-
Notifications
You must be signed in to change notification settings - Fork 27
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
DOM flow in Mosart #64
base: master
Are you sure you want to change the base?
Changes from 34 commits
9a1474f
02ebfba
bdb1e45
f0e77af
3b0d992
dc541fb
bd2272d
bfd5fc2
1089202
22196b0
22fa84c
2233bbf
691552d
f11e770
fbf614d
d4d9c2b
ae92015
68e31f0
3c18a69
9b245f7
4d1e1c4
06827d4
0123953
bf84861
1b8ca3b
ba0506b
03c7f89
6439c7b
9ce0d68
f7653d9
d1fc844
c38038c
475c98e
bdf66e2
7fa46ae
dae8a26
bbd2aa7
b2debee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
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 more be less than 0, lower boundary | ||
Tdom%domHout(iunit,ntdom) = max(0._r8,Tdom%domHout(iunit,ntdom)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this happen (negative domHout) because of negative flow? |
||
!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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know why you did this (you cannot output more that you get from surface flow and storage), but this also causes balance off (but maybe ok?) |
||
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 | ||
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) | ||
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) | ||
end subroutine mainchannelRoutingDOM | ||
!------------------------------------------------------------------------- | ||
end MODULE DommasbMod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ehout is overland flow [m/s] into tributaries. and domHout is concentration [kg/m2/s] going to trigutary. how does different units work out for this comparison?