Skip to content

Commit

Permalink
Merge branch 'wlin/lnd/nml_nbalance_err_tol' (PR #6651)
Browse files Browse the repository at this point in the history
This enables namelist control for the balance_check_tolerance.
The hardwired default of balance_check_tolerance is increased from
1e-8 to 1e-7 for C, N and P based on testing results from investigating a runtime
failure due to grid and column nbalance errors exceeding specified
threshold.

[BFB] for tests never having nbalance issue
[NML] no NML diff for tests as default is not set via nml.
  • Loading branch information
bishtgautam committed Oct 1, 2024
2 parents 76d797e + 632faeb commit b663752
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
6 changes: 6 additions & 0 deletions components/elm/bld/namelist_files/namelist_definition.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ If TRUE consider priority of plant to get a fraction of
symbiotic N fixation and P phosphatase
</entry>

<entry id="bgc_balance_check_tolerance" type="real" category="elm_physics"
group="elm_inparm" valid_values="" >
BGC balance check tolerance
Default 1.0e-7 hardwired
</entry>

<entry id="startdate_add_temperature" type="char*8" category="elm_physics"
group="elm_inparm" valid_values="" >
Set date for beginning of adding temperature to atmospheric forcing
Expand Down
11 changes: 7 additions & 4 deletions components/elm/src/biogeochem/EcosystemBalanceCheckMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ module EcosystemBalanceCheckMod
implicit none
save
private
real(r8), parameter :: balance_check_tolerance = 1e-8_r8

! This corersponds to namelist variable bgc_balance_check_tolerance
real(r8), public :: balance_check_tolerance = 1e-7_r8

!
! !PUBLIC MEMBER FUNCTIONS:
public :: BeginColCBalance
Expand Down Expand Up @@ -278,7 +281,7 @@ subroutine ColCBalanceCheck(bounds, &
end if

! check for significant errors
if (abs(col_errcb(c)) > 1e-8_r8) then
if (abs(col_errcb(c)) > balance_check_tolerance) then
err_found = .true.
err_index = c
end if
Expand Down Expand Up @@ -498,7 +501,7 @@ subroutine ColNBalanceCheck(bounds, &
! here is '-' adjustment. It says that the adding to PF decomp n pools was less.
end if

if (abs(col_errnb(c)) > 1e-8_r8) then
if (abs(col_errnb(c)) > balance_check_tolerance) then
err_found = .true.
err_index = c
end if
Expand Down Expand Up @@ -731,7 +734,7 @@ subroutine ColPBalanceCheck(bounds, &
col_errpb(c) = (col_pinputs(c) - col_poutputs(c))*dt - &
(col_endpb(c) - col_begpb(c))

if (abs(col_errpb(c)) > 1e-8_r8) then
if (abs(col_errpb(c)) > balance_check_tolerance) then
err_found = .true.
err_index = c
end if
Expand Down
8 changes: 7 additions & 1 deletion components/elm/src/main/controlMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ module controlMod
use elm_varctl , only: const_climate_hist
use elm_varctl , only: use_top_solar_rad
use elm_varctl , only: snow_shape, snicar_atm_type, use_dust_snow_internal_mixing
use EcosystemBalanceCheckMod, only: bgc_balance_check_tolerance => balance_check_tolerance

!
! !PUBLIC TYPES:
Expand Down Expand Up @@ -181,6 +182,10 @@ subroutine control_init( )
namelist /elm_inparm/ &
NFIX_PTASE_plant

! BGC balance check
namelist /elm_inparm/ &
bgc_balance_check_tolerance

! For experimental manipulations
namelist /elm_inparm/ &
startdate_add_temperature
Expand Down Expand Up @@ -325,7 +330,7 @@ subroutine control_init( )

namelist /elm_mosart/ &
lnd_rof_coupling_nstep

namelist /elm_inparm/ &
snow_shape, snicar_atm_type, use_dust_snow_internal_mixing

Expand Down Expand Up @@ -796,6 +801,7 @@ subroutine control_spmd()
call mpi_bcast (forest_fert_exp, 1, MPI_LOGICAL, 0, mpicom, ier)
call mpi_bcast (ECA_Pconst_RGspin, 1, MPI_LOGICAL, 0, mpicom, ier)
call mpi_bcast (NFIX_PTASE_plant, 1, MPI_LOGICAL, 0, mpicom, ier)
call mpi_bcast (bgc_balance_check_tolerance, 1, MPI_REAL8, 0, mpicom, ier)
call mpi_bcast (use_pheno_flux_limiter, 1, MPI_LOGICAL, 0, mpicom, ier)
call mpi_bcast (startdate_add_temperature, 1, MPI_CHARACTER, 0, mpicom, ier)
call mpi_bcast (startdate_add_co2, 1, MPI_CHARACTER, 0, mpicom, ier)
Expand Down

0 comments on commit b663752

Please sign in to comment.