Skip to content

danlipsa/CamAdaptor

Repository files navigation

This project provides a ParaView Catalyst adaptor for CAM5 simulation with fv or se dynamic modules. Files:

  • catalyst_add_and_coprocess.F90: included in one of the simulation files (physpkg.F90) as it needs to call functions from the simulation executable.
  • xx_catalyst_adapter.F90.in: catalyst adapter entry points. Converts from simulation data structures to regular arrays.
  • xx_create_data: creates VTK data. Linked together with the catalyst adapter.
  • xx_coprocess.py: VTK pipeline.

xx can be fv (Finite Volume) or se (Spectral Element).

Useful documentation:

To build CAM5 and the Catalyst adapter:

  1. Download CESM (Community Earth System Model) using instructions in:

    http://www.cesm.ucar.edu/models/cesm1.2/cesm/doc/usersguide/book1.html

    and cam_catalyst_adapter from:

    Store cam_catalyst_adapter in ~/src/cesm_1_2_1/models/atm/cam directory.

  2. Modify configure-cam.sh, gen-cam.sh, build-namelist.sh such that CAM_ROOT points to the location for cesm1_2_2 sources. The scripts assume that cesm1_2_1 is stored in ~/src/cesm_1_2_1 Apply cesm_1_2_2.patch to the cesm code.

  3. Create a CAM5 build directory, cd into it and configure it:

     mkdir ~/build/cam-5.3
     cd ~/build/cam-5.3
    

    Edit the configuration script by uncommenting the configuration you want or creating a different configuration. Parameters for finite volume and spectral element with different grid sizes are available. Run the configuration script.

     ~/src/cesm1_2_2/models/atm/cam/cam_catalyst_adapter/configure-cam.sh
    

    Note you have to configure the number of MPI processors and use the same number when you run the simulation.

  4. Try building CAM5. This step creates mod files used by the adapter.

     make -j10
    

    You'll get errors as the adapter is not built yet.

  5. Create adapter's build directory and configure it. Make sure you specify ParaView's build (or installation) directory. Build the adapter:

     cd ~/build/cam-5.3
     mkdir cam_catalyst_adapter
     cd cam_catalyst_adapter
     ccmake ~/src/cesm1_2_2/models/atm/cam/cam_catalyst_adapter
     make
    
  6. Build CAM5:

     cd ..
     make
    
  7. Create a run directory for the simulation and create the parameters for the simulation. This is where you set for how long you run the simulation and how often you save data.

     mkdir ~/run/cam-5.3
     cd ~/run/cam-5.3
     ~/src/cesm1_2_2/models/atm/cam/cam_catalyst_adapter/build-namelist.sh | grep FOUND
    

    Namelists (parameters) for the simulation are listed in:

    http://www.cesm.ucar.edu/cgi-bin/eaton/namelist/nldef2html-cam5_3

    Different configurations need different data files. If any of the required data files are NOT FOUND download them from: https://svn-ccsm-inputdata.cgd.ucar.edu/trunk/inputdata Don't checkout everything as the datafiles are big! First checkout individual empty directories leading to the file you are interested in:

     cd ~/src/cesm-data
     svn update --depth empty atm
     cd atm
     svn update --depth empty cam
     cd cam
     svn update --depth empty inic
     cd inic
     svn update --depth empty homme
     cd homme
    

    Then checkout the file:

     svn update cami-mam3_0000-01-01_ne30np4_L30_c130424.nc
    
  8. Run the simulation:

     ~/src/cesm1_2_2/models/atm/cam/cam_catalyst_adapter/run-cam.sh
    

    The data fields generated by the simulation (those stored in the .nc file) are listed in:

    http://www.cesm.ucar.edu/models/cesm1.2/cam/docs/ug5_3/hist_flds_fv_cam5.html

    You can view the history file camrun.cam.h0.*.nc in ParaView using 'NetCDF files generic and CF conventions' reader. You can switch the dimensions viewed to be (lat,lon) or (lev, lat, lon) to get a sphere or a ball.

  9. Optional: If you want to debug certain pio files in the simulation run:

     ~/src/cesm1_2_2/models/atm/cam/cam_catalyst_adapter/gen-cam.sh d
    

    This command copies a list of .F90.in to the corresponding .F90 so that gdb works correctly over these files. When you need to rebuild run:

     ~/src/cesm1_2_2/models/atm/cam/cam_catalyst_adapter/gen-cam.sh g
    

To dump the history file produced by the simulation in text format run ncdump camrun.cam.h0.*.nc > camrun.txt

See http://www.unidata.ucar.edu/software/netcdf/docs/netcdf_utilities_guide.html#ncdump_SYNOPSIS for more information.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published