Skip to content

Commit

Permalink
Icm veg (#23)
Browse files Browse the repository at this point in the history
* update notes

* veg_icm frame

* boxes left for light/inundation stress + init

* backup before adding dry_sediment_diagenesis

* sediment diagenesis under dry condition

* backup for optional mortality process

* veg light interactions + renew sav whole volume unit

* round for check; back up for dynamic linkage

* non-dynamic feedback set for multi-veg condition

* backup before going through diff and adding debugging outputs/msg

* backup test 1

* backup before removing mht etc; replace morris formula with two linear equaitons since it is universal for all locations

* benchmark #2, to add veg-related process on nutrient dynamics; leave full dynamics loop apart after benchmark #3 with both veg+sav

* benchmark#3, to fix temperal variation + spatial distribution; fixed SAV unit bug for nutrient dynamic processes + allow co-occupation

* reset CMakeLists in WWMIII_Sept2020

* backup for benchmark #3; to modify parameters + add full feedback loop

* benchmark #4, renewed nutrient recycle and tested equilibrium

* add vegetation production; modify hcan calc

Co-authored-by: Nicole Cai <ncai@vims.edu>
  • Loading branch information
josephzhang8 and nicolecx122 committed Nov 16, 2020
1 parent 2957865 commit a8cd6e8
Show file tree
Hide file tree
Showing 14 changed files with 2,476 additions and 488 deletions.
2 changes: 2 additions & 0 deletions mk/Make.defs.bora
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ PPFLAGS := $(PPFLAGS) -DMPIVERSION=2 #-DUSE_WRAP
#Pure MPI
FCPFLAGS = $(PPFLAGS) -O2 -mcmodel=medium -assume byterecl -ipo -axCORE-AVX2 -xSSE4.2 ##-heap-arrays
FLDFLAGS = -O2 -mcmodel=medium -ipo -axCORE-AVX2 -xSSE4.2 ##-heap-arrays #for final linking of object files
#FCPFLAGS = $(PPFLAGS) -O2 -CB -g -traceback -mcmodel=medium -assume byterecl -ipo -axCORE-AVX2 -xSSE4.2 ##-heap-arrays
#FLDFLAGS = -O2 -CB -g -traceback -mcmodel=medium -ipo -axCORE-AVX2 -xSSE4.2 ##-heap-arrays #for final linking of object files

#Hybrid
#FCPFLAGS = $(PPFLAGS) -O2 -mcmodel=medium -assume byterecl -ipo -axCORE-AVX2 -xSSE4.2 -qopenmp
Expand Down
8 changes: 4 additions & 4 deletions mk/Make.defs.whirlwind.intel
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ PPFLAGS := $(PPFLAGS) -DMPIVERSION=2 #-DUSE_WRAP
#-CB is much slower to compile and run
#Pure MPI
#EXEC := $(EXEC)_CB
FCPFLAGS = $(PPFLAGS) -O2 -mcmodel=medium -assume byterecl #-CB -g -traceback
FLDFLAGS = -O2 -mcmodel=medium #-CB -g -traceback #for final linking of object files
#FCPFLAGS = $(PPFLAGS) -g -mcmodel=medium -assume byterecl #-CB -g -traceback
#FLDFLAGS = -g -mcmodel=medium #-CB -g -traceback #for final linking of object files
#FCPFLAGS = $(PPFLAGS) -O2 -mcmodel=medium -assume byterecl #-CB -g -traceback
#FLDFLAGS = -O2 -mcmodel=medium #-CB -g -traceback #for final linking of object files
FCPFLAGS = $(PPFLAGS) -g -mcmodel=medium -assume byterecl -CB -g -traceback
FLDFLAGS = -g -mcmodel=medium -CB -g -traceback #for final linking of object files


#Hybrid
Expand Down
4 changes: 2 additions & 2 deletions mk/include_modules
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
# EXEC := $(EXEC)_ECO

# CE-QUAL-ICM
# USE_ICM = yes
# EXEC := $(EXEC)_ICM
USE_ICM = yes
EXEC := $(EXEC)_ICM
# ### Flags that go with USE_ICM
# ICM_PH = yes
# EXEC := $(EXEC)_PH
Expand Down
80 changes: 80 additions & 0 deletions sample_inputs/icm.in
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ iZoo = 0
!-----------------------------------------------------------------------
isav_icm = 0

!-----------------------------------------------------------------------
!Intertidal vegetation switch
!-----------------------------------------------------------------------
iveg_icm = 0

!-----------------------------------------------------------------------
!Atmospheric loading(iAtm=1: uniform atmospheric load; iAtm=2: spatially varying )
!-----------------------------------------------------------------------
Expand Down Expand Up @@ -428,7 +433,82 @@ fcdsav= 0.3
fclpsav= 0.15
fcrpsav= 0.05

!density parameters
rdenssav= 10

!-----------------------------------------------------------------------
!veg parameters
!-----------------------------------------------------------------------
initveg= 2 !initveg=1:prop; initveg=2:gr3
famveg= 0.2 0.2 0.2 !fraction for active metabolism
fplfveg= 0.6 0.6 0.6 !fraction for leaf biomass
fpstveg= 0.3 0.3 0.3 !fraction for stem biomass
fprtveg= 0.1 0.1 0.1 !fraction for root biomass
acdwveg= 0.38 0.38 0.38 !carbon to dry weight ratio
pmbsveg= 0.1 0.1 0.1 !coefficient for maximum growth rate function
toptveg= 32 32 32 !optimal temperature
ktg1veg= 0.003 0.003 0.003 !shape function of temperature adjustment
ktg2veg= 0.005 0.005 0.005 !shape function of temperature adjustment

!metabolism parameters
bmlfrveg= 0.02 0.02 0.02 !reference metabolism rate of lf
bmstrveg= 0.02 0.02 0.02
bmrtrveg= 0.02 0.02 0.02
ktblfveg= 0.069 0.069 0.069 !shape coefficient for temp impact
ktbstveg= 0.069 0.069 0.069
ktbrtveg= 0.069 0.069 0.069
trlfveg= 20 20 20 !reference temperature for metabolism
trstveg= 20 20 20
trrtveg= 20 20 20

!mortality parameters
iMortveg= 0 !1: ture on die-off term for veg !error, to add

!light & height parameters
alphaveg= 0.006 0.006 0.006
rkshveg= 0.045 0.045 0.045 !light attenuation from veg absorption
aveg= -0.001 -0.001 -0.001
bveg= 1.0 1.0 1.0
dveg= 0.0036 0.0036 0.0036
eveg= 0.054 0.054 0.054
critveg= 250 250 250

!salt parameter
saltveg= 35 35 35
saltoptveg= 35 15 0

!inundation parameter
tinunveg= 1 1 1

!nitrogen parameters
ancveg= 0.09 0.09 0.09 !nitrogen to carbon ratio
khnwveg= 0.01 0.01 0.01 !nitrogen half saturation in water column
khnsveg= 0.1 0.1 0.1 !nitrogen half saturation in sediments
khnprveg= 0.1 0.1 0.1 !?? !half NH4 concentration
fniveg= 0.5 0.5 0.5 !fraction of N to 4 groups in metabolism
fndveg= 0.3 0.3 0.3
fnlpveg= 0.15 0.15 0.15
fnrpveg= 0.05 0.05 0.05

!phosphorus parameters
apcveg= 0.01 0.01 0.01 !phosphorus to carbon ratio
khpwveg= 0.001 0.001 0.001 !phosphorus half saturation in water column
khpsveg= 0.01 0.01 0.01 !phosphorus half saturation in sediments
fpiveg= 0.5 0.5 0.5 !fraction of P to 4 groups in metabolism
fpdveg= 0.35 0.35 0.35
fplpveg= 0.1 0.1 0.1
fprpveg= 0.05 0.05 0.05

!oxygen parameters
aocrveg= 2.67 2.67 2.67 !oxygen to carbon ratio
fdoveg= 0.5 0.5 0.5 !fraction of to DO, in metabolism
fcdveg= 0.3 0.3 0.3
fclpveg= 0.15 0.15 0.15
fcrpveg= 0.05 0.05 0.05

!density parameters
rdensveg= 10 10 10 !density coefficient

!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
!wqparam2.in
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Expand Down
10 changes: 10 additions & 0 deletions sample_inputs/icm_sed.in
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,16 @@ frnsav= 0.65 0.300 0.050 !fraction of PON produced by rt metabolism g
frpsav= 0.65 0.255 0.095 !fraction of POP produced by rt metabolism goes to G1, G2, G3
frcsav= 0.65 0.255 0.095 !fraction of POC produced by rt metabolism goes to G1, G2, G3


!-----------------------------------------------------------------------
!Marsh
!-----------------------------------------------------------------------
!raction of POM produced by rt metabolism goes to G1, G2, G3, (3G,3veg)
frnveg= 0.65 0.65 0.65 0.300 0.300 0.300 0.050 0.050 0.050
frpveg= 0.65 0.65 0.65 0.255 0.255 0.255 0.095 0.095 0.095
frcveg= 0.65 0.65 0.65 0.255 0.255 0.255 0.095 0.095 0.095


!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
!benthic algae
!iBalg=0: Turn off Benthic Algae module
Expand Down
120 changes: 93 additions & 27 deletions sample_inputs/param.nml
Original file line number Diff line number Diff line change
Expand Up @@ -946,33 +946,99 @@
iof_icm(114) = 0 !DO reaeration [g/m^3/day] {ICM_reaDOO}
iof_icm(115) = 0 !DO consumption for SAV metabolism [g/m^3/day] {ICM_savmtDOO}
iof_icm(116) = 0 !DO production from SAV growth [g/m^3/day] {ICM_savgrDOO}

iof_icm(117) = 0 !Zoo. #1 {ICM_1}
iof_icm(118) = 0 !Zoo. #2 {ICM_2}
iof_icm(119) = 0 !phyto #1 {ICM_3}
iof_icm(120) = 0 !phyto #2 {ICM_4}
iof_icm(121) = 0 !phyto #3 {ICM_5}
iof_icm(122) = 0 !RPOC {ICM_6}
iof_icm(123) = 0 !LPOC {ICM_7}
iof_icm(124) = 0 !DOC {ICM_8}
iof_icm(125) = 0 !RPON {ICM_9}
iof_icm(126) = 0 !LPON {ICM_10}
iof_icm(127) = 0 !DON {ICM_11}
iof_icm(128) = 0 !NH4 {ICM_12}
iof_icm(129) = 0 !NO3 {ICM_13}
iof_icm(130) = 0 !RPOP {ICM_14}
iof_icm(131) = 0 !LPOP {ICM_15}
iof_icm(132) = 0 !DOP {ICM_16}
iof_icm(133) = 0 !PO4t {ICM_17}
iof_icm(134) = 0 !Si- biogenic {ICM_18}
iof_icm(135) = 0 !available Si {ICM_19}
iof_icm(136) = 0 !COD: Chemical oxygen demand {ICM_20}
iof_icm(137) = 0 !DO {ICM_21}
iof_icm(138) = 0 !TIC {ICM_22} !following requires ICM_PH on
iof_icm(139) = 0 !ALK {ICM_23}
iof_icm(140) = 0 !CA {ICM_24}
iof_icm(141) = 0 !CACO3 {ICM_25}

!veg biomass
iof_icm(117) = 0 !veg lf biomass group 1 [gC/m^2] {ICM_tlfveg1}
iof_icm(118) = 0 !veg lf biomass group 2 [gC/m^2] {ICM_tlfveg2}
iof_icm(119) = 0 !veg lf biomass group 3 [gC/m^2] {ICM_tlfveg3}
iof_icm(120) = 0 !veg st biomass group 1 [gC/m^2] {ICM_tstveg1}
iof_icm(121) = 0 !veg st biomass group 2 [gC/m^2] {ICM_tstveg2}
iof_icm(122) = 0 !veg st biomass group 3 [gC/m^2] {ICM_tstveg3}
iof_icm(123) = 0 !veg rt biomass group 1 [gC/m^2] {ICM_trtveg1}
iof_icm(124) = 0 !veg rt biomass group 2 [gC/m^2] {ICM_trtveg2}
iof_icm(125) = 0 !veg rt biomass group 3 [gC/m^2] {ICM_trtveg3}
iof_icm(126) = 0 !veg canopy height group 1 [m] {ICM_hcanveg1}
iof_icm(127) = 0 !veg canopy height group 2 [m] {ICM_hcanveg2}
iof_icm(128) = 0 !veg canopy height group 3 [m] {ICM_hcanveg3}
!veg-induced prcesses for nutrients in water column
iof_icm(129) = 0 !RPOC flux from veg metabolism [g/m^3/day] {ICM_vegmtRPOC}
iof_icm(130) = 0 !LPOC flux from veg metabolism [g/m^3/day] {ICM_vegmtLPOC}
iof_icm(131) = 0 !DOC flux from veg metabolism [g/m^3/day] {ICM_vegmtDOC}
iof_icm(132) = 0 !RPON flux from veg metabolism [g/m^3/day] {ICM_vegmtRPON}
iof_icm(133) = 0 !LPON flux from veg metabolism [g/m^3/day] {ICM_vegmtLPON}
iof_icm(134) = 0 !DON flux from veg metabolism [g/m^3/day] {ICM_vegmtDON}
iof_icm(135) = 0 !NH4 flux from veg metabolism [g/m^3/day] {ICM_vegmtNH4}
iof_icm(136) = 0 !NH4 uptake for veg growth [g/m^3/day] {ICM_veggrNH4}
iof_icm(137) = 0 !NO3 uptake for veg growth [g/m^3/day] {ICM_veggrNO3}
iof_icm(138) = 0 !RPOP flux from veg metabolism [g/m^3/day] {ICM_vegmtRPOP}
iof_icm(139) = 0 !LPOP flux from veg metabolism [g/m^3/day] {ICM_vegmtLPOP}
iof_icm(140) = 0 !DOP flux from veg metabolism [g/m^3/day] {ICM_vegmtDOP}
iof_icm(141) = 0 !PO4 flux from veg metabolism [g/m^3/day] {ICM_vegmtPO4}
iof_icm(142) = 0 !PO4 uptake for veg growth [g/m^3/day] {ICM_veggrPO4}
iof_icm(143) = 0 !DO consumption for veg metabolism [g/m^3/day] {ICM_vegmtDOO}
iof_icm(144) = 0 !DO production from veg growth [g/m^3/day] {ICM_veggrDOO}
!sav+veg-induced sediment fluxes
iof_icm(145) = 0 !sav-induced NH4 uptake from sediement [g/m^2/day] {ICM_tlfNH4sav}
iof_icm(146) = 0 !sav-induced PO4 uptake from sediement [g/m^2/day] {ICM_tlfPO4sav}
iof_icm(147) = 0 !sav-induced poc release to sediement [g/m^2/day] {ICM_trtpocsav}
iof_icm(148) = 0 !sav-induced pon release to sediement [g/m^2/day] {ICM_trtponsav}
iof_icm(149) = 0 !sav-induced pop release to sediement [g/m^2/day] {ICM_trtpopsav}
iof_icm(150) = 0 !sav-induced oxygen demand from sediement [g/m^2/day] {ICM_trtdosav}
iof_icm(151) = 0 !veg1-induced NH4 uptake from sediement [g/m^2/day] {ICM_tlfNH4veg1}
iof_icm(152) = 0 !veg2-induced NH4 uptake from sediement [g/m^2/day] {ICM_tlfNH4veg2}
iof_icm(153) = 0 !veg3-induced NH4 uptake from sediement [g/m^2/day] {ICM_tlfNH4veg3}
iof_icm(154) = 0 !veg1-induced PO4 uptake from sediement [g/m^2/day] {ICM_tlfPO4veg1}
iof_icm(155) = 0 !veg2-induced PO4 uptake from sediement [g/m^2/day] {ICM_tlfPO4veg2}
iof_icm(156) = 0 !veg3-induced PO4 uptake from sediement [g/m^2/day] {ICM_tlfPO4veg3}
iof_icm(157) = 0 !veg1-induced poc release to sediement [g/m^2/day] {ICM_trtpocveg1}
iof_icm(158) = 0 !veg2-induced poc release to sediement [g/m^2/day] {ICM_trtpocveg2}
iof_icm(159) = 0 !veg3-induced poc release to sediement [g/m^2/day] {ICM_trtpocveg3}
iof_icm(160) = 0 !veg1-induced pon release to sediement [g/m^2/day] {ICM_trtponveg1}
iof_icm(161) = 0 !veg2-induced pon release to sediement [g/m^2/day] {ICM_trtponveg2}
iof_icm(162) = 0 !veg3-induced pon release to sediement [g/m^2/day] {ICM_trtponveg3}
iof_icm(163) = 0 !veg1-induced pop release to sediement [g/m^2/day] {ICM_trtpopveg1}
iof_icm(164) = 0 !veg2-induced pop release to sediement [g/m^2/day] {ICM_trtpopveg2}
iof_icm(165) = 0 !veg3-induced pop release to sediement [g/m^2/day] {ICM_trtpopveg3}
iof_icm(166) = 0 !veg1-induced oxygen demand from sediement [g/m^2/day] {ICM_trtdoveg1}
iof_icm(167) = 0 !veg2-induced oxygen demand from sediement [g/m^2/day] {ICM_trtdoveg2}
iof_icm(168) = 0 !veg3-induced oxygen demand from sediement [g/m^2/day] {ICM_trtdoveg3}
iof_icm(169) = 0 !# of veg growth rate [/day] {ICM_plfveg}
iof_icm(170) = 0 !# of max veg growth rate [/day] {ICM_pmaxveg}
iof_icm(171) = 0 !# of veg light limitation [-] {ICM_fiveg}
iof_icm(172) = 0 !# of veg N limitation [-] {ICM_fnveg}
iof_icm(173) = 0 !# of veg P limitation [-] {ICM_fpveg}
iof_icm(174) = 0 !# of veg salinity stress [-] {ICM_fsveg}
iof_icm(175) = 0 !# of veg inundation stress [-] {ICM_ffveg}
iof_icm(176) = 0 !# of veg heigh to dep rario [-] {ICM_rdephcanveg}

iof_icm(177) = 0 !veg production [gC/m^2/day] {ICM_PrmPrdtveg}
iof_icm(178) = 0 !sav production [gC/m^2/day] {ICM_PrmPrdtsav}

iof_icm(179) = 0 !Zoo. #1 {ICM_1}
iof_icm(180) = 0 !Zoo. #2 {ICM_2}
iof_icm(181) = 0 !phyto #1 {ICM_3}
iof_icm(182) = 0 !phyto #2 {ICM_4}
iof_icm(183) = 0 !phyto #3 {ICM_5}
iof_icm(184) = 0 !RPOC {ICM_6}
iof_icm(185) = 0 !LPOC {ICM_7}
iof_icm(186) = 0 !DOC {ICM_8}
iof_icm(187) = 0 !RPON {ICM_9}
iof_icm(188) = 0 !LPON {ICM_10}
iof_icm(189) = 0 !DON {ICM_11}
iof_icm(190) = 0 !NH4 {ICM_12}
iof_icm(191) = 0 !NO3 {ICM_13}
iof_icm(192) = 0 !RPOP {ICM_14}
iof_icm(193) = 0 !LPOP {ICM_15}
iof_icm(194) = 0 !DOP {ICM_16}
iof_icm(195) = 0 !PO4t {ICM_17}
iof_icm(196) = 0 !Si- biogenic {ICM_18}
iof_icm(197) = 0 !available Si {ICM_19}
iof_icm(198) = 0 !COD: Chemical oxygen demand {ICM_20}
iof_icm(199) = 0 !DO {ICM_21}
iof_icm(200) = 0 !TIC {ICM_22} !following requires ICM_PH on
iof_icm(201) = 0 !ALK {ICM_23}
iof_icm(202) = 0 !CA {ICM_24}
iof_icm(203) = 0 !CACO3 {ICM_25}

!-----------------------------------------------------------------------
! CoSINE outputs
!-----------------------------------------------------------------------
Expand Down
25 changes: 17 additions & 8 deletions src/Hydro/schism_init.F90
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ subroutine schism_init(iorder,indir,iths,ntime)
#endif

#ifdef USE_ICM
use icm_mod, only : iSun,wqc,rIa,rIavg,hcansav,lfsav,stsav,rtsav
use icm_mod, only : iSun,wqc,rIa,rIavg,hcansav,lfsav,stsav,rtsav, & !ncai_sav
& tlfveg,tstveg,trtveg,hcanveg !ncai_veg
use icm_sed_mod, only: SED_BENDO,CTEMP,BBM,CPOS,PO4T2TM1S,NH4T2TM1S,NO3T2TM1S, &
& HST2TM1S,CH4T2TM1S,CH41TM1S,SO4T2TM1S,SIT2TM1S,BENSTR1S,CPOP,CPON,CPOC, &
& NH41TM1S,NO31TM1S,HS1TM1S,SI1TM1S,PO41TM1S,PON1TM1S,PON2TM1S,PON3TM1S,POC1TM1S,POC2TM1S,&
Expand Down Expand Up @@ -417,7 +418,7 @@ subroutine schism_init(iorder,indir,iths,ntime)
!order). Flags for modules other than hydro are only used inside USE_*
if(iorder==0) then
allocate(iof_hydro(40),iof_wwm(30),iof_gen(max(1,ntracer_gen)),iof_age(max(1,ntracer_age)),level_age(ntracer_age/2), &
&iof_sed(3*sed_class+20),iof_eco(max(1,eco_class)),iof_icm(180),iof_cos(20),iof_fib(5), &
&iof_sed(3*sed_class+20),iof_eco(max(1,eco_class)),iof_icm(210),iof_cos(20),iof_fib(5), &
&iof_sed2d(14),iof_ice(10),iof_ana(20),iof_marsh(2),iof_dvd(max(1,ntrs(12))),stat=istat)
if(istat/=0) call parallel_abort('INIT: iof failure')
!Global output on/off flags
Expand Down Expand Up @@ -5398,8 +5399,8 @@ subroutine schism_init(iorder,indir,iths,ntime)
enddo !k=1,31

!gfortran requires all chars have same length
ar_name(1:6)=(/'CPOP ','CPON ','CPOC ','lfsav','stsav','rtsav'/)
do k=1,3 !# of 2D arrays
ar_name(1:10)=(/'CPOP ','CPON ','CPOC ','tlfveg','tstveg','trtveg','hcanveg','lfsav','stsav','rtsav'/)
do k=1,7 !# of 2D arrays
if(myrank==0) then
j=nf90_inq_varid(ncid2,trim(adjustl(ar_name(k))),mm)
if(j/=NF90_NOERR) call parallel_abort('init: nc ICM3')
Expand All @@ -5421,13 +5422,21 @@ subroutine schism_init(iorder,indir,iths,ntime)
CPON(ie,m)=buf3(i)
else if(k==3) then
CPOC(ie,m)=buf3(i)
else if(k==4) then
tlfveg(ie,m)=buf3(i)
else if(k==5) then
tstveg(ie,m)=buf3(i)
else if(k==6) then
trtveg(ie,m)=buf3(i)
else if(k==7) then
hcanveg(ie,m)=buf3(i)
endif
endif !iegl
enddo !i
enddo !m
enddo !k

do k=4,6 !# of 2D arrays
do k=8,10 !# of 2D arrays
if(myrank==0) then
j=nf90_inq_varid(ncid2,trim(adjustl(ar_name(k))),mm)
if(j/=NF90_NOERR) call parallel_abort('init: nc ICM5')
Expand All @@ -5442,11 +5451,11 @@ subroutine schism_init(iorder,indir,iths,ntime)
do i=1,ne_global
if(iegl(i)%rank==myrank) then
ie=iegl(i)%id
if(k==4) then
if(k==8) then
lfsav(m,ie)=buf3(i)
else if(k==5) then
else if(k==9) then
stsav(m,ie)=buf3(i)
else if(k==6) then
else if(k==10) then
rtsav(m,ie)=buf3(i)
endif
endif !iegl
Expand Down
Loading

0 comments on commit a8cd6e8

Please sign in to comment.