The CESM1.3 POP2 FAQ
The CESM1.3 POP2 FAQ
Nancy J. Norton Susan Bates Michael Levy Gokhan Danabasoglu National Center for Atmospheric Research December 2013
Contents
- Introduction
- POP2 Forcing Questions
- Interannual Forcing (IAF) Compset Questions
- What are the interannual forcing (IAF) compsets?
- What are the COREv2 datasets?
- Where can I get the COREv2 data?
- What versions of CESM recognize the IAF compsets?
- If I create an IAF case on yellowstone, will it run out of the box?
- If I create an IAF case elsewhere, what do I need to do to get it to run?
- Tips for running interannually-forced cases: Specifically, what are the differences when running IAF cases with CESM1.1 release code and previous model versions?
- Configure- and Build-Time Questions
- Namelists
- What can I control by changing POP2 namelist variables?
- How do I change the value of a variable in a POP2 namelist?
- How do I change the POP2 timestep size?
- What can I control by changing variables in the tavg_nml namelist?
- How do I change the value of a variable in the POP2 tavg_nml namelist?
- How do I create daily time-averaged output variables?
- How do I create 5-day time-averaged output variables?
- Can I customize my CESM POP2 tavg output filenames?
- Initialization
- What is the startup/spunup initialization option in POP2?
- I want to initialize POP2 in a hybrid-start case with an old POP2 binary restart file. Will this work?
- Build
- Non-convergence, Timestep Size, and Other Run-Time Questions
- My job stopped running with a POP2 "error in solver" or "solver not converged" message. What should I do?
- POP2 stops with the error message "ERROR: k.e. > 100." What's the problem?
- If I decrease the POP2 timestep size to overcome an instability, how much of a reduction is reasonable?
- Why might the ocean model stop during initialization after I've modified the POP2 tavg_contents file?
- Why might the ocean model stop after running one month if I've modified the POP2 tavg_contents file?
- The CESM POP2 Output Files
- General
- What POP2 output files are produced in a CESM1 run?
- What are the POP2 "tavg files"?
- What are the POP2 restart files?
- What are the POP2 "rpointer files"?
- Time-Averaged History File Contents
- What's in the standard POP2 tavg output files?
- I want to reduce the size of the POP2 tavg output files. What strategies do you recommend?
- I want to reduce the size of the POP2 tavg output files by eliminating selected variables. Why do you recommend against this?
- But what if I really want to eliminate selected variables from the POP2 tavg output files? Is there anything I can do?
- How do I remove variables from the tavg output files?
- How do I add a POP2 variable to the tavg output files? Case 1 -- variable is already in the tavg_contents file
- How do I add a POP2 variable to the tavg output files? Case 2 -- code support already exists
- Are the variables in the POP2 tavg output files single or double precision?
- How can I create POP2 tavg output files with double-precision variables?
- Time-Averaged History File Control
- See the questions and answers about the tavg_nml namelist in the Configure and Build section
- Post Processing
- I deactivated the MOC computation during my $CASE execution. How do I compute the MOC after the run is completed?
- Is there a diagnostics package I can use to post-process output from my CESM1 POP2 case?
- Developer's Questions
All namelists except tavg_nml
The tavg_nml namelist
Introduction
This FAQ contains a compilation of common CESM1 POP2 user inquiries. It is intended to supplement the detailed usage information for CESM1 POP2 that can be found in the POP User's Guide. A general familiarity by the user of the the terminology and concepts in the CESM1 User's Guide is assumed.
POP2 Forcing
-
Is there an automatic option for setting up "hosing" experiments in POP2?
No.
Presently, there is no CESM POP2 "out-of-the-box" option to support hosing experiments, which are intended to model the climate effects from the addition of freshwater to an ocean region. However, the following general guidance may be useful to modellers interested in developing such experiments on their own.
Freshwater added at the ocean surface
The CESM POP2 forcing subroutines are rather complex and intertwined, with many dependencies among the forcing modules. For several years we have wanted to redesign these routines to cleanly support all of our forcing options, but resource limitations and higher priorities have prevented us from doing so.
Although a hosing option is not supported per se, it is very likely that all the elements that one would need are already in the code. However, we do not recommend activating these by trial-and-error namelist modifications, because this approach may have some unintended consequences that may not be apparent to the casual user.
Instead, we recommend the following: If you want to perform hosing experiments in fully coupled simulations, you can modify forcing_coupled.F90 module. The specific subroutine that needs to be modified is pop_set_coupled_forcing. Essentially, you need to add the "hosing" virtual salt fluxes to the following segment in proper units:
!$OMP PARALLEL DO PRIVATE(iblock) do iblock = 1, nblocks_clinic STF(:,:,2,iblock) = RCALCT(:,:,iblock)*( & (PREC_F(:,:,iblock)+EVAP_F(:,:,iblock)+ & MELT_F(:,:,iblock)+ROFF_F(:,:,iblock)+IOFF_F(:,:,iblock))*salinity_factor & + SALT_F(:,:,iblock)*sflux_factor) enddo !$OMP END PARALLEL DO
If you plan to use time-independent perturbations, these can be incorporated in this subroutine. The grid information is already accessible from this module, so you can define a geographic region.
If you plan to use a time-dependent perturbation, this gets a bit complicated. You can create a netCDF file and read it in the pop_init_coupled subroutine. Then, the field needs to be interpolated in time. For both reading the data set and time interpolation, you can mimic what is done elsewhere in other CESM POP2 forcing subroutines.
Freshwater added below ocean surface
If you want to add the freshwater at depth, then you may not need to modify the surface flux subroutines. The POP2 model allows interior restoring of T and S, the so-called robust diagnostics technique. The idea is to add source terms to the model T and S equations at any depth range, at any strength, and at any place you want. These can be time-dependent as well. So, take a look at forcing_s_interior.F90, where you should be able to incorporate your fluxes fairly easily.
Interannual Forcing (IAF) Compsets
-
What are the interannual forcing (IAF) compsets?
The interannual forcing (IAF) compsets are those compsets that use the data atmosphere model (datm) to provide CESM1 ocean-only(C), ice-only(D), or ocean-ice(G) cases with forcing from version 2 of the Coordinated Ocean-ice Reference Experiments (COREv2) datasets.
The IAF compsets include
- CIAF (active-ocean-only with interannual forcing)
- DIAF (active-ice-only with interannual forcing)
- GIAF (active-ocean-ice with interannual forcing)
-
What are the COREv2 datasets?
For additional information on the COREv2 forcing datasets, see http://www.clivar.org/organization/wgomd/resources/core/core-ii
-
Where can I get the COREv2 data?
If you are running IAF cases on the NCAR machine yellowstone, you do not need to download the COREv2 data.
If you are running IAF cases elsewhere, you do. See the full CESM1.2 instructions below.
-
What versions of CESM recognize the IAF compsets?
The IAF compsets are available in the CESM Release Version 1.0.4 (CESM1.0.4) and higher, including all versions of CESM1.1 and CESM1.2.
-
If I create an IAF case on yellowstone, will it run out of the box?
Yes, as long as you use CESM1.0.4 or higher, or any version of CESM1.1 or CESM1.2, to create your case.
-
If I create an IAF case elsewhere, what do I need to do to get it to run?
Before you can set up and run your IAF case on a machine other than NCAR's yellowstone, you will need to first download the forcing datasets onto your own disk location, then make modifications to the CESM so that it knows how to locate the data.
You will be downloading a lot of data (~85-90 Gbytes), so make sure your disk is large enough to hold all of the data. Also, this disk must be visible from your case's execution directory.
Here's how you can do this:
- Download your own copy of CESM1.2 (or higher versions) from the CESM website (follow the CESM Releases link from the main page ). The location where you download the code is called your $CCSMROOT directory.
- Download the interannual data (COREv2) from the GFDL website (http://data1.gfdl.noaa.gov/nomads/forms/mom4/COREv2.html). You want to download the "un-Corrected" data. When using the CESM, corrections to the data are made within the data atmosphere, so please be sure to get the uncorrected data. To learn more about this data, see the GFDL website.
- Let the model know where the downloaded files from the previous step reside:
- Change all occurrences of the string '/ccsm/ocn/iaf' in the
/$CCSMROOT/models/atm/datm/bld/datm.template.streams.xml
file (there are 10 of them) to match the directory name where you put your data. Do this BEFORE you issue the create_newcase command. This way, any case you create from this $CCSMROOT will find the data. - Let the model know where the
CORE2.t_10.ArcFactor.T62.1997-2004.nc file resides. In the
same file that you previously edited,
$CCSMROOT/models/atm/datm/bld/datm.template.streams.xml,
find the filename and change the directory listed three lines above this (in between theindicators) to match the directory where you put your downloaded data. - Issue the create_newcase command, referencing an IAF compset, from your modified $CODEROOT/scripts directory. Configure, build, and submit your job as usual. If you have followed the above steps, your new IAF cases will be configured to properly run on your machine.
-
What are the differences when running IAF cases with CESM1.1 or CESM1.2 release code and previous model versions?
TIPS FOR RUNNING INTERANNUALLY-FORCED CASES
Because a user can run a simulation using any number of years from the IAF data, there are two subtle issues that can potentially affect a user. This first will be encountered if you are performing a comparison between cases in which you have used different cycle lengths to force the model. The second will be encountered if you are branching a new simulation from a simulation that was forced with a different cycle length.
Because the IAF data now extend two more years (to 2009 rather than 2007), a user may easily encounter these two issues when using the default setup for the model. The examples below show ways to avoid mismatches between simulations using the new, 62-year data and simulations using the older, 60-year long data; however, these same principles may be applied to any simulations in which the forcing cycle length may differ. These examples also illustrate how to create simulations with varying forcing cycle lengths.
COMPARISON
Be aware that any new CESM1.1- or CESM1.2- release generated simulations have longer cycles (1948-2009) than simulations generated by older model versions, whose cycles include 1948-2007. If you would like to use the CESM1.2 release to compare with an older (pre CESM1.1) simulation, you can use the new code and force it to cycle over 1948-2007. To do this, input stream information into the user_nl_d*** files as indicated below.
Here are the changes you need to add to user_nl_datm (for CIAF,GIAF,and DIAF):
streams = "datm.streams.txt.CORE2_IAF.GCGCS.PREC $STARTYEAR 1948 2007", "datm.streams.txt.CORE2_IAF.GISS.LWDN $STARTYEAR 1948 2007", "datm.streams.txt.CORE2_IAF.GISS.SWDN $STARTYEAR 1948 2007", "datm.streams.txt.CORE2_IAF.GISS.SWUP $STARTYEAR 1948 2007", "datm.streams.txt.CORE2_IAF.NCEP.DN10 $STARTYEAR 1948 2007", "datm.streams.txt.CORE2_IAF.NCEP.Q_10 $STARTYEAR 1948 2007", "datm.streams.txt.CORE2_IAF.NCEP.SLP_ $STARTYEAR 1948 2007", "datm.streams.txt.CORE2_IAF.NCEP.T_10 $STARTYEAR 1948 2007", "datm.streams.txt.CORE2_IAF.NCEP.U_10 $STARTYEAR 1948 2007", "datm.streams.txt.CORE2_IAF.NCEP.V_10 $STARTYEAR 1948 2007", "datm.streams.txt.CORE2_IAF.CORE2.ArcFactor $STARTYEAR 1948 2007", "datm.streams.txt.presaero.clim_2000 1 1 1"
Here are the changes you need to add to user_nl_dice (only for CIAF):
streams = "datm.streams.txt.CORE2_IAF.GCGCS.PREC $STARTYEAR 1948 2007",
Here are the changes you need to add to user_nl_drof (for CIAF,GIAF,and DIAF):
streams=''drof.streams.txt.rof.diatren_iaf_rx1 $STARTYEAR 1948 2007''
where $STARTYEAR is your model start year. If you are branching from a older model version simulation, please see #2b below.
BRANCHING
If you are branching a new IAF case using CESM1.2 from an IAF case run with an older, pre-CESM 1.1 model version, the reference years for the data will be different. For example, the five cycles will correspond to model years as follows:
Cycle Older Model Versions CESM1.1 1 years 1-60 years 1-62 2 years 61-120 years 63-124 3 years 121-180 years 125-186 4 years 181-240 years 187-248 5 years 241-300 years 249-310 Let's say that you are going to re-run Cycle 5 of a previous run with some changes using the new code. The model reference year is 241, which corresponds to 1948 in the older versions. The $RUN_REFDATE in env_run.xml will need to be set to 0241 so that the model reads the correct restart files (from the old simulation); however, because the new code has the above reference years for the cycles, 241 would correspond to data year 2002, rather than 1948. To correct this, you must make the corresponding stream changes (see COMPARISON CAVEAT above) to the user_nl_datm, user_nl_dice, user_nl_docn, and user_nl_drof (depending on compset) using a $STARTDATE corresponding to the CESM1.1 data reference years.
This modification ONLY applies if you are branching from a simulation created with an older version of the model. If you are running a 'startup' simulation with the CESM1.2 release, this modification is not needed.
Configure- and Build-Time Questions
Namelists
-
What can I control by changing POP2 namelist variables?
In POP2, namelists are generally organized so that each Fortran module reads from its initialization routine a namelist specific to that module. The CESM1 POP2 namelist file, pop2_in, contains a collection of all of the namelists for the POP2 model as it is configured in your $CASE.
Full documentation for the POP2 namelists can be found distributed throughout the CESM1 POP User's Guide, and a full list of the contents of the pop2_in file can be found in the POP2 namelist documentation. Note that the latter documentation is presently incomplete; our intention is to update it as time and resources allow.
-
How do I change the value of a variable in a POP2 namelist?
In CESM1.2, all models use a component-specific version of the CESM build-namelist utility to generate each component's input namelist file. One benefit of using the common build-namelist utiliy is that you can easily change a component's namelist settings by making simple changes to the user_nl_${component} text files that reside in your case directory.
So to modify the value of a CESM1 POP2 variable, add
var_name&namelist_name = var_value
to $CASEROOT/user_nl_pop2 and then run the preview_namelist command. The namelist that was generated by invoking preview_namelist can be viewed in $CASEROOT/CaseDocs/pop2_in, where you can verify that your change was made.
If you do not know what namelist the variable you are changing belongs to, you can simply add
var_name = var_value
instead, but be aware that some variable names appear in multiple namelists, and in those cases, omitting &namelist_name will result in an error message.
A full list of variables that can be edited in user_nl_pop2 is available here.
There is one exception to this process. The present build-namelist procedure is not capable of properly handling all of the interactions of the options in the tavg_nml namelist's variable streams with all of the POP2 model options, so if you want to change the value of a CESM1 POP2 tavg_nml namelist variable, you must follow a different procedure instead. See the instructions in this document, or follow the streamlined version which appears at the top of your $CASEROOT/user_nl_pop2 file.
-
How do I change the POP2 timestep size?
To change the size of the POP2 timestep, you simply change the value of dt_count in your $CASE/user_nl_pop2 file.
To decrease the POP2 timestep, you must increase the POP2 time_manager_nml namelist variable dt_count.
For example, if the ocean grid in your case is gx1v6, then the default value for dt_count is 23. In order decrease the timestep by roughly 15%, you would increase dt_count to 26. To do this, put the following line in your $CASE/user_nl_pop2 file:
dt_count = 26You do not need to rebuild the executable in order to change dt_count.
Recommendations on the limits of timestep reduction appear in the Runtime section of this document.
-
What can I control by changing variables in the tavg_nml namelist?
The POP2 tavg_nml namelist contains variables that control many aspects of the time-averaged history file output ("the tavg files"), including the time-averaging frequency of variables, the frequency of time-averaged output files, the number of time-averaged output "streams", and some aspects of the time-averaged output filenames. See the CESM1 POP User's Guide for a complete description of the options available to the user and the "POP2: TAVG Settings" section of the POP2 namelist documentation.
Some features and options available to the user through the tavg_nml namelist controls include:
- timeseries files, in which output files contain averaged variables at multiple time levels per file
- support for the creation of up to nine simultaneous tavg output streams generated during a single model run, each with its own contents, time-averaging frequency, and bundling options
- an offset date specification, which allows finer control over the tavg_freq and tavg_freq_opt options
- the option for a one-time header, in which all time-invariant information is written into the first tavg file of each stream, at the beginning of each run segment, and then omitted from all subsequent files in that stream for the remainder of the run segment
-
How do I change the value of a variable in the POP2 tavg_nml namelist?
In CESM1.2, all components use a component-specific version of the CESM build-namelist utility to generate the component's namelist.
However, the underlying CESM1 common build-namelist scripts cannot properly handle all of complexity introduced by the options in the tavg_nml variable streams and their interactions with various POP2 modelling options, so in order to change the values of tavg_nml variables, you must follow a different procedure instead. This procedure is outlined in the comment section at the top of your $CASE/user_nl_pop2 file and is also explained here.
Process for changing CESM POP2 tavg_nml namelist variables:
- cd $CASEROOT/SourceMods/src.pop2
- cp $CODEROOT/ocn/pop2/input_templates/ocn.base.tavg.csh .
If at any point during the execution of your $CASEROOT you will be using the CESM1 POP2 ecosystem model, iage, or cfcs, then you should also copy their ocn.*.tavg.csh scripts. That is,
cp $CODEROOT/ocn/pop2/input_templates/ocn.${subm}.tavg.csh . where $subm = any or all of the values [ecosys,iage,cfc] - edit the ocn.*.tavg.csh scripts to make your changes
- cd $CASEROOT
- ./preview_namelist
- confirm your changes are correct by viewing $CASEROOT/CaseDocs/pop2_in
-
How do I create daily time-averaged output variables?
Out of the box, the CESM1 POP2 model is configured to write a recommended group of time-averaged ocean-model variables into a pre-determined number of files (the "tavg" files). By default in the gx* resolutions, three groups, or "streams," of tavg files are produced during each model run: one set of output files containing monthly averaged variables, another set of output files containing a small number of daily averaged variables, and one file containing time-invariant variables written at the beginning of the run.
For more details on time-averaged output, read the questions and answers in the Time-Averaged History File Contents section of this FAQ.
If you only want to change the averaging frequency of the primary POP2 time-averaged output variables (the variables written to the $CASEROOT.pop.h.yyyy-mm.nc files) from monthly to daily, then all you need to do is make one simple change in the tavg_nml namelist.
However, as previously discussed, the process for changing tavg_nml variables is non-standard. To create daily averages of the primary POP2 time-averaged output variables, follow the general steps for modifying the tavg_nml namelist variables.
When you reach the step in which you edit your $CASEROOT/SourceMods/ocn.base.tavg.csh script, find the block that corresponds to your case's resolution ('gx*' for the gx1v6 and gx3v7 grids; 'tx*' for the tx0.1v2 grid) and then change the line that controls the averaging frequency of the variables. Using the gx* block as an example, you would change the first element of the tavg_freq_opt namelist array from:
tavg_freq_opt = 'nmonth' 'nday' 'once' to tavg_freq_opt = 'nday' 'nday' 'once'
If you make no other changes, the result will be a timeseries of daily averaged variables bundled into monthly files with filenames of the form $CASE.pop.h.yyyy-mm.nc. If instead you want to create individual files, one for each day of the year, then you must also make a change to the line that controls the output frequency of the tavg files. Again using the gx* block as an example, you would change the first element of the tavg_file_freq_opt namelist array from:
tavg_file_freq_opt = 'nmonth' 'nmonth' 'once' to tavg_file_freq_opt = 'nday' 'nmonth' 'once'
If you make this change to the first element of tavg_file_freq_opt to 'nday', then your $CASE will generate daily files with filenames of the form: $CASEROOT.pop.h.yyyy-mm-dd.nc.
Note that daily time-averaged output, bundled as a timeseries of daily averages or written to individual files, will not work as-is with the POP2 diagnostics package. You will first need to create monthly averages from your daily average files before you can use the diagnostics package.
-
How do I create 5-day time-averaged output variables?
First, read the discussion on how to create daily averaged output, because what you want to do is nearly the same.
If you want to create 5-day averages of the primary POP2 time-averaged output variables, you will need to make changes to the tavg_nml namelist. follow the general steps for modifying the tavg_nml namelist variables, making these four changes to the appropriate resolution-dependent block of your $CASEROOT/SourceMods/ocn.base.tavg.csh script:
-
average variables over 5-day intervals:
-
change tavg_freq_opt = 'nmonth' 'nday' 'once' to tavg_freq_opt = 'nday' 'nday' 'once'
-
change tavg_freq = 1 1 1 to tavg_freq = 5 1 1
and create one file every five days:
-
change tavg_file_freq_opt = 'nmonth' 'nmonth' 'once' to tavg_file_freq_opt = 'nday' 'nmonth' 'once'
-
change tavg_file_freq = 1 1 1 to tavg_file_freq = 5 1 1
Because you are modifying the default tavg output stream, you cannot change the filename to reflect the 5-day averaging interval. However, with these modifications, you will generate tavg output files every five days, and each file will contain five-day averages of the standard POP2 tavg output variables.
Output filenames will be $CASE.pop.h.yyyy-mm-dd.nc, where the dd values are offset from one another by a difference of five.
You are cautioned that these files will not work with the standard CESM POP2 diagnostics package, which uses as input monthly averages of the standard tavg output variables.
-
-
Can I customize my CESM POP2 tavg output filenames?
No and yes.
No, you cannot change the name of the default POP2 tavg output stream, even though reviewing the tavg_nml namelist inputs would lead you to think that you could. Why? We decided that maintaining backwards compatability with older cases and with the built-in assumptions in the POP2 ocean diagnostics package were very important, and thus the name of the first (default) tavg output file should remain consistent with its previous naming convention: $CASE.pop.h.yyyy-mm.nc. Therefore, we wrote the POP2 model code so that it intentionally ignores the first element of the variable array tavg_stream_filestrings. As a result, if you try to change the name of the default file, you will see no effect.
Yes, you can customize the names of all but the default POP2 tavg output file. Just follow the procedure to change variables in the tavg_nml namelist, and then edit the second through last values of the variable array tavg_stream_filestrings in your ocn.*.tavg.csh script file.
For example, suppose you want to rename the daily (second) POP2 tavg output file from its default name,
$CASE.pop.h.nday1.yyyy-mm-dd.nc to $CASE.pop.h.daily.yyy-mm-dd.nc.
Follow the instructions for changing the tavg_nml namelist, and at the step where you edit the ocn.base.tavg.csh script, find the block that corresponds with your case's resolution and change the line:
tavg_stream_filestrings = 'nmonth1' 'nday1' 'once' to tavg_stream_filestrings = 'nmonth1' 'daily' 'once'
Initialization
-
What is the startup/spunup initialization option in POP2?
The startup/spunup initialization option is a specialized active-ocean model suboption available in the CESM1.2 POP2 model which can be used only in conjunction with a CESM "startup" case; it is not designed to work with "hybrid" or "branch" cases.
The recommended method for initializing the CESM active ocean model (POP2) in a CESM startup case is to use the default settings; these initialize the ocean model from Levitus initial conditions and a state of rest. Occasionally, however, researchers are interested in a startup run in which only the ocean model is initialized from a "spun up" ocean condition generated from a previous CESM run. To accommodate their request, a nonstandard method of initializing POP2 in a startup case was developed. It is called the startup_spunup option. It is a research option that is designed for use by expert users only.
Because of the complex interactions between the ocean-model parameterizations used to generate the spun-up case and those used in the new startup case, it is impossible to provide a single recommended spun-up ocean initial condition for all circumstances. Instead, researchers must carefully select an existing solution whose case conditions closely match those in the new case. A mismatch of options between the spun-up case and the new case can result in scientifically invalid solutions.
Instructions on the use of this option appear in the CESM1 User's Guide "Use Cases and FAQs section."
-
I want to initialize POP2 in a hybrid-start case with an old POP2 binary restart file. Will this work?
Yes.
When you set up your hybrid case, just make sure that you put the binary restart file and the corresponding "header" and "rpointer" files into your execution directory.
That is, you must have the following three files, all generated at the same POP2 case at the same model time, in your execution directory:
$CASE.pop.r.yyyy-mm-dd-sssss $CASE.pop.r.yyyy-mm-dd-sssss.hdr rpointer.ocn.restart
Upon initial execution of your hybrid case, the ocean model will read the rpointer.ocn.restart file and determine from it that the restart file's format is binary. Because it knows that the restart format is binary, the ocean model will then read the header file and the binary restart file correctly.
Note that unless you make changes to the POP2 restart_nml namelist, POP2 in your new run will generate output restart files in the netCDF format, not binary.
Build
-
What is the meaning of the "pop decomp not set" build-time error message?
If you create any CESM1 $CASE configured with the active ocean model (POP2), use only the default ("out-of-the-box") CESM1 settings, and then build your $CASE on a tested machine, you should not encounter a build-time error.
However, if you decide to customize your $CASE by changing the number of PE's assigned to POP2, your build might fail with the "pop decomp not set" error message.
Why? Because sometimes a decomposition cannot be found for the given pop grid resolution and number of PE's.
The decomposition is set using two different tools. First, a user-defined decomposition might exist for the given grid and pe count in your $CASE/Buildconf/pop_decomp.xml file. This tool was contributed by a member of the CESM community and is undocumented, but by studying the supported decompostions in this file, you should be able to modify this file to support additional PE/decomposition choices. If a decomposition is not found there, then the pop decomp script ($CASE/Buildconf/generate_pop_decomp.pl) attempts to generate one automatically. In some instances, both those methods will fail, a decomp will not be found, and you will see the error message, "pop decomp not set".
As a user, you can also overwrite the default decomposition by changing POP_AUTO_DECOMP to false in env_build.xml and then setting the env variables POP_BLCKX, POP_BLCKY, POP_MXBLCKS, and POP_DECOMPTYPE manually in the same file.
Note that not all decompositions make sense for the POP2 model, particularly those that result in subdividing the POP2 grid into very small subdomains, because at some point, the boundary calculations will dominate the interior computations. Also note that our general recommendation is to try to define decompositions that result in subdomains that are square or nearly so.
All namelists except tavg_nml
The tavg_nml namelist
Non-convergence, Timestep Size, and Other Run-Time Questions
-
My job stopped running with a POP2 "error in solver" or "solver not converged" message. What should I do?
If your case has been running successfully for a period of time, but then the ocean model suddenly fails to converge, you might have encountered a time-stepping instability. If so, you will need to decrease the ocean timestep and restart your case. We recommend you back up at least one month prior to the time of nonconvergence, decrease the ocean-model timestep by about 15-20%, and then restart your case.
See |Section 4|Running CESM|The run|Restarting a run in the CESM1.2 User's Guide for details on how to restart your run.
If, however, your model stops with a solver error message very early in your model run, a timestepping instability is less likely to be the cause. Many times when the run fails with an ocean nonconvergence error, particularly early in the model run, the ocean-model solver cannot converge because it has received bad boundary conditions passed from another model. In this situation, the user should investigate what is being passed to the ocean and perhaps write high-frequency output to help diagnose the problem.
-
POP2 stops with the error message "ERROR: k.e. > 100." What's the problem?
POP2 monitors the kinetic energy diagnostic during a model run. When the kinetic energy grows too large, the model shuts down, as you have discovered in your run.
If your case has been running successfully for some period of time before POP2 detects that K.E. is too large, that usually indicates you've encountered a CFL problem, which can usually be solved by reducing the ocean-model timestep by about 20%.
If, on the other hand, this problem occurs within days, or even steps, after ocean-model initialization, this usually indicates that the forcing coming into POP2 is way too strong, undefined, or otherwise "un-earthlike," which is usually caused by user setup error.
If you are using non-standard initial conditions or forcing in your case, it is most likely that you are forcing the POP2 model unrealistically. If this is your situation, you will need to correct the problems with your initial conditions or forcing before continuing your run.
-
If I decrease the POP2 timestep size to overcome an instability, how much of a reduction is reasonable?
Generally speaking, if your run has encountered a CFL-type instability, then decreasing the POP2 timestep by 15-20% should, under most circumstances, be sufficient to overcome the problem, assuming that you restart your run a month or so prior to the "blowup."
If this approach is successful, then you might consider increasing the ocean timestep back to its original value after you have run about a year or so with the reduced timestep.
If this approach is not successful, then you might find that decreasing the timestep by another 10% or so would be enough to overcome the instability.
However, in most cases, we do not recommend that you reduce your timestep much more than about 30%. If you have reduced your timestep by ~30% and your case still "blows up," it is most likely that something else is wrong with your run.
Two exceptions to this advice are:
- during the spin-up phase of a high-resolution (0.1o) ocean case, when significant timestep-size reductions may be necessary to overcome initial adjustments.
- in some highly customized paleo experiments. Consultation with paleo experts is advised.
Note that if you reduce your POP2 timestep, you may need to adjust your job's runtime limit, because the ocean model will take longer to run. Although you may also find that your case is now not optimally balanced, we recommend against making any changes to your PE layout to compensate, because this will create bit-level changes in your model solutions.
-
Why might the ocean model stop during initialization after I've modified the POP2 tavg_contents file?
You can eliminate any of the variables in the list shown in the Time-Averaged History Output section from your tavg history files by modifying your tavg_contents file, and the POP2 model will run just fine. However, if you decide to eliminate any variables that are not on the list, the POP2 model might stop during its initialization phase. Why?
The POP2 initial.F90 module contains a handful of subroutines that control the intialization of all POP2 modules, and as a result, it knows about all of the POP2 options and related variables that you've activated for your case. At the end of the final POP2 initialization routine, an inter-module consistency checking subroutine, POP_check, is called. Using the model-wide information available to it, this routine identifies some -- but not necessarily all -- inconsistencies among the various options selected in your case.
If any inconsistencies are detected, the POP_check routine will print messages in the ocn.log and/or ccsm.log files, and if the problem is a fatal error, POP_check will cause the ocean model to shut down, thus preventing the user from running an incorrectly specified case. POP_check is the subroutine that generates errors about missing UISOP or other variables, and it is the routine that will prevent your case from running beyond the ocean-model initialization phase.
-
Why might the ocean model stop after running one month if I've modified the POP2 tavg_contents file?
MOC and northward transport errors will only occur after the model has run to the point at which a time-averaged history file is to be generated, which typically occurs at the end of the first month.
Why would the error occur then?
Because the variables MOC, N_HEAT, and N_SALT are calculated from other time-averaged quantities, which must be available prior to the MOC, N_HEAT, and N_SALT computations. So if you have chosen to compute MOC, N_HEAT or N_SALT, but you have chosen not to keep a time-averaged variable that is needed in the calculation, the model will fail when it tries to compute MOC, etc.
Presently, there are no checks in place that will detect this particular inconsistency prior to the point at which you try to compute these variables, because of complexities in the way the time-averaging and these particular model diagnostics interact. As some users have noted, this is different from the way some other models handle their variables, which we understand makes it more difficult for new CESM users.
The CESM1 POP2 Output Files
General
-
What POP2 output files are produced in a CESM1 run?
During the course of its execution, CESM POP2 will produce restart, history, pointer, diagnostic, and log output files. These files will appear in your case's execution directory, and their filenames follow the CESM output-file naming conventions.
In particular, the standard CESM POP2 model produces the following files:
- log files:
- ocn.log.yymmdd-sssss output log (text) files
- diagnostics files:
- ${CASE}.pop.dd* general diagnostics
- ${CASE}.pop.do* overflows
- ${CASE}.pop.dt* transport
- ${CASE}.pop.dv* velocity
- time-averaged history files:
- ${CASE}.pop.h* (the "tavg" files)
- restart files:
- ${CASE}.pop.r.* model variables
- ${CASE}.pop.rh.* time-averaged history
- ${CASE}.pop.ro.* overflows
- restart pointer files:
- rpointer.ocn.restart.*
- rpointer.ocn.tavg.*
- rpointer.ocn.ovf.*
See the Model diagnostics and output section of the CESM POP2 User's guide for information on the diagnostics, history, and restart files and their configurable options.
NOTE: Unlike the LANL version of POP2, the CESM POP2 model does not, by default, generate instantaneous "snapshot" (*.s.* files). This is intentional; the CESM POP2 model does not support this option.
-
What are the POP2 "tavg files"?
The time-averaged history output files produced by the CESM1 POP2 model are commonly referred to as "the tavg files."
See tavg-specific questions in this FAQ and also the Model diagnostics and output:Model output files:Time-averaged history files subsection of the CESM POP2 User's guide for more information on the tavg files.
-
What are the POP2 restart files?
The CESM1 POP2 model restart files contain a snapshot of all model variables that are necessary to exactly restart the model from a previous run segment. These files are, by default, generated in the netCDF file format. However, the user may configure the CESM1 POP2 model so that it produces restart files in the native machine binary format. If the binary file format ('bin') is chosen, two restart files will be created: the actual binary data file and an accompanying text "header" file (suffix ".hdr").
See the Running POP:Initializing the model state:Restart control subsection of the CESM POP2 User's guide for more information on the restart files.
-
What are the POP2 "rpointer files"?
During execution, CESM1 component models periodically create restart files that allow that component to exactly restart. At the same time, the component models also create one or more ascii files that contain, at a minimum, the names of these restart files and may, additionally, contain other identifying information.
These files are called the "rpointer" (sometimes just "pointer") files, because their filenames all begin with the prefix string "rpointer," and they are the files that CESM component models read when resuming a $CASE's execution.
CESM1 POP2 creates the following three rpointer files whenever an ocean-model restart file is generated:
- rpointer.ocn.restart contains the name and the file format (binary or netCDF) of the ocean model restart file.
- rpointer.ocn.tavg contains the name of the file needed to continue an averaging interval that may have been interrupted at the end of the previous run segment. This file will always exist, and should be present in your execution directory, but its contents will only be read if the previous time-averaging interval spans model shut-down.
- rpointer.ocn.ovf contains the name of the file needed to continue a a case in which the overflows parameterization is active.
Time-Averaged History File Contents
-
What's in the standard POP2 tavg output files?
Out of the box, the CESM1 POP2 model is configured to write a recommended group of time-averaged ocean-model variables into a pre-determined number of files (the "tavg" files). By default in the gx* resolutions, three groups, or "streams," of tavg files are produced during each model run: one set of output files containing monthly averaged variables, another set of output files containing a small number of daily averaged variables, and one file, which is generated once, at the beginning of the run, containing a few 3D time-invariant variables.
By default, the daily averaged variables are bundled into monthly timeseries files. These files are relatively small, because they contain only a handful of 2D variables. Out of the box, these variables are: Surface Potential Temperature (SST), SST2, Mixed-Layer Depth, and Maximum Mixed-Layer Depth.
The monthly averaged files are the largest files, because they contain many variables, several of which are full 3D variables. For a complete list of the variables contained in these files, you can look at the $CODEROOT/models/ocn/pop2/input_templates/${resolution}_tavg_contents file. Also see the POP2 User's Guide for a list of variables that could be added to your output file and see the section in this FAQ for how to add a tavg variable to your output files.
Because of the monthly files' large size and monthly frequency, a user may be tempted to try to reduce the size of the POP2 output files by eliminating variables from these files. But see the next question...
-
I want to reduce the size of the POP2 tavg output files. What strategies do you recommend?
We know that the size of the POP2 tavg files can be significant when your storage space is limited, so we understand why you might want to reduce the size of these files.
If large file size is a problem, you might consider the following:
- Create annual averages instead of monthly averages.
- Compress the tavg files.
This can be a useful strategy during the early years of a long spin-up run, because often you will not be analyzing monthly or seasonal variations during the spin-up phase of your simulation.
Obviously, this is a quick way to reduce your POP2 tavg output file size by a factor of 12. But do consider the scientific rationale for your case before deciding on this option.
Compressing the ocean history files is a fairly effective way of reducing the file size, because of all of the land points. For example, using gzip to compress a standard gx1v6 POP2 *pop.h.* file reduces the size by 60%. However, note that compression is often a time-consuming process and it may not be practical to do this on your system. We recommend that you try compressing a single tavg file and timing the process before committing to this strategy.
Although there are plans for an autmoatic file compression option in future CESM releases, for now you would need to develop your own process for compression.
Also consider your usage of these files after you have compressed them. A new version of the CESM POP2 post-processing software automatically detects and uncompresses gzip'd files, but this process can potentially slow the post processing considerably.
-
I want to reduce the size of the POP2 tavg output files by eliminating selected variables. Why do you recommend against this?
We do not recommend eliminating variables from the POP2 monthly tavg history files if you are running cases for scientific studies.
Why? Because the variables on the monthly tavg files have been carefully selected to provide a full scientific picture of the ocean-model solutions. These variables are essential input to the standard CESM ocean-model post-processing diagnostics tools. If you plan to use these tools on your nonstandard, reduced-field files, they will likely fail because required variables are missing from your tavg output files. If you have eliminated variables from your tavg files and the post-processing tools fail, you are on your own.
Furthermore, the tavg-history file variables are tied to various pre-set POP2 run-time diagnostics settings; removing variables will often result in model shut-down because of inconsistent diagnostics settings and tavg-history-file field availablility. Eliminating variables from the tavg files then becomes a rather frustrating trial-and-error hunt for what "works." We do not recommend this approach.
-
But what if I really want to eliminate selected variables from the POP2 tavg output files? Is there anything I can do?
We repeat: we do not recommend eliminating variables from the POP2 monthly tavg history files if you are running cases for scientific studies.
But if you insist, we have identified variables that, if removed from the tavg_contents file, will not cause the model to stop with an error message during initialization or run time.
In particular, if you are not planning to analyze ocean mixing, you might try eliminating some or all of the following variables. Eliminating all of them will reduce the size of each monthly tavg history file by approximately 45%.
Note that the ocean-model diagnostics post-processing package will fail when these variables are not available in the monthly tavg files, and you will be on your own if this happens.
- KAPPA_ISOP
- KAPPA_THIC
- HOR_DIFF
- PV
- KVMIX
- TPOWER
- KVMIX_M
- VVC
- VDC_T
- VDC_S
- UVEL2
- VVEL2
- WVEL2
- Q
- UET
- UES
- WTT
- WTS
-
How do I remove variables from the tavg output files?
Assuming you understand and accept the consequences of eliminating variables from the tavg output files (see related questions above), you can follow the steps below to comment out and thereby eliminate variables from your tavg output files. See above for a list of 3D mixing variables that you could, under certain circumstances, decide to eliminate.
You need to be generally familiar with CESM1 and its terminology for the following instructions to make sense:
- cd $CASE/SourceMods/src.pop2
- cp $CODEROOT/ocn/pop2/input_templates/${OCN_RES}_tavg_contents .
- edit $CASE/SourceMods/src.pop2/${OCN_RES}_tavg_contents, replacing the leading "1" character of each variable with the comment symbol, "#"
- configure and build $CASE, if you haven't already done so
- if you have already configured and built $CASE, just submit your job -- the new job will use the new ${OCN_RES}_tavg_contents to determine which tavg variables are active.
-
How do I add a POP2 variable to the tavg output files? Case 1 -- variable is already in the tavg_contents file
First, search for your model variable in the CESM POP2 ${RESOLUTION}_tavg_contents file. If you find the variable in the file, then all you need to do is uncomment it and run your case.
Here's an example of this scenario:
Suppose you are interested in putting the maximum value of temperature over an averaging interval into a POP2 time-averaged output file in your gx1v6 ocean-resolution case. You search the gx1v6_tavg_contents file, and you find TEMP_MAX, but it is preceeded by the pound sign (#), which is a comment symbol in the tavg_contents file. This means that TEMP_MAX will not be written to your tavg output files, unless you uncomment it. Uncommenting the line is simple; here's what you need to do:
- $cd $CASE/SourceMods/src.pop2
- cp $CODEROOT/models/ocn/pop2/input_templates/gx1v6_tavg_contents .
- change following line in your gx1v6_tavg_contents file:
# TEMP_MAX to 1 TEMP_MAX
- run your $CASE (no rebuild is necessary)
If you follow these steps, you will find TEMP_MAX in your $CASE.pop.h.yyyy-mm.nc files.
-
How do I add a POP2 variable to the tavg output files? Case 2 -- code support already exists
Suppose you want to add a CESM POP2 variable to your tavg output files. You've already confirmed that the variable is not in the tavg_contents file, so here's what you should do:
First, search the CESM POP2 Fortran modules to see if your variable, VARNAME, is a model variable. If the model variable exists, then search the code to see if there is a tavg "handle" (tavg_VARNAME) associated with that model variable. If so, you're in luck; all you need to do is add the tavg variable name to the tavg_contents file.
For example, suppose you are interested in putting the time average of RHOU, the product of potential density and the U velocity, into a POP2 time-averaged output file in your gx1v6 ocean-resolution case. You've already searched the gx1v6_tavg_contents file, so you know RHOU is not there. So you next search the POP2 modules, and you find references to the variable RHOU and its tavg handle, tavg_RHOU, in the advection.F90 module. This is good news, because all you need to do to accomplish your goal is to add RHOU to your tavg_contents file:
- $cd $CASE/SourceMods/src.pop2
- cp $CODEROOT/models/ocn/pop2/input_templates/gx1v6_tavg_contents .
- add the following line to your gx1v6_tavg_contents file:
1 RHOU
- run your $CASE (no rebuild is necessary)
If you search the CESM POP2 Fortran modules and find your variable, but you do not find the tavg "handle" for that variable, you will need to modify the POP2 code. See the Developers section of this document for information on how to do this.
-
Are the variables in the POP2 tavg output files single or double precision?
By default, all POP2 tavg output variables are created in single precision (netCDF "float").
-
How can I create POP2 tavg output files with double-precision variables?
By default, all POP2 tavg output variables are created in single precision (netCDF "float"), which is usually appropriate and sufficient for scientific analysis.
Sometimes, however, a user might want to generate double-precision tavg variables (netCDF "double"), perhaps for short debugging runs or other special-purpose situations. If so, and if the doubled file size is not a problem, you can follow these steps to generate the double-precision tavg variables:
- create_newcase -case $CASE ...
- cd $CASE
- cesm_setup
- add this line:
set pop2defs = "$pop2defs -DTAVG_R8"
to the $CASE/Buildconf/pop2.buildexe.csh script,
just prior to the gmake command.
- build and run $CASE
Note that if you have already built the executable for an existing case and then decide that you want double-precision pop2 history variables, you must rebuild your case after you modify Buildconf/pop2.buildexe.csh. But before you do, you should ensure that the previous ocean executable has been removed. See the CESM1 ./$CASE.clean_build documentation in the CESM1 User's Guide section titled, "Rebuilding the Model."
- cd $CASE
- ./$CASE.clean_build
- add this line:
set pop2defs = "$pop2defs -DTAVG_R8"
to the $CASE/Buildconf/pop2.buildexe.csh script,
just prior to the gmake command.
- rebuild and run $CASE
Post Processing
-
I deactivated the MOC computation during my $CASE execution. How do I compute the MOC after the run is completed?
There is "off-line" post-processing code written in NCL that computes the MOC using POP2 output files. This post-processing tool will work with the newer CESM code and with either the gx* or tx0.1v2 grids. With some modifications, this code can also be made to work with CCSM3 POP1 output as well.
The documentation for that code is here: http://www.ncl.ucar.edu/Document/Functions/Built-in/moc_globe_atl.shtml
The documentation also includes an example NCL script to make use of this function.
-
Is there a diagnostics package I can use to post-process output from my CESM1 POP2 case?
The CESM Ocean Model Working Group (OMWG) has diagnostics packages to assess both spatial and temporal characteristics of ocean model simulations. We perform such assessments routinely for output from both forced ocean and fully-coupled experiments. The use of these packages includes evaluating the validity and climate state of a particular coupled model simulation, assessment of whether new capabilities in any component model, when coupled to the entire coupled model system (i.e., a new model code base), have impacted the ocean, and validating long coupled control simulations.
We expect to announce a new version of the OMWG diagnostics package with feature enhancements by the end of 2013.
See the CESM Ocean Component (POP2) Metrics and Diagnostics page for a discussion of the POP2 diagnostics.
Developer's Questions
-
How do I add a POP2 variable to the tavg output files?
Case 3 -- no code support existsFirst, search the CESM POP2 Fortran modules to see if your variable, VARNAME, is a model variable. If the model variable exists, but the tavg "handle" (tavg_VARNAME) associated with the model variable does not, you will need to add new code to the POP2 model.
Suppose you are interested in putting the time average of the U velocity at level five into a POP2 time-averaged output file. You've already searched the gx1v6_tavg_contents file, but U velocity at level five is not on the list. Next, you've searched the POP2 modules, and although you found references to UVEL, tavg_UVEL, tavg_U1_8, and lots of tavg_U* variables, you've found nothing that looks like U velocity at level five.
Because under this scenario you have not found what you want, you will need to modify the POP2 code. Note that in this example, you could also just extract level five from the 3D UVEL that is already written out to the $CASE.pop.h.yyyy* file, but let's just go with this example for now, assuming that you have good reason to want just U velocity at level five as a separate output variable.
In adding support for new tavg output variables, it is easiest to mimic developments for similar variables, so let's use tavg_U1_8, the vertical average of U velocity over model levels one through eight, as our template. To instrument the POP2 code to write out our new varible, U velocity at level five, do the following:
- $cd $CASE/SourceMods/src.pop2
- cp $CODEROOT/models/ocn/pop2/source/baroclinic.F90 .
- edit baroclinic, using tavg_U1_8 as a guide, adding the following lines in the appropriate places:
integer (int_kind) :: tavg_U5_5 ! U velocity in layer five call define_tavg_field(tavg_U5_5,'U5_5',2, & long_name='Zonal Velocity lvls 5-5', & units='centimeter/s', grid_loc='2221') if (k == 5) & call accumulate_tavg_field(UVEL(:,:,k,curtime,iblock),tavg_U5_5,iblock,k)
- cd $CASE
- build (or rebuild), then run your $CASE
- examine your $CASE.pop.h.yyyy-mm.nc file, where you should find your new variable, U5_5.
-
As a POP2 developer, how do I add a new POP2 namelist to the build-namelist procedure?
There are two files that you must modify in order to introduce a new namelist into the POP2 build-namelist procedure, and then there are two options for how to populate the namelist.
Suppose you have introduced the following namelist into the POP2 source code:
real (r8) :: varname1 logical (log_kind) :: varname2 integer (int_kind) :: varname3 character (char_len) :: varname4 character (char_len) :: varname5 character (char_len) :: varname6 namelist / abc_nml / & varname1, & varname2, & varname3, & varname4, & varname5, & varname6
To illustrate many different ways to handle values, we also work under the following assumptions:
- varname4 is a regular string,
- varname5 depends on a CESM environment variable, and
- varname6 is a filename for something located in the inputdata/ directory that is only used for a specific resolution.
You will need to make the following changes to models/ocn/pop2/bld/ (or in $CASEROOT/SourceMods/src.pop2) to have &abc_nml appear in pop2_in:
1. Edit namelist_files/namelist_definition_pop2.xml
You need to add definitions to namelist_files/namelist_definition_pop2.xml for all 6 of the &abc_nml variable names.
NOTES:
- In this file, the Default: value is for documentation purposes only. It has NO effect on the actual setting of the variable value in the pop2_in file.
- The entry for varname6 uses the attribute input_pathname="abs" to add the path of the CESM inputdata root directory.
--- begin addition to namelist_definition_pop2.xml ---
<!-------------------------------------> <!---group abc_nml ----> <!-------------------------------------> <entry id="varname1" type="real" category="pop2" group="abc_nml" > A brief description about varname 1. Default: </entry> <entry id="varname2" type="logical" category="pop2" group="abc_nml" > A brief description about varname 2. Default: </entry> <entry id="varname3" type="integer" category="pop2" group="abc_nml" > A brief description about varname 3. Default: </entry> <entry id="varname4" type="char*256" category="pop2" group="abc_nml" > A brief description about varname 4. Default: </entry> <entry id="varname5" type="char*256" category="pop2" group="abc_nml" > A brief description about varname 5. Default: </entry> <entry id="varname6" type="char*256" category="pop2" group="abc_nml" input_pathname="abs" > A brief description about varname 6. Default: </entry>
--- end addition to namelist_definition_pop2.xml ---
2. Edit build-namelist
You need to add abc_nml to the build-namelist groups array (search for the string "my @groups"; you want the one with the comment "Set namelist groups to be written out"). This tells build-namelist that &abc_nml should appear in pop2_in. Note that the order of the listing in @groups determines the order that the namelists appear in pop2_in.
--- begin addition to build-namelist ---
my @groups = qw(domain_nml ... abc_nml ... passive_tracers_on_nml);
--- end addition to build-namelist ---
While these first two steps tell the build-namelist script that &abc_nml exists and contains varname1 ... varname6, it does not actually add anything to pop2_in. There are two different ways to populate the namelist:
3.1 Short-term solution (user_nl_pop2)
After you create and configure your case, set all 6 variables in user_nl_pop2 by adding the following lines:
varname1 = 0.5 varname2 = .true. varname3 = 15 varname4 = "abc123" varname5 = "/dir/otherdir/netcdf_file.nc" varname6 = "/glade/p/cesm/cseg/inputdata/other_netcdf_file.nc"
This is the "short-term" solution because it requires updating user_nl_pop2 every time you create a new case that needs to read &abc_nml. It is a good way to run tests while you decide what variables need to be in &abc_nml, but it is not a permanent plan.
NOTE:
- You must specify the full pathname for varname6 in this case because build-namelist will not prepend "$DIN_LOC_ROOT/" to the value (and "$DIN_LOC_ROOT" will NOT be interpretted correctly from the user_nl_pop2 file, so you must type the path explicitly).
3.2 Long-term solution (use the namelist_defaults_pop2.xml file)
You can set default values in namelist_files/namelist_defaults.xml and then call the add_defaults() routine in build-namelist to read these values and add them to pop2_in. Sometimes variables need to be set directly by the add_defaults() routine, these should not included in the defaults file. In this simple example, varname5 is one such variable.
NOTE:
- Dependencies on grids should be specified in the defaults file rather than in build-namelist (functionally there is no difference but reducing the amount of logic tests in build-namelist both makes the script easier to read and reduces the likelihood of introducing a bug).
--- begin addition to namelist_defaults_pop2.xml ---
<!----------------------------> <!--abc_nml --> <!----------------------------> <varname1>0.5</varname1> <varname2 ocn_grid="gx3v7" >.false.</varname2> <varname2 ocn_grid="gx1v6" >.true. </varname2> <varname2 ocn_grid="tx1v1" >.false.</varname2> <varname2 ocn_grid="tx0.1v2">.false.</varname2> <varname3>15</varname3> <varname4>abc123</varname4> <varname6 ocn_grid="gx1v6">input_file.nc</varname6>
--- end addition to namelist_defaults_pop2.xml ---
--- begin addition to build-namelist ---
################################## # namelist group: abc_nml # ################################## add_default($nl, 'varname1'); add_default($nl, 'varname2'); add_default($nl, 'varname3'); add_default($nl, 'varname4'); add_default($nl, 'varname5', 'val'=>"${RUNDIR}/${output_d}o"); add_default($nl, 'varname6','nofail'=>1); if (not $nl->get_value('varname6')) { add_default($nl, 'varname6', 'val'=>'unknown_abc_cell','noprepend'=>1); }
--- end addition to build-namelist ---
2013-10-09 (njn01)