Case Build#

After a new case is setup, the tool that builds the new case by compiling the code is case.build. This tool is located in the $CASEROOT directory.

CESM case.build

Figure: Detailed view of the location of case.build

Running this script results in the following actions:

  • Checks and creates final component namelists

  • Builds individual model component libraries

  • Builds the final CESM model executable

Command Syntax#

You should still be in the CASEROOT directory after running case.setup

cd /glade/work/$USER/cases/CASE

Example case.build command:

qcmd -- ./case.build

NOTE: Do not enter the example above at the command line. You will create your first case in the Exercise at the end of this section.

Click here for example output
Building case in directory /glade/u/home/$USER/cases/b.day1.0
sharedlib_only is False
model_only is False
Setting resource.RLIMIT_STACK to -1 from (-1, -1)
Generating component namelists as part of build
 - Prestaging REFCASE (/glade/p/cesmdata/cseg/inputdata/cesm2_init/b.e20.B1850.f19_g17.release_cesm2_1_0.020/0301-01-01) to /glade/scratch/$USER/b.day1.0/run
Copy rpointer /glade/p/cesmdata/cseg/inputdata/cesm2_init/b.e20.B1850.f19_g17.release_cesm2_1_0.020/0301-01-01/rpointer.ocn.restart
Copy rpointer /glade/p/cesmdata/cseg/inputdata/cesm2_init/b.e20.B1850.f19_g17.release_cesm2_1_0.020/0301-01-01/rpointer.ice
Copy rpointer /glade/p/cesmdata/cseg/inputdata/cesm2_init/b.e20.B1850.f19_g17.release_cesm2_1_0.020/0301-01-01/rpointer.lnd
Copy rpointer /glade/p/cesmdata/cseg/inputdata/cesm2_init/b.e20.B1850.f19_g17.release_cesm2_1_0.020/0301-01-01/rpointer.rof
Copy rpointer /glade/p/cesmdata/cseg/inputdata/cesm2_init/b.e20.B1850.f19_g17.release_cesm2_1_0.020/0301-01-01/rpointer.atm
Copy rpointer /glade/p/cesmdata/cseg/inputdata/cesm2_init/b.e20.B1850.f19_g17.release_cesm2_1_0.020/0301-01-01/rpointer.ocn.tavg.5
Copy rpointer /glade/p/cesmdata/cseg/inputdata/cesm2_init/b.e20.B1850.f19_g17.release_cesm2_1_0.020/0301-01-01/rpointer.glc
Copy rpointer /glade/p/cesmdata/cseg/inputdata/cesm2_init/b.e20.B1850.f19_g17.release_cesm2_1_0.020/0301-01-01/rpointer.ocn.ovf
Copy rpointer /glade/p/cesmdata/cseg/inputdata/cesm2_init/b.e20.B1850.f19_g17.release_cesm2_1_0.020/0301-01-01/rpointer.drv
Creating component namelists
   Calling /glade/work/$USER/code/cesm2.1.1/components/cam//cime_config/buildnml
     ...calling cam buildcpp to set build time options
CAM namelist copy: file1 /glade/u/home/$USER/cases/b.day1.0/Buildconf/camconf/atm_in file2 /glade/scratch/$USER/b.day1.0/run/atm_in 
   Calling /glade/work/$USER/code/cesm2.1.1/components/clm//cime_config/buildnml
   Calling /glade/work/$USER/code/cesm2.1.1/components/cice//cime_config/buildnml
     ...buildnml calling cice buildcpp to set build time options
   Calling /glade/work/$USER/code/cesm2.1.1/components/pop//cime_config/buildnml
     ... buildnml: calling pop buildcpp to set build time options
   Calling /glade/work/$USER/code/cesm2.1.1/components/mosart//cime_config/buildnml
   Running /glade/work/$USER/code/cesm2.1.1/components/cism//cime_config/buildnml 
   Calling /glade/work/$USER/code/cesm2.1.1/components/ww3//cime_config/buildnml
   Calling /glade/work/$USER/code/cesm2.1.1/cime/src/components/stub_comps/sesp/cime_config/buildnml
   Calling /glade/work/$USER/code/cesm2.1.1/cime/src/drivers/mct/cime_config/buildnml
Finished creating component namelists
Building gptl with output to file /glade/scratch/$USER/b.day1.0/bld/gptl.bldlog.230604-210323
   Calling /glade/work/$USER/code/cesm2.1.1/cime/src/build_scripts/buildlib.gptl
Building mct with output to file /glade/scratch/$USER/b.day1.0/bld/mct.bldlog.230604-210323
   Calling /glade/work/$USER/code/cesm2.1.1/cime/src/build_scripts/buildlib.mct
Building pio with output to file /glade/scratch/$USER/b.day1.0/bld/pio.bldlog.230604-210323
   Calling /glade/work/$USER/code/cesm2.1.1/cime/src/build_scripts/buildlib.pio
Component pio build complete with 2 warnings
Building csm_share with output to file /glade/scratch/$USER/b.day1.0/bld/csm_share.bldlog.230604-210323
   Calling /glade/work/$USER/code/cesm2.1.1/cime/src/build_scripts/buildlib.csm_share
Component csm_share build complete with 20 warnings
         - Building clm4_5/clm5_0 Library 
Building lnd with output to /glade/scratch/$USER/b.day1.0/bld/lnd.bldlog.230604-210323
Component lnd build complete with 6 warnings
clm built in 192.005673 seconds
Building atm with output to /glade/scratch/$USER/b.day1.0/bld/atm.bldlog.230604-210323
Building ice with output to /glade/scratch/$USER/b.day1.0/bld/ice.bldlog.230604-210323
Building ocn with output to /glade/scratch/$USER/b.day1.0/bld/ocn.bldlog.230604-210323
Building rof with output to /glade/scratch/$USER/b.day1.0/bld/rof.bldlog.230604-210323
Building glc with output to /glade/scratch/$USER/b.day1.0/bld/glc.bldlog.230604-210323
Building wav with output to /glade/scratch/$USER/b.day1.0/bld/wav.bldlog.230604-210323
Building esp with output to /glade/scratch/$USER/b.day1.0/bld/esp.bldlog.230604-210323
sesp built in 6.550780 seconds
mosart built in 134.204042 seconds
ww built in 138.574013 seconds
Component ice build complete with 1 warnings
Component ocn build complete with 11 warnings
cice built in 433.050327 seconds
pop built in 433.050846 seconds
Component glc build complete with 3 warnings
cism built in 465.060580 seconds
Component atm build complete with 14 warnings
cam built in 571.486847 seconds
Building cesm with output to /glade/scratch/$USER/b.day1.0/bld/cesm.bldlog.230604-210323 
Time spent not building: 13.730840 sec
Time spent building: 1073.152414 sec
MODEL BUILD HAS FINISHED SUCCESSFULLY

Notes:

  • Notice the ./ before any command run in the CASEROOT.

  • On NCAR HPC machines you must call the case.build using qcmd because it compiles the model on a compute node rather than a login node. This reduces the load on login nodes and prevents a timeout while you are building the model.

  • The output tells you if it was successful at the end: MODEL BUILD HAS FINISHED SUCCESSFULLY

Tips#

  • To completely rebuild a case, run ./case.build --clean-all first before building the model.

  • If you want to make any source code modifications in SourceMods, do this before building the model. We will cover SourceMods in a later section.

  • If you want to make any modifications to env_build.xml, do this before building the model.

  • If any input data is missing the build will abort but provide a list of missing files. To acquire missing data run ./check_input_data --download. This will download the required data and put it in the inputdata directory defined by the XML variable DIN_LOC_ROOT. After you have done these steps you can re-run the case.build script.