Skip to content

Commit

Permalink
Merge branch 'singhbalwinder/atm/add-bc-pom-coarse-mode' (PR #416)
Browse files Browse the repository at this point in the history
Add bc and pom in the coarse mode of the MAM3/MAM4 chem pkgs

This commit adds BC and POM in the 3rd mode (coarse) of MAM3 and MAM4
chemistry packages. To run the model is this configuration, user has
to configure the model using "rain_evap_to_coarse_aero" option.  This
option will act as a CPP directive where turning this on would add BC
and POM into the coarse mode of MAM3 or MAM4 chemistry packages.

Another option "mam_amicphys_optaa_out" is added to control the
invocation of amicphys codes.

This commit also fixes a bug in the chemistry preprocessor and a bug
in RtmMod.F90 file.

Fixes #484

[BFB]
[NML]
[FCC]
AG-138
  • Loading branch information
susburrows committed Dec 9, 2015
2 parents b4cd63c + 5caba47 commit b324144
Show file tree
Hide file tree
Showing 24 changed files with 8,495 additions and 686 deletions.
173 changes: 122 additions & 51 deletions components/cam/bld/build-namelist
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,10 @@ add_default($nl, 'atm_cpl_dt', 'val'=>$nl->get_value('dtime'));
# Change default to using a single file.
add_default($nl, 'profile_single_file', 'val'=>'.true.');

#BSINGH - Get the value of RAIN_EVAP_TO_COARSE_AERO variable
my $rain_evap_to_coarse_aero = $cfg->get('rain_evap_to_coarse_aero'); #BSINGH - See if rain_evap_to_coarse_aero option is selected
if ($print>=1) { print "Running model with rain_evap_to_coarse_aero (1-YES, 0-NO)?: $rain_evap_to_coarse_aero $eol"; }

#-----------------------------------------------------------------------------------------------
# Add defaults for the CAM component

Expand Down Expand Up @@ -1068,37 +1072,73 @@ if ($aer_model eq 'mam' ) {
@mode_types = qw(accum aitken coarse);
@mode_num = qw(num_a1 num_a2 num_a3);
@mode_num_cw = qw(num_c1 num_c2 num_c3);
@mode_spec = (
[qw(so4_a1 pom_a1 soa_a1 bc_a1 dst_a1 ncl_a1)],
[qw(so4_a2 soa_a2 ncl_a2)],
[qw(dst_a3 ncl_a3 so4_a3)],
);
@mode_spec_type = (
[qw(sulfate p-organic s-organic black-c dust seasalt)],
[qw(sulfate s-organic seasalt)],
[qw(dust seasalt sulfate)],
);
@mode_spec_cw = (
[qw(so4_c1 pom_c1 soa_c1 bc_c1 dst_c1 ncl_c1)],
[qw(so4_c2 soa_c2 ncl_c2)],
[qw(dst_c3 ncl_c3 so4_c3)],
);

if ($rain_evap_to_coarse_aero == 0) { #default
@mode_spec = (
[qw(so4_a1 pom_a1 soa_a1 bc_a1 dst_a1 ncl_a1)],
[qw(so4_a2 soa_a2 ncl_a2)],
[qw(dst_a3 ncl_a3 so4_a3)],
);
@mode_spec_type = (
[qw(sulfate p-organic s-organic black-c dust seasalt)],
[qw(sulfate s-organic seasalt)],
[qw(dust seasalt sulfate)],
);
@mode_spec_cw = (
[qw(so4_c1 pom_c1 soa_c1 bc_c1 dst_c1 ncl_c1)],
[qw(so4_c2 soa_c2 ncl_c2)],
[qw(dst_c3 ncl_c3 so4_c3)],
);
}
else{
@mode_spec = (
[qw(so4_a1 pom_a1 soa_a1 bc_a1 dst_a1 ncl_a1)],
[qw(so4_a2 soa_a2 ncl_a2)],
[qw(dst_a3 ncl_a3 so4_a3 bc_a3 pom_a3 soa_a3)],
);
@mode_spec_type = (
[qw(sulfate p-organic s-organic black-c dust seasalt)],
[qw(sulfate s-organic seasalt)],
[qw(dust seasalt sulfate black-c p-organic s-organic)],
);
@mode_spec_cw = (
[qw(so4_c1 pom_c1 soa_c1 bc_c1 dst_c1 ncl_c1)],
[qw(so4_c2 soa_c2 ncl_c2)],
[qw(dst_c3 ncl_c3 so4_c3 bc_c3 pom_c3 soa_c3)],
);
}
if ($chem =~ /_mam3/) {
@mode_num_src = qw(A A A);
@mode_spec_src = (
[qw(A A A A A A)],
[qw(A A A)],
[qw(A A A)],
);
if ($rain_evap_to_coarse_aero == 0) { #default
@mode_spec_src = (
[qw(A A A A A A)],
[qw(A A A)],
[qw(A A A)],
);
}
else{
@mode_spec_src = (
[qw(A A A A A A)],
[qw(A A A)],
[qw(A A A A A A)],
);
}
}
else {
@mode_num_src = qw(N N N);
@mode_spec_src = (
[qw(N N N N N N)],
[qw(N N N)],
[qw(N N N)],
);
if ($rain_evap_to_coarse_aero == 0) { #default
@mode_spec_src = (
[qw(N N N N N N)],
[qw(N N N)],
[qw(N N N)],
);
}
else{
@mode_spec_src = (
[qw(N N N N N N)],
[qw(N N N)],
[qw(N N N N N N)],
);
}
}
} elsif($aero_modes eq '4mode') {
# For 4 modes
Expand All @@ -1113,32 +1153,62 @@ if ($aer_model eq 'mam' ) {
@mode_types = qw(accum aitken coarse primary_carbon);
@mode_num = qw(num_a1 num_a2 num_a3 num_a4);
@mode_num_cw = qw(num_c1 num_c2 num_c3 num_c4);
@mode_spec = (
[qw(so4_a1 pom_a1 soa_a1 bc_a1 dst_a1 ncl_a1)],
[qw(so4_a2 soa_a2 ncl_a2)],
[qw(dst_a3 ncl_a3 so4_a3)],
[qw(pom_a4 bc_a4)],
);
@mode_spec_type = (
[qw(sulfate p-organic s-organic black-c dust seasalt)],
[qw(sulfate s-organic seasalt)],
[qw(dust seasalt sulfate)],
[qw(p-organic black-c)],
);
@mode_spec_cw = (
[qw(so4_c1 pom_c1 soa_c1 bc_c1 dst_c1 ncl_c1)],
[qw(so4_c2 soa_c2 ncl_c2)],
[qw(dst_c3 ncl_c3 so4_c3)],
[qw(pom_c4 bc_c4)],
);
if ($rain_evap_to_coarse_aero == 0) { #default
@mode_spec = (
[qw(so4_a1 pom_a1 soa_a1 bc_a1 dst_a1 ncl_a1)],
[qw(so4_a2 soa_a2 ncl_a2)],
[qw(dst_a3 ncl_a3 so4_a3)],
[qw(pom_a4 bc_a4)],
);
@mode_spec_type = (
[qw(sulfate p-organic s-organic black-c dust seasalt)],
[qw(sulfate s-organic seasalt)],
[qw(dust seasalt sulfate)],
[qw(p-organic black-c)],
);
@mode_spec_cw = (
[qw(so4_c1 pom_c1 soa_c1 bc_c1 dst_c1 ncl_c1)],
[qw(so4_c2 soa_c2 ncl_c2)],
[qw(dst_c3 ncl_c3 so4_c3)],
[qw(pom_c4 bc_c4)],
);

@mode_num_src = qw(A A A A);
@mode_spec_src = (
[qw(A A A A A A)],
[qw(A A A)],
[qw(A A A)],
[qw(A A)],
);
@mode_num_src = qw(A A A A);
@mode_spec_src = (
[qw(A A A A A A)],
[qw(A A A)],
[qw(A A A)],
[qw(A A)],
);
}
else{
@mode_spec = (
[qw(so4_a1 pom_a1 soa_a1 bc_a1 dst_a1 ncl_a1)],
[qw(so4_a2 soa_a2 ncl_a2)],
[qw(dst_a3 ncl_a3 so4_a3 bc_a3 pom_a3 soa_a3)],
[qw(pom_a4 bc_a4)],
);
@mode_spec_type = (
[qw(sulfate p-organic s-organic black-c dust seasalt)],
[qw(sulfate s-organic seasalt)],
[qw(dust seasalt sulfate black-c p-organic s-organic)],
[qw(p-organic black-c)],
);
@mode_spec_cw = (
[qw(so4_c1 pom_c1 soa_c1 bc_c1 dst_c1 ncl_c1)],
[qw(so4_c2 soa_c2 ncl_c2)],
[qw(dst_c3 ncl_c3 so4_c3 bc_c3 pom_c3 soa_c3)],
[qw(pom_c4 bc_c4)],
);

@mode_num_src = qw(A A A A);
@mode_spec_src = (
[qw(A A A A A A)],
[qw(A A A)],
[qw(A A A A A A)],
[qw(A A)],
);
}

} elsif($aero_modes eq '7mode') {

Expand Down Expand Up @@ -2608,6 +2678,7 @@ add_default($nl, 'convproc_do_gas');
add_default($nl, 'demott_ice_nuc');
#BSINGH - ENDS

add_default($nl, 'mam_amicphys_optaa'); #for enabling amicphys code in cam

# Microphysics scheme
add_default($nl, 'use_subcol_microp');
Expand Down
3 changes: 3 additions & 0 deletions components/cam/bld/config_files/definition.xml
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ User specified Fortran compiler overrides Makefile default.
Type of Fortran compiler. Used when -fc specifies a generic wrapper script
such as mpif90 or ftn.
</entry>
<entry id="rain_evap_to_coarse_aero" valid_values="0,1" value="0">
Switch to enable extra species (BC, POM and SOA) in coarse mode for MAM3 and MAM4 simulations: 0=off, 1=on.
</entry>
<entry id="debug" valid_values="0,1" value="0">
Switch to enable debugging options for Fortran compiler: 0=off, 1=on.
</entry>
Expand Down
14 changes: 14 additions & 0 deletions components/cam/bld/configure
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ OPTIONS
Makefile defaults.
-cosp Enable the COSP simulator.
-debug Switch to turn on building CAM with debugging compiler options.
-rain_evap_to_coarse_aero Switch to turn on BC, POM and SOA in the MAM3 and MAM4 coarse mode (mam mode 3)
-defaults <file> Specify a configuration file which will be used to supply defaults instead of
one of the config_files/defaults_*.xml files. This file is used to specify model
configuration parameters only. Parameters relating to the build which
Expand Down Expand Up @@ -318,6 +319,7 @@ GetOptions(
"cosp" => \$opts{'cosp'},
"cppdefs=s" => \$opts{'cppdefs'},
"debug" => \$opts{'debug'},
"rain_evap_to_coarse_aero" => \$opts{'rain_evap_to_coarse_aero'},
"defaults=s" => \$opts{'defaults'},
"dyn=s" => \$opts{'dyn'},
"edit_chem_mech" => \$opts{'edit_chem_mech'},
Expand Down Expand Up @@ -825,6 +827,14 @@ if (defined $opts{'waccmx'}) {
}
my $waccmx = $cfg_ref->get('waccmx');

# Use "rain_evap_to_coarse_aero" in MAM3 or MAM4? [BSINGH - For extra coarse mode species for BC, POM and SOA]
my $rain_evap_to_coarse_aero_opt = (defined $opts{'rain_evap_to_coarse_aero'}) ? 1 : 0;
$cfg_ref->set('rain_evap_to_coarse_aero', $rain_evap_to_coarse_aero_opt);
my $rain_evap_to_coarse_aero = $rain_evap_to_coarse_aero_opt ? 1:0;

if ($print>=2) { print "Is rain_evap_to_coarse_aero active (0-NO; 1-YES)?: $rain_evap_to_coarse_aero$eol"; }


#-----------------------------------------------------------------------------------------------

# Prognostic species package(s)
Expand Down Expand Up @@ -1347,6 +1357,10 @@ if ($chem_pkg =~ '_mam3') {
$chem_cppdefs = ' -DMODAL_AERO -DMODAL_AERO_7MODE ';
}

if ($rain_evap_to_coarse_aero == 1 && ($chem_pkg =~ '_mam3' || $chem_pkg =~ '_mam4')) {
$chem_cppdefs = "$chem_cppdefs -DRAIN_EVAP_TO_COARSE_AERO "
}

my $carma_nadv = 0;
my $carma_cppdefs = '';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
so4_a3
pom_a3
bc_a3
soa_a3
num_a3
ncl_a4
so4_a4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
so4_a3
pom_a3
bc_a3
soa_a3
num_a3
ncl_a4
so4_a4
Expand Down
3 changes: 3 additions & 0 deletions components/cam/bld/namelist_files/namelist_defaults_cam.xml
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,9 @@
<convproc_method_activate>2</convproc_method_activate>
<convproc_do_gas >.false.</convproc_do_gas>

<!-- To turn on amicphys codes in cam-->
<mam_amicphys_optaa >0</mam_amicphys_optaa>

<!-- wet deposition option by PNNL -->
<resus_fix>.false.</resus_fix>

Expand Down
7 changes: 7 additions & 0 deletions components/cam/bld/namelist_files/namelist_definition.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3472,6 +3472,13 @@ Default: .false.
</entry>


<!-- Flag to turn on/off amicphys codes -->
<entry id="mam_amicphys_optaa" type="integer" category="scavenging"
group="phys_ctl_nl" valid_values="" >
invokes new microphysics code (single call to amicphys routine) if > 0
Default: 0
</entry>


<!-- Diagnostics -->

Expand Down
9 changes: 8 additions & 1 deletion components/cam/chem_proc/src/cam_chempp/eqrep.f
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,11 @@ subroutine EQUATION_REP( &
end if
production = .true.
rxno = rxmap(j,1,i)
if( coeff_ind(rxno) /= 0 .and. coeffs(k-(i+1),coeff_ind(rxno)) /= 1.e0 ) then
!BSINGH(12/20/2013): Original line: if( coeff_ind(rxno) /= 0 .and. coeffs(k-(i+1),coeff_ind(rxno)) /= 1.e0 ) then
!BSINGH(12/20/2013): Mods start (first check if coeff_ind(rxno) is non zero before using it as an index of coeffs array)
if( coeff_ind(rxno) /= 0) then
if( coeffs(k-(i+1),coeff_ind(rxno)) /= 1.e0 ) then
!BSINGH -ENDS
call NUMCON( eq_piece(buf_pos:), coeffs(k-(i+1),coeff_ind(rxno)), 'l' )
buf_pos = LEN_TRIM( eq_piece ) + 1
if( rxno > phtcnt ) then
Expand All @@ -179,6 +183,9 @@ subroutine EQUATION_REP( &
end if
buf_pos = buf_pos + 1
end if
!BSINGH(12/20/2013): Mods start
endif
!BSINGH -ENDS
if( rxno > phtcnt ) then
call NUMCON( eq_piece(buf_pos:), REAL(rxno-phtcnt), 'l' )
else
Expand Down
Loading

0 comments on commit b324144

Please sign in to comment.