light.F90 4.65 KB
Newer Older
1 2
#include "fabm_driver.h"

Jorn Bruggeman's avatar
Jorn Bruggeman committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
! 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.

19 20 21 22 23 24 25 26
module gotm_light

   use fabm_types

   implicit none

   private

Jorn Bruggeman's avatar
Jorn Bruggeman committed
27
   type, extends(type_base_model), public :: type_gotm_light
28
      ! Identifiers for dependencies [model inputs]
Jorn Bruggeman's avatar
Jorn Bruggeman committed
29 30 31
      type (type_surface_dependency_id) :: id_swr0 ! Surface shortwave radiation
      type (type_dependency_id)         :: id_dz   ! Cell thickness
      type (type_dependency_id)         :: id_ext  ! Attentuation coefficient for PAR
32 33

      ! Identifiers for diagnostic variables [model outputs]
34 35 36
      type (type_diagnostic_variable_id)         :: id_par  ! Photosynthetically active radiation
      type (type_diagnostic_variable_id)         :: id_swr  ! Shortwave radiation
      type (type_surface_diagnostic_variable_id) :: id_par0 ! Surface photosynthetically active radiation
37 38

      ! Parameters
Jorn Bruggeman's avatar
Jorn Bruggeman committed
39
      real(rk) :: a, g1, g2
40
   contains
Jorn Bruggeman's avatar
Jorn Bruggeman committed
41
      ! Model procedures
42
      procedure :: initialize
Jorn Bruggeman's avatar
Jorn Bruggeman committed
43
      procedure :: do_column
44 45 46 47
   end type type_gotm_light

contains

Jorn Bruggeman's avatar
Jorn Bruggeman committed
48
   subroutine initialize(self, configunit)
Jorn Bruggeman's avatar
Jorn Bruggeman committed
49 50 51 52 53 54
      class (type_gotm_light), intent(inout), target :: self
      integer,                 intent(in)            :: configunit

      call self%get_parameter(self%a,  'a',  '-','non-visible fraction of shortwave radiation', default=0.58_rk) 
      call self%get_parameter(self%g1, 'g1', 'm','e-folding depth of non-visible fraction',     default=0.35_rk)
      call self%get_parameter(self%g2, 'g2', 'm','e-folding depth of visible fraction',         default=23.0_rk) 
55 56

      ! Register diagnostic variables
Jorn Bruggeman's avatar
Jorn Bruggeman committed
57 58 59 60 61 62
      call self%register_diagnostic_variable(self%id_swr, 'swr', 'W m-2', 'shortwave radiation', &
         standard_variable=standard_variables%downwelling_shortwave_flux, source=source_do_column)
      call self%register_diagnostic_variable(self%id_par, 'par', 'W m-2', 'photosynthetically active radiation', &
         standard_variable=standard_variables%downwelling_photosynthetic_radiative_flux, source=source_do_column)
      call self%register_diagnostic_variable(self%id_par0, 'par0', 'W m-2', 'surface photosynthetically active radiation', &
         standard_variable=standard_variables%surface_downwelling_photosynthetic_radiative_flux, source=source_do_column)
63 64

      ! Register environmental dependencies (temperature, shortwave radiation)
Jorn Bruggeman's avatar
Jorn Bruggeman committed
65 66 67
      call self%register_dependency(self%id_swr0, standard_variables%surface_downwelling_shortwave_flux)
      call self%register_dependency(self%id_ext,  standard_variables%attenuation_coefficient_of_photosynthetic_radiative_flux)
      call self%register_dependency(self%id_dz,   standard_variables%cell_thickness)
68 69
   end subroutine
   
Jorn Bruggeman's avatar
Jorn Bruggeman committed
70
   subroutine do_column(self, _ARGUMENTS_DO_COLUMN_)
Jorn Bruggeman's avatar
Jorn Bruggeman committed
71
      class (type_gotm_light), intent(in) :: self
Jorn Bruggeman's avatar
Jorn Bruggeman committed
72
      _DECLARE_ARGUMENTS_DO_COLUMN_
73

Jorn Bruggeman's avatar
Jorn Bruggeman committed
74
      real(rk) :: swr0, dz, swr, par, z, ext, bioext
75

Jorn Bruggeman's avatar
Jorn Bruggeman committed
76 77 78 79
      _GET_SURFACE_(self%id_swr0,swr0)
      _SET_SURFACE_DIAGNOSTIC_(self%id_par0,swr0 * (1.0_rk - self%a))
      z = 0.0_rk
      bioext = 0.0_rk
80 81
      _VERTICAL_LOOP_BEGIN_
         _GET_(self%id_dz,dz)     ! Layer height (m)
82
         _GET_(self%id_ext,ext)   ! PAR attenuation (m-1)
83 84

         ! Set depth to centre of layer
Jorn Bruggeman's avatar
Jorn Bruggeman committed
85 86
         z = z + dz * 0.5_rk
         bioext = bioext + ext * dz * 0.5_rk
87 88

         ! Calculate photosynthetically active radiation (PAR), shortwave radiation, and PAR attenuation.
Jorn Bruggeman's avatar
Jorn Bruggeman committed
89
         par = swr0 * (1.0_rk - self%a) * exp(-z / self%g2 - bioext)
Jorn Bruggeman's avatar
Jorn Bruggeman committed
90
         swr = par + swr0 * self%a * exp(-z / self%g1)
91 92

         ! Move to bottom of layer
Jorn Bruggeman's avatar
Jorn Bruggeman committed
93 94
         z = z + dz * 0.5_rk
         bioext = bioext + ext * dz * 0.5_rk
95 96 97 98

         _SET_DIAGNOSTIC_(self%id_swr,swr) ! Shortwave radiation at layer centre
         _SET_DIAGNOSTIC_(self%id_par,par) ! Photosynthetically active radiation at layer centre
      _VERTICAL_LOOP_END_
Jorn Bruggeman's avatar
Jorn Bruggeman committed
99
   end subroutine do_column
100 101

end module gotm_light