Hi,
I am adding some code to OpenIFS and I want to know how to get the connectivity information of neighbouring grid-points? I understand how to get the latitude/longitude position of each gridpoint but not locate the gridpoints around this point.
Thanks.
4 Comments
Glenn Carver
Hi,
Difficult question.
In the IFS we do the grid-point computation independently from the neighbours. All horizontal derivatives are pre-computed and available at the entire grid-point. This is part of the code efficiency.
There are however places in the code telling you about the neighbours. Those are interpolation stencils of semi-Lagrangian (SL) space and FULLPOS (post-processing). The use of those structures however requires MPI communications.
Can you perhaps re-formulate your problem in the way to be more compliant with the IFS data-flow? What do you want to know from the neighbouring points?
The best way would be to go to the SL space (especially the PB1 buffers which are designed for interpolation). There the neighbours are defined through indirect addressing. When you are on one processor you have the access to the whole globe there.
(with thanks to Filip Vana for the answer)
Ryan Harry
When you say 'the SL space' what does that mean in terms of the code? Different arrays? Or only possible from certain parts of the code?
Glenn Carver
The way the fields are decomposed in the IFS, they do not know how to get to their neighbouring points. You could write some tools to do this for you but not sure anything like that is available.
The SL space are set of a specific arrays maintained at the level of
GP_MODEL.
They need to be filled at the level ofCPG_DYN
and then are passed toCALL_SL
where they are used. Their purpose is twofold:1/ In this structure you have tools giving you the values of the neighbours.
2/ For each
NPROMA
chunk they maintain the availability of all neighbouring points (i.e. halo) regardless of whether the computation there might be already completed (by other independentNPROMA
chunk).In reality this means when you want to do it for a specific quantity, you need to:
1/ define it in the SL structure (i.e. create and setup an adequate space in the SL buffer)
2/ fill the structure
3/ treat the upper and lower bounds there (i.e. provide some values)
4/ access it through the SL tools.
The beauty is that the SL structure takes care about the halo and parallel aspects for you. Though it still requires some coding.
Hope this gets bit clearer now.
(with thanks to Filip for providing this answer)
Ryan Harry
Yes, thanks (and to Filip)