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

Changing the frequency of calling the ZM scheme

Dear CAM users,
As a part of a study , I need to call the ZM scheme once in 3 timesteps, whereas the hack scheme will be called every timestep. To implement it what I have done is : the subroutine zm_convr is called from tphysbc as usual, but inside zm_convr I have put a condition that all the calculations will be carried out only if nstep is a multiple of 3 else it should use the output of the previous timestep. Again in the subroutine zm_evap, I check the hackflag alongwith the timestep number, to decide whether there will be any evaporation or not. If the hackflag is true, the evaporation calculations are carried out whereas if it is false, the output from the previous timestep are repeated.
While running the model it shows "significant energy and water conservation errors", and then there is a segmentation fault and the model stops.
The following is the error:

H_DEFINE: Successfully opened netcdf file
nstep, te 1 3303241608.55618477 -56.4380632074673940 0.563410444660671691E-02 98449.8678402549122
significant conservations error energy after zm_evap count 1 nstep 1 chunk 193 col 1
3432303598.99614239 3432294251.60643768 0.000000000000000000E+00 -9347.38970448169857 -9347.38970448169857 -0.272335748721009053E-05
significant conservations error water after zm_evap count 2 nstep 1 chunk 193 col 1
13.6635202481566260 13.6605878625277590 0.000000000000000000E+00 -0.293238562886678853E-02 -0.293238562886678853E-02 -0.214614211828947248E-03

Can anyone tell me where exactly I am making a mistake. Also, if there is a simpler way to do the same thing.


Thanks in Advance,
sans
 

pjr

Member
sans said:
Dear CAM users,
As a part of a study , I need to call the ZM scheme once in 3 timesteps, whereas the hack scheme will be called every timestep. To implement it what I have done is : the subroutine zm_convr is called from tphysbc as usual, but inside zm_convr I have put a condition that all the calculations will be carried out only if nstep is a multiple of 3 else it should use the output of the previous timestep. Again in the subroutine zm_evap, I check the hackflag alongwith the timestep number, to decide whether there will be any evaporation or not. If the hackflag is true, the evaporation calculations are carried out whereas if it is false, the output from the previous timestep are repeated.
While running the model it shows "significant energy and water conservation errors", and then there is a segmentation fault and the model stops.
The following is the error:

H_DEFINE: Successfully opened netcdf file
nstep, te 1 3303241608.55618477 -56.4380632074673940 0.563410444660671691E-02 98449.8678402549122
significant conservations error energy after zm_evap count 1 nstep 1 chunk 193 col 1
3432303598.99614239 3432294251.60643768 0.000000000000000000E+00 -9347.38970448169857 -9347.38970448169857 -0.272335748721009053E-05
significant conservations error water after zm_evap count 2 nstep 1 chunk 193 col 1
13.6635202481566260 13.6605878625277590 0.000000000000000000E+00 -0.293238562886678853E-02 -0.293238562886678853E-02 -0.214614211828947248E-03

Can anyone tell me where exactly I am making a mistake. Also, if there is a simpler way to do the same thing.


Thanks in Advance,
sans
Hi Sans,

It is hard to guess precisely what is going on from your description. You say that you want to use the values from the previous timestep. Can you explain how you did this? The thing to realize is that you will need to put in some explicit code to remember the previous value. The natural mechanism to do this is to use the "physics buffer" and to define the information that you are
storing there so that it persists across timesteps.

Schematically what you want to do is the following

if (mod(nstep-1,0) == 0) then
do the normal calculation of physics tendencies, cloud heights, precip rates, etc) from zhang scheme
store the results in pbuf
else
extract the information from pbuf into the variables containing physics tendencies, cloud heights, precip rates, etc
endif
call physics_update

Make sense?

Of course you need to also add code to define the space that you want to use in pbuf, etc.

Phil

The thin
 
Dear Phil,
Thanks a lot for your kind suggestions.
To use the values from the previous timestep, what I did is the following:

1) I decalred a new variable for each corresponding output variables (of subroutine zm_convr), inside the subroutine zm_convr, by using a SAVE attribute in the declaration.

2) Starting from the first timestep, I store the values of the output variables in the corresponding new variables, and then in the second and third timesteps, I assign the values of these new variables to the original output variables, instead of allowing the subroutine to calculate them.

Please do let me know if there is any mistake in the process I have followed.

Also, I will try doing it again using the physics buffer.

Thanks and Regards,
sans
 

hannay

Cecile Hannay
AMWG Liaison
Staff member

Code:
<a name="54">The ZM scheme is called at every physics timestep.</a>

Code:
 

Code:
<a name="54">But you could change the convective time scale <br />tau <br />in zm_conv.F90.<br /><br /><br /></a>
 
Thank you. Follow your response, does it mean though the ZM scheme is called at each physics time step, the tau (convective time scale, currently it is 3600s in CAM6) determines the lifecycle of a convection, which may span several physics time steps?If tau is set to be smaller, say, 2400s, then probably 3 convections will be triggered within 7200s. And only 2 convections will be triggered within 7200s if tau=3600s? Thanks,Lin
 
Top