Commit f145d25a authored by Jorn Bruggeman's avatar Jorn Bruggeman
Browse files

renamed preprocessor macros for accessing sources/fluxes across interfaces

parent 3e3d6908
......@@ -608,9 +608,9 @@
case ( 0,1 )
massflux = Sedimentation_Flux+Erosion_Flux
! unit is g/m**3 * m/s
_SET_BOTTOM_EXCHANGE_(self%id_spm,massflux)
_ADD_BOTTOM_FLUX_(self%id_spm,massflux)
! unit is kg/m**2/s
_SET_BOTTOM_ODE_(self%id_pmpool,-(massflux)/1000.0_rk*self%morfac)
_ADD_BOTTOM_SOURCE_(self%id_pmpool,-(massflux)/1000.0_rk*self%morfac)
! Export diagnostic variables mass flux - unit is kg/m**2/s
_SET_HORIZONTAL_DIAGNOSTIC_(self%id_massflux,-(massflux)/1000.0_rk)
! Export diagnostic variables bed load flux - unit is kg/m/s
......@@ -621,10 +621,10 @@
massflux = Sedimentation_Flux + Erosion_Flux
massflux_fluff = Sedimentation_Flux_fluff + Erosion_Flux_fluff
! unit is g/m**3 * m/s
_SET_BOTTOM_EXCHANGE_(self%id_spm,(massflux+massflux_fluff))
_ADD_BOTTOM_FLUX_(self%id_spm,(massflux+massflux_fluff))
! unit is kg/m**2/s
_SET_BOTTOM_ODE_(self%id_pmpool ,-(massflux)/1000.0_rk)
_SET_BOTTOM_ODE_(self%id_flufflayer,-(massflux_fluff)/1000.0_rk)
_ADD_BOTTOM_SOURCE_(self%id_pmpool ,-(massflux)/1000.0_rk)
_ADD_BOTTOM_SOURCE_(self%id_flufflayer,-(massflux_fluff)/1000.0_rk)
! Export diagnostic variables mass flux - unit is kg/m**2/s
_SET_HORIZONTAL_DIAGNOSTIC_(self%id_massflux ,-(massflux )/1000.0_rk)
end select
......@@ -665,7 +665,7 @@
_GET_(self%id_temp,temp)
_GET_(self%id_rhow,rhow)
_GET_(self%id_spm,spm)
_SET_VERTICAL_MOVEMENT_(self%id_spm,ws(self,temp,rhow,spm))
_ADD_VERTICAL_VELOCITY_(self%id_spm,ws(self,temp,rhow,spm))
_LOOP_END_
......
......@@ -432,17 +432,17 @@ else
end if
! We start with the differential equations
_SET_ODE_(self%id_pl,growth_lim_pl*pl-sum(G(1,:)*pred_vect)-self%mpl*pl)
_SET_ODE_(self%id_ps,growth_lim_ps*ps-sum(G(2,:)*pred_vect)-self%mps*ps)
_SET_ODE_(self%id_zs,(self%phyZ*sum(G(:,1)*zs))-sum(G(4,:)*pred_vect)-self%mu_zs*zs-self%mzs*zs**2)
_SET_ODE_(self%id_zl,(self%phyZ*sum(G(:,2)*zl))-sum(G(5,:)*pred_vect)-self%mu_zl*zl- mzl*zl**2)
_SET_ODE_(self%id_zn,(self%phyZ*sum(G(:,3)*zn))-sum(G(6,:)*pred_vect)-self%mu_zn*zn-self%mzn*zn**2)
_SET_ODE_(self%id_zg,(self%phyZ*sum(G(:,4)*zg))-self%mu_zg*zg-self%mnzg*zg-mpzg*zg**2)
_SET_ODE_(self%id_dn,(1.0_rk-self%phyZ)*(sum(G(:,1)*zs)+sum(G(:,2)*zl)+sum(G(:,3)*zn)+sum(G(:,4)*zg))+self%mpl*pl+self%mps*ps+self%mzs*zs**2+self%zl_pred_lost*(mzl*zl**2)+self%mzn*zn**2+self%mnzg*zg+mpzg*zg**2+(1.0_rk-oxilimexc)*(self%mu_zs*zs+self%mu_zl*zl+self%mu_zn*zn+self%mu_zg*zg)-sum(G(3,:)*pred_vect)-epsilon_n*dn)
_SET_ODE_(self%id_am,epsilon_n*dn+oxilimexc*(self%mu_zs*zs+self%mu_zl*zl+self%mu_zn*zn+self%mu_zg*zg)-(self%sigma_s*ppi_s*temp_lim_s*am_lim_s*ps)-(self%sigma_l*ppi_l*temp_lim_l*am_lim_l*pl)-nitrif-amm_nit_ox)
_SET_ODE_(self%id_ni,nitrif-(self%sigma_s*ppi_s*temp_lim_s*nit_lim_s*ps)-(self%sigma_l*ppi_l*temp_lim_l*nit_lim_l*pl)-denitri-0.6_rk*amm_nit_ox-1.34_rk*HS_nit_oxidation)
_SET_ODE_(self%id_o2,8.1258_rk*(growth_lim_pl*pl+growth_lim_ps*ps)-6.625_rk*(epsilon_n*dn+self%mu_zs*zs+self%mu_zl*zl+self%mu_zn*zn+self%mu_zg*zg)-2.0_rk*nitrif-HS_ox_oxidation)
_SET_ODE_(self%id_hs,(0.5_rk*epsilon_n*dn)-2.0_rk*HS_ox_oxidation-HS_nit_oxidation-HS_oth_oxidation)
_ADD_SOURCE_(self%id_pl,growth_lim_pl*pl-sum(G(1,:)*pred_vect)-self%mpl*pl)
_ADD_SOURCE_(self%id_ps,growth_lim_ps*ps-sum(G(2,:)*pred_vect)-self%mps*ps)
_ADD_SOURCE_(self%id_zs,(self%phyZ*sum(G(:,1)*zs))-sum(G(4,:)*pred_vect)-self%mu_zs*zs-self%mzs*zs**2)
_ADD_SOURCE_(self%id_zl,(self%phyZ*sum(G(:,2)*zl))-sum(G(5,:)*pred_vect)-self%mu_zl*zl- mzl*zl**2)
_ADD_SOURCE_(self%id_zn,(self%phyZ*sum(G(:,3)*zn))-sum(G(6,:)*pred_vect)-self%mu_zn*zn-self%mzn*zn**2)
_ADD_SOURCE_(self%id_zg,(self%phyZ*sum(G(:,4)*zg))-self%mu_zg*zg-self%mnzg*zg-mpzg*zg**2)
_ADD_SOURCE_(self%id_dn,(1.0_rk-self%phyZ)*(sum(G(:,1)*zs)+sum(G(:,2)*zl)+sum(G(:,3)*zn)+sum(G(:,4)*zg))+self%mpl*pl+self%mps*ps+self%mzs*zs**2+self%zl_pred_lost*(mzl*zl**2)+self%mzn*zn**2+self%mnzg*zg+mpzg*zg**2+(1.0_rk-oxilimexc)*(self%mu_zs*zs+self%mu_zl*zl+self%mu_zn*zn+self%mu_zg*zg)-sum(G(3,:)*pred_vect)-epsilon_n*dn)
_ADD_SOURCE_(self%id_am,epsilon_n*dn+oxilimexc*(self%mu_zs*zs+self%mu_zl*zl+self%mu_zn*zn+self%mu_zg*zg)-(self%sigma_s*ppi_s*temp_lim_s*am_lim_s*ps)-(self%sigma_l*ppi_l*temp_lim_l*am_lim_l*pl)-nitrif-amm_nit_ox)
_ADD_SOURCE_(self%id_ni,nitrif-(self%sigma_s*ppi_s*temp_lim_s*nit_lim_s*ps)-(self%sigma_l*ppi_l*temp_lim_l*nit_lim_l*pl)-denitri-0.6_rk*amm_nit_ox-1.34_rk*HS_nit_oxidation)
_ADD_SOURCE_(self%id_o2,8.1258_rk*(growth_lim_pl*pl+growth_lim_ps*ps)-6.625_rk*(epsilon_n*dn+self%mu_zs*zs+self%mu_zl*zl+self%mu_zn*zn+self%mu_zg*zg)-2.0_rk*nitrif-HS_ox_oxidation)
_ADD_SOURCE_(self%id_hs,(0.5_rk*epsilon_n*dn)-2.0_rk*HS_ox_oxidation-HS_nit_oxidation-HS_oth_oxidation)
! Export diagnostic variables
_SET_DIAGNOSTIC_(self%id_dPAR,par)
......@@ -505,11 +505,11 @@ else
end if
p_vel = p_vel/secs_per_day
flo2 =self%pvel_c*p_vel*(osat_weiss(temp,salt)-o2)
_SET_SURFACE_EXCHANGE_(self%id_o2,flo2)
_ADD_SURFACE_FLUX_(self%id_o2,flo2)
! end if
_SET_SURFACE_EXCHANGE_(self%id_ni,self%sfl_ni/secs_per_day)
_SET_SURFACE_EXCHANGE_(self%id_am,self%sfl_am/secs_per_day)
_ADD_SURFACE_FLUX_(self%id_ni,self%sfl_ni/secs_per_day)
_ADD_SURFACE_FLUX_(self%id_am,self%sfl_am/secs_per_day)
_HORIZONTAL_LOOP_END_
end subroutine do_surface
......@@ -580,11 +580,11 @@ else
llsd=0.0_rk
end if
_SET_BOTTOM_ODE_(self%id_fl,llds*deb-llsd*fl-llsa*fl-th(oxb,wo,0.0_rk,1.0_rk)*llsa*fl)
_SET_BOTTOM_EXCHANGE_(self%id_dn,-llds*deb+llsd*fl)
_SET_BOTTOM_EXCHANGE_(self%id_am,llsa*fl)
_SET_BOTTOM_EXCHANGE_(self%id_ni,self%s1*thomnp*llsa*fl)
_SET_BOTTOM_EXCHANGE_(self%id_o2,-(self%s4+self%s2*(thopnp+thomnm))*llsa*fl)
_ADD_BOTTOM_SOURCE_(self%id_fl,llds*deb-llsd*fl-llsa*fl-th(oxb,wo,0.0_rk,1.0_rk)*llsa*fl)
_ADD_BOTTOM_FLUX_(self%id_dn,-llds*deb+llsd*fl)
_ADD_BOTTOM_FLUX_(self%id_am,llsa*fl)
_ADD_BOTTOM_FLUX_(self%id_ni,self%s1*thomnp*llsa*fl)
_ADD_BOTTOM_FLUX_(self%id_o2,-(self%s4+self%s2*(thopnp+thomnm))*llsa*fl)
! Leave spatial loops over the horizontal domain (if any).
_HORIZONTAL_LOOP_END_
......
......@@ -389,17 +389,17 @@
ade = 0.0_rk
endif
_SET_ODE_(self%id_o2, part_uptake * (nn * 8.625_rk + aa * 6.625_rk) + rb * bbg * 6.625_rk - ldn_O * ldn * dd - 6.625_rk * (lpn * phyto + lzn * zz0) - 2.0_rk * nf * aa + ade * 0.375_rk)
_SET_ODE_(self%id_aa, ldn * dd - (part_uptake + nf) * aa + lpn * phyto + lzn * zz0)
_SET_ODE_(self%id_nn, nf * aa - part_uptake * nn - ldn_N * ldn * dd - ade)
_SET_ODE_(self%id_po, self%rfr * ( ldn * dd - (part_uptake * (aa + nn) + rb * bbg) + lpn * phyto + lzn * zz0))
_SET_ODE_(self%id_pp, uptake_p * (aa + nn) - (graz_z + lp) * pp)
_SET_ODE_(self%id_ff, uptake_f * (aa + nn) - (graz_z + lp) * ff)
_SET_ODE_(self%id_bb, rb * bbg - (0.5_rk * graz_z + lp) * bb)
_SET_ODE_(self%id_zz, graz_z * (pp + ff + 0.5_rk * bb) - lz * zz0)
_SET_ODE_(self%id_dd, lpd * phyto + lzd * zz0 - ldn * dd)
if (_AVAILABLE_(self%id_dic)) _SET_ODE_(self%id_dic, self%rfc*( lpn * phyto + lzn * zz0 + ldn * dd - rp * ppg - rf * ffg - rb * bbg))
_ADD_SOURCE_(self%id_o2, part_uptake * (nn * 8.625_rk + aa * 6.625_rk) + rb * bbg * 6.625_rk - ldn_O * ldn * dd - 6.625_rk * (lpn * phyto + lzn * zz0) - 2.0_rk * nf * aa + ade * 0.375_rk)
_ADD_SOURCE_(self%id_aa, ldn * dd - (part_uptake + nf) * aa + lpn * phyto + lzn * zz0)
_ADD_SOURCE_(self%id_nn, nf * aa - part_uptake * nn - ldn_N * ldn * dd - ade)
_ADD_SOURCE_(self%id_po, self%rfr * ( ldn * dd - (part_uptake * (aa + nn) + rb * bbg) + lpn * phyto + lzn * zz0))
_ADD_SOURCE_(self%id_pp, uptake_p * (aa + nn) - (graz_z + lp) * pp)
_ADD_SOURCE_(self%id_ff, uptake_f * (aa + nn) - (graz_z + lp) * ff)
_ADD_SOURCE_(self%id_bb, rb * bbg - (0.5_rk * graz_z + lp) * bb)
_ADD_SOURCE_(self%id_zz, graz_z * (pp + ff + 0.5_rk * bb) - lz * zz0)
_ADD_SOURCE_(self%id_dd, lpd * phyto + lzd * zz0 - ldn * dd)
if (_AVAILABLE_(self%id_dic)) _ADD_SOURCE_(self%id_dic, self%rfc*( lpn * phyto + lzn * zz0 + ldn * dd - rp * ppg - rf * ffg - rb * bbg))
_SET_DIAGNOSTIC_(self%id_NO3, nn * n_molar_mass)
_SET_DIAGNOSTIC_(self%id_NH4, aa * n_molar_mass)
......@@ -474,7 +474,7 @@
end if
p_vel = p_vel/secs_per_day
flo2 =p_vel*(osat_weiss(temp,salt)-o2)
_SET_SURFACE_EXCHANGE_(self%id_o2,flo2)
_ADD_SURFACE_FLUX_(self%id_o2,flo2)
! Newflux=2 use polynom approximation
! to order S & T ** 3 for oxygen saturation derived from
......@@ -485,16 +485,16 @@
+ salt * ((2.2258e-3_rk + (4.39e-7_rk * temp - 4.645e-5_rk) * temp) * temp - 6.33e-2_rk)) &
* 44.66e0_rk
flo2 = self%pvel * (osat - o2)
_SET_SURFACE_EXCHANGE_(self%id_o2,flo2)
_ADD_SURFACE_FLUX_(self%id_o2,flo2)
else
flo2 = self%pvel * (31.25_rk * (14.603_rk - 0.40215_rk * temp) - o2)
_SET_SURFACE_EXCHANGE_(self%id_o2,flo2)
_ADD_SURFACE_FLUX_(self%id_o2,flo2)
end if
_SET_SURFACE_DIAGNOSTIC_(self%id_OFL,flo2 * secs_per_day)
_SET_SURFACE_EXCHANGE_(self%id_nn,self%sfl_nn/secs_per_day)
_SET_SURFACE_EXCHANGE_(self%id_aa,self%sfl_aa/secs_per_day)
_SET_SURFACE_EXCHANGE_(self%id_po,self%sfl_po/secs_per_day)
_ADD_SURFACE_FLUX_(self%id_nn,self%sfl_nn/secs_per_day)
_ADD_SURFACE_FLUX_(self%id_aa,self%sfl_aa/secs_per_day)
_ADD_SURFACE_FLUX_(self%id_po,self%sfl_po/secs_per_day)
_HORIZONTAL_LOOP_END_
end subroutine do_surface
......@@ -589,24 +589,24 @@
oxlim = max (0.0_rk,oxb) * max (0.0_rk,oxb) / (0.01_rk + max(0.0_rk,oxb) * max(0.0_rk,oxb))
! Sediment resuspension, detritus settling, bio-resuspension, mineralization and burial
_SET_BOTTOM_ODE_(self%id_fl,-llsd * fl + llds * ddb - biores * fl - recs * fl - fl * self%fl_burialrate * fl/self%maxsed)
_ADD_BOTTOM_SOURCE_(self%id_fl,-llsd * fl + llds * ddb - biores * fl - recs * fl - fl * self%fl_burialrate * fl/self%maxsed)
! P-Fe resuspension, sedimentation, bio-resuspension, liberation, retention and burial
_SET_BOTTOM_ODE_(self%id_pb,-bpsd * pb + bpds * pwb -biores * pb -plib * pb + self%rfr * recs * fl * pret * oxlim - pbr * self%pburialrate * fl/self%maxsed)
_ADD_BOTTOM_SOURCE_(self%id_pb,-bpsd * pb + bpds * pwb -biores * pb -plib * pb + self%rfr * recs * fl * pret * oxlim - pbr * self%pburialrate * fl/self%maxsed)
! Denitrification in sediments
_SET_BOTTOM_EXCHANGE_(self%id_nn,-ldn_N * recs * fl)
_ADD_BOTTOM_FLUX_(self%id_nn,-ldn_N * recs * fl)
! Oxygen consumption due to mineralization and denitrification
_SET_BOTTOM_EXCHANGE_(self%id_o2,-ldn_O * recs * fl - 2.0_rk * fracdenitsed * recs * fl)
_ADD_BOTTOM_FLUX_(self%id_o2,-ldn_O * recs * fl - 2.0_rk * fracdenitsed * recs * fl)
! Ammonium production due to mineralization (oxic & anoxic)
_SET_BOTTOM_EXCHANGE_(self%id_aa,(1.0_rk - fracdenitsed) * recs * fl)
_ADD_BOTTOM_FLUX_(self%id_aa,(1.0_rk - fracdenitsed) * recs * fl)
! Phosphate production due to mineralization (retention if oxic) and release in anoxic
_SET_BOTTOM_EXCHANGE_(self%id_po, (1.0_rk - pret * oxlim) * self%rfr * recs * fl + plib * pb)
_ADD_BOTTOM_FLUX_(self%id_po, (1.0_rk - pret * oxlim) * self%rfr * recs * fl + plib * pb)
! Sediment resuspension, detritus settling, bio-resuspension
_SET_BOTTOM_EXCHANGE_(self%id_dd, llsd * fl -llds * ddb + biores * fl)
_ADD_BOTTOM_FLUX_(self%id_dd, llsd * fl -llds * ddb + biores * fl)
! P-Fe resuspension, settling and bio-resuspension
_SET_BOTTOM_EXCHANGE_(self%id_pw, bpsd * pb -bpds * pwb + biores * pb)
_ADD_BOTTOM_FLUX_(self%id_pw, bpsd * pb -bpds * pwb + biores * pb)
if (_AVAILABLE_(self%id_dic)) _SET_BOTTOM_EXCHANGE_(self%id_dic, self%rfc*recs * fl)
if (_AVAILABLE_(self%id_dic)) _ADD_BOTTOM_FLUX_(self%id_dic, self%rfc*recs * fl)
! BENTHIC DIAGNOSTIC VARIABLES
_SET_BOTTOM_DIAGNOSTIC_(self%id_DNB,(ldn_N * recs * fl + fracdenitsed * recs * fl) * secs_per_day)
......
......@@ -203,9 +203,9 @@
mue_phy = self%muemax_phy * ta_phy * mue_par_phy ! actual growth rate
! Set temporal derivatives
_SET_ODE_(self%id_phy, + mue_phy*phy - self%mortphy*phy )
_SET_ODE_(self%id_det, + self%mortphy*phy - self%rem*det )
_SET_ODE_(self%id_nut, + self%rem*det )
_ADD_SOURCE_(self%id_phy, + mue_phy*phy - self%mortphy*phy )
_ADD_SOURCE_(self%id_det, + self%mortphy*phy - self%rem*det )
_ADD_SOURCE_(self%id_nut, + self%rem*det )
! Export diagnostic variables
_SET_DIAGNOSTIC_(self%id_dPAR,par)
......@@ -328,8 +328,8 @@
_GET_(self%id_nut,nub)
_GET_(self%id_det,deb)
_SET_BOTTOM_EXCHANGE_(self%id_det,-self%depo*deb*deb) !detritus burial
_SET_BOTTOM_EXCHANGE_(self%id_nut,(self%nbot-nub)/secs_pr_hour) !nutrient restoring
_ADD_BOTTOM_FLUX_(self%id_det,-self%depo*deb*deb) !detritus burial
_ADD_BOTTOM_FLUX_(self%id_nut,(self%nbot-nub)/secs_pr_hour) !nutrient restoring
! Leave spatial loops over the horizontal domain (if any).
_HORIZONTAL_LOOP_END_
......
......@@ -371,19 +371,19 @@
end if
! Increment/decrement derivatives for our own state variables
_SET_ODE_(self%id_egb,(tab_mn*adb_mn - mea_mn *egb_mn - teb_mn*egb_mn)/secs_pr_day) ! egg biomass
_SET_ODE_(self%id_jb ,(teb_mn*egb_mn + (gj_mn-mj_mn-lj_mn)* jb_mn - tjb_mn* jb_mn)/secs_pr_day) ! nauplii biomass
_SET_ODE_(self%id_ja ,(tea_mn*egb_mn - mj_mn * ja_mn - tja_mn* jb_mn)/secs_pr_day) ! nauplii abundance
_SET_ODE_(self%id_tb ,(tjb_mn* jb_mn + (gt_mn-mt_mn-lt_mn)* tb_mn - ttb_mn* tb_mn)/secs_pr_day) ! c1 biomass
_SET_ODE_(self%id_ta ,(tja_mn* jb_mn - mt_mn * ta_mn - tta_mn* tb_mn)/secs_pr_day) ! c1 abundance
_SET_ODE_(self%id_adb,(ttb_mn* tb_mn + (ga_mn-ma_mn-la_mn)*adb_mn - tab_mn*adb_mn)/secs_pr_day) ! adult biomass
_SET_ODE_(self%id_ada,(tta_mn* tb_mn -ma_mn *ada_mn )/secs_pr_day) ! adult abundance
_ADD_SOURCE_(self%id_egb,(tab_mn*adb_mn - mea_mn *egb_mn - teb_mn*egb_mn)/secs_pr_day) ! egg biomass
_ADD_SOURCE_(self%id_jb ,(teb_mn*egb_mn + (gj_mn-mj_mn-lj_mn)* jb_mn - tjb_mn* jb_mn)/secs_pr_day) ! nauplii biomass
_ADD_SOURCE_(self%id_ja ,(tea_mn*egb_mn - mj_mn * ja_mn - tja_mn* jb_mn)/secs_pr_day) ! nauplii abundance
_ADD_SOURCE_(self%id_tb ,(tjb_mn* jb_mn + (gt_mn-mt_mn-lt_mn)* tb_mn - ttb_mn* tb_mn)/secs_pr_day) ! c1 biomass
_ADD_SOURCE_(self%id_ta ,(tja_mn* jb_mn - mt_mn * ta_mn - tta_mn* tb_mn)/secs_pr_day) ! c1 abundance
_ADD_SOURCE_(self%id_adb,(ttb_mn* tb_mn + (ga_mn-ma_mn-la_mn)*adb_mn - tab_mn*adb_mn)/secs_pr_day) ! adult biomass
_ADD_SOURCE_(self%id_ada,(tta_mn* tb_mn -ma_mn *ada_mn )/secs_pr_day) ! adult abundance
! Increment/decrement derivatives for external variables (prey, respiration/mortality target variables)
_SET_ODE_(self%id_foodmic, -(gj_mn*jb_mn)/self%food_scale/secs_pr_day)
_SET_ODE_(self%id_food, -(gt_mn*tb_mn+ga_mn*adb_mn)/self%food_scale/secs_pr_day)
_SET_ODE_(self%id_resptarget, (lj_mn*jb_mn + lt_mn*tb_mn + la_mn*adb_mn)/self%food_scale/secs_pr_day)
_SET_ODE_(self%id_morttarget, (mea_mn*egb_mn + mj_mn*jb_mn + mt_mn*tb_mn + ma_mn*adb_mn)/self%food_scale/secs_pr_day)
_ADD_SOURCE_(self%id_foodmic, -(gj_mn*jb_mn)/self%food_scale/secs_pr_day)
_ADD_SOURCE_(self%id_food, -(gt_mn*tb_mn+ga_mn*adb_mn)/self%food_scale/secs_pr_day)
_ADD_SOURCE_(self%id_resptarget, (lj_mn*jb_mn + lt_mn*tb_mn + la_mn*adb_mn)/self%food_scale/secs_pr_day)
_ADD_SOURCE_(self%id_morttarget, (mea_mn*egb_mn + mj_mn*jb_mn + mt_mn*tb_mn + ma_mn*adb_mn)/self%food_scale/secs_pr_day)
! Leave spatial loops (if any)
_LOOP_END_
......
......@@ -389,17 +389,17 @@
ade = 0.0_rk
endif
_SET_ODE_(self%id_o2, part_uptake * (nn * 8.625_rk + aa * 6.625_rk) + rb * bbg * 6.625_rk - ldn_O * ldn * dd - 6.625_rk * (lpn * phyto + lzn * zz0) - 2.0_rk * nf * aa + ade * 0.375_rk)
_SET_ODE_(self%id_aa, ldn * dd - (part_uptake + nf) * aa + lpn * phyto + lzn * zz0)
_SET_ODE_(self%id_nn, nf * aa - part_uptake * nn - ldn_N * ldn * dd - ade)
_SET_ODE_(self%id_po, self%rfr * ( ldn * dd - (part_uptake * (aa + nn) + rb * bbg) + lpn * phyto + lzn * zz0))
_SET_ODE_(self%id_pp, uptake_p * (aa + nn) - (graz_z + lp) * pp)
_SET_ODE_(self%id_ff, uptake_f * (aa + nn) - (graz_z + lp) * ff)
_SET_ODE_(self%id_bb, rb * bbg - (0.5_rk * graz_z + lp) * bb)
_SET_ODE_(self%id_zz, graz_z * (pp + ff + 0.5_rk * bb) - lz * zz0)
_SET_ODE_(self%id_dd, lpd * phyto + lzd * zz0 - ldn * dd)
if (_AVAILABLE_(self%id_dic)) _SET_ODE_(self%id_dic, self%rfc*( lpn * phyto + lzn * zz0 + ldn * dd - rp * ppg - rf * ffg - rb * bbg))
_ADD_SOURCE_(self%id_o2, part_uptake * (nn * 8.625_rk + aa * 6.625_rk) + rb * bbg * 6.625_rk - ldn_O * ldn * dd - 6.625_rk * (lpn * phyto + lzn * zz0) - 2.0_rk * nf * aa + ade * 0.375_rk)
_ADD_SOURCE_(self%id_aa, ldn * dd - (part_uptake + nf) * aa + lpn * phyto + lzn * zz0)
_ADD_SOURCE_(self%id_nn, nf * aa - part_uptake * nn - ldn_N * ldn * dd - ade)
_ADD_SOURCE_(self%id_po, self%rfr * ( ldn * dd - (part_uptake * (aa + nn) + rb * bbg) + lpn * phyto + lzn * zz0))
_ADD_SOURCE_(self%id_pp, uptake_p * (aa + nn) - (graz_z + lp) * pp)
_ADD_SOURCE_(self%id_ff, uptake_f * (aa + nn) - (graz_z + lp) * ff)
_ADD_SOURCE_(self%id_bb, rb * bbg - (0.5_rk * graz_z + lp) * bb)
_ADD_SOURCE_(self%id_zz, graz_z * (pp + ff + 0.5_rk * bb) - lz * zz0)
_ADD_SOURCE_(self%id_dd, lpd * phyto + lzd * zz0 - ldn * dd)
if (_AVAILABLE_(self%id_dic)) _ADD_SOURCE_(self%id_dic, self%rfc*( lpn * phyto + lzn * zz0 + ldn * dd - rp * ppg - rf * ffg - rb * bbg))
_SET_DIAGNOSTIC_(self%id_NO3, nn * n_molar_mass)
_SET_DIAGNOSTIC_(self%id_NH4, aa * n_molar_mass)
......@@ -559,26 +559,26 @@
oxlim = max (0.0_rk,oxb) * max (0.0_rk,oxb) / (0.01_rk + max(0.0_rk,oxb) * max(0.0_rk,oxb))
! Sediment resuspension, detritus settling, diatom settling, bio-resuspension, mineralization and burial
_SET_BOTTOM_ODE_(self%id_fl,-llsd * fl + llds * ddb + lldiat * ppb - biores * fl - recs * fl - fl * self%fl_burialrate * fl/self%maxsed)
_ADD_BOTTOM_SOURCE_(self%id_fl,-llsd * fl + llds * ddb + lldiat * ppb - biores * fl - recs * fl - fl * self%fl_burialrate * fl/self%maxsed)
! P-Fe resuspension, sedimentation, bio-resuspension, liberation, retention and burial
_SET_BOTTOM_ODE_(self%id_pb,-bpsd * pb + bpds * pwb -biores * pb -plib * pb + self%rfr * recs * fl * pret * oxlim - pbr * self%pburialrate * fl/self%maxsed)
_ADD_BOTTOM_SOURCE_(self%id_pb,-bpsd * pb + bpds * pwb -biores * pb -plib * pb + self%rfr * recs * fl * pret * oxlim - pbr * self%pburialrate * fl/self%maxsed)
! Denitrification in sediments
_SET_BOTTOM_EXCHANGE_(self%id_nn,-ldn_N * recs * fl)
_ADD_BOTTOM_FLUX_(self%id_nn,-ldn_N * recs * fl)
! Oxygen consumption due to mineralization and denitrification
_SET_BOTTOM_EXCHANGE_(self%id_o2,-ldn_O * recs * fl - 2.0_rk * fracdenitsed * recs * fl)
_ADD_BOTTOM_FLUX_(self%id_o2,-ldn_O * recs * fl - 2.0_rk * fracdenitsed * recs * fl)
! Ammonium production due to mineralization (oxic & anoxic)
_SET_BOTTOM_EXCHANGE_(self%id_aa,(1.0_rk - fracdenitsed) * recs * fl)
_ADD_BOTTOM_FLUX_(self%id_aa,(1.0_rk - fracdenitsed) * recs * fl)
! Phosphate production due to mineralization (retention if oxic) and release in anoxic
_SET_BOTTOM_EXCHANGE_(self%id_po, (1.0_rk - pret * oxlim) * self%rfr * recs * fl + plib * pb)
_ADD_BOTTOM_FLUX_(self%id_po, (1.0_rk - pret * oxlim) * self%rfr * recs * fl + plib * pb)
! Sediment resuspension, detritus settling, bio-resuspension
_SET_BOTTOM_EXCHANGE_(self%id_dd, llsd * fl -llds * ddb + biores * fl)
_ADD_BOTTOM_FLUX_(self%id_dd, llsd * fl -llds * ddb + biores * fl)
! P-Fe resuspension, settling and bio-resuspension
_SET_BOTTOM_EXCHANGE_(self%id_pw, bpsd * pb -bpds * pwb + biores * pb)
_ADD_BOTTOM_FLUX_(self%id_pw, bpsd * pb -bpds * pwb + biores * pb)
! Diatom settling
_SET_BOTTOM_EXCHANGE_(self%id_pp, -lldiat * ppb)
_ADD_BOTTOM_FLUX_(self%id_pp, -lldiat * ppb)
if (_AVAILABLE_(self%id_dic)) _SET_BOTTOM_EXCHANGE_(self%id_dic, self%rfc*recs * fl)
if (_AVAILABLE_(self%id_dic)) _ADD_BOTTOM_FLUX_(self%id_dic, self%rfc*recs * fl)
! BENTHIC DIAGNOSTIC VARIABLES
_SET_BOTTOM_DIAGNOSTIC_(self%id_DNB,(ldn_N * recs * fl + fracdenitsed * recs * fl) * secs_per_day)
......@@ -683,7 +683,7 @@
end if
p_vel = p_vel/secs_per_day
flo2 =p_vel*(osat_weiss(temp,salt)-o2)
_SET_SURFACE_EXCHANGE_(self%id_o2,flo2)
_ADD_SURFACE_FLUX_(self%id_o2,flo2)
! Newflux=2 use polynom approximation
! to order S & T ** 3 for oxygen saturation derived from
! www.helcom.fi/Monas/CombineManual2/PartB/AnnexB-8Appendix3.pdf
......@@ -692,17 +692,17 @@
+ salt * ((2.2258e-3_rk + (4.39e-7_rk * temp - 4.645e-5_rk) * temp) * temp - 6.33e-2_rk)) &
* 44.66e0_rk
flo2 = self%pvel * (osat - o2)
_SET_SURFACE_EXCHANGE_(self%id_o2,flo2)
_ADD_SURFACE_FLUX_(self%id_o2,flo2)
else
flo2 = self%pvel * (31.25_rk * (14.603_rk - 0.40215_rk * temp) - o2)
_SET_SURFACE_EXCHANGE_(self%id_o2,flo2)
_ADD_SURFACE_FLUX_(self%id_o2,flo2)
end if
_SET_SURFACE_DIAGNOSTIC_(self%id_OFL,flo2 * secs_per_day)
_SET_SURFACE_EXCHANGE_(self%id_nn,self%sfl_nn/secs_per_day)
_SET_SURFACE_EXCHANGE_(self%id_aa,self%sfl_aa/secs_per_day)
_SET_SURFACE_EXCHANGE_(self%id_po,self%sfl_po/secs_per_day)
_ADD_SURFACE_FLUX_(self%id_nn,self%sfl_nn/secs_per_day)
_ADD_SURFACE_FLUX_(self%id_aa,self%sfl_aa/secs_per_day)
_ADD_SURFACE_FLUX_(self%id_po,self%sfl_po/secs_per_day)
_HORIZONTAL_LOOP_END_
......
......@@ -358,23 +358,23 @@ call self%register_diagnostic_variable(self%id_N_fixation,'N_fixation','mmol/m**
!%! components of temporal derivarives calculated in this module:
_SET_ODE_(self%id_Phy,(GrowthPhy-MortPhy-ExcrPhy-GrazPhy))
_SET_ODE_(self%id_Het,(self%Uz*Grazing-MortHet-RespHet))
_SET_ODE_(self%id_O2,(GrowthPhy-RespHet)*self%r_o_n)
_SET_ODE_(self%id_DON,+ExcrPhy+Grazing*(1.-self%Uz)*self%Hz)
_SET_ODE_(self%id_PON,MortPhy+MortHet+Grazing*(1.-self%Uz)*(1.-self%Hz)-GrazPOP)
_SET_ODE_(self%id_NH4,+RespHet-GrowthPhy*(LimNH4/LimN)+N_fixation)
_SET_ODE_(self%id_NO2,-GrowthPhy*(LimNO3/LimN)*(NO2/(0.00001+NO2+NO3)))
_SET_ODE_(self%id_NO3,-GrowthPhy*(LimNO3/LimN)*((NO3+0.00001)/(0.00001+NO2+NO3)))
_SET_ODE_(self%id_DIC,(-GrowthPhy+RespHet)*self%r_c_n)
_SET_ODE_(self%id_PO4,(-GrowthPhy+RespHet)/self%r_n_p)
_SET_ODE_(self%id_Si,(-GrowthPhy+ExcrPhy)*self%r_si_n)
_SET_ODE_(self%id_Sipart,(MortPhy+GrazPhy)*self%r_si_n)
_SET_ODE_(self%id_Alk,dAlk)
_SET_ODE_(self%id_Baae,-GrazBaae)
_SET_ODE_(self%id_Baan,-GrazBaan)
_SET_ODE_(self%id_Bhae,-GrazBhae)
_SET_ODE_(self%id_Bhan,-GrazBhan)
_ADD_SOURCE_(self%id_Phy,(GrowthPhy-MortPhy-ExcrPhy-GrazPhy))
_ADD_SOURCE_(self%id_Het,(self%Uz*Grazing-MortHet-RespHet))
_ADD_SOURCE_(self%id_O2,(GrowthPhy-RespHet)*self%r_o_n)
_ADD_SOURCE_(self%id_DON,+ExcrPhy+Grazing*(1.-self%Uz)*self%Hz)
_ADD_SOURCE_(self%id_PON,MortPhy+MortHet+Grazing*(1.-self%Uz)*(1.-self%Hz)-GrazPOP)
_ADD_SOURCE_(self%id_NH4,+RespHet-GrowthPhy*(LimNH4/LimN)+N_fixation)
_ADD_SOURCE_(self%id_NO2,-GrowthPhy*(LimNO3/LimN)*(NO2/(0.00001+NO2+NO3)))
_ADD_SOURCE_(self%id_NO3,-GrowthPhy*(LimNO3/LimN)*((NO3+0.00001)/(0.00001+NO2+NO3)))
_ADD_SOURCE_(self%id_DIC,(-GrowthPhy+RespHet)*self%r_c_n)
_ADD_SOURCE_(self%id_PO4,(-GrowthPhy+RespHet)/self%r_n_p)
_ADD_SOURCE_(self%id_Si,(-GrowthPhy+ExcrPhy)*self%r_si_n)
_ADD_SOURCE_(self%id_Sipart,(MortPhy+GrazPhy)*self%r_si_n)
_ADD_SOURCE_(self%id_Alk,dAlk)
_ADD_SOURCE_(self%id_Baae,-GrazBaae)
_ADD_SOURCE_(self%id_Baan,-GrazBaan)
_ADD_SOURCE_(self%id_Bhae,-GrazBhae)
_ADD_SOURCE_(self%id_Bhan,-GrazBhan)
!%!----------------------------------------
_SET_DIAGNOSTIC_(self%id_MortHet,MortHet)
......@@ -467,7 +467,7 @@ _LOOP_END_
! Q_O2 = Oa*(Obe-O2)*0.24 ! 0.24 is to convert from [cm/h] to [m/day]
Q_O2 = windspeed*(Obe-O2) !After (Burchard et al., 2005)
_SET_SURFACE_EXCHANGE_(self%id_O2,Q_O2)
_ADD_SURFACE_FLUX_(self%id_O2,Q_O2)
_HORIZONTAL_LOOP_END_
......
......@@ -302,7 +302,7 @@
!!!!!Q_pCO2 = xk * ( pCO2a- max(0e0,pCO2w)) ! pCO2ocean >= 0 !
!!!!!Q_DIC = Q_pCO2*Kc0*1000./86400.
_SET_SURFACE_EXCHANGE_(self%id_DIC,Q_DIC)
_ADD_SURFACE_FLUX_(self%id_DIC,Q_DIC)
_HORIZONTAL_LOOP_END_
......
......@@ -821,39 +821,39 @@
!%!----------------------------------------
_SET_ODE_(self%id_Mn2,-mn_ox1+mn_rd2-mns_form+mns_diss-mnco3_form+mnco3_diss+0.5*fe_ox2+(DcDM_Mn+DcPM_Mn)*self%r_mn_n)
_SET_ODE_(self%id_Mn3, mn_ox1-mn_ox2+mn_rd1-mn_rd2)
_SET_ODE_(self%id_Mn4, mn_ox2-mn_rd1-0.5*fe_ox2+mnco3_ox-(DcDM_Mn+DcPM_Mn)*self%r_mn_n)
_SET_ODE_(self%id_MnS, mns_form-mns_diss)
_SET_ODE_(self%id_MnCO3, mnco3_form-mnco3_diss-mnco3_ox)
_SET_ODE_(self%id_Fe2,-fe_ox1-fe_ox2+fe_rd-fes_form+fes_diss-feco3_form+feco3_diss+(DcDM_Fe+DcPM_Fe)*4.*self%r_fe_n+feS2_ox)
_SET_ODE_(self%id_Fe3,fe_ox1+fe_ox2-fe_rd+fes_ox+feco3_ox-(DcDM_Fe+DcPM_Fe)*4.*self%r_fe_n)
_SET_ODE_(self%id_FeS,fes_form-fes_diss-fes_ox-feS2_form)
_SET_ODE_(self%id_FeS2,feS2_form-feS2_ox)
_SET_ODE_(self%id_FeCO3, feco3_form-feco3_diss-feco3_ox)
_SET_ODE_(self%id_H2S,-0.5*mn_rd1-0.5*mn_rd2-0.5*fe_rd -hs_ox-fes_form-mns_form+mns_diss +0.5*s0_disp -hs_no3+s2o3_rd+fes_diss-feS2_form)
_SET_ODE_(self%id_S0, hs_ox+0.5*mn_rd1+0.5*mn_rd2+0.5*fe_rd -s0_ox -s0_disp-s0_no3)
_SET_ODE_(self%id_S2O3,0.5*s0_ox-s2o3_ox+0.25*s0_disp +0.5*so4_rd-0.5*s2o3_rd-s2o3_no3)
_SET_ODE_(self%id_SO4,hs_no3-so4_rd+0.5*s2o3_ox+s0_no3+2.*s2o3_no3+fes_ox+2.*feS2_ox-ch4_so4)
_SET_ODE_(self%id_O2,(-DcDM_O2-DcPM_O2)*self%r_o_n -0.25*mn_ox1-0.25*mn_ox2-0.25*fe_ox1 -0.5*hs_ox-0.5*s0_ox-0.5*s2o3_ox -1.5*Nitrif1-0.5*Nitrif2-2.25*fes_ox-3.5*feS2_ox-0.5*mnco3_ox+feco3_ox-2.*ch4_o2)
_SET_ODE_(self%id_DON,(Autolysis-DcDM_O2-DcDM_NOX-DcDM_SO4 -DcDM_Mn -DcDM_Fe -HetBhae-HetBhan))
_SET_ODE_(self%id_PON,(-Autolysis-DcPM_O2-DcPM_NOX-DcPM_SO4 -DcPM_Mn -DcPM_Fe+MortBaae+MortBaan+MortBhae+MortBhan))
_SET_ODE_(self%id_NH4,(Dc_OM_total-Nitrif1-Anammox +0.75*s0_no3+s2o3_no3-ChemBaae-ChemBaan))
_SET_ODE_(self%id_NO2,(Nitrif1-Nitrif2+Denitr1-Denitr2-Anammox))
_SET_ODE_(self%id_NO3,(Nitrif2-Denitr1-1.6*hs_no3-0.75*s0_no3-s2o3_no3) )
_SET_ODE_(self%id_DIC,(Dc_OM_total-ChemBaae-ChemBaan)*self%r_c_n-caco3_form+caco3_diss-mnco3_form+mnco3_diss+mnco3_ox -feco3_form+feco3_diss+feco3_ox)
_SET_ODE_(self%id_Si,self%K_sipart_diss*Sipart+fe_si_compl)
_SET_ODE_(self%id_Sipart,-self%K_sipart_diss*Sipart)
_SET_ODE_(self%id_PO4,((Dc_OM_total-ChemBaae-ChemBaan)/self%r_n_p+fe_p_compl+mn_p_compl))
_SET_ODE_(self%id_Baae,ChemBaae-MortBaae)
_SET_ODE_(self%id_Baan,ChemBaan-MortBaan)
_SET_ODE_(self%id_Bhae,HetBhae-MortBhae)
_SET_ODE_(self%id_Bhan,HetBhan-MortBhan)
_SET_ODE_(self%id_caco3,caco3_form-caco3_diss)
_SET_ODE_(self%id_CH4,0.5*(DcDM_CH4+DcPM_CH4)-ch4_o2-ch4_so4)
_ADD_SOURCE_(self%id_Mn2,-mn_ox1+mn_rd2-mns_form+mns_diss-mnco3_form+mnco3_diss+0.5*fe_ox2+(DcDM_Mn+DcPM_Mn)*self%r_mn_n)
_ADD_SOURCE_(self%id_Mn3, mn_ox1-mn_ox2+mn_rd1-mn_rd2)
_ADD_SOURCE_(self%id_Mn4, mn_ox2-mn_rd1-0.5*fe_ox2+mnco3_ox-(DcDM_Mn+DcPM_Mn)*self%r_mn_n)
_ADD_SOURCE_(self%id_MnS, mns_form-mns_diss)
_ADD_SOURCE_(self%id_MnCO3, mnco3_form-mnco3_diss-mnco3_ox)
_ADD_SOURCE_(self%id_Fe2,-fe_ox1-fe_ox2+fe_rd-fes_form+fes_diss-feco3_form+feco3_diss+(DcDM_Fe+DcPM_Fe)*4.*self%r_fe_n+feS2_ox)
_ADD_SOURCE_(self%id_Fe3,fe_ox1+fe_ox2-fe_rd+fes_ox+feco3_ox-(DcDM_Fe+DcPM_Fe)*4.*self%r_fe_n)
_ADD_SOURCE_(self%id_FeS,fes_form-fes_diss-fes_ox-feS2_form)
_ADD_SOURCE_(self%id_FeS2,feS2_form-feS2_ox)
_ADD_SOURCE_(self%id_FeCO3, feco3_form-feco3_diss-feco3_ox)
_ADD_SOURCE_(self%id_H2S,-0.5*mn_rd1-0.5*mn_rd2-0.5*fe_rd -hs_ox-fes_form-mns_form+mns_diss +0.5*s0_disp -hs_no3+s2o3_rd+fes_diss-feS2_form)
_ADD_SOURCE_(self%id_S0, hs_ox+0.5*mn_rd1+0.5*mn_rd2+0.5*fe_rd -s0_ox -s0_disp-s0_no3)
_ADD_SOURCE_(self%id_S2O3,0.5*s0_ox-s2o3_ox+0.25*s0_disp +0.5*so4_rd-0.5*s2o3_rd-s2o3_no3)
_ADD_SOURCE_(self%id_SO4,hs_no3-so4_rd+0.5*s2o3_ox+s0_no3+2.*s2o3_no3+fes_ox+2.*feS2_ox-ch4_so4)
_ADD_SOURCE_(self%id_O2,(-DcDM_O2-DcPM_O2)*self%r_o_n -0.25*mn_ox1-0.25*mn_ox2-0.25*fe_ox1 -0.5*hs_ox-0.5*s0_ox-0.5*s2o3_ox -1.5*Nitrif1-0.5*Nitrif2-2.25*fes_ox-3.5*feS2_ox-0.5*mnco3_ox+feco3_ox-2.*ch4_o2)
_ADD_SOURCE_(self%id_DON,(Autolysis-DcDM_O2-DcDM_NOX-DcDM_SO4 -DcDM_Mn -DcDM_Fe -HetBhae-HetBhan))
_ADD_SOURCE_(self%id_PON,(-Autolysis-DcPM_O2-DcPM_NOX-DcPM_SO4 -DcPM_Mn -DcPM_Fe+MortBaae+MortBaan+MortBhae+MortBhan))
_ADD_SOURCE_(self%id_NH4,(Dc_OM_total-Nitrif1-Anammox +0.75*s0_no3+s2o3_no3-ChemBaae-ChemBaan))
_ADD_SOURCE_(self%id_NO2,(Nitrif1-Nitrif2+Denitr1-Denitr2-Anammox))
_ADD_SOURCE_(self%id_NO3,(Nitrif2-Denitr1-1.6*hs_no3-0.75*s0_no3-s2o3_no3) )
_ADD_SOURCE_(self%id_DIC,(Dc_OM_total-ChemBaae-ChemBaan)*self%r_c_n-caco3_form+caco3_diss-mnco3_form+mnco3_diss+mnco3_ox -feco3_form+feco3_diss+feco3_ox)
_ADD_SOURCE_(self%id_Si,self%K_sipart_diss*Sipart+fe_si_compl)
_ADD_SOURCE_(self%id_Sipart,-self%K_sipart_diss*Sipart)
_ADD_SOURCE_(self%id_PO4,((Dc_OM_total-ChemBaae-ChemBaan)/self%r_n_p+fe_p_compl+mn_p_compl))
_ADD_SOURCE_(self%id_Baae,ChemBaae-MortBaae)
_ADD_SOURCE_(self%id_Baan,ChemBaan-MortBaan)
_ADD_SOURCE_(self%id_Bhae,HetBhae-MortBhae)
_ADD_SOURCE_(self%id_Bhan,HetBhan-MortBhan)
_ADD_SOURCE_(self%id_caco3,caco3_form-caco3_diss)
_ADD_SOURCE_(self%id_CH4,0.5*(DcDM_CH4+DcPM_CH4)-ch4_o2-ch4_so4)
!! Alkalinity changes due to redox reactions:
......@@ -909,7 +909,7 @@
+ 2.*caco3_diss & ! CaCO3 -> Ca2+ + CO32-
! + 0.15*(Autolysis-DcDM_O2-DcDM_NOX-DcDM_SO4 -DcDM_Mn -DcDM_Fe -HetBhae-HetBhan)*7. & ! part of OM charged (EPS etc.)
)
_SET_ODE_(self%id_Alk,dAlk)
_ADD_SOURCE_(self%id_Alk,dAlk)