The issue arises when a user sets
tr_aero = .false.
in user_nl_cice, but doesn't change anything else. This conflicts with the
assumptions built into the default specification of ntr_aero (as far as I can
tell). See below for the diagnosis. This showed up when running CICE with
bounds checking enabled. I'm guessing that there should at least be a runtime
test whether the tr_aero and ntr_aero settings are compatible.
More details,
a) The model is built with
-DNTR_AERO=3
and (from cice/bld/configure)
my $cice_cppdefs = " ... -DNTR_AERO=$ntr_aero";
From config_definition.xml:
"CICE_CONFIG_OPTS are normally set as compset variables (e.g., -ntr_aero 3)
"
and in my env_build.xml.
so nothing is being set and 3 is the default for this compset?
b) in ice_domain_size.F90 the parameters n_aero and max_ntrcr are set to
n_aero = NTR_AERO
max_ntrcr = 18
(so n_aero = 3 here).
c) user_nl_cice specifies
tr_aero = .false.
d) in ice_init.F90
if (tr_aero) then
nt_aero = ntrcr + 1
ntrcr = ntrcr + n_aero*4 !MH 2 for snow soot and 2 for ice
!MH for multiple (n_aero) aerosols
else
nt_aero = max_ntrcr
endif
So nt_aero = 18
e) in ice_mechred.F90
if (n_aero >= 1) then
do iaero=1,n_aero
msoot(m,iaero) = msoot(m,iaero) &
+ vsrdgn(ij)*(c1-fsnowrdg) &
*(trcrn(i,j,nt_aero +4*(iaero-1),n) &
+ trcrn(i,j,nt_aero+1+4*(iaero-1),n))
enddo
endif
so (n_aero = 3 >= 1) and nt_aero + 1 + 4*(iaero-1) = 18 + 1 + 0 = 19, or +4
= 23 or +8 = 27.
However, trcrn is declared as
real (kind=dbl_kind), dimension (nx_block,ny_block,max_ntrcr,ncat), &
intent(inout) :: &
trcrn ! ice tracers
so the max 3rd index is max_ntrcr == 18.
Conclusion: It appears that
-DNTR_AERO=3
and
tr_aero = .false.
are incompatible.
tr_aero = .false.
in user_nl_cice, but doesn't change anything else. This conflicts with the
assumptions built into the default specification of ntr_aero (as far as I can
tell). See below for the diagnosis. This showed up when running CICE with
bounds checking enabled. I'm guessing that there should at least be a runtime
test whether the tr_aero and ntr_aero settings are compatible.
More details,
a) The model is built with
-DNTR_AERO=3
and (from cice/bld/configure)
my $cice_cppdefs = " ... -DNTR_AERO=$ntr_aero";
From config_definition.xml:
"CICE_CONFIG_OPTS are normally set as compset variables (e.g., -ntr_aero 3)
"
and in my env_build.xml.
so nothing is being set and 3 is the default for this compset?
b) in ice_domain_size.F90 the parameters n_aero and max_ntrcr are set to
n_aero = NTR_AERO
max_ntrcr = 18
(so n_aero = 3 here).
c) user_nl_cice specifies
tr_aero = .false.
d) in ice_init.F90
if (tr_aero) then
nt_aero = ntrcr + 1
ntrcr = ntrcr + n_aero*4 !MH 2 for snow soot and 2 for ice
!MH for multiple (n_aero) aerosols
else
nt_aero = max_ntrcr
endif
So nt_aero = 18
e) in ice_mechred.F90
if (n_aero >= 1) then
do iaero=1,n_aero
msoot(m,iaero) = msoot(m,iaero) &
+ vsrdgn(ij)*(c1-fsnowrdg) &
*(trcrn(i,j,nt_aero +4*(iaero-1),n) &
+ trcrn(i,j,nt_aero+1+4*(iaero-1),n))
enddo
endif
so (n_aero = 3 >= 1) and nt_aero + 1 + 4*(iaero-1) = 18 + 1 + 0 = 19, or +4
= 23 or +8 = 27.
However, trcrn is declared as
real (kind=dbl_kind), dimension (nx_block,ny_block,max_ntrcr,ncat), &
intent(inout) :: &
trcrn ! ice tracers
so the max 3rd index is max_ntrcr == 18.
Conclusion: It appears that
-DNTR_AERO=3
and
tr_aero = .false.
are incompatible.