-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathDommasbMod.F90
More file actions
executable file
·79 lines (63 loc) · 4.72 KB
/
DommasbMod.F90
File metadata and controls
executable file
·79 lines (63 loc) · 4.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
MODULE DommasbMod
!Description: core code of Dissolved Organic Matter mass balance utilizing river routing models
!Developed by Marius Lambert 02-02-2023
!This module is currently made interact with MOSART routing model
! USES:
use shr_kind_mod , only : r8 => shr_kind_r8
use shr_const_mod , only : SHR_CONST_REARTH, SHR_CONST_PI
use shr_sys_mod , only : shr_sys_abort
use RunoffMod , only : TRunoff, Tdom, TUnit
use RtmVar , only : iulog
implicit none
public hillslopeRoutingDOM
public subnetworkRoutingDOM
public mainchannelRoutingDOM
!--------------------------------------------------------------------
! ! PUBLIC MEMBER FUNCTIONS:
contains
!----------------------------------------------------------------------
subroutine hillslopeRoutingDOM(iunit,nt,ntdom,theDeltaT)
! ! DESCRIPTION: solve the ODEs with Euler algorithm for hillslope routing
implicit none
integer, intent(in) :: iunit, nt, ntdom
real(r8), intent(in) :: theDeltaT
!domsur (kg/m2*s) ,domH (kg/m2), ehout (m/s), domHout (kg/m2*s), qsur (m/s), wh (m)
Tdom%domHout(iunit,ntdom) = -TRunoff%ehout(iunit,nt) * (Tdom%domH(iunit,ntdom) + Tdom%domsur(iunit,ntdom) * theDeltaT)/(TRunoff%wh(iunit,nt)-TRunoff%dwh(iunit,nt)*theDeltaT+TRunoff%qsur(iunit,nt)*theDeltaT)
!we dont want a too high out
!Tdom%domHout(iunit,ntdom) = min(-TRunoff%ehout(iunit,nt) * 0.3_r8, Tdom%domHout(iunit,ntdom))
!cannot be less than 0, lower boundary
!Tdom%domHout(iunit,ntdom) = max(0._r8,Tdom%domHout(iunit,ntdom))
!cannot be more than available carbon, upper boundary
!Tdom%domHout(iunit,ntdom) = min((Tdom%domH(iunit,ntdom)+Tdom%domsur(iunit,ntdom)*theDeltaT)/theDeltaT,Tdom%domHout(iunit,ntdom))
!Tdom%domH(iunit,ntdom) = max(0._r8,Tdom%domH(iunit,ntdom) + (Tdom%domsur(iunit,ntdom) - Tdom%domHout(iunit,ntdom))* theDeltaT)
Tdom%domH(iunit,ntdom) = Tdom%domH(iunit,ntdom) + (Tdom%domsur(iunit,ntdom) - Tdom%domHout(iunit,ntdom))* theDeltaT
end subroutine hillslopeRoutingDOM
subroutine subnetworkRoutingDOM(iunit,nt,ntdom,theDeltaT)
! solve the ODEs with Euler algorithm for subnetwork routing
implicit none
integer, intent(in) :: iunit, nt, ntdom
real(r8), intent(in) :: theDeltaT
! domTout (kg/s), etout (m3/s), domT (kg), domsub (kg/s), domHout (kg/s), wt (m3), dwt (m3/s), etin (m3/s)
Tdom%domTout(iunit,ntdom) = -TRunoff%etout(iunit,nt) * (Tdom%domT(iunit,ntdom) + (Tdom%domsub(iunit,ntdom)+Tdom%domHout(iunit,ntdom)) * theDeltaT)/(TRunoff%wt(iunit,nt)-TRunoff%dwt(iunit,nt)*theDeltaT+TRunoff%etin(iunit,nt)*theDeltaT)
!Tdom%domTout(iunit,ntdom) = min(-TRunoff%etout(iunit,nt) *0.3_r8,Tdom%domTout(iunit,ntdom))
!Tdom%domTout(iunit,ntdom) = max(0._r8,Tdom%domTout(iunit,ntdom))
!Tdom%domTout(iunit,ntdom) = min((Tdom%domT(iunit,ntdom)+(Tdom%domsub(iunit,ntdom)+Tdom%domHout(iunit,ntdom))* theDeltaT)/theDeltaT,Tdom%domTout(iunit,ntdom))
!Tdom%domT(iunit,ntdom) = max(0._r8,Tdom%domT(iunit,ntdom) + ( Tdom%domsub(iunit,ntdom) + Tdom%domHout(iunit,ntdom) - Tdom%domTout(iunit,ntdom) ) * theDeltaT)
Tdom%domT(iunit,ntdom) = Tdom%domT(iunit,ntdom) + ( Tdom%domsub(iunit,ntdom) + Tdom%domHout(iunit,ntdom) - Tdom%domTout(iunit,ntdom) ) * theDeltaT
end subroutine subnetworkRoutingDOM
subroutine mainchannelRoutingDOM(iunit,nt,ntdom,theDeltaT)
! solve the ODE with Euler algorithm for main-channel routing
implicit none
integer, intent(in) :: iunit, nt, ntdom
real(r8), intent(in) :: theDeltaT
real(r8) :: temp_gwl
temp_gwl = TRunoff%qgwl(iunit,nt) * TUnit%area(iunit) * TUnit%frac(iunit)
Tdom%domRout(iunit,ntdom) = -TRunoff%erout(iunit,nt) * (Tdom%domR(iunit,ntdom) + (Tdom%domRUp(iunit,ntdom) + Tdom%domToutLat(iunit,ntdom)) * theDeltaT)/(TRunoff%wr(iunit,nt)-TRunoff%dwr(iunit,nt)*theDeltaT+(TRunoff%erlateral(iunit,nt)+TRunoff%erin(iunit,nt)+temp_gwl)*theDeltaT)
!Tdom%domRout(iunit,ntdom) = min(-TRunoff%erout(iunit,nt) *0.3_r8,Tdom%domRout(iunit,ntdom))
!Tdom%domRout(iunit,ntdom) = max(0._r8,Tdom%domRout(iunit,ntdom))
!Tdom%domRout(iunit,ntdom) = min((Tdom%domR(iunit,ntdom)+(Tdom%domRUp(iunit,ntdom) + Tdom%domToutLat(iunit,ntdom))* theDeltaT)/theDeltaT,Tdom%domRout(iunit,ntdom))
!Tdom%domR(iunit,ntdom) = max(0._r8,Tdom%domR(iunit,ntdom) + (Tdom%domRUp(iunit,ntdom) + Tdom%domToutLat(iunit,ntdom) - Tdom%domRout(iunit,ntdom)) * theDeltaT)
Tdom%domR(iunit,ntdom) = Tdom%domR(iunit,ntdom) + (Tdom%domRUp(iunit,ntdom) + Tdom%domToutLat(iunit,ntdom) - Tdom%domRout(iunit,ntdom)) * theDeltaT
end subroutine mainchannelRoutingDOM
!-------------------------------------------------------------------------
end MODULE DommasbMod