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

WIP: Prototype water state breakout #395

Closed
Closed
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
28 changes: 28 additions & 0 deletions src/biogeophys/WaterBalanceType.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module WaterBalanceType

! This type contains variables used in water balance checks and adjustments done based
! on changes in water states from one point to another. We'll need separate instances
! for each isotope/tracer if we want to do balance checks and related adjustments on
! the isotopes/tracers.
type, public :: waterbalance_type
real(r8), pointer :: h2osno_old_col (:) ! col snow mass for previous time step (kg/m2) (new)
real(r8), pointer :: liq1_grc (:) ! grc initial gridcell total h2o liq content
real(r8), pointer :: liq2_grc (:) ! grc post land cover change total liq content
real(r8), pointer :: ice1_grc (:) ! grc initial gridcell total h2o ice content
real(r8), pointer :: ice2_grc (:) ! grc post land cover change total ice content

real(r8), pointer :: begwb_col (:) ! water mass begining of the time step
real(r8), pointer :: endwb_col (:) ! water mass end of the time step
real(r8), pointer :: errh2o_patch (:) ! water conservation error (mm H2O)
real(r8), pointer :: errh2o_col (:) ! water conservation error (mm H2O)
real(r8), pointer :: errh2osno_col (:) ! snow water conservation error(mm H2O)
contains
procedure :: Init
procedure :: Restart
end type waterbalance_type

contains

! Standard infrastructure routines here

end module WaterBalanceType
66 changes: 66 additions & 0 deletions src/biogeophys/WaterDiagnosticBulkType.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
module WaterDiagnosticsBulkType

! This type contains everything in waterdiag_type, plus water diagnostic variables that
! only apply to the bulk water state.
type, extends(waterdiag_type), public :: waterdiag_bulk_type
real(r8), pointer :: snow_depth_col (:) ! col snow height of snow covered area (m)
real(r8), pointer :: snowdp_col (:) ! col area-averaged snow height (m)
real(r8), pointer :: snow_layer_unity_col (:,:) ! value 1 for each snow layer, used for history diagnostics
real(r8), pointer :: bw_col (:,:) ! col partial density of water in the snow pack (ice + liquid) [kg/m3]

real(r8), pointer :: h2osoi_liq_tot_col (:) ! vertically summed col liquid water (kg/m2) (new) (-nlevsno+1:nlevgrnd)
real(r8), pointer :: h2osoi_ice_tot_col (:) ! vertically summed col ice lens (kg/m2) (new) (-nlevsno+1:nlevgrnd)
real(r8), pointer :: air_vol_col (:,:) ! col air filled porosity
real(r8), pointer :: h2osoi_liqvol_col (:,:) ! col volumetric liquid water content (v/v)
real(r8), pointer :: snounload_patch (:) ! Canopy snow unloading (mm H2O)
real(r8), pointer :: swe_old_col (:,:) ! col initial snow water

real(r8), pointer :: total_plant_stored_h2o_col(:) ! col water that is bound in plants, including roots, sapwood, leaves, etc
! in most cases, the vegetation scheme does not have a dynamic
! water storage in plants, and thus 0.0 is a suitable for the trivial case.
! When FATES is coupled in with plant hydraulics turned on, this storage
! term is set to non-zero. (kg/m2 H2O)

real(r8), pointer :: snw_rds_col (:,:) ! col snow grain radius (col,lyr) [m^-6, microns]
real(r8), pointer :: snw_rds_top_col (:) ! col snow grain radius (top layer) [m^-6, microns]
real(r8), pointer :: h2osno_top_col (:) ! col top-layer mass of snow [kg]
real(r8), pointer :: sno_liq_top_col (:) ! col snow liquid water fraction (mass), top layer [fraction]

real(r8), pointer :: rh_ref2m_patch (:) ! patch 2 m height surface relative humidity (%)
real(r8), pointer :: rh_ref2m_r_patch (:) ! patch 2 m height surface relative humidity - rural (%)
real(r8), pointer :: rh_ref2m_u_patch (:) ! patch 2 m height surface relative humidity - urban (%)
real(r8), pointer :: rh_af_patch (:) ! patch fractional humidity of canopy air (dimensionless) ! private
real(r8), pointer :: rh10_af_patch (:) ! 10-day mean patch fractional humidity of canopy air (dimensionless)
real(r8), pointer :: dqgdT_col (:) ! col d(qg)/dT

! Fractions
real(r8), pointer :: frac_sno_col (:) ! col fraction of ground covered by snow (0 to 1)
real(r8), pointer :: frac_sno_eff_col (:) ! col fraction of ground covered by snow (0 to 1)
real(r8), pointer :: frac_iceold_col (:,:) ! col fraction of ice relative to the tot water (new) (-nlevsno+1:nlevgrnd)
real(r8), pointer :: frac_h2osfc_col (:) ! col fractional area with surface water greater than zero
real(r8), pointer :: frac_h2osfc_nosnow_col (:) ! col fractional area with surface water greater than zero (if no snow present)
real(r8), pointer :: wf_col (:) ! col soil water as frac. of whc for top 0.05 m (0-1)
real(r8), pointer :: wf2_col (:) ! col soil water as frac. of whc for top 0.17 m (0-1)
real(r8), pointer :: fwet_patch (:) ! patch canopy fraction that is wet (0 to 1)
real(r8), pointer :: fcansno_patch (:) ! patch canopy fraction that is snow covered (0 to 1)
real(r8), pointer :: fdry_patch (:) ! patch canopy fraction of foliage that is green and dry [-] (new)
contains
procedure :: Init
procedure :: Restart
end type waterdiag_bulk_type

contains

subroutine Init(this, bounds, ...)
call this%waterdiag_type%Init(bounds, ...)

! Then do init stuff needed for the variables declared in this module
end subroutine Init

subroutine Restart(this, bounds, ...)
call this%waterdiag_type%Restart(bounds, ...)

! Then do restart stuff needed for the variables declared in this module
end subroutine Restart

end module WaterDiagnosticsBulkType
31 changes: 31 additions & 0 deletions src/biogeophys/WaterDiagnosticType.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module WaterDiagnosticType

! This type contains water diagnostic variables for which we need a separate instance
! for each isotope or water tracer.
type, public :: waterdiag_type
real(r8), pointer :: snowice_col (:) ! col average snow ice lens
real(r8), pointer :: snowliq_col (:) ! col average snow liquid water
real(r8), pointer :: h2osoi_liqice_10cm_col (:) ! col liquid water + ice lens in top 10cm of soil (kg/m2)
real(r8), pointer :: h2osoi_vol_col (:,:) ! col volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (nlevgrnd)

real(r8), pointer :: q_ref2m_patch (:) ! patch 2 m height surface specific humidity (kg/kg)
real(r8), pointer :: qg_col (:) ! col ground specific humidity [kg/kg]
real(r8), pointer :: tws_grc (:) ! grc total water storage (mm H2O) NOTE: Similar to wt_col in the old code

! NOTE(wjs, 2018-05-24) I'm not sure whether we need a separate instance for each
! tracer for these, but they look similar to qg, which had a separate water isotope
! instance in the old water isotope branch.
real(r8), pointer :: qg_snow_col (:) ! col ground specific humidity [kg/kg]
real(r8), pointer :: qg_soil_col (:) ! col ground specific humidity [kg/kg]
real(r8), pointer :: qg_h2osfc_col (:) ! col ground specific humidity [kg/kg]
real(r8), pointer :: qaf_lun (:) ! lun urban canopy air specific humidity (kg/kg)
contains
procedure :: Init
procedure :: Restart
end type waterdiag_type

contains

! Standard infrastructure routines here

end module WaterDiagnosticType
27 changes: 27 additions & 0 deletions src/biogeophys/WaterStateBulkType.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module WaterStateBulkType

! This type contains everything in waterstate_type, plus water state variables that
! only apply to the bulk water state.
type, extends(waterstate_type), public :: waterstate_bulk_type
real(r8), pointer :: snow_persistence_col (:) ! col length of time that ground has had non-zero snow thickness (sec)
real(r8), pointer :: int_snow_col (:) ! col integrated snowfall (mm H2O)
contains
procedure :: Init
procedure :: Restart
end type waterstate_bulk_type

contains

subroutine Init(this, bounds, ...)
call this%waterstate_type%Init(bounds, ...)

! Then do init stuff needed for the variables declared in this module
end subroutine Init

subroutine Restart(this, bounds, ...)
call this%waterstate_type%Restart(bounds, ...)

! Then do restart stuff needed for the variables declared in this module
end subroutine Restart

end module WaterStateBulkType
Loading