Commit 13b33164 authored by Jorn Bruggeman's avatar Jorn Bruggeman
Browse files

replaced _HORIZONTAL_ with _SURFACE_/_BOTTOM_ where possible

parent f145d25a
......@@ -149,6 +149,10 @@
#define _DECLARE_ARGUMENTS_HORIZONTAL_ type (type_horizontal_cache),intent(inout) :: cache;_DECLARE_HORIZONTAL_INDICES_
#define _HORIZONTAL_LOOP_BEGIN_ _HORIZONTAL_LOOP_BEGIN_EX_(cache)
#define _CONCURRENT_HORIZONTAL_LOOP_BEGIN_ _CONCURRENT_HORIZONTAL_LOOP_BEGIN_EX_(cache)
#define _SURFACE_LOOP_BEGIN_ _HORIZONTAL_LOOP_BEGIN_
#define _SURFACE_LOOP_END_ _HORIZONTAL_LOOP_END_
#define _BOTTOM_LOOP_BEGIN_ _HORIZONTAL_LOOP_BEGIN_
#define _BOTTOM_LOOP_END_ _HORIZONTAL_LOOP_END_
! Preprocessor symbols for procedures operating on a VERTICAL slice
#ifdef _FABM_DEPTH_DIMENSION_INDEX_
......
......@@ -60,13 +60,13 @@ contains
_DECLARE_ARGUMENTS_DO_SURFACE_
! Enter spatial loops (if any)
_HORIZONTAL_LOOP_BEGIN_
_SURFACE_LOOP_BEGIN_
! Transfer surface exchange value to FABM.
_ADD_SURFACE_FLUX_(self%id_tracer, self%surface_flux)
! Leave spatial loops (if any)
_HORIZONTAL_LOOP_END_
_SURFACE_LOOP_END_
end subroutine do_surface
end module bb_passive
......
......@@ -64,7 +64,7 @@ contains
real(rk) :: prey, biomass, g
! Enter spatial loops over the horizontal domain (if any).
_HORIZONTAL_LOOP_BEGIN_
_BOTTOM_LOOP_BEGIN_
! Retrieve current predator density (bottom-bound state variable)
_GET_BOTTOM_(self%id_biomass,biomass)
......@@ -93,7 +93,7 @@ contains
end if
! Leave spatial loops over the horizontal domain (if any).
_HORIZONTAL_LOOP_END_
_BOTTOM_LOOP_END_
end subroutine do_bottom
......
......@@ -39,14 +39,14 @@ contains
real(rk) :: yearday
_HORIZONTAL_LOOP_BEGIN_
_SURFACE_LOOP_BEGIN_
_GET_GLOBAL_(self%id_yearday,yearday)
if (modulo(yearday-self%offset, 1.0_rk) < self%light_period) then
_SET_SURFACE_DIAGNOSTIC_(self%id_swr_sf, self%swr)
else
_SET_SURFACE_DIAGNOSTIC_(self%id_swr_sf, 0.0_rk)
end if
_HORIZONTAL_LOOP_END_
_SURFACE_LOOP_END_
end subroutine do_surface
end module
......@@ -10,11 +10,11 @@ module examples_mean
private
type,extends(type_base_model),public :: type_examples_mean
type (type_dependency_id) :: id_temp
type (type_dependency_id) :: id_temp_tempmean
type (type_horizontal_dependency_id) :: id_temp_vertmean,id_temp_vertmean_20m,id_temp_vertmean_tempmean
type (type_diagnostic_variable_id) :: id_temp_tempmean_diag
type (type_horizontal_diagnostic_variable_id) :: id_temp_vertmean_diag,id_temp_vertmean_20m_diag,id_temp_vertmean_tempmean_diag
type (type_dependency_id) :: id_temp
type (type_dependency_id) :: id_temp_tempmean
type (type_horizontal_dependency_id) :: id_temp_vertmean,id_temp_vertmean_20m,id_temp_vertmean_tempmean
type (type_diagnostic_variable_id) :: id_temp_tempmean_diag
type (type_surface_diagnostic_variable_id) :: id_temp_vertmean_diag,id_temp_vertmean_20m_diag,id_temp_vertmean_tempmean_diag
contains
procedure :: initialize
procedure :: do
......@@ -57,14 +57,14 @@ contains
real(rk) :: temp, temp_20m, temp_tempmean
_HORIZONTAL_LOOP_BEGIN_
_SURFACE_LOOP_BEGIN_
_GET_HORIZONTAL_(self%id_temp_vertmean, temp)
_GET_HORIZONTAL_(self%id_temp_vertmean_20m, temp_20m)
_GET_HORIZONTAL_(self%id_temp_vertmean_tempmean, temp_tempmean)
_SET_HORIZONTAL_DIAGNOSTIC_(self%id_temp_vertmean_diag, temp)
_SET_HORIZONTAL_DIAGNOSTIC_(self%id_temp_vertmean_20m_diag, temp_20m)
_SET_HORIZONTAL_DIAGNOSTIC_(self%id_temp_vertmean_tempmean_diag, temp_tempmean)
_HORIZONTAL_LOOP_END_
_SET_SURFACE_DIAGNOSTIC_(self%id_temp_vertmean_diag, temp)
_SET_SURFACE_DIAGNOSTIC_(self%id_temp_vertmean_20m_diag, temp_20m)
_SET_SURFACE_DIAGNOSTIC_(self%id_temp_vertmean_tempmean_diag, temp_tempmean)
_SURFACE_LOOP_END_
end subroutine do_surface
end module
......@@ -3,7 +3,6 @@
module nonlocal
use fabm_types
use fabm_standard_variables
implicit none
......@@ -16,7 +15,7 @@ module nonlocal
! apply at the bottom of the domain (w_bot). Linear interpolation is used to determine weights in between
! these levels. In the special case where both weights equal 1, a vertical integral computed using
! this presence distribution will in fact be the real vertical integral between z_top and z_bot.
type,extends(type_base_model),public :: type_vertical_distribution
type, extends(type_base_model), public :: type_vertical_distribution
type (type_diagnostic_variable_id) :: id_weights
type (type_dependency_id) :: id_depth
......@@ -30,11 +29,11 @@ module nonlocal
! Weights are taken from an externally computed variable [id_target below],
! which typically is a diagnostic computed by a model of type type_vertical_distribution.
! The variable to be integrated is a dependency [id_target below] that must be coupled at run time.
! The resultant integral is a diagnsotic that acts like a state variable, that is to say,
! other models can use it as if it were a state avriable, and provide sources and sinks,
! and thsi model will then automagically distribute those sinks and sources again over their
! The resultant integral is a diagnostic that acts like a state variable, that is to say,
! other models can use it as if it were a state variable, and provide sources and sinks,
! and this model will then automagically distribute those sinks and sources again over their
! original depth-explicit source variable, using the appropriate weights.
type,extends(type_base_model),public :: type_depth_integral
type, extends(type_base_model), public :: type_depth_integral
type (type_horizontal_diagnostic_variable_id) :: id_integral
type (type_state_variable_id) :: id_target
type (type_dependency_id) :: id_weights
......@@ -56,9 +55,9 @@ module nonlocal
contains
subroutine vertical_distribution_initialize(self,configunit)
class (type_vertical_distribution),intent(inout),target :: self
integer, intent(in) :: configunit
subroutine vertical_distribution_initialize(self, configunit)
class (type_vertical_distribution), intent(inout), target :: self
integer, intent(in) :: configunit
call self%get_parameter(self%z_top,'z_top','m','upper limit of vertical distribution')
call self%get_parameter(self%z_bot,'z_bot','m','lower limit of vertical distribution')
......@@ -69,11 +68,11 @@ contains
call self%register_dependency(self%id_depth,standard_variables%depth)
end subroutine vertical_distribution_initialize
subroutine vertical_distribution_do(self,_ARGUMENTS_DO_)
class (type_vertical_distribution),intent(in) :: self
subroutine vertical_distribution_do(self, _ARGUMENTS_DO_)
class (type_vertical_distribution), intent(in) :: self
_DECLARE_ARGUMENTS_DO_
real(rk) :: z,slope
real(rk) :: z, slope
_LOOP_BEGIN_
_GET_(self%id_depth,z)
......@@ -91,11 +90,11 @@ contains
_LOOP_END_
end subroutine vertical_distribution_do
subroutine depth_integral_initialize(self,configunit)
class (type_depth_integral),intent(inout),target :: self
integer, intent(in) :: configunit
subroutine depth_integral_initialize(self, configunit)
class (type_depth_integral), intent(inout), target :: self
integer, intent(in) :: configunit
class (type_depth_integral_rate_distributor),pointer :: rate_distributor
class (type_depth_integral_rate_distributor), pointer :: rate_distributor
call self%register_state_dependency(self%id_target, 'target', '', 'variable to depth-integrate')
call self%register_dependency(self%id_weights,'weights','-','weights for vertical integration')
......@@ -115,10 +114,10 @@ contains
end subroutine depth_integral_initialize
subroutine depth_integral_do_column(self, _ARGUMENTS_DO_COLUMN_)
class (type_depth_integral),intent(in) :: self
class (type_depth_integral), intent(in) :: self
_DECLARE_ARGUMENTS_DO_COLUMN_
real(rk) :: local,weight,thickness,integral
real(rk) :: local, weight, thickness, integral
integral = 0.0_rk
_VERTICAL_LOOP_BEGIN_
......@@ -130,9 +129,9 @@ contains
_SET_HORIZONTAL_DIAGNOSTIC_(self%id_integral,integral)
end subroutine depth_integral_do_column
subroutine depth_integral_rate_distributor_initialize(self,configunit)
class (type_depth_integral_rate_distributor),intent(inout),target :: self
integer, intent(in) :: configunit
subroutine depth_integral_rate_distributor_initialize(self, configunit)
class (type_depth_integral_rate_distributor), intent(inout), target :: self
integer, intent(in) :: configunit
call self%register_state_dependency(self%id_target, 'target', '', 'variable to apply sources and sinks to')
call self%register_dependency(self%id_weights,'weights','-','weights for vertical distribution')
......@@ -140,12 +139,12 @@ contains
call self%register_dependency(self%id_sms,'sms','','depth-integrated sources-sinks')
end subroutine depth_integral_rate_distributor_initialize
subroutine depth_integral_rate_distributor_do(self,_ARGUMENTS_DO_)
class (type_depth_integral_rate_distributor),intent(in) :: self
subroutine depth_integral_rate_distributor_do(self, _ARGUMENTS_DO_)
class (type_depth_integral_rate_distributor), intent(in) :: self
_DECLARE_ARGUMENTS_DO_
real(rk) :: integral,integrated_sms,relative_change
real(rk) :: local,weight
real(rk) :: integral, integrated_sms, relative_change
real(rk) :: local, weight
_LOOP_BEGIN_
! First compute relative rate of change of depth-integrated target variable.
......
......@@ -289,7 +289,7 @@ contains
if (.not. self%fluff) return
! Enter spatial loops over the horizontal domain (if any).
_HORIZONTAL_LOOP_BEGIN_
_BOTTOM_LOOP_BEGIN_
! Retrieve current (local) state variable values.
_GET_(self%id_am,amb)
......@@ -334,7 +334,7 @@ contains
_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_
_BOTTOM_LOOP_END_
end subroutine do_bottom
! Weiss formula for the saturation oxygen (osat) \cite{Weiss1970}:
......@@ -394,7 +394,7 @@ contains
real(rk) :: p_vel,sc,flo2
integer, parameter :: newflux=1
_HORIZONTAL_LOOP_BEGIN_
_SURFACE_LOOP_BEGIN_
_GET_(self%id_temp,temp)
_GET_(self%id_salt,salt)
_GET_SURFACE_(self%id_wind,wnd)
......@@ -430,7 +430,7 @@ contains
_ADD_SURFACE_FLUX_(self%id_am,self%sfl_am)
_ADD_SURFACE_FLUX_(self%id_po,self%sfl_po)
_HORIZONTAL_LOOP_END_
_SURFACE_LOOP_END_
end subroutine do_surface
! Step function
......
......@@ -200,8 +200,8 @@ contains
! Export diagnostic variables
_SET_DIAGNOSTIC_(self%id_dPAR,par)
_SET_DIAGNOSTIC_(self%id_PPR ,primprod*secs_pr_day)
_SET_DIAGNOSTIC_(self%id_NPR ,(primprod - self%rpn*p)*secs_pr_day)
_SET_DIAGNOSTIC_(self%id_PPR,primprod*secs_pr_day)
_SET_DIAGNOSTIC_(self%id_NPR,(primprod - self%rpn*p)*secs_pr_day)
! Leave spatial loops (if any)
_LOOP_END_
......
......@@ -212,7 +212,7 @@ contains
!-----------------------------------------------------------------------
!BOC
! Enter spatial loops (if any)
_HORIZONTAL_LOOP_BEGIN_
_SURFACE_LOOP_BEGIN_
_GET_(self%id_temp,temp)
_GET_(self%id_salt,salt)
......@@ -249,7 +249,7 @@ contains
_SET_SURFACE_DIAGNOSTIC_(self%id_co2_flux,fl * days_per_sec)
! Leave spatial loops (if any)
_HORIZONTAL_LOOP_END_
_SURFACE_LOOP_END_
end subroutine do_surface
!EOC
......
......@@ -278,7 +278,7 @@
if (self%sedrate == 0.0_rk) return
! Enter spatial loops over the horizontal domain (if any).
_HORIZONTAL_LOOP_BEGIN_
_BOTTOM_LOOP_BEGIN_
! Retrieve current (local) state variable values.
! if (self%fluff) then
......@@ -296,7 +296,7 @@
_ADD_BOTTOM_FLUX_(self%id_c, -ll * c)
! Leave spatial loops over the horizontal domain (if any).
_HORIZONTAL_LOOP_END_
_BOTTOM_LOOP_END_
end subroutine do_bottom
!EOC
......
......@@ -276,7 +276,7 @@
!-----------------------------------------------------------------------
!BOC
! Enter spatial loops over the horizontal domain (if any).
_HORIZONTAL_LOOP_BEGIN_
_BOTTOM_LOOP_BEGIN_
! Retrieve current (local) state variable values.
! if (self%fluff) then
......@@ -368,7 +368,7 @@
_SET_BOTTOM_DIAGNOSTIC_(self%id_PBR,(pbr * self%pburialrate * fl/self%maxsed) * secs_per_day)
! Leave spatial loops over the horizontal domain (if any).
_HORIZONTAL_LOOP_END_
_BOTTOM_LOOP_END_
end subroutine do_bottom
!EOC
......@@ -435,7 +435,7 @@
!-----------------------------------------------------------------------
!BOC
!
_HORIZONTAL_LOOP_BEGIN_
_SURFACE_LOOP_BEGIN_
_GET_(self%id_temp,temp)
_GET_(self%id_salt,salt)
......@@ -479,7 +479,7 @@
_SET_SURFACE_DIAGNOSTIC_(self%id_OFL,flo2 * secs_per_day)
_HORIZONTAL_LOOP_END_
_SURFACE_LOOP_END_
end subroutine do_surface
!EOC
......
......@@ -39,14 +39,14 @@ contains
real(rk) :: yearday
_HORIZONTAL_LOOP_BEGIN_
_SURFACE_LOOP_BEGIN_
_GET_GLOBAL_(self%id_yearday,yearday)
if (mod(yearday-self%offset, 1.0_rk) < self%light_period) then
_SET_SURFACE_DIAGNOSTIC_(self%id_swr_sf, self%swr)
else
_SET_SURFACE_DIAGNOSTIC_(self%id_swr_sf, 0.0_rk)
end if
_HORIZONTAL_LOOP_END_
_SURFACE_LOOP_END_
end subroutine do_surface
end module
......@@ -1330,7 +1330,7 @@ contains
real(rk) :: bc, bn, bp, bsi
real(rk) :: mF, mFN, mFP, mFChl, mC, mN, mP, mChl, mSi
_HORIZONTAL_LOOP_BEGIN_
_BOTTOM_LOOP_BEGIN_
! Retrieve internal state variables values
_GET_(self%id_mF, mF)
......@@ -1342,9 +1342,9 @@ contains
_GET_(self%id_mP, mP)
_GET_(self%id_mChl, mChl)
_GET_HORIZONTAL_(self%id_bc, bc)
_GET_HORIZONTAL_(self%id_bn, bn)
_GET_HORIZONTAL_(self%id_bp, bp)
_GET_BOTTOM_(self%id_bc, bc)
_GET_BOTTOM_(self%id_bn, bn)
_GET_BOTTOM_(self%id_bp, bp)
! Account for sinking
_ADD_BOTTOM_FLUX_(self%id_mC, -self%sink * mC)
......@@ -1362,12 +1362,12 @@ contains
if (self%SSi) then
_GET_(self%id_mSi, mSi)
_GET_HORIZONTAL_(self%id_bsi, bsi)
_GET_BOTTOM_(self%id_bsi, bsi)
_ADD_BOTTOM_FLUX_(self%id_mSi, -self%sink * mSi)
_ADD_BOTTOM_SOURCE_(self%id_bsi, self%sink * mSi/28._rk)
end if
_HORIZONTAL_LOOP_END_
_BOTTOM_LOOP_END_
end subroutine
end module su_mixo
......
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