Skip to content

Commit f5894d8

Browse files
Merge remote-tracking branch 'odiazib/eamxx/time_interpolation_linoz_oxid' (PR #7722)
EAMxx: Time interpolation for Linoz and Oxidants I am updating the time interpolation for LINOZ and oxidants. As part of this PR, the routines developed by @TaufiqHassan will be used. Additionally, the NetCDF files for LINOZ and oxidants are being replaced with updated versions due to issues with the time variable in the previous files. After this PR, time interpolation will be consistent with the DataInterpolation class and EAM. Note that we are using the routine implemented in PR 7381. Further details: The current implementation does not account for the number of days in each month; it only checks the month to select a time slice. The test mam4_aero_microphys_standalone_baseline_cmp will fail for the configurations gcc-openmp and gcc-cuda, except for gcc-openmp/fpe (this test does not compare baselines). The test cpu-gcc/REP_D_Ln5.ne4pg2_oQU480.F2010-EAMxx-MAM4xx will also fail the baseline comparison. [NBFB] * odiazib/eamxx/time_interpolation_linoz_oxid: EAMxx: Updating NetCDF files for standalone testing. The previous files contained an issue with the time variable. The new files are limited to a single year. Fixing the time interpolation for LINOZ and oxidants.
2 parents 69ce0d0 + 09acb5d commit f5894d8

File tree

3 files changed

+11
-20
lines changed

3 files changed

+11
-20
lines changed

components/eamxx/src/physics/mam/readfiles/tracer_reader_utils.hpp

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ struct TracerTimeSlice {
126126

127127
// Converts raw YYYYMMDD date integers into sorted TimeStamp-index pairs.
128128
// Assumes yearly periodicity for now.
129-
// NOTE: Consider adding support for transient data.
129+
// NOTE: Consider adding support for transient data.
130130
struct TracerTimeDatabase {
131131
std::vector<TracerTimeSlice> slices;
132132
scream::util::TimeLine timeline = scream::util::TimeLine::YearlyPeriodic;
@@ -148,7 +148,7 @@ struct TracerTimeDatabase {
148148
int get_next_idx(int idx) const {
149149
return (idx + 1) % slices.size();
150150
}
151-
151+
152152
// Finds the interval [t_i, t_{i+1}) that contains ts. Assumes cyclic behavior.
153153
int find_interval(const util::TimeStamp& ts) const {
154154
EKAT_REQUIRE_MSG(size() >= 2, "Time database has fewer than 2 time slices.");
@@ -362,7 +362,7 @@ inline void init_monthly_time_offset(TracerData& tracer_data,
362362
EKAT_REQUIRE_MSG(cyclical_ymd_index >= 0,
363363
"Error! Model time (" + std::to_string(cyclical_ymd) +
364364
") is not within tracer time period.");
365-
365+
366366
tracer_data.offset_time_index_ = cyclical_ymd_index;
367367
}
368368

@@ -383,7 +383,7 @@ inline void init_irregular_time_database(TracerData& tracer_data,
383383

384384
auto ts_model = convert_date(cyclical_ymd);
385385
const int interval = tracer_data.time_db.find_interval(ts_model);
386-
386+
387387
EKAT_REQUIRE_MSG(interval >= 0,
388388
"Error! Model time (" + std::to_string(cyclical_ymd) +
389389
") is not within the tracer time range.");
@@ -461,11 +461,7 @@ inline void setup_tracer_data(TracerData &tracer_data,
461461
}
462462

463463
// Time initialization logic — delegated to helpers above
464-
if (tracer_file_type == ELEVATED_EMISSIONS) {
465-
init_irregular_time_database(tracer_data, trace_data_file, cyclical_ymd);
466-
} else {
467-
init_monthly_time_offset(tracer_data, trace_data_file, cyclical_ymd);
468-
}
464+
init_irregular_time_database(tracer_data, trace_data_file, cyclical_ymd);
469465

470466
scorpio::release_file(trace_data_file);
471467
tracer_data.file_type = tracer_file_type;
@@ -624,7 +620,7 @@ inline void update_monthly_timestate(
624620
}
625621
}
626622

627-
// Loads time slice data before and after current timestamp (ts),
623+
// Loads time slice data before and after current timestamp (ts),
628624
// and prepares interpolation state. First call initializes both BEG and END.
629625
inline void update_irregular_timestate(
630626
const std::shared_ptr<AtmosphereInput>& scorpio_reader,
@@ -705,13 +701,8 @@ inline void update_tracer_timestate(
705701
TracerTimeState& time_state,
706702
TracerData& data_tracer)
707703
{
708-
if (data_tracer.file_type == ELEVATED_EMISSIONS) {
709-
update_irregular_timestate(scorpio_reader, ts, tracer_horiz_interp,
704+
update_irregular_timestate(scorpio_reader, ts, tracer_horiz_interp,
710705
time_state, data_tracer);
711-
} else {
712-
update_monthly_timestate(scorpio_reader, ts, tracer_horiz_interp,
713-
time_state, data_tracer);
714-
}
715706
}
716707

717708
// This function is based on the SPA::perform_time_interpolation function.

components/eamxx/tests/single-process/mam/aero_microphys/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/output.yaml
2525
# Ensure test input files are present in the data dir
2626
set (TEST_INPUT_FILES
2727
scream/init/${EAMxx_tests_IC_FILE_MAM4xx_72lev}
28-
scream/mam4xx/linoz/ne2np4/linoz1850-2015_2010JPL_CMIP6_10deg_58km_ne2np4_c20240724.nc
29-
scream/mam4xx/invariants/ne2np4/oxid_ne2np4_L26_1850-2015_c20240827.nc
28+
scream/mam4xx/linoz/ne2np4/linoz2010_2010JPL_CMIP6_10deg_58km_ne2np4_c20250923.nc
29+
scream/mam4xx/invariants/ne2np4/oxid_ne2np4_L26_2015_c20250923.nc
3030
scream/mam4xx/linoz/Linoz_Chlorine_Loading_CMIP6_0003-2017_c20171114.nc
3131
scream/mam4xx/photolysis/RSF_GT200nm_v3.0_c080811.nc
3232
scream/mam4xx/photolysis/temp_prs_GT200nm_JPL10_c130206.nc

components/eamxx/tests/single-process/mam/aero_microphys/input.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ eamxx:
2020
mam4_o3_lbl: 4
2121
mam4_psc_T : 193.0
2222
mam4_linoz_ymd : 20100101
23-
mam4_linoz_file_name : ${SCREAM_DATA_DIR}/mam4xx/linoz/ne2np4/linoz1850-2015_2010JPL_CMIP6_10deg_58km_ne2np4_c20240724.nc
24-
mam4_oxid_file_name : ${SCREAM_DATA_DIR}/mam4xx/invariants/ne2np4/oxid_ne2np4_L26_2015_c20250813.nc
23+
mam4_linoz_file_name : ${SCREAM_DATA_DIR}/mam4xx/linoz/ne2np4/linoz2010_2010JPL_CMIP6_10deg_58km_ne2np4_c20250923.nc
24+
mam4_oxid_file_name : ${SCREAM_DATA_DIR}/mam4xx/invariants/ne2np4/oxid_ne2np4_L26_2015_c20250923.nc
2525
mam4_oxid_ymd : 20150101
2626
mam4_linoz_chlorine_file : ${SCREAM_DATA_DIR}/mam4xx/linoz/Linoz_Chlorine_Loading_CMIP6_0003-2017_c20171114.nc
2727
mam4_chlorine_loading_ymd : 20100101

0 commit comments

Comments
 (0)