Skip to content

Commit

Permalink
Move pi (and few others) to marbl_constants_mod
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mnlevy1981 committed May 24, 2016
1 parent ef98625 commit d5adaf8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 23 deletions.
20 changes: 6 additions & 14 deletions src/marbl_ciso_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
!-----------------------------------------------------------------------
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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) :: &
Expand All @@ -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
Expand Down
20 changes: 11 additions & 9 deletions src/marbl_constants_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d5adaf8

Please sign in to comment.