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

how to output a 3D(pft, lat, lon) local variable as histfield and read it again

xiaxs

xiaxs
New Member
Hi,

I want to output a 3D(pft, lat, lon) local variable as histfield and read it again. for example, the local variable, named "rh_can" in subroutine PhotosynthesisHydraulicStress of PhotosynthesisMod.F90.

the version of CESM is 2.1.3. the script of creating case is:
./create_newcase --compset FHIST_BGC --res f09_f09_mg17 --case ~/CESM2/scratch/Default_1D_nocrop

Thank you for any help.
 

oleson

Keith Oleson
CSEG and Liaisons
Staff member
To write the variable to a history file, you would need to establish that variable as global not local, following an approach similar to that posted here:


This would produce a gridcell average of that variable on the history file. If you wanted to look at the 3D version of that variable. you'd want to add a new history file stream, e.g.,

hist_fincl2 = "New_Variable"
hist_dov2xy(2) = .false.
hist_type1d_pertape(2) = 'PFTS'

More details about adding history fields can be found in the section "Bonus Exercise 3.5" in the CLM tutorial here:

 

xiaxs

xiaxs
New Member
To write the variable to a history file, you would need to establish that variable as global not local, following an approach similar to that posted here:


This would produce a gridcell average of that variable on the history file. If you wanted to look at the 3D version of that variable. you'd want to add a new history file stream, e.g.,

hist_fincl2 = "New_Variable"
hist_dov2xy(2) = .false.
hist_type1d_pertape(2) = 'PFTS'

More details about adding history fields can be found in the section "Bonus Exercise 3.5" in the CLM tutorial here:

Thank you, Keith.

It will take some time to read the pdf and figure out the trouble, thanks for your generous sharing and timely reply!
 

xiaxs

xiaxs
New Member
Hi, Keith.

Maybe I missed the real trouble.
The true problem is that how to output a local variable rh_can in line 3293 in PhotosynthesisMod.F90.
There are 21013 gridcells, and 421920 pfts in CLM5.
I want to output all patch's value, not all gridcell's value aggregated by patch.

Thankyou
 

oleson

Keith Oleson
CSEG and Liaisons
Staff member
If you do this:

hist_fincl2 = "New_Variable"
hist_dov2xy(2) = .false.
hist_type1d_pertape(2) = 'PFTS'

then New_Variable will be output in h1 as:

float New_Variable(time, pft)

where the pft dimension is 421920.
 
Top