Scheduled Downtime
On Tuesday 24 October 2023 @ 5pm MT the forums will be in read only mode in preparation for the downtime. On Wednesday 25 October 2023 @ 5am MT, this website will be down for maintenance and expected to return online later in the morning.
Normal Operations
The forums are back online with normal operations. If you notice any issues or errors related to the forums, please reach out to help@ucar.edu

adding heating to physpkg routine

hi,

I am running CCSM4 and I have implemented additional heating profiles as a tendency in the CAM routine phys_run2 located in physpkg.F90. I now have made a separate file containing these heating profiles that I would like to read in and use. My question is where is the best place to do this? I dont want to read the file in every time I enter the routine phys_run2. Can I read the file in the routine phys_init and then declare the heating with the "save" statement. If I do this, do I have to declare the heating profile variable outside the "contains" part of the routine or can I just save it in phys_init?

Is there a better way to do this, like somehow use the buffers to save and recall it? Im not sure how to do this latter approach. Any advice you can give me would be greatly appreciated. Thanks!

Cara-Lyn
 

eaton

CSEG and Liaisons
I'll try to give some ideas about how to hack this as easily as possible...

I'm assuming that you don't need to do any time or spatial interpolation of the data you read in. Then the hard part is knowing how to read the data from a presumably 3D field in the dataset and distribute it to the "chunk" data structure used by the physics. You could create your own module that is responsible for reading this data and storing it so that it is available via use association where you need it. The module data needs to contain an index with dimensions begchunk:endchunk because each mpi task will process this subset of the total number of chunks in the grid. Make this public module data. The module will contain an "init" subroutine which should be called from phys_init. This subroutine will read the global field and scatter it to the chunks. The subroutine that is used for this is in the phys_grid module: scatter_field_to_chunk. So you read the 3D field on the masterproc only, then call scatter_field_to_chunk from all processes. This will distribute the 3D global data to the chunks in each process. Assuming that this chunked data is publicly accessible from your module you can access it wherever you need it via use association.
 
Top