Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vegetation temperature outputs for crop stress work #2719

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 26 additions & 26 deletions src/biogeophys/LunaMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,8 @@ subroutine Update_Photosynthesis_Capacity(bounds, fn, filterp, &
nrad => surfalb_inst%nrad_patch , & ! Input: [integer (:) ] pft number of canopy layers, above snow for radiative transfer
lnc => photosyns_inst%lnca_patch , & ! Input: [real(r8) (:) ] top leaf layer leaf N concentration (gN leaf/m^2)
t10 => temperature_inst%t_a10_patch , & ! Input: [real(r8) (:) ] 10-day running mean of the 2 m temperature (K)
t_veg_day => temperature_inst%t_veg_day_patch , & ! Input: [real(r8) (:) ] daytime mean vegetation temperature (Kelvin)
t_veg_night => temperature_inst%t_veg_night_patch , & ! Input: [real(r8) (:) ] nighttime mean vegetation temperature (Kelvin)
t_veg_day_acc => temperature_inst%t_veg_day_acc_patch , & ! Input: [real(r8) (:) ] daytime mean vegetation temperature (Kelvin)
t_veg_night_acc => temperature_inst%t_veg_night_acc_patch , & ! Input: [real(r8) (:) ] nighttime mean vegetation temperature (Kelvin)
t_veg10_day => temperature_inst%t_veg10_day_patch , & ! Input: [real(r8) (:) ] 10-day mean daytime vegetation temperature (Kelvin)
t_veg10_night => temperature_inst%t_veg10_night_patch , & ! Input: [real(r8) (:) ] 10-day mean nighttime vegetation temperature (Kelvin)
rh10_p => waterdiagnosticbulk_inst%rh10_af_patch , & ! Input: [real(r8) (:) ] 10-day mean canopy air relative humidity at the pacth (unitless)
Expand Down Expand Up @@ -361,7 +361,7 @@ subroutine Update_Photosynthesis_Capacity(bounds, fn, filterp, &
c = patch%column(p)
!----------------------------------------------------
!store the daily mean climate conditions
if(t_veg_day(p).ne.spval) then !check whether it is the first day
if(t_veg_day_acc(p).ne.spval) then !check whether it is the first day
!------------------------------------------
!get the climate driver
CO2a10 = CO2_p240(p)
Expand Down Expand Up @@ -568,21 +568,21 @@ subroutine Acc240_Climate_LUNA(bounds, fn, filterp, oair, cair, &
real (r8) :: dtime ! stepsize in seconds
real (r8) :: TRad ! total short-wave radiation on the top of canopy (w/m2)
real (r8) :: tlaii ! total leaf area index for a certain canopy layer
real (r8) :: t_veg_dayi ! daytime mean vegetation temperature (Kelvin)
real (r8) :: t_veg_nighti ! nighttime mean vegetation temperature (Kelvin)
real (r8) :: par24d_z_i(1:nlevcan) ! daytime mean radiation (w/m**2)
!-------------------------------------------------------------------------------------------------------------------------------------------------
associate( &
par24d_z => solarabs_inst%par24d_z_patch , & ! Input: [real(r8) (:,:) ] daily accumulated absorbed PAR for leaves in canopy layer (W/m**2)
par24x_z => solarabs_inst%par24x_z_patch , & ! Input: [real(r8) (:,:) ] daily maximum of patch absorbed PAR for leaves in canopy layer (W/m**2)
nrad => surfalb_inst%nrad_patch , & ! Input: [integer (:) ] pft number of canopy layers, above snow for radiative transfer
t_veg_day => temperature_inst%t_veg_day_patch , & ! Input: [real(r8) (:) ] daytime accumulative vegetation temperature (Kelvin*nsteps)
t_veg_night => temperature_inst%t_veg_night_patch , & ! Input: [real(r8) (:) ] nighttime accumulative vegetation temperature (Kelvin*nsteps)
t_veg_day_acc => temperature_inst%t_veg_day_acc_patch , & ! Input: [real(r8) (:) ] daytime accumulative vegetation temperature (Kelvin*nsteps)
t_veg_night_acc => temperature_inst%t_veg_night_acc_patch , & ! Input: [real(r8) (:) ] nighttime accumulative vegetation temperature (Kelvin*nsteps)
t_veg_dayi => temperature_inst%t_veg_day_patch , & ! Input: [real(r8) (:) ] daytime mean vegetation temperature (Kelvin)
t_veg_nighti => temperature_inst%t_veg_night_patch , & ! Input: [real(r8) (:) ] nighttime mean vegetation temperature (Kelvin)
nnightsteps => temperature_inst%nnightsteps_patch , & ! Input: [integer (:) ] number of nighttime steps in 24 hours from mid-night, LUNA specific
ndaysteps => temperature_inst%ndaysteps_patch , & ! Input: [integer (:) ] number of daytime steps in 24 hours from mid-night, LUNA specific
t_veg10_day => temperature_inst%t_veg10_day_patch , & ! Output: [real(r8) (:) ] 10-day mean vegetation temperature (Kelvin)
t_veg10_night => temperature_inst%t_veg10_night_patch , & ! Output: [real(r8) (:) ] 10-day mean vegetation temperature (Kelvin)
rh10_p => waterdiagnosticbulk_inst%rh10_af_patch , & ! Output: [real(r8) (:) ] 10-day mean canopy air relative humidity at the pacth (s/m)
rh10_p => waterdiagnosticbulk_inst%rh10_af_patch , & ! Output: [real(r8) (:) ] 10-day mean canopy air relative humidity at the pacth (s/m)
rb10_p => frictionvel_inst%rb10_patch , & ! Output: [real(r8) (:) ] 10-day mean boundary layer resistance at the pacth (s/m)
par240d_z => solarabs_inst%par240d_z_patch , & ! Output: [real(r8) (:,:) ] 10-day running mean of daytime patch absorbed PAR for leaves in canopy layer (W/m**2)
par240x_z => solarabs_inst%par240x_z_patch & ! Output: [real(r8) (:,:) ] 10-day running mean of maximum patch absorbed PAR for leaves in canopy layer (W/m**2)
Expand All @@ -598,7 +598,7 @@ subroutine Acc240_Climate_LUNA(bounds, fn, filterp, oair, cair, &
ft = patch%itype(p)
g = patch%gridcell(p)
c = patch%column(p)
if(t_veg_day(p).ne.spval) then !check whether it is the first day
if(t_veg_day_acc(p).ne.spval) then !check whether it is the first day
!---------------------------------------------------------
!calculate the 10 day running mean radiations
if(ndaysteps(p)>0.0_r8) then
Expand All @@ -616,25 +616,25 @@ subroutine Acc240_Climate_LUNA(bounds, fn, filterp, oair, cair, &
!-------------------------------------------------------
!calculate the 10 day running mean daytime temperature
if(ndaysteps(p)>0.0_r8)then
t_veg_dayi = t_veg_day(p) / ndaysteps(p)
t_veg_dayi(p) = t_veg_day_acc(p) / ndaysteps(p)
else
t_veg_dayi = t_veg_night(p) / nnightsteps(p)
t_veg_dayi(p) = t_veg_night_acc(p) / nnightsteps(p)
endif
if(t_veg10_day(p).eq. spval)then
t_veg10_day(p) = t_veg_dayi
t_veg10_day(p) = t_veg_dayi(p)
endif
t_veg10_day(p) = 0.9_r8 * t_veg10_day(p)+ 0.1_r8 * t_veg_dayi
t_veg10_day(p) = 0.9_r8 * t_veg10_day(p)+ 0.1_r8 * t_veg_dayi(p)
!-------------------------------------------------------
!calculate the 10 day running mean nighttime temperature
if(nnightsteps(p)>0)then
t_veg_nighti = t_veg_night(p) / nnightsteps(p)
t_veg_nighti(p) = t_veg_night_acc(p) / nnightsteps(p)
else
t_veg_nighti = t_veg_day(p) / ndaysteps(p)
t_veg_nighti(p) = t_veg_day_acc(p) / ndaysteps(p)
endif
if(t_veg10_night(p).eq. spval)then
t_veg10_night(p) = t_veg_nighti
t_veg10_night(p) = t_veg_nighti(p)
endif
t_veg10_night(p) = 0.9_r8 * t_veg10_night(p) + 0.1_r8 * t_veg_nighti
t_veg10_night(p) = 0.9_r8 * t_veg10_night(p) + 0.1_r8 * t_veg_nighti(p)
!--------------------------------------------------------------------
if(rh10_p(p).eq. spval)then
rh10_p(p) = rh(p)
Expand Down Expand Up @@ -704,8 +704,8 @@ subroutine Acc24_Climate_LUNA(bounds, fn, filterp, canopystate_inst, photosyns_i
nrad => surfalb_inst%nrad_patch , & ! Input: [integer (:) ] pft number of canopy layers, above snow for radiative transfer
gpp => photosyns_inst%fpsn_patch , & ! Input: [real(r8) (:) ] patch instaneous gpp (umol CO2/m**2 ground/s) for canopy layer
gpp_day => photosyns_inst%fpsn24_patch , & ! Output: [real(r8) (:) ] patch 24 hours acculative gpp(umol CO2/m**2 ground/day) from mid-night
t_veg_day => temperature_inst%t_veg_day_patch , & ! Output: [real(r8) (:) ] daytime mean vegetation temperature (Kelvin)
t_veg_night => temperature_inst%t_veg_night_patch , & ! Output: [real(r8) (:) ] nighttime mean vegetation temperature (Kelvin)
t_veg_day_acc => temperature_inst%t_veg_day_acc_patch , & ! Output: [real(r8) (:) ] daytime mean vegetation temperature (Kelvin)
t_veg_night_acc => temperature_inst%t_veg_night_acc_patch , & ! Output: [real(r8) (:) ] nighttime mean vegetation temperature (Kelvin)
nnightsteps => temperature_inst%nnightsteps_patch , & ! Output: [integer (:) ] number of nighttime steps in 24 hours from mid-night, LUNA specific
ndaysteps => temperature_inst%ndaysteps_patch & ! Output: [integer (:) ] number of daytime steps in 24 hours from mid-night, LUNA specific
)
Expand All @@ -721,12 +721,12 @@ subroutine Acc24_Climate_LUNA(bounds, fn, filterp, canopystate_inst, photosyns_i
c = patch%column(p)
!----------------------------------------------------
!store the daily mean climate conditions
if(t_veg_day(p).ne.spval) then !check whether it is the first day
if(t_veg_day_acc(p).ne.spval) then !check whether it is the first day
if(sabv(p)>0)then
t_veg_day(p) = t_veg_day(p) + t_veg(p)
t_veg_day_acc(p) = t_veg_day_acc(p) + t_veg(p)
ndaysteps(p) = ndaysteps(p) + 1
else
t_veg_night(p) = t_veg_night(p) + t_veg(p)
t_veg_night_acc(p) = t_veg_night_acc(p) + t_veg(p)
nnightsteps(p) = nnightsteps(p) + 1
endif
do z = 1, nrad(p)
Expand Down Expand Up @@ -792,8 +792,8 @@ subroutine Clear24_Climate_LUNA(bounds, fn, filterp, canopystate_inst, photosyns
par24d_z => solarabs_inst%par24d_z_patch , & ! Output: [real(r8) (:,:) ] daily accumulated absorbed PAR for leaves in canopy layer (W/m**2)
par24x_z => solarabs_inst%par24x_z_patch , & ! Output: [real(r8) (:,:) ] daily maximum of patch absorbed PAR for leaves in canopy layer (W/m**2)
gpp_day => photosyns_inst%fpsn24_patch , & ! Output: [real(r8) (:) ] patch 24 hours acculative gpp(umol CO2/m**2 ground/day) from mid-night
t_veg_day => temperature_inst%t_veg_day_patch , & ! Output: [real(r8) (:) ] daytime mean vegetation temperature (Kelvin)
t_veg_night => temperature_inst%t_veg_night_patch , & ! Output: [real(r8) (:) ] nighttime mean vegetation temperature (Kelvin)
t_veg_day_acc => temperature_inst%t_veg_day_acc_patch , & ! Output: [real(r8) (:) ] daytime mean vegetation temperature (Kelvin)
t_veg_night_acc => temperature_inst%t_veg_night_acc_patch , & ! Output: [real(r8) (:) ] nighttime mean vegetation temperature (Kelvin)
nnightsteps => temperature_inst%nnightsteps_patch , & ! Output: [integer (:) ] number of nighttime steps in 24 hours from mid-night, LUNA specific
ndaysteps => temperature_inst%ndaysteps_patch & ! Output: [integer (:) ] number of daytime steps in 24 hours from mid-night, LUNA specific
)
Expand All @@ -809,8 +809,8 @@ subroutine Clear24_Climate_LUNA(bounds, fn, filterp, canopystate_inst, photosyns
c = patch%column(p)
!------------------------------------------------------------------------------
!clear out the daily state variables at the begining of simulations
t_veg_day(p) = 0.0_r8
t_veg_night(p) = 0.0_r8
t_veg_day_acc(p) = 0.0_r8
t_veg_night_acc(p) = 0.0_r8
par24d_z(p,:) = 0.0_r8
par24x_z(p,:) = 0.0_r8
gpp_day(p) = 0.0_r8
Expand Down
34 changes: 32 additions & 2 deletions src/biogeophys/TemperatureType.F90
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ module TemperatureType
real(r8), pointer :: t_stem_patch (:) ! patch stem temperatu\re (Kelvin)
real(r8), pointer :: t_veg_patch (:) ! patch vegetation temperature (Kelvin)
real(r8), pointer :: t_skin_patch (:) ! patch skin temperature (Kelvin)
real(r8), pointer :: t_veg_day_patch (:) ! patch daytime accumulative vegetation temperature (Kelvinx*nsteps), LUNA specific, from midnight to current step
real(r8), pointer :: t_veg_night_patch (:) ! patch night-time accumulative vegetation temperature (Kelvin*nsteps), LUNA specific, from midnight to current step
real(r8), pointer :: t_veg_day_acc_patch (:) ! patch daytime accumulative vegetation temperature (Kelvinx*nsteps), LUNA specific, from midnight to current step
real(r8), pointer :: t_veg_night_acc_patch (:) ! patch night-time accumulative vegetation temperature (Kelvin*nsteps), LUNA specific, from midnight to current step
real(r8), pointer :: t_veg_day_patch (:) ! patch daytime mean vegetation temperature (Kelvin), LUNA specific, from midnight to current step
real(r8), pointer :: t_veg_night_patch (:) ! patch night-time mean vegetation temperature (Kelvin), LUNA specific, from midnight to current step
real(r8), pointer :: t_veg10_day_patch (:) ! 10 day running mean of patch daytime time vegetation temperature (Kelvin), LUNA specific, but can be reused
real(r8), pointer :: t_veg10_night_patch (:) ! 10 day running mean of patch night time vegetation temperature (Kelvin), LUNA specific, but can be reused
integer, pointer :: ndaysteps_patch (:) ! number of daytime steps accumulated from mid-night, LUNA specific
Expand Down Expand Up @@ -216,6 +218,8 @@ subroutine InitAllocate(this, bounds)
allocate(this%t_veg_patch (begp:endp)) ; this%t_veg_patch (:) = nan
allocate(this%t_skin_patch (begp:endp)) ; this%t_skin_patch (:) = nan
if(use_luna) then
allocate(this%t_veg_day_acc_patch (begp:endp)) ; this%t_veg_day_acc_patch (:) = spval
allocate(this%t_veg_night_acc_patch (begp:endp)) ; this%t_veg_night_acc_patch (:) = spval
allocate(this%t_veg_day_patch (begp:endp)) ; this%t_veg_day_patch (:) = spval
allocate(this%t_veg_night_patch (begp:endp)) ; this%t_veg_night_patch (:) = spval
allocate(this%t_veg10_day_patch (begp:endp)) ; this%t_veg10_day_patch (:) = spval
Expand Down Expand Up @@ -422,6 +426,26 @@ subroutine InitHistory(this, bounds, is_simple_buildtemp, is_prog_buildtemp )
avgflag='A', long_name='vegetation temperature', &
ptr_patch=this%t_veg_patch)

this%t_veg_patch(begp:endp) = spval
call hist_addfld1d (fname='TVMAX', units='K', &
avgflag='X', long_name='vegetation maximum temperature', &
ptr_patch=this%t_veg_patch, default='inactive')

this%t_veg_patch(begp:endp) = spval
call hist_addfld1d (fname='TVMIN', units='K', &
avgflag='M', long_name='vegetation minimum temperature', &
ptr_patch=this%t_veg_patch, default='inactive')

this%t_veg_day_patch(begp:endp) = spval
call hist_addfld1d (fname='TVDAY', units='K', &
avgflag='A', long_name='average daytime vegetation temperature', &
ptr_patch=this%t_veg_day_patch, default='inactive')

this%t_veg_night_patch(begp:endp) = spval
call hist_addfld1d (fname='TVNIGHT', units='K', &
avgflag='A', long_name='average nighttime vegetation temperature', &
ptr_patch=this%t_veg_night_patch, default='inactive')

this%t_skin_patch(begp:endp) = spval
call hist_addfld1d(fname='TSKIN', units='K', &
avgflag='A', long_name='skin temperature', &
Expand Down Expand Up @@ -1095,12 +1119,18 @@ subroutine Restart(this, bounds, ncid, flag, is_simple_buildtemp, is_prog_buildt
interpinic_flag='interp', readvar=readvar, data=this%t_veg10_day_patch )
call restartvar(ncid=ncid, flag=flag, varname='tvegd', xtype=ncd_double, &
dim1name='pft', long_name='accumulative daytime vegetation temperature', units='Kelvin*steps', &
interpinic_flag='interp', readvar=readvar, data=this%t_veg_day_acc_patch )
call restartvar(ncid=ncid, flag=flag, varname='tvegdm', xtype=ncd_double, &
dim1name='pft', long_name='mean daytime vegetation temperature', units='Kelvin', &
interpinic_flag='interp', readvar=readvar, data=this%t_veg_day_patch )
call restartvar(ncid=ncid, flag=flag, varname='tvegn10', xtype=ncd_double, &
dim1name='pft', long_name='10-day mean nighttime vegetation temperature', units='Kelvin', &
interpinic_flag='interp', readvar=readvar, data=this%t_veg10_night_patch )
call restartvar(ncid=ncid, flag=flag, varname='tvegn', xtype=ncd_double, &
dim1name='pft', long_name='accumulative nighttime vegetation temperature', units='Kelvin*steps', &
interpinic_flag='interp', readvar=readvar, data=this%t_veg_night_acc_patch )
call restartvar(ncid=ncid, flag=flag, varname='tvegnm', xtype=ncd_double, &
dim1name='pft', long_name='mean nighttime vegetation temperature', units='Kelvin', &
interpinic_flag='interp', readvar=readvar, data=this%t_veg_night_patch )
call restartvar(ncid=ncid, flag=flag, varname='tair10', xtype=ncd_double, &
dim1name='pft', long_name='10-day mean air temperature', units='Kelvin', &
Expand Down