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

userdefined grid following guide step 5

We are trying to set up new userdefined grids for the atmosphere and ocean of CESM1.2.2 (only these two components). We do not know how to proceed with step number 5, in page 81 ("If you are adding a new ocn or rtm grid, create a new rtm->ocn mapping file") http://www.cesm.ucar.edu/models/cesm1.2/cesm/doc/usersguide/ug.pdf. We hope you can help us at this stage. Given that we are defining a new ocean grid, but not a new rtm grid, we are wondering whether we should create a new rtm->ocn mapping file, and if so, how.
We have read the whole section "How do I add a new user-defined grid?", and we would also like to ask you please one additional question. The examples provided in this section define multiple new grids. For example, in step 3, it specifies atm, ocn, lnd and rtm parameters, and in step 7, ATM, LND, ICE and OCN files and paths. This is a bit confusing to us, since the components are different in these two steps, and we need to create only new userdefined grids for the atmosphere and ocean. We would like to ask you please whether, in our case, during the series of steps, we should only specify ATM and OCN parameters, filenames and paths, or instead, as it appears in the documentation, we should additionally specify other components in some specific steps.
 

mlevy

Michael Levy
CSEG and Liaisons
Staff member
Hi Albert,Sorry to take so long to get back to you - I'll reply on the bulletin board instead of via email in case others run into the same issue.For your first point, you do need a new runoff to ocean mapping file. You should use the runoff grid provided by CESM in inputdata, and you make the runoff -> ocean mapping file with the tool provided in$CESMROOT/tools/mapping/gen_mapping_files/runoff_to_ocn
Note that you will need to build the executable before you can use this tool, details for doing so are in the README file.For your second question - assuming you are running the atmosphere and the land on the same grid, you only need to specify an atmosphere and ocean grid when running the gen_cesm_maps.sh tool. If you are introducing new ocean and atmosphere grids but using a pre-existing land grid, you should include that when generating all the maps.Let me know if you have any additional questions!~Mike
 
Hi Mike,We did the step 5 as you explained to us. For this purpose, we defined run_off.nml like this:  &input_nml
   gridtype     = 'rtm'
   file_roff    = '/share/data/udic/cesm/inputdata/lnd/clm2/rtmdata/rdirc.05.061026'
   file_ocn     = '/home/ajornet/Downloads/cesm1_2_2/tools/mapping/gen_mapping_files/ocean_scrip_finetrop267x180.nc'
   file_nn      = 'map_r05_to_finetrop267x180_nn_130507.nc '
   file_smooth  = 'map_finetrop267x180_to_finetrop267x180_sm_e1000r300_130507.nc '
   file_new     = 'map_r05_to_finetrop267x180_nnsm_e1000r300_130507.nc'
   title        = 'runoff map: r05 -> finetrop267x180, nearest neighbor and smoothed '
   eFold        = 1000000.0
   rMax         =  300000.0
   step1 = .true.
   step2 = .true.
   step3 = .true.We got the expected outputs. At this stage, we are at step 8. It is necessary to define user_nl_cpl. We do it but with no clue about the fields. So we guess this way,ocn2atmFmapname='pathto/map_finetrop267x180_TO_rectgrid73x96_aave.141001.nc'
ocn2atmSmapname='pathto/map_finetrop267x180_TO_rectgrid73x96_blin.141001.nc'

atm2ocnFmapname='pathto/map_rectgrid73x96_TO_finetrop267x180_aave.141001.nc'
atm2ocnSmapname='pathto/map_rectgrid73x96_TO_finetrop267x180_blin.141001.nc'
atm2ocnVmapname='pathto/map_rectgrid73x96_TO_finetrop267x180_patc.141001.nc'map_finetrop267x180_to_finetrop267x180_sm_e1000r300_130507.nc ?map_r05_to_finetrop267x180_nn_130507.nc ?
map_r05_to_finetrop267x180_nnsm_e1000r300_130507.nc? We have a few question:What is the difference between F, S and V?  Also, how do we manage with runoff to ocean outputs in this case? We have 3 outputs we are not sure which one is useful to us.Again, thank you for your help 
 

mlevy

Michael Levy
CSEG and Liaisons
Staff member
Hi Albert,
Fmaps are used to map fluxes (typically values that need to be conserved), Smaps are used to map scalars (bilinear is usually accurate enough), and Vmaps are used to map vectors (we've found higher-order maps such as patch map to be preferable).The runoff map is actually the product of two maps: you do a nearest neighbor map from the runoff grid (r05) to the ocean grid (finetrop267x180), then you do a smooth map from the ocean to itself so that the runoff does not accumulate at a single point. The product of these maps, and what you want to use as your runoff map, is file_new in the namelist:
map_r05_to_finetrop267x180_nnsm_e1000r300_130507.nc Note: despite what I mentioned above about bilinear maps for scalar values, you need to use the aave (conservative) map for ocn2atmSmapname -- the fact that part of the ocean grid is masked out causes problems with the weighting of the bilinear map but the conservative map adjusts for this automatically. So I would use ocn2atmSmapname='pathto/map_finetrop267x180_TO_rectgrid73x96_aave.141001.nc'
 
I have noticed when defining user_nl_cpl those names, they need to be defined with underscore, like this:atm2ocn_Fmapnameotherwise it throws an error.Once done, I do not see how the points are connected in order to create a new case with a new grid. How mygrid.xml (step 7) and user_nl_cpl (step 8) are related when creating a new case? Step 9 leaves the question opened. 
 

mlevy

Michael Levy
CSEG and Liaisons
Staff member
To create a new case using your grids, you run
$ ./create_newcase -compset ___ -res [your resolution] -mach ___ -case ___ -user_grid_file mygrid.xmlThen you update user_nl_cpl as you noted above We recommend running an A compset first - that will only use data component models and will test that the mapping files are all set up correctly. After successfully running an A compset, you can try adding scientific models (C for POP ocean, F for CAM atmosphere & CLM land, B for fully-coupled CAM, CLM, POP, CICE, etc etc) 
 
Hi, When I try to apply the command you showed me, it throws an error. ajornet@login:~/Downloads/cesm1_2_2/scripts> ./create_newcase -case ~/cesm/example_mygrid -compset A -user_grid_file /home/ajornet/cesm/test_compsetB/mygrid.xml -res atm_ocn -mach ithaca
-------------------------------------------------------------------------------
For a list of potential issues in the current tag, please point your web browser to:
https://svn-ccsm-models.cgd.ucar.edu/cesm1/known_problems/
-------------------------------------------------------------------------------
file /home/ajornet/Downloads/cesm1_2_2/scripts/ccsm_utils/Case.template/config_compsets.xml is not a compset parameters file I checked the code at create_newcase, I show you the piece of code that throws the exception. Line 1219.create_newcase->set_compset method
    my $xml_grid = XML::Lite->new( $grid_file );
    my $root = $xml_grid->root_element();
    my $name = $root->get_name();
    $name eq "config_compset" or die
        "file $compset_file is not a compset parameters filen";I checked root->get_name and it contains the first line of mygrid.xml, which is "config_horiz_grid". Obviously something is wrong.  mygrid.xml




 

mlevy

Michael Levy
CSEG and Liaisons
Staff member
The error message makes it seem like the problem is in the config_compset.xml file rather than anything you are adding. Can you create an A compset with the T62_g16 resolution? For example, I just ran$ ./create_newcase -compset A -res T62_g16 -mach yellowstone -case ~/projects/tests/deletemeon yellowstone and created a new case without any errors. Can you do the same? (Obviously you need to update machine name and change the case directory.)
 

mlevy

Michael Levy
CSEG and Liaisons
Staff member
Ignore that previous response, it looks like the error being reported isn't correct... I think you are using an old format for the custom grid file. Try this instead:
$ cat my_grid.xml




73
96
custom atmosphere grid



267
180
custom ocean grid





360
180
Standard 1 degree runoff





  0 0    
  null is no grid:


a%atmgrid_l%atmgrid_oi%ocngrid_r%rx1_m%ocngrid_g%null_w%null


domain.ocn.ocngrid.141001.nc
domain.ocn.ocngrid.141001.nc



domain.atm.atmgrid_ocngrid.141001.nc
domain.atm.atmgrid_ocngrid.141001.nc




 
When running step 9, it fails due to a missing variable name at the atm initialization.It searches for 'xc'. If we compare with our domain atm file:dimensions:
    grid_size = 7008 ;
    grid_corners = 4 ;
    grid_rank = 2 ;
variables:
    int grid_dims(grid_rank) ;
    double grid_center_lat(grid_size) ;
        grid_center_lat:units = "degrees" ;
    double grid_center_lon(grid_size) ;
        grid_center_lon:units = "degrees" ;
    int grid_imask(grid_size) ;
        grid_imask:units = "unitless" ;
    double grid_corner_lat(grid_size, grid_corners) ;
        grid_corner_lat:units = "degrees" ;
    double grid_corner_lon(grid_size, grid_corners) ;
        grid_corner_lon:units = "degrees" ;

// global attributes:
        string :date_created = "mar sep 30 14:25:12 CEST 2014" ;
        string :Createdby = "ESMF_regridding.ncl" ;
        string :Conventions = "SCRIP" ;
        string :title = "User-defined SCRIP Grid File" ;
} We are not sure this format is correct.
 

mlevy

Michael Levy
CSEG and Liaisons
Staff member
Hi Albert, That looks like your SCRIP grid file (used as input when you generate your mapping files), not the output from gen_domain. I'm a little confused - what file is that, and where does it appear in the env_*.xml or CESM namelists? ~Mike 
 
Ignore my last message, I did a mistake. I missed step 4 in order to generate domain files.At this point and following your suggestion I tested with multiple compsets:compset A->OK
compset F-> failscompset B -> fails When running cesm_setup I get the same error for both:ajornet@login:~/cesm/joangrid_compsetB> ./cesm_setup
Creating Macros file for ithaca/home/ajornet/Downloads/cesm1_2_2/scripts/ccsm_utils/Machines/config_compilers.xml intel ithaca
Creating batch script joangrid_compsetB.run
Locking file env_mach_pes.xml
Creating user_nl_xxx files for components and cpl
Running preview_namelist script
 infile is /home/ajornet/cesm/joangrid_compsetB/Buildconf/cplconf/cesm_namelist
set_horiz_grid: no match for dycore fv and hgrid atmgrid
ERROR: cam.buildnml.csh failed
ERROR: /home/ajornet/cesm/joangrid_compsetB/preview_namelists failed: 25344
 
Top