From d5adaf823538547533aa202a43004834b49b35ea Mon Sep 17 00:00:00 2001 From: Michael Levy Date: Tue, 24 May 2016 15:21:17 -0600 Subject: [PATCH] Move pi (and few others) to marbl_constants_mod Pi is now hard-coded to be 3.14159265358979323846_r8, rather than computed in marbl_ciso_set_interior. Also, marbl_ciso no longer has its own marbl_seconds_in_year variable - uses marbl_constants_mod:spy instead. --- src/marbl_ciso_mod.F90 | 20 ++++++-------------- src/marbl_constants_mod.F90 | 20 +++++++++++--------- 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/src/marbl_ciso_mod.F90 b/src/marbl_ciso_mod.F90 index 579ad9dc..7daa868f 100644 --- a/src/marbl_ciso_mod.F90 +++ b/src/marbl_ciso_mod.F90 @@ -73,9 +73,6 @@ module marbl_ciso_mod real (r8) :: Ca14CO3 ! local copy of model autotroph Ca14CO3 end type autotroph_local_type - ! Module variables - real(r8) :: pi - !----------------------------------------------------------------------- ! scalar constants for 14C decay calculation !----------------------------------------------------------------------- @@ -354,6 +351,7 @@ subroutine marbl_ciso_set_interior_forcing( & use marbl_constants_mod , only : R13c_std use marbl_constants_mod , only : R14c_std use marbl_constants_mod , only : spd + use marbl_constants_mod , only : spy use marbl_diagnostics_mod , only : store_diagnostics_ciso_interior implicit none @@ -379,7 +377,6 @@ subroutine marbl_ciso_set_interior_forcing( & logical (log_kind) :: zero_mask real (r8) :: & - marbl_seconds_in_year, & work1, & ! temporaries ztop ! depth of top of cell @@ -538,14 +535,8 @@ subroutine marbl_ciso_set_interior_forcing( & ! Set module variables !----------------------------------------------------------------------- - ! FIXME #36: move this calculations to the init phase when - ! the initialization is brought into this module - - pi = 4.0_r8 * atan( 1.0_r8 ) - ! Define decay variable for DI14C, using earlier defined half-life of 14C - marbl_seconds_in_year = 86400._r8 * 365._r8 - c14_lambda_inv_sec = log(c2) / (c14_halflife_years * marbl_seconds_in_year) + c14_lambda_inv_sec = log(c2) / (c14_halflife_years * spy) !---------------------------------------------------------------------------------------- ! Set cell attributes @@ -1303,7 +1294,9 @@ subroutine fract_keller_morel( & ! ! Developed by X. Giraud, ETH Zürich, 21.07.2008 !--------------------------------------------------------------------------- - + + use marbl_constants_mod, only : pi + implicit none real (r8), intent(in) :: & @@ -1323,8 +1316,7 @@ subroutine fract_keller_morel( & real (r8) :: & var, theta, eps_up - real (r8) :: & - pi, Vol, Qc, Surf, radius_m + real (r8) :: Vol, Qc, Surf, radius_m real (r8) :: & eps_diff = 0.7_r8, & ! fractionation by diffusion, O'Leary, 1984 diff --git a/src/marbl_constants_mod.F90 b/src/marbl_constants_mod.F90 index e6e21307..15213109 100644 --- a/src/marbl_constants_mod.F90 +++ b/src/marbl_constants_mod.F90 @@ -7,19 +7,21 @@ module marbl_constants_mod save ! General constants - real(kind=r8), parameter, public :: & - c0 = 0.0_r8 , & - c1 = 1.0_r8 , & - c2 = 2.0_r8 , & - c3 = 3.0_r8 , & - c10 = 10.0_r8 , & - c1000 = 1000.0_r8 , & - p001 = 0.001_r8 , & - p5 = 0.5_r8 + real(kind=r8), parameter, public :: & + c0 = 0.0_r8 , & + c1 = 1.0_r8 , & + c2 = 2.0_r8 , & + c3 = 3.0_r8 , & + c10 = 10.0_r8 , & + c1000 = 1000.0_r8 , & + p001 = 0.001_r8 , & + p5 = 0.5_r8 , & + pi = 3.14159265358979323846_r8 ! Unit Conversion real(kind=r8), parameter, public :: & spd = 86400.0_r8, & ! number of seconds in a day + spy = 365.0_r8*spd, & ! number of seconds in a year dps = c1 / spd, & ! number of days in a second yps = c1 / (365.0_r8*spd), & ! number of years in a second mpercm = .01_r8 ! meters per cm