@@ -236,28 +236,19 @@ void MAMMicrophysics::set_grids(
236
236
add_field<Computed>(" mam4_microphysics_tendency_renaming_cloud_borne" , vector3d_num_gas_aerosol_constituents, nondim, grid_name);
237
237
}
238
238
239
- <<<<<<< HEAD
240
239
// Creating a Linoz reader and setting Linoz parameters involves reading data
241
240
// from a file and configuring the necessary parameters for the Linoz model.
242
- #ifdef USE_OLD_LINOZ_FILE_READ
243
- if (config_.linoz .compute ) {
244
241
245
- =======
246
- >>>>>>> b16a6664e4 (EAMxx: Fixing variable names and add comments.)
247
- // NOTE: order matches mam4xx:
248
- // names of variables in oxid file.
249
- var_names_oxi_={" O3" , " OH" , " NO3" , " HO2" };
250
242
// names of variables for linoz
251
- var_names_linoz_ = {
243
+ if (config_.linoz .compute ) {
244
+ var_names_linoz_ = {
252
245
" o3_clim" , " o3col_clim" , " t_clim" , " PmL_clim" ,
253
246
" dPmL_dO3" , " dPmL_dT" , " dPmL_dO3col" , " cariolle_pscs" };
254
- <<<<<<< HEAD
255
- std::cout << " Using former reader..." << " \n " ;
256
- =======
257
-
247
+ }
258
248
#ifdef USE_OLD_LINOZ_FILE_READ
259
- {
260
- >>>>>>> b16a6664e4 (EAMxx: Fixing variable names and add comments.)
249
+ if (config_.linoz .compute ) {
250
+
251
+ std::cout << " Using former reader..." << " \n " ;
261
252
linoz_file_name_ = m_params.get <std::string>(" mam4_linoz_file_name" );
262
253
const std::string linoz_map_file =
263
254
m_params.get <std::string>(" aero_microphys_remap_file" , " " );
@@ -281,7 +272,9 @@ void MAMMicrophysics::set_grids(
281
272
linoz_data_.init (num_cols_io_linoz, num_levs_io_linoz, nvars);
282
273
linoz_data_.allocate_temporary_views ();
283
274
} // LINOZ reader
284
-
275
+ // NOTE: order matches mam4xx:
276
+ // names of variables in oxid file.
277
+ var_names_oxi_={" O3" , " OH" , " NO3" , " HO2" };
285
278
{
286
279
oxid_file_name_ = m_params.get <std::string>(" mam4_oxid_file_name" );
287
280
const std::string oxid_map_file =
@@ -311,9 +304,11 @@ void MAMMicrophysics::set_grids(
311
304
} // oxid file reader
312
305
313
306
#else
314
- // The DataInterpolation class uses Field. We save these fields in FM.
315
- for (const auto &field_name : var_names_linoz_) {
307
+ if (config_.linoz .compute ) {
308
+ // The DataInterpolation class uses Field. We save these fields in FM.
309
+ for (const auto &field_name : var_names_linoz_) {
316
310
add_field<Computed>(field_name, scalar3d_mid, nondim, grid_name);
311
+ }
317
312
}
318
313
for (const auto &field_name : var_names_oxi_) {
319
314
add_field<Computed>(field_name, scalar3d_mid, nondim, grid_name);
@@ -735,7 +730,7 @@ void MAMMicrophysics::initialize_impl(const RunType run_type) {
735
730
add_postcondition_check<Interval>(get_field_out("cldfrac_liq"),m_grid,0.0,1.0,false);
736
731
add_postcondition_check<LowerBound>(get_field_out("tke"),m_grid,0);
737
732
*/
738
-
733
+ # ifdef USE_OLD_LINOZ_FILE_READ
739
734
if (config_.linoz .compute ) {
740
735
// climatology data for linear stratospheric chemistry
741
736
auto linoz_o3_clim = buffer_.scratch [0 ]; // ozone (climatology) [vmr]
@@ -753,7 +748,7 @@ void MAMMicrophysics::initialize_impl(const RunType run_type) {
753
748
// overhead O3 column [vmr/DU]
754
749
auto linoz_cariolle_pscs =
755
750
buffer_.scratch [7 ]; // Cariolle parameter for PSC loss of ozone [1/s]
756
- #endif
751
+
757
752
auto ts = start_of_step_ts ();
758
753
std::string linoz_chlorine_file =
759
754
m_params.get <std::string>(" mam4_linoz_chlorine_file" );
@@ -762,7 +757,7 @@ void MAMMicrophysics::initialize_impl(const RunType run_type) {
762
757
linoz_chlorine_file, ts, chlorine_loading_ymd, chlorine_values_,
763
758
chlorine_time_secs_);
764
759
}
765
-
760
+ # endif
766
761
init_temporary_views ();
767
762
// FIXME : why are we only using nlev_ instead of ncol_xnlev?
768
763
cmfdqr_ = view_1d (" cmfdqr_" , nlev_);
@@ -779,7 +774,9 @@ void MAMMicrophysics::initialize_impl(const RunType run_type) {
779
774
TracerDataReader_, curr_month, *TracerHorizInterp_, tracer_data_);
780
775
#else
781
776
set_oxid_reader ();
782
- set_linoz_reader ();
777
+ if (config_.linoz .compute ) {
778
+ set_linoz_reader ();
779
+ }
783
780
#endif
784
781
785
782
#ifdef USE_OLD_VERTICAL_FILE_READ
@@ -915,8 +912,8 @@ void MAMMicrophysics::run_impl(const double dt) {
915
912
}
916
913
917
914
918
- view_2d linoz_output[ 8 ];
919
- if (config_. linoz . compute ) {
915
+
916
+ # ifdef USE_OLD_LINOZ_FILE_READ
920
917
// climatology data for linear stratospheric chemistry
921
918
// ozone (climatology) [vmr]
922
919
view_2d linoz_o3_clim;
@@ -934,39 +931,20 @@ void MAMMicrophysics::run_impl(const double dt) {
934
931
view_2d linoz_dPmL_dO3col;
935
932
// Cariolle parameter for PSC loss of ozone [1/s]
936
933
view_2d linoz_cariolle_pscs;
937
-
938
-
939
- linoz_output[0 ] = linoz_o3_clim;
940
- linoz_output[1 ] = linoz_o3col_clim;
941
- linoz_output[2 ] = linoz_t_clim;
942
- linoz_output[3 ] = linoz_PmL_clim;
943
- linoz_output[4 ] = linoz_dPmL_dO3;
944
- linoz_output[5 ] = linoz_dPmL_dT;
945
- linoz_output[6 ] = linoz_dPmL_dO3col;
946
- linoz_output[7 ] = linoz_cariolle_pscs;
947
- }
948
934
#else
949
- // FIXME: I will need to modify perform_atmospheric_chemistry_and_microphysics in MAM4xx.
950
- // Let's do that after we have tested the new interface for DataInterpolation.
951
- // const auto linoz_o3_clim = get_field_in("o3_clim").get_view<const Real **>();
952
- // const auto linoz_o3col_clim = get_field_in("o3col_clim").get_view<const Real **>();
953
- // const auto linoz_t_clim = get_field_in("t_clim").get_view<const Real **>();
954
- // const auto linoz_PmL_clim = get_field_in("PmL_clim").get_view<const Real **>();
955
- // const auto linoz_dPmL_dO3 = get_field_in("dPmL_dO3").get_view<const Real **>();
956
- // const auto linoz_dPmL_dT = get_field_in("dPmL_dT").get_view<const Real **>();
957
- // const auto linoz_dPmL_dO3col = get_field_in("dPmL_dO3col").get_view<const Real **>();
958
- // const auto linoz_cariolle_pscs = get_field_in("cariolle_pscs").get_view<const Real **>();
959
935
data_interp_oxid_->run (end_of_step_ts ());
960
- data_interp_linoz_->run (end_of_step_ts ());
961
936
962
- const auto linoz_o3_clim = get_field_out (" o3_clim" ).get_view <Real **>();
963
- const auto linoz_o3col_clim = get_field_out (" o3col_clim" ).get_view <Real **>();
964
- const auto linoz_t_clim = get_field_out (" t_clim" ).get_view <Real **>();
965
- const auto linoz_PmL_clim = get_field_out (" PmL_clim" ).get_view <Real **>();
966
- const auto linoz_dPmL_dO3 = get_field_out (" dPmL_dO3" ).get_view <Real **>();
967
- const auto linoz_dPmL_dT = get_field_out (" dPmL_dT" ).get_view <Real **>();
968
- const auto linoz_dPmL_dO3col = get_field_out (" dPmL_dO3col" ).get_view <Real **>();
969
- const auto linoz_cariolle_pscs = get_field_out (" cariolle_pscs" ).get_view <Real **>();
937
+ if (config_.linoz .compute ) {
938
+ data_interp_linoz_->run (end_of_step_ts ());
939
+ linoz_o3_clim = get_field_out (" o3_clim" ).get_view <Real **>();
940
+ linoz_o3col_clim = get_field_out (" o3col_clim" ).get_view <Real **>();
941
+ linoz_t_clim = get_field_out (" t_clim" ).get_view <Real **>();
942
+ linoz_PmL_clim = get_field_out (" PmL_clim" ).get_view <Real **>();
943
+ linoz_dPmL_dO3 = get_field_out (" dPmL_dO3" ).get_view <Real **>();
944
+ linoz_dPmL_dT = get_field_out (" dPmL_dT" ).get_view <Real **>();
945
+ linoz_dPmL_dO3col = get_field_out (" dPmL_dO3col" ).get_view <Real **>();
946
+ linoz_cariolle_pscs = get_field_out (" cariolle_pscs" ).get_view <Real **>();
947
+ }
970
948
971
949
const auto oxid_O3 = get_field_out (" O3" ).get_view <Real **>();
972
950
const auto oxid_OH = get_field_out (" OH" ).get_view <Real **>();
@@ -988,6 +966,7 @@ void MAMMicrophysics::run_impl(const double dt) {
988
966
}
989
967
990
968
#ifdef USE_OLD_LINOZ_FILE_READ
969
+ const auto &cnst_offline = cnst_offline_;
991
970
// Update the TracerTimeState to reflect the current time
992
971
trace_time_state_.t_now = ts.frac_of_year_in_days ();
993
972
scream::mam_coupling::advance_tracer_data (
@@ -998,7 +977,6 @@ void MAMMicrophysics::run_impl(const double dt) {
998
977
dry_atm_.p_mid , dry_atm_.z_iface , // in
999
978
cnst_offline_); // out
1000
979
Kokkos::fence ();
1001
- const auto &cnst_offline = cnst_offline_;
1002
980
1003
981
if (config_.linoz .compute ) {
1004
982
view_2d linoz_output[8 ];
@@ -1010,7 +988,6 @@ void MAMMicrophysics::run_impl(const double dt) {
1010
988
linoz_output[5 ] = linoz_dPmL_dT;
1011
989
linoz_output[6 ] = linoz_dPmL_dO3col;
1012
990
linoz_output[7 ] = linoz_cariolle_pscs;
1013
-
1014
991
scream::mam_coupling::advance_tracer_data (
1015
992
LinozDataReader_, // in
1016
993
*LinozHorizInterp_, // out
@@ -1021,6 +998,7 @@ void MAMMicrophysics::run_impl(const double dt) {
1021
998
Kokkos::fence ();
1022
999
}
1023
1000
#endif
1001
+
1024
1002
#ifdef USE_OLD_VERTICAL_FILE_READ
1025
1003
int i = 0 ;
1026
1004
for (const auto &var_name : extfrc_lst_) {
@@ -1188,6 +1166,12 @@ void MAMMicrophysics::run_impl(const double dt) {
1188
1166
for (int i = 0 ; i < mam4::mo_setinv::num_tracer_cnst; ++i) {
1189
1167
cnst_offline_icol[i] = ekat::subview (cnst_offline[i], icol);
1190
1168
}
1169
+ #else
1170
+ cnst_offline_icol[0 ] = ekat::subview (oxid_O3, icol);;
1171
+ cnst_offline_icol[1 ] = ekat::subview (oxid_OH, icol);;
1172
+ cnst_offline_icol[2 ] = ekat::subview (oxid_NO3, icol);;
1173
+ cnst_offline_icol[3 ] = ekat::subview (oxid_HO2, icol);;
1174
+ #endif
1191
1175
// calculate o3 column densities (first component of col_dens in Fortran
1192
1176
// code)
1193
1177
auto o3_col_dens_i = ekat::subview (o3_col_dens, icol);
0 commit comments