Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Summa Actors
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Numerical_Simulations_Lab
Actors
Summa Actors
Commits
a8ead8c4
Commit
a8ead8c4
authored
2 years ago
by
Kyle
Browse files
Options
Downloads
Patches
Plain Diff
copied from summa
parent
8ea21441
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
build/source/engine/bigAquifer.f90
+126
-132
126 additions, 132 deletions
build/source/engine/bigAquifer.f90
with
126 additions
and
132 deletions
build/source/engine/bigAquifer.f90
+
126
−
132
View file @
a8ead8c4
...
...
@@ -19,135 +19,129 @@
! along with this program. If not, see <http://www.gnu.org/licenses/>.
module
bigAquifer_module
! -----------------------------------------------------------------------------------------------------------
! numerical recipes data types
USE
nrtype
! access missing values
USE
globalData
,
only
:
integerMissing
! missing integer
USE
globalData
,
only
:
realMissing
! missing real number
! physical constants
USE
multiconst
,
only
:&
LH_vap
,
&
! latent heat of vaporization (J kg-1)
iden_water
! intrinsic density of water (kg m-3)
! -----------------------------------------------------------------------------------------------------------
implicit
none
private
public
::
bigAquifer
contains
! ***************************************************************************************************************
! public subroutine bigAquifer: compute aquifer water fluxes and their derivatives
! ***************************************************************************************************************
subroutine
bigAquifer
(&
! input: state variables and fluxes
scalarAquiferStorageTrial
,
&
! intent(in): trial value of aquifer storage (m)
scalarCanopyTranspiration
,
&
! intent(in): canopy transpiration (kg m-2 s-1)
scalarSoilDrainage
,
&
! intent(in): soil drainage (m s-1)
! input: pre-computed derivatives
dCanopyTrans_dCanWat
,
&
! intent(in): derivative in canopy transpiration w.r.t. canopy total water content (s-1)
dCanopyTrans_dTCanair
,
&
! intent(in): derivative in canopy transpiration w.r.t. canopy air temperature (kg m-2 s-1 K-1)
dCanopyTrans_dTCanopy
,
&
! intent(in): derivative in canopy transpiration w.r.t. canopy temperature (kg m-2 s-1 K-1)
dCanopyTrans_dTGround
,
&
! intent(in): derivative in canopy transpiration w.r.t. ground temperature (kg m-2 s-1 K-1)
! input: diagnostic variables and parameters
mpar_data
,
&
! intent(in): model parameter structure
diag_data
,
&
! intent(in): diagnostic variable structure
! output: fluxes
scalarAquiferTranspire
,
&
! intent(out): transpiration loss from the aquifer (m s-1)
scalarAquiferRecharge
,
&
! intent(out): recharge to the aquifer (m s-1)
scalarAquiferBaseflow
,
&
! intent(out): total baseflow from the aquifer (m s-1)
dBaseflow_dAquifer
,
&
! intent(out): change in baseflow flux w.r.t. aquifer storage (s-1)
! output: derivatives in transpiration w.r.t. canopy state variables
dAquiferTrans_dTCanair
,
&
! intent(out): derivatives in the aquifer transpiration flux w.r.t. canopy air temperature
dAquiferTrans_dTCanopy
,
&
! intent(out): derivatives in the aquifer transpiration flux w.r.t. canopy temperature
dAquiferTrans_dTGround
,
&
! intent(out): derivatives in the aquifer transpiration flux w.r.t. ground temperature
dAquiferTrans_dCanWat
,
&
! intent(out): derivatives in the aquifer transpiration flux w.r.t. canopy total water
! output: error control
err
,
message
)
! intent(out): error control
! named variables
USE
var_lookup
,
only
:
iLookDIAG
! named variables for structure elements
USE
var_lookup
,
only
:
iLookPARAM
! named variables for structure elements
! data types
USE
data_types
,
only
:
var_dlength
! x%var(:)%dat (rkind)
! -------------------------------------------------------------------------------------------------------------------------------------------------
implicit
none
! input: state variables, fluxes, and parameters
real
(
rkind
),
intent
(
in
)
::
scalarAquiferStorageTrial
! trial value of aquifer storage (m)
real
(
rkind
),
intent
(
in
)
::
scalarCanopyTranspiration
! canopy transpiration (kg m-2 s-1)
real
(
rkind
),
intent
(
in
)
::
scalarSoilDrainage
! soil drainage (m s-1)
! input: pre-computed derivatves
real
(
rkind
),
intent
(
in
)
::
dCanopyTrans_dCanWat
! derivative in canopy transpiration w.r.t. canopy total water content (s-1)
real
(
rkind
),
intent
(
in
)
::
dCanopyTrans_dTCanair
! derivative in canopy transpiration w.r.t. canopy air temperature (kg m-2 s-1 K-1)
real
(
rkind
),
intent
(
in
)
::
dCanopyTrans_dTCanopy
! derivative in canopy transpiration w.r.t. canopy temperature (kg m-2 s-1 K-1)
real
(
rkind
),
intent
(
in
)
::
dCanopyTrans_dTGround
! derivative in canopy transpiration w.r.t. ground temperature (kg m-2 s-1 K-1)
! input: diagnostic variables and parameters
type
(
var_dlength
),
intent
(
in
)
::
mpar_data
! model parameters
type
(
var_dlength
),
intent
(
in
)
::
diag_data
! diagnostic variables for a local HRU
! output: fluxes
real
(
rkind
),
intent
(
out
)
::
scalarAquiferTranspire
! transpiration loss from the aquifer (m s-1)
real
(
rkind
),
intent
(
out
)
::
scalarAquiferRecharge
! recharge to the aquifer (m s-1)
real
(
rkind
),
intent
(
out
)
::
scalarAquiferBaseflow
! total baseflow from the aquifer (m s-1)
real
(
rkind
),
intent
(
out
)
::
dBaseflow_dAquifer
! change in baseflow flux w.r.t. aquifer storage (s-1)
! output: derivatives in transpiration w.r.t. canopy state variables
real
(
rkind
),
intent
(
inout
)
::
dAquiferTrans_dTCanair
! derivatives in the aquifer transpiration flux w.r.t. canopy air temperature
real
(
rkind
),
intent
(
inout
)
::
dAquiferTrans_dTCanopy
! derivatives in the aquifer transpiration flux w.r.t. canopy temperature
real
(
rkind
),
intent
(
inout
)
::
dAquiferTrans_dTGround
! derivatives in the aquifer transpiration flux w.r.t. ground temperature
real
(
rkind
),
intent
(
inout
)
::
dAquiferTrans_dCanWat
! derivatives in the aquifer transpiration flux w.r.t. canopy total water
! output: error control
integer
(
i4b
),
intent
(
out
)
::
err
! error code
character
(
*
),
intent
(
out
)
::
message
! error message
! -----------------------------------------------------------------------------------------------------------------------------------------------------
! local variables
real
(
rkind
)
::
aquiferTranspireFrac
! fraction of total transpiration that comes from the aquifer (-)
real
(
rkind
)
::
xTemp
! temporary variable (-)
! -------------------------------------------------------------------------------------------------------------------------------------------------
! initialize error control
err
=
0
;
message
=
'bigAquifer/'
! make association between local variables and the information in the data structures
associate
(&
! model diagnostic variables: contribution of the aquifer to transpiration
scalarTranspireLim
=>
diag_data
%
var
(
iLookDIAG
%
scalarTranspireLim
)
%
dat
(
1
),
&
! intent(in): [dp] weighted average of the transpiration limiting factor (-)
scalarAquiferRootFrac
=>
diag_data
%
var
(
iLookDIAG
%
scalarAquiferRootFrac
)
%
dat
(
1
),
&
! intent(in): [dp] fraction of roots below the lowest soil layer (-)
scalarTranspireLimAqfr
=>
diag_data
%
var
(
iLookDIAG
%
scalarTranspireLimAqfr
)
%
dat
(
1
),
&
! intent(in): [dp] transpiration limiting factor for the aquifer (-)
! model parameters: baseflow flux
aquiferBaseflowRate
=>
mpar_data
%
var
(
iLookPARAM
%
aquiferBaseflowRate
)
%
dat
(
1
),
&
! intent(in): [dp] tbaseflow rate when aquiferStorage = aquiferScaleFactor (m s-1)
aquiferScaleFactor
=>
mpar_data
%
var
(
iLookPARAM
%
aquiferScaleFactor
)
%
dat
(
1
),
&
! intent(in): [dp] scaling factor for aquifer storage in the big bucket (m)
aquiferBaseflowExp
=>
mpar_data
%
var
(
iLookPARAM
%
aquiferBaseflowExp
)
%
dat
(
1
)
&
! intent(in): [dp] baseflow exponent (-)
)
! associating local variables with the information in the data structures
! compute aquifer transpiration (m s-1)
aquiferTranspireFrac
=
scalarAquiferRootFrac
*
scalarTranspireLimAqfr
/
scalarTranspireLim
! fraction of total transpiration that comes from the aquifer (-)
scalarAquiferTranspire
=
aquiferTranspireFrac
*
scalarCanopyTranspiration
/
iden_water
! aquifer transpiration (kg m-2 s-1 --> m s-1)
! derivatives in transpiration w.r.t. canopy state variables
dAquiferTrans_dCanWat
=
aquiferTranspireFrac
*
dCanopyTrans_dCanWat
/
iden_water
dAquiferTrans_dTCanair
=
aquiferTranspireFrac
*
dCanopyTrans_dTCanair
/
iden_water
dAquiferTrans_dTCanopy
=
aquiferTranspireFrac
*
dCanopyTrans_dTCanopy
/
iden_water
dAquiferTrans_dTGround
=
aquiferTranspireFrac
*
dCanopyTrans_dTGround
/
iden_water
! compute aquifer recharge (transfer variables -- included for generality for basin-wide aquifer)
scalarAquiferRecharge
=
scalarSoilDrainage
! m s-1
! compute the aquifer baseflow (m s-1)
xTemp
=
scalarAquiferStorageTrial
/
aquiferScaleFactor
scalarAquiferBaseflow
=
aquiferBaseflowRate
*
(
xTemp
**
aquiferBaseflowExp
)
! compute the derivative in the net aquifer flux
dBaseflow_dAquifer
=
-
(
aquiferBaseflowExp
*
aquiferBaseflowRate
*
(
xTemp
**
(
aquiferBaseflowExp
-
1._rkind
)))/
aquiferScaleFactor
! end association to data in structures
end
associate
end
subroutine
bigAquifer
! *******************************************************************************************************************************************************************************
! *******************************************************************************************************************************************************************************
end
module
bigAquifer_module
\ No newline at end of file
! -----------------------------------------------------------------------------------------------------------
! numerical recipes data types
USE
nrtype
! access missing values
USE
globalData
,
only
:
integerMissing
! missing integer
USE
globalData
,
only
:
realMissing
! missing real number
! physical constants
USE
multiconst
,
only
:&
LH_vap
,
&
! latent heat of vaporization (J kg-1)
iden_water
! intrinsic density of water (kg m-3)
! -----------------------------------------------------------------------------------------------------------
implicit
none
private
public
::
bigAquifer
contains
! ***************************************************************************************************************
! public subroutine bigAquifer: compute aquifer water fluxes and their derivatives
! ***************************************************************************************************************
subroutine
bigAquifer
(&
! input: state variables and fluxes
scalarAquiferStorageTrial
,
&
! intent(in): trial value of aquifer storage (m)
scalarCanopyTranspiration
,
&
! intent(in): canopy transpiration (kg m-2 s-1)
scalarSoilDrainage
,
&
! intent(in): soil drainage (m s-1)
! input: pre-computed derivatives
dCanopyTrans_dCanWat
,
&
! intent(in): derivative in canopy transpiration w.r.t. canopy total water content (s-1)
dCanopyTrans_dTCanair
,
&
! intent(in): derivative in canopy transpiration w.r.t. canopy air temperature (kg m-2 s-1 K-1)
dCanopyTrans_dTCanopy
,
&
! intent(in): derivative in canopy transpiration w.r.t. canopy temperature (kg m-2 s-1 K-1)
dCanopyTrans_dTGround
,
&
! intent(in): derivative in canopy transpiration w.r.t. ground temperature (kg m-2 s-1 K-1)
! input: diagnostic variables and parameters
mpar_data
,
&
! intent(in): model parameter structure
diag_data
,
&
! intent(in): diagnostic variable structure
! output: fluxes
scalarAquiferTranspire
,
&
! intent(out): transpiration loss from the aquifer (m s-1)
scalarAquiferRecharge
,
&
! intent(out): recharge to the aquifer (m s-1)
scalarAquiferBaseflow
,
&
! intent(out): total baseflow from the aquifer (m s-1)
dBaseflow_dAquifer
,
&
! intent(out): change in baseflow flux w.r.t. aquifer storage (s-1)
! output: derivatives in transpiration w.r.t. canopy state variables
dAquiferTrans_dTCanair
,
&
! intent(out): derivatives in the aquifer transpiration flux w.r.t. canopy air temperature
dAquiferTrans_dTCanopy
,
&
! intent(out): derivatives in the aquifer transpiration flux w.r.t. canopy temperature
dAquiferTrans_dTGround
,
&
! intent(out): derivatives in the aquifer transpiration flux w.r.t. ground temperature
dAquiferTrans_dCanWat
,
&
! intent(out): derivatives in the aquifer transpiration flux w.r.t. canopy total water
! output: error control
err
,
message
)
! intent(out): error control
! named variables
USE
var_lookup
,
only
:
iLookDIAG
! named variables for structure elements
USE
var_lookup
,
only
:
iLookPARAM
! named variables for structure elements
! data types
USE
data_types
,
only
:
var_dlength
! x%var(:)%dat (rkind)
! -------------------------------------------------------------------------------------------------------------------------------------------------
implicit
none
! input: state variables, fluxes, and parameters
real
(
rkind
),
intent
(
in
)
::
scalarAquiferStorageTrial
! trial value of aquifer storage (m)
real
(
rkind
),
intent
(
in
)
::
scalarCanopyTranspiration
! canopy transpiration (kg m-2 s-1)
real
(
rkind
),
intent
(
in
)
::
scalarSoilDrainage
! soil drainage (m s-1)
! input: pre-computed derivatves
real
(
rkind
),
intent
(
in
)
::
dCanopyTrans_dCanWat
! derivative in canopy transpiration w.r.t. canopy total water content (s-1)
real
(
rkind
),
intent
(
in
)
::
dCanopyTrans_dTCanair
! derivative in canopy transpiration w.r.t. canopy air temperature (kg m-2 s-1 K-1)
real
(
rkind
),
intent
(
in
)
::
dCanopyTrans_dTCanopy
! derivative in canopy transpiration w.r.t. canopy temperature (kg m-2 s-1 K-1)
real
(
rkind
),
intent
(
in
)
::
dCanopyTrans_dTGround
! derivative in canopy transpiration w.r.t. ground temperature (kg m-2 s-1 K-1)
! input: diagnostic variables and parameters
type
(
var_dlength
),
intent
(
in
)
::
mpar_data
! model parameters
type
(
var_dlength
),
intent
(
in
)
::
diag_data
! diagnostic variables for a local HRU
! output: fluxes
real
(
rkind
),
intent
(
out
)
::
scalarAquiferTranspire
! transpiration loss from the aquifer (m s-1)
real
(
rkind
),
intent
(
out
)
::
scalarAquiferRecharge
! recharge to the aquifer (m s-1)
real
(
rkind
),
intent
(
out
)
::
scalarAquiferBaseflow
! total baseflow from the aquifer (m s-1)
real
(
rkind
),
intent
(
out
)
::
dBaseflow_dAquifer
! change in baseflow flux w.r.t. aquifer storage (s-1)
! output: derivatives in transpiration w.r.t. canopy state variables
real
(
rkind
),
intent
(
inout
)
::
dAquiferTrans_dTCanair
! derivatives in the aquifer transpiration flux w.r.t. canopy air temperature
real
(
rkind
),
intent
(
inout
)
::
dAquiferTrans_dTCanopy
! derivatives in the aquifer transpiration flux w.r.t. canopy temperature
real
(
rkind
),
intent
(
inout
)
::
dAquiferTrans_dTGround
! derivatives in the aquifer transpiration flux w.r.t. ground temperature
real
(
rkind
),
intent
(
inout
)
::
dAquiferTrans_dCanWat
! derivatives in the aquifer transpiration flux w.r.t. canopy total water
! output: error control
integer
(
i4b
),
intent
(
out
)
::
err
! error code
character
(
*
),
intent
(
out
)
::
message
! error message
! -----------------------------------------------------------------------------------------------------------------------------------------------------
! local variables
real
(
rkind
)
::
aquiferTranspireFrac
! fraction of total transpiration that comes from the aquifer (-)
real
(
rkind
)
::
xTemp
! temporary variable (-)
! -------------------------------------------------------------------------------------------------------------------------------------------------
! initialize error control
err
=
0
;
message
=
'bigAquifer/'
! make association between local variables and the information in the data structures
associate
(&
! model diagnostic variables: contribution of the aquifer to transpiration
scalarTranspireLim
=>
diag_data
%
var
(
iLookDIAG
%
scalarTranspireLim
)
%
dat
(
1
),
&
! intent(in): [dp] weighted average of the transpiration limiting factor (-)
scalarAquiferRootFrac
=>
diag_data
%
var
(
iLookDIAG
%
scalarAquiferRootFrac
)
%
dat
(
1
),
&
! intent(in): [dp] fraction of roots below the lowest soil layer (-)
scalarTranspireLimAqfr
=>
diag_data
%
var
(
iLookDIAG
%
scalarTranspireLimAqfr
)
%
dat
(
1
),
&
! intent(in): [dp] transpiration limiting factor for the aquifer (-)
! model parameters: baseflow flux
aquiferBaseflowRate
=>
mpar_data
%
var
(
iLookPARAM
%
aquiferBaseflowRate
)
%
dat
(
1
),
&
! intent(in): [dp] tbaseflow rate when aquiferStorage = aquiferScaleFactor (m s-1)
aquiferScaleFactor
=>
mpar_data
%
var
(
iLookPARAM
%
aquiferScaleFactor
)
%
dat
(
1
),
&
! intent(in): [dp] scaling factor for aquifer storage in the big bucket (m)
aquiferBaseflowExp
=>
mpar_data
%
var
(
iLookPARAM
%
aquiferBaseflowExp
)
%
dat
(
1
)
&
! intent(in): [dp] baseflow exponent (-)
)
! associating local variables with the information in the data structures
! compute aquifer transpiration (m s-1)
aquiferTranspireFrac
=
scalarAquiferRootFrac
*
scalarTranspireLimAqfr
/
scalarTranspireLim
! fraction of total transpiration that comes from the aquifer (-)
scalarAquiferTranspire
=
aquiferTranspireFrac
*
scalarCanopyTranspiration
/
iden_water
! aquifer transpiration (kg m-2 s-1 --> m s-1)
! derivatives in transpiration w.r.t. canopy state variables
dAquiferTrans_dCanWat
=
aquiferTranspireFrac
*
dCanopyTrans_dCanWat
/
iden_water
dAquiferTrans_dTCanair
=
aquiferTranspireFrac
*
dCanopyTrans_dTCanair
/
iden_water
dAquiferTrans_dTCanopy
=
aquiferTranspireFrac
*
dCanopyTrans_dTCanopy
/
iden_water
dAquiferTrans_dTGround
=
aquiferTranspireFrac
*
dCanopyTrans_dTGround
/
iden_water
! compute aquifer recharge (transfer variables -- included for generality for basin-wide aquifer)
scalarAquiferRecharge
=
scalarSoilDrainage
! m s-1
! compute the aquifer baseflow (m s-1)
xTemp
=
scalarAquiferStorageTrial
/
aquiferScaleFactor
scalarAquiferBaseflow
=
aquiferBaseflowRate
*
(
xTemp
**
aquiferBaseflowExp
)
! compute the derivative in the net aquifer flux
dBaseflow_dAquifer
=
-
(
aquiferBaseflowExp
*
aquiferBaseflowRate
*
(
xTemp
**
(
aquiferBaseflowExp
-
1._rkind
)))/
aquiferScaleFactor
! end association to data in structures
end
associate
end
subroutine
bigAquifer
end
module
bigAquifer_module
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment