Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/use status log #38

Merged
merged 13 commits into from
May 3, 2016
Merged
15 changes: 8 additions & 7 deletions src/marbl_ciso_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ module marbl_ciso_mod
use marbl_sizes , only : zooplankton_cnt
use marbl_sizes , only : grazer_prey_cnt

use marbl_logging , only : error_msg
use marbl_logging , only : status_msg
use marbl_logging , only : marbl_log_type

use marbl_interface_types , only : marbl_tracer_metadata_type
Expand Down Expand Up @@ -130,6 +128,7 @@ subroutine marbl_ciso_init_nml(nl_buffer, marbl_status_log)
! local variables
!-----------------------------------------------------------------------
character(*), parameter :: subname = 'marbl_ciso_mod:marbl_ciso_init_nml'
character(len=char_len) :: log_message

integer (int_kind) :: &
n, & ! index
Expand Down Expand Up @@ -223,6 +222,7 @@ subroutine marbl_ciso_init_tracer_metadata(marbl_tracer_metadata, &
! local variables
!-----------------------------------------------------------------------
character(*), parameter :: subname = 'marbl_ciso_mod:marbl_ciso_init_tracer_metadata'
character(len=char_len) :: log_message

integer (int_kind) :: n ! tracer index
integer (int_kind) :: auto_ind ! autotroph functional group index
Expand Down Expand Up @@ -268,7 +268,6 @@ subroutine marbl_ciso_init_tracer_metadata(marbl_tracer_metadata, &
marbl_tracer_metadata(zoo14C_ind)%short_name='zoo14C'
marbl_tracer_metadata(zoo14C_ind)%long_name='Zooplankton Carbon-14'


!-----------------------------------------------------------------------
! initialize autotroph tracer_d values and tracer indices
!-----------------------------------------------------------------------
Expand Down Expand Up @@ -559,8 +558,7 @@ subroutine marbl_ciso_set_interior_forcing( &
cell_radius, cell_permea, cell_eps_fix, marbl_status_log)

if (marbl_status_log%labort_marbl) then
error_msg = "error code returned from setup_cell_attributes"
call marbl_status_log%log_error(error_msg, subname)
call marbl_status_log%log_error_trace("setup_cell_attributes", subname)
return
end if

Expand Down Expand Up @@ -1076,6 +1074,7 @@ subroutine setup_cell_attributes(ciso_fract_factors, &
! local variables
!-----------------------------------------------------------------------
character(*), parameter :: subname = 'marbl_ciso_mod:setup_cell_attributes'
character(len=char_len) :: log_message
integer (int_kind) :: &
auto_ind ! autotroph functional group index
!-----------------------------------------------------------------------
Expand Down Expand Up @@ -1130,8 +1129,8 @@ subroutine setup_cell_attributes(ciso_fract_factors, &
! cell_eps_fix(auto_ind) = 23.0_r8 ! fractionation effect of carbon fixation

else if (autotrophs(auto_ind)%Nfixer .and. autotrophs(auto_ind)%kSiO3 > c0) then
error_msg = "ciso: Currently Keller and Morel fractionation does not work for Diatoms-Diazotrophs"
call marbl_status_log%log_error(error_msg, subname)
log_message = "ciso: Currently Keller and Morel fractionation does not work for Diatoms-Diazotrophs"
call marbl_status_log%log_error(log_message, subname)
return

else
Expand Down Expand Up @@ -1518,6 +1517,7 @@ subroutine compute_particulate_terms(k, column_km, column_kmt, column_delta_z, c
! local variables
!-----------------------------------------------------------------------
character(*), parameter :: subname = 'marbl_ciso_mod:ciso_compute_particulate_terms'
character(len=char_len) :: log_message

real (r8) :: &
dz_loc, & ! dz at a particular i,j location
Expand Down Expand Up @@ -1867,6 +1867,7 @@ subroutine marbl_ciso_set_surface_forcing( &
! local variables
!-----------------------------------------------------------------------
character(*), parameter :: subname = 'marbl_ciso_mod:marbl_ciso_set_surface_forcing'
character(len=char_len) :: log_message

logical (log_kind), save :: &
first = .true. ! Logical for first iteration test
Expand Down
36 changes: 17 additions & 19 deletions src/marbl_co2calc_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ module marbl_co2calc_mod
! based upon OCMIP2 co2calc
!-----------------------------------------------------------------------------

use marbl_kinds_mod , only : int_kind, r8, log_kind
use marbl_kinds_mod , only : int_kind, r8, log_kind, char_len
use marbl_logging , only : marbl_log_type
use marbl_logging , only : error_msg
use marbl_logging , only : status_msg
use marbl_parms , only : p001,c3, c10
use marbl_constants_mod , only : c0, p5, c1, c2, c1000, T0_Kelvin, rho_sw

Expand Down Expand Up @@ -137,7 +135,7 @@ subroutine marbl_co2calc_surf( &
!---------------------------------------------------------------------------
! local variable declarations
!---------------------------------------------------------------------------
character(*), parameter :: subname = 'marbl_co2calc:marbl_co2calc_surf'
character(*), parameter :: subname = 'marbl_co2calc_mod:marbl_co2calc_surf'
integer(kind=int_kind) :: n
integer(kind=int_kind) :: k
real(kind=r8) :: mass_to_vol ! (mol/kg) -> (mmol/m^3)
Expand Down Expand Up @@ -202,8 +200,7 @@ subroutine marbl_co2calc_surf( &

if (present (marbl_status_log)) then
if (marbl_status_log%labort_marbl) then
error_msg = "error code returned from comp_htotal"
call marbl_status_log%log_error(error_msg, subname)
call marbl_status_log%log_error_trace("comp_htotal()", subname)
return
end if
end if
Expand Down Expand Up @@ -306,6 +303,7 @@ subroutine marbl_comp_CO3terms(&
!---------------------------------------------------------------------------
! local variable declarations
!---------------------------------------------------------------------------
character(*), parameter :: subname = 'marbl_co2calc_mod:marbl_comp_CO3terms'
integer(kind=int_kind) :: c
real(kind=r8) :: mass_to_vol ! (mol/kg) -> (mmol/m^3)
real(kind=r8) :: vol_to_mass ! (mmol/m^3) -> (mol/kg)
Expand Down Expand Up @@ -371,8 +369,7 @@ subroutine marbl_comp_CO3terms(&
phlo, phhi, htotal, marbl_status_log)

if (marbl_status_log%labort_marbl) then
error_msg = "error code returned from comp_htotal"
call marbl_status_log%log_error(error_msg, "marbl_co2calc::marbl_comp_CO3terms")
call marbl_status_log%log_error_trace("comp_htotal()", subname)
return
end if

Expand Down Expand Up @@ -789,6 +786,7 @@ subroutine comp_htotal(num_elements, mask, temp, dic_in, ta_in, pt_in, sit_in, &
!---------------------------------------------------------------------------
! local variable declarations
!---------------------------------------------------------------------------
character(*), parameter :: subname = 'marbl_co2calc_mod:marbl_comp_htotal'
integer(kind=int_kind) :: c
real(kind=r8) :: mass_to_vol ! (mol/kg) -> (mmol/m^3)
real(kind=r8) :: vol_to_mass ! (mmol/m^3) -> (mol/kg)
Expand Down Expand Up @@ -866,8 +864,7 @@ subroutine comp_htotal(num_elements, mask, temp, dic_in, ta_in, pt_in, sit_in, &
marbl_status_log)

if (marbl_status_log%labort_marbl) then
error_msg = "error code returned from drtsafe"
call marbl_status_log%log_error(error_msg, "marbl_co2calc::comp_htotal")
call marbl_status_log%log_error_trace("drtsafe", subname)
return
end if

Expand Down Expand Up @@ -907,7 +904,8 @@ subroutine drtsafe(num_elements, mask_in, k1, k2, co3_coeffs, x1, x2, xacc, &
!---------------------------------------------------------------------------
! local variable declarations
!---------------------------------------------------------------------------
character(*), parameter :: subname = 'marbl_co2calc::drtsafe'
character(*), parameter :: subname = 'marbl_co2calc_mod:drtsafe'
character(len=char_len) :: log_message
logical(kind=log_kind) :: leave_bracket, dx_decrease
logical(kind=log_kind), dimension(num_elements) :: mask
integer(kind=int_kind) :: c, it
Expand Down Expand Up @@ -942,24 +940,24 @@ subroutine drtsafe(num_elements, mask_in, k1, k2, co3_coeffs, x1, x2, xacc, &
! FIXME #21: make marbl_status_log required - this is currently needed
! since abio_dic_dic14_mod is calling this routine but has
! not itself been MARBLized yet
WRITE(status_msg,"(4A,I0,A,I0,A,I0)") '(', subname, ') ', &
WRITE(log_message,"(4A,I0,A,I0,A,I0)") '(', subname, ') ', &
', c = ', c, ', it = ', it
call marbl_status_log%log_noerror(status_msg, subname, c, .true.)
WRITE(status_msg,"(4A,2E15.7e3)") '(', subname, ') ', &
call marbl_status_log%log_noerror(log_message, subname, c, .true.)
WRITE(log_message,"(4A,2E15.7e3)") '(', subname, ') ', &
' x1,f = ', x1(c), flo(c)
call marbl_status_log%log_noerror(status_msg, subname, c, .true.)
WRITE(status_msg,"(4A,2E15.7e3)") '(', subname, ') ', &
call marbl_status_log%log_noerror(log_message, subname, c, .true.)
WRITE(log_message,"(4A,2E15.7e3)") '(', subname, ') ', &
' x2,f = ', x2(c), fhi(c)
call marbl_status_log%log_noerror(status_msg, subname, c, .true.)
call marbl_status_log%log_noerror(log_message, subname, c, .true.)
end if
end if
end do

if (it > max_bracket_grow_it) then
if (present(marbl_status_log)) then
! FIXME #21 (see above)
error_msg = "bounding bracket for pH solution not found"
call marbl_status_log%log_error(error_msg, subname, c)
log_message = "bounding bracket for pH solution not found"
call marbl_status_log%log_error(log_message, subname, c)
end if
return
end if
Expand Down
Loading