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

Simple Code Modifications - Adding New Output Variables

nuvolet

Toni Viudez
Member
Hi all,

We are trying to have new outputs in our CESM2.2 run simulations and we found an old reference for CAM 3.0:

Adding New Output Variables

Nevertheless, when we look at the same modules (history.F90) suggested in previous link, we do not find the functions such as: addfld and outfld

Anybody knows if there is an updated documentation for this purpose?

Thanks in advance
 

cacraig

Cheryl Craig
CSEG and Liaisons
Staff member
The file that contains the addfld/outfld calls is src/control/cam_history.F90. While the calls are at a high level the same as they were in cam3, the details differ from that documentation. Unfortunately, the CAM6.3 User's Guide does not detail adding an output field. The routines are documented in the cam_history.F90 file though.

A quick overview is that addfld adds the variable to the masterlist, and outfld will write it out. BUT, this combination does not by default write out the variables and the user needs an additional step of either an additional call to add_default in the code or putting the variable in a fincl in user_nl_cam. Adding an add_default means that every time the outfld for the variable is called, the variables will be written out. Alternatively, if you want to control when this new outfld produces output, then you can add the variable to your user_nl_cam in a fincl field.

Let me know if you have difficulties adding these calls.
 

nuvolet

Toni Viudez
Member
You can also find some info about adding new variables in the CESM tutorial
Look for: 'Topic: Namelist and Code Modifications'.
There are:
- slides with examples
- solution to the exercises
- and a video.

Look the code modification section (slide 29 and after) in:
Hi Cecile,

Before I want to modify code I tried a simple case in order to familiarize with CESM2.2.
I wanted to run a simple case using the ./xmlchange command like this:

./xmlchange RUN_STARTDATE=20000101,STOP_OPTION=ndays,STOP_N=2,STOP_DATE=20000102

Which is a single run for 2 days by using the following case:

./create_newcase --case cam60f2000 --compset F2000climo --res f09_f09_mg17

At the end of the run I did not get any file like {CASE}.{component}.h*.nc, which I understand are the diagnostic files and are the one with the results of the simulation for the case created. Meanwhile I only have the restart files: {CASE}.{component}.r*.nc

I followed the suggestion from another CESM user Michael Levy in the following post:


And I still do not get the supposed diagnostic files. Obviously, I think that until I do not get those type of files I could not modify code, right?
Do you have any suggestion?.
Thanks in advance
 

hannay

Cecile Hannay
AMWG Liaison
Staff member
The history files (the *h0* files) are output monthly by default. If you run for 2 days, you won't see any history files. Please try to run for a one month and I expect you will see some history files
 

nuvolet

Toni Viudez
Member
The history files (the *h0* files) are output monthly by default. If you run for 2 days, you won't see any history files. Please try to run for a one month and I expect you will see some history files
After I went through all the steps to run the case for 2 months, after ./case.build in between the terminal outputs I got these message:

NOTE: ignoring setting of rof2ocn_liq_rmapname=idmap in seq_maps.rc
NOTE: ignoring setting of rof2ocn_fmapname=idmap in seq_maps.rc
NOTE: ignoring setting of rof2ocn_ice_rmapname=idmap in seq_maps.rc

Could be this something I should consider as a cause of not having the h*.nc

Thanks in advance
 

cacraig

Cheryl Craig
CSEG and Liaisons
Staff member
We can better help you if you provide the information requested in: Information to include in help requests. This way we can see exactly what you are doing and how the run is working for you.

I should also note that the messages about seq_maps.rc can occur in runs that work just fine.
 
Last edited:
Top