Skip to content

Commit

Permalink
minor updates for demo
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolecx122 committed Sep 8, 2022
1 parent 539a298 commit 2e289ae
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cmake/SCHISM.local.build
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ set( USE_ICE OFF CACHE BOOLEAN "Use ICE module")
set( USE_GEN OFF CACHE BOOLEAN "Use generic tracer module")
set( USE_AGE OFF CACHE BOOLEAN "Use age module")
set( USE_ECO OFF CACHE BOOLEAN "Use ECO-SIM module")
set( USE_ICM ON CACHE BOOLEAN "Use ICM module")
set( USE_ICM OFF CACHE BOOLEAN "Use ICM module")
##pH model is active only if ICM is on
set( ICM_PH OFF CACHE BOOLEAN "Use pH module inside ICM")
set( USE_COSINE OFF CACHE BOOLEAN "Use CoSiNE module")
Expand Down
14 changes: 9 additions & 5 deletions src/ICM/icm.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3256,10 +3256,10 @@ subroutine calkwq(id,nv,ure,it)
do j=1,3
if(tdep-hcanveg(id,j)>1.e-5) then
if(idry_e(id)==1) then
rtmp=rtmp+aocrveg(j)*plfveg(id,j)*tlfveg(id,j)/max(1.e-5,hcanveg(id,j))
rtmp=rtmp+aocrveg(j)*plfveg(id,j)*(1-famveg(j))*tlfveg(id,j)/max(1.e-5,hcanveg(id,j))
else
if(ze(klev-1,id)<hcanveg(id,j)+ze(kbe(id),id)) then
rtmp=rtmp+aocrveg(j)*plfveg(id,j)*tlfveg(id,j)/max(1.e-5,hcanveg(id,j))
rtmp=rtmp+aocrveg(j)*plfveg(id,j)*(1-famveg(j))*tlfveg(id,j)/max(1.e-5,hcanveg(id,j))
endif !ze
endif !idry_e
endif !submerged
Expand Down Expand Up @@ -3612,16 +3612,20 @@ subroutine calkwq(id,nv,ure,it)

!recycling of nutrients unit: g/m^2/day
rtmp=(bmlfveg(j)+plfveg(id,j)*famveg(j))*tlfveg(id,j)+bmstveg(j)*tstveg(id,j)
!immediate release to add on to benthic fluxes
!immediate release to add on to benthic fluxes, fniveg and fpiveg are mostly by default to be 0
tNH4veg(id,j)=ancveg(j)*fniveg(j)*rtmp
tPO4veg(id,j)=apcveg(j)*fpiveg(j)*rtmp
!release of POM to add on to depostional fluxes
tponveg(id,j)=ancveg(j)*(bmrtveg(j)*trtveg(id,j)+(1-fniveg(j))*rtmp)
tpopveg(id,j)=apcveg(j)*(bmrtveg(j)*trtveg(id,j)+(1-fpiveg(j))*rtmp)

!DOC and DO
rtmp=bmlfveg(j)*tlfveg(id,j)+bmstveg(j)*tstveg(id,j)
tDOveg(id,j)=(1-khrveg(i)/(khrveg(i)+DOO(nv,1)))*aocrveg(j)*fdoveg(j)*rtmp
tDOCveg(id,j)=(khrveg(i)/(khrveg(i)+DOO(nv,1)))*fdoveg(j)*rtmp
trtdoveg(id,j)=aocrveg(j)*frtdoveg(j)*bmrtveg(j)*trtveg(id,j)
!release of POM to add on to depostional fluxes
tpocveg(id,j)=(1-frtdoveg(j))*bmrtveg(j)*trtveg(id,j)+(1-fdoveg(j))*rtmp
tponveg(id,j)=ancveg(j)*(bmrtveg(j)*trtveg(id,j)+(1-fniveg(j))*rtmp)
tpopveg(id,j)=apcveg(j)*(bmrtveg(j)*trtveg(id,j)+(1-fpiveg(j))*rtmp)

! if(isrecnveg==0)then !recycled nutrients go to sediment directly
! trtponveg(id,j)=trtponveg(id,j)+ancveg(j)*(1-fniveg(j))* &
Expand Down
14 changes: 11 additions & 3 deletions src/ICM/icm_sed_flux.F90
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function sed_zbrent(id,ierr)
integer, intent(out) :: ierr !0: normal; /=0: error
integer, parameter :: nloop=100
!Error: tweak single
real(kind=iwp), parameter :: eps=3.0e-8_iwp, tol=1.e-5_iwp,sodmin=1.e-8_iwp,sodmax=100._iwp
real(kind=iwp), parameter :: eps=3.0e-8_iwp, tol=1.e-5_iwp,sodmin=1.e-10_iwp,sodmax=100._iwp
!real(kind=iwp),intent(out) :: fout
! real(kind=iwp), external :: sedf
real(kind=iwp) :: sed_zbrent
Expand Down Expand Up @@ -126,17 +126,25 @@ function sed_zbrent(id,ierr)
!call sedf(fb,b)

!root must be bracketed in brent
if(abs(fa)<2.e-6) then
if(abs(fa)<1.e-3) then
sed_zbrent=a
return
endif !fa

if(SOD<1.e-3) then
sed_zbrent=SOD
return
endif

if(fa*fb>0.0) then
if(O20<0.02)then
sed_zbrent=a
return
elseif(SOD<1.e-1)then
sed_zbrent=SOD
return
else
ierr=1
!ierr=1
write(12,*)'sed_zbrent: sod=',fa,fb,myrank
return
endif !water column hypoxia
Expand Down

0 comments on commit 2e289ae

Please sign in to comment.