Skip to content

Commit

Permalink
add fraction for ICM clam model
Browse files Browse the repository at this point in the history
  • Loading branch information
wzhengui committed Aug 16, 2024
1 parent a8cca85 commit cc238c5
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 25 deletions.
1 change: 1 addition & 0 deletions sample_inputs/icm.nml
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ gFPP = 0.5 0.45 0.05 !fraction of predation BA P into 3G classes in sediment
!calpha(clam=1:nclam, PC); cKTFR=(clam,2); cTSS=(clam, 4)
!-----------------------------------------------------------------------
cpatch0 = -999 !region flag for clam. (1: ON all elem.; -999: spatial)
cFc = 1.0 1.0 1.0 1.0 1.0 !fraction of clam coverage
clam0 = 0.1 0.1 0.1 0.1 0.1 !initial clam conc. (g[C].m-2)
cfrmax = 0.5 0.5 0.5 0.5 0.5 !maximum filtration rate (m3.g[C]-1.day-1)
cTFR = 27.0 27.0 27.0 27.0 27.0 !optimal temperature of filtration (oC)
Expand Down
36 changes: 18 additions & 18 deletions src/ICM/icm.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1196,29 +1196,29 @@ subroutine clam_calc(id,kb,wdz)
enddo !i=1,nclam

!interaction with water column variables; change rate of conc. (g.m-3.day-1)
cdwqc(iPB1, kb+1)=-sum(PC(1)*Fr*CLAM(1:nclam,id))/wdz
cdwqc(iPB2, kb+1)=-sum(PC(2)*Fr*CLAM(1:nclam,id))/wdz
cdwqc(iPB3, kb+1)=-sum(PC(3)*Fr*CLAM(1:nclam,id))/wdz
cdwqc(iLPOC,kb+1)=-sum(PC(4)*Fr*CLAM(1:nclam,id))/wdz
cdwqc(iRPOC,kb+1)=-sum(PC(5)*Fr*CLAM(1:nclam,id))/wdz
cdwqc(iLPON,kb+1)=-sum(PN(4)*Fr*CLAM(1:nclam,id))/wdz
cdwqc(iRPON,kb+1)=-sum(PN(5)*Fr*CLAM(1:nclam,id))/wdz
cdwqc(iLPOP,kb+1)=-sum(PP(4)*Fr*CLAM(1:nclam,id))/wdz
cdwqc(iRPOP,kb+1)=-sum(PP(5)*Fr*CLAM(1:nclam,id))/wdz
cdwqc(iNH4, kb+1)=sum((ATFN-cn2c*GP)+cn2c*MT)/wdz
cdwqc(iPO4, kb+1)=sum((ATFP-cp2c*GP)+cp2c*MT)/wdz
cdwqc(iDOX, kb+1)=o2c*sum((ATFC-GP)+MT)/wdz
cdwqc(iPB1, kb+1)=-sum(cFc*PC(1)*Fr*CLAM(1:nclam,id))/wdz
cdwqc(iPB2, kb+1)=-sum(cFc*PC(2)*Fr*CLAM(1:nclam,id))/wdz
cdwqc(iPB3, kb+1)=-sum(cFc*PC(3)*Fr*CLAM(1:nclam,id))/wdz
cdwqc(iLPOC,kb+1)=-sum(cFc*PC(4)*Fr*CLAM(1:nclam,id))/wdz
cdwqc(iRPOC,kb+1)=-sum(cFc*PC(5)*Fr*CLAM(1:nclam,id))/wdz
cdwqc(iLPON,kb+1)=-sum(cFc*PN(4)*Fr*CLAM(1:nclam,id))/wdz
cdwqc(iRPON,kb+1)=-sum(cFc*PN(5)*Fr*CLAM(1:nclam,id))/wdz
cdwqc(iLPOP,kb+1)=-sum(cFc*PP(4)*Fr*CLAM(1:nclam,id))/wdz
cdwqc(iRPOP,kb+1)=-sum(cFc*PP(5)*Fr*CLAM(1:nclam,id))/wdz
cdwqc(iNH4, kb+1)=sum(cFc*((ATFN-cn2c*GP)+cn2c*MT))/wdz
cdwqc(iPO4, kb+1)=sum(cFc*((ATFP-cp2c*GP)+cp2c*MT))/wdz
cdwqc(iDOX, kb+1)=o2c*sum(cFc*((ATFC-GP)+MT))/wdz

!interaction with sediment layer
cFPOC(id,1:2)=0; cFPON(id,1:2)=0; cFPOP(id,1:2)=0
do i=1,nclam
cFPOC(id,1)=cFPOC(id,1)+sum(((1-cIF(i))+(1.0-calpha(i,1:4))*cIF(i))*Fr(i)*CLAM(i,id)*PC(1:4))+sum(RT+PR)
cFPON(id,1)=cFPON(id,1)+sum(((1-cIF(i))+(1.0-calpha(i,1:4))*cIF(i))*Fr(i)*CLAM(i,id)*PN(1:4))+sum(cn2c(i)*(RT+PR))
cFPOP(id,1)=cFPOP(id,1)+sum(((1-cIF(i))+(1.0-calpha(i,1:4))*cIF(i))*Fr(i)*CLAM(i,id)*PP(1:4))+sum(cp2c(i)*(RT+PR))
cFPOC(id,1)=cFPOC(id,1)+sum(cFc(i)*((1-cIF(i))+(1.0-calpha(i,1:4))*cIF(i))*Fr(i)*CLAM(i,id)*PC(1:4))+sum(cFc(i)*(RT+PR))
cFPON(id,1)=cFPON(id,1)+sum(cFc(i)*((1-cIF(i))+(1.0-calpha(i,1:4))*cIF(i))*Fr(i)*CLAM(i,id)*PN(1:4))+sum(cFc(i)*cn2c(i)*(RT+PR))
cFPOP(id,1)=cFPOP(id,1)+sum(cFc(i)*((1-cIF(i))+(1.0-calpha(i,1:4))*cIF(i))*Fr(i)*CLAM(i,id)*PP(1:4))+sum(cFc(i)*cp2c(i)*(RT+PR))
enddo !i
cFPOC(id,2)=sum(((1-cIF)+(1.0-calpha(1:nclam,5))*cIF)*Fr*CLAM(1:nclam,id)*PC(5))
cFPON(id,2)=sum(((1-cIF)+(1.0-calpha(1:nclam,5))*cIF)*Fr*CLAM(1:nclam,id)*PN(5))
cFPOP(id,2)=sum(((1-cIF)+(1.0-calpha(1:nclam,5))*cIF)*Fr*CLAM(1:nclam,id)*PP(5))
cFPOC(id,2)=sum(cFc*((1-cIF)+(1.0-calpha(1:nclam,5))*cIF)*Fr*CLAM(1:nclam,id)*PC(5))
cFPON(id,2)=sum(cFc*((1-cIF)+(1.0-calpha(1:nclam,5))*cIF)*Fr*CLAM(1:nclam,id)*PN(5))
cFPOP(id,2)=sum(cFc*((1-cIF)+(1.0-calpha(1:nclam,5))*cIF)*Fr*CLAM(1:nclam,id)*PP(5))

endif !iClam
end subroutine clam_calc
Expand Down
12 changes: 6 additions & 6 deletions src/ICM/icm_init.F90
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ subroutine read_icm_param(imode)
& bKST,bSTmax,bp2d,bVpmin,bKhDO_Vp,bDOc_ST,banoxic,boxic,bKCH4,bKTCH4,bKhDO_CH4,bo2n
namelist /BAG/ gpatch0,gBA0,gGPM,gTGP,gKTGP,gMTB,gPRR,gTR,gKTR,galpha,gKSED,gKBA,gKhN,gKhP, &
& gp2c,gn2c,gFCP,gFNP,gFPP
namelist /CLAM_ICM/ cpatch0,clam0,clam0,cfrmax,cTFR,csalt,cKDO,cDOh,cfTSSm,cRF,cIFmax,cMTB, &
namelist /CLAM_ICM/ cpatch0,cFc,clam0,cfrmax,cTFR,csalt,cKDO,cDOh,cfTSSm,cRF,cIFmax,cMTB, &
& cTMT,cKTMT,cMRT,cPRR,cHSR,cDoyp,CDoyh,cn2c,cp2c,cKTFR,cKTSS,cTSS,calpha
namelist /ERO/ ierosion,erosion,etau,eporo,efrac,ediso,dfrac,dWS_POC

Expand Down Expand Up @@ -103,7 +103,7 @@ subroutine read_icm_param(imode)
allocate(clam0(nclam),cfrmax(nclam),cTFR(nclam),csalt(nclam),cKDO(nclam),cDOh(nclam),cfTSSm(nclam), &
& cRF(nclam),cIFmax(nclam),cMTB(nclam),cTMT(nclam),cKTMT(nclam),cMRT(nclam),cn2c(nclam), &
& cp2c(nclam),cKTFR(nclam,2),cKTSS(nclam,2),cTSS(nclam,4),calpha(nclam,5),cPRR(nclam), &
& cHSR(nclam),cDoyp(nclam,2),CDoyh(nclam,2),stat=istat)
& cHSR(nclam),cDoyp(nclam,2),CDoyh(nclam,2),cFc(nclam),stat=istat)
if(istat/=0) call parallel_abort('failed in alloc. clam0')
allocate(vmarsh0(nmarsh,3),vGPM(nmarsh),vFAM(nmarsh),vTGP(nmarsh),vKTGP(nmarsh,2), &
& vFCP(nmarsh,3),vMTB(nmarsh,3),vTMT(nmarsh,3),vKTMT(nmarsh,3),vFCM(nmarsh,4),vFNM(nmarsh,4), &
Expand Down Expand Up @@ -163,7 +163,7 @@ subroutine read_icm_param(imode)
!init. CLAM module
cpatch0=1; clam0=0; cfrmax=0; cTFR=0; csalt=0; cKDO=0; cDOh=0; cfTSSm=0; cRF=0; cIFmax=0
cMTB=0; cTMT=0; cKTMT=0; cMRT=0; cPRR=0; cHSR=0; cDoyp=0; cDoyh=0; cn2c=0; cp2c=0
cKTFR=0; cKTSS=0; cTSS=0; calpha=0
cKTFR=0; cKTSS=0; cTSS=0; calpha=0; cFc=1.0

!init. ERO module
ierosion=0; erosion=0; etau=0; eporo=0; efrac=0; ediso=0; dfrac=0; dWS_POC=0
Expand Down Expand Up @@ -936,17 +936,17 @@ subroutine icm_vars_init
endif

if(iClam==1) then
pname((m+1):(m+24))=&
pname((m+1):(m+25))=&
& (/'cpatch0','clam0 ','cfrmax ','cTFR ','csalt ',&
& 'cKDO ','cDOh ','cfTSSm ','cRF ','cIFmax ',&
& 'cMTB ','cTMT ','cKTMT ','cMRT ','cPRR ',&
& 'cHSR ','cDoyp ','cDoyh ','cn2c ','cp2c ',&
& 'cKTFR ','cKTSS ','cTSS ','calpha '/)
& 'cKTFR ','cKTSS ','cTSS ','calpha ','cFc '/)
sp(m+1)%p=>cpatch0; sp(m+2)%p1=>clam0; sp(m+3)%p1=>cfrmax; sp(m+4)%p1=>cTFR; sp(m+5)%p1=>csalt; m=m+5
sp(m+1)%p1=>cKDO; sp(m+2)%p1=>cDOh; sp(m+3)%p1=>cfTSSm; sp(m+4)%p1=>cRF; sp(m+5)%p1=>cIFmax; m=m+5
sp(m+1)%p1=>cMTB; sp(m+2)%p1=>cTMT; sp(m+3)%p1=>cKTMT; sp(m+4)%p1=>cMRT; sp(m+5)%p1=>cPRR; m=m+5
sp(m+1)%p1=>cHSR; sp(m+2)%p2=>cDoyp; sp(m+3)%p2=>cDoyh; sp(m+4)%p1=>cn2c; sp(m+5)%p1=>cp2c; m=m+5
sp(m+1)%p2=>cKTFR; sp(m+2)%p2=>cKTSS; sp(m+3)%p2=>cTSS; sp(m+4)%p2=>calpha; m=m+4
sp(m+1)%p2=>cKTFR; sp(m+2)%p2=>cKTSS; sp(m+3)%p2=>cTSS; sp(m+4)%p2=>calpha;sp(m+5)%p1=>cFc; m=m+5
endif

!read spatially varying parameters
Expand Down
2 changes: 1 addition & 1 deletion src/ICM/icm_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ module icm_mod
!Clam model (CLAM) parameters and variables
!-------------------------------------------------------------------------------
real(rkind),save,target :: cpatch0
real(rkind),save,target,allocatable,dimension(:) :: clam0,cfrmax,cTFR,csalt,cKDO,cDOh,cfTSSm,cRF, &
real(rkind),save,target,allocatable,dimension(:) :: cFc,clam0,cfrmax,cTFR,csalt,cKDO,cDOh,cfTSSm,cRF, &
& cIFmax,cMTB,cTMT,cKTMT,cMRT,cPRR,cHSR,cn2c,cp2c
real(rkind),save,target,allocatable,dimension(:,:) :: cKTFR,cKTSS,cTSS,calpha,cDoyp,cDoyh

Expand Down

0 comments on commit cc238c5

Please sign in to comment.