Skip to content

Commit

Permalink
Merge pull request #98 from mvertens/feature/oslo_aero_integrate
Browse files Browse the repository at this point in the history
noresm_v7_cam6_3_123: Add oslo-aero as an new aerosol scheme

Addition of oslo-aero as new aerosol scheme

Summary: Addition of oslo-aero as a new aerosol scheme via primarily the addition of new cpp-ifdefs. 

Contributors: @mvertens @ingvisau @gold2718 

Reviewers: @gold2718 

Purpose of changes: #97: Add oslo-aero as new aerosol scheme

Github PR URL: #98

Changes made to build system: Changes for turning on oslo-aero 

Changes made to the namelist: new oslo-aero namelists

Changes to the defaults for the boundary datasets: oslo-aero boundary datasets

Substantial timing or memory changes: to be determined

The main aim of this PR is to being carrying out simulations with oslo-aero as the aerosol scheme used in CAM.  New OSLO_AERO CPP-ifdefs have been introduced that enable oslo-aero to be activated. This will be the first step for future object-oriented refactorization that is planned. 

Testing: NOTE: Regression testing of aux_cam_noresm completed.  
- Tests added for Oslo Aero
- Substantial changes were needed to ensure restart and BfB behavior when channging task count. This makes it impossible to compare with the release version of Oslo Aero.

AEROCOM is not enabled in this PR 

closes #89: Implement Oslo-aero in noresm_develop
closes #97: Add oslo-aero as new aerosol scheme
  • Loading branch information
gold2718 authored Oct 24, 2023
2 parents 0384e57 + 427dc88 commit 647efef
Show file tree
Hide file tree
Showing 33 changed files with 2,618 additions and 40 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ chem_proc
cime
components
manage_externals.log
src/chemistry/oslo_aero
src/physics/ali_arms/
src/physics/camnor_phys
src/physics/carma/base
Expand Down
2 changes: 1 addition & 1 deletion Externals.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ required = True

[cime]
protocol = git
tag = cime6.0.105_noresm_v4
tag = cime6.0.173_noresm_v0
repo_url = https://github.com/NorESMhub/cime.git
local_path = cime
required = True
Expand Down
9 changes: 8 additions & 1 deletion Externals_CAM.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,18 @@ required = True

[camnor_phys]
protocol = git
tag = camnor_noresm_v0.0.4
tag = camnor_noresm_v0.0.5
repo_url = https://github.com/NorESMhub/CAM-Nor-physics
local_path = src/physics/camnor_phys
required = True

[oslo_aero]
protocol = git
tag = noresm_oslo_aero_v0
repo_url = https://github.com/NorESMhub/OSLO_AERO
local_path = src/chemistry/oslo_aero
required = True

[hemco]
protocol = git
tag = hemco-cesm1_2_0_hemco3_6_2_cesm
Expand Down
133 changes: 130 additions & 3 deletions bld/build-namelist
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,11 @@ if ($cfg->get('debug')) {
my $prescribe_aerosols = $TRUE;
if ($simple_phys) {$prescribe_aerosols = $FALSE;}

if( $chem =~ /_oslo/){
$prescribe_aerosols = $FALSE;
print " ==> Using Oslo aerosols: PRESCRIBED AERO = FALSE (not yet implemented) \n"
}

# Chemistry deposition lists
if ( ($chem ne 'none') or ( $prog_species ) ){
my $chem_proc_src = $cfg->get('chem_proc_src');
Expand Down Expand Up @@ -928,7 +933,15 @@ else {
my $aer_model = 'bam';
if ($prescribed_aero_model eq 'modal' or $chem =~ /_mam/) {$aer_model = 'mam';}

if ($aer_model eq 'mam' ) {
if ($chem =~ /_mam_oslo/) {$aer_model = 'oslo';}

#do nothing here

if ($aer_model eq 'oslo') {

#do nothing here

} elsif ($aer_model eq 'mam' ) {

my $aero_modes = '3mode';
if ($chem =~ /_mam7/) {$aero_modes = '7mode';}
Expand Down Expand Up @@ -1542,7 +1555,7 @@ elsif ($carma eq 'tholin') {

# turn on stratospheric aerosol forcings in CAM6 configurations
my $chem_has_ocs = chem_has_species($cfg, 'OCS');
if (($phys =~ /cam6/ or $phys =~ /cam_dev/) and $chem =~ /_mam/) {
if (($phys =~ /cam6/ or $phys =~ /cam_dev/) and $chem =~ /_mam/ and $chem ne 'trop_mam_oslo') {
# turn on volc forcings in cam6 -- prognostic or prescribed
if ( $chem_has_ocs ) {
# turn on prognostic stratospheric aerosols
Expand Down Expand Up @@ -1684,6 +1697,7 @@ if ($chem =~ /ghg_mam4/) {
}
add_default($nl, 'flbc_file');
}

if ( $prog_species ) {
my $ddval;
my $emisval;
Expand Down Expand Up @@ -2594,10 +2608,96 @@ if (($chem eq 'trop_mam4') or ($chem eq 'waccm_sc_mam4') or ($chem eq 'ghg_mam4'
add_default($nl, $file);
}
}
if ($chem eq 'trop_mam7') {

if ($chem eq 'trop_mam_oslo' ) {

my %species;

# Surface emission datasets:
%species = ();
%species = (%species,
'DMS -> ' => 'dms_oslo_emis_file',
'SO2 -> ' => 'so2_oslo_emis_file',
'BC_AX -> ' => 'bc_ax_oslo_emis_file',
'BC_N -> ' =>'bc_n_oslo_emis_file',
'BC_NI -> ' =>'bc_ni_oslo_emis_file',
'SO4_PR -> ' =>'so4_pr_oslo_emis_file',
'OM_NI -> ' =>'om_ni_oslo_emis_file',
'monoterp -> ' => 'monoterp_oslo_emis_file',
'isoprene -> ' => 'isoprene_oslo_emis_file',
);

my $first = 1;
my $pre = "";
my $val = "";
foreach my $id (sort keys %species) {
my $rel_filepath = get_default_value($species{$id} );
my $abs_filepath = set_abs_filepath($rel_filepath, $inputdata_rootdir);
$val .= $pre . quote_string($id . $abs_filepath);
if ($first) {
$pre = ",";
$first = 0;
}
}
add_default($nl, 'srf_emis_specifier', 'val'=>$val);
unless (defined $nl->get_value('srf_emis_type')) {
add_default($nl, 'srf_emis_type', 'val'=>'CYCLICAL');
add_default($nl, 'srf_emis_cycle_yr', 'val'=>'2000');
}

# Vertical emission datasets:
%species = ();
%species = ('SO2 -> ' => 'so2_oslo_ext_file',
'BC_AX -> ' => 'bc_ax_oslo_ext_file',
'BC_N -> ' => 'bc_n_oslo_ext_file',
'BC_NI -> ' => 'bc_ni_oslo_ext_file',
'OM_NI -> ' => 'om_ni_oslo_ext_file',
'SO4_PR -> ' => 'so4_pr_oslo_ext_file');

$first = 1;
$pre = "";
$val = "";
foreach my $id (sort keys %species) {
my $rel_filepath = get_default_value($species{$id} );
my $abs_filepath = set_abs_filepath($rel_filepath, $inputdata_rootdir);
$val .= $pre . quote_string($id . $abs_filepath);
if ($first) {
$pre = ",";
$first = 0;
}
}
add_default($nl, 'ext_frc_specifier', 'val'=>$val);
unless (defined $nl->get_value('ext_frc_type')) {
add_default($nl, 'ext_frc_type', 'val'=>"'CYCLICAL'");
add_default($nl, 'ext_frc_cycle_yr', 'val'=>'2000');
}

# Prescribed species
add_default($nl, 'tracer_cnst_specifier', 'val'=>"'O3','OH','NO3','HO2'");
unless (defined $nl->get_value('tracer_cnst_type')) {
add_default($nl, 'tracer_cnst_type', 'ver'=>'fixed_ox');
add_default($nl, 'tracer_cnst_cycle_yr','ver'=>'fixed_ox');
}

my @files = ('tracer_cnst_datapath', 'tracer_cnst_file', 'tracer_cnst_filelist');
foreach my $file (@files) {
add_default($nl, $file, 'ver'=>'fixed_ox');
}

add_default($nl, 'fstrat_list', 'val'=>"' '");
add_default($nl, 'flbc_list', 'val'=>"' '");

# Datasets
my @files = ('soil_erod_file',
'xs_long_file', 'rsf_file', 'exo_coldens_file' );
foreach my $file (@files) {
add_default($nl, $file);
}
}

if ($chem eq 'trop_mam7') {
my %species;

# Surface emission datasets:
%species = ();
%species = ('DMS -> ' => 'dms_emis_file',
Expand Down Expand Up @@ -2625,6 +2725,7 @@ if ($chem eq 'trop_mam7') {
$first = 0;
}
}

add_default($nl, 'srf_emis_specifier', 'val'=>$val);
unless (defined $nl->get_value('srf_emis_type')) {
add_default($nl, 'srf_emis_type', 'val'=>'CYCLICAL');
Expand Down Expand Up @@ -2807,6 +2908,7 @@ if ($chem =~ /waccm_ma/ or $chem =~ /waccm_tsmlt/) {
add_default($nl, 'efield_potential_max', 'val'=>'120.D0');
}


# Determine the source of the prescribed GHG values.

my $lbc_file = $nl->get_value('flbc_file');
Expand Down Expand Up @@ -2917,6 +3019,31 @@ $use_simple_phys = '.false.';
if ($simple_phys) {$use_simple_phys = '.true.';}
$nl->set_variable_value('phys_ctl_nl', 'use_simple_phys', $use_simple_phys);

#Cam-Oslo options
add_default($nl, 'volc_fraction_coarse');
add_default($nl, 'aerotab_table_dir');
add_default($nl, 'ocean_filepath');
add_default($nl, 'dms_source');
add_default($nl, 'opom_source');
#add_default($nl, 'dms_source_type');
#add_default($nl, 'dms_cycle_year');
#add_default($nl, 'ocean_filename');
#add_default($nl, 'ocean_filepath');
#add_default($nl, 'opom_source');
unless (defined $nl->get_value('ocean_filename')) {
add_default($nl, 'ocean_filename');
}
unless (defined $nl->get_value('opom_source_type')) {
add_default($nl, 'opom_source_type');
add_default($nl, 'opom_cycle_year');
}
unless (defined $nl->get_value('dms_source_type')) {
add_default($nl, 'dms_source_type');
add_default($nl, 'dms_cycle_year');
}
#add_default($nl, 'opom_source_type');
#add_default($nl, 'opom_cycle_year');

# WACCM-X runtime options
add_default($nl, 'waccmx_opt');

Expand Down
6 changes: 3 additions & 3 deletions bld/config_files/definition.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ meteor_smoke (Meteor Smoke), mixed_sulfate (Meteor Smoke and Sulfate), pmc (Pola
sulfate (Sulfate Aerosols), tholin (early earth haze), test_detrain (Detrainment), test_growth (Particle Growth), test_passive (Passive Dust),
test_radiative (Radiatively Active Dust), test_swelling (Sea Salt), test_tracers (Asian Monsoon), test_tracers2 (Guam).
</entry>
<entry id="chem" valid_values="none,ghg_mam4,terminator,trop_mam3,trop_mam4,trop_mam7,trop_mozart,trop_strat_mam4_ts2,trop_strat_mam4_vbs,trop_strat_mam4_vbsext,trop_strat_mam5_ts2,trop_strat_mam5_vbs,trop_strat_mam5_vbsext,waccm_ma,waccm_mad,waccm_ma_sulfur,waccm_sc,waccm_sc_mam4,waccm_mad_mam4,waccm_ma_mam4,waccm_tsmlt_mam4,waccm_tsmlt_mam4_vbsext,waccm_mad_mam5,waccm_ma_mam5,waccm_tsmlt_mam5,waccm_tsmlt_mam5_vbsext" value="">
Chemistry package: none,ghg_mam4,terminator,trop_mam3,trop_mam4,trop_mam7,trop_mozart,trop_strat_mam4_ts2,trop_strat_mam4_vbs,trop_strat_mam4_vbsext,trop_strat_mam5_ts2,trop_strat_mam5_vbs,trop_strat_mam5_vbsext,waccm_ma,waccm_mad,waccm_ma_sulfur,waccm_sc,waccm_sc_mam4,waccm_mad_mam4,waccm_ma_mam4,waccm_tsmlt_mam4,waccm_tsmlt_mam4_vbsext,waccm_mad_mam5,waccm_ma_mam5,waccm_tsmlt_mam5,waccm_tsmlt_mam5_vbsext
<entry id="chem" valid_values="none,ghg_mam4,terminator,trop_mam3,trop_mam4,trop_mam7,trop_mam_oslo,trop_mozart,trop_strat_mam4_ts2,trop_strat_mam4_vbs,trop_strat_mam4_vbsext,trop_strat_mam5_ts2,trop_strat_mam5_vbs,trop_strat_mam5_vbsext,waccm_ma,waccm_mad,waccm_ma_sulfur,waccm_sc,waccm_sc_mam4,waccm_mad_mam4,waccm_ma_mam4,waccm_tsmlt_mam4,waccm_tsmlt_mam4_vbsext,waccm_mad_mam5,waccm_ma_mam5,waccm_tsmlt_mam5,waccm_tsmlt_mam5_vbsext" value="">
Chemistry package: none,ghg_mam4,terminator,trop_mam3,trop_mam4,trop_mam7,trop_mam_oslo,trop_mozart,trop_strat_mam4_ts2,trop_strat_mam4_vbs,trop_strat_mam4_vbsext,trop_strat_mam5_ts2,trop_strat_mam5_vbs,trop_strat_mam5_vbsext,waccm_ma,waccm_mad,waccm_ma_sulfur,waccm_sc,waccm_sc_mam4,waccm_mad_mam4,waccm_ma_mam4,waccm_tsmlt_mam4,waccm_tsmlt_mam4_vbsext,waccm_mad_mam5,waccm_ma_mam5,waccm_tsmlt_mam5,waccm_tsmlt_mam5_vbsext
</entry>
<entry id="prog_species" valid_values="DST,SSLT,SO4,GHG,OC,BC,CARBON16" value="" list="1">
Prognostic mozart species packages: list of any subset of the following: DST,SSLT,SO4,GHG,OC,BC,CARBON16
Expand Down Expand Up @@ -224,7 +224,7 @@ User specified C compiler options to append to Makefile defaults.
<entry id="fc" value="">
User specified Fortran compiler overrides Makefile default.
</entry>
<entry id="fc_type" valid_values="cray,pgi,intel,gnu,pathscale,ibm,nag,nvhpc,pgi-gpu,nvhpc-gpu" value="">
<entry id="fc_type" valid_values="intel,gnu" value="">
Type of Fortran compiler. Used when -fc specifies a generic wrapper script
such as mpif90 or ftn.
</entry>
Expand Down
32 changes: 24 additions & 8 deletions bld/configure
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,15 @@ OPTIONS
test_tracers, test_tracers2].
Default: none.
-chem <name> Build CAM with specified prognostic chemistry package
[ none | ghg_mam4 | terminator | trop_mam3 | trop_mam4 | trop_mam7 | trop_mozart | trop_strat_mam4_ts2 |
[ none | ghg_mam4 | terminator | trop_mam3 | trop_mam4 | trop_mam7 | trop_mam_oslo | trop_mozart | trop_strat_mam4_ts2 |
trop_strat_mam4_vbs | trop_strat_mam4_vbsext | trop_strat_mam5_ts2 | trop_strat_mam5_vbs |
trop_strat_mam5_vbsext | waccm_ma | waccm_mad | waccm_ma_sulfur | waccm_sc | waccm_sc_mam4 |
waccm_mad_mam4 | waccm_ma_mam4 | waccm_tsmlt_mam4 | waccm_tsmlt_mam4_vbsext | waccm_mad_mam5 |
waccm_ma_mam5 | waccm_tsmlt_mam5 | waccm_tsmlt_mam5_vbsext ].
Default: trop_mam4 for cam6 and trop_mam3 for cam5.
Default: trop_mam_oslo when -camnor is specified
Default: trop_mam5 for cam7
Default: trop_mam4 for cam6
Default: trop_mam3 for cam5.
-[no]clubb_sgs Switch on [off] CLUBB_SGS. Default: on for cam6, otherwise off.
-clubb_opts <list> Comma separated list of CLUBB options to turn on/off. By default they are all off.
Current option is: clubb_do_adv (Advect CLUBB moments)
Expand Down Expand Up @@ -154,13 +157,13 @@ OPTIONS
-cosp_libdir <dir> Directory containing COSP library.
-esmf_libdir <dir> Directory containing ESMF library and esmf.mk file.
-fc <name> User specified Fortran compiler. Overrides Makefile default.
-fc_type <name> Type of Fortran compiler [pgi | intel | gnu | pathscale
| ibm | nag]. This argument is used in conjunction
-fc_type <name> Type of Fortran compiler [intel | gnu].
This argument is used in conjunction
with the -fc argument when the name of the fortran
compiler refers to a wrapper script (e.g., mpif90
or ftn). In this case the user needs to specify
compiler refers to a wrapper script (e.g., mpif90).
In this case the user needs to specify
the type of Fortran compiler that is being invoked
by the wrapper script. Default: pgi
by the wrapper script. Default: gnu
-fflags <string> A string of user specified Fortran compiler flags. Appended to
Makefile defaults. See -fopt to override optimization flags.
-fopt <string> A string of user specified Fortran compiler optimization flags.
Expand Down Expand Up @@ -589,6 +592,9 @@ my $chem_pkg = 'trop_mam4';
if ($simple_phys or $phys_pkg =~ m/^cam[34]$/ or $phys_pkg eq 'spcam_sam1mom') {
$chem_pkg = 'none';
}
elsif ($camnor) {
$chem_pkg = 'trop_mam_oslo';
}
elsif ($phys_pkg eq 'cam5' or $phys_pkg eq 'spcam_m2005') {
$chem_pkg = 'trop_mam3';
}
Expand Down Expand Up @@ -1409,6 +1415,8 @@ if ($chem_pkg =~ '_mam3') {
$chem_cppdefs = ' -DMODAL_AERO -DMODAL_AERO_5MODE ';
} elsif ($chem_pkg =~ '_mam7') {
$chem_cppdefs = ' -DMODAL_AERO -DMODAL_AERO_7MODE ';
} elsif ($chem_pkg =~ '_oslo') {
$chem_cppdefs = ' -DOSLO_AERO';
}

# CARMA sectional microphysics
Expand Down Expand Up @@ -2094,6 +2102,10 @@ sub write_filepath
}
}

if ($chem =~/_oslo/) {
print $fh "$camsrcdir/src/chemistry/oslo_aero/src_cam\n";
}

# offline unit driver (defaults to stub)
print $fh "$camsrcdir/src/unit_drivers\n";
print $fh "$camsrcdir/src/unit_drivers/${offline_drv}\n";
Expand Down Expand Up @@ -2130,7 +2142,11 @@ sub write_filepath
if ($chem_src_dir) {
print $fh "$chem_src_dir\n";
}
if ($chem =~ /_mam/) {
if ($chem =~/_oslo/) {
# print $fh "$camsrcdir/src/chemistry/oslo_aero/object\n"; BUG: this does not compile
print $fh "$camsrcdir/src/chemistry/oslo_aero/src\n";
print $fh "$camsrcdir/src/chemistry/oslo_aero/cam_intr\n";
} elsif ($chem =~ /_mam/) {
print $fh "$camsrcdir/src/chemistry/modal_aero\n";
} else {
print $fh "$camsrcdir/src/chemistry/bulk_aero\n";
Expand Down
21 changes: 18 additions & 3 deletions bld/namelist_files/namelist_defaults_cam.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2278,9 +2278,10 @@
<nucleate_ice_subgrid_strat microphys="mg2" >1.2D0</nucleate_ice_subgrid_strat>
<nucleate_ice_subgrid_strat microphys="mg3" >1.2D0</nucleate_ice_subgrid_strat>

<use_hetfrz_classnuc >.false.</use_hetfrz_classnuc>
<use_hetfrz_classnuc phys="cam6" >.true.</use_hetfrz_classnuc>
<use_hetfrz_classnuc phys="cam_dev">.true.</use_hetfrz_classnuc>
<use_hetfrz_classnuc >.false.</use_hetfrz_classnuc>
<use_hetfrz_classnuc phys="cam6" >.true.</use_hetfrz_classnuc>
<use_hetfrz_classnuc phys="cam_dev" >.true.</use_hetfrz_classnuc>
<use_hetfrz_classnuc chem="trop_mam_oslo">.true.</use_hetfrz_classnuc>
<hetfrz_bc_scalfac>0.01D0</hetfrz_bc_scalfac>
<hetfrz_dust_scalfac>0.05D0</hetfrz_dust_scalfac>

Expand Down Expand Up @@ -3338,6 +3339,7 @@
' C3H6_O3 + ISOP_O3 + MVK_O3 + MACR_O3 + MTERP_O3 + BCARY_O3 + S_O3 + SO_O3'
</rxn_rate_sums>


<!-- HEMCO: Harmonized Emissions Component -->
<use_hemco>.false.</use_hemco>
<hemco_data_root>atm/cam/geoschem/emis/ExtData/HEMCO</hemco_data_root>
Expand Down Expand Up @@ -3365,4 +3367,17 @@
<hemco_grid_xdim hgrid="1.9x2.5">144</hemco_grid_xdim>
<hemco_grid_ydim hgrid="1.9x2.5">91</hemco_grid_ydim>

<!-- CAM-Oslo variables -->
<dme_energy_adjust>.true.</dme_energy_adjust>
<volc_fraction_coarse >0.0</volc_fraction_coarse>
<aerotab_table_dir>noresm-only/atm/cam/camoslo/AeroTab_8jun17/</aerotab_table_dir>
<dms_source>lana</dms_source>
<dms_source_type>CYCLICAL</dms_source_type>
<dms_cycle_year>2000</dms_cycle_year>
<opom_source>odowd</opom_source>
<opom_source_type>CYCLICAL</opom_source_type>
<opom_cycle_year>2000</opom_cycle_year>
<ocean_filename>Lana_ocean_1849_2006.nc</ocean_filename>
<ocean_filepath>noresm-only/atm/cam/camoslo</ocean_filepath>

</namelist_defaults>
Loading

0 comments on commit 647efef

Please sign in to comment.