Commit 527b035e authored by Jorn Bruggeman's avatar Jorn Bruggeman
Browse files

use FABM 1.0 conventions for akvaplan/antiparasitic

parent 2f5e0d10
......@@ -24,15 +24,15 @@ module akvaplan_antiparasitic
type (type_bottom_state_variable_id) :: id_antiparasitic_bot
! Environmental dependencies
type (type_dependency_id) :: id_T ! temperature
type (type_dependency_id) :: id_h ! cell thickness
type (type_horizontal_dependency_id) :: id_shear ! bottom shear
type (type_dependency_id) :: id_T ! temperature
type (type_dependency_id) :: id_h ! cell thickness
type (type_bottom_dependency_id) :: id_shear ! bottom shear
! Identifiers for diagnostic variables
type (type_diagnostic_variable_id) :: id_degradation_pom_flux, id_degradation_c_flux ! pelagic degradation flux for pom and treatment (antiparasitic!)
type (type_horizontal_diagnostic_variable_id) :: id_resuspension_flux_pom, id_deposition_flux_pom ! deposition and resuspension fluxes of all pom
type (type_horizontal_diagnostic_variable_id) :: id_resuspension_flux_c, id_deposition_flux_c ! deposition and resuspension fluxes of antiparasitic treatment
type (type_horizontal_diagnostic_variable_id) :: id_degradation_pom_bot_flux, id_degradation_c_bot_flux ! sediment degradation fluxes for pom and treatment (antiparasitic!)
type (type_diagnostic_variable_id) :: id_degradation_pom_flux, id_degradation_c_flux ! pelagic degradation flux for pom and treatment (antiparasitic!)
type (type_bottom_diagnostic_variable_id) :: id_resuspension_flux_pom, id_deposition_flux_pom ! deposition and resuspension fluxes of all pom
type (type_bottom_diagnostic_variable_id) :: id_resuspension_flux_c, id_deposition_flux_c ! deposition and resuspension fluxes of antiparasitic treatment
type (type_bottom_diagnostic_variable_id) :: id_degradation_pom_bot_flux, id_degradation_c_bot_flux ! sediment degradation fluxes for pom and treatment (antiparasitic!)
! Parameters
real(rk), allocatable :: w(:)
......@@ -92,7 +92,7 @@ contains
call self%get_parameter(self%erate, 'erate', 'g m-2 d-1', 'bed erodibility', default=0.0_rk, scale_factor=1.0_rk/secs_pr_day, minimum=0._rk)
do i=1,npom
write (index,'(i0)') i
call self%get_parameter(self%tau_bot_crit(i), 'tau_bot_crit'//trim(index), 'Pa', 'critical shear stress for particulate organic matter class '//trim(index), default=0.0_rk, scale_factor=1.0_rk/secs_pr_day, minimum=0.0_rk)
call self%get_parameter(self%tau_bot_crit(i), 'tau_bot_crit'//trim(index), 'Pa', 'critical shear stress for particulate organic matter class '//trim(index), default=0.0_rk, scale_factor=1.0_rk/secs_pr_day, minimum=0.0_rk)
end do
! Numerics and debugging
......@@ -124,13 +124,13 @@ contains
call self%register_diagnostic_variable(self%id_degradation_pom_flux, 'pom_degradation', 'g C m-3 s-1', 'degradation of total particulate organic matter in pelagic')
call self%register_diagnostic_variable(self%id_degradation_c_flux, 'c_degradation', 'g m-3 s-1', 'degradation of total antiparasitic in pelagic')
call self%register_diagnostic_variable(self%id_resuspension_flux_pom, 'resuspension_flux_pom', 'g C m-2 s-1', 'total organic matter resuspension', source=source_do_bottom)
call self%register_diagnostic_variable(self%id_deposition_flux_pom, 'deposition_flux_pom', 'g C m-2 s-1', 'total organic matter deposition', source=source_do_bottom)
call self%register_diagnostic_variable(self%id_resuspension_flux_c, 'resuspension_flux_c', 'g m-2 s-1', 'antiparasitic resuspension', source=source_do_bottom)
call self%register_diagnostic_variable(self%id_deposition_flux_c, 'deposition_flux_c', 'g m-2 s-1', 'antiparasitic deposition', source=source_do_bottom)
call self%register_diagnostic_variable(self%id_resuspension_flux_pom, 'resuspension_flux_pom', 'g C m-2 s-1', 'total organic matter resuspension')
call self%register_diagnostic_variable(self%id_deposition_flux_pom, 'deposition_flux_pom', 'g C m-2 s-1', 'total organic matter deposition')
call self%register_diagnostic_variable(self%id_resuspension_flux_c, 'resuspension_flux_c', 'g m-2 s-1', 'antiparasitic resuspension')
call self%register_diagnostic_variable(self%id_deposition_flux_c, 'deposition_flux_c', 'g m-2 s-1', 'antiparasitic deposition')
call self%register_diagnostic_variable(self%id_degradation_pom_bot_flux, 'pom_bot_degradation','g C m-2 s-1', 'degradation of total organic matter in sediment', source=source_do_bottom)
call self%register_diagnostic_variable(self%id_degradation_c_bot_flux, 'c_bot_degradation','g m-2 s-1', 'degradation of total antiparasitic in sediment', source=source_do_bottom)
call self%register_diagnostic_variable(self%id_degradation_pom_bot_flux, 'pom_bot_degradation','g C m-2 s-1', 'degradation of total organic matter in sediment')
call self%register_diagnostic_variable(self%id_degradation_c_bot_flux, 'c_bot_degradation','g m-2 s-1', 'degradation of total antiparasitic in sediment')
end subroutine initialize
......@@ -156,11 +156,11 @@ contains
k_ads = self%k_ads * f
k_wat = self%k_w * f
_GET_(self%id_antiparasitic, c)
_SET_ODE_(self%id_antiparasitic, -(frac_ads * k_ads + frac_wat * k_wat) * c)
_ADD_SOURCE_(self%id_antiparasitic, -(frac_ads * k_ads + frac_wat * k_wat) * c)
! Degradation (s-1) for POM
do i=1,size(self%id_pom)
_SET_ODE_(self%id_pom(i), -self%k_pom * pom(i))
_ADD_SOURCE_(self%id_pom(i), -self%k_pom * pom(i))
end do
! Save diagnostics for total pom and antiparasitic degradation
......@@ -179,18 +179,18 @@ contains
real(rk) :: h, pom(size(self%id_pom)), pom_bot(size(self%id_pom)), pom_tot, pom_bot_tot, frac_ads, w, c, tau_bot, erosion(size(self%id_pom)), rel_antiparasitic_erosion, T, f, k_ads, c_bot
real(rk) :: pom_deposition
_HORIZONTAL_LOOP_BEGIN_
_BOTTOM_LOOP_BEGIN_
_GET_(self%id_h, h)
do i = 1, size(self%id_pom)
_GET_(self%id_pom(i), pom(i))
_GET_HORIZONTAL_(self%id_pom_bot(i), pom_bot(i))
_GET_BOTTOM_(self%id_pom_bot(i), pom_bot(i))
end do
pom_tot = sum(pom)
pom_bot_tot = sum(pom_bot)
! Erosion rate (g m-2 s-1) per POM class
_GET_HORIZONTAL_(self%id_shear, tau_bot)
_GET_BOTTOM_(self%id_shear, tau_bot)
erosion = min(pom_bot/self%max_dt, self%erate * (1.0_rk - self%bed_por) * max(tau_bot / self%tau_bot_crit - 1.0_rk, 0.0_rk))
! Calculate relative erosion for antiparasitic substance.
......@@ -203,9 +203,9 @@ contains
! Sedimentation, resuspension, degradation per POM class
do i = 1, size(self%id_pom)
! From pelagic to bottom. Convention is negative out of pelagic, positive into water
_SET_BOTTOM_EXCHANGE_(self%id_pom(i), -min(h/self%max_dt, self%w(i)) * pom(i) + erosion(i))
_ADD_BOTTOM_FLUX_(self%id_pom(i), -min(h/self%max_dt, self%w(i)) * pom(i) + erosion(i))
! From bottom to pelagic. Convention is positive into bottom, negative into water. Added degradation of pom_bot
_SET_BOTTOM_ODE_(self%id_pom_bot(i), min(h/self%max_dt, self%w(i)) * pom(i) - erosion(i) - self%k_pom * pom_bot(i))
_ADD_BOTTOM_SOURCE_(self%id_pom_bot(i), min(h/self%max_dt, self%w(i)) * pom(i) - erosion(i) - self%k_pom * pom_bot(i))
end do
! Sinking rate of antiparasitic is weighted average of sinking rate per antiparasitic fraction
......@@ -225,32 +225,32 @@ contains
! Sedimentation and resuspension for antiparasitic
_GET_(self%id_antiparasitic, c)
_GET_HORIZONTAL_(self%id_antiparasitic_bot, c_bot)
_SET_BOTTOM_EXCHANGE_(self%id_antiparasitic, -w * c + rel_antiparasitic_erosion * c_bot)
_SET_BOTTOM_ODE_(self%id_antiparasitic_bot, w * c - rel_antiparasitic_erosion * c_bot - k_ads * c_bot)
_GET_BOTTOM_(self%id_antiparasitic_bot, c_bot)
_ADD_BOTTOM_FLUX_(self%id_antiparasitic, -w * c + rel_antiparasitic_erosion * c_bot)
_ADD_BOTTOM_SOURCE_(self%id_antiparasitic_bot, w * c - rel_antiparasitic_erosion * c_bot - k_ads * c_bot)
! Save diagnostic total pom bottom degradation
_SET_HORIZONTAL_DIAGNOSTIC_(self%id_degradation_pom_bot_flux, self%k_pom * pom_bot_tot)
_SET_BOTTOM_DIAGNOSTIC_(self%id_degradation_pom_bot_flux, self%k_pom * pom_bot_tot)
! Save diagnostic antiparasitic bottom degradation
_SET_HORIZONTAL_DIAGNOSTIC_(self%id_degradation_c_bot_flux, k_ads * c_bot )
_SET_BOTTOM_DIAGNOSTIC_(self%id_degradation_c_bot_flux, k_ads * c_bot )
! Save diagnostic total pom bottom deposition
pom_deposition = 0.0_rk
do i = 1, size(self%id_pom)
pom_deposition = pom_deposition + min(h/self%max_dt, self%w(i)) * pom(i)
end do
_SET_HORIZONTAL_DIAGNOSTIC_(self%id_deposition_flux_pom, pom_deposition)
_SET_BOTTOM_DIAGNOSTIC_(self%id_deposition_flux_pom, pom_deposition)
! Save diagnostic total pom bottom resuspension
_SET_HORIZONTAL_DIAGNOSTIC_(self%id_resuspension_flux_pom, sum(erosion))
_SET_BOTTOM_DIAGNOSTIC_(self%id_resuspension_flux_pom, sum(erosion))
! Save diagnostic antiparasitic bottom deposition
_SET_HORIZONTAL_DIAGNOSTIC_(self%id_deposition_flux_c, w * c )
_SET_BOTTOM_DIAGNOSTIC_(self%id_deposition_flux_c, w * c )
! Save diagnostic antiparasitic bottom resuspension
_SET_HORIZONTAL_DIAGNOSTIC_(self%id_resuspension_flux_c, rel_antiparasitic_erosion * c_bot)
_SET_BOTTOM_DIAGNOSTIC_(self%id_resuspension_flux_c, rel_antiparasitic_erosion * c_bot)
_HORIZONTAL_LOOP_END_
_BOTTOM_LOOP_END_
end subroutine do_bottom
......@@ -276,7 +276,7 @@ contains
else
w = 0
end if
_SET_VERTICAL_MOVEMENT_(self%id_antiparasitic, -w)
_ADD_VERTICAL_VELOCITY_(self%id_antiparasitic, -w)
_LOOP_END_
......
instances:
ab:
model: akvaplan/antiparasitic
parameters:
npom: 8
w1: 216.0 # sinking velocity of POM class 1 (m d-1)
w2: 648.0 # sinking velocity of POM class 2 (m d-1)
w3: 1080.0 # sinking velocity of POM class 3 (m d-1)
w4: 1728.0 # sinking velocity of POM class 4 (m d-1)
w5: 3240.0 # sinking velocity of POM class 5 (m d-1)
w6: 6480.0 # sinking velocity of POM class 6 (m d-1)
w7: 7603.2 # sinking velocity of POM class 7 (m d-1)
w8: 10368.0 # sinking velocity of POM class 8 (m d-1)
K_oc: 0.005 # water : POM partition coefficient of antiparasitic (m3 g-1)
E_a: 0 # activation energy for antiparasitic degradation (J mol-1)
T_ref: 20 # reference temperature for antiparasitic degradation (degrees Celsius)
k_w: 0.0 # degradation rate of dissolved antiparasitic at reference temperature (d-1)
k_ads: 0.0 # degradation rate of adsorbed antiparasitic at reference temperature (d-1)
k_pom: 0.0 # degradation rate of POM (d-1)
erate: 0.0035 # maximum erosion rate (g m-2 d-1) - should this vary per POM class???
bed_por: 0.4 # sediment porosity
tau_bot_crit1: 0.005 # critical bottom shear stress for resuspension of POM class 1 (Pa)
tau_bot_crit2: 0.005 # critical bottom shear stress for resuspension of POM class 2 (Pa)
tau_bot_crit3: 0.005 # critical bottom shear stress for resuspension of POM class 3 (Pa)
tau_bot_crit4: 0.005 # critical bottom shear stress for resuspension of POM class 4 (Pa)
tau_bot_crit5: 0.005 # critical bottom shear stress for resuspension of POM class 5 (Pa)
tau_bot_crit6: 0.005 # critical bottom shear stress for resuspension of POM class 6 (Pa)
tau_bot_crit7: 0.005 # critical bottom shear stress for resuspension of POM class 7 (Pa)
tau_bot_crit8: 0.005 # critical bottom shear stress for resuspension of POM class 8 (Pa)
initialization:
pom1: 1 # pelagic concentration of POM class 1 (g m-3)
pom2: 1 # pelagic concentration of POM class 2 (g m-3)
pom3: 1 # pelagic concentration of POM class 3 (g m-3)
pom4: 1 # pelagic concentration of POM class 4 (g m-3)
pom5: 1 # pelagic concentration of POM class 5 (g m-3)
pom6: 1 # pelagic concentration of POM class 6 (g m-3)
pom7: 1 # pelagic concentration of POM class 7 (g m-3)
pom8: 1 # pelagic concentration of POM class 8 (g m-3)
pom1_bot: 0 # density of POM class 1 in sediment (g m-2)
pom2_bot: 0 # density of POM class 2 in sediment (g m-2)
pom3_bot: 0 # density of POM class 3 in sediment (g m-2)
pom4_bot: 0 # density of POM class 4 in sediment (g m-2)
pom5_bot: 0 # density of POM class 5 in sediment (g m-2)
pom6_bot: 0 # density of POM class 6 in sediment (g m-2)
pom7_bot: 0 # density of POM class 7 in sediment (g m-2)
pom8_bot: 0 # density of POM class 8 in sediment (g m-2)
c: 1 # pelagic concentration of antiparasitic (g m-3)
c_bot: 0 # density of antiparasitic in sediment (g m-2)
ab:
model: akvaplan/antiparasitic
parameters:
npom: 8 # number of particulate organic matter classes
w1: 216.0 # sinking velocity of particulate organic matter class 1 (m d-1)
w2: 648.0 # sinking velocity of particulate organic matter class 2 (m d-1)
w3: 1080.0 # sinking velocity of particulate organic matter class 3 (m d-1)
w4: 1728.0 # sinking velocity of particulate organic matter class 4 (m d-1)
w5: 3240.0 # sinking velocity of particulate organic matter class 5 (m d-1)
w6: 6480.0 # sinking velocity of particulate organic matter class 6 (m d-1)
w7: 7603.2 # sinking velocity of particulate organic matter class 7 (m d-1)
w8: 10368.0 # sinking velocity of particulate organic matter class 8 (m d-1)
K_oc: 0.005 # organic carbon : water partition coefficient (m3 g-1)
E_a: 0.0 # activation energy for antiparasitic decay (0: no temperature dependence) (J mol-1), default = 0.0
T_ref: 20.0 # reference temperature (degree Celsius), default = 20.0
k_ads: 0.0 # degradation of adsorbed antiparasitic at reference temperature (d-1), default = 0.0
k_w: 0.0 # degradation of dissolved antiparasitic at reference temperature (d-1), default = 0.0
k_pom: 0.0 # degradation of particulate organic matter (d-1), default = 0.0
bed_por: 0.4 # bed porosity (-)
erate: 0.0035 # bed erodibility (g m-2 d-1), default = 0.0
tau_bot_crit1: 0.005 # critical shear stress for particulate organic matter class 1 (Pa), default = 0.0
tau_bot_crit2: 0.005 # critical shear stress for particulate organic matter class 2 (Pa), default = 0.0
tau_bot_crit3: 0.005 # critical shear stress for particulate organic matter class 3 (Pa), default = 0.0
tau_bot_crit4: 0.005 # critical shear stress for particulate organic matter class 4 (Pa), default = 0.0
tau_bot_crit5: 0.005 # critical shear stress for particulate organic matter class 5 (Pa), default = 0.0
tau_bot_crit6: 0.005 # critical shear stress for particulate organic matter class 6 (Pa), default = 0.0
tau_bot_crit7: 0.005 # critical shear stress for particulate organic matter class 7 (Pa), default = 0.0
tau_bot_crit8: 0.005 # critical shear stress for particulate organic matter class 8 (Pa), default = 0.0
initialization:
pom1: 1.0 # concentration of particulate organic matter class 1 (g C m-3)
pom2: 1.0 # concentration of particulate organic matter class 2 (g C m-3)
pom3: 1.0 # concentration of particulate organic matter class 3 (g C m-3)
pom4: 1.0 # concentration of particulate organic matter class 4 (g C m-3)
pom5: 1.0 # concentration of particulate organic matter class 5 (g C m-3)
pom6: 1.0 # concentration of particulate organic matter class 6 (g C m-3)
pom7: 1.0 # concentration of particulate organic matter class 7 (g C m-3)
pom8: 1.0 # concentration of particulate organic matter class 8 (g C m-3)
pom1_bot: 0.0 # particulate organic matter class 1 in sediment (g C m-2)
pom2_bot: 0.0 # particulate organic matter class 2 in sediment (g C m-2)
pom3_bot: 0.0 # particulate organic matter class 3 in sediment (g C m-2)
pom4_bot: 0.0 # particulate organic matter class 4 in sediment (g C m-2)
pom5_bot: 0.0 # particulate organic matter class 5 in sediment (g C m-2)
pom6_bot: 0.0 # particulate organic matter class 6 in sediment (g C m-2)
pom7_bot: 0.0 # particulate organic matter class 7 in sediment (g C m-2)
pom8_bot: 0.0 # particulate organic matter class 8 in sediment (g C m-2)
c: 1.0 # total antiparasitic concentration (dissolved + adbsorbed) (g m-3)
c_bot: 0.0 # total antiparasitic in sediment (g m-2)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment