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

Confusion about FHIST_BGC spinup

Ceil

Member
Hi @oleson,

I need your help. I carefully read userguide about spinup and I also look through the related content in CESM forum. But I am still confused about some details.
My research topic is about agricultural management. I want to use FHIST_BGC and I modify surface data and source code. My analysis period is 2010-2020. I wonder whether my spinup design as shown below is right.
First spinup:
I2000Clm50BgcCrop;
CLM_ACCELERATED_SPINUP=on;
RUN_TYPE=startup;
leave RUN_STARTDATE, GET_REFCASE, and RUN_REF* as default
STOP_OPTION=nyears
STOP_N=1000
vi my_cesm_sandbox/components/clm/tools/contrib/SpinupStability.ncl # run the script to decide whether the model is already spun up

Final spinup:
FHIST_BGC;
CLM_ACCELERATED_SPINUP=off;
RUN_TYPE=hybrid;
finidat=’the last restart file in the first spinup, i.e., *.clm2.r.*.nc’
leave RUN_STARTDATE, GET_REFCASE, and RUN_REF* as default
STOP_OPTION=nyears
STOP_N=200
vi my_cesm_sandbox/components/clm/tools/contrib/SpinupStability.ncl # run the script to decide whether the model is already spun up

Formal running (used to analyze):
FHIST_BGC;
RUN_TYPE=hybrid;
finidat=’the last restart file in the final spinup, i.e., *.clm2.r.*.nc’
leave GET_REFCASE and RUN_REF* as default
RUN_STARTDATE=2010-01-01
STOP_OPTION=nyears
STOP_N=10

The above setting is my sensitivity experiment, and it will start to run after modifying surface data and source code. To study the effects of the sensitivity experiment, I should do a control experiment that is used to compare with the sensitivity experiment. For the control experiment, if I do not modify anything, does it mean that I do not need to spinup FHIST_BGC? Is the following design right?
Control experiment (used to analyze):
FHIST_BGC;
RUN_TYPE=hybrid;
finidat=’the default restart file provided by CESM developers’
leave GET_REFCASE and RUN_REF* as default
RUN_STARTDATE=2010-01-01
STOP_OPTION=nyears
STOP_N=10
 

oleson

Keith Oleson
CSEG and Liaisons
Staff member
For the control, you shouldn't have to spinup if you don't modify anything, since an initial file is usually provided. However, I'm not sure if an initial file is available for the year you are starting from (2010). You could set it up to see.
The spinups look fine other than you probably don't need 1000 years in AD mode, 200-400 years should work. And generally the "final spinup" will take longer than 200 years to be in equilibrium.
Keep in mind that the spinup will be run with GSWP3 atmospheric forcing by default, which has a different climate than an F-case. So you may need a few years of additional spinup using an F-case, e=.g., F2000, to let the model adjust to the coupled model forcing.
An alternative is to skip the I-case spinups and run an F-case, e.g., F2000, spinup for a number of years and then initialize the FHIST from the end of that spinup. That would have the advantage of spinning up under similar atmospheric forcing.
 

Ceil

Member
For the control, you shouldn't have to spinup if you don't modify anything, since an initial file is usually provided. However, I'm not sure if an initial file is available for the year you are starting from (2010). You could set it up to see.
The spinups look fine other than you probably don't need 1000 years in AD mode, 200-400 years should work. And generally the "final spinup" will take longer than 200 years to be in equilibrium.
Keep in mind that the spinup will be run with GSWP3 atmospheric forcing by default, which has a different climate than an F-case. So you may need a few years of additional spinup using an F-case, e=.g., F2000, to let the model adjust to the coupled model forcing.
An alternative is to skip the I-case spinups and run an F-case, e.g., F2000, spinup for a number of years and then initialize the FHIST from the end of that spinup. That would have the advantage of spinning up under similar atmospheric forcing.
Hi Oleson, many thanks for your reply! It helps me a lot! I will use F2000climo to replace I2000Clm50BgcCrop in the first spinup.
 

oleson

Keith Oleson
CSEG and Liaisons
Staff member
We don't seem to have any f05 land restart files in our inputdata directory. So I'm not sure that resolution is actually supported. I tried:

./create_newcase --case cam6_clm50_cesm215R_f05mg17_hist --compset FHIST_BGC --res f05_f05_mg17 --run-unsupported

with release-cesm2.1.5 and got an error associated with missing a atm initial file (ncdata).
You might post on the CAM forum to see if that resolution/compset combination is supported.
 

Ceil

Member
We don't seem to have any f05 land restart files in our inputdata directory. So I'm not sure that resolution is actually supported. I tried:

./create_newcase --case cam6_clm50_cesm215R_f05mg17_hist --compset FHIST_BGC --res f05_f05_mg17 --run-unsupported

with release-cesm2.1.5 and got an error associated with missing a atm initial file (ncdata).
You might post on the CAM forum to see if that resolution/compset combination is supported.
Hi Oleson, thanks for your reply! I made the ncdata by myself with reference to other threads in CESM forum. So I can successfully run f05_f05_mg17 when RUN_TYPE is startup. The only files I need are restart files, because I do not want to spin up the default model by myself.

In addtion, how about your suggestions for my first question above? Also can be seen below:
I will use f05_f05_mg17 in my formal running, but is it correct to use f09_f09_mg17 in the first and final spinups? Because I guess that using the lower resolution can save half of my computing hours.
 

oleson

Keith Oleson
CSEG and Liaisons
Staff member
It's preferable to spinup the model at the same resolution the production is run at. However, the lower resolution land file will be interpolated to the higher resolution at run time if use_init_interp = .true. I don't think the atm will do that at run time but there is probably a standalone tool to do it. I'd check on the CAM Forum
 

Ceil

Member
It's preferable to spinup the model at the same resolution the production is run at. However, the lower resolution land file will be interpolated to the higher resolution at run time if use_init_interp = .true. I don't think the atm will do that at run time but there is probably a standalone tool to do it. I'd check on the CAM Forum
Thanks for your suggestions! I have already posted another thread "ask for restart files of f05_f05_mg17" on the CAM fourm. Hope to get the restart files, then I can save many computing hours.
 

Ceil

Member
Hi @oleson ,

I still did not get any replies about the restart files for f05_f05_mg17. It seems no such files available for users. Now I have new questions and I really need your help.
1. I want to consider two plant species at the same time and their interactions, i.e., agro-forestry. But it seems no such settings or similar settings in current CESM models. So do I need to create my own model infrastructure? Probably something like adding a new PFT to the model?

2. I want to draw a spatial distribution of global land cover/use that used in the model. But I did not find a variable that including all plant types. There seems only fraction variables such as PCT_CROP and PCT_NAT_PFT. How can I draw the land cover/use spatial distribution?

3. For the control run,
./create_newcase --case ../../../cases/control_FHISTBGC_f09 --res f09_f09_mg17 --compset HIST_CAM60_CLM50%BGC-CROP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV --run-unsupported
Why the default settings are full coupled B (not F) as shown below:
RUN_REFCASE=b.e20.BHIST.f09_g17.20thC.297_01_v2
RUN_REFDATE=1979-01-01
Can I do the following modification:
./xmlchange RUN_STARTDATE=2010-01-01
./xmlchange RUN_REFDATE=2010-01-01
./xmlchange RUN_REFCASE=f.e20.FHIST.f09_f09.cesm2_1.001_v2

4. After running ./create_newcase --case ../../../cases/firstspinup_F2010BGC_f05 --res f05_f05_mg17 --compset 2010_CAM60_CLM50%BGC-CROP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV --run-unsupported, there are errors about missing the following data:
surfdata_0.47x0.63_78pfts_CMIP6_simyr2000_c170919.nc
sst_HadOIBl_bc_0.47x0.63_2010climo_c180511.nc
But I did not find data, so can I use the following data to replace the data above:
The only difference between the two data seems the creating date (c170919 vs. c180508) and the climatological date (2010climo vs. 2000climo). I wonder whether the creating/climatological date matters and where can I download the required data.
 

slevis

Moderator
1. You are probably right about that.
2. If you mean that you want to change the land cover/ use from what is prescribed in our default fsurdat/ landuse files, then you need to generate custom fsurdat and/or landuse files.
 

slevis

Moderator
4. I think that the model should automatically download the files for you if you specify files that appear in the svn repository. Since the other files aren't available, then I would certainly proceed with the files that are available.
 

Ceil

Member
Hi @oleson

I am confused about how to place the modified source code. Taking the following as an example, which is correct?
1) mkdir src.clm/biogeochem
cp cesm2.1.5_covercrop/my_cesm_sandbox/components/clm/src/biogeochem/CNPhenologyMod.F90 SourceMods/src.clm/biogeochem/
2) cp cesm2.1.5_covercrop/my_cesm_sandbox/components/clm/src/biogeochem/CNPhenologyMod.F90 SourceMods/src.clm/

After successfully ./case.build, how to find records (such as logs or documents) to prove that I have already successfully modified source codes?
 

Ceil

Member
Hi @oleson ,

Many thanks for your reply!
I have a new question. I am confused to read the format of max_NH_planting_date in clm5_params.c171117.nc.
What does 631 means? If unit is YYYYMMDD, there should be 8 numbers such as 00000631? But what are year, month, and day, respectively?
int max_NH_planting_date(pft) ;
max_NH_planting_date:_FillValue = 0 ;
max_NH_planting_date:long_name = "Maximum planting date for the Northern Hemipsphere" ;
max_NH_planting_date:units = "YYYYMMDD" ;
max_NH_planting_date:coordinates = "pftname" ;
max_NH_planting_date:comment = "Typical U.S. latest planting dates according to AgroIBIS: Maize May 10th; soybean Jun 20th; s
pring wheat mid-May; winter wheat early Nov." ;

max_NH_planting_date = _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
615, 615, 615, 615, 1130, 1130, 615, 615, 615, 615, 1130, 1130, 615, 615,
1130, 1130, _, _, _, _, _, _, _, _, 531, 531, _, _, _, _, _, _, _, _, _,
_, _, _, _, _, _, _, _, _, 228, 228, _, _, _, _, 331, 331, _, _, _, _, _,
_, 415, 415, 631, 631 ;

I care about this variable because after ./case.submit I got errors as below:
ERROR timeaddmonths(): MM out of range
clm::TimeSetymd: error return from ESMF_TimeSet: setting get_calday
ERROR: CHKRC

After refering to Problem running with Crop and using ESMF library -- bad date in paramsfile · Issue #463 · ESCOMP/CTSM, I changed 631 to 701 as below shows,
ncap2 -s "max_NH_planting_date(77:78)=701" clm5_params.c171117_tmp.nc clm5_params.c171117.nc
Unluckily, I still got the same errors.
 

oleson

Keith Oleson
CSEG and Liaisons
Staff member
Despite what the units say, 631 means June 31, which of course isn't a valid calendar date. So setting it to 701 (July 1) is the bug fix. Not sure why you are still getting the error unless it's not actually related to that particular bug. Have you looked at your log files to see the full traceback of the error? You can also attach all of your log files here and the output of ncdump -v max_NH_planting_date clm5_params.c171117.nc would also be useful, and we might be able to help further.
 

Ceil

Member
Hi @oleson ,

Please see my logs (cesm.log.835636.240229-164045, lnd.log.835636.240229-164045) in the attachments. To get more information about the errors, I also did the following modification:
vi ../../../my_cesm_sandbox/cime/src/share/esmf_wrf_timemgr/ESMF_TimeMod.F90
IF ( PRESENT( YY ) ) THEN
! PRINT *,'DEBUG: ESMF_TimeSet(): YY = ',YY
PRINT *,'DEBUG: ESMF_TimeSet(): YY = ',YY !modified
if (dset) CALL wrf_error_fatal( 'ESMF_TimeSet: D or DL and YY,MM,DD not both valid')
time%YR = YY
ENDIF
IF ( PRESENT( MM ) ) THEN
if (dset) CALL wrf_error_fatal( 'ESMF_TimeSet: D or DL and YY,MM,DD not both valid')
! PRINT *,'DEBUG: ESMF_TimeSet(): MM = ',MM
PRINT *,'DEBUG: ESMF_TimeSet(): MM = ',MM !modified
CALL timeaddmonths( time, MM, ierr )
Then I got more information as below (I could not attach the log file, because the size is over 10 G):
DEBUG: ESMF_TimeSet(): YY = 0
DEBUG: ESMF_TimeSet(): MM = 11
DEBUG: ESMF_TimeSet(): YY = 0
DEBUG: ESMF_TimeSet(): MM = 1
DEBUG: ESMF_TimeSet(): YY = 0
DEBUG: ESMF_TimeSet(): MM = 0
ERROR timeaddmonths(): MM out of range
clm::TimeSetymd: error return from ESMF_TimeSet: setting get_calday
ERROR: CHKRC
DEBUG: ESMF_TimeSet(): YY = 0
DEBUG: ESMF_TimeSet(): MM = 6

So I think that the errors are from MM=0 (but should be 1 <= MM <= 12)



The following is my model running code, and I also attach the src.clm and clm5_params.c171117_covercrop.nc in the logs.tar:
cd cesm2.1.3/my_cesm_sandbox/cime/scripts
./create_newcase --case ../../../cases/test_FHISTBGC_f09 --res f09_f09_mg17 --compset HIST_CAM60_CLM50%BGC-CROP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV --run-unsupported
cd ../../../cases/test_FHISTBGC_f09
./case.setup

#put the modified source code in the SourceMods/src.clm/

#modify clm5_params.c171117.nc to match the modified source code, so get a new file named clm5_params.c171117_covercrop.nc
The details about the modification can be seen as below:
ncap2 -s "covercrop=mergetoclmpft" clm5_params.c171117.nc temp1.nc
ncap2 -s "covercrop(0:76)=0" temp1.nc temp2.nc
ncap2 -s "covercrop(77:78)=1" temp2.nc temp3.nc
ncap2 -s "irrigated(78)=0" temp3.nc temp4.nc # if without this modification, pftconMod.F90 ERROR: irrigated has wrong values
ncap2 -s "max_NH_planting_date(77:78)=701" temp4.nc clm5_params.c171117_covercrop.nc
use python to do this modification: pftname[77]=covercrop_1, pftname[78]=covercrop_2

echo "paramfile = '/cluster/work/users/xiaz/inputdata/lnd/clm2/paramdata/clm5_params.c171117_covercrop.nc'" >> user_nl_clm

./case.build
./case.submit
 

Attachments

  • cesm.log.835636.240229-164045.txt
    977.1 KB · Views: 2
  • logs.tar
    850 KB · Views: 2

slevis

Moderator
Am I correct to understand from the above that the default model works but the model with your modifications fails?
 

Ceil

Member
Hi @oleson ,

Please see my logs (cesm.log.835636.240229-164045, lnd.log.835636.240229-164045) in the attachments. To get more information about the errors, I also did the following modification:
vi ../../../my_cesm_sandbox/cime/src/share/esmf_wrf_timemgr/ESMF_TimeMod.F90
IF ( PRESENT( YY ) ) THEN
! PRINT *,'DEBUG: ESMF_TimeSet(): YY = ',YY
PRINT *,'DEBUG: ESMF_TimeSet(): YY = ',YY !modified
if (dset) CALL wrf_error_fatal( 'ESMF_TimeSet: D or DL and YY,MM,DD not both valid')
time%YR = YY
ENDIF
IF ( PRESENT( MM ) ) THEN
if (dset) CALL wrf_error_fatal( 'ESMF_TimeSet: D or DL and YY,MM,DD not both valid')
! PRINT *,'DEBUG: ESMF_TimeSet(): MM = ',MM
PRINT *,'DEBUG: ESMF_TimeSet(): MM = ',MM !modified
CALL timeaddmonths( time, MM, ierr )
Then I got more information as below (I could not attach the log file, because the size is over 10 G):
DEBUG: ESMF_TimeSet(): YY = 0
DEBUG: ESMF_TimeSet(): MM = 11
DEBUG: ESMF_TimeSet(): YY = 0
DEBUG: ESMF_TimeSet(): MM = 1
DEBUG: ESMF_TimeSet(): YY = 0
DEBUG: ESMF_TimeSet(): MM = 0
ERROR timeaddmonths(): MM out of range
clm::TimeSetymd: error return from ESMF_TimeSet: setting get_calday
ERROR: CHKRC
DEBUG: ESMF_TimeSet(): YY = 0
DEBUG: ESMF_TimeSet(): MM = 6

So I think that the errors are from MM=0 (but should be 1 <= MM <= 12)



The following is my model running code, and I also attach the src.clm and clm5_params.c171117_covercrop.nc in the logs.tar:
cd cesm2.1.3/my_cesm_sandbox/cime/scripts
./create_newcase --case ../../../cases/test_FHISTBGC_f09 --res f09_f09_mg17 --compset HIST_CAM60_CLM50%BGC-CROP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV --run-unsupported
cd ../../../cases/test_FHISTBGC_f09
./case.setup

#put the modified source code in the SourceMods/src.clm/

#modify clm5_params.c171117.nc to match the modified source code, so get a new file named clm5_params.c171117_covercrop.nc
The details about the modification can be seen as below:
ncap2 -s "covercrop=mergetoclmpft" clm5_params.c171117.nc temp1.nc
ncap2 -s "covercrop(0:76)=0" temp1.nc temp2.nc
ncap2 -s "covercrop(77:78)=1" temp2.nc temp3.nc
ncap2 -s "irrigated(78)=0" temp3.nc temp4.nc # if without this modification, pftconMod.F90 ERROR: irrigated has wrong values
ncap2 -s "max_NH_planting_date(77:78)=701" temp4.nc clm5_params.c171117_covercrop.nc
use python to do this modification: pftname[77]=covercrop_1, pftname[78]=covercrop_2

echo "paramfile = '/cluster/work/users/xiaz/inputdata/lnd/clm2/paramdata/clm5_params.c171117_covercrop.nc'" >> user_nl_clm

./case.build
./case.submit
The default model can work, but it is very strange to have the errors. From my modification, I did not modify something that related to date or calendar. I am still struggling for this problem, but it seems to make no sense. Could you please provide me some help?
 

oleson

Keith Oleson
CSEG and Liaisons
Staff member
Unfortunately, with code modifications and modifications to the parameter file, there's not much we can do to help directly. A suggestion though: look at your traceback in your cesm log:

cesm.exe 0000000002796820 shr_abort_mod_mp_ 114 shr_abort_mod.F90
cesm.exe 0000000001AFB3A9 clm_time_manager_ 1861 clm_time_manager.F90
cesm.exe 0000000001CCA71F cnphenologymod_mp 2174 CNPhenologyMod.F90
cesm.exe 00000000021A5625 cndrivermod_mp_cn 73 CNDriverMod.F90
cesm.exe 0000000001CDD945 cnvegetationfacad 532 CNVegetationFacade.F90
cesm.exe 0000000001AEC007 clm_initializemod 456 clm_initializeMod.F90
cesm.exe 0000000001AD5571 lnd_comp_mct_mp_l 233 lnd_comp_mct.F90
cesm.exe 000000000043A0B4 component_mod_mp_ 267 component_mod.F90
cesm.exe 0000000000428864 cime_comp_mod_mp_ 1237 cime_comp_mod.F90
cesm.exe 00000000004370EB MAIN__ 114 cime_driver.F90

In particular, line 2174 in your version of CNPhenologyMod.F90 is:

minplantjday(n, inNH) = int( get_calday( pftcon%mnNHplantdate(n), 0 ) )

So presumably the model is having trouble converting mnNHplantdate(n) to a calendar date. So I'd suggest printing out some of those values.
Also, it can be easier to troubleshoot land-only simulations compared to coupled simulations.
 
Top