-
Notifications
You must be signed in to change notification settings - Fork 54
MAM4xx: Fixing the ne120 case for the microphysics interface. #3095
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 13 commits
8590674
f1c9a39
23fd730
e0a1f20
fa86f7a
9f6e83e
c07bc72
e3f6717
2508f47
806a6f1
9788c57
97b2dd7
37ae73a
342958c
3eb6d04
a596e6b
589742d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
#!/bin/sh | ||
#------------------------------------------------------ | ||
# MAM4xx adds additionaltracers to the simulation | ||
# Increase number of tracers for MAM4xx simulations | ||
#------------------------------------------------------ | ||
|
||
$CIMEROOT/../components/eamxx/cime_config/testdefs/testmods_dirs/scream/mam4xx/update_eamxx_num_tracers.sh -b | ||
|
||
#------------------------------------------------------ | ||
# Add aerosol microphysics process, force ne4pg2 | ||
# emission files and provide a ne4pg2->ne30pg2 mapping | ||
# file | ||
#------------------------------------------------------ | ||
alias ATMCHANGE='$CIMEROOT/../components/eamxx/scripts/atmchange' | ||
|
||
ATMCHANGE physics::atm_procs_list="mac_aero_mic,rrtmgp,mam4_aero_microphys" -b | ||
|
||
ATMCHANGE mam4_aero_microphys::mam4_so2_verti_emiss_file_name='${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_so2_elev_1x1_2010_clim_ne4pg2_c20241008.nc' -b | ||
ATMCHANGE mam4_aero_microphys::mam4_so4_a1_verti_emiss_file_name='${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_so4_a1_elev_1x1_2010_clim_ne4pg2_c20241008.nc' -b | ||
ATMCHANGE mam4_aero_microphys::mam4_so4_a2_verti_emiss_file_name='${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_so4_a2_elev_1x1_2010_clim_ne4pg2_c20241008.nc' -b | ||
ATMCHANGE mam4_aero_microphys::mam4_pom_a4_verti_emiss_file_name='${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_pom_a4_elev_1x1_2010_clim_ne4pg2_c20241008.nc' -b | ||
ATMCHANGE mam4_aero_microphys::mam4_bc_a4_verti_emiss_file_name='${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_bc_a4_elev_1x1_2010_clim_ne4pg2_c20241008.nc' -b | ||
ATMCHANGE mam4_aero_microphys::mam4_num_a1_verti_emiss_file_name='${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_num_a1_elev_1x1_2010_clim_ne4pg2_c20241008.nc' -b | ||
ATMCHANGE mam4_aero_microphys::mam4_num_a2_verti_emiss_file_name='${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_num_a2_elev_1x1_2010_clim_ne4pg2_c20241008.nc' -b | ||
ATMCHANGE mam4_aero_microphys::mam4_num_a4_verti_emiss_file_name='${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_num_a4_elev_1x1_2010_clim_ne4pg2_c20241008.nc' -b | ||
ATMCHANGE mam4_aero_microphys::mam4_soag_verti_emiss_file_name='${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_soag_elev_1x1_2010_clim_ne4pg2_c20241008.nc' -b | ||
ATMCHANGE mam4_aero_microphys::aero_microphys_remap_file='${DIN_LOC_ROOT}/atm/scream/maps/map_ne4pg2_to_ne30pg2_nco_c20241108.nc' -b | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,12 +66,19 @@ struct ForcingHelper { | |
}; | ||
|
||
enum TracerFileType { | ||
// file with PS ncol, lev, and time | ||
// file with ncol, lev, ilev, time and has P0 and PS as variables | ||
// example: oxidants | ||
FORMULA_PS, | ||
// nc zonal file from ncremap | ||
ZONAL, | ||
// vertical emission files | ||
// example: linoz | ||
ZONAL, | ||
// file with ncol, altitude, altitude_int, time | ||
// example: elevated (at a height) emissions of aerosols and precursors | ||
// NOTE: we must rename the default vertical tags when horiz remapping | ||
// NOTE: we vert remap in a different routine in mam4xx | ||
VERT_EMISSION, | ||
// Placeholder for cases where no file type is applicable | ||
NONE | ||
}; | ||
|
||
enum TracerDataIndex { BEG = 0, END = 1, OUT = 2 }; | ||
|
@@ -381,11 +388,6 @@ inline std::shared_ptr<AbstractRemapper> create_horiz_remapper( | |
model_grid->clone("tracer_horiz_interp_tgt_grid", true); | ||
horiz_interp_tgt_grid->reset_num_vertical_lev(tracer_data.nlevs_data); | ||
|
||
if(tracer_data.file_type == VERT_EMISSION) { | ||
horiz_interp_tgt_grid->reset_field_tag_name(LEV, "altitude"); | ||
horiz_interp_tgt_grid->reset_field_tag_name(ILEV, "altitude_int"); | ||
} | ||
|
||
const int ncols_model = model_grid->get_num_global_dofs(); | ||
std::shared_ptr<AbstractRemapper> remapper; | ||
if(tracer_data.ncols_data == ncols_model) { | ||
|
@@ -438,14 +440,31 @@ inline std::shared_ptr<AbstractRemapper> create_horiz_remapper( | |
|
||
inline std::shared_ptr<AtmosphereInput> create_tracer_data_reader( | ||
const std::shared_ptr<AbstractRemapper> &horiz_remapper, | ||
const std::string &tracer_data_file) { | ||
const std::string &tracer_data_file, | ||
const TracerFileType file_type = NONE) | ||
{ | ||
std::vector<Field> io_fields; | ||
for(int i = 0; i < horiz_remapper->get_num_fields(); ++i) { | ||
io_fields.push_back(horiz_remapper->get_src_field(i)); | ||
} | ||
const auto io_grid = horiz_remapper->get_src_grid(); | ||
return std::make_shared<AtmosphereInput>(tracer_data_file, io_grid, io_fields, | ||
if(file_type == VERT_EMISSION ){ | ||
// NOTE: If we are using a vertical emission nc file with altitude instead of lev, | ||
// we must rename this tag. | ||
// We need to perform a shallow clone of io_grid because tags are const in this object. | ||
auto horiz_interp_src_grid = | ||
io_grid->clone("tracer_horiz_interp_src_grid", true); | ||
horiz_interp_src_grid->reset_field_tag_name(LEV, "altitude"); | ||
horiz_interp_src_grid->reset_field_tag_name(ILEV, "altitude_int"); | ||
return std::make_shared<AtmosphereInput>(tracer_data_file, horiz_interp_src_grid, io_fields, | ||
true); | ||
} else{ | ||
// We do not need to rename tags in or clone io_grid for other types of files. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is partly the confusion and that's why I was unhappy about this PR. Your comments here don't add up to what's going on. What you should actually say is the following: "we must not rename the tags". If you rename the tags here for the zonal or formula_ps files, you will end up with errors. (You will be to rename the tags for the surface/none type though.) So, your branching logic is justified, but that wasn't clear to me (because the notes here made it sound it was just a preference; if it were just a preference, it'd simply be bad code imo --- we should only branch if we have to) Based on the info you provided in the main post, I believe the following is the best way to describe this messy situation. Let's take your enum for illustration: enum TracerFileType {
- // file with PS ncol, lev, and time
+ // file with ncol, lev, ilev, time and has P0 and PS as variables
+ // example: oxidants
FORMULA_PS,
- // nc zonal file from ncremap
+ // file with ncol, lev, ilev, time
+ // example: linoz
ZONAL,
- // vertical emission files
+ // file with ncol, altitude, altitude_int, time
+ // example: elevated (at a height) emissions of aerosols and precursors
+ // NOTE: we must rename the default vertical tags when horiz remapping
+ // NOTE: we vert remap in a different routine in mam4xx
VERT_EMISSION,
- //
+ // file with ncol, time
+ // example: surface emissions of aerosols and precursors
NONE
}; Note I referred to the "VERT_EMISSION" files as they are actually named "elevated" (that's in the name of the files). I think it would have been good to keep that terminology from EAM. I believe the "NONE" type includes the surface emission. In the messy namelist world of EAM, we roughly call these "ext_frc_" (VERT_) and "srf_emis_" (NONE). So, I think you should actually change the "NONE" type to something more meaningful. I would encourage you to check with people like Balwinder, Kai, and Mingxuan. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mingxuanwupnnl explained very well why to use the term "external forcings" for emissions (as they are applied like forcing in the equations). I think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can rename the enums. Note that we are not using the @singhbalwinder, is this change okay: renaming There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's change it to |
||
return std::make_shared<AtmosphereInput>(tracer_data_file, io_grid, io_fields, | ||
true); | ||
} | ||
|
||
|
||
} // create_tracer_data_reader | ||
|
||
inline void update_tracer_data_from_file( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should add a test
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To create a test, I will need to have a map file. Is it possible to include this test in a future PR? Note that the evaluation team is running additional cases that allow us to catch issues.