You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
EAMxx: Data interpolation for MAM4 microphysics.
Our current implementation of the reader for Linoz, invariants, and vertical emission files uses an approach based on the former SPA reader. @bartgol implemented the DataInterpolation class, which provides more flexibility to handle different types of files. Here, we are using this DataInterpolation class to read the necessary files for the MAM4 microphysics interface. Because MAM4 still uses the vertical interpolation from EAM (the ported version), I have added three new vertical interpolation types to this class and created a VerticalRemapperMAM4 class for MAM4 vertical interpolation.
This PR also fixes the time interpolation issue for Linoz, invariant, and vertical emission fields.
Because we will use single-year NetCDF files for elevated emissions, invariants, and Linoz, the following namelist parameters were deleted: mam4_linoz_ymd, mam4_oxid_ymd, and elevated_emiss_ymd.
I implemented the VerticalRemapperMAM4 class, which inherits from VerticalRemapper, to invoke MAM4xx vertical interpolation routines that were ported from EAM. The DataInterpolation class handles VerticalRemapperMAM4 as a custom vertical remapper.
In particular, VerticalRemapperMAM4 supports three types of vertical interpolation:
Details
1. `VerticalRemapperMAM4::MAM4_PSRef` This is equivalent to `DataInterpolation::VRemapType::Dynamic3DRef`, where the source pressure field is computed as:
psrc(icol,k)=ps_v(icol)⋅hybm(k)+P0⋅hyam(k)
The main difference is that MAM4_PSRef invokes the mam4::vertical_interpolation::vert_interp routine.
I added a boolean parameter, mam4_use_mam4xx_oxi_vert_remap, to allow users to switch between MAM4_PSRef and DataInterpolation::VRemapType::Dynamic3DRef. Currently, this parameter is hardcoded to true, meaning oxidant vertical interpolation will be performed using the MAM4xx routine. However, if the evaluation team is interested in testing the use of DataInterpolation::VRemapType::Dynamic3DRef, this parameter can be moved to the namelist.
VerticalRemapperMAM4::MAM4_ZONAL
This vertical interpolation type is similar to DataInterpolation::Static1D, where a 1D variable is used as the independent variable. In the case of MAM4_ZONAL, the independent variable is lev with units of mbar. The main difference is that MAM4_ZONAL invokes the mam4::vertical_interpolation::vert_interp routine. Note that in this case, unit conversion from mbar to Pascals is handled by mam4::vertical_interpolation::vert_interp.
3. VerticalRemapperMAM4::MAM4_ELEVATED_EMISSIONS
This vertical interpolation type uses altitude as the independent variable. There is no equivalent in the VerticalRemapper for this case.
Tests (DataInterpolation for elevated emissions)
I tested this PR using only the DataInterpolation for elevated emissions. In this case, we expect the tests to pass, including baselines (BFB). However, I noted that the single-precision tests fail for gcc-openmp and gcc-cuda during the baseline comparison. Additionally, the test REP_D_Ln5.ne4pg2_oQU480.F2010-EAMxx-MAM4xx.ghci-snl-cpu_gnu is also failing in the baseline comparison.
gcc-cuda/sp and gcc-openmp/sp
Click to view detailed comparison
Most of the standalone tests are passing, except for gcc-cuda/sp and gcc-openmp/sp. It is important to note that the double-precision tests are passing, which means this implementation using the DataInterpolation class is producing BFB results consistent with the former reader (using @TaufiqHassan's correction for time interpolation).
REP_D_Ln5.ne4pg2_oQU480.F2010-EAMxx-MAM4xx.ghci-snl-cpu_gnu
Click to view detailed comparison
This test is failing with DIFFs, and these DIFFs increase as the number of time steps increases. I carefully reviewed this test and concluded that these DIFFs are very small in the first iteration. However, as MAM4 affects host model variables (in particular, temperature), these DIFFs increase over time. I conducted a couple of experiments where I ran both the old and new readers, and I found that the DIFFs remain small. For example:
Sector BFB Hash Value
forc_new_8_sector_0 12e765df7450c4b7 243788.7310767502
forc_old_8_sector_0 12e765df7450e328 243788.7310767502
forc_new_8_sector_1 4805cb37e8068d23 151464.7675245383
forc_old_8_sector_1 4805cb37e80691e7 151464.7675245383
forc_new_8_sector_2 3e98c5625d38c1fd 262341.6782332305
forc_old_8_sector_2 3e98c5625d38caa5 262341.6782332306
Using preprocessor directives (USE_OLD_LINOZ_FILE_READ and USE_OLD_VERTICAL_FILE_READ) was causing confusion for the evaluation team. Therefore, I decided to delete the former reader.
Tests (DataInterpolation for both invariants and linoz)
Before this PR, we knew there was a time interpolation issue inherited from the former SPA reader. Therefore, using the DataInterpolation class for invariants and Linoz will produce NBFB results in all tests where microphysics processes are involved. Thus, baseline tests are expected to fail for gcc-cuda, gcc-openmp, and REP_D_Ln5.ne4pg2_oQU480.F2010-EAMxx-MAM4xx.ghci-snl-cpu_gnu.
During the testing of DataInterpolation for invariants and Linoz, we found a bug in the former reader and noted that the DataInterpolation class only works for files containing single-year data. The bug in the former reader involved selecting the wrong year for interpolation during a restart, which caused the restart to be NBFB. This bug was fixed by replacing the NetCDF files for oxidants and Linoz. The new files contain only single-year data to accommodate the current features of the DataInterpolation class.
NC files
Elevated emissions
The DataInterpolation class relies on the time variable for time interpolation. In the elevated emission files currently used in the master branch, the time variable is not present. Instead, these files have the date variable. @meng630 helped add the time variable to these files. Note that we do not expect any changes due to these file updates.
Invariants
We are using new invariant files for the year 2015. We note that the current files do not contain data from 2010.
Linoz
We are using a single-year file for Linoz for the year 2010. In addition, we replaced the time variable and created a new time variable that does not assume years of 365 days and months of 30 days, which was causing interpolation issues in the DataInterpolation class. Note that the DataInterpolation class uses time instead of date for time interpolation.
NBFB
This PR introduces modifications that, in theory, should not produce significant changes and is expected to be a BFB PR. However, we have identified a few tests that are failing due to baseline comparisons. As a result, this PR will be classified as NBFB.
These tests are failing because of the baselines:
gcc-openmp/sp and gcc-cuda/dbg
mam4_aero_microphys_standalone_baseline_cmp
DIFF REP_D_Ln5.ne4pg2_oQU480.F2010-EAMxx-MAM4xx.ghci-snl-cpu_gnu.eamxx-L72 (phase BASELINE)
Key Findings
@singhbalwinder and @odiazib investigated the cause of the BFB behavior and found that the issues primarily arise from the alpha parameter involved in the linear interpolation. In the `DataInterpolation` class, our current implementation for reading tracers in `mam4xx` utilizes the following linear interpolation formula:
x_interpolated = x1 * alpha + x2 * (1 - alpha)
where:
x1 is the value at time 1,
x2 is the value at time 2,
x_interpolated is the value at the current time, and
alpha = (t_now - t1) / (t2 - t1).
DIFFs in Standalone Tests: We noted that DIFFs in standalone tests are only present in the single precision cases (CUDA and OpenMP). In these instances, the alpha parameter is hard-coded to double in the DataInterpolation class, leading to the observed DIFFs. For reference, see the implementation here.
Impact on t_now: In the case of REP_D_Ln5.ne4pg2_oQU480.F2010-EAMxx-MAM4xx.ghci-snl-cpu_gnu.eamxx-L72, we found that the changes in this PR are producing small variations in the value of t_now. These differences are in the last digits of t_now and propagate to alpha.
[NBFB]
* odiazib/eamxx/data_interpolation_microphysics: (29 commits)
EAMxx:Fixes made after rebase.
EAMxx: Add info to logger.
EAMxx: Fixes after rebasing.
EAMxx: Adding oxid_ to avoid conflicts with gases treated as tracers.
EAMxx: Update linoz and oxid files in cmake and input.yaml.
EAMxx: Removing unused code; including mam4_linoz_ymd, mam4_oxid_ymd, and elevated_emiss_ymd from namelist.
EAMxx: Removing code from tracer_reader_utils.
EAMxx: Deleting code for former reader (Linoz and invariants).
EAMxx: Deleting code for former reader.
EAMxx: Using one year files for linoz and invariants.
EAMxx: Using z_mam4_int.
EAMxx: Rename z_iface to z_int.
EAMxx: Using (1,1,1) as ref_ts.
EAMxx: Fixing after rebasing against master.
EAMxx: Fixing variable names and add comments.
EAMxx: Do not run test on AT2.
EAMxx: Removing unused code.
EAMx: Fixing dynamics_physics test for microphysics.
EAMxx: Adding z_iface to namelist.
EAMxx: Adding z_iface : 0.0 to yaml file in standalone tests.
...
<mam4_so2_elevated_emiss_file_nametype="file"doc="elevated emissions for so2">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne30pg2/elevated/cmip6_mam4_so2_elev_1x1_2010_clim_ne30pg2_c20241008.nc</mam4_so2_elevated_emiss_file_name>
340
-
<mam4_so4_a1_elevated_emiss_file_nametype="file"doc="elevated emissions for so4_a1">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne30pg2/elevated/cmip6_mam4_so4_a1_elev_1x1_2010_clim_ne30pg2_c20241008.nc</mam4_so4_a1_elevated_emiss_file_name>
341
-
<mam4_so4_a2_elevated_emiss_file_nametype="file"doc="elevated emissions for ao4_a2">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne30pg2/elevated/cmip6_mam4_so4_a2_elev_1x1_2010_clim_ne30pg2_c20241008.nc</mam4_so4_a2_elevated_emiss_file_name>
342
-
<mam4_pom_a4_elevated_emiss_file_nametype="file"doc="elevated emissions for pom_a4">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne30pg2/elevated/cmip6_mam4_pom_a4_elev_1x1_2010_clim_ne30pg2_c20241008.nc</mam4_pom_a4_elevated_emiss_file_name>
343
-
<mam4_bc_a4_elevated_emiss_file_nametype="file"doc="elevated emissions for bc_a4">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne30pg2/elevated/cmip6_mam4_bc_a4_elev_1x1_2010_clim_ne30pg2_c20241008.nc</mam4_bc_a4_elevated_emiss_file_name>
344
-
<mam4_num_a1_elevated_emiss_file_nametype="file"doc="elevated emissions for num_a1">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne30pg2/elevated/cmip6_mam4_num_a1_elev_1x1_2010_clim_ne30pg2_c20241008.nc</mam4_num_a1_elevated_emiss_file_name>
345
-
<mam4_num_a2_elevated_emiss_file_nametype="file"doc="elevated emissions for num_a2">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne30pg2/elevated/cmip6_mam4_num_a2_elev_1x1_2010_clim_ne30pg2_c20241008.nc</mam4_num_a2_elevated_emiss_file_name>
346
-
<mam4_num_a4_elevated_emiss_file_nametype="file"doc="elevated emissions for num_a4">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne30pg2/elevated/cmip6_mam4_num_a4_elev_1x1_2010_clim_ne30pg2_c20241008.nc</mam4_num_a4_elevated_emiss_file_name>
347
-
<mam4_soag_elevated_emiss_file_nametype="file"doc="elevated emissions for soag">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne30pg2/elevated/cmip6_mam4_soag_elev_1x1_2010_clim_ne30pg2_c20241008.nc</mam4_soag_elevated_emiss_file_name>
335
+
<mam4_so2_elevated_emiss_file_nametype="file"doc="elevated emissions for so2">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne30pg2/elevated/cmip6_mam4_so2_elev_1x1_2010_clim_ne30pg2_c20250630.nc</mam4_so2_elevated_emiss_file_name>
336
+
<mam4_so4_a1_elevated_emiss_file_nametype="file"doc="elevated emissions for so4_a1">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne30pg2/elevated/cmip6_mam4_so4_a1_elev_1x1_2010_clim_ne30pg2_c20250630.nc</mam4_so4_a1_elevated_emiss_file_name>
337
+
<mam4_so4_a2_elevated_emiss_file_nametype="file"doc="elevated emissions for ao4_a2">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne30pg2/elevated/cmip6_mam4_so4_a2_elev_1x1_2010_clim_ne30pg2_c20250630.nc</mam4_so4_a2_elevated_emiss_file_name>
338
+
<mam4_pom_a4_elevated_emiss_file_nametype="file"doc="elevated emissions for pom_a4">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne30pg2/elevated/cmip6_mam4_pom_a4_elev_1x1_2010_clim_ne30pg2_c20250630.nc</mam4_pom_a4_elevated_emiss_file_name>
339
+
<mam4_bc_a4_elevated_emiss_file_nametype="file"doc="elevated emissions for bc_a4">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne30pg2/elevated/cmip6_mam4_bc_a4_elev_1x1_2010_clim_ne30pg2_c20250630.nc</mam4_bc_a4_elevated_emiss_file_name>
340
+
<mam4_num_a1_elevated_emiss_file_nametype="file"doc="elevated emissions for num_a1">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne30pg2/elevated/cmip6_mam4_num_a1_elev_1x1_2010_clim_ne30pg2_c20250630.nc</mam4_num_a1_elevated_emiss_file_name>
341
+
<mam4_num_a2_elevated_emiss_file_nametype="file"doc="elevated emissions for num_a2">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne30pg2/elevated/cmip6_mam4_num_a2_elev_1x1_2010_clim_ne30pg2_c20250630.nc</mam4_num_a2_elevated_emiss_file_name>
342
+
<mam4_num_a4_elevated_emiss_file_nametype="file"doc="elevated emissions for num_a4">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne30pg2/elevated/cmip6_mam4_num_a4_elev_1x1_2010_clim_ne30pg2_c20250630.nc</mam4_num_a4_elevated_emiss_file_name>
343
+
<mam4_soag_elevated_emiss_file_nametype="file"doc="elevated emissions for soag">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne30pg2/elevated/cmip6_mam4_soag_elev_1x1_2010_clim_ne30pg2_c20250630.nc</mam4_soag_elevated_emiss_file_name>
348
344
349
345
<!-- For ne4 grids -->
350
-
<mam4_so2_elevated_emiss_file_namehgrid="ne4np4.pg2"type="file"doc="elevated emissions for so2">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_so2_elev_1x1_2010_clim_ne4pg2_c20241008.nc</mam4_so2_elevated_emiss_file_name>
351
-
<mam4_so4_a1_elevated_emiss_file_namehgrid="ne4np4.pg2"type="file"doc="elevated emissions for so4_a1">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_so4_a1_elev_1x1_2010_clim_ne4pg2_c20241008.nc</mam4_so4_a1_elevated_emiss_file_name>
352
-
<mam4_so4_a2_elevated_emiss_file_namehgrid="ne4np4.pg2"type="file"doc="elevated emissions for so4_a2">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_so4_a2_elev_1x1_2010_clim_ne4pg2_c20241008.nc</mam4_so4_a2_elevated_emiss_file_name>
353
-
<mam4_pom_a4_elevated_emiss_file_namehgrid="ne4np4.pg2"type="file"doc="elevated emissions for pom_a4">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_pom_a4_elev_1x1_2010_clim_ne4pg2_c20241008.nc</mam4_pom_a4_elevated_emiss_file_name>
354
-
<mam4_bc_a4_elevated_emiss_file_namehgrid="ne4np4.pg2"type="file"doc="elevated emissions for bc_a4">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_bc_a4_elev_1x1_2010_clim_ne4pg2_c20241008.nc</mam4_bc_a4_elevated_emiss_file_name>
355
-
<mam4_num_a1_elevated_emiss_file_namehgrid="ne4np4.pg2"type="file"doc="elevated emissions for num_a1">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_num_a1_elev_1x1_2010_clim_ne4pg2_c20241008.nc</mam4_num_a1_elevated_emiss_file_name>
356
-
<mam4_num_a2_elevated_emiss_file_namehgrid="ne4np4.pg2"type="file"doc="elevated emissions for num_a2">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_num_a2_elev_1x1_2010_clim_ne4pg2_c20241008.nc</mam4_num_a2_elevated_emiss_file_name>
357
-
<mam4_num_a4_elevated_emiss_file_namehgrid="ne4np4.pg2"type="file"doc="elevated emissions for num_a4">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_num_a4_elev_1x1_2010_clim_ne4pg2_c20241008.nc</mam4_num_a4_elevated_emiss_file_name>
358
-
<mam4_soag_elevated_emiss_file_namehgrid="ne4np4.pg2"type="file"doc="elevated emissions for soag">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_soag_elev_1x1_2010_clim_ne4pg2_c20241008.nc</mam4_soag_elevated_emiss_file_name>
346
+
<mam4_so2_elevated_emiss_file_namehgrid="ne4np4.pg2"type="file"doc="elevated emissions for so2">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_so2_elev_1x1_2010_clim_ne4pg2_c20250701.nc</mam4_so2_elevated_emiss_file_name>
347
+
<mam4_so4_a1_elevated_emiss_file_namehgrid="ne4np4.pg2"type="file"doc="elevated emissions for so4_a1">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_so4_a1_elev_1x1_2010_clim_ne4pg2_c20250701.nc</mam4_so4_a1_elevated_emiss_file_name>
348
+
<mam4_so4_a2_elevated_emiss_file_namehgrid="ne4np4.pg2"type="file"doc="elevated emissions for so4_a2">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_so4_a2_elev_1x1_2010_clim_ne4pg2_c20250701.nc</mam4_so4_a2_elevated_emiss_file_name>
349
+
<mam4_pom_a4_elevated_emiss_file_namehgrid="ne4np4.pg2"type="file"doc="elevated emissions for pom_a4">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_pom_a4_elev_1x1_2010_clim_ne4pg2_c20250701.nc</mam4_pom_a4_elevated_emiss_file_name>
350
+
<mam4_bc_a4_elevated_emiss_file_namehgrid="ne4np4.pg2"type="file"doc="elevated emissions for bc_a4">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_bc_a4_elev_1x1_2010_clim_ne4pg2_c20250701.nc</mam4_bc_a4_elevated_emiss_file_name>
351
+
<mam4_num_a1_elevated_emiss_file_namehgrid="ne4np4.pg2"type="file"doc="elevated emissions for num_a1">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_num_a1_elev_1x1_2010_clim_ne4pg2_c20250701.nc</mam4_num_a1_elevated_emiss_file_name>
352
+
<mam4_num_a2_elevated_emiss_file_namehgrid="ne4np4.pg2"type="file"doc="elevated emissions for num_a2">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_num_a2_elev_1x1_2010_clim_ne4pg2_c20250701.nc</mam4_num_a2_elevated_emiss_file_name>
353
+
<mam4_num_a4_elevated_emiss_file_namehgrid="ne4np4.pg2"type="file"doc="elevated emissions for num_a4">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_num_a4_elev_1x1_2010_clim_ne4pg2_c20250701.nc</mam4_num_a4_elevated_emiss_file_name>
354
+
<mam4_soag_elevated_emiss_file_namehgrid="ne4np4.pg2"type="file"doc="elevated emissions for soag">${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_soag_elev_1x1_2010_clim_ne4pg2_c20250701.nc</mam4_soag_elevated_emiss_file_name>
359
355
360
356
<!-- Mapping Files for finer resolutions -->
361
357
<aero_microphys_remap_filetype="file"doc="File containing mapping data from the grid of frac land use files to the model grid. Unused if the grid is the same.">none</aero_microphys_remap_file>
@@ -711,6 +707,7 @@ be lost if SCREAM_HACK_XML is not enabled.
711
707
<num_c2type="real">0.0</num_c2>
712
708
<num_c3type="real">0.0</num_c3>
713
709
<num_c4type="real">0.0</num_c4>
710
+
<z_mam4_inttype="real">0.0</z_mam4_int>
714
711
<!-- Surface fluxes for the land model from MAM4xx wet scavenging-->
0 commit comments