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

Can we change the max number of history tapes in CLM?

Status
Not open for further replies.

KeerZ

Member
Hello, I understand that in CLM5.0 the max number of history tapes is 10, but I am wondering whether it is possible to change the maximum tape number to 12?

I need to output 12 file tapes and it will be really convenient if I could just specify fincl1 to fincl12, but I am not sure how complex this modification might be.
 

KeerZ

Member
Here are what I tried to change the max number of history tapes:

1. In ~/cesm2.1.2/components/clm/bld/namelist_files, I added namelist hist_fexcl11,hist_fexcl12,hist_fincl11,hist_fincl12 by imitating how hist_fincl1 is specified. The statements are like:
<entry id="hist_fincl11" type="char*64(1000)" category="history"
group="clm_inparm" valid_values="" >
Fields to add to history tape series 11.
</entry>


2. Then I modified scripts controlMod.F90 and histFileMod.F90 (attahced) and upload them to my case directory (~/cases/b.e20.BSSP585.f09_g16.SSP5_TestMonthlyMaximum3/SourceMods/src.clm)

In the above two scripts, I changed the max_tapes = 12. Wherever I saw statements relevant to hist_fincl1~ hist_fincl10 and hist_fincl1 ~ hist_fincl10, I add the same statements for hist_fexcl11,hist_fexcl12,hist_fincl11,hist_fincl12.

3. With the above modification, I can successfully build the case, but the model execution failed with the error:
(lnd_init_mct) :CLM land model initialization
cesm2.1.3-rc.01

Attempting to initialize the land model .....

Attempting to initialize run control settings .....
Read in clm_inparm namelist from: lnd_in
ENDRUN:
ERROR: ERROR reading clm_inparm namelistERROR in controlMod.F90 at line 310


I think there is something wrong in my modified code, but I could not find out where. I'd appreciate any suggestions or examples that I can follow. Thank you!
 

Attachments

  • controlMod.txt
    46.4 KB · Views: 0
  • histFileMod.txt
    235.2 KB · Views: 2

oleson

Keith Oleson
CSEG and Liaisons
Staff member
I don't actually see those changes in ~/cesm2.1.2/components/clm/bld/namelist_files.
For example, there aren't any entries for hist_fincl11 and hist_fincl12 in namelist_definition_clm4_5.xml.
Maybe you made those changes in another code base?
 

KeerZ

Member
I don't actually see those changes in ~/cesm2.1.2/components/clm/bld/namelist_files.
For example, there aren't any entries for hist_fincl11 and hist_fincl12 in namelist_definition_clm4_5.xml.
Maybe you made those changes in another code base?
Oh, sorry I removed those changes because they did not work - now you should be able to find the modified namelist_definition_clm4_5.xml (attached) in my ~/cesm2.1.2/components/clm/bld/namelist_files, where I added the entries for hist_fexcl11,hist_fexcl12,hist_fincl11,hist_fincl12.

The modifications in namelist_definition_clm4_5.xml and in controlMod.F90 and histFileMod.F90 are basically all modifications I made.
 

Attachments

  • namelist_definition_clm4_5.txt
    109.5 KB · Views: 1

KeerZ

Member
The log file of my failed simulation: /glade/scratch/keerzhang/b.e20.BSSP585.f09_g16.SSP5_TestMonthlyMaximum3/run/lnd.log.4574504.chadmin1.ib0.cheyenne.ucar.edu.201011-143742
 

oleson

Keith Oleson
CSEG and Liaisons
Staff member
I think you will also need to change the dimensions of other affected variables in the namelist definition file from 10 to 12, e.g., :

<entry id="hist_mfilt" type="integer(10)" category="history"
 

erik

Erik Kluzek
CSEG and Liaisons
Staff member
Another thing that you'll need to change is that there is only one digit allowed for the stream number for the history file names (so clm2.h0. to clm2.h9.) to get this to work you'll have to allow two digits for the filenames.
 

KeerZ

Member
Another thing that you'll need to change is that there is only one digit allowed for the stream number for the history file names (so clm2.h0. to clm2.h9.) to get this to work you'll have to allow two digits for the filenames.
I think you will also need to change the dimensions of other affected variables in the namelist definition file from 10 to 12, e.g., :

<entry id="hist_mfilt" type="integer(10)" category="history"
Hello Erik and Keith. Thank you for the help!

Besides the modifications I described in #2, I also modified other affected variables and the digit allowed for the stream number. In summary, my modifications include:

1. In ~/cesm2.1.2/components/clm/bld/namelist_files/namelist_definition_clm4_5.xml, I added namelist hist_fexcl11~17,hist_fincl11~17 (now I am trying to change the maximum tape number to 17 for later use):
<entry id="hist_fincl17" type="char*64(1000)" category="history"
group="clm_inparm" valid_values="" >
Fields to add to history tape series 11.
</entry>


I also modified other affected variables (hist_dov2xy, hist_mfilt, hist_ndens ect.):
<entry id="hist_dov2xy" type="logical(17)" category="history"

2. In controlMod.F90 and histFileMod.F90, I changed the max_tapes = 17. Wherever I saw statements relevant to fincl and fexcl, I add the same statements for hist_fexcl11~17,hist_fincl11~17.

Then I assigned len=2 to the hist index in histFileMod.F90:
character(len=2) :: hnum ! history file index
character(len= 2) :: hist_index !p,1 or 2 (currently)



With these Modifications, I can run a simulation with 17 hist tapes successfully. However, in the archive, there are 9 tapes named as XX.clm2.h1~h9. The 10th and 11th tapes are named as XX.clm2.h* .2015-01-01-0000.nc, and the 13th to 17th tapes are not archived. I am not sure where else I need to modify...Do you have any suggestions on how to fix this problem?

I've attahced the Modified F90 files and xml files, and my test case can be found at /glade/scratch/keerzhang/archive/b.e21.BSSP585.f09_g16.SSP5_UC_indiv_soil3_1_5. Thank you very much!

Regards,
Keer
 

Attachments

  • ChangeNumberHistoryTapes2.zip
    69.4 KB · Views: 0

oleson

Keith Oleson
CSEG and Liaisons
Staff member
I think the problem is that this code here in histFileMod.F90 needs to be modified:

write(hist_index,'(i1.1)') hist_file - 1
set_hist_filename = "./"//trim(caseid)//".clm2"//trim(inst_suffix)//&
".h"//hist_index//"."//trim(cdate)//".nc"


I tried this which seems to work:

if (hist_file .le. 10) then
write(hist_index,'(i1.1)') hist_file - 1
else
write(hist_index,'(i2.2)') hist_file - 1
end if

set_hist_filename = "./"//trim(caseid)//".clm2"//trim(inst_suffix)//&
".h"//trim(hist_index)//"."//trim(cdate)//".nc"

The "trim" function removes trailing blank characters.

You'll need to do something similar for the *.rh*.* files as well. The existing code is:

! Create the restart history filename and open it
write(hnum,'(i1.1)') t-1
locfnhr(t) = "./" // trim(caseid) //".clm2"// trim(inst_suffix) &
// ".rh" // hnum //"."// trim(rdate) //".nc"
 

KeerZ

Member
I think the problem is that this code here in histFileMod.F90 needs to be modified:

write(hist_index,'(i1.1)') hist_file - 1
set_hist_filename = "./"//trim(caseid)//".clm2"//trim(inst_suffix)//&
".h"//hist_index//"."//trim(cdate)//".nc"


I tried this which seems to work:

if (hist_file .le. 10) then
write(hist_index,'(i1.1)') hist_file - 1
else
write(hist_index,'(i2.2)') hist_file - 1
end if

set_hist_filename = "./"//trim(caseid)//".clm2"//trim(inst_suffix)//&
".h"//trim(hist_index)//"."//trim(cdate)//".nc"

The "trim" function removes trailing blank characters.

You'll need to do something similar for the *.rh*.* files as well. The existing code is:

! Create the restart history filename and open it
write(hnum,'(i1.1)') t-1
locfnhr(t) = "./" // trim(caseid) //".clm2"// trim(inst_suffix) &
// ".rh" // hnum //"."// trim(rdate) //".nc"
Thanks Keith. I modified these two places:
if (hist_file .le. 10) then
write(hist_index,'(i1.1)') hist_file - 1
else
write(hist_index,'(i2.2)') hist_file - 1
end if
set_hist_filename = "./"//trim(caseid)//".clm2"//trim(inst_suffix)//&
".h"//trim(hist_index)//"."//trim(cdate)//".nc"


if (t .le. 10) then
write(hnum,'(i1.1)') t-1
else
write(hnum,'(i2.2)') t-1
end if
locfnhr(t) = "./" // trim(caseid) //".clm2"// trim(inst_suffix) &
// ".rh" // trim(hnum) //"."// trim(rdate) //".nc"

Now I got 17 hist tapes successfully! That is great. But I noticed that in the /glade/scratch/keerzhang/archive/b.e21.BSSP585.f09_g16.SSP5UC_indisoil_test3/rest, there are no XX.clm2.rh10~16.2015-02-01-00000.nc files (I only got XX.clm2.rh0~9.2015-02-01-00000.nc files). I am wondering what are the *.rh*.* files for? If I need to branch the case at certain year in the future, will the missing rh files make me unable to do that (or to do that correctly)?
 

oleson

Keith Oleson
CSEG and Liaisons
Staff member
I think the problem is that the rh files all exist in the run directory, but the short-term archiver is not moving over all of the files.
In your env_archive.xml, there are these lines:

<comp_archive_spec compclass="lnd" compname="clm">
<rest_file_extension>r</rest_file_extension>
<rest_file_extension>rh\d?</rest_file_extension>

I think if you change the last line to:

<rest_file_extension>rh\d*</rest_file_extension>

and rerun the archiver (or the simulation), it will move/copy over all of the rh files.
 

KeerZ

Member
I think the problem is that the rh files all exist in the run directory, but the short-term archiver is not moving over all of the files.
In your env_archive.xml, there are these lines:

<comp_archive_spec compclass="lnd" compname="clm">
<rest_file_extension>r</rest_file_extension>
<rest_file_extension>rh\d?</rest_file_extension>

I think if you change the last line to:

<rest_file_extension>rh\d*</rest_file_extension>

and rerun the archiver (or the simulation), it will move/copy over all of the rh files.
Yes. This solved the problem with *.rh.* files. Thank you so much for the help!
 
Status
Not open for further replies.
Top