Main menu


Output Slab Ocean Model history on pop grid

8 posts / 0 new
Last post
Output Slab Ocean Model history on pop grid

Dear Forum,

I wondered if there's a way to get SOM output on pop grid.

For example, in docn_comp_mod.F90 there is a variable somtp, which I guess is SOM temprature and is on pop grid (i.e. gx3v7 in my case).

So my question is, how to write out the somtp history in a netcdf file?

I searched and found subroutines like addfld, add_default and outfld, but they seem to work on CAM component only.

There's also a history.F90 in ./models/ocn/pop2/source/ , but I have no idea how to use it.

Will you please help?



There are two ways to do this. You can get the coupler to write history files using the AVGHIST_OPTION and AVGHIST_N variables for averaged history files or HIST_OPTION and HIST_N for snapshot files. Otherwise, you can get the sea ice component (CICE) to write out sst. The coupler history file variables are in env_run.xml, while the CICE one is in the CICE namelist (f_sst). Depending on the version, this is either cice.buildnml.csh or user_nl_cice. Documentation for these options are here:

Coupler history:

CICE history:


Thanks David, for the quick response.

I checked my model, which is SOM+CAM5 (CESM1_2_2, E_compset), there’s no output file under cpl/hist/, but there are output files under ice/hist/.

So I guess writing SOM output in CICE history files would be plausible.

An outline of procedures I can think of to, for example, write the somtp variable in docn_comp_mod.F90 to CICE history files, would be:

1. Add a new state ‘my_somtp’ that is passed from the ocean to CICE. This is done by namelist:


 cplflds_custom = 'So_my_somtp->o2x', 'So_my_somtp->x2i’


2. Assign somtp values to my_somtp;

3. Since CICE field list does not have my_somtp, need to add my_somtp in ice_history_fields.F90 and in ice_history.F90, copy them to $CASEROOT/SourceMods/src.cice/

4. Include fincl1 = ‘MY_SOMTP’ in user_nl_cice. Build and run.

Am I following the right path?



You should probably read the FAQ. For the SOM, the somtp is assumed to be the same as SST. Hence you just write f_sst from the CICE, which is there already.



Hi Dave,

Sorry about the confusion. 

What I’m really doing is to apply relaxation to SOM temperature, record restoring heat fluxes due to restoring term, and generate a Q-flux from the recorded restoring heat.

So far I’m able to modify docn_comp_mod.F90 to carry out the relaxation and calculate restoring heat flux.

But I don’t know how to output the heat flux since it’s a new user-defined variable.

I mentioned somtp just as an example. Looks like I picked a bad example.  Zaiyu

I see now. This is something that is not supported in the CESM. However, you might be able to workaround it two ways:

1. Hack the coupler code to receive a new flux from the DOCN. Then this could be written to the coupler history file.

2. The DOCN is able to write instantaneous restart files. These might be sufficient, but you could also hack this code to write history files instead.

Good luck.



Thanks Dave.

Now I have set AVGHIST_OPTION=nmonths and AVGHIST_N=1, run the model (E compset) for 1 year.

But still there's no output files in ./cpl/hist/

Am I missing something, or cpl history is not available for E compset?

Thanks again


Just a comment on the cpl history average issue above.

With AVGHIST_OPTION=nmonths and AVGHIST_N=1 in env_run.xml, even after rebuild, however, cpl.log shows:

(seq_timemgr_clockInit) histavg_option = never

(seq_timemgr_clockInit) histavg_n      =       -999

When added below options in user_nl_cpl:


 histavg_n = 1

 histavg_option = 'nmonths'

The issue is solved.

Log in or register to post comments

Who's new

  • ezhu@...
  • 1260680980@...
  • liruichao@...
  • krc139@...
  • wilim@...