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

Modifying parameters in source code to be passed through namelist

Hi all, I am using CAM 5 standalone with cam4 physiscs. I have changed the zm_conv.F90 so that I can pass parameter tau(convective time scale) to be passed through namelist, similar to parameters c0_lnd,c0_ocn and ke. But upon comparing the two simulations :-1) with source code unchanged2) with source code changed to pass tau through namelist file atm_in, passing same value as in original code i.e 3600D0I found that there is a little difference in the two.Why is it so?I have checked if tau interacts with any other module, and I couldn't find any such interaction. Also I haven't changed the precision of the variable in source code. Thanks
 

rneale

Rich Neale
CAM Project Scientist
Staff member
I would expect 1 and 2 to give you the same result if the value is 3600 in both cases, so I am a confused about what you were expecting.Newer versions of the developers code already have tau passed through the namelist if you want to update your tag.Rich
 
Thanks Rich for your response,That's exactly my point. The two simulations should yield the same result, but it is not so. And I fail to understand why?My simulation period is 6 months which is quite small, does that lead the simulations to differ?Thanks
 
Hi all,I am attaching the changed zm_conv.F90 and the changed atm_in namelist. Perhaps this will help to answer the question.I have commented at all locations where I have made changes in zm_conv.F90, to see find tag KILLBILL at start of the comment.In the atm_in I have added the last two lines in the section zm_conv_nl as&zmconv_nl zmconv_tau             =  3600.0D0
 zmconv_capelmt         =  70.0D0to pass parameters through namelist.Again, just to reiterate, I can't figure why this change leads to a different simulation result.Thanks again
 

eaton

CSEG and Liaisons
Your change looks correct.  It is indeed surprising to have a change as simple as this result in a different simulation.  I think it's most likely that the change of capelmt from a parameter to a variable is the culprit here.  You could try just making the change to tau to see whether that gives you the result you expect.There are a couple of ways to convince yourself that the code is OK.  The easiest would be to run both the control and experiment with debug flags on.  The idea is that turning on debug should turn off the compiler optimization which is the only thing I can think of that could be causing the difference.  If the debug versions compare exactly then you can turn the optimization back on and have confidence that that is what is causing the difference.  We would expect the answer differences due to a roundoff level change from optimization not to be climate changing.The other more involved procedure would be to verify that the difference in the simulations is indeed due to a roundoff level change.  You can do this using the cam4 physics option and following the procedure for a perturbation growth test described here: http://www.cesm.ucar.edu/models/cesm1.0/cam/docs/port/
 
Thanks Eaton for your response,I will try the simulations with debug flag on and perturbation growth  soon.I would also like to report that I tried the simulation with individual parameters, i.e one parameter at a time. I found that even when I only changed the code for tau, the results weren't the same.Another thing I would like to report is that I tried providing the value tau=3600.0D0 and tau=3600D0. And capelmt in similar fashions. Even the simulation with these two ways of providing input, causing the simulations to differ.Please reply if this sheds any light on the matter.Thanks 
 

eaton

CSEG and Liaisons
No, I'm afraid this is as confusing as before.  It would be interesting to know what compute platform and compiler you're using, as well as the specific model configuration and how it's parallelized (task and thread counts).
 
I am sorry, I've made an error in reporting the results in the previous comment.I have rechecked and results and by entering the parameters tau = 3600.0D0 and tau = 3600D0, and similarly for capelmt, the results are same. I think this dispels the notion of precision of the parameter playing any role in the difference.The first result is correct though, that the simulation is different even if I change the code for tau only. 
 
Hi all,I think I have figured it out. As eaton suggested I ran the model with the debug flag on. It stopped giving the error of floating point exception. Then I went back again to the code zm_conv.F90 and noticed that the parameters passed through the namelist had to be broadcasted to other tasks. I hadn't noticed this before. So I added new parameters to be broadcasted too.
Now the simulation resultys are coming out the same.Thanks
 
Top