From 7230e1e192a5f1f4586aa65507048d76d662aaa0 Mon Sep 17 00:00:00 2001 From: Michael Levy Date: Tue, 22 Mar 2016 11:00:52 -0600 Subject: [PATCH 01/11] Add status log to diagnostic calls Working towards solution to issue #23 -- errors returned from diagnostic init are now added to the status log instead of printed to stdout. --- src/marbl_diagnostics_mod.F90 | 1777 +++++++++++++++++++++++++++++---- src/marbl_interface.F90 | 23 +- src/marbl_interface_types.F90 | 29 +- 3 files changed, 1594 insertions(+), 235 deletions(-) diff --git a/src/marbl_diagnostics_mod.F90 b/src/marbl_diagnostics_mod.F90 index f5d25e62..c10fdbd5 100644 --- a/src/marbl_diagnostics_mod.F90 +++ b/src/marbl_diagnostics_mod.F90 @@ -53,6 +53,9 @@ module marbl_diagnostics_mod use marbl_interface_types , only : marbl_surface_forcing_indexing_type use marbl_interface_types , only : marbl_diagnostics_type + use marbl_logging, only : marbl_log_type + use marbl_logging, only : error_msg + implicit none public @@ -352,7 +355,8 @@ subroutine marbl_diagnostics_init( & marbl_tracer_metadata, & marbl_interior_forcing_diags, & marbl_interior_restore_diags, & - marbl_surface_forcing_diags) + marbl_surface_forcing_diags, & + marbl_status_log) logical (log_kind) , intent(in) :: ciso_on type(marbl_domain_type) , intent(in) :: marbl_domain @@ -360,6 +364,7 @@ subroutine marbl_diagnostics_init( & type(marbl_diagnostics_type) , intent(inout) :: marbl_interior_forcing_diags type(marbl_diagnostics_type) , intent(inout) :: marbl_interior_restore_diags type(marbl_diagnostics_type) , intent(inout) :: marbl_surface_forcing_diags + type(marbl_log_type) , intent(inout) :: marbl_status_log !----------------------------------------------------------------------- ! local variables @@ -372,6 +377,8 @@ subroutine marbl_diagnostics_init( & integer :: num_restore_diags integer :: num_forcing_diags character(len=char_len) :: lname, sname, units, vgrid + + character(*), parameter :: subname = "marbl_diagnostics_mod:marbl_diagnostics_init" !----------------------------------------------------------------------- !----------------------------------------------------------------- @@ -412,7 +419,13 @@ subroutine marbl_diagnostics_init( & units = 'fraction' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%ECOSYS_IFRAC) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%ECOSYS_IFRAC, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -423,7 +436,13 @@ subroutine marbl_diagnostics_init( & units = 'cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%ECOSYS_XKW) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%ECOSYS_XKW, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -434,7 +453,13 @@ subroutine marbl_diagnostics_init( & units = 'atmospheres' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%ECOSYS_ATM_PRESS) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%ECOSYS_ATM_PRESS, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -445,7 +470,13 @@ subroutine marbl_diagnostics_init( & units = 'cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%PV_O2) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%PV_O2, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -456,7 +487,13 @@ subroutine marbl_diagnostics_init( & units = 'none' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%SCHMIDT_O2) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%SCHMIDT_O2, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -467,7 +504,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3' ! = nmol/cm^3 vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%O2SAT) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%O2SAT, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -478,7 +521,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%O2_GAS_FLUX) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%O2_GAS_FLUX, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -489,7 +538,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CO2STAR) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CO2STAR, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -500,7 +555,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%DCO2STAR) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%DCO2STAR, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -511,7 +572,13 @@ subroutine marbl_diagnostics_init( & units = 'ppmv' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%pCO2SURF) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%pCO2SURF, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -522,7 +589,13 @@ subroutine marbl_diagnostics_init( & units = 'ppmv' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%DpCO2) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%DpCO2, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -533,7 +606,13 @@ subroutine marbl_diagnostics_init( & units = 'cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%PV_CO2) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%PV_CO2, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -544,7 +623,13 @@ subroutine marbl_diagnostics_init( & units = 'none' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%SCHMIDT_CO2) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%SCHMIDT_CO2, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -555,7 +640,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%DIC_GAS_FLUX) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%DIC_GAS_FLUX, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -566,7 +657,13 @@ subroutine marbl_diagnostics_init( & units = 'none' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%PH) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%PH, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -577,7 +674,13 @@ subroutine marbl_diagnostics_init( & units = 'ppmv' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%ATM_CO2) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%ATM_CO2, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -588,7 +691,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CO2STAR_ALT_CO2) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CO2STAR_ALT_CO2, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -599,7 +708,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%DCO2STAR_ALT_CO2) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%DCO2STAR_ALT_CO2, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -610,7 +725,13 @@ subroutine marbl_diagnostics_init( & units = 'ppmv' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%pCO2SURF_ALT_CO2) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%pCO2SURF_ALT_CO2, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -621,7 +742,13 @@ subroutine marbl_diagnostics_init( & units = 'ppmv' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%DpCO2_ALT_CO2) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%DpCO2_ALT_CO2, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -632,7 +759,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%DIC_GAS_FLUX_ALT_CO2) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%DIC_GAS_FLUX_ALT_CO2, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -643,7 +776,13 @@ subroutine marbl_diagnostics_init( & units = 'none' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%PH_ALT_CO2) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%PH_ALT_CO2, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -654,7 +793,13 @@ subroutine marbl_diagnostics_init( & units = 'ppmv' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%ATM_ALT_CO2) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%ATM_ALT_CO2, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -665,7 +810,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%IRON_FLUX) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%IRON_FLUX, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -676,7 +827,13 @@ subroutine marbl_diagnostics_init( & units = 'g/cm^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%DUST_FLUX) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%DUST_FLUX, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -687,7 +844,13 @@ subroutine marbl_diagnostics_init( & units = 'nmol/cm^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%NOx_FLUX) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%NOx_FLUX, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -698,7 +861,13 @@ subroutine marbl_diagnostics_init( & units = 'nmol/cm^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%NHy_FLUX) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%NHy_FLUX, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -709,7 +878,13 @@ subroutine marbl_diagnostics_init( & units = 'nmol/cm^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%DIN_RIV_FLUX) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%DIN_RIV_FLUX, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -720,7 +895,13 @@ subroutine marbl_diagnostics_init( & units = 'nmol/cm^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%DIP_RIV_FLUX) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%DIP_RIV_FLUX, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -731,7 +912,13 @@ subroutine marbl_diagnostics_init( & units = 'nmol/cm^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%DON_RIV_FLUX) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%DON_RIV_FLUX, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -742,7 +929,13 @@ subroutine marbl_diagnostics_init( & units = 'nmol/cm^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%DONr_RIV_FLUX) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%DONr_RIV_FLUX, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -753,7 +946,13 @@ subroutine marbl_diagnostics_init( & units = 'nmol/cm^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%DOP_RIV_FLUX) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%DOP_RIV_FLUX, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -764,7 +963,13 @@ subroutine marbl_diagnostics_init( & units = 'nmol/cm^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%DOPr_RIV_FLUX) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%DOPr_RIV_FLUX, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -775,7 +980,13 @@ subroutine marbl_diagnostics_init( & units = 'nmol/cm^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%DSI_RIV_FLUX) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%DSI_RIV_FLUX, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -786,7 +997,13 @@ subroutine marbl_diagnostics_init( & units = 'nmol/cm^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%DFE_RIV_FLUX) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%DFE_RIV_FLUX, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -797,7 +1014,13 @@ subroutine marbl_diagnostics_init( & units = 'nmol/cm^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%DIC_RIV_FLUX) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%DIC_RIV_FLUX, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -808,7 +1031,13 @@ subroutine marbl_diagnostics_init( & units = 'alk/cm^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%ALK_RIV_FLUX) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%ALK_RIV_FLUX, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -819,7 +1048,13 @@ subroutine marbl_diagnostics_init( & units = 'nmol/cm^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%DOC_RIV_FLUX) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%DOC_RIV_FLUX, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -830,7 +1065,13 @@ subroutine marbl_diagnostics_init( & units = 'nmol/cm^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%DOCr_RIV_FLUX) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%DOCr_RIV_FLUX, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if !----------------------------------------------------------------------- @@ -847,7 +1088,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_DI13C_GAS_FLUX) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_DI13C_GAS_FLUX, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -858,7 +1105,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_DI13C_AS_GAS_FLUX) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_DI13C_AS_GAS_FLUX, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -869,7 +1122,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_DI13C_SA_GAS_FLUX) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_DI13C_SA_GAS_FLUX, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -880,7 +1139,13 @@ subroutine marbl_diagnostics_init( & units = 'permil' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_d13C_GAS_FLUX) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_d13C_GAS_FLUX, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -891,7 +1156,13 @@ subroutine marbl_diagnostics_init( & units = 'permil' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_D13C_atm) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_D13C_atm, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -902,7 +1173,13 @@ subroutine marbl_diagnostics_init( & units = 'permil' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_R13C_DIC_surf) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_R13C_DIC_surf, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -913,7 +1190,13 @@ subroutine marbl_diagnostics_init( & units = 'permil' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_R13C_atm) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_R13C_atm, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -924,7 +1207,13 @@ subroutine marbl_diagnostics_init( & units = 'nmol/cm^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_DI13C_RIV_FLUX) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_DI13C_RIV_FLUX, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -935,7 +1224,13 @@ subroutine marbl_diagnostics_init( & units = 'nmol/cm^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_DO13C_RIV_FLUX) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_DO13C_RIV_FLUX, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -946,7 +1241,13 @@ subroutine marbl_diagnostics_init( & units = 'permil' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_eps_aq_g_surf) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_eps_aq_g_surf, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -957,7 +1258,13 @@ subroutine marbl_diagnostics_init( & units = 'permil' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_eps_dic_g_surf) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_eps_dic_g_surf, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -968,7 +1275,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_DI14C_GAS_FLUX) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_DI14C_GAS_FLUX, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -979,7 +1292,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_DI14C_AS_GAS_FLUX) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_DI14C_AS_GAS_FLUX, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -990,7 +1309,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_DI14C_SA_GAS_FLUX) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_DI14C_SA_GAS_FLUX, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1001,7 +1326,13 @@ subroutine marbl_diagnostics_init( & units = 'permil' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_d14C_GAS_FLUX) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_d14C_GAS_FLUX, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1012,7 +1343,13 @@ subroutine marbl_diagnostics_init( & units = 'permil' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_D14C_atm) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_D14C_atm, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1023,7 +1360,13 @@ subroutine marbl_diagnostics_init( & units = 'permil' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_R14C_DIC_surf) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_R14C_DIC_surf, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1034,7 +1377,13 @@ subroutine marbl_diagnostics_init( & units = 'permil' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_R14C_atm) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_R14C_atm, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1045,7 +1394,13 @@ subroutine marbl_diagnostics_init( & units = 'nmol/cm^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_DI14C_RIV_FLUX) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_DI14C_RIV_FLUX, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1056,7 +1411,13 @@ subroutine marbl_diagnostics_init( & units = 'nmol/cm^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_DO14C_RIV_FLUX) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_DO14C_RIV_FLUX, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1067,7 +1428,13 @@ subroutine marbl_diagnostics_init( & units = 'permil' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_GLOBAL_D14C) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_GLOBAL_D14C, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if end if @@ -1091,7 +1458,13 @@ subroutine marbl_diagnostics_init( & units = 'cm' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%zsatcalc) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%zsatcalc, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1102,7 +1475,13 @@ subroutine marbl_diagnostics_init( & units = 'cm' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%zsatarag) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%zsatarag, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1113,7 +1492,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%O2_ZMIN) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%O2_ZMIN, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1124,7 +1509,13 @@ subroutine marbl_diagnostics_init( & units = 'cm' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%O2_ZMIN_DEPTH) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%O2_ZMIN_DEPTH, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1135,7 +1526,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%photoC_TOT_zint) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%photoC_TOT_zint, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1146,7 +1543,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%photoC_NO3_TOT_zint) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%photoC_NO3_TOT_zint, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1157,7 +1560,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%Jint_Ctot) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%Jint_Ctot, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1168,7 +1577,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%Jint_100m_Ctot) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%Jint_100m_Ctot, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1179,7 +1594,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%Jint_Ntot) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%Jint_Ntot, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1190,7 +1611,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%Jint_100m_Ntot) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%Jint_100m_Ntot, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1201,7 +1628,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%Jint_Ptot) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%Jint_Ptot, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1212,7 +1645,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%Jint_100m_Ptot) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%Jint_100m_Ptot, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1223,7 +1662,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%Jint_Sitot) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%Jint_Sitot, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1234,7 +1679,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%Jint_100m_Sitot) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%Jint_100m_Sitot, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1245,7 +1696,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%Jint_Fetot) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%Jint_Fetot, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1256,7 +1713,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%Jint_100m_Fetot) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%Jint_100m_Fetot, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if ! Particulate 2D diags @@ -1268,7 +1731,13 @@ subroutine marbl_diagnostics_init( & units = 'nmolC/cm^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%calcToSed) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%calcToSed, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1279,7 +1748,13 @@ subroutine marbl_diagnostics_init( & units = 'nmolC/cm^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%pocToSed) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%pocToSed, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1290,7 +1765,13 @@ subroutine marbl_diagnostics_init( & units = 'nmolN/cm^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%ponToSed) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%ponToSed, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1301,7 +1782,13 @@ subroutine marbl_diagnostics_init( & units = 'nmolN/cm^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%SedDenitrif) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%SedDenitrif, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1312,7 +1799,13 @@ subroutine marbl_diagnostics_init( & units = 'nmolC/cm^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%OtherRemin) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%OtherRemin, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1323,7 +1816,13 @@ subroutine marbl_diagnostics_init( & units = 'nmolP/cm^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%popToSed) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%popToSed, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1334,7 +1833,13 @@ subroutine marbl_diagnostics_init( & units = 'nmolSi/cm^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%bsiToSed) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%bsiToSed, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1345,7 +1850,13 @@ subroutine marbl_diagnostics_init( & units = 'g/cm^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%dustToSed) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%dustToSed, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1356,7 +1867,13 @@ subroutine marbl_diagnostics_init( & units = 'nmolFe/cm^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%pfeToSed) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%pfeToSed, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if ! Autotroph 2D diags @@ -1369,7 +1886,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%photoC_zint(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%photoC_zint(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1380,7 +1903,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%photoC_NO3_zint(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%photoC_NO3_zint(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1392,7 +1921,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CaCO3_form_zint(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CaCO3_form_zint(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if else ind%CaCO3_form_zint(n) = -1 end if @@ -1407,7 +1942,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%tot_CaCO3_form_zint) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%tot_CaCO3_form_zint, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if ! General 3D diags @@ -1419,7 +1960,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CO3) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CO3, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1430,7 +1977,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%HCO3) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%HCO3, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1441,7 +1994,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%H2CO3) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%H2CO3, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1452,7 +2011,13 @@ subroutine marbl_diagnostics_init( & units = 'none' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%ph_3D) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%ph_3D, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1463,7 +2028,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CO3_ALT_CO2) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CO3_ALT_CO2, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1474,7 +2045,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%HCO3_ALT_CO2) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%HCO3_ALT_CO2, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1485,7 +2062,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%H2CO3_ALT_CO2) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%H2CO3_ALT_CO2, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1496,7 +2079,13 @@ subroutine marbl_diagnostics_init( & units = 'none' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%ph_3D_ALT_CO2) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%ph_3D_ALT_CO2, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1507,7 +2096,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%co3_sat_calc) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%co3_sat_calc, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1518,7 +2113,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%co3_sat_arag) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%co3_sat_arag, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1529,7 +2130,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%NITRIF) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%NITRIF, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1540,7 +2147,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%DENITRIF) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%DENITRIF, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1551,7 +2164,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%O2_PRODUCTION) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%O2_PRODUCTION, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1562,7 +2181,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%O2_CONSUMPTION) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%O2_CONSUMPTION, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1573,7 +2198,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%AOU) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%AOU, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1584,7 +2215,13 @@ subroutine marbl_diagnostics_init( & units = 'W/m^2' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%PAR_avg) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%PAR_avg, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1595,7 +2232,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%auto_graze_TOT) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%auto_graze_TOT, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1606,7 +2249,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%photoC_TOT) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%photoC_TOT, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1617,7 +2266,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%photoC_NO3_TOT) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%photoC_NO3_TOT, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1628,7 +2283,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%DOC_prod) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%DOC_prod, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1639,7 +2300,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%DOC_remin) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%DOC_remin, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1650,7 +2317,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%DOCr_remin) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%DOCr_remin, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1661,7 +2334,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%DON_prod) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%DON_prod, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1672,7 +2351,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%DON_remin) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%DON_remin, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1683,7 +2368,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%DONr_remin) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%DONr_remin, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1694,7 +2385,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%DOP_prod) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%DOP_prod, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1705,7 +2402,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%DOP_remin) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%DOP_remin, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1716,7 +2419,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%DOPr_remin) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%DOPr_remin, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1727,7 +2436,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%Fe_scavenge) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%Fe_scavenge, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1738,7 +2453,13 @@ subroutine marbl_diagnostics_init( & units = '1/y' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%Fe_scavenge_rate) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%Fe_scavenge_rate, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if ! Particulate 3D diags @@ -1750,7 +2471,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%POC_FLUX_IN) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%POC_FLUX_IN, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1761,7 +2488,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%POC_PROD) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%POC_PROD, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1772,7 +2505,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%POC_REMIN) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%POC_REMIN, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1783,7 +2522,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%POC_REMIN_DIC) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%POC_REMIN_DIC, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1794,7 +2539,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%PON_REMIN_NH4) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%PON_REMIN_NH4, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1805,7 +2556,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%POP_REMIN_PO4) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%POP_REMIN_PO4, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1816,7 +2573,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CaCO3_FLUX_IN) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CaCO3_FLUX_IN, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1827,7 +2590,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CaCO3_PROD) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CaCO3_PROD, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1838,7 +2607,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CaCO3_REMIN) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CaCO3_REMIN, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1849,7 +2624,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%SiO2_FLUX_IN) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%SiO2_FLUX_IN, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1860,7 +2641,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%SiO2_PROD) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%SiO2_PROD, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1871,7 +2658,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%SiO2_REMIN) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%SiO2_REMIN, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1882,7 +2675,13 @@ subroutine marbl_diagnostics_init( & units = 'ng/s/m^2' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%dust_FLUX_IN) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%dust_FLUX_IN, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1893,7 +2692,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%dust_REMIN) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%dust_REMIN, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1904,7 +2709,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%P_iron_FLUX_IN) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%P_iron_FLUX_IN, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1915,7 +2726,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%P_iron_PROD) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%P_iron_PROD, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1926,7 +2743,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%P_iron_REMIN) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%P_iron_REMIN, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if ! Autotroph 3D diags @@ -1940,7 +2763,13 @@ subroutine marbl_diagnostics_init( & units = 'none' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%N_lim(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%N_lim(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1951,7 +2780,13 @@ subroutine marbl_diagnostics_init( & units = 'none' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%P_lim(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%P_lim(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1962,7 +2797,13 @@ subroutine marbl_diagnostics_init( & units = 'none' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%Fe_lim(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%Fe_lim(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1974,7 +2815,13 @@ subroutine marbl_diagnostics_init( & units = 'none' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%SiO3_lim(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%SiO3_lim(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if else ind%SiO3_lim(n) = -1 end if @@ -1988,7 +2835,13 @@ subroutine marbl_diagnostics_init( & units = 'none' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%light_lim(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%light_lim(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -1999,7 +2852,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%photoC(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%photoC(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2010,7 +2869,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%photoC_NO3(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%photoC_NO3(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2021,7 +2886,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%photoFe(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%photoFe(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2032,7 +2903,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%photoNO3(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%photoNO3(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2043,7 +2920,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%photoNH4(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%photoNH4(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2054,7 +2937,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%DOP_uptake(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%DOP_uptake(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2065,7 +2954,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%PO4_uptake(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%PO4_uptake(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2076,7 +2971,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%auto_graze(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%auto_graze(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2087,7 +2988,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%auto_graze_poc(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%auto_graze_poc(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2098,7 +3005,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%auto_graze_doc(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%auto_graze_doc(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2109,7 +3022,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%auto_graze_zoo(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%auto_graze_zoo(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2120,7 +3039,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%auto_loss(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%auto_loss(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2131,7 +3056,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%auto_loss_poc(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%auto_loss_poc(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2142,7 +3073,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%auto_loss_doc(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%auto_loss_doc(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2153,7 +3090,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%auto_agg(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%auto_agg(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2167,7 +3110,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%bSi_form(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%bSi_form(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if else ind%bSi_form(n) = -1 end if @@ -2182,7 +3131,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CaCO3_form(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CaCO3_form(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if else ind%CaCO3_form(n) = -1 end if @@ -2197,7 +3152,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%Nfix(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%Nfix(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if else ind%Nfix(n) = -1 end if @@ -2213,7 +3174,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%tot_bSi_form) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%tot_bSi_form, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2224,7 +3191,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%tot_CaCO3_form) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%tot_CaCO3_form, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2235,7 +3208,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%tot_Nfix) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%tot_Nfix, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if ! Zooplankton 3D diags @@ -2249,7 +3228,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%zoo_loss(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%zoo_loss(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2260,7 +3245,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%zoo_loss_poc(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%zoo_loss_poc(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2271,7 +3262,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%zoo_loss_doc(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%zoo_loss_doc(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2282,7 +3279,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%zoo_graze(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%zoo_graze(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2293,7 +3296,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%zoo_graze_poc(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%zoo_graze_poc(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2304,7 +3313,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%zoo_graze_doc(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%zoo_graze_doc(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2315,7 +3330,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%zoo_graze_zoo(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%zoo_graze_zoo(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2326,7 +3347,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%x_graze_zoo(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%x_graze_zoo(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if end do @@ -2343,7 +3370,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_PO13C_FLUX_IN) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_PO13C_FLUX_IN, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2354,7 +3387,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_PO13C_PROD) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_PO13C_PROD, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2365,7 +3404,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_PO13C_REMIN) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_PO13C_REMIN, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2376,7 +3421,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_DO13C_prod) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_DO13C_prod, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2387,7 +3438,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_DO13C_remin) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_DO13C_remin, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2398,7 +3455,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_Ca13CO3_FLUX_IN) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_Ca13CO3_FLUX_IN, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2409,7 +3472,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_Ca13CO3_PROD) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_Ca13CO3_PROD, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2420,7 +3489,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_Ca13CO3_REMIN) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_Ca13CO3_REMIN, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2431,7 +3506,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_photo13C_TOT) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_photo13C_TOT, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2442,7 +3523,13 @@ subroutine marbl_diagnostics_init( & units = 'permil' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_DIC_d13C) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_DIC_d13C, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2453,7 +3540,13 @@ subroutine marbl_diagnostics_init( & units = 'permil' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_DOC_d13C) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_DOC_d13C, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2464,7 +3557,13 @@ subroutine marbl_diagnostics_init( & units = 'permil' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_zooC_d13C) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_zooC_d13C, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2475,7 +3574,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_PO14C_FLUX_IN) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_PO14C_FLUX_IN, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2486,7 +3591,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_PO14C_PROD) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_PO14C_PROD, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2497,7 +3608,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_PO14C_REMIN) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_PO14C_REMIN, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2508,7 +3625,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_DO14C_prod) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_DO14C_prod, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2519,7 +3642,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_DO14C_remin) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_DO14C_remin, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2530,7 +3659,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_Ca14CO3_FLUX_IN) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_Ca14CO3_FLUX_IN, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2541,7 +3676,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_Ca14CO3_PROD) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_Ca14CO3_PROD, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2552,7 +3693,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_Ca14CO3_REMIN) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_Ca14CO3_REMIN, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2563,7 +3710,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_photo14C_TOT) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_photo14C_TOT, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2574,7 +3727,13 @@ subroutine marbl_diagnostics_init( & units = 'permil' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_DIC_d14C) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_DIC_d14C, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2585,7 +3744,13 @@ subroutine marbl_diagnostics_init( & units = 'permil' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_DOC_d14C) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_DOC_d14C, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2596,7 +3761,13 @@ subroutine marbl_diagnostics_init( & units = 'permil' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_zooC_d14C) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_zooC_d14C, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if ! Nonstandard 2D fields @@ -2609,7 +3780,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_photo13C_TOT_zint) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_photo13C_TOT_zint, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2620,7 +3797,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_photo14C_TOT_zint) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_photo14C_TOT_zint, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2631,7 +3814,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_Jint_13Ctot) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_Jint_13Ctot, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2642,7 +3831,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_Jint_14Ctot) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_Jint_14Ctot, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2653,7 +3848,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_Jint_100m_13Ctot) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_Jint_100m_13Ctot, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2664,7 +3865,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_Jint_100m_14Ctot) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_Jint_100m_14Ctot, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if ! Nonstandard autotroph 2D and 3D fields for each autotroph @@ -2680,7 +3887,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_Ca13CO3_form(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_Ca13CO3_form(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2691,7 +3904,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_Ca13CO3_form_zint(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_Ca13CO3_form_zint(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2702,7 +3921,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_Ca14CO3_form(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_Ca14CO3_form(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2713,7 +3938,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_Ca14CO3_form_zint(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_Ca14CO3_form_zint(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2724,7 +3955,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_autotrophCaCO3_d13C(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_autotrophCaCO3_d13C(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2735,7 +3972,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_autotrophCaCO3_d14C(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_autotrophCaCO3_d14C(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2746,7 +3989,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_photo13C(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_photo13C(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2757,7 +4006,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3/s' vgrid = 'layer_avg' truncate = .true. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_photo14C(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_photo14C(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2768,7 +4023,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_photo13C_zint(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_photo13C_zint(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2779,7 +4040,13 @@ subroutine marbl_diagnostics_init( & units = 'mmol/m^3 cm/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_photo14C_zint(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_photo14C_zint(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2790,7 +4057,13 @@ subroutine marbl_diagnostics_init( & units = 'permil' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_eps_autotroph(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_eps_autotroph(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2801,7 +4074,13 @@ subroutine marbl_diagnostics_init( & units = 'permil' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_d13C(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_d13C(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2812,7 +4091,13 @@ subroutine marbl_diagnostics_init( & units = 'permil' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_d14C(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_d14C(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2823,7 +4108,13 @@ subroutine marbl_diagnostics_init( & units = 'm^3/mmol C/s' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_mui_to_co2star(n)) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_mui_to_co2star(n), marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if end do @@ -2838,7 +4129,13 @@ subroutine marbl_diagnostics_init( & units = 'permil' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_eps_aq_g) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_eps_aq_g, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2849,7 +4146,13 @@ subroutine marbl_diagnostics_init( & units = 'permil' vgrid = 'layer_avg' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%CISO_eps_dic_g) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%CISO_eps_dic_g, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if ! Vars to sum up burial in sediments (2D) @@ -2862,7 +4165,13 @@ subroutine marbl_diagnostics_init( & units = 'nmolC/cm^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%calcToSed_13C) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%calcToSed_13C, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2873,7 +4182,13 @@ subroutine marbl_diagnostics_init( & units = 'nmolC/cm^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%pocToSed_13C) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%pocToSed_13C, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2884,7 +4199,13 @@ subroutine marbl_diagnostics_init( & units = 'nmolC/cm^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%calcToSed_14C) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%calcToSed_14C, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if if (count_only) then @@ -2895,7 +4216,13 @@ subroutine marbl_diagnostics_init( & units = 'nmolC/cm^2/s' vgrid = 'none' truncate = .false. - call diags%add_diagnostic(lname, sname, units, vgrid, truncate, ind%pocToSed_14C) + call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & + ind%pocToSed_14C, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if end if ! end of if ciso_on @@ -2920,7 +4247,13 @@ subroutine marbl_diagnostics_init( & sname = trim(marbl_tracer_metadata(n)%short_name) // "_RESTORE" units = 'mmol/m^3' vgrid = 'layer_avg' - call diags%add_diagnostic(lname, sname, units, vgrid, .false., tmp_id) + call diags%add_diagnostic(lname, sname, units, vgrid, .false., & + tmp_id, marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(sname), " to diags%add_diagnostic" + return + end if end if end do diff --git a/src/marbl_interface.F90 b/src/marbl_interface.F90 index 111bbd09..4570b736 100644 --- a/src/marbl_interface.F90 +++ b/src/marbl_interface.F90 @@ -287,18 +287,29 @@ subroutine init(this, & domain = this%domain, & tracer_metadata = this%tracer_metadata(ecosys_ind_beg:ecosys_ind_end), & status_log = this%statusLog) + if (this%statusLog%labort_marbl) then + call this%statusLog%log_error("error code returned from this%restoring%init", & + "marbl_interface::marbl_init()") + return + end if !-------------------------------------------------------------------- ! Initialize marbl diagnostics !-------------------------------------------------------------------- - call marbl_diagnostics_init( & - ciso_on = this%ciso_on, & - marbl_domain = this%domain, & + call marbl_diagnostics_init( & + ciso_on = this%ciso_on, & + marbl_domain = this%domain, & marbl_tracer_metadata = this%tracer_metadata(ecosys_ind_beg:ecosys_ind_end), & - marbl_interior_forcing_diags = this%interior_forcing_diags, & - marbl_interior_restore_diags = this%interior_restore_diags, & - marbl_surface_forcing_diags = this%surface_forcing_diags) + marbl_interior_forcing_diags = this%interior_forcing_diags, & + marbl_interior_restore_diags = this%interior_restore_diags, & + marbl_surface_forcing_diags = this%surface_forcing_diags, & + marbl_status_log = this%StatusLog) + if (this%statusLog%labort_marbl) then + call this%statusLog%log_error("error code returned from marbl_diagnostics_init", & + "marbl_interface::marbl_init()") + return + end if end associate diff --git a/src/marbl_interface_types.F90 b/src/marbl_interface_types.F90 index 02dd6f5b..013948c3 100644 --- a/src/marbl_interface_types.F90 +++ b/src/marbl_interface_types.F90 @@ -4,6 +4,7 @@ module marbl_interface_types use marbl_kinds_mod , only : r8, log_kind, int_kind, char_len use marbl_constants_mod , only : c0, c1 use marbl_interface_constants , only : marbl_str_length + use marbl_logging , only : marbl_log_type, error_msg implicit none @@ -312,13 +313,16 @@ end subroutine marbl_interior_forcing_input_constructor !***************************************************************************** subroutine marbl_single_diag_init(this, lname, sname, units, vgrid, & - truncate, num_elements, num_levels) + truncate, num_elements, num_levels, marbl_status_log) class(marbl_single_diagnostic_type) , intent(inout) :: this character(len=char_len) , intent(in) :: lname, sname, units, vgrid logical , intent(in) :: truncate integer , intent(in) :: num_elements integer , intent(in) :: num_levels + type(marbl_log_type) , intent(inout) :: marbl_status_log + + character(*), parameter :: subname = 'marbl_interface_types:marbl_single_diag_init' ! Allocate column memory for 3D vars or num_elements memory for 2D vars select case (trim(vgrid)) @@ -329,8 +333,10 @@ subroutine marbl_single_diag_init(this, lname, sname, units, vgrid, & case ('none') allocate(this%field_2d(num_elements)) case DEFAULT - ! FIXME #23: use marbl_log_type to trap this error and then return! - print*, "ERROR: ", trim(vgrid), " is not a valid vertical grid for MARBL" + write(error_msg,"(3A)") "ERROR: ", trim(vgrid), & + " is not a valid vertical grid for MARBL" + call marbl_status_log%log_error(error_msg, subname) + return end select this%compute_now = .true. @@ -396,21 +402,30 @@ end subroutine marbl_diagnostics_set_to_zero !***************************************************************************** subroutine marbl_diagnostics_add(this, lname, sname, units, vgrid, & - truncate, id) + truncate, id, marbl_status_log) class(marbl_diagnostics_type) , intent(inout) :: this character(len=char_len) , intent(in) :: lname, sname, units, vgrid logical (int_kind) , intent(in) :: truncate integer (int_kind) , intent(out) :: id + type(marbl_log_type) , intent(inout) :: marbl_status_log + + character(*), parameter :: subname = 'marbl_interface_types:marbl_diagnostics_add' this%diag_cnt = this%diag_cnt + 1 id = this%diag_cnt if (id.gt.size(this%diags)) then - ! FIXME #23: use marbl_log_type to trap this error and then return! - print*, "ERROR: increase max number of diagnostics!" + error_msg = "ERROR: increase max number of diagnostics!" + call marbl_status_log%log_error(error_msg, subname) + return end if call this%diags(id)%initialize(lname, sname, units, vgrid, truncate, & - this%num_elements, this%num_levels) + this%num_elements, this%num_levels, marbl_status_log) + if (marbl_status_log%labort_marbl) then + error_msg = "error code returned from this%diags%initialize" + call marbl_status_log%log_error(error_msg, subname) + return + end if end subroutine marbl_diagnostics_add From c3cdc1274a4887aefcd1646fce35d582a2f65a45 Mon Sep 17 00:00:00 2001 From: Michael Levy Date: Tue, 22 Mar 2016 12:02:11 -0600 Subject: [PATCH 02/11] Add status log to forcing field calls When adding forcing fields, errors are logged properly rather than printed to stdout. Also cleaned up some of the diagnostic logging from the prior commit. This should let us close issue #23 --- src/marbl_diagnostics_mod.F90 | 255 +++++++++++++++++++++- src/marbl_interface.F90 | 8 +- src/marbl_interface_types.F90 | 93 +++++--- src/marbl_mod.F90 | 389 ++++++++++++++++++++++++++++------ 4 files changed, 637 insertions(+), 108 deletions(-) diff --git a/src/marbl_diagnostics_mod.F90 b/src/marbl_diagnostics_mod.F90 index c10fdbd5..3d407bc1 100644 --- a/src/marbl_diagnostics_mod.F90 +++ b/src/marbl_diagnostics_mod.F90 @@ -424,6 +424,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -441,6 +442,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -458,6 +460,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -475,6 +478,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -492,6 +496,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -509,6 +514,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -526,6 +532,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -543,6 +550,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -560,6 +568,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -577,6 +586,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -594,6 +604,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -611,6 +622,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -628,6 +640,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -645,6 +658,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -662,6 +676,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -679,6 +694,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -696,6 +712,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -713,6 +730,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -730,6 +748,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -747,6 +766,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -764,6 +784,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -781,6 +802,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -798,6 +820,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -815,6 +838,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -832,6 +856,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -849,6 +874,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -866,6 +892,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -883,6 +910,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -900,6 +928,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -917,6 +946,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -934,6 +964,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -951,6 +982,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -968,6 +1000,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -985,6 +1018,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1002,6 +1036,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1019,6 +1054,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1036,6 +1072,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1053,6 +1090,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1070,6 +1108,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1093,6 +1132,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1110,6 +1150,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1127,6 +1168,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1144,6 +1186,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1161,6 +1204,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1178,6 +1222,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1195,6 +1240,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1212,6 +1258,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1229,6 +1276,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1246,6 +1294,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1263,6 +1312,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1280,6 +1330,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1297,6 +1348,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1314,6 +1366,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1331,6 +1384,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1348,6 +1402,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1365,6 +1420,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1382,6 +1438,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1399,6 +1456,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1416,6 +1474,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1433,6 +1492,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1463,6 +1523,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1480,6 +1541,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1497,6 +1559,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1514,6 +1577,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1531,6 +1595,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1548,6 +1613,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1565,6 +1631,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1582,6 +1649,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1599,6 +1667,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1616,6 +1685,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1633,6 +1703,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1650,6 +1721,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1667,6 +1739,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1684,6 +1757,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1701,6 +1775,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1718,6 +1793,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1736,6 +1812,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1753,6 +1830,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1770,6 +1848,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1787,6 +1866,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1804,6 +1884,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1821,6 +1902,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1838,6 +1920,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1855,6 +1938,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1872,6 +1956,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1891,6 +1976,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1908,6 +1994,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1926,6 +2013,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if else @@ -1947,6 +2035,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1965,6 +2054,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1982,6 +2072,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -1999,6 +2090,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2016,6 +2108,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2033,6 +2126,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2050,6 +2144,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2067,6 +2162,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2084,6 +2180,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2101,6 +2198,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2118,6 +2216,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2135,6 +2234,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2152,6 +2252,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2169,6 +2270,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2186,6 +2288,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2203,6 +2306,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2220,6 +2324,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2237,6 +2342,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2254,6 +2360,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2271,6 +2378,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2288,6 +2396,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2305,6 +2414,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2322,6 +2432,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2339,6 +2450,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2356,6 +2468,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2373,6 +2486,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2390,6 +2504,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2407,6 +2522,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2424,6 +2540,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2441,6 +2558,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2458,6 +2576,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2476,6 +2595,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2493,6 +2613,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2510,6 +2631,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2527,6 +2649,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2544,6 +2667,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2561,6 +2685,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2578,6 +2703,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2595,6 +2721,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2612,6 +2739,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2629,6 +2757,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2646,6 +2775,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2663,6 +2793,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2680,6 +2811,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2697,6 +2829,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2714,6 +2847,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2731,6 +2865,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2748,6 +2883,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2768,6 +2904,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2785,6 +2922,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2802,6 +2940,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2820,6 +2959,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if else @@ -2840,6 +2980,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2857,6 +2998,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2874,6 +3016,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2891,6 +3034,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2908,6 +3052,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2925,6 +3070,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2942,6 +3088,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2959,6 +3106,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2976,6 +3124,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -2993,6 +3142,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3010,6 +3160,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3027,6 +3178,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3044,6 +3196,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3061,6 +3214,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3078,6 +3232,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3095,6 +3250,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3115,6 +3271,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if else @@ -3136,6 +3293,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if else @@ -3157,6 +3315,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if else @@ -3179,6 +3338,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3196,6 +3356,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3213,6 +3374,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3233,6 +3395,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3250,6 +3413,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3267,6 +3431,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3284,6 +3449,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3301,6 +3467,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3318,6 +3485,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3335,6 +3503,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3352,6 +3521,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3375,6 +3545,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3392,6 +3563,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3409,6 +3581,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3426,6 +3599,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3443,6 +3617,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3460,6 +3635,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3477,6 +3653,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3494,6 +3671,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3511,6 +3689,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3528,6 +3707,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3545,6 +3725,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3562,6 +3743,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3579,6 +3761,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3596,6 +3779,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3613,6 +3797,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3630,6 +3815,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3647,6 +3833,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3664,6 +3851,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3681,6 +3869,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3698,6 +3887,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3715,6 +3905,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3732,6 +3923,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3749,6 +3941,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3766,6 +3959,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3785,6 +3979,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3802,6 +3997,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3819,6 +4015,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3836,6 +4033,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3853,6 +4051,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3870,6 +4069,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3892,6 +4092,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3909,6 +4110,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3926,6 +4128,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3943,6 +4146,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3960,6 +4164,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3977,6 +4182,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -3994,6 +4200,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -4011,6 +4218,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -4028,6 +4236,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -4045,6 +4254,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -4062,6 +4272,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -4079,6 +4290,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -4096,6 +4308,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -4113,6 +4326,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -4134,6 +4348,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -4151,6 +4366,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -4170,6 +4386,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -4187,6 +4404,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -4204,6 +4422,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -4221,6 +4440,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -4252,6 +4472,7 @@ subroutine marbl_diagnostics_init( & if (marbl_status_log%labort_marbl) then write(error_msg,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" + call marbl_status_log%log_error(error_msg, subname) return end if end if @@ -4265,9 +4486,24 @@ subroutine marbl_diagnostics_init( & ! Initialize all diagnostics to zero !----------------------------------------------------------------- - call marbl_interior_forcing_diags%set_to_zero() - call marbl_interior_restore_diags%set_to_zero() - call marbl_surface_forcing_diags%set_to_zero() + call marbl_interior_forcing_diags%set_to_zero(marbl_status_log) + if (marbl_status_log%labort_marbl) then + error_msg = "error code returned marbl_interior_forcing_diags%set_to_zero" + call marbl_status_log%log_error(error_msg, subname) + return + end if + call marbl_interior_restore_diags%set_to_zero(marbl_status_log) + if (marbl_status_log%labort_marbl) then + error_msg = "error code returned marbl_interior_forcing_diags%set_to_zero" + call marbl_status_log%log_error(error_msg, subname) + return + end if + call marbl_surface_forcing_diags%set_to_zero(marbl_status_log) + if (marbl_status_log%labort_marbl) then + error_msg = "error code returned marbl_interior_forcing_diags%set_to_zero" + call marbl_status_log%log_error(error_msg, subname) + return + end if end subroutine marbl_diagnostics_init @@ -4288,7 +4524,8 @@ subroutine marbl_diagnostics_set_interior_forcing ( & sed_denitrif, other_remin, nitrif, denitrif, & column_o2, o2_production, o2_consumption, & fe_scavenge, fe_scavenge_rate, & - marbl_interior_forcing_diags) + marbl_interior_forcing_diags, & + marbl_status_log) implicit none @@ -4315,6 +4552,9 @@ subroutine marbl_diagnostics_set_interior_forcing ( & real (r8) , intent(in) :: fe_scavenge_rate(domain%km) ! annual scavenging rate of iron as % of ambient real (r8) , intent(in) :: fe_scavenge(domain%km) ! loss of dissolved iron, scavenging (mmol Fe/m^3/sec) type (marbl_diagnostics_type) , intent(inout) :: marbl_interior_forcing_diags + type (marbl_log_type) , intent(inout) :: marbl_status_log + + character(*), parameter :: subname = "marbl_diagnostics_mod:set_interior" !----------------------------------------------------------------- @@ -4327,7 +4567,12 @@ subroutine marbl_diagnostics_set_interior_forcing ( & PAR => marbl_PAR & ) - call marbl_interior_forcing_diags%set_to_zero() + call marbl_interior_forcing_diags%set_to_zero(marbl_status_log) + if (marbl_status_log%labort_marbl) then + error_msg = "error code returned marbl_interior_forcing_diags%set_to_zero" + call marbl_status_log%log_error(error_msg, subname) + return + end if call store_diagnostics_carbonate(domain, & carbonate, marbl_interior_forcing_diags) diff --git a/src/marbl_interface.F90 b/src/marbl_interface.F90 index 4570b736..13d083ed 100644 --- a/src/marbl_interface.F90 +++ b/src/marbl_interface.F90 @@ -274,7 +274,13 @@ subroutine init(this, & num_elements = num_surface_elements, & num_surface_forcing_fields = num_surface_forcing_fields, & surface_forcing_indices = this%surface_forcing_ind, & - surface_forcing_fields = this%surface_forcing_fields) + surface_forcing_fields = this%surface_forcing_fields, & + marbl_status_log = this%StatusLog) + if (this%statusLog%labort_marbl) then + error_msg = "error code returned from marbl_init_surface_forcing_fields" + call this%statusLog%log_error(error_msg, "marbl_interface::marbl_init()") + return + end if allocate(this%surface_input_forcings(num_surface_elements, num_surface_forcing_fields)) diff --git a/src/marbl_interface_types.F90 b/src/marbl_interface_types.F90 index 013948c3..e34e5f64 100644 --- a/src/marbl_interface_types.F90 +++ b/src/marbl_interface_types.F90 @@ -4,7 +4,7 @@ module marbl_interface_types use marbl_kinds_mod , only : r8, log_kind, int_kind, char_len use marbl_constants_mod , only : c0, c1 use marbl_interface_constants , only : marbl_str_length - use marbl_logging , only : marbl_log_type, error_msg + use marbl_logging , only : marbl_log_type, error_msg, status_msg implicit none @@ -333,7 +333,7 @@ subroutine marbl_single_diag_init(this, lname, sname, units, vgrid, & case ('none') allocate(this%field_2d(num_elements)) case DEFAULT - write(error_msg,"(3A)") "ERROR: ", trim(vgrid), & + write(error_msg,"(2A)") trim(vgrid), & " is not a valid vertical grid for MARBL" call marbl_status_log%log_error(error_msg, subname) return @@ -378,11 +378,13 @@ end subroutine marbl_diagnostics_constructor !***************************************************************************** - subroutine marbl_diagnostics_set_to_zero(this) + subroutine marbl_diagnostics_set_to_zero(this, marbl_status_log) class(marbl_diagnostics_type), intent(inout) :: this + type(marbl_log_type), intent(inout) :: marbl_status_log integer (int_kind) :: n + character(*), parameter :: subname="marbl_interface_types:diagnostics_set_to_zero" do n=1,this%diag_cnt if (allocated(this%diags(n)%field_2d)) then @@ -391,9 +393,13 @@ subroutine marbl_diagnostics_set_to_zero(this) this%diags(n)%field_3d(:, :) = c0 else ! TODO abort abort abort - write(*,*) "ERROR: neither field_2d nor field_3d are allocated" - write(*,*) "Diag short name = ", trim(this%diags(n)%short_name) - write(*,*) "Diag long name = ", trim(this%diags(n)%long_name) + error_msg = "neither field_2d nor field_3d are allocated" + call marbl_status_log%log_error(error_msg, subname) + write(error_msg,"(2A)") "Diag short name = ", trim(this%diags(n)%short_name) + call marbl_status_log%log_error(error_msg, subname) + write(error_msg,"(2A)") "Diag long name = ", trim(this%diags(n)%long_name) + call marbl_status_log%log_error(error_msg, subname) + return end if end do @@ -415,7 +421,7 @@ subroutine marbl_diagnostics_add(this, lname, sname, units, vgrid, & this%diag_cnt = this%diag_cnt + 1 id = this%diag_cnt if (id.gt.size(this%diags)) then - error_msg = "ERROR: increase max number of diagnostics!" + error_msg = "not enough memory allocated for this number of diagnostics!" call marbl_status_log%log_error(error_msg, subname) return end if @@ -525,7 +531,8 @@ subroutine marbl_single_forcing_field_init(this, & year_first, year_last, year_align, & date, & time, & - marbl_forcing_calendar_name) + marbl_forcing_calendar_name, & + marbl_status_log) class(marbl_single_forcing_field_type), intent(inout) :: this integer (kind=int_kind), intent(in) :: num_elements @@ -544,15 +551,17 @@ subroutine marbl_single_forcing_field_init(this, & integer (kind=int_kind), optional, intent(in) :: year_align integer (kind=int_kind), optional, intent(in) :: date integer (kind=int_kind), optional, intent(in) :: time - type (marbl_forcing_monthly_every_ts_type), optional, target, intent(in) :: marbl_forcing_calendar_name + type(marbl_forcing_monthly_every_ts_type), optional, target, intent(in) :: marbl_forcing_calendar_name + type(marbl_log_type), intent(inout) :: marbl_status_log !----------------------------------------------------------------------- ! local variables !----------------------------------------------------------------------- character(len=char_len), dimension(6) :: valid_field_sources - integer (kind=int_kind) :: n - logical (log_kind) :: has_valid_source - logical (log_kind) :: has_valid_inputs + integer(kind=int_kind) :: n + logical(log_kind) :: has_valid_source + logical(log_kind) :: has_valid_inputs + character(*), parameter :: subname = "marbl_interface_types:single_forcing_field_init" !----------------------------------------------------------------------- valid_field_sources(1) = "constant" @@ -568,8 +577,10 @@ subroutine marbl_single_forcing_field_init(this, & if (trim(field_source) .eq. trim(valid_field_sources(n))) has_valid_source = .true. enddo if (.not. has_valid_source) then - ! FIXME #23: use marbl_log_type to trap this error and then return! - write(*,*) "ERROR: ", trim(field_source), "is not a valid field source for MARBL" + write(error_msg,"(2A)") trim(field_source), & + "is not a valid field source for MARBL" + call marbl_status_log%log_error(error_msg, subname) + return endif ! required variables for all forcing field sources @@ -597,50 +608,53 @@ subroutine marbl_single_forcing_field_init(this, & case('constant') if (.not.present(field_constant)) has_valid_inputs = .false. if (has_valid_inputs) then - write(*,*) "Adding constant forcing_field_type for ", this%marbl_varname + write(status_msg,"(2A)") "Adding constant forcing_field_type for ", & + trim(this%marbl_varname) + call marbl_status_log%log_noerror(status_msg, subname) call marbl_forcing_constant_init(this%field_constant_info, field_constant) - else - ! FIXME #23: use marbl_log_type to trap this error and then return! - write(*,*) "ERROR: Call to MARBL does not have the correct optional arguments for ", trim(field_source) endif case('driver') if (.not.present(marbl_driver_varname)) has_valid_inputs = .false. if (has_valid_inputs) then - write(*,*) "Adding driver forcing_field_type for ", this%marbl_varname + write(status_msg, "(2A)") "Adding driver forcing_field_type for ", & + trim(this%marbl_varname) + call marbl_status_log%log_noerror(status_msg, subname) call this%field_driver_info%initialize(marbl_driver_varname) - else - ! FIXME #23: use marbl_log_type to trap this error and then return! - write(*,*) "ERROR: Call to MARBL does not have the correct optional arguments for ", trim(field_source) endif case('file') if (.not.present(filename)) has_valid_inputs = .false. if (.not.present(file_varname)) has_valid_inputs = .false. if (has_valid_inputs) then - write(*,*) "Adding file forcing_field_type for ", this%marbl_varname + write(status_msg,"(2A)") "Adding file forcing_field_type for ", & + trim(this%marbl_varname) + call marbl_status_log%log_noerror(status_msg, subname) call this%field_file_info%initialize(& filename, file_varname, & temporal=temporal, year_first=year_first, & year_last=year_last, year_align=year_align, & date=date, time=time) - else - ! FIXME #23: use marbl_log_type to trap this error and then return! - write(*,*) "ERROR: Call to MARBL does not have the correct optional arguments for ", trim(field_source) endif case('POP monthly calendar') if (.not.present(marbl_forcing_calendar_name)) has_valid_inputs = .false. if (has_valid_inputs) then - write(*,*) "Adding calendar forcing_field_type for ", this%marbl_varname + write(status_msg,"(2A)") "Adding calendar forcing_field_type for ", & + trim(this%marbl_varname) + call marbl_status_log%log_noerror(status_msg, subname) call this%field_monthly_calendar_info%initialize(marbl_forcing_calendar_name) - else - ! FIXME #23: use marbl_log_type to trap this error and then return! - write(*,*) "ERROR: Call to MARBL does not have the correct optional arguments for ", trim(field_source) endif end select + if (.not.has_valid_inputs) then + write(error_msg,"(3A)") "Call to MARBL does not have the correct ", & + "optional arguments for ", trim(field_source) + call marbl_status_log%log_error(error_msg, subname) + return + end if + end subroutine marbl_single_forcing_field_init !***************************************************************************** @@ -673,7 +687,7 @@ subroutine marbl_forcing_fields_add(this, & year_first, year_last, year_align, & date, time, & marbl_forcing_calendar_name, & - id) + id, marbl_status_log) class(marbl_forcing_fields_type) , intent(inout) :: this character (char_len) , intent(in) :: field_source @@ -692,17 +706,20 @@ subroutine marbl_forcing_fields_add(this, & integer (kind=int_kind), optional, intent(in) :: date integer (kind=int_kind), optional, intent(in) :: time integer (kind=int_kind) , intent(out) :: id - type (marbl_forcing_monthly_every_ts_type), optional, target, intent(in) :: marbl_forcing_calendar_name + type(marbl_forcing_monthly_every_ts_type), optional, target, intent(in) :: marbl_forcing_calendar_name + type(marbl_log_type), intent(inout) :: marbl_status_log integer (kind=int_kind) :: num_elem + character(*), parameter :: subname = "marbl_interface_types:marbl_forcing_fields_add" ! Note - the following sets the indices into the marble interface type surface_input_forcings(:,indices) this%forcing_field_cnt = this%forcing_field_cnt + 1 id = this%forcing_field_cnt if (id .gt. size(this%forcing_fields)) then - ! FIXME #23: use marbl_log_type to trap this error and then return! - print*, "ERROR: increase max number of forcing fields!" + error_msg = "not enough memory allocated for number of forcing fields!" + call marbl_status_log%log_error(error_msg, subname) + return end if num_elem = this%num_elements @@ -716,7 +733,13 @@ subroutine marbl_forcing_fields_add(this, & temporal=temporal, year_first=year_first, & year_last=year_last, year_align=year_align, & date=date, time=time, & - marbl_forcing_calendar_name=marbl_forcing_calendar_name) + marbl_forcing_calendar_name=marbl_forcing_calendar_name, & + marbl_status_log = marbl_status_log) + if (marbl_status_log%labort_MARBL) then + error_msg = "error code returned from this%forcing_fields%initialize" + call marbl_status_log%log_error(error_msg, subname) + return + end if end subroutine marbl_forcing_fields_add diff --git a/src/marbl_mod.F90 b/src/marbl_mod.F90 index 31047f97..7fbf1760 100644 --- a/src/marbl_mod.F90 +++ b/src/marbl_mod.F90 @@ -769,7 +769,8 @@ end subroutine marbl_init_nml subroutine marbl_init_surface_forcing_fields(& ciso_on, num_elements, num_surface_forcing_fields, & - surface_forcing_indices, surface_forcing_fields) + surface_forcing_indices, surface_forcing_fields, & + marbl_status_log) ! Initialize the surface forcing_fields datatype with information from the ! namelist read @@ -812,11 +813,12 @@ subroutine marbl_init_surface_forcing_fields(& implicit none - logical (kind=log_kind) , intent(in) :: ciso_on - integer (KIND=int_kind) , intent(in) :: num_elements - integer (kind=int_kind) , intent(out) :: num_surface_forcing_fields - type(marbl_surface_forcing_indexing_type) , intent(out) :: surface_forcing_indices - type(marbl_forcing_fields_type) , intent(out) :: surface_forcing_fields + logical (kind=log_kind) , intent(in) :: ciso_on + integer (KIND=int_kind) , intent(in) :: num_elements + integer (kind=int_kind) , intent(out) :: num_surface_forcing_fields + type(marbl_surface_forcing_indexing_type) , intent(out) :: surface_forcing_indices + type(marbl_forcing_fields_type) , intent(out) :: surface_forcing_fields + type(marbl_log_type) , intent(inout) :: marbl_status_log !----------------------------------------------------------------------- ! local variables @@ -838,7 +840,7 @@ subroutine marbl_init_surface_forcing_fields(& forcing_fields => surface_forcing_fields & ) - ! First cound then allocate memory for surface forcing fields + ! First count then allocate memory for surface forcing fields num_surface_forcing_fields = 0 do imode = 1,2 @@ -859,7 +861,14 @@ subroutine marbl_init_surface_forcing_fields(& units = 'unknown' call forcing_fields%add_forcing_field(& field_source=fsource, marbl_varname=varname, field_units=units, & - marbl_driver_varname=varname, id=ind%surface_mask_id) + marbl_driver_varname=varname, id=ind%surface_mask_id, & + marbl_status_log = marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(varname), " to forcing_fields%add" + call marbl_status_log%log_error(error_msg, subname) + return + end if end if if (ciso_on) then @@ -872,11 +881,16 @@ subroutine marbl_init_surface_forcing_fields(& units = 'unknown' call forcing_fields%add_forcing_field(& field_source=fsource, marbl_varname=varname, field_units=units, & - marbl_driver_varname=varname, id=ind%d13c_id) + marbl_driver_varname=varname, id=ind%d13c_id, & + marbl_status_log = marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(varname), " to forcing_fields%add" + call marbl_status_log%log_error(error_msg, subname) + return + end if end if - end if - if (ciso_on) then if (count_only) then num_surface_forcing_fields = num_surface_forcing_fields + 1 else @@ -886,11 +900,16 @@ subroutine marbl_init_surface_forcing_fields(& units = 'unknown' call forcing_fields%add_forcing_field(& field_source=fsource, marbl_varname=varname, field_units=units, & - marbl_driver_varname=varname, id=ind%d14c_id) + marbl_driver_varname=varname, id=ind%d14c_id, & + marbl_status_log = marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(varname), " to forcing_fields%add" + call marbl_status_log%log_error(error_msg, subname) + return + end if end if - end if - if (ciso_on) then if (count_only) then num_surface_forcing_fields = num_surface_forcing_fields + 1 else @@ -900,7 +919,14 @@ subroutine marbl_init_surface_forcing_fields(& units = 'unknown' call forcing_fields%add_forcing_field(& field_source=fsource, marbl_varname=varname, field_units=units, & - marbl_driver_varname=varname, id=ind%d14c_glo_avg_id) + marbl_driver_varname=varname, id=ind%d14c_glo_avg_id, & + marbl_status_log = marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(varname), " to forcing_fields%add" + call marbl_status_log%log_error(error_msg, subname) + return + end if end if end if @@ -913,7 +939,14 @@ subroutine marbl_init_surface_forcing_fields(& units = 'unknown' call forcing_fields%add_forcing_field(& field_source=fsource, marbl_varname=varname, field_units=units, & - marbl_driver_varname=driver_varname, id=ind%u10_sqr_id) + marbl_driver_varname=driver_varname, id=ind%u10_sqr_id, & + marbl_status_log = marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(varname), " to forcing_fields%add" + call marbl_status_log%log_error(error_msg, subname) + return + end if end if if (count_only) then @@ -925,7 +958,14 @@ subroutine marbl_init_surface_forcing_fields(& units = 'Temperature (C)' call forcing_fields%add_forcing_field(& field_source=fsource, marbl_varname=varname, field_units=units, & - marbl_driver_varname=driver_varname, id=ind%sst_id) + marbl_driver_varname=driver_varname, id=ind%sst_id, & + marbl_status_log = marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(varname), " to forcing_fields%add" + call marbl_status_log%log_error(error_msg, subname) + return + end if end if if (count_only) then @@ -937,7 +977,14 @@ subroutine marbl_init_surface_forcing_fields(& units = 'unknown' call forcing_fields%add_forcing_field(& field_source=fsource, marbl_varname=varname, field_units=units, & - marbl_driver_varname=driver_varname, id=ind%sss_id) + marbl_driver_varname=driver_varname, id=ind%sss_id, & + marbl_status_log = marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(varname), " to forcing_fields%add" + call marbl_status_log%log_error(error_msg, subname) + return + end if end if if (lflux_gas_co2) then @@ -950,7 +997,14 @@ subroutine marbl_init_surface_forcing_fields(& units = 'unknown' call forcing_fields%add_forcing_field(& field_source=fsource, marbl_varname=varname, field_units=units, & - field_constant = atm_co2_const, id=ind%xco2_id) + field_constant = atm_co2_const, id=ind%xco2_id, & + marbl_status_log = marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(varname), " to forcing_fields%add" + call marbl_status_log%log_error(error_msg, subname) + return + end if end if else if (atm_co2_iopt == atm_co2_iopt_drv_prog .or. atm_co2_iopt == atm_co2_iopt_drv_diag) then if (count_only) then @@ -966,7 +1020,14 @@ subroutine marbl_init_surface_forcing_fields(& units = 'unknown' call forcing_fields%add_forcing_field(& field_source=fsource, marbl_varname=varname, field_units=units, & - marbl_driver_varname=driver_varname, id=ind%xco2_id) + marbl_driver_varname=driver_varname, id=ind%xco2_id, & + marbl_status_log = marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(varname), " to forcing_fields%add" + call marbl_status_log%log_error(error_msg, subname) + return + end if end if end if end if @@ -981,7 +1042,14 @@ subroutine marbl_init_surface_forcing_fields(& units = 'unknown' call forcing_fields%add_forcing_field(& field_source=fsource, marbl_varname=varname, field_units=units, & - field_constant=atm_alt_co2_const, id=ind%xco2_alt_co2_id) + field_constant=atm_alt_co2_const, id=ind%xco2_alt_co2_id, & + marbl_status_log = marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(varname), " to forcing_fields%add" + call marbl_status_log%log_error(error_msg, subname) + return + end if end if end if @@ -995,7 +1063,14 @@ subroutine marbl_init_surface_forcing_fields(& units = 'unknown' call forcing_fields%add_forcing_field(& field_source=fsource, marbl_varname=varname, field_units=units, & - marbl_driver_varname=driver_varname, id=ind%ifrac_id) + marbl_driver_varname=driver_varname, id=ind%ifrac_id, & + marbl_status_log = marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(varname), " to forcing_fields%add" + call marbl_status_log%log_error(error_msg, subname) + return + end if end if elseif (gas_flux_forcing_iopt == gas_flux_forcing_iopt_file) then if (count_only) then @@ -1006,7 +1081,14 @@ subroutine marbl_init_surface_forcing_fields(& units = 'unknown' call forcing_fields%add_forcing_field(& field_source=fsource, marbl_varname=varname, field_units=units, & - marbl_forcing_calendar_name=fice_file, id=ind%ifrac_id) + marbl_forcing_calendar_name=fice_file, id=ind%ifrac_id, & + marbl_status_log = marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(varname), " to forcing_fields%add" + call marbl_status_log%log_error(error_msg, subname) + return + end if end if end if @@ -1020,7 +1102,14 @@ subroutine marbl_init_surface_forcing_fields(& units = 'unknown' call forcing_fields%add_forcing_field(& field_source=fsource, marbl_varname=varname, field_units=units, & - marbl_driver_varname=driver_varname, id=ind%xkw_id) + marbl_driver_varname=driver_varname, id=ind%xkw_id, & + marbl_status_log = marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(varname), " to forcing_fields%add" + call marbl_status_log%log_error(error_msg, subname) + return + end if end if elseif (gas_flux_forcing_iopt == gas_flux_forcing_iopt_file) then if (count_only) then @@ -1031,7 +1120,14 @@ subroutine marbl_init_surface_forcing_fields(& units = 'unknown' call forcing_fields%add_forcing_field(& field_source=fsource, marbl_varname=varname, field_units=units, & - marbl_forcing_calendar_name=xkw_file, id=ind%xkw_id) + marbl_forcing_calendar_name=xkw_file, id=ind%xkw_id, & + marbl_status_log = marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(varname), " to forcing_fields%add" + call marbl_status_log%log_error(error_msg, subname) + return + end if end if end if @@ -1046,7 +1142,14 @@ subroutine marbl_init_surface_forcing_fields(& units = 'unknown' call forcing_fields%add_forcing_field(& field_source=fsource, marbl_varname=varname, field_units=units, & - marbl_driver_varname=driver_varname, id=ind%atm_pressure_id) + marbl_driver_varname=driver_varname, id=ind%atm_pressure_id, & + marbl_status_log = marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(varname), " to forcing_fields%add" + call marbl_status_log%log_error(error_msg, subname) + return + end if end if end if elseif (gas_flux_forcing_iopt == gas_flux_forcing_iopt_file) then @@ -1058,7 +1161,14 @@ subroutine marbl_init_surface_forcing_fields(& units = 'unknown' call forcing_fields%add_forcing_field(& field_source=fsource, marbl_varname=varname, field_units=units, & - marbl_forcing_calendar_name=ap_file, id=ind%atm_pressure_id) + marbl_forcing_calendar_name=ap_file, id=ind%atm_pressure_id,& + marbl_status_log = marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(varname), " to forcing_fields%add" + call marbl_status_log%log_error(error_msg, subname) + return + end if end if end if @@ -1070,7 +1180,14 @@ subroutine marbl_init_surface_forcing_fields(& units = 'unknown' call forcing_fields%add_forcing_field(& field_source=fsource, marbl_varname=varname, field_units=units, & - marbl_forcing_calendar_name=dust_flux_file, id=ind%dust_flux_id) + marbl_forcing_calendar_name=dust_flux_file, id=ind%dust_flux_id,& + marbl_status_log = marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(varname), " to forcing_fields%add" + call marbl_status_log%log_error(error_msg, subname) + return + end if end if if (count_only) then @@ -1081,7 +1198,14 @@ subroutine marbl_init_surface_forcing_fields(& units = 'unknown' call forcing_fields%add_forcing_field(& field_source=fsource, marbl_varname=varname, field_units=units, & - marbl_forcing_calendar_name=iron_flux_file, id=ind%iron_flux_id) + marbl_forcing_calendar_name=iron_flux_file, id=ind%iron_flux_id,& + marbl_status_log = marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(varname), " to forcing_fields%add" + call marbl_status_log%log_error(error_msg, subname) + return + end if end if if (count_only) then @@ -1095,18 +1219,34 @@ subroutine marbl_init_surface_forcing_fields(& ! stream_index = stream_index + 1 - line in forcing field routine call forcing_fields%add_forcing_field(& field_source=fsource, marbl_varname=varname, field_units=units, & - unit_conv_factor = ndep_shr_stream_scale_factor, & - file_varname = file_varname, & - year_first = ndep_shr_stream_year_first, & - year_last = ndep_shr_stream_year_last, & - year_align = ndep_shr_stream_year_align, & - filename = ndep_shr_stream_file, & - id=ind%nox_flux_id) + unit_conv_factor = ndep_shr_stream_scale_factor, & + file_varname = file_varname, & + year_first = ndep_shr_stream_year_first, & + year_last = ndep_shr_stream_year_last, & + year_align = ndep_shr_stream_year_align, & + filename = ndep_shr_stream_file, & + id=ind%nox_flux_id, & + marbl_status_log = marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(varname), " to forcing_fields%add" + call marbl_status_log%log_error(error_msg, subname) + return + end if else fsource = 'POP monthly calendar' call forcing_fields%add_forcing_field(& - field_source=fsource, marbl_varname=varname, field_units=units, & - marbl_forcing_calendar_name=nox_flux_monthly_file, id=ind%nox_flux_id) + field_source=fsource, marbl_varname=varname, & + field_units=units, & + marbl_forcing_calendar_name=nox_flux_monthly_file, & + id=ind%nox_flux_id, & + marbl_status_log = marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(varname), " to forcing_fields%add" + call marbl_status_log%log_error(error_msg, subname) + return + end if end if end if @@ -1119,19 +1259,38 @@ subroutine marbl_init_surface_forcing_fields(& fsource = 'file' file_varname = 'NHx_deposition' call forcing_fields%add_forcing_field(& - field_source=fsource, marbl_varname=varname, field_units=units, & - unit_conv_factor = ndep_shr_stream_scale_factor, & - file_varname = file_varname, & - year_first = ndep_shr_stream_year_first, & - year_last = ndep_shr_stream_year_last, & - year_align = ndep_shr_stream_year_align, & - filename = ndep_shr_stream_file, & - id=ind%nhy_flux_id) + field_source=fsource, & + marbl_varname=varname, & + field_units=units, & + unit_conv_factor = ndep_shr_stream_scale_factor, & + file_varname = file_varname, & + year_first = ndep_shr_stream_year_first, & + year_last = ndep_shr_stream_year_last, & + year_align = ndep_shr_stream_year_align, & + filename = ndep_shr_stream_file, & + id=ind%nhy_flux_id, & + marbl_status_log = marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(varname), " to forcing_fields%add" + call marbl_status_log%log_error(error_msg, subname) + return + end if else fsource = 'POP monthly calendar' call forcing_fields%add_forcing_field(& - field_source=fsource, marbl_varname=varname, field_units=units, & - marbl_forcing_calendar_name=nhy_flux_monthly_file, id=ind%nhy_flux_id) + field_source=fsource, & + marbl_varname=varname, & + field_units=units, & + marbl_forcing_calendar_name=nhy_flux_monthly_file, & + id=ind%nhy_flux_id, & + marbl_status_log = marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(varname), " to forcing_fields%add" + call marbl_status_log%log_error(error_msg, subname) + return + end if end if end if @@ -1142,8 +1301,18 @@ subroutine marbl_init_surface_forcing_fields(& varname = 'DIN river flux' units = 'unknown' call forcing_fields%add_forcing_field(& - field_source=fsource, marbl_varname=varname, field_units=units, & - marbl_forcing_calendar_name=din_riv_flux_file, id=ind%din_riv_flux_id) + field_source=fsource, & + marbl_varname=varname, & + field_units=units, & + marbl_forcing_calendar_name=din_riv_flux_file, & + id=ind%din_riv_flux_id, & + marbl_status_log = marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(varname), " to forcing_fields%add" + call marbl_status_log%log_error(error_msg, subname) + return + end if end if if (count_only) then @@ -1153,8 +1322,18 @@ subroutine marbl_init_surface_forcing_fields(& varname = 'DIP river flux' units = 'unknown' call forcing_fields%add_forcing_field(& - field_source=fsource, marbl_varname=varname, field_units=units, & - marbl_forcing_calendar_name=dip_riv_flux_file, id=ind%dip_riv_flux_id) + field_source=fsource, & + marbl_varname=varname, & + field_units=units, & + marbl_forcing_calendar_name=dip_riv_flux_file, & + id=ind%dip_riv_flux_id, & + marbl_status_log = marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(varname), " to forcing_fields%add" + call marbl_status_log%log_error(error_msg, subname) + return + end if end if if (count_only) then @@ -1164,8 +1343,18 @@ subroutine marbl_init_surface_forcing_fields(& varname = 'DON river flux' units = 'unknown' call forcing_fields%add_forcing_field(& - field_source=fsource, marbl_varname=varname, field_units=units, & - marbl_forcing_calendar_name=don_riv_flux_file, id=ind%don_riv_flux_id) + field_source=fsource, & + marbl_varname=varname, & + field_units=units, & + marbl_forcing_calendar_name=don_riv_flux_file, & + id=ind%don_riv_flux_id, & + marbl_status_log = marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(varname), " to forcing_fields%add" + call marbl_status_log%log_error(error_msg, subname) + return + end if end if if (count_only) then @@ -1175,8 +1364,18 @@ subroutine marbl_init_surface_forcing_fields(& varname = 'DOP river flux' units = 'unknown' call forcing_fields%add_forcing_field(& - field_source=fsource, marbl_varname=varname, field_units=units, & - marbl_forcing_calendar_name=dop_riv_flux_file, id=ind%dop_riv_flux_id) + field_source=fsource, & + marbl_varname=varname, & + field_units=units, & + marbl_forcing_calendar_name=dop_riv_flux_file, & + id=ind%dop_riv_flux_id, & + marbl_status_log = marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(varname), " to forcing_fields%add" + call marbl_status_log%log_error(error_msg, subname) + return + end if end if if (count_only) then @@ -1186,8 +1385,18 @@ subroutine marbl_init_surface_forcing_fields(& varname = 'DSI river flux' units = 'unknown' call forcing_fields%add_forcing_field(& - field_source=fsource, marbl_varname=varname, field_units=units, & - marbl_forcing_calendar_name=dsi_riv_flux_file, id=ind%dsi_riv_flux_id) + field_source=fsource, & + marbl_varname=varname, & + field_units=units, & + marbl_forcing_calendar_name=dsi_riv_flux_file, & + id=ind%dsi_riv_flux_id, & + marbl_status_log = marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(varname), " to forcing_fields%add" + call marbl_status_log%log_error(error_msg, subname) + return + end if end if if (count_only) then @@ -1197,8 +1406,18 @@ subroutine marbl_init_surface_forcing_fields(& varname = 'DFE river flux' units = 'unknown' call forcing_fields%add_forcing_field(& - field_source=fsource, marbl_varname=varname, field_units=units, & - marbl_forcing_calendar_name=dfe_riv_flux_file, id=ind%dfe_riv_flux_id) + field_source=fsource, & + marbl_varname=varname, & + field_units=units, & + marbl_forcing_calendar_name=dfe_riv_flux_file, & + id=ind%dfe_riv_flux_id, & + marbl_status_log = marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(varname), " to forcing_fields%add" + call marbl_status_log%log_error(error_msg, subname) + return + end if end if if (count_only) then @@ -1208,8 +1427,18 @@ subroutine marbl_init_surface_forcing_fields(& varname = 'DIC river flux' units = 'unknown' call forcing_fields%add_forcing_field(& - field_source=fsource, marbl_varname=varname, field_units=units, & - marbl_forcing_calendar_name=dic_riv_flux_file, id=ind%dic_riv_flux_id) + field_source=fsource, & + marbl_varname=varname, & + field_units=units, & + marbl_forcing_calendar_name=dic_riv_flux_file, & + id=ind%dic_riv_flux_id, & + marbl_status_log = marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(varname), " to forcing_fields%add" + call marbl_status_log%log_error(error_msg, subname) + return + end if end if if (count_only) then @@ -1219,8 +1448,18 @@ subroutine marbl_init_surface_forcing_fields(& varname = 'ALK river flux' units = 'unknown' call forcing_fields%add_forcing_field(& - field_source=fsource, marbl_varname=varname, field_units=units, & - marbl_forcing_calendar_name=alk_riv_flux_file, id=ind%alk_riv_flux_id) + field_source=fsource, & + marbl_varname=varname, & + field_units=units, & + marbl_forcing_calendar_name=alk_riv_flux_file, & + id=ind%alk_riv_flux_id, & + marbl_status_log = marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(varname), " to forcing_fields%add" + call marbl_status_log%log_error(error_msg, subname) + return + end if end if if (count_only) then @@ -1230,8 +1469,18 @@ subroutine marbl_init_surface_forcing_fields(& varname = 'DOC river flux' units = 'unknown' call forcing_fields%add_forcing_field(& - field_source=fsource, marbl_varname=varname, field_units=units, & - marbl_forcing_calendar_name=doc_riv_flux_file, id=ind%doc_riv_flux_id) + field_source=fsource, & + marbl_varname=varname, & + field_units=units, & + marbl_forcing_calendar_name=doc_riv_flux_file, & + id=ind%doc_riv_flux_id, & + marbl_status_log = marbl_status_log) + if (marbl_status_log%labort_marbl) then + write(error_msg,"(3A)") "error code returned when adding ", & + trim(varname), " to forcing_fields%add" + call marbl_status_log%log_error(error_msg, subname) + return + end if end if end do @@ -1629,7 +1878,13 @@ subroutine marbl_set_interior_forcing( & sed_denitrif, other_remin, nitrif, denitrif, & tracers(o2_ind, :), o2_production, o2_consumption, & fe_scavenge, fe_scavenge_rate, & - interior_forcing_diags) + interior_forcing_diags, & + marbl_status_log) + if (marbl_status_log%labort_marbl) then + error_msg = "error code returned from marbl_diagnostics_set_interior_forcing" + call marbl_status_log%log_error(error_msg, "marbl_interface::set_interior_forcing") + return + end if ! Compute resotre diagnostics do n = 1, ecosys_tracer_cnt From 2703f187ed8b84ebc0db6a212eb05e3fa37a816c Mon Sep 17 00:00:00 2001 From: Michael Levy Date: Tue, 5 Apr 2016 14:49:36 -0600 Subject: [PATCH 03/11] Remove error_msg and status_msg from marbl_logging As Keith pointed out, having these module variables creates the potential for a race condition if multiple OpenMP threads in the GCM are writing log messages at the same time. Every routine that calls log_error() or log_noerror() now has a local variable named "log_message" that we write messages into before calling one of the two aforementioned routines. --- src/marbl_ciso_mod.F90 | 65 +-- src/marbl_co2calc_mod.F90 | 38 +- src/marbl_diagnostics_mod.F90 | 905 +++++++++++++++++----------------- src/marbl_interface.F90 | 13 +- src/marbl_interface_types.F90 | 77 +-- src/marbl_logging.F90 | 3 - src/marbl_mod.F90 | 264 +++++----- src/marbl_restore_mod.F90 | 23 +- 8 files changed, 704 insertions(+), 684 deletions(-) diff --git a/src/marbl_ciso_mod.F90 b/src/marbl_ciso_mod.F90 index 03eac08f..0bd81d1f 100644 --- a/src/marbl_ciso_mod.F90 +++ b/src/marbl_ciso_mod.F90 @@ -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 @@ -135,6 +133,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 @@ -143,8 +142,7 @@ subroutine marbl_ciso_init_nml(nl_buffer, marbl_status_log) character(len=marbl_nl_buffer_size) :: & tmp_nl_buffer - character(char_len) :: & - ciso_comp_surf_avg_freq_opt + character(char_len) :: ciso_comp_surf_avg_freq_opt ! ecosys_ciso_nml namelist namelist /ecosys_ciso_nml/ & @@ -227,8 +225,8 @@ subroutine marbl_ciso_init_nml(nl_buffer, marbl_status_log) case ('nmonth') ciso_comp_surf_avg_freq_iopt = marbl_freq_opt_nmonth case default - write(error_msg, "(2A)") "unknown ciso_comp_surf_avg_freq_opt: ", trim(ciso_comp_surf_avg_freq_opt) - call marbl_status_log%log_error(error_msg, subname) + write(log_message, "(2A)") "unknown ciso_comp_surf_avg_freq_opt: ", trim(ciso_comp_surf_avg_freq_opt) + call marbl_status_log%log_error(log_message, subname) return end select @@ -237,11 +235,11 @@ subroutine marbl_ciso_init_nml(nl_buffer, marbl_status_log) !----------------------------------------------------------------------- if (ciso_use_nml_surf_vals .and. ciso_comp_surf_avg_freq_iopt /= marbl_freq_opt_never) then - write(error_msg, "(4A)") "ciso_use_nml_surf_vals can only be .true. if ", & - "ciso_comp_surf_avg_freq_opt is 'never', but", & - "ciso_comp_surf_avg_freq_opt = ", & + write(log_message, "(4A)") "ciso_use_nml_surf_vals can only be .true. if ", & + "ciso_comp_surf_avg_freq_opt is 'never', but ", & + "ciso_comp_surf_avg_freq_opt = ", & trim(ciso_comp_surf_avg_freq_opt) - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return endif @@ -271,6 +269,7 @@ subroutine marbl_ciso_init_tracer_metadata(marbl_tracer_metadata, marbl_status_l ! 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 @@ -327,9 +326,9 @@ subroutine marbl_ciso_init_tracer_metadata(marbl_tracer_metadata, marbl_status_l end do if (ecosys_ciso_tracer_cnt /= n) then - write(error_msg, "(4A)") "ecosys_ciso_tracer_cnt = ", ecosys_ciso_tracer_cnt, & - "but computed ecosys_ciso_tracer_cnt = ", n - call marbl_status_log%log_error(error_msg, subname) + write(log_message, "(4A)") "ecosys_ciso_tracer_cnt = ", ecosys_ciso_tracer_cnt, & + "but computed ecosys_ciso_tracer_cnt = ", n + call marbl_status_log%log_error(log_message, subname) return endif @@ -378,22 +377,22 @@ subroutine marbl_ciso_init_tracer_metadata(marbl_tracer_metadata, marbl_status_l endif end do - write (status_msg,"(A)") '----- autotroph tracer indices -----' - call marbl_status_log%log_noerror(status_msg, subname) + write (log_message,"(A)") '----- autotroph tracer indices -----' + call marbl_status_log%log_noerror(log_message, subname) do auto_ind = 1, autotroph_cnt - write (status_msg, "(3A,I0)") 'C13_ind(' , trim(autotrophs(auto_ind)%sname), ') = ', autotrophs(auto_ind)%C13_ind - call marbl_status_log%log_noerror(status_msg, subname) - write (status_msg, "(3A,I0)") 'C14_ind(' , trim(autotrophs(auto_ind)%sname), ') = ', autotrophs(auto_ind)%C14_ind - call marbl_status_log%log_noerror(status_msg, subname) - write (status_msg, "(3A,I0)") 'Ca13CO3_ind(' , trim(autotrophs(auto_ind)%sname), ') = ', autotrophs(auto_ind)%Ca13CO3_ind - call marbl_status_log%log_noerror(status_msg, subname) - write (status_msg, "(3A,I0)") 'Ca14CO3_ind(' , trim(autotrophs(auto_ind)%sname), ') = ', autotrophs(auto_ind)%Ca14CO3_ind - call marbl_status_log%log_noerror(status_msg, subname) + write (log_message, "(3A,I0)") 'C13_ind(' , trim(autotrophs(auto_ind)%sname), ') = ', autotrophs(auto_ind)%C13_ind + call marbl_status_log%log_noerror(log_message, subname) + write (log_message, "(3A,I0)") 'C14_ind(' , trim(autotrophs(auto_ind)%sname), ') = ', autotrophs(auto_ind)%C14_ind + call marbl_status_log%log_noerror(log_message, subname) + write (log_message, "(3A,I0)") 'Ca13CO3_ind(' , trim(autotrophs(auto_ind)%sname), ') = ', autotrophs(auto_ind)%Ca13CO3_ind + call marbl_status_log%log_noerror(log_message, subname) + write (log_message, "(3A,I0)") 'Ca14CO3_ind(' , trim(autotrophs(auto_ind)%sname), ') = ', autotrophs(auto_ind)%Ca14CO3_ind + call marbl_status_log%log_noerror(log_message, subname) end do - write (status_msg, "(A,I0)") 'autotroph_cnt = ', autotroph_cnt - call marbl_status_log%log_noerror(status_msg, subname) - write (status_msg,"(A)") '------------------------------------' - call marbl_status_log%log_noerror(status_msg, subname) + write (log_message, "(A,I0)") 'autotroph_cnt = ', autotroph_cnt + call marbl_status_log%log_noerror(log_message, subname) + write (log_message,"(A)") '------------------------------------' + call marbl_status_log%log_noerror(log_message, subname) !----------------------------------------------------------------------- ! set lfull_depth_tavg flag for short-lived ecosystem tracers @@ -471,6 +470,7 @@ subroutine marbl_ciso_set_interior_forcing( & ! local variables !----------------------------------------------------------------------- character(*), parameter :: subname = 'marbl_ciso_mod:marbl_ciso_set_interior forcing' + character(len=char_len) :: log_message logical (log_kind) :: zero_mask @@ -645,8 +645,8 @@ 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) + log_message = "error code returned from setup_cell_attributes" + call marbl_status_log%log_error(log_message, subname) return end if @@ -1160,6 +1160,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) :: & n, & ! index for looping over column_tracer auto_ind ! autotroph functional group index @@ -1215,8 +1216,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 @@ -1600,6 +1601,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 @@ -1952,6 +1954,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 diff --git a/src/marbl_co2calc_mod.F90 b/src/marbl_co2calc_mod.F90 index 66902874..d31ec57f 100644 --- a/src/marbl_co2calc_mod.F90 +++ b/src/marbl_co2calc_mod.F90 @@ -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 @@ -138,6 +136,7 @@ subroutine marbl_co2calc_surf( & ! local variable declarations !--------------------------------------------------------------------------- character(*), parameter :: subname = 'marbl_co2calc:marbl_co2calc_surf' + character(len=char_len) :: log_message integer(kind=int_kind) :: n integer(kind=int_kind) :: k real(kind=r8) :: mass_to_vol ! (mol/kg) -> (mmol/m^3) @@ -202,8 +201,8 @@ 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) + log_message = "error code returned from comp_htotal" + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -306,6 +305,8 @@ subroutine marbl_comp_CO3terms(& !--------------------------------------------------------------------------- ! local variable declarations !--------------------------------------------------------------------------- + character(*), parameter :: subname = 'marbl_co2calc:marbl_comp_CO3terms' + character(len=char_len) :: log_message 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) @@ -371,8 +372,8 @@ 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") + log_message = "error code returned from comp_htotal" + call marbl_status_log%log_error(log_message, subname) return end if @@ -789,6 +790,8 @@ subroutine comp_htotal(num_elements, mask, temp, dic_in, ta_in, pt_in, sit_in, & !--------------------------------------------------------------------------- ! local variable declarations !--------------------------------------------------------------------------- + character(*), parameter :: subname = 'marbl_co2calc:marbl_comp_htotal' + character(len=char_len) :: log_message 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) @@ -866,8 +869,8 @@ 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") + log_message = "error code returned from drtsafe" + call marbl_status_log%log_error(log_message, subname) return end if @@ -908,6 +911,7 @@ subroutine drtsafe(num_elements, mask_in, k1, k2, co3_coeffs, x1, x2, xacc, & ! local variable declarations !--------------------------------------------------------------------------- character(*), parameter :: subname = 'marbl_co2calc::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 @@ -942,15 +946,15 @@ 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 @@ -958,8 +962,8 @@ subroutine drtsafe(num_elements, mask_in, k1, k2, co3_coeffs, x1, x2, xacc, & 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 diff --git a/src/marbl_diagnostics_mod.F90 b/src/marbl_diagnostics_mod.F90 index e3bef502..dd3538d2 100644 --- a/src/marbl_diagnostics_mod.F90 +++ b/src/marbl_diagnostics_mod.F90 @@ -55,7 +55,6 @@ module marbl_diagnostics_mod use marbl_interface_types , only : marbl_diagnostics_type use marbl_logging, only : marbl_log_type - use marbl_logging, only : error_msg implicit none public @@ -380,6 +379,7 @@ subroutine marbl_diagnostics_init( & character(len=char_len) :: lname, sname, units, vgrid character(*), parameter :: subname = "marbl_diagnostics_mod:marbl_diagnostics_init" + character(len=char_len) :: log_message !----------------------------------------------------------------------- !----------------------------------------------------------------- @@ -423,9 +423,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%ECOSYS_IFRAC, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -441,9 +441,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%ECOSYS_XKW, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -459,9 +459,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%ECOSYS_ATM_PRESS, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -477,9 +477,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%PV_O2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -495,9 +495,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%SCHMIDT_O2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -513,9 +513,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%O2SAT, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -531,9 +531,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%O2_GAS_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -549,9 +549,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CO2STAR, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -567,9 +567,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DCO2STAR, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -585,9 +585,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%pCO2SURF, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -603,9 +603,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DpCO2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -621,9 +621,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%PV_CO2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -639,9 +639,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%SCHMIDT_CO2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -657,9 +657,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DIC_GAS_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -675,9 +675,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%PH, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -693,9 +693,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%ATM_CO2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -711,9 +711,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CO2STAR_ALT_CO2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -729,9 +729,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DCO2STAR_ALT_CO2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -747,9 +747,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%pCO2SURF_ALT_CO2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -765,9 +765,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DpCO2_ALT_CO2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -783,9 +783,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DIC_GAS_FLUX_ALT_CO2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -801,9 +801,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%PH_ALT_CO2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -819,9 +819,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%ATM_ALT_CO2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -837,9 +837,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%IRON_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -855,9 +855,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DUST_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -873,9 +873,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%NOx_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -891,9 +891,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%NHy_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -909,9 +909,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DIN_RIV_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -927,9 +927,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DIP_RIV_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -945,9 +945,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DON_RIV_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -963,9 +963,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DONr_RIV_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -981,9 +981,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DOP_RIV_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -999,9 +999,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DOPr_RIV_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1017,9 +1017,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DSI_RIV_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1035,9 +1035,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DFE_RIV_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1053,9 +1053,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DIC_RIV_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1071,9 +1071,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%ALK_RIV_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1089,9 +1089,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DOC_RIV_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1107,9 +1107,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DOCr_RIV_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1131,9 +1131,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DI13C_GAS_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1149,9 +1149,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DI13C_AS_GAS_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1167,9 +1167,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DI13C_SA_GAS_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1185,9 +1185,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_d13C_GAS_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1203,9 +1203,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_D13C_atm, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1221,9 +1221,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_R13C_DIC_surf, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1239,9 +1239,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_R13C_atm, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1257,9 +1257,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DI13C_RIV_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1275,9 +1275,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DO13C_RIV_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1293,9 +1293,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_eps_aq_g_surf, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1311,9 +1311,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_eps_dic_g_surf, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1329,9 +1329,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DI14C_GAS_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1347,9 +1347,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DI14C_AS_GAS_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1365,9 +1365,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DI14C_SA_GAS_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1383,9 +1383,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_d14C_GAS_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1401,9 +1401,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_D14C_atm, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1419,9 +1419,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_R14C_DIC_surf, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1437,9 +1437,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_R14C_atm, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1455,9 +1455,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DI14C_RIV_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1473,9 +1473,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DO14C_RIV_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1491,9 +1491,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_GLOBAL_D14C, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1522,9 +1522,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%zsatcalc, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1540,9 +1540,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%zsatarag, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1558,9 +1558,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%O2_ZMIN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1576,9 +1576,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%O2_ZMIN_DEPTH, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1594,9 +1594,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%photoC_TOT_zint, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1612,9 +1612,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%photoC_NO3_TOT_zint, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1630,9 +1630,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%Jint_Ctot, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1648,9 +1648,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%Jint_100m_Ctot, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1666,9 +1666,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%Jint_Ntot, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1684,9 +1684,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%Jint_100m_Ntot, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1702,9 +1702,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%Jint_Ptot, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1720,9 +1720,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%Jint_100m_Ptot, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1738,9 +1738,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%Jint_Sitot, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1756,9 +1756,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%Jint_100m_Sitot, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1774,9 +1774,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%Jint_Fetot, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1792,9 +1792,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%Jint_100m_Fetot, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1811,9 +1811,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%calcToSed, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1829,9 +1829,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%pocToSed, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1847,9 +1847,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%ponToSed, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1865,9 +1865,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%SedDenitrif, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1883,9 +1883,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%OtherRemin, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1901,9 +1901,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%popToSed, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1919,9 +1919,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%bsiToSed, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1937,9 +1937,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%dustToSed, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1955,9 +1955,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%pfeToSed, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1975,9 +1975,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%photoC_zint(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1993,9 +1993,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%photoC_NO3_zint(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2012,9 +2012,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CaCO3_form_zint(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if else @@ -2034,9 +2034,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%tot_CaCO3_form_zint, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2053,9 +2053,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CO3, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2071,9 +2071,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%HCO3, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2089,9 +2089,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%H2CO3, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2107,9 +2107,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%ph_3D, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2125,9 +2125,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CO3_ALT_CO2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2143,9 +2143,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%HCO3_ALT_CO2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2161,9 +2161,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%H2CO3_ALT_CO2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2179,9 +2179,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%ph_3D_ALT_CO2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2197,9 +2197,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%co3_sat_calc, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2215,9 +2215,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%co3_sat_arag, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2233,9 +2233,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%NITRIF, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2251,9 +2251,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DENITRIF, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2269,9 +2269,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%O2_PRODUCTION, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2287,9 +2287,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%O2_CONSUMPTION, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2305,9 +2305,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%AOU, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2323,9 +2323,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%PAR_avg, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2341,9 +2341,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%auto_graze_TOT, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2359,9 +2359,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%photoC_TOT, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2377,9 +2377,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%photoC_NO3_TOT, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2395,9 +2395,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DOC_prod, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2413,9 +2413,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DOC_remin, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2431,9 +2431,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DOCr_remin, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2449,9 +2449,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DON_prod, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2467,9 +2467,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DON_remin, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2485,9 +2485,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DONr_remin, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2503,9 +2503,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DOP_prod, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2521,9 +2521,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DOP_remin, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2539,9 +2539,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DOPr_remin, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2557,9 +2557,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%Fe_scavenge, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2575,9 +2575,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%Fe_scavenge_rate, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2594,9 +2594,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%POC_FLUX_IN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2612,9 +2612,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%POC_PROD, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2630,9 +2630,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%POC_REMIN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2648,9 +2648,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%POC_REMIN_DIC, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2666,9 +2666,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%PON_REMIN_NH4, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2684,9 +2684,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%POP_REMIN_PO4, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2702,9 +2702,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CaCO3_FLUX_IN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2720,9 +2720,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CaCO3_PROD, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2738,9 +2738,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CaCO3_REMIN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2756,9 +2756,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%SiO2_FLUX_IN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2774,9 +2774,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%SiO2_PROD, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2792,9 +2792,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%SiO2_REMIN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2810,9 +2810,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%dust_FLUX_IN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2828,9 +2828,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%dust_REMIN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2846,9 +2846,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%P_iron_FLUX_IN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2864,9 +2864,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%P_iron_PROD, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2882,9 +2882,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%P_iron_REMIN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2903,9 +2903,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%N_lim(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2921,9 +2921,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%P_lim(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2939,9 +2939,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%Fe_lim(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2958,9 +2958,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%SiO3_lim(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if else @@ -2979,9 +2979,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%light_lim(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -2997,9 +2997,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%photoC(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3015,9 +3015,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%photoC_NO3(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3033,9 +3033,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%photoFe(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3051,9 +3051,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%photoNO3(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3069,9 +3069,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%photoNH4(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3087,9 +3087,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DOP_uptake(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3105,9 +3105,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%PO4_uptake(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3123,9 +3123,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%auto_graze(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3141,9 +3141,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%auto_graze_poc(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3159,9 +3159,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%auto_graze_doc(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3177,9 +3177,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%auto_graze_zoo(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3195,9 +3195,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%auto_loss(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3213,9 +3213,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%auto_loss_poc(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3231,9 +3231,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%auto_loss_doc(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3249,9 +3249,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%auto_agg(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3270,9 +3270,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%bSi_form(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if else @@ -3292,9 +3292,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CaCO3_form(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if else @@ -3314,9 +3314,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%Nfix(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if else @@ -3337,9 +3337,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%tot_bSi_form, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3355,9 +3355,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%tot_CaCO3_form, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3373,9 +3373,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%tot_Nfix, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3394,9 +3394,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%zoo_loss(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3412,9 +3412,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%zoo_loss_poc(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3430,9 +3430,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%zoo_loss_doc(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3448,9 +3448,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%zoo_graze(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3466,9 +3466,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%zoo_graze_poc(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3484,9 +3484,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%zoo_graze_doc(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3502,9 +3502,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%zoo_graze_zoo(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3520,9 +3520,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%x_graze_zoo(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3544,9 +3544,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_PO13C_FLUX_IN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3562,9 +3562,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_PO13C_PROD, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3580,9 +3580,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_PO13C_REMIN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3598,9 +3598,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DO13C_prod, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3616,9 +3616,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DO13C_remin, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3634,9 +3634,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_Ca13CO3_FLUX_IN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3652,9 +3652,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_Ca13CO3_PROD, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3670,9 +3670,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_Ca13CO3_REMIN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3688,9 +3688,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_photo13C_TOT, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3706,9 +3706,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DIC_d13C, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3724,9 +3724,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DOC_d13C, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3742,9 +3742,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_zooC_d13C, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3760,9 +3760,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_PO14C_FLUX_IN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3778,9 +3778,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_PO14C_PROD, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3796,9 +3796,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_PO14C_REMIN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3814,9 +3814,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DO14C_prod, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3832,9 +3832,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DO14C_remin, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3850,9 +3850,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_Ca14CO3_FLUX_IN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3868,9 +3868,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_Ca14CO3_PROD, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3886,9 +3886,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_Ca14CO3_REMIN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3904,9 +3904,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_photo14C_TOT, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3922,9 +3922,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DIC_d14C, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3940,9 +3940,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DOC_d14C, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3958,9 +3958,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_zooC_d14C, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3978,9 +3978,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_photo13C_TOT_zint, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -3996,9 +3996,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_photo14C_TOT_zint, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -4014,9 +4014,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_Jint_13Ctot, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -4032,9 +4032,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_Jint_14Ctot, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -4050,9 +4050,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_Jint_100m_13Ctot, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -4068,9 +4068,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_Jint_100m_14Ctot, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -4091,9 +4091,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_Ca13CO3_form(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -4109,9 +4109,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_Ca13CO3_form_zint(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -4127,9 +4127,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_Ca14CO3_form(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -4145,9 +4145,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_Ca14CO3_form_zint(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -4163,9 +4163,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_autotrophCaCO3_d13C(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -4181,9 +4181,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_autotrophCaCO3_d14C(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -4199,9 +4199,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_photo13C(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -4217,9 +4217,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_photo14C(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -4235,9 +4235,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_photo13C_zint(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -4253,9 +4253,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_photo14C_zint(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -4271,9 +4271,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_eps_autotroph(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -4289,9 +4289,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_d13C(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -4307,9 +4307,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_d14C(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -4325,9 +4325,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_mui_to_co2star(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -4347,9 +4347,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_eps_aq_g, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -4365,9 +4365,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_eps_dic_g, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -4385,9 +4385,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%calcToSed_13C, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -4403,9 +4403,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%pocToSed_13C, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -4421,9 +4421,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%calcToSed_14C, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -4439,9 +4439,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%pocToSed_14C, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -4471,9 +4471,9 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, .false., & tmp_id, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -4489,20 +4489,20 @@ subroutine marbl_diagnostics_init( & call marbl_interior_forcing_diags%set_to_zero(marbl_status_log) if (marbl_status_log%labort_marbl) then - error_msg = "error code returned marbl_interior_forcing_diags%set_to_zero" - call marbl_status_log%log_error(error_msg, subname) + log_message = "error code returned marbl_interior_forcing_diags%set_to_zero" + call marbl_status_log%log_error(log_message, subname) return end if call marbl_interior_restore_diags%set_to_zero(marbl_status_log) if (marbl_status_log%labort_marbl) then - error_msg = "error code returned marbl_interior_forcing_diags%set_to_zero" - call marbl_status_log%log_error(error_msg, subname) + log_message = "error code returned marbl_interior_forcing_diags%set_to_zero" + call marbl_status_log%log_error(log_message, subname) return end if call marbl_surface_forcing_diags%set_to_zero(marbl_status_log) if (marbl_status_log%labort_marbl) then - error_msg = "error code returned marbl_interior_forcing_diags%set_to_zero" - call marbl_status_log%log_error(error_msg, subname) + log_message = "error code returned marbl_interior_forcing_diags%set_to_zero" + call marbl_status_log%log_error(log_message, subname) return end if @@ -4556,6 +4556,7 @@ subroutine marbl_diagnostics_set_interior_forcing ( & type (marbl_log_type) , intent(inout) :: marbl_status_log character(*), parameter :: subname = "marbl_diagnostics_mod:set_interior" + character(len=char_len) :: log_message !----------------------------------------------------------------- @@ -4570,8 +4571,8 @@ subroutine marbl_diagnostics_set_interior_forcing ( & call marbl_interior_forcing_diags%set_to_zero(marbl_status_log) if (marbl_status_log%labort_marbl) then - error_msg = "error code returned marbl_interior_forcing_diags%set_to_zero" - call marbl_status_log%log_error(error_msg, subname) + log_message = "error code returned marbl_interior_forcing_diags%set_to_zero" + call marbl_status_log%log_error(log_message, subname) return end if @@ -4681,6 +4682,7 @@ subroutine marbl_diagnostics_set_surface_forcing( & ! local variables !----------------------------------------------------------------------- character(*), parameter :: subname = 'marbl_diagnostics:store_diagnostics_surface_forcing' + character(len=char_len) :: log_message !----------------------------------------------------------------------- !----------------------------------------------------------------------- @@ -5846,6 +5848,7 @@ subroutine store_diagnostics_ciso_surface_forcing( & ! local variables !----------------------------------------------------------------------- character(*), parameter :: subname = 'marbl_diagnostics:store_diagnostics_ciso_surface_forcing' + character(len=char_len) :: log_message !----------------------------------------------------------------------- associate( & diff --git a/src/marbl_interface.F90 b/src/marbl_interface.F90 index 2d2da635..275bec97 100644 --- a/src/marbl_interface.F90 +++ b/src/marbl_interface.F90 @@ -18,9 +18,8 @@ module marbl_interface ! column test system !----------------------------------------------------------------------- - use marbl_kinds_mod , only : r8, log_kind, int_kind, log_kind + use marbl_kinds_mod , only : r8, log_kind, int_kind, log_kind, char_len use marbl_logging , only : marbl_log_type - use marbl_logging , only : error_msg use marbl_sizes , only : ecosys_tracer_cnt use marbl_sizes , only : ecosys_ciso_tracer_cnt @@ -154,6 +153,7 @@ subroutine init(this, & real (r8) , intent(in) :: gcm_zw(gcm_num_levels) ! thickness of layer k real (r8) , intent(in) :: gcm_zt(gcm_num_levels) ! thickness of layer k + character(len=char_len) :: log_message integer :: i !-------------------------------------------------------------------- @@ -275,8 +275,8 @@ subroutine init(this, & surface_forcing_fields = this%surface_forcing_fields, & marbl_status_log = this%StatusLog) if (this%statusLog%labort_marbl) then - error_msg = "error code returned from marbl_init_surface_forcing_fields" - call this%statusLog%log_error(error_msg, "marbl_interface::marbl_init()") + log_message = "error code returned from marbl_init_surface_forcing_fields" + call this%statusLog%log_error(log_message, "marbl_interface::marbl_init()") return end if @@ -328,6 +328,7 @@ subroutine set_interior_forcing(this) implicit none class(marbl_interface_class), intent(inout) :: this + character(len=char_len) :: log_message call this%restoring%restore_tracers( & this%column_tracers, & @@ -353,8 +354,8 @@ subroutine set_interior_forcing(this) marbl_status_log = this%statusLog) if (this%statusLog%labort_marbl) then - error_msg = "error code returned from marbl_set_interior_forcing" - call this%statusLog%log_error(error_msg, "marbl_interface::set_interior_forcing") + log_message = "error code returned from marbl_set_interior_forcing" + call this%statusLog%log_error(log_message, "marbl_interface::set_interior_forcing") return end if diff --git a/src/marbl_interface_types.F90 b/src/marbl_interface_types.F90 index bd4a941c..f35187bf 100644 --- a/src/marbl_interface_types.F90 +++ b/src/marbl_interface_types.F90 @@ -5,8 +5,6 @@ module marbl_interface_types use marbl_constants_mod , only : c0, c1 use marbl_interface_constants , only : marbl_str_length use marbl_logging , only : marbl_log_type - use marbl_logging , only : error_msg - use marbl_logging , only : status_msg implicit none @@ -355,6 +353,7 @@ subroutine marbl_single_diag_init(this, lname, sname, units, vgrid, & type(marbl_log_type) , intent(inout) :: marbl_status_log character(*), parameter :: subname = 'marbl_interface_types:marbl_single_diag_init' + character(len=char_len) :: log_message ! Allocate column memory for 3D vars or num_elements memory for 2D vars select case (trim(vgrid)) @@ -365,9 +364,9 @@ subroutine marbl_single_diag_init(this, lname, sname, units, vgrid, & case ('none') allocate(this%field_2d(num_elements)) case DEFAULT - write(error_msg,"(2A)") trim(vgrid), & + write(log_message,"(2A)") trim(vgrid), & " is not a valid vertical grid for MARBL" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end select @@ -392,6 +391,7 @@ subroutine marbl_single_sfo_constructor(this, num_elements, field_name, id, & character(len=*), parameter :: subname = & 'marbl_interface_types:marbl_single_sfo_constructor' + character(len=char_len) :: log_message select case (trim(field_name)) case("flux_o2") @@ -410,13 +410,13 @@ subroutine marbl_single_sfo_constructor(this, num_elements, field_name, id, & this%units = "mg/m^3" sfo_ind%totalChl_id = id case DEFAULT - write(error_msg, "(2A)") trim(field_name), & + write(log_message, "(2A)") trim(field_name), & " is not a valid surface forcing field name" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end select - write(status_msg, "(3A)") "Adding ", trim(field_name), " to surface forcing outputs" - call marbl_status_log%log_noerror(status_msg, subname) + write(log_message, "(3A)") "Adding ", trim(field_name), " to surface forcing outputs" + call marbl_status_log%log_noerror(log_message, subname) allocate(this%forcing_field(num_elements)) this%forcing_field = c0 @@ -451,6 +451,7 @@ subroutine marbl_sfo_add(this, num_elements, field_name, sfo_id, & type(marbl_single_sfo_type), dimension(:), pointer :: new_sfo integer :: n, old_size character(len=*), parameter :: subname = 'marbl_interface_types:marbl_sfo_add' + character(len=char_len) :: log_message if (associated(this%sfo)) then old_size = size(this%sfo) @@ -476,8 +477,8 @@ subroutine marbl_sfo_add(this, num_elements, field_name, sfo_id, & call new_sfo(sfo_id)%construct(num_elements, field_name, sfo_id, & marbl_status_log) if (marbl_status_log%labort_marbl) then - error_msg = "error code returned from new_sfo%construct" - call marbl_status_log%log_error(error_msg, subname) + log_message = "error code returned from new_sfo%construct" + call marbl_status_log%log_error(log_message, subname) return end if @@ -517,6 +518,7 @@ subroutine marbl_diagnostics_set_to_zero(this, marbl_status_log) integer (int_kind) :: n character(*), parameter :: subname="marbl_interface_types:diagnostics_set_to_zero" + character(len=char_len) :: log_message do n=1,this%diag_cnt if (allocated(this%diags(n)%field_2d)) then @@ -525,12 +527,12 @@ subroutine marbl_diagnostics_set_to_zero(this, marbl_status_log) this%diags(n)%field_3d(:, :) = c0 else ! TODO abort abort abort - error_msg = "neither field_2d nor field_3d are allocated" - call marbl_status_log%log_error(error_msg, subname) - write(error_msg,"(2A)") "Diag short name = ", trim(this%diags(n)%short_name) - call marbl_status_log%log_error(error_msg, subname) - write(error_msg,"(2A)") "Diag long name = ", trim(this%diags(n)%long_name) - call marbl_status_log%log_error(error_msg, subname) + log_message = "neither field_2d nor field_3d are allocated" + call marbl_status_log%log_error(log_message, subname) + write(log_message,"(2A)") "Diag short name = ", trim(this%diags(n)%short_name) + call marbl_status_log%log_error(log_message, subname) + write(log_message,"(2A)") "Diag long name = ", trim(this%diags(n)%long_name) + call marbl_status_log%log_error(log_message, subname) return end if end do @@ -549,19 +551,20 @@ subroutine marbl_diagnostics_add(this, lname, sname, units, vgrid, & type(marbl_log_type) , intent(inout) :: marbl_status_log character(*), parameter :: subname = 'marbl_interface_types:marbl_diagnostics_add' + character(len=char_len) :: log_message this%diag_cnt = this%diag_cnt + 1 id = this%diag_cnt if (id.gt.size(this%diags)) then - error_msg = "not enough memory allocated for this number of diagnostics!" - call marbl_status_log%log_error(error_msg, subname) + log_message = "not enough memory allocated for this number of diagnostics!" + call marbl_status_log%log_error(log_message, subname) return end if call this%diags(id)%initialize(lname, sname, units, vgrid, truncate, & this%num_elements, this%num_levels, marbl_status_log) if (marbl_status_log%labort_marbl) then - error_msg = "error code returned from this%diags%initialize" - call marbl_status_log%log_error(error_msg, subname) + log_message = "error code returned from this%diags%initialize" + call marbl_status_log%log_error(log_message, subname) return end if @@ -694,6 +697,7 @@ subroutine marbl_single_forcing_field_init(this, & logical(log_kind) :: has_valid_source logical(log_kind) :: has_valid_inputs character(*), parameter :: subname = "marbl_interface_types:single_forcing_field_init" + character(len=char_len) :: log_message !----------------------------------------------------------------------- valid_field_sources(1) = "constant" @@ -709,9 +713,9 @@ subroutine marbl_single_forcing_field_init(this, & if (trim(field_source) .eq. trim(valid_field_sources(n))) has_valid_source = .true. enddo if (.not. has_valid_source) then - write(error_msg,"(2A)") trim(field_source), & + write(log_message,"(2A)") trim(field_source), & "is not a valid field source for MARBL" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return endif @@ -740,18 +744,18 @@ subroutine marbl_single_forcing_field_init(this, & case('constant') if (.not.present(field_constant)) has_valid_inputs = .false. if (has_valid_inputs) then - write(status_msg,"(2A)") "Adding constant forcing_field_type for ", & + write(log_message,"(2A)") "Adding constant forcing_field_type for ", & trim(this%marbl_varname) - call marbl_status_log%log_noerror(status_msg, subname) + call marbl_status_log%log_noerror(log_message, subname) call marbl_forcing_constant_init(this%field_constant_info, field_constant) endif case('driver') if (.not.present(marbl_driver_varname)) has_valid_inputs = .false. if (has_valid_inputs) then - write(status_msg, "(2A)") "Adding driver forcing_field_type for ", & + write(log_message, "(2A)") "Adding driver forcing_field_type for ", & trim(this%marbl_varname) - call marbl_status_log%log_noerror(status_msg, subname) + call marbl_status_log%log_noerror(log_message, subname) call this%field_driver_info%initialize(marbl_driver_varname) endif @@ -759,9 +763,9 @@ subroutine marbl_single_forcing_field_init(this, & if (.not.present(filename)) has_valid_inputs = .false. if (.not.present(file_varname)) has_valid_inputs = .false. if (has_valid_inputs) then - write(status_msg,"(2A)") "Adding file forcing_field_type for ", & + write(log_message,"(2A)") "Adding file forcing_field_type for ", & trim(this%marbl_varname) - call marbl_status_log%log_noerror(status_msg, subname) + call marbl_status_log%log_noerror(log_message, subname) call this%field_file_info%initialize(& filename, file_varname, & temporal=temporal, year_first=year_first, & @@ -772,18 +776,18 @@ subroutine marbl_single_forcing_field_init(this, & case('POP monthly calendar') if (.not.present(marbl_forcing_calendar_name)) has_valid_inputs = .false. if (has_valid_inputs) then - write(status_msg,"(2A)") "Adding calendar forcing_field_type for ", & + write(log_message,"(2A)") "Adding calendar forcing_field_type for ", & trim(this%marbl_varname) - call marbl_status_log%log_noerror(status_msg, subname) + call marbl_status_log%log_noerror(log_message, subname) call this%field_monthly_calendar_info%initialize(marbl_forcing_calendar_name) endif end select if (.not.has_valid_inputs) then - write(error_msg,"(3A)") "Call to MARBL does not have the correct ", & + write(log_message,"(3A)") "Call to MARBL does not have the correct ", & "optional arguments for ", trim(field_source) - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if @@ -843,14 +847,15 @@ subroutine marbl_forcing_fields_add(this, & integer (kind=int_kind) :: num_elem character(*), parameter :: subname = "marbl_interface_types:marbl_forcing_fields_add" + character(len=char_len) :: log_message ! Note - the following sets the indices into the marble interface type surface_input_forcings(:,indices) this%forcing_field_cnt = this%forcing_field_cnt + 1 id = this%forcing_field_cnt if (id .gt. size(this%forcing_fields)) then - error_msg = "not enough memory allocated for number of forcing fields!" - call marbl_status_log%log_error(error_msg, subname) + log_message = "not enough memory allocated for number of forcing fields!" + call marbl_status_log%log_error(log_message, subname) return end if num_elem = this%num_elements @@ -868,8 +873,8 @@ subroutine marbl_forcing_fields_add(this, & marbl_forcing_calendar_name=marbl_forcing_calendar_name, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_MARBL) then - error_msg = "error code returned from this%forcing_fields%initialize" - call marbl_status_log%log_error(error_msg, subname) + log_message = "error code returned from this%forcing_fields%initialize" + call marbl_status_log%log_error(log_message, subname) return end if diff --git a/src/marbl_logging.F90 b/src/marbl_logging.F90 index 2330ba02..a286900a 100644 --- a/src/marbl_logging.F90 +++ b/src/marbl_logging.F90 @@ -47,9 +47,6 @@ module marbl_logging procedure, public :: erase => marbl_log_erase end type marbl_log_type - character(len=char_len), public :: error_msg - character(len=char_len), public :: status_msg - contains subroutine marbl_output_options_constructor(this, labort_on_warning, LogVerbose, LogNamelist, & diff --git a/src/marbl_mod.F90 b/src/marbl_mod.F90 index c20f142a..3dac0c4b 100644 --- a/src/marbl_mod.F90 +++ b/src/marbl_mod.F90 @@ -210,8 +210,6 @@ module marbl_mod use marbl_diagnostics_mod , only : marbl_diagnostics_set_interior_forcing use marbl_logging , only : marbl_log_type - use marbl_logging , only : error_msg - use marbl_logging , only : status_msg implicit none private @@ -400,6 +398,7 @@ subroutine marbl_init_nml(nl_buffer, marbl_status_log) !----------------------------------------------------------------------- character(*), parameter :: subname = 'marbl_mod:marbl_init_nml' + character(len=char_len) :: log_message character(len=marbl_nl_buffer_size) :: tmp_nl_buffer integer (int_kind) :: n ! index for looping over tracers @@ -650,8 +649,8 @@ subroutine marbl_init_nml(nl_buffer, marbl_status_log) else if (trim(gas_flux_forcing_opt) == 'file') then gas_flux_forcing_iopt = gas_flux_forcing_iopt_file else - write(error_msg, "(2A)") "unknown gas_flux_forcing_opt: ", trim(gas_flux_forcing_opt) - call marbl_status_log%log_error(error_msg, subname) + write(log_message, "(2A)") "unknown gas_flux_forcing_opt: ", trim(gas_flux_forcing_opt) + call marbl_status_log%log_error(log_message, subname) return endif @@ -684,8 +683,8 @@ subroutine marbl_init_nml(nl_buffer, marbl_status_log) case ('nmonth') comp_surf_avg_freq_iopt = marbl_freq_opt_nmonth case default - write(error_msg, "(2A)") "unknown comp_surf_avg_freq_opt: ", trim(comp_surf_avg_freq_opt) - call marbl_status_log%log_error(error_msg, subname) + write(log_message, "(2A)") "unknown comp_surf_avg_freq_opt: ", trim(comp_surf_avg_freq_opt) + call marbl_status_log%log_error(log_message, subname) return end select @@ -697,8 +696,8 @@ subroutine marbl_init_nml(nl_buffer, marbl_status_log) case ('drv_diag') atm_co2_iopt = atm_co2_iopt_drv_diag case default - write(error_msg, "(2A)") "unknown atm_co2_opt: ", trim(atm_co2_opt) - call marbl_status_log%log_error(error_msg, subname) + write(log_message, "(2A)") "unknown atm_co2_opt: ", trim(atm_co2_opt) + call marbl_status_log%log_error(log_message, subname) return end select @@ -706,8 +705,8 @@ subroutine marbl_init_nml(nl_buffer, marbl_status_log) case ('const') atm_alt_co2_iopt = atm_co2_iopt_const case default - write(error_msg, "(2A)") "unknown atm_alt_co2_opt: ", trim(atm_alt_co2_opt) - call marbl_status_log%log_error(error_msg, subname) + write(log_message, "(2A)") "unknown atm_alt_co2_opt: ", trim(atm_alt_co2_opt) + call marbl_status_log%log_error(log_message, subname) return end select @@ -717,8 +716,8 @@ subroutine marbl_init_nml(nl_buffer, marbl_status_log) case ('omega_calc') caco3_bury_thres_iopt = caco3_bury_thres_iopt_omega_calc case default - write(error_msg, "(2A)") "unknown caco3_bury_thres_opt: ", trim(caco3_bury_thres_opt) - call marbl_status_log%log_error(error_msg, subname) + write(log_message, "(2A)") "unknown caco3_bury_thres_opt: ", trim(caco3_bury_thres_opt) + call marbl_status_log%log_error(log_message, subname) return end select @@ -727,10 +726,10 @@ subroutine marbl_init_nml(nl_buffer, marbl_status_log) !----------------------------------------------------------------------- if (use_nml_surf_vals .and. comp_surf_avg_freq_iopt /= marbl_freq_opt_never) then - write(error_msg, "(4A)") "use_nml_surf_vals can only be .true. if ", & + write(log_message, "(4A)") "use_nml_surf_vals can only be .true. if ", & "comp_surf_avg_freq_opt is 'never', but ", & "comp_surf_avg_freq_opt = ", trim(comp_surf_avg_freq_opt) - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return endif @@ -741,8 +740,8 @@ subroutine marbl_init_nml(nl_buffer, marbl_status_log) ! FIXME #11: eliminate marbl_parms! call marbl_params_init(nl_buffer, marbl_status_log) if (marbl_status_log%labort_marbl) then - error_msg = "error code returned from marbl_params_init" - call marbl_status_log%log_error(error_msg, subname) + log_message = "error code returned from marbl_params_init" + call marbl_status_log%log_error(log_message, subname) return end if @@ -824,6 +823,7 @@ subroutine marbl_init_surface_forcing_fields(& ! local variables !----------------------------------------------------------------------- character(*), parameter :: subname = 'marbl_mod:marbl_sflux_forcing_fields_init' + character(len=char_len) :: log_message character(char_len) :: fsource character(char_len) :: filename character(char_len) :: varname @@ -864,9 +864,9 @@ subroutine marbl_init_surface_forcing_fields(& marbl_driver_varname=varname, id=ind%surface_mask_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -884,9 +884,9 @@ subroutine marbl_init_surface_forcing_fields(& marbl_driver_varname=varname, id=ind%d13c_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -903,9 +903,9 @@ subroutine marbl_init_surface_forcing_fields(& marbl_driver_varname=varname, id=ind%d14c_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -922,9 +922,9 @@ subroutine marbl_init_surface_forcing_fields(& marbl_driver_varname=varname, id=ind%d14c_glo_avg_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -942,9 +942,9 @@ subroutine marbl_init_surface_forcing_fields(& marbl_driver_varname=driver_varname, id=ind%u10_sqr_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -961,9 +961,9 @@ subroutine marbl_init_surface_forcing_fields(& marbl_driver_varname=driver_varname, id=ind%sst_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -980,9 +980,9 @@ subroutine marbl_init_surface_forcing_fields(& marbl_driver_varname=driver_varname, id=ind%sss_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1000,9 +1000,9 @@ subroutine marbl_init_surface_forcing_fields(& field_constant = atm_co2_const, id=ind%xco2_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1023,9 +1023,9 @@ subroutine marbl_init_surface_forcing_fields(& marbl_driver_varname=driver_varname, id=ind%xco2_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1045,9 +1045,9 @@ subroutine marbl_init_surface_forcing_fields(& field_constant=atm_alt_co2_const, id=ind%xco2_alt_co2_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1066,9 +1066,9 @@ subroutine marbl_init_surface_forcing_fields(& marbl_driver_varname=driver_varname, id=ind%ifrac_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1084,9 +1084,9 @@ subroutine marbl_init_surface_forcing_fields(& marbl_forcing_calendar_name=fice_file, id=ind%ifrac_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1105,9 +1105,9 @@ subroutine marbl_init_surface_forcing_fields(& marbl_driver_varname=driver_varname, id=ind%xkw_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1123,9 +1123,9 @@ subroutine marbl_init_surface_forcing_fields(& marbl_forcing_calendar_name=xkw_file, id=ind%xkw_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1145,9 +1145,9 @@ subroutine marbl_init_surface_forcing_fields(& marbl_driver_varname=driver_varname, id=ind%atm_pressure_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1164,9 +1164,9 @@ subroutine marbl_init_surface_forcing_fields(& marbl_forcing_calendar_name=ap_file, id=ind%atm_pressure_id,& marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1183,9 +1183,9 @@ subroutine marbl_init_surface_forcing_fields(& marbl_forcing_calendar_name=dust_flux_file, id=ind%dust_flux_id,& marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1201,9 +1201,9 @@ subroutine marbl_init_surface_forcing_fields(& marbl_forcing_calendar_name=iron_flux_file, id=ind%iron_flux_id,& marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1228,9 +1228,9 @@ subroutine marbl_init_surface_forcing_fields(& id=ind%nox_flux_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if else @@ -1242,9 +1242,9 @@ subroutine marbl_init_surface_forcing_fields(& id=ind%nox_flux_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1271,9 +1271,9 @@ subroutine marbl_init_surface_forcing_fields(& id=ind%nhy_flux_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if else @@ -1286,9 +1286,9 @@ subroutine marbl_init_surface_forcing_fields(& id=ind%nhy_flux_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1308,9 +1308,9 @@ subroutine marbl_init_surface_forcing_fields(& id=ind%din_riv_flux_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1329,9 +1329,9 @@ subroutine marbl_init_surface_forcing_fields(& id=ind%dip_riv_flux_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1350,9 +1350,9 @@ subroutine marbl_init_surface_forcing_fields(& id=ind%don_riv_flux_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1371,9 +1371,9 @@ subroutine marbl_init_surface_forcing_fields(& id=ind%dop_riv_flux_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1392,9 +1392,9 @@ subroutine marbl_init_surface_forcing_fields(& id=ind%dsi_riv_flux_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1413,9 +1413,9 @@ subroutine marbl_init_surface_forcing_fields(& id=ind%dfe_riv_flux_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1434,9 +1434,9 @@ subroutine marbl_init_surface_forcing_fields(& id=ind%dic_riv_flux_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1455,9 +1455,9 @@ subroutine marbl_init_surface_forcing_fields(& id=ind%alk_riv_flux_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1476,9 +1476,9 @@ subroutine marbl_init_surface_forcing_fields(& id=ind%doc_riv_flux_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(error_msg,"(3A)") "error code returned when adding ", & + write(log_message,"(3A)") "error code returned when adding ", & trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return end if end if @@ -1508,6 +1508,7 @@ subroutine marbl_init_tracer_metadata(marbl_tracer_metadata, marbl_status_log) !----------------------------------------------------------------------- character(*), parameter :: subname = 'marbl_mod:marbl_init_tracer_metadata' + character(len=char_len) :: log_message integer (int_kind) :: non_living_biomass_ecosys_tracer_cnt ! number of non-autotroph ecosystem tracers integer (int_kind) :: n ! index for looping over tracers @@ -1531,8 +1532,8 @@ subroutine marbl_init_tracer_metadata(marbl_tracer_metadata, marbl_status_log) call marbl_check_ecosys_tracer_count_consistency(non_living_biomass_ecosys_tracer_cnt, marbl_status_log) if (marbl_status_log%labort_marbl) then - error_msg = "error code returned from marbl_check_ecosys_tracer_count_consistency" - call marbl_status_log%log_error(error_msg, subname) + log_message = "error code returned from marbl_check_ecosys_tracer_count_consistency" + call marbl_status_log%log_error(log_message, subname) return end if @@ -1540,16 +1541,16 @@ subroutine marbl_init_tracer_metadata(marbl_tracer_metadata, marbl_status_log) non_living_biomass_ecosys_tracer_cnt, n, marbl_status_log) if (marbl_status_log%labort_marbl) then - error_msg = "error code returned from marbl_init_zooplankton_tracer_metadata" - call marbl_status_log%log_error(error_msg, subname) + log_message = "error code returned from marbl_init_zooplankton_tracer_metadata" + call marbl_status_log%log_error(log_message, subname) return end if call marbl_init_autotroph_tracer_metadata(marbl_tracer_metadata, n, marbl_status_log) if (marbl_status_log%labort_marbl) then - error_msg = "error code returned from marbl_init_autotroph_tracer_metadata" - call marbl_status_log%log_error(error_msg, subname) + log_message = "error code returned from marbl_init_autotroph_tracer_metadata" + call marbl_status_log%log_error(log_message, subname) return end if @@ -1633,6 +1634,7 @@ subroutine marbl_set_interior_forcing( & ! local variables !----------------------------------------------------------------------- character(*), parameter :: subname = 'marbl_mod:marbl_set_interior_forcing' + character(len=char_len) :: log_message integer (int_kind) :: auto_ind ! autotroph functional group index integer (int_kind) :: auto_ind2 ! autotroph functional group index @@ -1735,8 +1737,8 @@ subroutine marbl_set_interior_forcing( & zsat_calcite(:), zsat_aragonite(:), marbl_status_log) if (marbl_status_log%labort_marbl) then - error_msg = "error code returned from marbl_compute_carbonate_chemistry" - call marbl_status_log%log_error(error_msg, subname) + log_message = "error code returned from marbl_compute_carbonate_chemistry" + call marbl_status_log%log_error(log_message, subname) return end if @@ -1808,8 +1810,8 @@ subroutine marbl_set_interior_forcing( & other_remin(k), fesedflux(k), ciso_on, marbl_status_log) if (marbl_status_log%labort_marbl) then - error_msg = "error code returned from marbl_compute_particulate_terms" - call marbl_status_log%log_error(error_msg, subname) + log_message = "error code returned from marbl_compute_particulate_terms" + call marbl_status_log%log_error(log_message, subname) return end if @@ -1881,8 +1883,8 @@ subroutine marbl_set_interior_forcing( & interior_forcing_diags, & marbl_status_log) if (marbl_status_log%labort_marbl) then - error_msg = "error code returned from marbl_diagnostics_set_interior_forcing" - call marbl_status_log%log_error(error_msg, "marbl_interface::set_interior_forcing") + log_message = "error code returned from marbl_diagnostics_set_interior_forcing" + call marbl_status_log%log_error(log_message, "marbl_interface::set_interior_forcing") return end if @@ -1906,8 +1908,8 @@ subroutine marbl_set_interior_forcing( & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - error_msg = "error code returned from marbl_ciso_set_interior_forcing" - call marbl_status_log%log_error(error_msg, "marbl_interface::set_interior_forcing") + log_message = "error code returned from marbl_ciso_set_interior_forcing" + call marbl_status_log%log_error(log_message, "marbl_interface::set_interior_forcing") return end if end if @@ -2157,6 +2159,7 @@ subroutine marbl_compute_particulate_terms(k, domain, & character(*), parameter :: & subname = 'marbl_mod:compute_particulate_terms' + character(len=char_len) :: log_message real (r8) :: TfuncS ! temperature scaling from soft POM remin @@ -2640,8 +2643,8 @@ subroutine marbl_compute_particulate_terms(k, domain, & endif if (poc_error) then - write(error_msg, "(A)") "mass ratio of ballast production exceeds POC production" - call marbl_status_log%log_error(error_msg, subname) + write(log_message, "(A)") "mass ratio of ballast production exceeds POC production" + call marbl_status_log%log_error(log_message, subname) endif end associate @@ -2715,6 +2718,7 @@ subroutine marbl_set_surface_forcing( & ! local variables !----------------------------------------------------------------------- character(*), parameter :: subname = 'marbl_mod:marbl_set_surface_forcing' + character(len=char_len) :: log_message integer (int_kind) :: n ! loop indices integer (int_kind) :: auto_ind ! autotroph functional group index real (r8) :: phlo(num_elements) ! lower bound for ph in solver @@ -2905,8 +2909,8 @@ subroutine marbl_set_surface_forcing( & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - error_msg = "error code returned from co2calc_surf" - call marbl_status_log%log_error(error_msg, subname) + log_message = "error code returned from co2calc_surf" + call marbl_status_log%log_error(log_message, subname) return end if @@ -2965,8 +2969,8 @@ subroutine marbl_set_surface_forcing( & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - error_msg = "error code returned from co2calc_surf" - call marbl_status_log%log_error(error_msg, subname) + log_message = "error code returned from co2calc_surf" + call marbl_status_log%log_error(log_message, subname) return end if @@ -3288,6 +3292,7 @@ subroutine marbl_check_ecosys_tracer_count_consistency(non_living_biomass_ecosys zoo_ind ! zooplankton functional group index character(*), parameter :: subname = 'marbl_mod:check_ecosys_tracer_count_consistency' + character(len=char_len) :: log_message !----------------------------------------------------------------------- ! confirm that ecosys_tracer_cnt is consistent with autotroph declarations @@ -3306,9 +3311,9 @@ subroutine marbl_check_ecosys_tracer_count_consistency(non_living_biomass_ecosys end do if (ecosys_tracer_cnt /= n) then - write(error_msg, "(4A)") "ecosys_tracer_cnt = ", ecosys_tracer_cnt, & + write(log_message, "(4A)") "ecosys_tracer_cnt = ", ecosys_tracer_cnt, & "but computed ecosys_tracer_cnt = ", n - call marbl_status_log%log_error(error_msg, subname) + call marbl_status_log%log_error(log_message, subname) return endif @@ -3334,6 +3339,7 @@ subroutine marbl_init_zooplankton_tracer_metadata(marbl_tracer_metadata, & ! local variables !----------------------------------------------------------------------- character(*), parameter :: subname = "marbl_mod:marbl_init_zooplankton_tracer_metadata" + character(len=char_len) :: log_message integer (int_kind) :: zoo_ind ! zooplankton functional group index !----------------------------------------------------------------------- @@ -3349,16 +3355,16 @@ subroutine marbl_init_zooplankton_tracer_metadata(marbl_tracer_metadata, & n = n + 1 end do - write (status_msg, "(A)") '----- zooplankton tracer indices -----' - call marbl_status_log%log_noerror(status_msg, subname) + write (log_message, "(A)") '----- zooplankton tracer indices -----' + call marbl_status_log%log_noerror(log_message, subname) do zoo_ind = 1, zooplankton_cnt - write (status_msg, "(3A,I0)") 'C_ind(', trim(zooplankton(zoo_ind)%sname), ') = ', zooplankton(zoo_ind)%C_ind - call marbl_status_log%log_noerror(status_msg, subname) + write (log_message, "(3A,I0)") 'C_ind(', trim(zooplankton(zoo_ind)%sname), ') = ', zooplankton(zoo_ind)%C_ind + call marbl_status_log%log_noerror(log_message, subname) end do - write (status_msg, "(A,I0)") 'zooplankton_cnt = ', zooplankton_cnt - call marbl_status_log%log_noerror(status_msg, subname) - write (status_msg, "(A)") '------------------------------------' - call marbl_status_log%log_noerror(status_msg, subname) + write (log_message, "(A,I0)") 'zooplankton_cnt = ', zooplankton_cnt + call marbl_status_log%log_noerror(log_message, subname) + write (log_message, "(A)") '------------------------------------' + call marbl_status_log%log_noerror(log_message, subname) end subroutine marbl_init_zooplankton_tracer_metadata @@ -3380,6 +3386,7 @@ subroutine marbl_init_autotroph_tracer_metadata(marbl_tracer_metadata, n, marbl_ ! local variables !----------------------------------------------------------------------- character(*), parameter :: subname = "marbl_mod:marbl_init_autotroph_tracer_metadata" + character(len=char_len) :: log_message integer (int_kind) :: auto_ind ! zooplankton functional group index !----------------------------------------------------------------------- @@ -3434,24 +3441,24 @@ subroutine marbl_init_autotroph_tracer_metadata(marbl_tracer_metadata, n, marbl_ endif end do - write (status_msg, "(A)") '----- autotroph tracer indices -----' - call marbl_status_log%log_noerror(status_msg, subname) + write (log_message, "(A)") '----- autotroph tracer indices -----' + call marbl_status_log%log_noerror(log_message, subname) do auto_ind = 1, autotroph_cnt - write (status_msg, "(3A,I0)") 'Chl_ind(', trim(autotrophs(auto_ind)%sname), ') = ' , autotrophs(auto_ind)%Chl_ind - call marbl_status_log%log_noerror(status_msg, subname) - write (status_msg, "(3A,I0)") 'C_ind(', trim(autotrophs(auto_ind)%sname), ') = ' , autotrophs(auto_ind)%C_ind - call marbl_status_log%log_noerror(status_msg, subname) - write (status_msg, "(3A,I0)") 'Fe_ind(', trim(autotrophs(auto_ind)%sname), ') = ' , autotrophs(auto_ind)%Fe_ind - call marbl_status_log%log_noerror(status_msg, subname) - write (status_msg, "(3A,I0)") 'Si_ind(', trim(autotrophs(auto_ind)%sname), ') = ' , autotrophs(auto_ind)%Si_ind - call marbl_status_log%log_noerror(status_msg, subname) - write (status_msg, "(3A,I0)") 'CaCO3_ind(', trim(autotrophs(auto_ind)%sname), ') = ' , autotrophs(auto_ind)%CaCO3_ind - call marbl_status_log%log_noerror(status_msg, subname) + write (log_message, "(3A,I0)") 'Chl_ind(', trim(autotrophs(auto_ind)%sname), ') = ' , autotrophs(auto_ind)%Chl_ind + call marbl_status_log%log_noerror(log_message, subname) + write (log_message, "(3A,I0)") 'C_ind(', trim(autotrophs(auto_ind)%sname), ') = ' , autotrophs(auto_ind)%C_ind + call marbl_status_log%log_noerror(log_message, subname) + write (log_message, "(3A,I0)") 'Fe_ind(', trim(autotrophs(auto_ind)%sname), ') = ' , autotrophs(auto_ind)%Fe_ind + call marbl_status_log%log_noerror(log_message, subname) + write (log_message, "(3A,I0)") 'Si_ind(', trim(autotrophs(auto_ind)%sname), ') = ' , autotrophs(auto_ind)%Si_ind + call marbl_status_log%log_noerror(log_message, subname) + write (log_message, "(3A,I0)") 'CaCO3_ind(', trim(autotrophs(auto_ind)%sname), ') = ' , autotrophs(auto_ind)%CaCO3_ind + call marbl_status_log%log_noerror(log_message, subname) end do - write (status_msg, "(A,I0)") 'autotroph_cnt = ', autotroph_cnt - call marbl_status_log%log_noerror(status_msg, subname) - write (status_msg, "(A)") '------------------------------------' - call marbl_status_log%log_noerror(status_msg, subname) + write (log_message, "(A,I0)") 'autotroph_cnt = ', autotroph_cnt + call marbl_status_log%log_noerror(log_message, subname) + write (log_message, "(A)") '------------------------------------' + call marbl_status_log%log_noerror(log_message, subname) end subroutine marbl_init_autotroph_tracer_metadata @@ -3869,6 +3876,7 @@ subroutine marbl_compute_carbonate_chemistry(domain, interior_forcing_input, & ! local variables !----------------------------------------------------------------------- character(*), parameter :: subname = 'marbl_mod:marbl_compute_carbonate_chemistry' + character(len=char_len) :: log_message integer :: k type(thermodynamic_coefficients_type), dimension(domain%km) :: co3_coeffs logical(log_kind) , dimension(domain%km) :: mask @@ -3934,8 +3942,8 @@ subroutine marbl_compute_carbonate_chemistry(domain, interior_forcing_input, & marbl_status_log) if (marbl_status_log%labort_marbl) then - error_msg = "error code returned from conp_CO3terms" - call marbl_status_log%log_error(error_msg, subname) + log_message = "error code returned from conp_CO3terms" + call marbl_status_log%log_error(log_message, subname) return end if @@ -3961,8 +3969,8 @@ subroutine marbl_compute_carbonate_chemistry(domain, interior_forcing_input, & hco3_alt_co2, co3_alt_co2, marbl_status_log) if (marbl_status_log%labort_marbl) then - error_msg = "error code returned from comp_CO3terms" - call marbl_status_log%log_error(error_msg, subname) + log_message = "error code returned from comp_CO3terms" + call marbl_status_log%log_error(log_message, subname) return end if diff --git a/src/marbl_restore_mod.F90 b/src/marbl_restore_mod.F90 index ec77a3f6..df97c03c 100644 --- a/src/marbl_restore_mod.F90 +++ b/src/marbl_restore_mod.F90 @@ -43,8 +43,6 @@ subroutine init(this, nl_buffer, domain, tracer_metadata, status_log) use marbl_kinds_mod , only : char_len, int_kind, i4, log_kind use marbl_logging , only : marbl_log_type - use marbl_logging , only : error_msg - use marbl_logging , only : status_msg use marbl_interface_types, only : marbl_tracer_metadata_type use marbl_namelist_mod, only : marbl_nl_cnt use marbl_namelist_mod, only : marbl_nl_buffer_size @@ -79,6 +77,7 @@ subroutine init(this, nl_buffer, domain, tracer_metadata, status_log) integer(int_kind) :: nml_error, k, n, t character(len=marbl_nl_buffer_size) :: tmp_nl_buffer character(*), parameter :: subname = 'ecosys_restore:Init' + character(len=char_len) :: log_message !----------------------------------------------------------------------- @@ -110,8 +109,8 @@ subroutine init(this, nl_buffer, domain, tracer_metadata, status_log) tmp_nl_buffer = marbl_namelist(nl_buffer, 'ecosys_restore_nml') read(tmp_nl_buffer, nml=ecosys_restore_nml, iostat=nml_error) if (nml_error /= 0) then - error_msg = "Error reading ecosys_restore_nml" - call status_log%log_error(error_msg, subname) + log_message = "Error reading ecosys_restore_nml" + call status_log%log_error(log_message, subname) return else ! FIXME #16: this is printing contents of pop_in, not the entire ecosys_restore_nml @@ -136,21 +135,21 @@ subroutine init(this, nl_buffer, domain, tracer_metadata, status_log) endif ! FIXME #35: assert(len(restore_short_names) == len(restore_filenames)) - write(status_msg, "(A)") "Found restore variables : " - call status_log%log_noerror(status_msg, subname) + write(log_message, "(A)") "Found restore variables : " + call status_log%log_noerror(log_message, subname) do t = 1, size(restore_short_names) if (len(trim(restore_short_names(t))) > 0) then this%lrestore_any = .true. - write(status_msg, "(6A)") trim(restore_short_names(t)), " --> ", & + write(log_message, "(6A)") trim(restore_short_names(t)), " --> ", & trim(restore_filenames(t)), " [ ", trim(restore_file_varnames(t)), " ]" - call status_log%log_noerror(status_msg, subname) + call status_log%log_noerror(log_message, subname) do n=1,size(tracer_metadata) if (trim(restore_short_names(t)).eq.trim(tracer_metadata(n)%short_name)) exit end do if (n.le.size(tracer_metadata)) then - write(status_msg, "(3A,I0)") "Index for ", trim(restore_short_names(t)), & + write(log_message, "(3A,I0)") "Index for ", trim(restore_short_names(t)), & " is ", n - call status_log%log_noerror(status_msg, subname) + call status_log%log_noerror(log_message, subname) allocate(this%tracer_restore(n)%inv_tau(domain%km)) allocate(this%tracer_restore(n)%climatology(domain%km)) this%tracer_restore(n)%inv_tau(:) = inv_tau @@ -158,8 +157,8 @@ subroutine init(this, nl_buffer, domain, tracer_metadata, status_log) this%tracer_restore(n)%file_metadata%filename = trim(restore_filenames(t)) this%tracer_restore(n)%file_metadata%file_varname = trim(restore_file_varnames(t)) else - write(error_msg, "(2A)") "Can not find tracer named ", trim(restore_short_names(t)) - call status_log%log_error(error_msg, subname) + write(log_message, "(2A)") "Can not find tracer named ", trim(restore_short_names(t)) + call status_log%log_error(log_message, subname) end if end if end do From e257a8c1cf04a6db233e0dbfe8a6304eca3647e9 Mon Sep 17 00:00:00 2001 From: Michael Levy Date: Tue, 5 Apr 2016 15:42:14 -0600 Subject: [PATCH 04/11] First pass removing 'error code returned' messages I created a new subroutine to standardize the error traceback in MARBL. When first encountering an error, call LOG%log_error() and return; every subsequent call should be to LOG%log_error_trace, which takes the name of the routine that produced the error as an argument rather than a log message. Note that this is just a wrapper script - log_error_trace creates the log message "Error reported from [routine name]" and then calls LOG%log_error with that message. I say "first pass" because I still need to adapt the errors from add_diagnostics() and add_forcing_field(), where I want to include the name of the diagnostic [or forcing] field that produced the error. I was originally thinking that I should add an optional argument for field name, but instead I might treat add_forcing_field([FIELDNAME]) as the routine name. --- src/marbl_ciso_mod.F90 | 4 +-- src/marbl_co2calc_mod.F90 | 12 +++------ src/marbl_interface.F90 | 28 ++++++++------------- src/marbl_interface_types.F90 | 10 +++----- src/marbl_logging.F90 | 13 ++++++++++ src/marbl_mod.F90 | 47 ++++++++++++++--------------------- 6 files changed, 49 insertions(+), 65 deletions(-) diff --git a/src/marbl_ciso_mod.F90 b/src/marbl_ciso_mod.F90 index 0bd81d1f..e8f059e9 100644 --- a/src/marbl_ciso_mod.F90 +++ b/src/marbl_ciso_mod.F90 @@ -470,7 +470,6 @@ subroutine marbl_ciso_set_interior_forcing( & ! local variables !----------------------------------------------------------------------- character(*), parameter :: subname = 'marbl_ciso_mod:marbl_ciso_set_interior forcing' - character(len=char_len) :: log_message logical (log_kind) :: zero_mask @@ -645,8 +644,7 @@ subroutine marbl_ciso_set_interior_forcing( & cell_radius, cell_permea, cell_eps_fix, marbl_status_log) if (marbl_status_log%labort_marbl) then - log_message = "error code returned from setup_cell_attributes" - call marbl_status_log%log_error(log_message, subname) + call marbl_status_log%log_error_trace("setup_cell_attributes", subname) return end if diff --git a/src/marbl_co2calc_mod.F90 b/src/marbl_co2calc_mod.F90 index d31ec57f..b48ecd84 100644 --- a/src/marbl_co2calc_mod.F90 +++ b/src/marbl_co2calc_mod.F90 @@ -136,7 +136,6 @@ subroutine marbl_co2calc_surf( & ! local variable declarations !--------------------------------------------------------------------------- character(*), parameter :: subname = 'marbl_co2calc:marbl_co2calc_surf' - character(len=char_len) :: log_message integer(kind=int_kind) :: n integer(kind=int_kind) :: k real(kind=r8) :: mass_to_vol ! (mol/kg) -> (mmol/m^3) @@ -201,8 +200,7 @@ subroutine marbl_co2calc_surf( & if (present (marbl_status_log)) then if (marbl_status_log%labort_marbl) then - log_message = "error code returned from comp_htotal" - call marbl_status_log%log_error(log_message, subname) + call marbl_status_log%log_error_trace("comp_htotal()", subname) return end if end if @@ -306,7 +304,6 @@ subroutine marbl_comp_CO3terms(& ! local variable declarations !--------------------------------------------------------------------------- character(*), parameter :: subname = 'marbl_co2calc:marbl_comp_CO3terms' - character(len=char_len) :: log_message 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) @@ -372,8 +369,7 @@ subroutine marbl_comp_CO3terms(& phlo, phhi, htotal, marbl_status_log) if (marbl_status_log%labort_marbl) then - log_message = "error code returned from comp_htotal" - call marbl_status_log%log_error(log_message, subname) + call marbl_status_log%log_error_trace("comp_htotal()", subname) return end if @@ -791,7 +787,6 @@ subroutine comp_htotal(num_elements, mask, temp, dic_in, ta_in, pt_in, sit_in, & ! local variable declarations !--------------------------------------------------------------------------- character(*), parameter :: subname = 'marbl_co2calc:marbl_comp_htotal' - character(len=char_len) :: log_message 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) @@ -869,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 - log_message = "error code returned from drtsafe" - call marbl_status_log%log_error(log_message, subname) + call marbl_status_log%log_error_trace("drtsafe", subname) return end if diff --git a/src/marbl_interface.F90 b/src/marbl_interface.F90 index 275bec97..b25ae7e3 100644 --- a/src/marbl_interface.F90 +++ b/src/marbl_interface.F90 @@ -153,7 +153,7 @@ subroutine init(this, & real (r8) , intent(in) :: gcm_zw(gcm_num_levels) ! thickness of layer k real (r8) , intent(in) :: gcm_zt(gcm_num_levels) ! thickness of layer k - character(len=char_len) :: log_message + character(*), parameter :: subname = 'marbl_interface:marbl_init' integer :: i !-------------------------------------------------------------------- @@ -176,16 +176,14 @@ subroutine init(this, & call marbl_init_nml(gcm_nl_buffer, this%statusLog) if (this%statusLog%labort_marbl) then - call this%statusLog%log_error("error code returned from marbl_init_nml", & - "marbl_interface::marbl_init()") + call this%statusLog%log_error_trace("marbl_init_nml()", subname) return end if if (gcm_ciso_on) then call marbl_ciso_init_nml(gcm_nl_buffer, this%statusLog) if (this%statusLog%labort_marbl) then - call this%statusLog%log_error("error code returned from marbl_ciso_init_nml", & - "marbl_interface::marbl_init()") + call this%statusLog%log_error_trace("marbl_ciso_init_nml()", subname) return end if end if @@ -246,8 +244,7 @@ subroutine init(this, & this%statusLog) if (this%statusLog%labort_marbl) then - call this%statusLog%log_error("error code returned from marbl_init_tracer_metadata", & - "marbl_interface::marbl_init()") + call this%statusLog%log_error_trace("marbl_init_tracer_metadata()", subname) return end if @@ -257,8 +254,7 @@ subroutine init(this, & this%statusLog) if (this%statusLog%labort_marbl) then - call this%statusLog%log_error("error code returned from marbl_ciso_init_tracer_metadata", & - "marbl_interface::marbl_init()") + call this%statusLog%log_error_trace("marbl_ciso_init_tracer_metadata()", subname) return end if end if @@ -275,8 +271,7 @@ subroutine init(this, & surface_forcing_fields = this%surface_forcing_fields, & marbl_status_log = this%StatusLog) if (this%statusLog%labort_marbl) then - log_message = "error code returned from marbl_init_surface_forcing_fields" - call this%statusLog%log_error(log_message, "marbl_interface::marbl_init()") + call this%statusLog%log_error_trace("marbl_init_surface_forcing_fields()", subname) return end if @@ -292,8 +287,7 @@ subroutine init(this, & tracer_metadata = this%tracer_metadata(ecosys_ind_beg:ecosys_ind_end), & status_log = this%statusLog) if (this%statusLog%labort_marbl) then - call this%statusLog%log_error("error code returned from this%restoring%init", & - "marbl_interface::marbl_init()") + call this%statusLog%log_error_trace("this%restoring%init()", subname) return end if @@ -310,8 +304,7 @@ subroutine init(this, & marbl_surface_forcing_diags = this%surface_forcing_diags, & marbl_status_log = this%StatusLog) if (this%statusLog%labort_marbl) then - call this%statusLog%log_error("error code returned from marbl_diagnostics_init", & - "marbl_interface::marbl_init()") + call this%statusLog%log_error_trace("marbl_diagnostics_init()", subname) return end if @@ -328,7 +321,7 @@ subroutine set_interior_forcing(this) implicit none class(marbl_interface_class), intent(inout) :: this - character(len=char_len) :: log_message + character(*), parameter :: subname='marbl_interface:set_interior_forcing' call this%restoring%restore_tracers( & this%column_tracers, & @@ -354,8 +347,7 @@ subroutine set_interior_forcing(this) marbl_status_log = this%statusLog) if (this%statusLog%labort_marbl) then - log_message = "error code returned from marbl_set_interior_forcing" - call this%statusLog%log_error(log_message, "marbl_interface::set_interior_forcing") + call this%statusLog%log_error_trace("marbl_set_interior_forcing()", subname) return end if diff --git a/src/marbl_interface_types.F90 b/src/marbl_interface_types.F90 index f35187bf..0813ff10 100644 --- a/src/marbl_interface_types.F90 +++ b/src/marbl_interface_types.F90 @@ -451,7 +451,6 @@ subroutine marbl_sfo_add(this, num_elements, field_name, sfo_id, & type(marbl_single_sfo_type), dimension(:), pointer :: new_sfo integer :: n, old_size character(len=*), parameter :: subname = 'marbl_interface_types:marbl_sfo_add' - character(len=char_len) :: log_message if (associated(this%sfo)) then old_size = size(this%sfo) @@ -477,8 +476,7 @@ subroutine marbl_sfo_add(this, num_elements, field_name, sfo_id, & call new_sfo(sfo_id)%construct(num_elements, field_name, sfo_id, & marbl_status_log) if (marbl_status_log%labort_marbl) then - log_message = "error code returned from new_sfo%construct" - call marbl_status_log%log_error(log_message, subname) + call marbl_status_log%log_error_trace('new_sfo%construct()', subname) return end if @@ -563,8 +561,7 @@ subroutine marbl_diagnostics_add(this, lname, sname, units, vgrid, & call this%diags(id)%initialize(lname, sname, units, vgrid, truncate, & this%num_elements, this%num_levels, marbl_status_log) if (marbl_status_log%labort_marbl) then - log_message = "error code returned from this%diags%initialize" - call marbl_status_log%log_error(log_message, subname) + call marbl_status_log%log_error_trace('this%diags%initialize()', subname) return end if @@ -873,8 +870,7 @@ subroutine marbl_forcing_fields_add(this, & marbl_forcing_calendar_name=marbl_forcing_calendar_name, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_MARBL) then - log_message = "error code returned from this%forcing_fields%initialize" - call marbl_status_log%log_error(log_message, subname) + call marbl_status_log%log_error_trace('this%forcing_fields%initialize()', subname) return end if diff --git a/src/marbl_logging.F90 b/src/marbl_logging.F90 index a286900a..e4b7bbaf 100644 --- a/src/marbl_logging.F90 +++ b/src/marbl_logging.F90 @@ -44,6 +44,7 @@ module marbl_logging procedure, public :: log_namelist => marbl_log_namelist procedure, public :: log_error => marbl_log_error procedure, public :: log_noerror => marbl_log_noerror + procedure, public :: log_error_trace => marbl_log_error_trace procedure, public :: erase => marbl_log_erase end type marbl_log_type @@ -215,6 +216,18 @@ subroutine marbl_log_noerror(this, StatusMsg, CodeLoc, ElemInd, lall_tasks) end subroutine marbl_log_noerror + subroutine marbl_log_error_trace(this, RoutineName, CodeLoc, ElemInd) + + class(marbl_log_type), intent(inout) :: this + character(len=*), intent(in) :: RoutineName, CodeLoc + integer, optional, intent(in) :: ElemInd + character(len=char_len) :: log_message + + write(log_message, "(2A)") "Error reported from ", trim(RoutineName) + call this%log_error(log_message, CodeLoc, ElemInd) + + end subroutine marbl_log_error_trace + subroutine marbl_log_erase(this) class(marbl_log_type), intent(inout) :: this diff --git a/src/marbl_mod.F90 b/src/marbl_mod.F90 index 3dac0c4b..a35a175c 100644 --- a/src/marbl_mod.F90 +++ b/src/marbl_mod.F90 @@ -740,8 +740,7 @@ subroutine marbl_init_nml(nl_buffer, marbl_status_log) ! FIXME #11: eliminate marbl_parms! call marbl_params_init(nl_buffer, marbl_status_log) if (marbl_status_log%labort_marbl) then - log_message = "error code returned from marbl_params_init" - call marbl_status_log%log_error(log_message, subname) + call marbl_status_log%log_error_trace('marbl_params_init', subname) return end if @@ -1508,7 +1507,6 @@ subroutine marbl_init_tracer_metadata(marbl_tracer_metadata, marbl_status_log) !----------------------------------------------------------------------- character(*), parameter :: subname = 'marbl_mod:marbl_init_tracer_metadata' - character(len=char_len) :: log_message integer (int_kind) :: non_living_biomass_ecosys_tracer_cnt ! number of non-autotroph ecosystem tracers integer (int_kind) :: n ! index for looping over tracers @@ -1532,8 +1530,8 @@ subroutine marbl_init_tracer_metadata(marbl_tracer_metadata, marbl_status_log) call marbl_check_ecosys_tracer_count_consistency(non_living_biomass_ecosys_tracer_cnt, marbl_status_log) if (marbl_status_log%labort_marbl) then - log_message = "error code returned from marbl_check_ecosys_tracer_count_consistency" - call marbl_status_log%log_error(log_message, subname) + call marbl_status_log%log_error_trace( & + 'marbl_check_ecosys_tracer_count_consistency()', subname) return end if @@ -1541,16 +1539,16 @@ subroutine marbl_init_tracer_metadata(marbl_tracer_metadata, marbl_status_log) non_living_biomass_ecosys_tracer_cnt, n, marbl_status_log) if (marbl_status_log%labort_marbl) then - log_message = "error code returned from marbl_init_zooplankton_tracer_metadata" - call marbl_status_log%log_error(log_message, subname) + call marbl_status_log%log_error_trace('marbl_init_zooplankton_tracer_metadata()', & + subname) return end if call marbl_init_autotroph_tracer_metadata(marbl_tracer_metadata, n, marbl_status_log) if (marbl_status_log%labort_marbl) then - log_message = "error code returned from marbl_init_autotroph_tracer_metadata" - call marbl_status_log%log_error(log_message, subname) + call marbl_status_log%log_error_trace('marbl_init_autortoph_tracer_metadata()', & + subname) return end if @@ -1634,7 +1632,6 @@ subroutine marbl_set_interior_forcing( & ! local variables !----------------------------------------------------------------------- character(*), parameter :: subname = 'marbl_mod:marbl_set_interior_forcing' - character(len=char_len) :: log_message integer (int_kind) :: auto_ind ! autotroph functional group index integer (int_kind) :: auto_ind2 ! autotroph functional group index @@ -1737,8 +1734,8 @@ subroutine marbl_set_interior_forcing( & zsat_calcite(:), zsat_aragonite(:), marbl_status_log) if (marbl_status_log%labort_marbl) then - log_message = "error code returned from marbl_compute_carbonate_chemistry" - call marbl_status_log%log_error(log_message, subname) + call marbl_status_log%log_error_trace(& + 'marbl_check_ecosys_tracer_count_consistency()', subname) return end if @@ -1810,8 +1807,8 @@ subroutine marbl_set_interior_forcing( & other_remin(k), fesedflux(k), ciso_on, marbl_status_log) if (marbl_status_log%labort_marbl) then - log_message = "error code returned from marbl_compute_particulate_terms" - call marbl_status_log%log_error(log_message, subname) + call marbl_status_log%log_error_trace('marbl_compute_particulate_terms()', & + subname) return end if @@ -1883,8 +1880,8 @@ subroutine marbl_set_interior_forcing( & interior_forcing_diags, & marbl_status_log) if (marbl_status_log%labort_marbl) then - log_message = "error code returned from marbl_diagnostics_set_interior_forcing" - call marbl_status_log%log_error(log_message, "marbl_interface::set_interior_forcing") + call marbl_status_log%log_error_trace(& + 'marbl_diagnostics_set_interior_foricng()', subname) return end if @@ -1908,8 +1905,8 @@ subroutine marbl_set_interior_forcing( & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - log_message = "error code returned from marbl_ciso_set_interior_forcing" - call marbl_status_log%log_error(log_message, "marbl_interface::set_interior_forcing") + call marbl_status_log%log_error_trace(& + 'marbl_ciso_set_interior_foricng()', subname) return end if end if @@ -2718,7 +2715,6 @@ subroutine marbl_set_surface_forcing( & ! local variables !----------------------------------------------------------------------- character(*), parameter :: subname = 'marbl_mod:marbl_set_surface_forcing' - character(len=char_len) :: log_message integer (int_kind) :: n ! loop indices integer (int_kind) :: auto_ind ! autotroph functional group index real (r8) :: phlo(num_elements) ! lower bound for ph in solver @@ -2909,8 +2905,7 @@ subroutine marbl_set_surface_forcing( & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - log_message = "error code returned from co2calc_surf" - call marbl_status_log%log_error(log_message, subname) + call marbl_status_log%log_error_trace('co2calc_surf()', subname) return end if @@ -2969,8 +2964,7 @@ subroutine marbl_set_surface_forcing( & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - log_message = "error code returned from co2calc_surf" - call marbl_status_log%log_error(log_message, subname) + call marbl_status_log%log_error_trace('co2calc_surf()', subname) return end if @@ -3876,7 +3870,6 @@ subroutine marbl_compute_carbonate_chemistry(domain, interior_forcing_input, & ! local variables !----------------------------------------------------------------------- character(*), parameter :: subname = 'marbl_mod:marbl_compute_carbonate_chemistry' - character(len=char_len) :: log_message integer :: k type(thermodynamic_coefficients_type), dimension(domain%km) :: co3_coeffs logical(log_kind) , dimension(domain%km) :: mask @@ -3942,8 +3935,7 @@ subroutine marbl_compute_carbonate_chemistry(domain, interior_forcing_input, & marbl_status_log) if (marbl_status_log%labort_marbl) then - log_message = "error code returned from conp_CO3terms" - call marbl_status_log%log_error(log_message, subname) + call marbl_status_log%log_error_trace('marbl_comp_CO3terms()', subname) return end if @@ -3969,8 +3961,7 @@ subroutine marbl_compute_carbonate_chemistry(domain, interior_forcing_input, & hco3_alt_co2, co3_alt_co2, marbl_status_log) if (marbl_status_log%labort_marbl) then - log_message = "error code returned from comp_CO3terms" - call marbl_status_log%log_error(log_message, subname) + call marbl_status_log%log_error_trace('marbl_comp_CO3terms()', subname) return end if From 8213853688f6fd9940876d65465ce5eed8930e1a Mon Sep 17 00:00:00 2001 From: Michael Levy Date: Tue, 5 Apr 2016 16:43:59 -0600 Subject: [PATCH 05/11] Remove 'error code returned' from diagnostics mod I created a wrapper routine in marbl_diagnostics_mod that calls LOG%log_error_trace when labort_marbl is detecting from an add_diags call. Something similar should be used in marbl_mod for the forcing fields. --- src/marbl_diagnostics_mod.F90 | 915 +++++++++------------------------- 1 file changed, 240 insertions(+), 675 deletions(-) diff --git a/src/marbl_diagnostics_mod.F90 b/src/marbl_diagnostics_mod.F90 index dd3538d2..55397218 100644 --- a/src/marbl_diagnostics_mod.F90 +++ b/src/marbl_diagnostics_mod.F90 @@ -379,7 +379,6 @@ subroutine marbl_diagnostics_init( & character(len=char_len) :: lname, sname, units, vgrid character(*), parameter :: subname = "marbl_diagnostics_mod:marbl_diagnostics_init" - character(len=char_len) :: log_message !----------------------------------------------------------------------- !----------------------------------------------------------------- @@ -423,9 +422,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%ECOSYS_IFRAC, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -441,9 +438,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%ECOSYS_XKW, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -459,9 +454,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%ECOSYS_ATM_PRESS, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -477,9 +470,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%PV_O2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -495,9 +486,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%SCHMIDT_O2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -513,9 +502,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%O2SAT, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -531,9 +518,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%O2_GAS_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -549,9 +534,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CO2STAR, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -567,9 +550,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DCO2STAR, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -585,9 +566,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%pCO2SURF, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -603,9 +582,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DpCO2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -621,9 +598,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%PV_CO2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -639,9 +614,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%SCHMIDT_CO2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -657,9 +630,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DIC_GAS_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -675,9 +646,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%PH, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -693,9 +662,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%ATM_CO2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -711,9 +678,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CO2STAR_ALT_CO2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -729,9 +694,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DCO2STAR_ALT_CO2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -747,9 +710,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%pCO2SURF_ALT_CO2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -765,9 +726,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DpCO2_ALT_CO2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -783,9 +742,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DIC_GAS_FLUX_ALT_CO2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -801,9 +758,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%PH_ALT_CO2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -819,9 +774,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%ATM_ALT_CO2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -837,9 +790,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%IRON_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -855,9 +806,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DUST_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -873,9 +822,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%NOx_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -891,9 +838,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%NHy_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -909,9 +854,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DIN_RIV_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -927,9 +870,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DIP_RIV_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -945,9 +886,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DON_RIV_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -963,9 +902,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DONr_RIV_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -981,9 +918,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DOP_RIV_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -999,9 +934,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DOPr_RIV_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1017,9 +950,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DSI_RIV_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1035,9 +966,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DFE_RIV_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1053,9 +982,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DIC_RIV_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1071,9 +998,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%ALK_RIV_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1089,9 +1014,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DOC_RIV_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1107,9 +1030,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DOCr_RIV_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1131,9 +1052,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DI13C_GAS_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1149,9 +1068,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DI13C_AS_GAS_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1167,9 +1084,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DI13C_SA_GAS_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1185,9 +1100,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_d13C_GAS_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1203,9 +1116,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_D13C_atm, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1221,9 +1132,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_R13C_DIC_surf, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1239,9 +1148,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_R13C_atm, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1257,9 +1164,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DI13C_RIV_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1275,9 +1180,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DO13C_RIV_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1293,9 +1196,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_eps_aq_g_surf, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1311,9 +1212,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_eps_dic_g_surf, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1329,9 +1228,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DI14C_GAS_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1347,9 +1244,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DI14C_AS_GAS_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1365,9 +1260,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DI14C_SA_GAS_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1383,9 +1276,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_d14C_GAS_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1401,9 +1292,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_D14C_atm, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1419,9 +1308,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_R14C_DIC_surf, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1437,9 +1324,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_R14C_atm, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1455,9 +1340,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DI14C_RIV_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1473,9 +1356,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DO14C_RIV_FLUX, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1491,9 +1372,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_GLOBAL_D14C, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1522,9 +1401,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%zsatcalc, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1540,9 +1417,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%zsatarag, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1558,9 +1433,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%O2_ZMIN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1576,9 +1449,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%O2_ZMIN_DEPTH, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1594,9 +1465,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%photoC_TOT_zint, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1612,9 +1481,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%photoC_NO3_TOT_zint, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1630,9 +1497,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%Jint_Ctot, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1648,9 +1513,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%Jint_100m_Ctot, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1666,9 +1529,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%Jint_Ntot, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1684,9 +1545,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%Jint_100m_Ntot, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1702,9 +1561,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%Jint_Ptot, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1720,9 +1577,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%Jint_100m_Ptot, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1738,9 +1593,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%Jint_Sitot, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1756,9 +1609,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%Jint_100m_Sitot, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1774,9 +1625,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%Jint_Fetot, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1792,9 +1641,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%Jint_100m_Fetot, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1811,9 +1658,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%calcToSed, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1829,9 +1674,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%pocToSed, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1847,9 +1690,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%ponToSed, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1865,9 +1706,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%SedDenitrif, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1883,9 +1722,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%OtherRemin, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1901,9 +1738,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%popToSed, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1919,9 +1754,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%bsiToSed, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1937,9 +1770,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%dustToSed, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1955,9 +1786,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%pfeToSed, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1975,9 +1804,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%photoC_zint(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -1993,9 +1820,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%photoC_NO3_zint(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2012,9 +1837,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CaCO3_form_zint(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if else @@ -2034,9 +1857,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%tot_CaCO3_form_zint, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2053,9 +1874,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CO3, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2071,9 +1890,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%HCO3, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2089,9 +1906,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%H2CO3, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2107,9 +1922,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%ph_3D, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2125,9 +1938,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CO3_ALT_CO2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2143,9 +1954,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%HCO3_ALT_CO2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2161,9 +1970,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%H2CO3_ALT_CO2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2179,9 +1986,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%ph_3D_ALT_CO2, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2197,9 +2002,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%co3_sat_calc, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2215,9 +2018,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%co3_sat_arag, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2233,9 +2034,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%NITRIF, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2251,9 +2050,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DENITRIF, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2269,9 +2066,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%O2_PRODUCTION, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2287,9 +2082,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%O2_CONSUMPTION, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2305,9 +2098,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%AOU, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2323,9 +2114,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%PAR_avg, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2341,9 +2130,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%auto_graze_TOT, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2359,9 +2146,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%photoC_TOT, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2377,9 +2162,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%photoC_NO3_TOT, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2395,9 +2178,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DOC_prod, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2413,9 +2194,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DOC_remin, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2431,9 +2210,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DOCr_remin, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2449,9 +2226,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DON_prod, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2467,9 +2242,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DON_remin, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2485,9 +2258,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DONr_remin, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2503,9 +2274,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DOP_prod, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2521,9 +2290,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DOP_remin, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2539,9 +2306,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DOPr_remin, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2557,9 +2322,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%Fe_scavenge, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2575,9 +2338,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%Fe_scavenge_rate, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2594,9 +2355,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%POC_FLUX_IN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2612,9 +2371,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%POC_PROD, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2630,9 +2387,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%POC_REMIN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2648,9 +2403,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%POC_REMIN_DIC, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2666,9 +2419,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%PON_REMIN_NH4, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2684,9 +2435,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%POP_REMIN_PO4, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2702,9 +2451,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CaCO3_FLUX_IN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2720,9 +2467,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CaCO3_PROD, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2738,9 +2483,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CaCO3_REMIN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2756,9 +2499,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%SiO2_FLUX_IN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2774,9 +2515,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%SiO2_PROD, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2792,9 +2531,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%SiO2_REMIN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2810,9 +2547,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%dust_FLUX_IN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2828,9 +2563,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%dust_REMIN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2846,9 +2579,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%P_iron_FLUX_IN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2864,9 +2595,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%P_iron_PROD, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2882,9 +2611,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%P_iron_REMIN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2903,9 +2630,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%N_lim(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2921,9 +2646,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%P_lim(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2939,9 +2662,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%Fe_lim(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2958,9 +2679,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%SiO3_lim(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if else @@ -2979,9 +2698,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%light_lim(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -2997,9 +2714,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%photoC(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3015,9 +2730,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%photoC_NO3(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3033,9 +2746,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%photoFe(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3051,9 +2762,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%photoNO3(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3069,9 +2778,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%photoNH4(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3087,9 +2794,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%DOP_uptake(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3105,9 +2810,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%PO4_uptake(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3123,9 +2826,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%auto_graze(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3141,9 +2842,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%auto_graze_poc(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3159,9 +2858,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%auto_graze_doc(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3177,9 +2874,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%auto_graze_zoo(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3195,9 +2890,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%auto_loss(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3213,9 +2906,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%auto_loss_poc(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3231,9 +2922,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%auto_loss_doc(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3249,9 +2938,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%auto_agg(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3270,9 +2957,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%bSi_form(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if else @@ -3292,9 +2977,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CaCO3_form(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if else @@ -3314,9 +2997,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%Nfix(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if else @@ -3337,9 +3018,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%tot_bSi_form, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3355,9 +3034,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%tot_CaCO3_form, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3373,9 +3050,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%tot_Nfix, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3394,9 +3069,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%zoo_loss(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3412,9 +3085,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%zoo_loss_poc(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3430,9 +3101,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%zoo_loss_doc(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3448,9 +3117,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%zoo_graze(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3466,9 +3133,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%zoo_graze_poc(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3484,9 +3149,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%zoo_graze_doc(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3502,9 +3165,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%zoo_graze_zoo(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3520,9 +3181,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%x_graze_zoo(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3544,9 +3203,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_PO13C_FLUX_IN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3562,9 +3219,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_PO13C_PROD, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3580,9 +3235,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_PO13C_REMIN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3598,9 +3251,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DO13C_prod, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3616,9 +3267,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DO13C_remin, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3634,9 +3283,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_Ca13CO3_FLUX_IN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3652,9 +3299,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_Ca13CO3_PROD, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3670,9 +3315,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_Ca13CO3_REMIN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3688,9 +3331,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_photo13C_TOT, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3706,9 +3347,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DIC_d13C, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3724,9 +3363,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DOC_d13C, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3742,9 +3379,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_zooC_d13C, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3760,9 +3395,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_PO14C_FLUX_IN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3778,9 +3411,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_PO14C_PROD, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3796,9 +3427,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_PO14C_REMIN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3814,9 +3443,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DO14C_prod, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3832,9 +3459,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DO14C_remin, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3850,9 +3475,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_Ca14CO3_FLUX_IN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3868,9 +3491,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_Ca14CO3_PROD, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3886,9 +3507,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_Ca14CO3_REMIN, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3904,9 +3523,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_photo14C_TOT, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3922,9 +3539,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DIC_d14C, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3940,9 +3555,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_DOC_d14C, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3958,9 +3571,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_zooC_d14C, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3978,9 +3589,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_photo13C_TOT_zint, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -3996,9 +3605,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_photo14C_TOT_zint, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -4014,9 +3621,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_Jint_13Ctot, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -4032,9 +3637,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_Jint_14Ctot, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -4050,9 +3653,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_Jint_100m_13Ctot, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -4068,9 +3669,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_Jint_100m_14Ctot, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -4091,9 +3690,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_Ca13CO3_form(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -4109,9 +3706,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_Ca13CO3_form_zint(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -4127,9 +3722,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_Ca14CO3_form(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -4145,9 +3738,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_Ca14CO3_form_zint(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -4163,9 +3754,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_autotrophCaCO3_d13C(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -4181,9 +3770,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_autotrophCaCO3_d14C(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -4199,9 +3786,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_photo13C(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -4217,9 +3802,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_photo14C(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -4235,9 +3818,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_photo13C_zint(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -4253,9 +3834,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_photo14C_zint(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -4271,9 +3850,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_eps_autotroph(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -4289,9 +3866,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_d13C(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -4307,9 +3882,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_d14C(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -4325,9 +3898,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_mui_to_co2star(n), marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -4347,9 +3918,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_eps_aq_g, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -4365,9 +3934,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%CISO_eps_dic_g, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -4385,9 +3952,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%calcToSed_13C, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -4403,9 +3968,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%pocToSed_13C, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -4421,9 +3984,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%calcToSed_14C, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -4439,9 +4000,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, truncate, & ind%pocToSed_14C, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -4471,9 +4030,7 @@ subroutine marbl_diagnostics_init( & call diags%add_diagnostic(lname, sname, units, vgrid, .false., & tmp_id, marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(sname), " to diags%add_diagnostic" - call marbl_status_log%log_error(log_message, subname) + call log_add_diagnostics_error(marbl_status_log, sname, subname) return end if end if @@ -4489,20 +4046,20 @@ subroutine marbl_diagnostics_init( & call marbl_interior_forcing_diags%set_to_zero(marbl_status_log) if (marbl_status_log%labort_marbl) then - log_message = "error code returned marbl_interior_forcing_diags%set_to_zero" - call marbl_status_log%log_error(log_message, subname) + call marbl_status_log%log_error_trace(& + 'marbl_interior_forcing_diags%set_to_zero', subname) return end if call marbl_interior_restore_diags%set_to_zero(marbl_status_log) if (marbl_status_log%labort_marbl) then - log_message = "error code returned marbl_interior_forcing_diags%set_to_zero" - call marbl_status_log%log_error(log_message, subname) + call marbl_status_log%log_error_trace(& + 'marbl_interior_restore_diags%set_to_zero', subname) return end if call marbl_surface_forcing_diags%set_to_zero(marbl_status_log) if (marbl_status_log%labort_marbl) then - log_message = "error code returned marbl_interior_forcing_diags%set_to_zero" - call marbl_status_log%log_error(log_message, subname) + call marbl_status_log%log_error_trace(& + 'marbl_surface_forcing_diags%set_to_zero', subname) return end if @@ -4556,7 +4113,6 @@ subroutine marbl_diagnostics_set_interior_forcing ( & type (marbl_log_type) , intent(inout) :: marbl_status_log character(*), parameter :: subname = "marbl_diagnostics_mod:set_interior" - character(len=char_len) :: log_message !----------------------------------------------------------------- @@ -4571,8 +4127,8 @@ subroutine marbl_diagnostics_set_interior_forcing ( & call marbl_interior_forcing_diags%set_to_zero(marbl_status_log) if (marbl_status_log%labort_marbl) then - log_message = "error code returned marbl_interior_forcing_diags%set_to_zero" - call marbl_status_log%log_error(log_message, subname) + call marbl_status_log%log_error_trace(& + 'marbl_interior_forcing_diags%set_to_zero', subname) return end if @@ -4682,7 +4238,6 @@ subroutine marbl_diagnostics_set_surface_forcing( & ! local variables !----------------------------------------------------------------------- character(*), parameter :: subname = 'marbl_diagnostics:store_diagnostics_surface_forcing' - character(len=char_len) :: log_message !----------------------------------------------------------------------- !----------------------------------------------------------------------- @@ -5848,7 +5403,6 @@ subroutine store_diagnostics_ciso_surface_forcing( & ! local variables !----------------------------------------------------------------------- character(*), parameter :: subname = 'marbl_diagnostics:store_diagnostics_ciso_surface_forcing' - character(len=char_len) :: log_message !----------------------------------------------------------------------- associate( & @@ -5970,4 +5524,15 @@ subroutine compute_vertical_integrals(integrand, delta_z, kmt, & end subroutine compute_vertical_integrals + subroutine log_add_diagnostics_error(marbl_status_log, sname, subname) + + type(marbl_log_type), intent(inout) :: marbl_status_log + character(len=*), intent(in) :: sname, subname + character(len=char_len) :: routine_name + + write(routine_name,"(3A)") "diags%add_diagnostic(", trim(sname), ")" + call marbl_status_log%log_error_trace(routine_name, subname) + + end subroutine log_add_diagnostics_error + end module marbl_diagnostics_mod From 00d1635673dcf72916e173a8811e5485a50ec7fe Mon Sep 17 00:00:00 2001 From: Michael Levy Date: Tue, 5 Apr 2016 22:28:01 -0600 Subject: [PATCH 06/11] Add description of logging module to source code This commit only affects the comments in .F90 files, but there is now a header in marbl_logging.F90 that explains how marbl_instance%StatusLog works and how the GCM should interact with it. Also, there was a "TODO" comment in marbl_interface_types.F90 that had already been done, so I deleted it. --- src/marbl_interface_types.F90 | 1 - src/marbl_logging.F90 | 46 +++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/src/marbl_interface_types.F90 b/src/marbl_interface_types.F90 index 0813ff10..f94b5491 100644 --- a/src/marbl_interface_types.F90 +++ b/src/marbl_interface_types.F90 @@ -524,7 +524,6 @@ subroutine marbl_diagnostics_set_to_zero(this, marbl_status_log) elseif (allocated(this%diags(n)%field_3d)) then this%diags(n)%field_3d(:, :) = c0 else - ! TODO abort abort abort log_message = "neither field_2d nor field_3d are allocated" call marbl_status_log%log_error(log_message, subname) write(log_message,"(2A)") "Diag short name = ", trim(this%diags(n)%short_name) diff --git a/src/marbl_logging.F90 b/src/marbl_logging.F90 index e4b7bbaf..395a21c3 100644 --- a/src/marbl_logging.F90 +++ b/src/marbl_logging.F90 @@ -1,5 +1,51 @@ module marbl_logging +! ------------ +! Module Usage +! ------------ +! +! MARBL has been designed so that all I/O goes through the GCM (or whatever is +! driving the library). The marbl_interface_class contains StatusLog, which +! is used to +! +! (a) send text to stdout (or wherever your model prefers) +! (b) report errors that require the model to abort +! +! In MARBL subroutines, one of three subroutines will be used: +! +! (1) StatusLog%log_noerror -- this stores a log message in StatusLog that does +! not contain a fatal error +! (2) StatusLog%log_error -- this stores a log message in StatusLog that DOES +! contain a fatal error. It does this by setting StatusLog%labort_marbl = +! .true.; when a call from the GCM to MARBL returns, it is important for the +! GCM to check the value of StatusLog%labort_marbl and abort the run if an +! error has been reported. +! (3) StatusLog%log_error_trace -- this routine helps trace the path in the code +! that resulted in an error being reported. If a MARBL routine logs an error +! message, then the routine that called the errant routine also logs an +! error message giving more information about where the call was made from. +! +! StatusLog uses a linked list to store the error messages. To print the +! message, start with a pointer of type(marbl_status_log_entry_type) that points +! to StatusLog%FullLog. You definitely want to print FullLogPtr%LogMessage, and +! may also be interested in FullLogPtr%ElementInd (if the message came from a +! portion of the code looping of num_elements) and FullLogPtr%CodeLocation +! (which contains MODULE:SUBROUTINE). +! +! There is also a helpful FullLogPtr%lall_tasks, which is .true. if MARBL deems +! the message important enough to be printed regardless of the number of tasks +! or threads the GCM is using. Error messages will always set lall_tasks to +! .true. but diagnostic messages (such as notes about which surface forcing +! output fields are being used) will set lall_tasks to .false. and only a single +! task needs to print those messages. +! +! After the GCM processes the contents of FullLogPtr, set FullLogPtr => +! FullLogPtr%next and, if associated(FullLogPtr), process the next message. Once +! you get to the last message in the linked list, FullLogPtr%next => NULL(). +! +! Once you have looped through all of the log messages, run StatusLog%erase() to +! clear the contents of the log. + use marbl_kinds_mod, only : char_len use marbl_namelist_mod, only : marbl_nl_buffer_size implicit none From 3344b3c44b84a9d8e405bc7d5b71fbf7c0b36f7c Mon Sep 17 00:00:00 2001 From: Michael Levy Date: Tue, 5 Apr 2016 22:40:42 -0600 Subject: [PATCH 07/11] Remove 'error code returned' from forcing field Much like the diagnostics in e257a8c1 there is now a routine in marbl_mod to handle the log_error_trace calls when forcing_fields%add_forcing_field() returns an error. --- src/marbl_mod.F90 | 151 ++++++++++++++-------------------------------- 1 file changed, 46 insertions(+), 105 deletions(-) diff --git a/src/marbl_mod.F90 b/src/marbl_mod.F90 index a35a175c..ae662bfe 100644 --- a/src/marbl_mod.F90 +++ b/src/marbl_mod.F90 @@ -863,9 +863,7 @@ subroutine marbl_init_surface_forcing_fields(& marbl_driver_varname=varname, id=ind%surface_mask_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(log_message, subname) + call log_add_forcing_field_error(marbl_status_log, varname, subname) return end if end if @@ -883,9 +881,7 @@ subroutine marbl_init_surface_forcing_fields(& marbl_driver_varname=varname, id=ind%d13c_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(log_message, subname) + call log_add_forcing_field_error(marbl_status_log, varname, subname) return end if end if @@ -902,9 +898,7 @@ subroutine marbl_init_surface_forcing_fields(& marbl_driver_varname=varname, id=ind%d14c_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(log_message, subname) + call log_add_forcing_field_error(marbl_status_log, varname, subname) return end if end if @@ -921,9 +915,7 @@ subroutine marbl_init_surface_forcing_fields(& marbl_driver_varname=varname, id=ind%d14c_glo_avg_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(log_message, subname) + call log_add_forcing_field_error(marbl_status_log, varname, subname) return end if end if @@ -941,9 +933,7 @@ subroutine marbl_init_surface_forcing_fields(& marbl_driver_varname=driver_varname, id=ind%u10_sqr_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(log_message, subname) + call log_add_forcing_field_error(marbl_status_log, varname, subname) return end if end if @@ -960,9 +950,7 @@ subroutine marbl_init_surface_forcing_fields(& marbl_driver_varname=driver_varname, id=ind%sst_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(log_message, subname) + call log_add_forcing_field_error(marbl_status_log, varname, subname) return end if end if @@ -979,9 +967,7 @@ subroutine marbl_init_surface_forcing_fields(& marbl_driver_varname=driver_varname, id=ind%sss_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(log_message, subname) + call log_add_forcing_field_error(marbl_status_log, varname, subname) return end if end if @@ -999,9 +985,7 @@ subroutine marbl_init_surface_forcing_fields(& field_constant = atm_co2_const, id=ind%xco2_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(log_message, subname) + call log_add_forcing_field_error(marbl_status_log, varname, subname) return end if end if @@ -1022,9 +1006,7 @@ subroutine marbl_init_surface_forcing_fields(& marbl_driver_varname=driver_varname, id=ind%xco2_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(log_message, subname) + call log_add_forcing_field_error(marbl_status_log, varname, subname) return end if end if @@ -1044,9 +1026,7 @@ subroutine marbl_init_surface_forcing_fields(& field_constant=atm_alt_co2_const, id=ind%xco2_alt_co2_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(log_message, subname) + call log_add_forcing_field_error(marbl_status_log, varname, subname) return end if end if @@ -1065,9 +1045,7 @@ subroutine marbl_init_surface_forcing_fields(& marbl_driver_varname=driver_varname, id=ind%ifrac_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(log_message, subname) + call log_add_forcing_field_error(marbl_status_log, varname, subname) return end if end if @@ -1083,9 +1061,7 @@ subroutine marbl_init_surface_forcing_fields(& marbl_forcing_calendar_name=fice_file, id=ind%ifrac_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(log_message, subname) + call log_add_forcing_field_error(marbl_status_log, varname, subname) return end if end if @@ -1104,9 +1080,7 @@ subroutine marbl_init_surface_forcing_fields(& marbl_driver_varname=driver_varname, id=ind%xkw_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(log_message, subname) + call log_add_forcing_field_error(marbl_status_log, varname, subname) return end if end if @@ -1122,9 +1096,7 @@ subroutine marbl_init_surface_forcing_fields(& marbl_forcing_calendar_name=xkw_file, id=ind%xkw_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(log_message, subname) + call log_add_forcing_field_error(marbl_status_log, varname, subname) return end if end if @@ -1144,9 +1116,7 @@ subroutine marbl_init_surface_forcing_fields(& marbl_driver_varname=driver_varname, id=ind%atm_pressure_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(log_message, subname) + call log_add_forcing_field_error(marbl_status_log, varname, subname) return end if end if @@ -1163,9 +1133,7 @@ subroutine marbl_init_surface_forcing_fields(& marbl_forcing_calendar_name=ap_file, id=ind%atm_pressure_id,& marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(log_message, subname) + call log_add_forcing_field_error(marbl_status_log, varname, subname) return end if end if @@ -1182,9 +1150,7 @@ subroutine marbl_init_surface_forcing_fields(& marbl_forcing_calendar_name=dust_flux_file, id=ind%dust_flux_id,& marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(log_message, subname) + call log_add_forcing_field_error(marbl_status_log, varname, subname) return end if end if @@ -1200,9 +1166,7 @@ subroutine marbl_init_surface_forcing_fields(& marbl_forcing_calendar_name=iron_flux_file, id=ind%iron_flux_id,& marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(log_message, subname) + call log_add_forcing_field_error(marbl_status_log, varname, subname) return end if end if @@ -1226,12 +1190,6 @@ subroutine marbl_init_surface_forcing_fields(& filename = ndep_shr_stream_file, & id=ind%nox_flux_id, & marbl_status_log = marbl_status_log) - if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(log_message, subname) - return - end if else fsource = 'POP monthly calendar' call forcing_fields%add_forcing_field(& @@ -1240,12 +1198,10 @@ subroutine marbl_init_surface_forcing_fields(& marbl_forcing_calendar_name=nox_flux_monthly_file, & id=ind%nox_flux_id, & marbl_status_log = marbl_status_log) - if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(log_message, subname) - return - end if + end if + if (marbl_status_log%labort_marbl) then + call log_add_forcing_field_error(marbl_status_log, varname, subname) + return end if end if @@ -1269,12 +1225,6 @@ subroutine marbl_init_surface_forcing_fields(& filename = ndep_shr_stream_file, & id=ind%nhy_flux_id, & marbl_status_log = marbl_status_log) - if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(log_message, subname) - return - end if else fsource = 'POP monthly calendar' call forcing_fields%add_forcing_field(& @@ -1284,12 +1234,10 @@ subroutine marbl_init_surface_forcing_fields(& marbl_forcing_calendar_name=nhy_flux_monthly_file, & id=ind%nhy_flux_id, & marbl_status_log = marbl_status_log) - if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(log_message, subname) - return - end if + end if + if (marbl_status_log%labort_marbl) then + call log_add_forcing_field_error(marbl_status_log, varname, subname) + return end if end if @@ -1307,9 +1255,7 @@ subroutine marbl_init_surface_forcing_fields(& id=ind%din_riv_flux_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(log_message, subname) + call log_add_forcing_field_error(marbl_status_log, varname, subname) return end if end if @@ -1328,9 +1274,7 @@ subroutine marbl_init_surface_forcing_fields(& id=ind%dip_riv_flux_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(log_message, subname) + call log_add_forcing_field_error(marbl_status_log, varname, subname) return end if end if @@ -1349,9 +1293,7 @@ subroutine marbl_init_surface_forcing_fields(& id=ind%don_riv_flux_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(log_message, subname) + call log_add_forcing_field_error(marbl_status_log, varname, subname) return end if end if @@ -1370,9 +1312,7 @@ subroutine marbl_init_surface_forcing_fields(& id=ind%dop_riv_flux_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(log_message, subname) + call log_add_forcing_field_error(marbl_status_log, varname, subname) return end if end if @@ -1391,9 +1331,7 @@ subroutine marbl_init_surface_forcing_fields(& id=ind%dsi_riv_flux_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(log_message, subname) + call log_add_forcing_field_error(marbl_status_log, varname, subname) return end if end if @@ -1412,9 +1350,7 @@ subroutine marbl_init_surface_forcing_fields(& id=ind%dfe_riv_flux_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(log_message, subname) + call log_add_forcing_field_error(marbl_status_log, varname, subname) return end if end if @@ -1433,9 +1369,7 @@ subroutine marbl_init_surface_forcing_fields(& id=ind%dic_riv_flux_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(log_message, subname) + call log_add_forcing_field_error(marbl_status_log, varname, subname) return end if end if @@ -1454,9 +1388,7 @@ subroutine marbl_init_surface_forcing_fields(& id=ind%alk_riv_flux_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(log_message, subname) + call log_add_forcing_field_error(marbl_status_log, varname, subname) return end if end if @@ -1475,9 +1407,7 @@ subroutine marbl_init_surface_forcing_fields(& id=ind%doc_riv_flux_id, & marbl_status_log = marbl_status_log) if (marbl_status_log%labort_marbl) then - write(log_message,"(3A)") "error code returned when adding ", & - trim(varname), " to forcing_fields%add" - call marbl_status_log%log_error(log_message, subname) + call log_add_forcing_field_error(marbl_status_log, varname, subname) return end if end if @@ -5559,6 +5489,17 @@ subroutine marbl_export_autotroph_shared_variables (& end subroutine marbl_export_autotroph_shared_variables + subroutine log_add_forcing_field_error(marbl_status_log, varname, subname) + + type(marbl_log_type), intent(inout) :: marbl_status_log + character(len=*), intent(in) :: varname, subname + character(len=char_len) :: routine_name + + write(routine_name,"(3A)") "forcing_fields%add(", trim(varname), ")" + call marbl_status_log%log_error_trace(routine_name, subname) + + end subroutine log_add_forcing_field_error + end module marbl_mod !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| From 2c42d813440ee87e388f89bca00ab8cc4a656f43 Mon Sep 17 00:00:00 2001 From: Michael Levy Date: Thu, 7 Apr 2016 17:46:46 -0600 Subject: [PATCH 08/11] Use proper formatting when writing to string I was trying to write a message combining strings and integers using the "(4A)" formatting string, which needed to be changed to "(A,I0,A,I0)" --- src/marbl_ciso_mod.F90 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/marbl_ciso_mod.F90 b/src/marbl_ciso_mod.F90 index e8f059e9..5c804269 100644 --- a/src/marbl_ciso_mod.F90 +++ b/src/marbl_ciso_mod.F90 @@ -326,8 +326,9 @@ subroutine marbl_ciso_init_tracer_metadata(marbl_tracer_metadata, marbl_status_l end do if (ecosys_ciso_tracer_cnt /= n) then - write(log_message, "(4A)") "ecosys_ciso_tracer_cnt = ", ecosys_ciso_tracer_cnt, & - "but computed ecosys_ciso_tracer_cnt = ", n + write(log_message, "(A,I0,A,I0)") "ecosys_ciso_tracer_cnt = ", & + ecosys_ciso_tracer_cnt, & + "but computed tracer count is ", n call marbl_status_log%log_error(log_message, subname) return endif From 1bd3def4752462fb2f92076cfa6545e4c0a415bb Mon Sep 17 00:00:00 2001 From: Michael Levy Date: Fri, 22 Apr 2016 14:28:27 -0600 Subject: [PATCH 09/11] Standardize formatting for subname The parameter subname appears in many subroutines, and should be declared as character(*), parmameter :: subname = '[module name]:[subroutine name]' This was not being done consistently throughout the code. --- src/marbl_co2calc_mod.F90 | 8 ++++---- src/marbl_diagnostics_mod.F90 | 8 ++++---- src/marbl_interface.F90 | 2 +- src/marbl_interface_types.F90 | 11 +++++------ src/marbl_mod.F90 | 4 ++-- src/marbl_restore_mod.F90 | 2 +- 6 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/marbl_co2calc_mod.F90 b/src/marbl_co2calc_mod.F90 index b48ecd84..436822c7 100644 --- a/src/marbl_co2calc_mod.F90 +++ b/src/marbl_co2calc_mod.F90 @@ -135,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) @@ -303,7 +303,7 @@ subroutine marbl_comp_CO3terms(& !--------------------------------------------------------------------------- ! local variable declarations !--------------------------------------------------------------------------- - character(*), parameter :: subname = 'marbl_co2calc:marbl_comp_CO3terms' + 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) @@ -786,7 +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:marbl_comp_htotal' + 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) @@ -904,7 +904,7 @@ 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 diff --git a/src/marbl_diagnostics_mod.F90 b/src/marbl_diagnostics_mod.F90 index 55397218..88c88cde 100644 --- a/src/marbl_diagnostics_mod.F90 +++ b/src/marbl_diagnostics_mod.F90 @@ -378,7 +378,7 @@ subroutine marbl_diagnostics_init( & integer :: num_forcing_diags character(len=char_len) :: lname, sname, units, vgrid - character(*), parameter :: subname = "marbl_diagnostics_mod:marbl_diagnostics_init" + character(*), parameter :: subname = 'marbl_diagnostics_mod:marbl_diagnostics_init' !----------------------------------------------------------------------- !----------------------------------------------------------------- @@ -4112,7 +4112,7 @@ subroutine marbl_diagnostics_set_interior_forcing ( & type (marbl_diagnostics_type) , intent(inout) :: marbl_interior_forcing_diags type (marbl_log_type) , intent(inout) :: marbl_status_log - character(*), parameter :: subname = "marbl_diagnostics_mod:set_interior" + character(*), parameter :: subname = 'marbl_diagnostics_mod:set_interior' !----------------------------------------------------------------- @@ -4237,7 +4237,7 @@ subroutine marbl_diagnostics_set_surface_forcing( & !----------------------------------------------------------------------- ! local variables !----------------------------------------------------------------------- - character(*), parameter :: subname = 'marbl_diagnostics:store_diagnostics_surface_forcing' + character(*), parameter :: subname = 'marbl_diagnostics_mod:store_diagnostics_surface_forcing' !----------------------------------------------------------------------- !----------------------------------------------------------------------- @@ -5402,7 +5402,7 @@ subroutine store_diagnostics_ciso_surface_forcing( & !----------------------------------------------------------------------- ! local variables !----------------------------------------------------------------------- - character(*), parameter :: subname = 'marbl_diagnostics:store_diagnostics_ciso_surface_forcing' + character(*), parameter :: subname = 'marbl_diagnostics_mod:store_diagnostics_ciso_surface_forcing' !----------------------------------------------------------------------- associate( & diff --git a/src/marbl_interface.F90 b/src/marbl_interface.F90 index b25ae7e3..248410eb 100644 --- a/src/marbl_interface.F90 +++ b/src/marbl_interface.F90 @@ -321,7 +321,7 @@ subroutine set_interior_forcing(this) implicit none class(marbl_interface_class), intent(inout) :: this - character(*), parameter :: subname='marbl_interface:set_interior_forcing' + character(*), parameter :: subname = 'marbl_interface:set_interior_forcing' call this%restoring%restore_tracers( & this%column_tracers, & diff --git a/src/marbl_interface_types.F90 b/src/marbl_interface_types.F90 index f94b5491..1b1049ab 100644 --- a/src/marbl_interface_types.F90 +++ b/src/marbl_interface_types.F90 @@ -389,8 +389,7 @@ subroutine marbl_single_sfo_constructor(this, num_elements, field_name, id, & integer(int_kind), intent(in) :: id type(marbl_log_type), intent(inout) :: marbl_status_log - character(len=*), parameter :: subname = & - 'marbl_interface_types:marbl_single_sfo_constructor' + character(*), parameter :: subname = 'marbl_interface_types:marbl_single_sfo_constructor' character(len=char_len) :: log_message select case (trim(field_name)) @@ -450,7 +449,7 @@ subroutine marbl_sfo_add(this, num_elements, field_name, sfo_id, & type(marbl_single_sfo_type), dimension(:), pointer :: new_sfo integer :: n, old_size - character(len=*), parameter :: subname = 'marbl_interface_types:marbl_sfo_add' + character(*), parameter :: subname = 'marbl_interface_types:marbl_sfo_add' if (associated(this%sfo)) then old_size = size(this%sfo) @@ -515,7 +514,7 @@ subroutine marbl_diagnostics_set_to_zero(this, marbl_status_log) type(marbl_log_type), intent(inout) :: marbl_status_log integer (int_kind) :: n - character(*), parameter :: subname="marbl_interface_types:diagnostics_set_to_zero" + character(*), parameter :: subname = 'marbl_interface_types:diagnostics_set_to_zero' character(len=char_len) :: log_message do n=1,this%diag_cnt @@ -692,7 +691,7 @@ subroutine marbl_single_forcing_field_init(this, & integer(kind=int_kind) :: n logical(log_kind) :: has_valid_source logical(log_kind) :: has_valid_inputs - character(*), parameter :: subname = "marbl_interface_types:single_forcing_field_init" + character(*), parameter :: subname = 'marbl_interface_types:single_forcing_field_init' character(len=char_len) :: log_message !----------------------------------------------------------------------- @@ -842,7 +841,7 @@ subroutine marbl_forcing_fields_add(this, & type(marbl_log_type), intent(inout) :: marbl_status_log integer (kind=int_kind) :: num_elem - character(*), parameter :: subname = "marbl_interface_types:marbl_forcing_fields_add" + character(*), parameter :: subname = 'marbl_interface_types:marbl_forcing_fields_add' character(len=char_len) :: log_message ! Note - the following sets the indices into the marble interface type surface_input_forcings(:,indices) diff --git a/src/marbl_mod.F90 b/src/marbl_mod.F90 index ae662bfe..69cb7003 100644 --- a/src/marbl_mod.F90 +++ b/src/marbl_mod.F90 @@ -3262,7 +3262,7 @@ subroutine marbl_init_zooplankton_tracer_metadata(marbl_tracer_metadata, & !----------------------------------------------------------------------- ! local variables !----------------------------------------------------------------------- - character(*), parameter :: subname = "marbl_mod:marbl_init_zooplankton_tracer_metadata" + character(*), parameter :: subname = 'marbl_mod:marbl_init_zooplankton_tracer_metadata' character(len=char_len) :: log_message integer (int_kind) :: zoo_ind ! zooplankton functional group index !----------------------------------------------------------------------- @@ -3309,7 +3309,7 @@ subroutine marbl_init_autotroph_tracer_metadata(marbl_tracer_metadata, n, marbl_ !----------------------------------------------------------------------- ! local variables !----------------------------------------------------------------------- - character(*), parameter :: subname = "marbl_mod:marbl_init_autotroph_tracer_metadata" + character(*), parameter :: subname = 'marbl_mod:marbl_init_autotroph_tracer_metadata' character(len=char_len) :: log_message integer (int_kind) :: auto_ind ! zooplankton functional group index !----------------------------------------------------------------------- diff --git a/src/marbl_restore_mod.F90 b/src/marbl_restore_mod.F90 index df97c03c..5e91fa17 100644 --- a/src/marbl_restore_mod.F90 +++ b/src/marbl_restore_mod.F90 @@ -76,7 +76,7 @@ subroutine init(this, nl_buffer, domain, tracer_metadata, status_log) real(r8), dimension(:), allocatable :: inv_tau integer(int_kind) :: nml_error, k, n, t character(len=marbl_nl_buffer_size) :: tmp_nl_buffer - character(*), parameter :: subname = 'ecosys_restore:Init' + character(*), parameter :: subname = 'marbl_restore_mod:init' character(len=char_len) :: log_message !----------------------------------------------------------------------- From 844db845259594e9fa80e8efbe2bc71ff4f9fa5a Mon Sep 17 00:00:00 2001 From: Michael Levy Date: Fri, 22 Apr 2016 15:17:29 -0600 Subject: [PATCH 10/11] Improve documentation in marbl_logging.F90 Per the comments in Pull Request #38, I did the following: 1. Used more stream-lined approach to documenting module use 2. Included basic print_marbl_log code 3. Defined the various strings that are intent(in) to the different marbl_log_* routines 4. Added a horizontal rule between subroutines 5. Added a brief blurb about the OutputOptions variable, mentioning that it is a place-holder for future development. --- src/marbl_logging.F90 | 125 +++++++++++++++++++++++++++++++----------- 1 file changed, 92 insertions(+), 33 deletions(-) diff --git a/src/marbl_logging.F90 b/src/marbl_logging.F90 index 395a21c3..3bc9583d 100644 --- a/src/marbl_logging.F90 +++ b/src/marbl_logging.F90 @@ -4,60 +4,63 @@ module marbl_logging ! Module Usage ! ------------ ! -! MARBL has been designed so that all I/O goes through the GCM (or whatever is -! driving the library). The marbl_interface_class contains StatusLog, which -! is used to +! Assume a variable named StatusLog (as appears in the marbl_interface_class) ! -! (a) send text to stdout (or wherever your model prefers) -! (b) report errors that require the model to abort +! Use the following routines to write log entries +! ----------------------------------------------- ! -! In MARBL subroutines, one of three subroutines will be used: -! -! (1) StatusLog%log_noerror -- this stores a log message in StatusLog that does +! (1) StatusLog%log_namelist -- this stores a log message that contains a +! namelist that has been read in by MARBL. The log message will include +! "Contents of &[namelist_name]:" as a prefix to the actual namelist. +! (2) StatusLog%log_noerror -- this stores a log message in StatusLog that does ! not contain a fatal error -! (2) StatusLog%log_error -- this stores a log message in StatusLog that DOES +! (3) StatusLog%log_error -- this stores a log message in StatusLog that DOES ! contain a fatal error. It does this by setting StatusLog%labort_marbl = ! .true.; when a call from the GCM to MARBL returns, it is important for the ! GCM to check the value of StatusLog%labort_marbl and abort the run if an ! error has been reported. -! (3) StatusLog%log_error_trace -- this routine helps trace the path in the code +! (4) StatusLog%log_error_trace -- this routine helps trace the path in the code ! that resulted in an error being reported. If a MARBL routine logs an error ! message, then the routine that called the errant routine also logs an ! error message giving more information about where the call was made from. ! -! StatusLog uses a linked list to store the error messages. To print the -! message, start with a pointer of type(marbl_status_log_entry_type) that points -! to StatusLog%FullLog. You definitely want to print FullLogPtr%LogMessage, and -! may also be interested in FullLogPtr%ElementInd (if the message came from a -! portion of the code looping of num_elements) and FullLogPtr%CodeLocation -! (which contains MODULE:SUBROUTINE). -! -! There is also a helpful FullLogPtr%lall_tasks, which is .true. if MARBL deems -! the message important enough to be printed regardless of the number of tasks -! or threads the GCM is using. Error messages will always set lall_tasks to -! .true. but diagnostic messages (such as notes about which surface forcing -! output fields are being used) will set lall_tasks to .false. and only a single -! task needs to print those messages. -! -! After the GCM processes the contents of FullLogPtr, set FullLogPtr => -! FullLogPtr%next and, if associated(FullLogPtr), process the next message. Once -! you get to the last message in the linked list, FullLogPtr%next => NULL(). +! Pseudo-code for writing StatusLog in the driver +! ----------------------------------------------- ! -! Once you have looped through all of the log messages, run StatusLog%erase() to -! clear the contents of the log. +! Using '#if 0' so code below is not compiled +#if 0 + type(marbl_status_log_entry_type), pointer :: LogEntry + + ! Set pointer to first entry of the log + LogEntry => StatusLog%FullLog + + do while (associated(LogEntry)) + ! If running in parallel, you may want to check if you are the master + ! task or if LogEntry%lalltasks = .true. + write(stdout,*) trim(LogEntry%LogMessage) + LogEntry => LogEntry%next + end do + + ! Erase contents of log now that they have been written out + call StatusLog%erase() + + if (StatusLog%labort_marbl) then + [GCM abort call: "error found in MARBL"] + end if + +#endif use marbl_kinds_mod, only : char_len use marbl_namelist_mod, only : marbl_nl_buffer_size + implicit none private save integer, parameter, private :: marbl_log_len = marbl_nl_buffer_size - ! MNL TO-DO: do we want a wrapper class that contains a linked list of - ! marbl_log_type? Then labort_marbl can be in the wrapped class - ! (and so can the status level definitions); would make this more - ! in line with the diagnostic and forcing field types, as well + !**************************************************************************** + type, public :: marbl_status_log_entry_type integer :: ElementInd logical :: lall_tasks ! True => message should be written to stdout by @@ -68,6 +71,19 @@ module marbl_logging type(marbl_status_log_entry_type), pointer :: next end type marbl_status_log_entry_type + !**************************************************************************** + + ! Note: this data type is not in use at the moment, but it is included as an + ! initial step towards allowing the user some control over what types + ! of messages are added to the log. For example, if you do not want + ! the contents of namelists written to the log, you would simply set + ! + ! lLogNamelist = .false. + ! + ! In the future we hope to be able to set these options via namelist, + ! but for now lLogNamelist, lLogGeneral, lLogWarning, and lLogError are + ! all set to .true. and can not be changed without modifying the source + ! code in this file. type, private :: marbl_log_output_options_type logical :: labort_on_warning ! True => elevate Warnings to Errors logical :: lLogVerbose ! Debugging output should be given Verbose label @@ -80,6 +96,8 @@ module marbl_logging procedure :: construct => marbl_output_options_constructor end type marbl_log_output_options_type + !**************************************************************************** + type, public :: marbl_log_type logical, public :: labort_marbl ! True => driver should abort GCM type(marbl_log_output_options_type) :: OutputOptions @@ -94,8 +112,12 @@ module marbl_logging procedure, public :: erase => marbl_log_erase end type marbl_log_type + !**************************************************************************** + contains + !**************************************************************************** + subroutine marbl_output_options_constructor(this, labort_on_warning, LogVerbose, LogNamelist, & LogGeneral, LogWarning, LogError) @@ -141,6 +163,8 @@ subroutine marbl_output_options_constructor(this, labort_on_warning, LogVerbose, end subroutine marbl_output_options_constructor + !**************************************************************************** + subroutine marbl_log_constructor(this) class(marbl_log_type), intent(inout) :: this @@ -152,9 +176,14 @@ subroutine marbl_log_constructor(this) end subroutine marbl_log_constructor + !**************************************************************************** + subroutine marbl_log_namelist(this, NamelistName, NamelistContents, CodeLoc, ElemInd) class(marbl_log_type), intent(inout) :: this + ! NamelistName is the name of the namelist + ! NamelistContents is a string containing the contents of the namelist + ! CodeLoc is the name of the subroutine that is calling StatusLog%log_namelist character(len=*), intent(in) :: NamelistName, NamelistContents, CodeLoc integer, optional, intent(in) :: ElemInd type(marbl_status_log_entry_type), pointer :: new_entry @@ -187,9 +216,14 @@ subroutine marbl_log_namelist(this, NamelistName, NamelistContents, CodeLoc, Ele end subroutine marbl_log_namelist + !**************************************************************************** + subroutine marbl_log_error(this, ErrorMsg, CodeLoc, ElemInd) class(marbl_log_type), intent(inout) :: this + ! ErrorMsg is the error message to be printed in the log; it does not need + ! to contain the name of the module or subroutine triggering the error + ! CodeLoc is the name of the subroutine that is calling StatusLog%log_error character(len=*), intent(in) :: ErrorMsg, CodeLoc integer, optional, intent(in) :: ElemInd type(marbl_status_log_entry_type), pointer :: new_entry @@ -223,11 +257,19 @@ subroutine marbl_log_error(this, ErrorMsg, CodeLoc, ElemInd) end subroutine marbl_log_error + !**************************************************************************** + subroutine marbl_log_noerror(this, StatusMsg, CodeLoc, ElemInd, lall_tasks) class(marbl_log_type), intent(inout) :: this + ! StatusMsg is the message to be printed in the log; it does not need to + ! contain the name of the module or subroutine producing the log message + ! CodeLoc is the name of the subroutine that is calling StatusLog%log_noerror character(len=*), intent(in) :: StatusMsg, CodeLoc integer, optional, intent(in) :: ElemInd + ! If lall_tasks is .true., then this is a message that should be printed out + ! regardless of which task produced it. By default, MARBL assumes that only + ! the master task needs to print a message logical, optional, intent(in) :: lall_tasks type(marbl_status_log_entry_type), pointer :: new_entry @@ -262,9 +304,24 @@ subroutine marbl_log_noerror(this, StatusMsg, CodeLoc, ElemInd, lall_tasks) end subroutine marbl_log_noerror + !**************************************************************************** + subroutine marbl_log_error_trace(this, RoutineName, CodeLoc, ElemInd) + ! This routine should only be called if another subroutine has returned and + ! StatusLog%labort_marbl = .true. + class(marbl_log_type), intent(inout) :: this + ! RoutineName is the name of the subroutine that returned with + ! labort_marbl = .true. + ! CodeLoc is the name of the subroutine that is calling StatusLog%log_error_trace + ! + ! Log will contain a message along the lines of + ! + ! "(CodeLoc) Error reported from RoutineName" + ! + ! When the log is printed, this will provide a traceback through the sequence + ! of calls that led to the original error message. character(len=*), intent(in) :: RoutineName, CodeLoc integer, optional, intent(in) :: ElemInd character(len=char_len) :: log_message @@ -274,6 +331,8 @@ subroutine marbl_log_error_trace(this, RoutineName, CodeLoc, ElemInd) end subroutine marbl_log_error_trace + !**************************************************************************** + subroutine marbl_log_erase(this) class(marbl_log_type), intent(inout) :: this From 29dc48a34771abe0d4b08571f9dc45c776ecd7bd Mon Sep 17 00:00:00 2001 From: Michael Levy Date: Tue, 3 May 2016 11:02:04 -0600 Subject: [PATCH 11/11] Formatting clean-up Added visual spacer between subroutines and made whitespace consistent with previous commit. --- src/marbl_mod.F90 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/marbl_mod.F90 b/src/marbl_mod.F90 index 8b96ea12..8281f755 100644 --- a/src/marbl_mod.F90 +++ b/src/marbl_mod.F90 @@ -5557,6 +5557,8 @@ subroutine marbl_update_tracer_file_metadata(marbl_tracer_indices, & end subroutine marbl_update_tracer_file_metadata + !*********************************************************************** + subroutine log_add_forcing_field_error(marbl_status_log, varname, subname) type(marbl_log_type), intent(inout) :: marbl_status_log @@ -5564,7 +5566,7 @@ subroutine log_add_forcing_field_error(marbl_status_log, varname, subname) character(len=*), intent(in) :: subname character(len=char_len) :: routine_name - write(routine_name, "(3A)") "forcing_fields%add(", trim(varname), ")" + write(routine_name,"(3A)") "forcing_fields%add(", trim(varname), ")" call marbl_status_log%log_error_trace(routine_name, subname) end subroutine log_add_forcing_field_error