Hello,
I am trying to modify CAM (based off of git tag `cam6_3_139`) to implement an updated gravity wave parameterization in `src/physics/cam/gw_drag.F90`.
As part of my work I need to operate on some variables using the global grid rather than the chunked grid that has been scattered to various ranks/processes.
To my mind this would involve an `MPI_GATHER`, but I am unsure of the best way to go about doing this in CAM.
I have been looking at the routines in `src/physics/cam/phys_grid.F90`, specifically the `scatter_field_to_chunk` and `gather_chunk_to_field` subroutines and wonder if this is the approach I should be using?
Alternatively I can see that the `physics_state` type perhaps has options to init and access from the wider grid?
I have struggled to find documentation or examples for these, though my apologies if I have missed something obvious.
If anyone could provide advice or point me in the direction of some example code/documentation it would be greatly appreciated.
Apologies that my query is not brilliantly formulated, but I am not entirely sure where I should be looking.
Once I have a better idea I can try and refine it to make it easier to help.
Specifically I am working with `src/physics/cam/gw_drag.F90` to implement a new call to `gw_drag_prof` (source in `src/physics/cam/gw_common.F90`).
The current version of `gw_drag_prof` operates on a single column, so loops over the columns in the chunked section (`begchunk:endchunk`).
I am looking to incorporate non-locality, so want to gather the full grid of variables, not just the local one.
I think most of the variables I need come from a `physics_state` variable which I am hoping will allow me to access the wider data.
I am trying to modify CAM (based off of git tag `cam6_3_139`) to implement an updated gravity wave parameterization in `src/physics/cam/gw_drag.F90`.
As part of my work I need to operate on some variables using the global grid rather than the chunked grid that has been scattered to various ranks/processes.
To my mind this would involve an `MPI_GATHER`, but I am unsure of the best way to go about doing this in CAM.
I have been looking at the routines in `src/physics/cam/phys_grid.F90`, specifically the `scatter_field_to_chunk` and `gather_chunk_to_field` subroutines and wonder if this is the approach I should be using?
Alternatively I can see that the `physics_state` type perhaps has options to init and access from the wider grid?
I have struggled to find documentation or examples for these, though my apologies if I have missed something obvious.
If anyone could provide advice or point me in the direction of some example code/documentation it would be greatly appreciated.
Apologies that my query is not brilliantly formulated, but I am not entirely sure where I should be looking.
Once I have a better idea I can try and refine it to make it easier to help.
Specifically I am working with `src/physics/cam/gw_drag.F90` to implement a new call to `gw_drag_prof` (source in `src/physics/cam/gw_common.F90`).
The current version of `gw_drag_prof` operates on a single column, so loops over the columns in the chunked section (`begchunk:endchunk`).
I am looking to incorporate non-locality, so want to gather the full grid of variables, not just the local one.
I think most of the variables I need come from a `physics_state` variable which I am hoping will allow me to access the wider data.