From 42e572d3ad37bda4f7b77161616b94883e305014 Mon Sep 17 00:00:00 2001 From: Shannon de Roos Date: Mon, 12 Aug 2024 12:16:20 -0600 Subject: [PATCH 1/3] added TMIN and TMAX as output vars --- src/biogeophys/TemperatureType.F90 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/biogeophys/TemperatureType.F90 b/src/biogeophys/TemperatureType.F90 index 899da6b882..e8f3e829a0 100644 --- a/src/biogeophys/TemperatureType.F90 +++ b/src/biogeophys/TemperatureType.F90 @@ -422,6 +422,17 @@ 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_skin_patch(begp:endp) = spval call hist_addfld1d(fname='TSKIN', units='K', & avgflag='A', long_name='skin temperature', & From 08bbe5a7fa455f7e467e6d772d4644bdf8d40302 Mon Sep 17 00:00:00 2001 From: Shannon de Roos Date: Thu, 15 Aug 2024 14:42:32 -0600 Subject: [PATCH 2/3] Added vegetation temperature day and night mean outputs --- src/biogeophys/LunaMod.F90 | 52 +++++++++++++++--------------- src/biogeophys/TemperatureType.F90 | 23 +++++++++++-- 2 files changed, 47 insertions(+), 28 deletions(-) diff --git a/src/biogeophys/LunaMod.F90 b/src/biogeophys/LunaMod.F90 index dbd39daedf..910139d701 100644 --- a/src/biogeophys/LunaMod.F90 +++ b/src/biogeophys/LunaMod.F90 @@ -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) @@ -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) @@ -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) @@ -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 @@ -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) @@ -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 ) @@ -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) @@ -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 ) @@ -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 diff --git a/src/biogeophys/TemperatureType.F90 b/src/biogeophys/TemperatureType.F90 index e8f3e829a0..7f83d88a03 100644 --- a/src/biogeophys/TemperatureType.F90 +++ b/src/biogeophys/TemperatureType.F90 @@ -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 @@ -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 @@ -432,6 +436,15 @@ subroutine InitHistory(this, bounds, is_simple_buildtemp, is_prog_buildtemp ) 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) + + 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) this%t_skin_patch(begp:endp) = spval call hist_addfld1d(fname='TSKIN', units='K', & @@ -1106,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', & From 2e8a8401fbb15f33913ae69c05e5df28d67c05cd Mon Sep 17 00:00:00 2001 From: Shannon de Roos Date: Fri, 16 Aug 2024 14:40:07 -0600 Subject: [PATCH 3/3] made new variables inactive by default --- src/biogeophys/TemperatureType.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/biogeophys/TemperatureType.F90 b/src/biogeophys/TemperatureType.F90 index 7f83d88a03..8f1434ee75 100644 --- a/src/biogeophys/TemperatureType.F90 +++ b/src/biogeophys/TemperatureType.F90 @@ -439,12 +439,12 @@ subroutine InitHistory(this, bounds, is_simple_buildtemp, is_prog_buildtemp ) 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) + 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) + ptr_patch=this%t_veg_night_patch, default='inactive') this%t_skin_patch(begp:endp) = spval call hist_addfld1d(fname='TSKIN', units='K', &