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

How do I change 2+ namelists with build_namelist?

How do I change more than one namelist with build_namelist?

For instance, suppose I want to change the driver stop_option, stop_n,
and the atmosphere CO2 mixing ratio.

I tried these five slightly different syntaxes:

1) -namelist "&seq_timemgr_inparm stop_option='nyears' stop_n=1 &cam_inparm co2vmr=734.0e-6"
2) -namelist "&seq_timemgr_inparm stop_option='nyears' stop_n=1, &cam_inparm co2vmr=734.0e-6"
3) -namelist "&seq_timemgr_inparm stop_option='nyears' stop_n=1","&cam_inparm co2vmr=734.0e-6"
4) -namelist "&seq_timemgr_inparm stop_option='nyears' stop_n=1" -namelist "&cam_inparm co2vmr=734.0e-6"
5) -namelist "&seq_timemgr_inparm stop_option='nyears' stop_n=1", -namelist "&cam_inparm co2vmr=734.0e-6"

With 1, 2, 3 build_namelist hangs and never returns.
With 4,5 build_namelist produces the namelists but doesn't apply the changes in the -namelist option.

Is there a way around?
Did I miss some detail in the syntax?

I could edit the namelists by hand instead.

Than you.
Gus
 

hannay

Cecile Hannay
AMWG Liaison
Staff member
Use:
$cfgdir/build-namelist -s -case casename -runtype initial
-namelist "&atm stop_option='nyears',stop_n=1,co2vmr=734.0e-6 /"

It will automically put the namelist variables in the appropriate namelists.
 

eaton

CSEG and Liaisons
Cecile has give the best solution. Here is some additional information:

Note that all five attempts contain incorrect namelist syntax: they all lack the final "/". Unfortunately the simple namelist parsing code that we're using is not reporting this fact. I'll add that to my list of future improvements.

Only one -namelist argument should be used. If multiple -namelist args are present only the final one will be recognized (assuming that it's value contains correct syntax).

It is possible to put multiple namelist groups in the -namelist value. But there is no advantage to doing so since build-namelist ignores the group names anyway. They are only required because the namelist parser requires valid namelist syntax. build-namelist is using a definition file to check user input and part of the definition of a namelist variable is the group it belongs to. build-namelist puts the variables in the correct group and writes the groups into the correct output files. This makes it much easier for the user to produce correct namelist files.
 
Thank you, Cecile and Brian.
Cecile's solution works perfectly.

I just noticed that I should have posted this question
on another forum: "Questions about the namelist".
Sorry for misplacing it.

Gus
 
Top