Commit 9cc189c0 authored by Jorn Bruggeman's avatar Jorn Bruggeman
Browse files

model clean-up

parent 50317b5f
module bb_model_library module bb_model_library
use fabm_types, only: type_base_model_factory,type_base_model use fabm_types, only: type_base_model_factory, type_base_model
implicit none implicit none
private private
type,extends(type_base_model_factory) :: type_factory type, extends(type_base_model_factory) :: type_factory
contains contains
procedure :: create procedure :: create
end type end type
type (type_factory),save,target,public :: bb_model_factory type (type_factory), save, target, public :: bb_model_factory
contains contains
subroutine create(self,name,model) subroutine create(self, name, model)
use bb_filter_feeder use bb_filter_feeder
use bb_lorenz63 use bb_lorenz63
use bb_passive use bb_passive
! Add new BB models here ! Add new BB models here
class (type_factory),intent(in) :: self class (type_factory), intent(in) :: self
character(*), intent(in) :: name character(*), intent(in) :: name
class (type_base_model),pointer :: model class (type_base_model), pointer :: model
select case (name) select case (name)
case ('passive'); allocate(type_bb_passive::model) case ('passive'); allocate(type_bb_passive::model)
......
module examples_model_library module examples_model_library
use fabm_types, only: type_base_model_factory,type_base_model use fabm_types, only: type_base_model_factory, type_base_model
use examples_benthic_predator use examples_benthic_predator
use examples_duplicator use examples_duplicator
...@@ -14,13 +14,13 @@ module examples_model_library ...@@ -14,13 +14,13 @@ module examples_model_library
private private
type,extends(type_base_model_factory) :: type_factory type, extends(type_base_model_factory) :: type_factory
contains contains
procedure :: initialize procedure :: initialize
procedure :: create procedure :: create
end type end type
type (type_factory),save,target,public :: examples_model_factory type (type_factory), save, target, public :: examples_model_factory
contains contains
...@@ -34,10 +34,10 @@ contains ...@@ -34,10 +34,10 @@ contains
call self%type_base_model_factory%initialize() call self%type_base_model_factory%initialize()
end subroutine initialize end subroutine initialize
subroutine create(self,name,model) subroutine create(self, name, model)
class (type_factory),intent(in) :: self class (type_factory), intent(in) :: self
character(*), intent(in) :: name character(*), intent(in) :: name
class (type_base_model),pointer :: model class (type_base_model), pointer :: model
select case (name) select case (name)
case ('benthic_predator'); allocate(type_examples_benthic_predator::model) case ('benthic_predator'); allocate(type_examples_benthic_predator::model)
...@@ -48,7 +48,7 @@ contains ...@@ -48,7 +48,7 @@ contains
case ('light_cycle'); allocate(type_examples_light_cycle::model) case ('light_cycle'); allocate(type_examples_light_cycle::model)
! Add individual example models here ! Add individual example models here
case default case default
call self%type_base_model_factory%create(name,model) call self%type_base_model_factory%create(name, model)
end select end select
end subroutine end subroutine
......
...@@ -13,18 +13,18 @@ module examples_npzd_model_library ...@@ -13,18 +13,18 @@ module examples_npzd_model_library
private private
type,extends(type_base_model_factory) :: type_factory type,extends(type_base_model_factory) :: type_factory
contains contains
procedure :: create procedure :: create
end type end type
type (type_factory),save,target,public :: examples_npzd_model_factory type (type_factory), save, target, public :: examples_npzd_model_factory
contains contains
subroutine create(self,name,model) subroutine create(self, name, model)
class (type_factory),intent(in) :: self class (type_factory), intent(in) :: self
character(*), intent(in) :: name character(*), intent(in) :: name
class (type_base_model),pointer :: model class (type_base_model), pointer :: model
select case (name) select case (name)
case ('nut'); allocate(type_examples_npzd_nut::model) case ('nut'); allocate(type_examples_npzd_nut::model)
......
This diff is collapsed.
This diff is collapsed.
module gotm_model_library module gotm_model_library
use fabm_types, only: type_base_model_factory,type_base_model use fabm_types, only: type_base_model_factory, type_base_model
implicit none implicit none
private private
type,extends(type_base_model_factory) :: type_factory type, extends(type_base_model_factory) :: type_factory
contains contains
procedure :: create procedure :: create
end type end type
type (type_factory),save,target,public :: gotm_model_factory type (type_factory), save, target, public :: gotm_model_factory
contains contains
subroutine create(self,name,model) subroutine create(self, name, model)
use gotm_npzd use gotm_npzd
use gotm_fasham use gotm_fasham
...@@ -23,9 +23,9 @@ contains ...@@ -23,9 +23,9 @@ contains
use gotm_light use gotm_light
! Add new GOTM models here ! Add new GOTM models here
class (type_factory),intent(in) :: self class (type_factory), intent(in) :: self
character(*), intent(in) :: name character(*), intent(in) :: name
class (type_base_model),pointer :: model class (type_base_model), pointer :: model
select case (name) select case (name)
case ('npzd'); allocate(type_gotm_npzd::model) case ('npzd'); allocate(type_gotm_npzd::model)
......
#include "fabm_driver.h" #include "fabm_driver.h"
! This is a FABM implementation of the original two-band light model used in GOTM
! (the General Ocean Turbulence Model)
!
! It distinguishes two wavebands:
! * visible (equivalent to photosynthetically activate radation, PAR, 400 - 700 nm)
! * non-visible, which combines ultraviolet (< 400 nm) and infrared (> 700 nm)
! The non-visible fraction is generally absorbed close to the surface.
! The visible fraction typically penetrates deeper into the water.
! Attenuation of the visible band is influenced by FABM variables that contibute to
! standard_variables%attenuation_coefficient_of_photosynthetic_radiative_flux
! (as well as by the background attenuation set by parameter g2)
!
! The model is driven by downwelling shortwave radiation just below the water surface,
! which in FABM is denoted with standard_variables%surface_downwelling_shortwave_flux
! This is the radiation left after reflection by the surface [albedo] is accounted for.
module gotm_light module gotm_light
use fabm_types use fabm_types
......
...@@ -152,13 +152,13 @@ contains ...@@ -152,13 +152,13 @@ contains
call self%add_to_aggregate_variable(standard_variables%attenuation_coefficient_of_photosynthetic_radiative_flux, self%p0 * self%kc) call self%add_to_aggregate_variable(standard_variables%attenuation_coefficient_of_photosynthetic_radiative_flux, self%p0 * self%kc)
end subroutine initialize end subroutine initialize
subroutine do(self,_ARGUMENTS_DO_) subroutine do(self, _ARGUMENTS_DO_)
class (type_gotm_npzd),intent(in) :: self class (type_gotm_npzd),intent(in) :: self
_DECLARE_ARGUMENTS_DO_ _DECLARE_ARGUMENTS_DO_
real(rk) :: n,p,z,d,par,I_0 real(rk) :: n, p, z, d, par, I_0
real(rk) :: iopt,rpd,primprod,g,dn real(rk) :: iopt, rpd, primprod, g, dn
real(rk), parameter :: secs_pr_day = 86400. real(rk), parameter :: secs_pr_day = 86400.0_rk
! Enter spatial loops (if any) ! Enter spatial loops (if any)
_LOOP_BEGIN_ _LOOP_BEGIN_
...@@ -177,7 +177,7 @@ contains ...@@ -177,7 +177,7 @@ contains
iopt = max(0.25*I_0,self%I_min) iopt = max(0.25*I_0,self%I_min)
! Loss rate of phytoplankton to detritus depends on local light intensity. ! Loss rate of phytoplankton to detritus depends on local light intensity.
if (par .ge. self%I_min) then if (par >= self%I_min) then
rpd = self%rpdu rpd = self%rpdu
else else
rpd = self%rpdl rpd = self%rpdl
...@@ -207,13 +207,13 @@ contains ...@@ -207,13 +207,13 @@ contains
_LOOP_END_ _LOOP_END_
end subroutine do end subroutine do
subroutine do_ppdd(self,_ARGUMENTS_DO_PPDD_) subroutine do_ppdd(self, _ARGUMENTS_DO_PPDD_)
class (type_gotm_npzd), intent(in) :: self class (type_gotm_npzd), intent(in) :: self
_DECLARE_ARGUMENTS_DO_PPDD_ _DECLARE_ARGUMENTS_DO_PPDD_
real(rk) :: n,p,z,d,par,I_0 real(rk) :: n, p, z, d, par, I_0
real(rk) :: iopt,rpd,dn,primprod real(rk) :: iopt, rpd, dn, primprod
real(rk), parameter :: secs_pr_day = 86400. real(rk), parameter :: secs_pr_day = 86400.0_rk
! Enter spatial loops (if any) ! Enter spatial loops (if any)
_LOOP_BEGIN_ _LOOP_BEGIN_
...@@ -232,7 +232,7 @@ contains ...@@ -232,7 +232,7 @@ contains
iopt = max(0.25*I_0,self%I_min) iopt = max(0.25*I_0,self%I_min)
! Loss rate of phytoplankton to detritus depends on local light intensity. ! Loss rate of phytoplankton to detritus depends on local light intensity.
if (par .ge. self%I_min) then if (par >= self%I_min) then
rpd = self%rpdu rpd = self%rpdu
else else
rpd = self%rpdl rpd = self%rpdl
......
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