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

Adding some variables to initial files

yhdchoi

YONGHAN CHOI
New Member
Hello,

I am testing CESM2 with DART for data assimilation cycling.

I would like to add some variables (e.g., skin temperature, 2-m temperature, surface elevation, and surface type) to CAM initial files.

I found that a namelist variable, "inithist_all" can make initial files include required and "optional" fields.
However, I could not find how I can select optional fields.
So, I am not sure that I can use "inithist_all" namelist variable to achieve my goal.

Could you let me know how I can add some variables (fields) to initial files?

Thank you!
 

hannay

Cecile Hannay
AMWG Liaison
Staff member
inithist_all allows you to add a set of pre-defined variables (CONCLD&IC, ...) to the ic file.

The pre-defined variables are added in cam_diagnostics.F90 with calls to: addfld, add_default, outfld.

You could modify the code and try to add your own variables.
I suggest that you follow the way it is done for 'CONCLD&IC'

Look for the lines in cam_diagnostics.F90

call addfld ('CONCLD&IC', (/ 'lev' /), 'I','fraction','Convective cloud fraction' )
call add_default ('CONCLD&IC ',0, 'I')
call outfld('CONCLD&IC ',cwat_var, pcols,lchnk)

These 3 lines are located at 3 different places in the cam_diagnostics.F90
 

yhdchoi

YONGHAN CHOI
New Member
Hello Cecile,

Thank you for your kind help!

I successfully added five variables (2-m temperature, skin temperature, land/ocean/sea-ice fraction) to initial files by modifying subroutine, diag_physvar_ic.

I also want to add surface elevation (or surface geopotential) to initial files.
However, unlike the other variables, cam_in does not contain "phis".
state does contain "phis", but diag_physvar_ic does not have "state" as one of arguments.

Could you let me know how I can add PHIS variable to initial files?

Thanks!
 

yhdchoi

YONGHAN CHOI
New Member
Hello Cecile,

Today, I found that the variables I intended to add (2-m temperature, skin temperature, land/ocean/sea-ice fraction) are not added.

I am sorry for confusing.

I added call of addfld & add_default to subroutine, diag_init_moist, and call of outfld to subroutine, diag_physvar_ic.
I did not call pbuf_get_index & pbuf_get_field, but used "cam_in".

Thank you for your kind help.
 

yhdchoi

YONGHAN CHOI
New Member
inithist_all allows you to add a set of pre-defined variables (CONCLD&IC, ...) to the ic file.

The pre-defined variables are added in cam_diagnostics.F90 with calls to: addfld, add_default, outfld.

You could modify the code and try to add your own variables.
I suggest that you follow the way it is done for 'CONCLD&IC'

Look for the lines in cam_diagnostics.F90

call addfld ('CONCLD&IC', (/ 'lev' /), 'I','fraction','Convective cloud fraction' )
call add_default ('CONCLD&IC ',0, 'I')
call outfld('CONCLD&IC ',cwat_var, pcols,lchnk)

These 3 lines are located at 3 different places in the cam_diagnostics.F90
Hello Cecile,

I added addfld, add_default, and outfld (& pbuf_get_index, and pbuf_get_field) for each field that I would like to add.

There was no compile error, and six fields (TREFHT, TS, PHIS, LANDFRAC, OCNFRAC, ICEFRAC) were added to initial files.

However, all six fields have their default values (set by add_default).

My guess is that "pbuf" does not have the six fields.

Could you help me to solve the above issue?

Thank you!
 
Top