Skip to content

Commit

Permalink
Merge branch 'ozone_refactor' into simple_bfb_feb21
Browse files Browse the repository at this point in the history
  • Loading branch information
billsacks committed Feb 20, 2021
2 parents f2faca6 + 329977f commit 40ad51c
Show file tree
Hide file tree
Showing 6 changed files with 173 additions and 103 deletions.
12 changes: 6 additions & 6 deletions src/biogeophys/CanopyFluxesMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1550,16 +1550,16 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp,
call PhotosynthesisTotal(fn, filterp, &
atm2lnd_inst, canopystate_inst, photosyns_inst)

! Calculate ozone stress. This needs to be done after rssun and rsshade are
! computed by the Photosynthesis routine. However, Photosynthesis also uses the
! ozone stress computed here. Thus, the ozone stress computed in timestep i is
! applied in timestep (i+1).
! Calculate ozone uptake. This needs to be done after rssun and rsshade are
! computed by the Photosynthesis routine. The updated ozone uptake computed here
! will be used in the next time step to calculate ozone stress for the next time
! step's photosynthesis calculations.

! COMPILER_BUG(wjs, 2014-11-29, pgi 14.7) The following dummy variable assignment is
! needed with pgi 14.7 on yellowstone; without it, forc_pbot_downscaled_col gets
! resized inappropriately in the following subroutine call, due to a compiler bug.
dummy_to_make_pgi_happy = ubound(atm2lnd_inst%forc_pbot_downscaled_col, 1)
call ozone_inst%CalcOzoneStress( &
call ozone_inst%CalcOzoneUptake( &
bounds, fn, filterp, &
forc_pbot = atm2lnd_inst%forc_pbot_downscaled_col(bounds%begc:bounds%endc), &
forc_th = atm2lnd_inst%forc_th_downscaled_col(bounds%begc:bounds%endc), &
Expand All @@ -1568,7 +1568,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp,
rb = frictionvel_inst%rb1_patch(bounds%begp:bounds%endp), &
ram = frictionvel_inst%ram1_patch(bounds%begp:bounds%endp), &
tlai = canopystate_inst%tlai_patch(bounds%begp:bounds%endp))

!---------------------------------------------------------
!update Vc,max and Jmax by LUNA model
if(use_luna)then
Expand Down
16 changes: 13 additions & 3 deletions src/biogeophys/OzoneBaseMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ module OzoneBaseMod
! The following routines need to be implemented by all type extensions
procedure(Init_interface) , public, deferred :: Init
procedure(Restart_interface) , public, deferred :: Restart
procedure(CalcOzoneUptake_interface) , public, deferred :: CalcOzoneUptake
procedure(CalcOzoneStress_interface) , public, deferred :: CalcOzoneStress

! The following routines should only be called by extensions of the ozone_base_type
Expand Down Expand Up @@ -59,8 +60,8 @@ subroutine Restart_interface(this, bounds, ncid, flag)
type(file_desc_t) , intent(inout) :: ncid ! netcdf id
character(len=*) , intent(in) :: flag ! 'read', 'write' or 'define'
end subroutine Restart_interface
subroutine CalcOzoneStress_interface(this, bounds, num_exposedvegp, filter_exposedvegp, &

subroutine CalcOzoneUptake_interface(this, bounds, num_exposedvegp, filter_exposedvegp, &
forc_pbot, forc_th, rssun, rssha, rb, ram, tlai)
use decompMod , only : bounds_type
use shr_kind_mod , only : r8 => shr_kind_r8
Expand All @@ -77,8 +78,17 @@ subroutine CalcOzoneStress_interface(this, bounds, num_exposedvegp, filter_expos
real(r8) , intent(in) :: rb( bounds%begp: ) ! boundary layer resistance (s/m)
real(r8) , intent(in) :: ram( bounds%begp: ) ! aerodynamical resistance (s/m)
real(r8) , intent(in) :: tlai( bounds%begp: ) ! one-sided leaf area index, no burying by snow
end subroutine CalcOzoneStress_interface
end subroutine CalcOzoneUptake_interface

subroutine CalcOzoneStress_interface(this, bounds, num_exposedvegp, filter_exposedvegp)
use decompMod, only : bounds_type
import :: ozone_base_type

class(ozone_base_type) , intent(inout) :: this
type(bounds_type) , intent(in) :: bounds
integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp
integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg
end subroutine CalcOzoneStress_interface
end interface

contains
Expand Down
4 changes: 2 additions & 2 deletions src/biogeophys/OzoneFactoryMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ function create_and_init_ozone_type(bounds) result(ozone)
!-----------------------------------------------------------------------

if (use_ozone) then
allocate(ozone, source = ozone_type())
allocate(ozone_type :: ozone)
else
allocate(ozone, source = ozone_off_type())
allocate(ozone_off_type :: ozone)
end if

call ozone%Init(bounds)
Expand Down
Loading

0 comments on commit 40ad51c

Please sign in to comment.