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

Help regarding adding a passive tracer into SCAM model

csp

CSP
Member
Dear experts,
I am trying to add a passive scalar into the SCAM model to check the effect of detrainment from the convective cloud (or convective scheme) to the stratus cloud (or large-scale scheme ). Could anyone please help? Any comment/suggestion would be appreciated, many thanks in advance.
 

jet

Member
This question really applies to CAM in general and will also hold for SCAM. It sounds like you would like to add a new tracer. If by passive you mean non advected field, you can register a new field to the physics_buffer (pbuf). The physics_buffer interface allows you to

add a field (returns an index that you can use to retrieve the field from the buffer later)
call pbuf_add_field('NPCCN', 'physpkg',dtype_r8,(/pcols,pver/), npccn_idx)

initialize a field
call pbuf_set_field(pbuf2d, npccn_idx, 0)

and retrieve a field from the buffer to modify or use in another routine or subsequent timestep given the field index
call pbuf_get_field(pbuf, npccn_idx, npccn)

or first retrieve the index first if it is not saved as a public module variable and then call pbuf_get_field.
npccn_idx = pbuf_get_index('NPCCN')

You can create fields with specific types (integer, real, etc.) and the returned field is generally a pointer.
real(r8), pointer :: npccn(:,:) ! number of CCN (liquid activated)

One of the nice things about using the physics buffer is that all fields are automatically saved and carried across model restarts.

There are many examples of creating and using pbuf fields in the model. Some of the NPCCN field examples above are from cesm2_2_0 in components/cam/src/physics/cam/microp_areo.F90. There are also discussions of using the physics_buffer in this forum (for example Questions on physics_buffer )

Hope this helps.

jt
 
  • Love
Reactions: csp

csp

CSP
Member
Many thanks, @jet (JT) for your help. I will try to implement this and will update this thread, highly appreciate your help!
 
Top