CESM3 Case Setup: Configuration With Cam6_4_129
This article provides a detailed guide on setting up and configuring a CESM3 (Community Earth System Model version 3) case, specifically using the cam6_4_129 version. This configuration is crucial for climate research and simulations, allowing scientists to model and understand various aspects of the Earth's climate system. Whether you're a seasoned climate modeler or just starting, this step-by-step guide will walk you through the process.
Understanding the Case Details
Before diving into the setup, let's break down the specifics of the case. The case we're discussing is:
Case Name: f.e30.FHISTC_WAsc.ne30pg3_mg17_L135_cam6_4_129_beres0.15
This name encodes a wealth of information:
f.e30: Denotes the framework and resolution.FHISTC_WAsc: Represents the compset, indicating a historical simulation with specified atmospheric conditions.ne30pg3_mg17: Describes the grid resolution.L135: Specifies the number of vertical levels in the atmosphere.cam6_4_129: Indicates the version of the Community Atmosphere Model (CAM) used.beres0.15: Refers to a specific parameter setting related to the Beres cloud microphysics scheme.
Keywords: 1deg, CESM3, WACCM7, SE, 135L, effgw_beres_dp=0.15
These keywords highlight key aspects of the simulation:
1deg: Approximate horizontal resolution.CESM3: The model version.WACCM7: The specific configuration of the Whole Atmosphere Community Climate Model.SE: Spectral Element dynamical core.135L: 135 vertical levels.effgw_beres_dp=0.15: Parameter setting for the effective gravity wave scheme.
Directory Structure:
- Case Dir:
/glade/u/home/mijeong/cesm3/cases/$CASE- Where the case is created and managed. - Run Dir:
/glade/derecho/scratch/mijeong/$CASE/run- Where the simulation runs and output is generated. - Archive Dir:
/glade/campaign/acom/acom-climate/mijeong/archive/$CASE- Where the simulation output is archived for long-term storage.
Having a clear understanding of these details is essential for proper setup and execution of the CESM3 case. The case name itself acts as a concise summary of the simulation's configuration, allowing researchers to quickly identify and replicate specific setups. The directory structure is crucial for managing the large amounts of data generated by climate simulations. By organizing the case, run, and archive directories effectively, users can ensure that their simulations are reproducible and that their data is readily accessible for analysis. Furthermore, understanding the keywords associated with the case helps in categorizing and searching for specific types of simulations within a broader research context.
Cloning CAM and Updating Fleximod
Cloning the CAM Repository
The first step involves cloning the specific version of the Community Atmosphere Model (CAM) from the ESCOMP GitHub repository. This ensures you're working with the exact version used for this case.
cd /glade/work/mijeong/cesm_tags
git clone https://github.com/ESCOMP/CAM.git -b cam6_4_129 cam6_4_129
cd cam6_4_129
Here's a breakdown of the commands:
cd /glade/work/mijeong/cesm_tags: Navigates to the directory where you want to store the CAM source code.git clone https://github.com/ESCOMP/CAM.git -b cam6_4_129 cam6_4_129: Clones the CAM repository, specifically thecam6_4_129branch, and names the local directorycam6_4_129.cd cam6_4_129: Enters the newly cloned CAM directory.
Updating Fleximod
Fleximod is a tool used to manage modifications to the CAM source code. Updating it ensures that you have the latest changes and bug fixes.
bin/git-fleximod update
This command updates the Fleximod configuration within the CAM directory. The use of Git for version control is fundamental in scientific computing, as it allows for tracking changes, collaborating with others, and reverting to previous states if necessary. Cloning the repository ensures that you have a local copy of the code, which can be modified and experimented with without affecting the central repository. Specifying the branch (-b cam6_4_129) is crucial for reproducibility, as it ensures that all users are working with the same version of the code. Additionally, keeping Fleximod up-to-date is essential for managing modifications to the model code, such as bug fixes or enhancements. By following these steps, researchers can establish a solid foundation for their modeling work, ensuring that they are working with a well-defined and manageable codebase.
Creating the New Case
Accessing Derecho
To proceed, you need to access the Derecho supercomputer, where the simulation will be run.
ssh derecho
This command establishes a secure shell connection to the Derecho system.
Navigating to the CIME Scripts Directory
Next, navigate to the directory containing the CIME (Common Infrastructure for Modeling the Earth) scripts, which are used to create and manage CESM cases.
cd /glade/work/mijeong/cesm_tags/cam6_4_129/cime/scripts
This command changes the current directory to the location of the CIME scripts within the CAM directory.
Creating the Case
Now, you can create the new case using the create_newcase script.
./create_newcase --case /glade/work/mijeong/cesm3/cases/f.e30.FHISTC_WAsc.ne30pg3_mg17_L135_cam6_4_129_beres0.15 --compset FHISTC_WAsc --res ne30pg3_ne30pg3_mg17 --machine derecho --project P93300007 --run-unsupported --pecount 5400
Let's break down the options used in this command:
--case: Specifies the path and name for the new case directory.--compset: Defines the compset (component set), which determines the model components and their configurations.FHISTC_WAscindicates a historical simulation with specific atmospheric conditions.--res: Sets the resolution for the model components.ne30pg3_ne30pg3_mg17defines the horizontal and vertical grid resolutions.--machine: Specifies the machine on which the simulation will be run (Derecho).--project: Provides the project code for resource allocation.--run-unsupported: Allows the case to run even if it's not officially supported on the machine.--pecount: Sets the processor count for the simulation.
Setting Up the Case
After creating the case, navigate into the case directory and run the case.setup script.
cd /glade/work/mijeong/cesm3/cases/f.e30.FHISTC_WAsc.ne30pg3_mg17_L135_cam6_4_129_beres0.15
./case.setup
This script prepares the case for building and running, setting up the necessary directory structure and configuration files. The create_newcase script is a fundamental tool in the CESM workflow, as it automates the process of setting up a new simulation. By providing various options, such as the compset, resolution, and machine, users can tailor their simulations to specific research questions and computational resources. The case.setup script is equally important, as it finalizes the case configuration, ensuring that all necessary files and directories are in place. Together, these scripts streamline the process of setting up a CESM simulation, allowing researchers to focus on the scientific aspects of their work rather than the technical details of model configuration.
Editing and Verifying Namelist Settings
Understanding Namelists
Namelists are Fortran-style input files that control various aspects of the model's behavior. Editing and verifying these settings is crucial for tailoring the simulation to your specific needs. The primary namelist for CAM is user_nl_cam.
Key Namelist Settings
Here are some of the key namelist settings used in this case:
fincl1,fincl2,fincl3: These lists specify the output variables to be saved at different frequencies. Understanding these variables is vital for analyzing simulation results.fincl1includes variables like atmospheric composition (ACTNI,ACTNL), aerosol properties (AODDUST,BURDENBC), cloud characteristics (CLDHGH,CLDLOW), and radiative fluxes (FLDS,FLNS).fincl2focuses on dynamical variables (OMEGAU,OMEGAV), fluxes (SHFLX,LHFLX), and atmospheric state (U,V,T,Q).fincl3includes instantaneous values of key atmospheric variables at specified intervals.
interpolate_output = .true.,.true.,.true.: This setting enables interpolation of output data to a common grid, simplifying analysis.mfilt = 1,1,1: This parameter controls the frequency of output, with smaller values indicating more frequent output.nhtfrq = 0,0,-24: Specifies the output frequency in hours. A negative value indicates that the output is an average over the specified interval.effgw_beres_dp = 0.15D0: This parameter sets the value for the effective gravity wave dissipation parameter in the Beres microphysics scheme. This value is crucial for controlling the simulation's behavior in the upper atmosphere.
Importance of Variable Selection
The fincl settings are particularly important, as they determine the amount and type of data saved during the simulation. Carefully selecting the output variables is essential for balancing the need for comprehensive data with the computational cost of storing and processing large datasets. For example, including variables related to aerosols and clouds (ACTNI, CLDHGH) is important for studying atmospheric composition and cloud processes, while variables like radiative fluxes (FLNS, FSNT) are crucial for understanding the energy budget of the climate system. Similarly, the choice of output frequency (nhtfrq) affects the temporal resolution of the data, with more frequent output allowing for the study of short-term variability and less frequent output being suitable for long-term trends. By carefully configuring these settings, researchers can ensure that their simulations generate the data needed to address their specific research questions.
Making XML Changes
Understanding XML Change
The xmlchange command is a powerful tool for modifying the case configuration through XML files. This method is used to set various simulation parameters, such as the run dates, stop options, and output settings.
Key XML Changes
Here are the key XML changes made in this case:
./xmlchange RUN_REFDATE=1980-01-01: Sets the reference date for the run../xmlchange RUN_STARTDATE=1980-01-01: Sets the starting date for the simulation../xmlchange STOP_OPTION=nmonths: Specifies that the simulation will run for a certain number of months../xmlchange STOP_N=12: Sets the number of months to run (12 in this case)../xmlchange CONTINUE_RUN=FALSE: Indicates that this is not a continuation run../xmlchange RESUBMIT=9: Sets the number of times the job will be resubmitted if it fails../xmlchange DOUT_S_SAVE_INTERIM_RESTART_FILES=TRUE: Enables saving interim restart files, which are crucial for restarting the simulation if it's interrupted../xmlchange DOUT_S_ROOT=/glade/campaign/acom/acom-climate/mijeong/archive/$CASE: Sets the root directory for output archiving../xmlchange DOUT_S=TRUE: Enables output archiving../xmlchange JOB_WALLCLOCK_TIME=07:00:00 --subgroup case.run: Sets the wall clock time for the main run job (7 hours)../xmlchange JOB_WALLCLOCK_TIME=00:20:00 --subgroup case.st_archive: Sets the wall clock time for the archiving job (20 minutes).
Importance of Configuration Settings
The xmlchange commands are fundamental for controlling the overall behavior of the simulation. Setting the RUN_REFDATE and RUN_STARTDATE correctly ensures that the simulation starts from the desired initial conditions. The STOP_OPTION and STOP_N parameters define the duration of the simulation, which is crucial for addressing specific scientific questions. Enabling interim restart files (DOUT_S_SAVE_INTERIM_RESTART_FILES=TRUE) is a best practice, as it allows the simulation to be restarted from a previous state in case of interruptions, saving valuable computational time. The DOUT_S_ROOT and DOUT_S=TRUE settings ensure that the simulation output is archived in a designated location, making it accessible for analysis. Finally, setting the JOB_WALLCLOCK_TIME for the run and archiving jobs is essential for managing computational resources effectively and ensuring that the jobs complete within the allocated time. By carefully configuring these settings, researchers can optimize their simulations for both scientific accuracy and computational efficiency.
Building and Submitting the Case
Building the Case
After making the necessary XML changes, the next step is to build the case. This compiles the model and creates the executable.
./case.build
This command initiates the build process, which may take some time depending on the complexity of the model and the available computational resources.
Checking Workflow Settings
Before submitting the case, it's essential to check the env_workflow.xml file for clock settings. This file controls the timing and scheduling of various tasks within the simulation.
Check env_workflow.xml for clock settings
Ensure that the clock settings are appropriate for your simulation duration and output frequency.
Setting Wall Clock Time
Set the wall clock time for the run and archive jobs using the xmlchange command.
./xmlchange JOB_WALLCLOCK_TIME=07:00:00 --subgroup case.run
./xmlchange JOB_WALLCLOCK_TIME=00:20:00 --subgroup case.st_archive
These commands set the maximum time allowed for the run and archive jobs, respectively. The wall clock time should be set based on the expected runtime of the simulation and the available computational resources.
Previewing Namelists and Run Script
Before submitting the case, it's a good practice to preview the namelists and run script to ensure that all settings are correct.
./preview_namelists
./preview_run
These commands display the contents of the namelists and the run script, allowing you to verify the configuration before submitting the job.
Submitting the Case
Finally, submit the case to the queuing system.
./case.submit
This command submits the simulation job to the scheduler, which will run the simulation when resources are available. The case.build command is a critical step in the CESM workflow, as it translates the model's source code into an executable that can be run on the target machine. The build process involves compiling the Fortran code, linking libraries, and creating the necessary executables. Before submitting the case, checking the env_workflow.xml file ensures that the simulation's timing and scheduling parameters are correctly configured. Previewing the namelists and run script using ./preview_namelists and ./preview_run is a best practice that allows users to verify their settings before launching the simulation, potentially saving time and resources by catching errors early. Finally, the case.submit command initiates the simulation, submitting it to the queuing system for execution on the supercomputer. By following these steps, researchers can ensure that their CESM simulations are built and submitted correctly, maximizing their chances of a successful run.
Conclusion
Setting up and configuring a CESM3 case with cam6_4_129 involves several key steps, from cloning the CAM repository to submitting the case for execution. Each step requires careful attention to detail to ensure that the simulation runs correctly and produces meaningful results. By following this guide, you can effectively set up your CESM3 simulations and contribute to climate research.
For more in-depth information on CESM and climate modeling, visit the NCAR Climate and Global Dynamics Laboratory website.