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 'fabi_sun_z' with the highest temporal resolution

Status
Not open for further replies.

gsoto

Gerardo Soto
New Member
Hi everyone,

This question has two parts.
1) How can I output 'fabi_sun_z' from the SurfaceAlbedoMod.F90? (I assumed this would be a default, but I can't find it), and
2) I know the h7 stream is for outputting 3-hourly averages, but I would like to have at least hourly results. How can I do that?

Thanks in advance!
 

oleson

Keith Oleson
CSEG and Liaisons
Staff member
In general, you'll want to add a call to the "InitHistory" subroutine within the module where the variable is defined and initialized. It looks like fabi_sun_z is initialized and defined in SurfaceAlbedoType.F90. So you would want to add something like this in the InitHistory subroutine:

this%fabi_sun_z_patch(begp:endp,:) = spval
if (nlevcan>1) then
call hist_addfld2d (fname='FABI_SUN_Z', units='0-1', type2d='nlevcan', &
avgflag='A', long_name='absorbed sunlit leaf diffuse PAR (per unit lai+sai) for canopy layer', &
ptr_patch=this%fabi_sun_z_patch)
else
ptr_1d => this%fabi_sun_z_patch(begp:endp,1)
call hist_addfld1d (fname='FABI_SUN_Z', units='0-1', &
avgflag='A', long_name='absorbed sunlit leaf diffuse PAR (per unit lai+sai) for canopy layer', &
ptr_patch=ptr_1d)
end if

That should handle cases where nlevcan=1 (the CLM default) and nlevcan>1.
You'll also need to add this in the "ARGUMENTS" section of InitHistory:

real(r8), pointer :: ptr_1d(:) ! pointer to 1d patch array

The history streams are not fixed, they can be configured to output whatever you need.
For instance, to get the standard monthly average history files for default variables and a second set of history files that have 1/2 hourly fabi_sun_z:

hist_nhtfrq = 0,1
hist_mfilt = 1,48
hist_fincl2 = 'FABI_SUN_Z'
 

gsoto

Gerardo Soto
New Member
Thank you very much Keith!

Is the use of the pointer considered a good standard here or it's more of your style? Isn't just the same to use "ptr_patch = this%fabi_sun_z_patch(begp:endp,1)" for the 'else' part?

If the first part is true, should I recycle the pointer if I want to include say 'FABI_SHA_Z', or it would be better to define as many pointers as 'else's for different fields I have in mind?

Thanks again!
 

oleson

Keith Oleson
CSEG and Liaisons
Staff member
I was following an example in PhotosynthesisMod.F90. Of course there are bad examples in the code as well as good examples.
I also got a compiler error when I didn't use the ptr_1d approach:

/glade/work/oleson/release-cesm2.1.3/cime/scripts/clm50_cesm213R_2deg_GSWP3V1_2000/SourceMods/src.clm/SurfaceAlbedoType.F90(238): error #7121: A ptr dummy may only be argument associated with a ptr, and this array element or section does not inherit the POINTER attr from its parent array. [FABI_SUN_Z_PATCH]

In the PhotosynthesisMod.F90 example I followed, the pointer was recycled.
 

gsoto

Gerardo Soto
New Member
got you! Thanks again!
It compiled successfully for both variables with two pointers.
 
Status
Not open for further replies.
Top