diff --git a/Code.v05-00/defaults/input.yaml b/Code.v05-00/defaults/input.yaml index d8dd54954..3153705d9 100644 --- a/Code.v05-00/defaults/input.yaml +++ b/Code.v05-00/defaults/input.yaml @@ -3,25 +3,9 @@ SIMULATION MENU: OUTPUT SUBMENU: Output folder (string): =MISSING= Overwrite if folder exists (T/F): T - # FFT options (for spectral solver) - Use threaded FFT (T/F): F - FFTW WISDOM SUBMENU: - Use FFTW WISDOM (T/F): T - Dir w/ write permission (string): =MISSING= # This mostly contains information on background aerosol concentration; Not too relevant for contrail behavior Input background condition (string): =DEFAULT= - # All parameters here are overwritten in EMISSION INDICES SUBMENU Input engine emissions (string): =DEFAULT= - # Ignore/Don't change these, these are deprecated features. - SAVE FORWARD RESULTS SUBMENU: - Save forward results (T/F): F - netCDF filename format (string): APCEMM_Case_* - ADJOINT OPTIMIZATION SUBMENU: - Turn on adjoint optim. (T/F): F - netCDF filename format (string): APCEMM_ADJ_Case_* - BOX MODEL SUBMENU: - Run box model (T/F): F - netCDF filename format (string): APCEMM_BOX_CASE_* RANDOM NUMBER GENERATION SUBMENU: Force seed value (T/F): F Seed value (positive int): 0 @@ -40,7 +24,6 @@ PARAMETER MENU: # Pressure altitude at which the contrail is initialized Pressure [hPa] (double): 265 Horiz. diff. coeff. [m^2/s] (double): 15.0 - # Can be overwritten if met file is passed Verti. diff. [m^2/s] (double): 0.15 Brunt-Vaisala Frequency [s^-1] (double): 0.013 LOCATION AND TIME SUBMENU: @@ -60,10 +43,6 @@ PARAMETER MENU: EMISSION INDICES SUBMENU: # Engine specific parameters # Default parameters are estimates for a 737-800 at 35k ft - # Affects EPM mostly: - NOx [g(NO2)/kg_fuel] (double): 10 # EDB for CFM56-5B3 - CO [g/kg_fuel] (double): 1 - UHC [g/kg_fuel] (double): 0.6 # Affects contrail diffusion model: SO2 [g/kg_fuel] (double): 1.2 # Assuming 600ppm of Sulfur SO2 to SO4 conv [%] (double): 2 # AEDT paper, Barrett et al. (2010) @@ -82,58 +61,31 @@ PARAMETER MENU: TRANSPORT MENU: # Keep on Turn on Transport (T/F): T - # Outdated, not used (was used by spectral solver) - Fill Negative Values (T/F): T Transport Timestep [min] (double): 1 - # Keep off: not sure of the effect yet + met updraft is included (if met file input) - PLUME UPDRAFT SUBMENU: - Turn on plume updraft (T/F): F - Updraft timescale [s] (double): 3600 - Updraft veloc. [cm/s] (double): 5 - -# Chemistry component of APCEMM hasn't been touched in a long time; leave off if only interested in contrail simulation -CHEMISTRY MENU: - Turn on Chemistry (T/F): F - Perform hetero. chem. (T/F): F - Photolysis rates folder (string): /path/to/input/ AEROSOL MENU: # Keep on Turn on grav. settling (T/F): T # Keep on Turn on solid coagulation (T/F): T - # Keep off - Turn on liquid coagulation (T/F): F # Keep on Turn on ice growth (T/F): T Ice growth timestep [min] (double): 1 -# At least one of "Use met. input", "Impose moist layer depth", or "Impose lapse rate" must be true -# Imposing moist layer depth will automatically calculate the lapse rate and override the imposed lapse rate - -# If using met. input: -# Exactly one of "Init temp. from met." and "Impose lapse rate" must be true -# Exactly one of "Init RH from met." and "Impose moist layer depth" must be true METEOROLOGY MENU: # --- MET INPUT OPTIONS ---+ METEOROLOGICAL INPUT SUBMENU: - Use met. input (T/F): T Met input file path (string): =MISSING= # Frequency of met data availability Time series data timestep [hr] (double): 1.0 - # If off, uses the parameter specified in METEOROLOGICAL PARAMETERS SUBMENU - Init temp. from met. (T/F): T Temp. time series input (T/F): T # Always interpolates in time, this controls spatial interpolation Interpolate temp. met. data (T/F): T # Same options as the ones for Temperature: - Init RH from met. (T/F): T RH time series input (T/F): T Interpolate RH met. data (T/F): T - Init wind shear from met. (T/F): T Wind shear time series input (T/F): T Interpolate shear met. data (T/F): F - Init vert. veloc. from met. data (T/F): T Vert. veloc. time series input (T/F): F Interpolate vert. veloc. met. data (T/F): F @@ -150,25 +102,10 @@ METEOROLOGY MENU: # The only thing that should be changed here is the save frequency DIAGNOSTIC MENU: - netCDF filename format (string): trac_avg.apcemm.hhmm - # Leave "save species timeseries" off. It will do nothing without also turning chemistry on. - SPECIES TIMESERIES SUBMENU: - Save species timeseries (T/F): F - Inst timeseries file (string): ts_hhmm.nc - #list input: separate by spaces. e.g. 1 2 3 4 5 - Species indices to include (list of ints): 1 - Save frequency [min] (double): 10 - # Index 1 (ice) is the only relevant thing to save AEROSOL TIMESERIES SUBMENU: Save aerosol timeseries (T/F): T Inst timeseries file (string): ts_aerosol_hhmm.nc - #list input: separate by spaces. e.g. 1 2 3 4 5 - Aerosol indices to include (list of ints): 1 Save frequency [min] (double): 10 - # Keep off if chemistry is also off - PRODUCTION & LOSS SUBMENU: - Turn on P/L diag (T/F): F - Save O3 P/L (T/F): F # Sometimes you have to change YLIM_DOWN here if the supersaturated layer is very thick # because YLIM_DOWN must be larger than the layer thickness. @@ -182,13 +119,6 @@ ADVANCED OPTIONS MENU: XLIM_LEFT (positive double): 1.0e+3 YLIM_UP (positive double): 300 YLIM_DOWN (positive double): 1.5e+3 - INITIAL CONTRAIL SIZE SUBMENU: - #Depth = BaseDepth + DepthScalingFactor * Default_Depth - #Same formula for width - Base Contrail Depth [m] (double): 0.0 - Contrail Depth Scaling Factor [-] (double): 1.0 - Base Contrail Width [m] (double): 0.0 - Contrail Width Scaling Factor [-] (double): 1.0 Ambient Lapse Rate [K/km] (double): -3.0 Tropopause Pressure [Pa] (double): 2.0e+4 EARLY PLUME SUBMENU: diff --git a/Code.v05-00/include/Core/Aircraft.hpp b/Code.v05-00/include/Core/Aircraft.hpp index 11007d0c5..b8f86b1c7 100644 --- a/Code.v05-00/include/Core/Aircraft.hpp +++ b/Code.v05-00/include/Core/Aircraft.hpp @@ -69,9 +69,6 @@ class Aircraft inline const Vortex& vortex() const { return vortex_; } /* Setters for engine properties */ - void setEI_NOx(const double NOx); - void setEI_CO(const double CO); - void setEI_HC(const double HC); void setEI_Soot(const double Soot); void setSootRad(const double sootRad); void setFuelFlow(const double ff); diff --git a/Code.v05-00/include/Core/Input.hpp b/Code.v05-00/include/Core/Input.hpp index 7fae0118b..1e048b73a 100644 --- a/Code.v05-00/include/Core/Input.hpp +++ b/Code.v05-00/include/Core/Input.hpp @@ -39,9 +39,6 @@ class Input UInt emissionDOY_ = 0; double emissionTime_ = 0.0; - double EI_NOx_ = 0.0; - double EI_CO_ = 0.0; - double EI_HC_ = 0.0; double EI_SO2_ = 0.0; double EI_SO2TOSO4_ = 0.0; double EI_Soot_ = 0.0; @@ -97,9 +94,6 @@ class Input UInt emissionMonth() const { return emissionMonth_; } double emissionTime() const { return emissionTime_; } - double EI_NOx() const { return EI_NOx_; } - double EI_CO() const { return EI_CO_; } - double EI_HC() const { return EI_HC_; } double EI_SO2() const { return EI_SO2_; } double EI_SO2TOSO4() const { return EI_SO2TOSO4_; } double EI_Soot() const { return EI_Soot_; } @@ -136,9 +130,6 @@ class Input void set_emissionDOY( UInt emissionDOY ) { emissionDOY_ = emissionDOY; } void set_emissionTime( double emissionTime ) { emissionTime_ = emissionTime; } - void set_EI_NOx( double EI_NOx ) { EI_NOx_ = EI_NOx; } - void set_EI_CO( double EI_CO ) { EI_CO_ = EI_CO; } - void set_EI_HC( double EI_HC ) { EI_HC_ = EI_HC; } void set_EI_SO2( double EI_SO2 ) { EI_SO2_ = EI_SO2; } void set_EI_SO2TOSO4( double EI_SO2TOSO4 ) { EI_SO2TOSO4_ = EI_SO2TOSO4; } void set_EI_Soot( double EI_Soot ) { EI_Soot_ = EI_Soot; } diff --git a/Code.v05-00/include/Core/Input_Mod.hpp b/Code.v05-00/include/Core/Input_Mod.hpp index 2b08881dc..1c85257a4 100644 --- a/Code.v05-00/include/Core/Input_Mod.hpp +++ b/Code.v05-00/include/Core/Input_Mod.hpp @@ -31,17 +31,8 @@ struct OptInput int SIMULATION_OMP_NUM_THREADS; std::string SIMULATION_OUTPUT_FOLDER; bool SIMULATION_OVERWRITE; - bool SIMULATION_THREADED_FFT; - bool SIMULATION_USE_FFTW_WISDOM; - std::string SIMULATION_DIRECTORY_W_WRITE_PERMISSION; std::string SIMULATION_INPUT_BACKG_COND; std::string SIMULATION_INPUT_ENG_EI; - bool SIMULATION_SAVE_FORWARD; - std::string SIMULATION_FORWARD_FILENAME; - bool SIMULATION_ADJOINT; - std::string SIMULATION_ADJOINT_FILENAME; - bool SIMULATION_BOXMODEL; - std::string SIMULATION_BOX_FILENAME; bool SIMULATION_FORCE_SEED; unsigned int SIMULATION_SEED_VALUE; epm_type SIMULATION_EPM_TYPE; @@ -56,19 +47,7 @@ struct OptInput /* ========================================== */ bool TRANSPORT_TRANSPORT; - bool TRANSPORT_FILL; double TRANSPORT_TIMESTEP; - bool TRANSPORT_UPDRAFT; - double TRANSPORT_UPDRAFT_TIMESCALE; - double TRANSPORT_UPDRAFT_VELOCITY; - - /* ========================================== */ - /* ---- CHEMISTRY MENU ---------------------- */ - /* ========================================== */ - - bool CHEMISTRY_CHEMISTRY; - bool CHEMISTRY_HETCHEM; - std::string CHEMISTRY_JRATE_FOLDER; /* ========================================== */ /* ---- AEROSOL MENU ------------------------ */ @@ -76,7 +55,6 @@ struct OptInput bool AEROSOL_GRAVSETTLING; bool AEROSOL_COAGULATION_SOLID; - bool AEROSOL_COAGULATION_LIQUID; bool AEROSOL_ICE_GROWTH; double AEROSOL_ICE_GROWTH_TIMESTEP; @@ -84,50 +62,27 @@ struct OptInput /* ---- METEOROLOGY MENU -------------------- */ /* ========================================== */ - bool MET_LOADMET; std::string MET_FILENAME; double MET_DT; - bool MET_LOADTEMP; bool MET_TEMPTIMESERIES; bool MET_INTERPTEMPDATA; - bool MET_LOADRH; bool MET_RHTIMESERIES; bool MET_INTERPRHDATA; - bool MET_LOADSHEAR; bool MET_SHEARTIMESERIES; bool MET_INTERPSHEARDATA; - bool MET_LOADVERTVELOC; bool MET_VERTVELOCTIMESERIES; bool MET_INTERPVERTVELOC; bool MET_ENABLE_TEMP_PERTURB; double MET_TEMP_PERTURB_AMPLITUDE; - /* ========================================== */ - /* ---- DIAGNOSTIC MENU --------------------- */ - /* ========================================== */ - - std::string DIAG_FILENAME; - /* ========================================== */ /* ---- TIMESERIES MENU --------------------- */ /* ========================================== */ - bool TS_SPEC; - std::string TS_FILENAME; - std::vector TS_SPECIES; - double TS_FREQ; bool TS_AERO; std::string TS_AERO_FILENAME; - std::vector TS_AEROSOL; double TS_AERO_FREQ; - /* ========================================== */ - /* ---- PROD & LOSS MENU -------------------- */ - /* ========================================== */ - - bool PL_PL; - bool PL_O3; - /* =============================================== */ /* ---- ADVANCED OPTIONS MENU -------------------- */ /* =============================================== */ @@ -138,10 +93,6 @@ struct OptInput double ADV_GRID_XLIM_LEFT; double ADV_GRID_YLIM_UP; double ADV_GRID_YLIM_DOWN; - double ADV_CSIZE_DEPTH_BASE; - double ADV_CSIZE_DEPTH_SCALING_FACTOR; - double ADV_CSIZE_WIDTH_BASE; - double ADV_CSIZE_WIDTH_SCALING_FACTOR; double ADV_AMBIENT_LAPSERATE; double ADV_TROPOPAUSE_PRESSURE; double ADV_EP_N_REF; diff --git a/Code.v05-00/include/Core/MPMSimVarsWrapper.hpp b/Code.v05-00/include/Core/MPMSimVarsWrapper.hpp index 29d4daab1..fab15d789 100644 --- a/Code.v05-00/include/Core/MPMSimVarsWrapper.hpp +++ b/Code.v05-00/include/Core/MPMSimVarsWrapper.hpp @@ -9,33 +9,14 @@ struct MPMSimVarsWrapper{ /* --- Input options from the SIMULATION MENU ---------------------------- */ /* ======================================================================= */ - bool RUN_BOXMODEL; bool BUILD_LUT; - bool SAVE_FORWARD; - bool ADJOINT; std::string BACKG_FILENAME; - bool THREADED_FFT; - bool USE_WISDOM; - std::string FFTW_DIR; /* ======================================================================= */ /* ---- Input options from the TRANSPORT MENU ---------------------------- */ /* ======================================================================= */ bool TRANSPORT; - bool FILLNEG; - - bool UPDRAFT; - double UPDRAFT_TIME; - double UPDRAFT_VEL; - - /* ======================================================================= */ - /* ---- Input options from the CHEMISTRY MENU ---------------------------- */ - /* ======================================================================= */ - - bool CHEMISTRY; - bool HETCHEM; - std::string JRATE_FOLDER; /* ======================================================================= */ /* ---- Input options from the AEROSOL MENU ------------------------------ */ @@ -56,35 +37,15 @@ struct MPMSimVarsWrapper{ bool TEMP_PERTURB; double metDepth; - /* ======================================================================= */ - /* ---- Input options from the DIAGNOSTIC MENU --------------------------- */ - /* ======================================================================= */ - - std::string DIAG_FILENAME; - /* ======================================================================= */ /* ---- Input options from the TIMESERIES MENU --------------------------- */ /* ======================================================================= */ std::string TS_FOLDER; - bool TS_SPEC; - std::string TS_SPEC_FILEPATH; - std::vector TS_SPEC_LIST; - double TS_FREQ; - bool TS_AERO; std::string TS_AERO_FILEPATH; - std::vector TS_AERO_LIST; double TS_AERO_FREQ; - /* ======================================================================= */ - /* ---- Input options from the PROD & LOSS MENU -------------------------- */ - /* ======================================================================= */ - - /* TODO: Implement PL rates */ - bool SAVE_PL; - bool SAVE_O3PL; - /* If DIAG_OUTPUT is turned on, make sure that output timestep is a * multiple of the dynamic timestep */ diff --git a/Code.v05-00/include/Core/Meteorology.hpp b/Code.v05-00/include/Core/Meteorology.hpp index 9a1b15dae..527fe7b7f 100644 --- a/Code.v05-00/include/Core/Meteorology.hpp +++ b/Code.v05-00/include/Core/Meteorology.hpp @@ -216,7 +216,6 @@ class Meteorology //Information on loading - bool useMetFileInput_; MetVarLoadType tempLoadType_; MetVarLoadType rhLoadType_; MetVarLoadType shearLoadType_; diff --git a/Code.v05-00/include/Defaults/Input.hpp b/Code.v05-00/include/Defaults/Input.hpp index 19bbe03d1..9a752e79f 100644 --- a/Code.v05-00/include/Defaults/Input.hpp +++ b/Code.v05-00/include/Defaults/Input.hpp @@ -4,25 +4,9 @@ SIMULATION MENU: OUTPUT SUBMENU: Output folder (string): =MISSING= Overwrite if folder exists (T/F): T - # FFT options (for spectral solver) - Use threaded FFT (T/F): F - FFTW WISDOM SUBMENU: - Use FFTW WISDOM (T/F): T - Dir w/ write permission (string): =MISSING= # This mostly contains information on background aerosol concentration; Not too relevant for contrail behavior Input background condition (string): =DEFAULT= - # All parameters here are overwritten in EMISSION INDICES SUBMENU Input engine emissions (string): =DEFAULT= - # Ignore/Don't change these, these are deprecated features. - SAVE FORWARD RESULTS SUBMENU: - Save forward results (T/F): F - netCDF filename format (string): APCEMM_Case_* - ADJOINT OPTIMIZATION SUBMENU: - Turn on adjoint optim. (T/F): F - netCDF filename format (string): APCEMM_ADJ_Case_* - BOX MODEL SUBMENU: - Run box model (T/F): F - netCDF filename format (string): APCEMM_BOX_CASE_* RANDOM NUMBER GENERATION SUBMENU: Force seed value (T/F): F Seed value (positive int): 0 @@ -41,7 +25,6 @@ PARAMETER MENU: # Pressure altitude at which the contrail is initialized Pressure [hPa] (double): 265 Horiz. diff. coeff. [m^2/s] (double): 15.0 - # Can be overwritten if met file is passed Verti. diff. [m^2/s] (double): 0.15 Brunt-Vaisala Frequency [s^-1] (double): 0.013 LOCATION AND TIME SUBMENU: @@ -61,10 +44,6 @@ PARAMETER MENU: EMISSION INDICES SUBMENU: # Engine specific parameters # Default parameters are estimates for a 737-800 at 35k ft - # Affects EPM mostly: - NOx [g(NO2)/kg_fuel] (double): 10 # EDB for CFM56-5B3 - CO [g/kg_fuel] (double): 1 - UHC [g/kg_fuel] (double): 0.6 # Affects contrail diffusion model: SO2 [g/kg_fuel] (double): 1.2 # Assuming 600ppm of Sulfur SO2 to SO4 conv [%] (double): 2 # AEDT paper, Barrett et al. (2010) @@ -83,58 +62,31 @@ PARAMETER MENU: TRANSPORT MENU: # Keep on Turn on Transport (T/F): T - # Outdated, not used (was used by spectral solver) - Fill Negative Values (T/F): T Transport Timestep [min] (double): 1 - # Keep off: not sure of the effect yet + met updraft is included (if met file input) - PLUME UPDRAFT SUBMENU: - Turn on plume updraft (T/F): F - Updraft timescale [s] (double): 3600 - Updraft veloc. [cm/s] (double): 5 - -# Chemistry component of APCEMM hasn't been touched in a long time; leave off if only interested in contrail simulation -CHEMISTRY MENU: - Turn on Chemistry (T/F): F - Perform hetero. chem. (T/F): F - Photolysis rates folder (string): /path/to/input/ AEROSOL MENU: # Keep on Turn on grav. settling (T/F): T # Keep on Turn on solid coagulation (T/F): T - # Keep off - Turn on liquid coagulation (T/F): F # Keep on Turn on ice growth (T/F): T Ice growth timestep [min] (double): 1 -# At least one of "Use met. input", "Impose moist layer depth", or "Impose lapse rate" must be true -# Imposing moist layer depth will automatically calculate the lapse rate and override the imposed lapse rate - -# If using met. input: -# Exactly one of "Init temp. from met." and "Impose lapse rate" must be true -# Exactly one of "Init RH from met." and "Impose moist layer depth" must be true METEOROLOGY MENU: # --- MET INPUT OPTIONS ---+ METEOROLOGICAL INPUT SUBMENU: - Use met. input (T/F): T Met input file path (string): =MISSING= # Frequency of met data availability Time series data timestep [hr] (double): 1.0 - # If off, uses the parameter specified in METEOROLOGICAL PARAMETERS SUBMENU - Init temp. from met. (T/F): T Temp. time series input (T/F): T # Always interpolates in time, this controls spatial interpolation Interpolate temp. met. data (T/F): T # Same options as the ones for Temperature: - Init RH from met. (T/F): T RH time series input (T/F): T Interpolate RH met. data (T/F): T - Init wind shear from met. (T/F): T Wind shear time series input (T/F): T Interpolate shear met. data (T/F): F - Init vert. veloc. from met. data (T/F): T Vert. veloc. time series input (T/F): F Interpolate vert. veloc. met. data (T/F): F @@ -151,25 +103,10 @@ METEOROLOGY MENU: # The only thing that should be changed here is the save frequency DIAGNOSTIC MENU: - netCDF filename format (string): trac_avg.apcemm.hhmm - # Leave "save species timeseries" off. It will do nothing without also turning chemistry on. - SPECIES TIMESERIES SUBMENU: - Save species timeseries (T/F): F - Inst timeseries file (string): ts_hhmm.nc - #list input: separate by spaces. e.g. 1 2 3 4 5 - Species indices to include (list of ints): 1 - Save frequency [min] (double): 10 - # Index 1 (ice) is the only relevant thing to save AEROSOL TIMESERIES SUBMENU: Save aerosol timeseries (T/F): T Inst timeseries file (string): ts_aerosol_hhmm.nc - #list input: separate by spaces. e.g. 1 2 3 4 5 - Aerosol indices to include (list of ints): 1 Save frequency [min] (double): 10 - # Keep off if chemistry is also off - PRODUCTION & LOSS SUBMENU: - Turn on P/L diag (T/F): F - Save O3 P/L (T/F): F # Sometimes you have to change YLIM_DOWN here if the supersaturated layer is very thick # because YLIM_DOWN must be larger than the layer thickness. @@ -183,13 +120,6 @@ ADVANCED OPTIONS MENU: XLIM_LEFT (positive double): 1.0e+3 YLIM_UP (positive double): 300 YLIM_DOWN (positive double): 1.5e+3 - INITIAL CONTRAIL SIZE SUBMENU: - #Depth = BaseDepth + DepthScalingFactor * Default_Depth - #Same formula for width - Base Contrail Depth [m] (double): 0.0 - Contrail Depth Scaling Factor [-] (double): 1.0 - Base Contrail Width [m] (double): 0.0 - Contrail Width Scaling Factor [-] (double): 1.0 Ambient Lapse Rate [K/km] (double): -3.0 Tropopause Pressure [Pa] (double): 2.0e+4 EARLY PLUME SUBMENU: diff --git a/Code.v05-00/include/EPM/Solution.hpp b/Code.v05-00/include/EPM/Solution.hpp index 278cc6127..61da2a59c 100644 --- a/Code.v05-00/include/EPM/Solution.hpp +++ b/Code.v05-00/include/EPM/Solution.hpp @@ -69,8 +69,7 @@ class Solution void processInputBackgroundLine(std::istream &s, Vector_1D &amb_Value, Vector_2D &aer_Value); void setAmbientConcentrations(const Input &input, Vector_1D &amb_Value); - void initializeSpeciesH2O(const Input &input, const OptInput &input_Opt, - Vector_1D &amb_Value, const double airDens, + void initializeSpeciesH2O(Vector_1D &amb_Value, const double airDens, const Meteorology &met); void setSpeciesValues(Vector_1D &AERFRAC, Vector_1D &SOLIDFRAC, const Vector_1D &stratData); diff --git a/Code.v05-00/include/YamlInputReader/YamlInputReader.hpp b/Code.v05-00/include/YamlInputReader/YamlInputReader.hpp index 65715b34b..5664cf8b2 100644 --- a/Code.v05-00/include/YamlInputReader/YamlInputReader.hpp +++ b/Code.v05-00/include/YamlInputReader/YamlInputReader.hpp @@ -22,6 +22,12 @@ namespace YamlInputReader{ "mode were removed, so every PARAMETER MENU entry takes exactly one value. To vary a " "parameter, write one input file per value and start one APCEMM process for each."; + // Appended to every error raised by an input file that still names an option which was + // parsed and stored but never read on any run path. + inline const string UNUSED_OPTION_MESSAGE = + "This option was read but never used, setting it never changed a " + "result. It is removed so that it can no longer be misleading."; + // Merge default and user provided files, returns a merged YAML::Node YAML::Node mergeYamlInputFiles(const vector& filenames); @@ -41,7 +47,6 @@ namespace YamlInputReader{ void readSimMenu(OptInput& input, const YAML::Node& simNode); void readParamMenu(Input& scenario, const YAML::Node& paramNode); void readTransportMenu(OptInput& input, const YAML::Node& transportNode); - void readChemMenu(OptInput& input, const YAML::Node& chemNode); void readAeroMenu(OptInput& input, const YAML::Node& aeroNode); void readMetMenu(OptInput& input, const YAML::Node& metNode); void readDiagMenu(OptInput& input, const YAML::Node& diagNode); diff --git a/Code.v05-00/src/Core/Aircraft.cpp b/Code.v05-00/src/Core/Aircraft.cpp index 7c5b1bd5a..5ceb46b86 100644 --- a/Code.v05-00/src/Core/Aircraft.cpp +++ b/Code.v05-00/src/Core/Aircraft.cpp @@ -42,9 +42,6 @@ Aircraft::Aircraft( const Input& input, std::string engineFilePath, std::string engNumber_ = input.numEngines(); setFuelFlow( input.fuelFlow() ); - setEI_NOx( input.EI_NOx() ); - setEI_CO( input.EI_CO() ); - setEI_HC( input.EI_HC() ); setEI_Soot( input.EI_Soot() ); setSootRad( input.sootRad() ); fuel_per_dist_ = input.fuelFlow() / vFlight_ms_; @@ -105,30 +102,6 @@ double Aircraft::VortexLosses( const double N_postjet, const double WV_exhaust, } /* End of Aircraft::VortexLosses */ -void Aircraft::setEI_NOx(const double NOx) -{ - - if ( NOx > 0.0E+00 ) - engine_.setEI_NOx(NOx); - -} /* End of Aircraft::setEI_NOx */ - -void Aircraft::setEI_CO(const double CO) -{ - - if ( CO > 0.0E+00 ) - engine_.setEI_CO(CO); - -} /* End of Aircraft::setEI_CO */ - -void Aircraft::setEI_HC(const double HC) -{ - - if ( HC > 0.0E+00 ) - engine_.setEI_HC(HC); - -} /* End of Aircraft::setEI_HC */ - void Aircraft::setEI_Soot(const double Soot) { diff --git a/Code.v05-00/src/Core/Input.cpp b/Code.v05-00/src/Core/Input.cpp index fbe38ecca..7fa4b036f 100644 --- a/Code.v05-00/src/Core/Input.cpp +++ b/Code.v05-00/src/Core/Input.cpp @@ -62,15 +62,6 @@ void Input::checkInputValidity() const { if ( emissionTime_ < 0 || emissionTime_ > 24 ) reject( "emissionTime", emissionTime_, "hrs", "0 to 24" ); - if ( EI_NOx_ < 0.0E+00 || EI_NOx_ > 5.0E+01 ) - reject( "EI_NOx", EI_NOx_, "g/kg_fuel", "0 to 50" ); - - if ( EI_CO_ < 0.0E+00 || EI_CO_ > 3.0E+01 ) - reject( "EI_CO", EI_CO_, "g/kg_fuel", "0 to 30" ); - - if ( EI_HC_ < 0.0E+00 || EI_HC_ > 1.0E+01 ) - reject( "EI_HC", EI_HC_, "g/kg_fuel", "0 to 10" ); - if ( EI_SO2_ < 0.0E+00 || EI_SO2_ > 1.0E+02 ) reject( "EI_SO2", EI_SO2_, "g/kg_fuel", "0 to 100" ); diff --git a/Code.v05-00/src/Core/MPMSimVarsWrapper.cpp b/Code.v05-00/src/Core/MPMSimVarsWrapper.cpp index 98dc15f58..744c76cd0 100644 --- a/Code.v05-00/src/Core/MPMSimVarsWrapper.cpp +++ b/Code.v05-00/src/Core/MPMSimVarsWrapper.cpp @@ -2,42 +2,20 @@ #include "Core/MPMSimVarsWrapper.hpp" MPMSimVarsWrapper::MPMSimVarsWrapper(const Input& input, const OptInput& Input_Opt, const double depth_estimate): - RUN_BOXMODEL(Input_Opt.SIMULATION_BOXMODEL), // Placeholder for a future look-up table build. Nothing reads it: it used // to mirror the parameter sweep flag, which no longer exists. BUILD_LUT(false), - SAVE_FORWARD(Input_Opt.SIMULATION_SAVE_FORWARD), - ADJOINT(Input_Opt.SIMULATION_ADJOINT), BACKG_FILENAME(Input_Opt.SIMULATION_INPUT_BACKG_COND), - THREADED_FFT(Input_Opt.SIMULATION_THREADED_FFT), - USE_WISDOM(Input_Opt.SIMULATION_USE_FFTW_WISDOM), - FFTW_DIR(Input_Opt.SIMULATION_DIRECTORY_W_WRITE_PERMISSION), TRANSPORT(Input_Opt.TRANSPORT_TRANSPORT), - FILLNEG(Input_Opt.TRANSPORT_FILL), - UPDRAFT(Input_Opt.TRANSPORT_UPDRAFT), - UPDRAFT_TIME(Input_Opt.TRANSPORT_UPDRAFT_TIMESCALE), - UPDRAFT_VEL(Input_Opt.TRANSPORT_UPDRAFT_VELOCITY), - CHEMISTRY(Input_Opt.CHEMISTRY_CHEMISTRY), - HETCHEM(Input_Opt.CHEMISTRY_HETCHEM), - JRATE_FOLDER(Input_Opt.CHEMISTRY_JRATE_FOLDER), GRAVSETTLING(Input_Opt.AEROSOL_GRAVSETTLING), ICE_COAG(Input_Opt.AEROSOL_COAGULATION_SOLID), - LIQ_COAG(Input_Opt.AEROSOL_COAGULATION_LIQUID), ICE_GROWTH(Input_Opt.AEROSOL_ICE_GROWTH), TEMP_PERTURB(Input_Opt.MET_ENABLE_TEMP_PERTURB), metDepth(depth_estimate), - DIAG_FILENAME(Input_Opt.DIAG_FILENAME), TS_FOLDER(Input_Opt.SIMULATION_OUTPUT_FOLDER), - TS_SPEC(Input_Opt.TS_SPEC), - TS_SPEC_FILEPATH(TS_FOLDER + "/" + Input_Opt.TS_FILENAME), - TS_SPEC_LIST(Input_Opt.TS_SPECIES), - TS_FREQ(Input_Opt.TS_FREQ), TS_AERO(Input_Opt.TS_AERO), TS_AERO_FILEPATH(TS_FOLDER + "/" + Input_Opt.TS_AERO_FILENAME), - TS_AERO_LIST(Input_Opt.TS_AEROSOL), TS_AERO_FREQ(Input_Opt.TS_AERO_FREQ), - SAVE_PL(Input_Opt.PL_PL), - SAVE_O3PL(Input_Opt.PL_O3), temperature_K(input.temperature_K()), pressure_Pa(input.pressure_Pa()), relHumidity_w(input.relHumidity_w()) diff --git a/Code.v05-00/src/Core/Meteorology.cpp b/Code.v05-00/src/Core/Meteorology.cpp index cb9fce2f4..c40436fc3 100644 --- a/Code.v05-00/src/Core/Meteorology.cpp +++ b/Code.v05-00/src/Core/Meteorology.cpp @@ -30,7 +30,6 @@ Meteorology::Meteorology( const OptInput &optInput, met_dt_h_(optInput.MET_DT), pressureRef_(pressure_Pa), turbTempPertAmplitude_(optInput.MET_TEMP_PERTURB_AMPLITUDE), - useMetFileInput_(optInput.MET_LOADMET), interpTemp_(optInput.MET_INTERPTEMPDATA), interpRH_(optInput.MET_INTERPRHDATA), interpShear_(optInput.MET_INTERPSHEARDATA), diff --git a/Code.v05-00/src/EPM/Models/Original/Integrate.cpp b/Code.v05-00/src/EPM/Models/Original/Integrate.cpp index d04ca4415..6b5d33179 100644 --- a/Code.v05-00/src/EPM/Models/Original/Integrate.cpp +++ b/Code.v05-00/src/EPM/Models/Original/Integrate.cpp @@ -370,7 +370,7 @@ namespace EPM::Models } /* Output variables */ /* Check if contrail is water supersaturated at some point during formation */ - if ( !simVars_.CHEMISTRY && !observer.checkwatersat() ) { + if ( !observer.checkwatersat() ) { std::cout << "EndSim: Never reaches water saturation... ending simulation" << std::endl; //exit(0); return SimStatus::NoWaterSaturation; @@ -392,7 +392,7 @@ namespace EPM::Models Soot_den = PartDens_3mins; H2O_mol = H2OMol_3mins; std::cout << "No persistent contrail..." << std::endl; - if (!simVars_.CHEMISTRY) return SimStatus::NoPersistence; + return SimStatus::NoPersistence; } std::cout << "Ice_den=" << Ice_den << std::endl; diff --git a/Code.v05-00/src/EPM/Solution.cpp b/Code.v05-00/src/EPM/Solution.cpp index 709a19f86..bc5f8d13e 100644 --- a/Code.v05-00/src/EPM/Solution.cpp +++ b/Code.v05-00/src/EPM/Solution.cpp @@ -68,7 +68,7 @@ void Solution::Initialize(std::string fileName, setAmbientConcentrations(input, amb_Value); /* Initialize and allocate space for species */ - initializeSpeciesH2O(input, Input_Opt, amb_Value, airDens, met); + initializeSpeciesH2O(amb_Value, airDens, met); Vector_1D stratData{ Species[ind_SO4][0][0], Species[ind_HNO3][0][0], \ Species[ind_HCl][0][0], Species[ind_HOCl][0][0], \ @@ -263,15 +263,14 @@ void Solution::setAmbientConcentrations(const Input& input, Vector_1D& amb_Value } -void Solution::initializeSpeciesH2O(const Input& input, const OptInput& Input_Opt, Vector_1D& amb_Value, const double airDens, const Meteorology& met){ - UInt actualX = size_x; - UInt actualY = size_y; - if ( !Input_Opt.CHEMISTRY_CHEMISTRY ) { - actualX = 1; - actualY = 1; - - reducedSize = 1; - } +void Solution::initializeSpeciesH2O(Vector_1D& amb_Value, const double airDens, const Meteorology& met){ + // Every species except the H2O family is held as a single cell because chemistry was + // the only thing that needed them on the full grid and it is no longer supported. + // This is a placeholder fix, ideally we would fully remove the structure holding arrays for non H2O + // species but that's a more complex refactor. + UInt actualX = 1; + UInt actualY = 1; + reducedSize = 1; Vector_2D tmpArray( size_y, Vector_1D( size_x, 0.0E+00 ) ); Vector_2D tmpArray_Reduced( actualY, Vector_1D( actualX, 0.0E+00 ) ); @@ -290,29 +289,13 @@ void Solution::initializeSpeciesH2O(const Input& input, const OptInput& Input_Op } } - if ( Input_Opt.MET_LOADMET ) { - /* Use meteorological input? */ - - //TODO: Fix this insanely wasteful copy. Probably not happening without significant refactoring everything. - Species[ind_H2Omet] = met.H2O_field(); - /* Update H2O */ - for ( UInt i = 0; i < size_x; i++ ) { - for ( UInt j = 0; j < size_y; j++ ) { - Species[ind_H2O][j][i] = Species[ind_H2Omet][j][i] \ - + Species[ind_H2Oplume][j][i]; - } - } - } else { - /* Else use user-defined H2O profile */ - double H2Oval = (input.relHumidity_w()/((double) 100.0) * \ - physFunc::pSat_H2Ol( input.temperature_K() ) / ( kB * input.temperature_K() )) / 1.00E+06; - for ( UInt i = 0; i < size_x; i++ ) { - for ( UInt j = 0; j < size_y; j++ ) { - //H2O[j][i] = H2Oval; - Species[ind_H2Omet][j][i] = H2Oval; - /* RH_w = x_H2O * P / Psat_H2Ol(T) = [H2O](#/cm3) * 1E6 * kB * T / Psat_H2Ol(T) */ - Species[ind_H2O][j][i] = Species[ind_H2Omet][j][i] + Species[ind_H2Oplume][j][i]; - } + //TODO: Fix this insanely wasteful copy. Probably not happening without significant refactoring everything. + Species[ind_H2Omet] = met.H2O_field(); + /* Update H2O */ + for ( UInt i = 0; i < size_x; i++ ) { + for ( UInt j = 0; j < size_y; j++ ) { + Species[ind_H2O][j][i] = Species[ind_H2Omet][j][i] \ + + Species[ind_H2Oplume][j][i]; } } diff --git a/Code.v05-00/src/Main.cpp b/Code.v05-00/src/Main.cpp index f969ef47f..1ead123ce 100644 --- a/Code.v05-00/src/Main.cpp +++ b/Code.v05-00/src/Main.cpp @@ -195,10 +195,7 @@ int main( int argc, char* argv[]) fmt::print(" P [hPa]: {:>8.2f}\n", scenario.pressure_Pa()/100.0); // Report relevant input met data when crashing - if (Input_Opt.MET_LOADMET) - { - fmt::print(" Met file : {:>}\n", Input_Opt.MET_FILENAME); - } + fmt::print(" Met file : {:>}\n", Input_Opt.MET_FILENAME); } else { std::cout << "\n APCEMM completed." << std::endl; } diff --git a/Code.v05-00/src/YamlInputReader/YamlInputReader.cpp b/Code.v05-00/src/YamlInputReader/YamlInputReader.cpp index 12e5391e6..6e3ee4f46 100644 --- a/Code.v05-00/src/YamlInputReader/YamlInputReader.cpp +++ b/Code.v05-00/src/YamlInputReader/YamlInputReader.cpp @@ -82,11 +82,9 @@ namespace YamlInputReader{ // before the generic unknown-key error so an outdated input file gets a warning // naming the option that is deprecated instead of failing with "Unknown key found". bool checkDeprecatedKey(const std::string& key, const std::string& errorPath) { - static const std::set deprecatedKeys = { - "Chemistry Timestep [min] (double)", - "Coag. timestep [min] (double)", - "Temp. Perturb. Timescale (min)", - }; + // Currently empty: every option deprecated is now put in checkRemovedKey() + // instead. Kept here for future deprecations. + static const std::set deprecatedKeys = {}; if (deprecatedKeys.contains(key)) { std::cout << "WARNING: Deprecated option found: '" << errorPath << "'. This option is no longer used and has no effect." << std::endl; return true; @@ -98,15 +96,82 @@ namespace YamlInputReader{ // before the generic unknown-key error so an outdated input file gets a message // naming the option that went away instead of "Unknown key found". void checkRemovedKey(const std::string& key, const std::string& errorPath) { - static const std::set removedKeys = { + // Options removed with the multi-case runs + static const std::set removedSweepKeys = { "PARAM SWEEP SUBMENU", "Parameter sweep (T/F)", "Run Monte Carlo (T/F)", "Num Monte Carlo runs (int)", }; - if (removedKeys.contains(key)) { + if (removedSweepKeys.contains(key)) { throw std::runtime_error("Removed option found: '" + errorPath + "'. Delete it from your input file. " + ONE_RUN_PER_PROCESS_MESSAGE); } + + // Options that were parsed and stored but never used in a simulation. They are now + // removed to not be misleading to users. + // Because we match by node key (and not full path), options that appear multiple times + // under the same name would trigger this warning everywhere. By not including them here + // they do not have a nice message to explain their removal. + // They are still refused by validateYamlKeys() however as it validates against the structure + // of the defaults/input.yaml by parsing every branch of the tree checking the keys. + // This is the case for "Inst timeseries file (string)" and "Save frequency [min] (double)" + static const std::set removedUnusedKeys = { + // SIMULATION MENU: spectral solver leftovers and never-implemented run modes + "Use threaded FFT (T/F)", + "FFTW WISDOM SUBMENU", + "Use FFTW WISDOM (T/F)", + "Dir w/ write permission (string)", + "SAVE FORWARD RESULTS SUBMENU", + "Save forward results (T/F)", + "ADJOINT OPTIMIZATION SUBMENU", + "Turn on adjoint optim. (T/F)", + "BOX MODEL SUBMENU", + "Run box model (T/F)", + "netCDF filename format (string)", + // PARAMETER MENU: emission indices that reach Emission and stop + "NOx [g(NO2)/kg_fuel] (double)", + "CO [g/kg_fuel] (double)", + "UHC [g/kg_fuel] (double)", + // TRANSPORT MENU: spectral solver leftover, and updraft now comes from the met file + "Fill Negative Values (T/F)", + "PLUME UPDRAFT SUBMENU", + "Turn on plume updraft (T/F)", + "Updraft timescale [s] (double)", + "Updraft veloc. [cm/s] (double)", + // CHEMISTRY MENU: chemistry is no longer supported + "CHEMISTRY MENU", + "Turn on Chemistry (T/F)", + "Chemistry Timestep [min] (double)", + "Perform hetero. chem. (T/F)", + "Photolysis rates folder (string)", + // AEROSOL MENU: no coagulation runs, so its timestep never applied + "Coag. timestep [min] (double)", + "Turn on liquid coagulation (T/F)", + // METEOROLOGY MENU: met now comes from the netCDF file only + "Use met. input (T/F)", + "Init temp. from met. (T/F)", + "Init RH from met. (T/F)", + "Init wind shear from met. (T/F)", + "Init vert. veloc. from met. data (T/F)", + "Temp. Perturb. Timescale (min)", + // DIAGNOSTIC MENU: species and P/L diagnostics needed chemistry + "SPECIES TIMESERIES SUBMENU", + "Save species timeseries (T/F)", + "Species indices to include (list of ints)", + "Aerosol indices to include (list of ints)", + "PRODUCTION & LOSS SUBMENU", + "Turn on P/L diag (T/F)", + "Save O3 P/L (T/F)", + // ADVANCED OPTIONS MENU: the documented scaling formula was never implemented + "INITIAL CONTRAIL SIZE SUBMENU", + "Base Contrail Depth [m] (double)", + "Contrail Depth Scaling Factor [-] (double)", + "Base Contrail Width [m] (double)", + "Contrail Width Scaling Factor [-] (double)", + }; + if (removedUnusedKeys.contains(key)) { + throw std::runtime_error("Removed option found: '" + errorPath + "'. Delete it from your input file. " + UNUSED_OPTION_MESSAGE); + } } void validateYamlKeys(const YAML::Node& defaultNode, const YAML::Node& userNode, const std::string& currentPath = "") { @@ -218,13 +283,6 @@ namespace YamlInputReader{ throw std::runtime_error("Something went wrong in reading the TRANSPORT MENU! Please double-check your input file with the reference in Code.v05-00/defaults/input.yaml\n Exception: " + std::string(e.what())); } - try { - readChemMenu(input, mergedData["CHEMISTRY MENU"]); - } - catch (const std::exception& e) { - throw std::runtime_error("Something went wrong in reading the CHEMISTRY MENU! Please double-check your input file with the reference in Code.v05-00/defaults/input.yaml\n Exception: " + std::string(e.what())); - } - try { readAeroMenu(input, mergedData["AEROSOL MENU"]); } @@ -322,26 +380,9 @@ namespace YamlInputReader{ if ( outputFolder.back() != '/' ) {outputFolder = outputFolder + "/";} input.SIMULATION_OUTPUT_FOLDER = outputFolder; input.SIMULATION_OVERWRITE = parseBoolString(outputSubmenu["Overwrite if folder exists (T/F)"].as(), "Overwrite if folder exists (T/F)"); - input.SIMULATION_THREADED_FFT = parseBoolString(simNode["Use threaded FFT (T/F)"].as(), "Use threaded FFT (T/F)"); - - YAML::Node fftwWisdomSubmenu = simNode["FFTW WISDOM SUBMENU"]; - input.SIMULATION_USE_FFTW_WISDOM = parseBoolString(fftwWisdomSubmenu["Use FFTW WISDOM (T/F)"].as(), "Use FFTW WISDOM (T/F)"); - input.SIMULATION_DIRECTORY_W_WRITE_PERMISSION = readPath(fftwWisdomSubmenu, "Dir w/ write permission (string)"); input.SIMULATION_INPUT_BACKG_COND = readPath(simNode, "Input background condition (string)"); input.SIMULATION_INPUT_ENG_EI = readPath(simNode, "Input engine emissions (string)"); - YAML::Node saveForwardSubmenu = simNode["SAVE FORWARD RESULTS SUBMENU"]; - input.SIMULATION_SAVE_FORWARD = parseBoolString(saveForwardSubmenu["Save forward results (T/F)"].as(), "Save forward results (T/F)"); - input.SIMULATION_FORWARD_FILENAME = saveForwardSubmenu["netCDF filename format (string)"].as(); - - YAML::Node adjointSubmenu = simNode["ADJOINT OPTIMIZATION SUBMENU"]; - input.SIMULATION_ADJOINT = parseBoolString(adjointSubmenu["Turn on adjoint optim. (T/F)"].as(), "Turn on adjoint optim. (T/F)"); - input.SIMULATION_ADJOINT_FILENAME = adjointSubmenu["netCDF filename format (string)"].as(); - - YAML::Node boxModelSubmenu = simNode["BOX MODEL SUBMENU"]; - input.SIMULATION_BOXMODEL = parseBoolString(boxModelSubmenu["Run box model (T/F)"].as(), "Run box model (T/F)"); - input.SIMULATION_BOX_FILENAME = boxModelSubmenu["netCDF filename format (string)"].as(); - YAML::Node seedSubmenu = simNode["RANDOM NUMBER GENERATION SUBMENU"]; input.SIMULATION_FORCE_SEED = parseBoolString(seedSubmenu["Force seed value (T/F)"].as(), "Force seed value (T/F)"); input.SIMULATION_SEED_VALUE = parseScalarUIntParam(seedSubmenu["Seed value (positive int)"].as(), "Seed value (positive int)"); @@ -386,9 +427,6 @@ namespace YamlInputReader{ scenario.set_backgSO2(parseScalarParam(backMixRatioSubmenu["SO2 [ppt] (double)"].as(), "SO2 [ppt] (double)")); YAML::Node eiSubmenu = paramNode["EMISSION INDICES SUBMENU"]; - scenario.set_EI_NOx(parseScalarParam(eiSubmenu["NOx [g(NO2)/kg_fuel] (double)"].as(), "NOx [g(NO2)/kg_fuel] (double)")); - scenario.set_EI_CO(parseScalarParam(eiSubmenu["CO [g/kg_fuel] (double)"].as(), "CO [g/kg_fuel] (double)")); - scenario.set_EI_HC(parseScalarParam(eiSubmenu["UHC [g/kg_fuel] (double)"].as(), "UHC [g/kg_fuel] (double)")); scenario.set_EI_SO2(parseScalarParam(eiSubmenu["SO2 [g/kg_fuel] (double)"].as(), "SO2 [g/kg_fuel] (double)")); //Convert % to ratio scenario.set_EI_SO2TOSO4(parseScalarParam(eiSubmenu["SO2 to SO4 conv [%] (double)"].as(), "SO2 to SO4 conv [%] (double)") / 100.0); @@ -405,41 +443,24 @@ namespace YamlInputReader{ } void readTransportMenu(OptInput& input, const YAML::Node& transportNode){ input.TRANSPORT_TRANSPORT = parseBoolString(transportNode["Turn on Transport (T/F)"].as(), "Turn on Transport (T/F)"); - input.TRANSPORT_FILL = parseBoolString(transportNode["Fill Negative Values (T/F)"].as(), "Fill Negative Values (T/F)"); input.TRANSPORT_TIMESTEP = parseDoubleString(transportNode["Transport Timestep [min] (double)"].as(), "Transport Timestep [min] (double)"); - - YAML::Node updraftSubmenu = transportNode["PLUME UPDRAFT SUBMENU"]; - input.TRANSPORT_UPDRAFT = parseBoolString(updraftSubmenu["Turn on plume updraft (T/F)"].as(), "Turn on plume updraft (T/F)"); - input.TRANSPORT_UPDRAFT_TIMESCALE = parseDoubleString(updraftSubmenu["Updraft timescale [s] (double)"].as(), "Updraft timescale [s] (double)"); - input.TRANSPORT_UPDRAFT_VELOCITY = parseDoubleString(updraftSubmenu["Updraft veloc. [cm/s] (double)"].as(), "Updraft veloc. [cm/s] (double)"); - } - void readChemMenu(OptInput& input, const YAML::Node& chemNode){ - input.CHEMISTRY_CHEMISTRY = parseBoolString(chemNode["Turn on Chemistry (T/F)"].as(), "Turn on Chemistry (T/F)"); - input.CHEMISTRY_HETCHEM = parseBoolString(chemNode["Perform hetero. chem. (T/F)"].as(), "Perform hetero. chem. (T/F)"); - input.CHEMISTRY_JRATE_FOLDER = readPath(chemNode, "Photolysis rates folder (string)"); } void readAeroMenu(OptInput& input, const YAML::Node& aeroNode){ input.AEROSOL_GRAVSETTLING = parseBoolString(aeroNode["Turn on grav. settling (T/F)"].as(), "Turn on grav. settling (T/F)"); input.AEROSOL_COAGULATION_SOLID = parseBoolString(aeroNode["Turn on solid coagulation (T/F)"].as(), "Turn on solid coagulation (T/F)"); - input.AEROSOL_COAGULATION_LIQUID = parseBoolString(aeroNode["Turn on liquid coagulation (T/F)"].as(), "Turn on liquid coagulation (T/F)"); input.AEROSOL_ICE_GROWTH = parseBoolString(aeroNode["Turn on ice growth (T/F)"].as(), "Turn on ice growth (T/F)"); input.AEROSOL_ICE_GROWTH_TIMESTEP = parseDoubleString(aeroNode["Ice growth timestep [min] (double)"].as(), "Ice growth timestep [min] (double)"); } void readMetMenu(OptInput& input, const YAML::Node& metNode){ YAML::Node metInputSubmenu = metNode["METEOROLOGICAL INPUT SUBMENU"]; - input.MET_LOADMET = parseBoolString(metInputSubmenu["Use met. input (T/F)"].as(), "Use met. input (T/F)"); input.MET_FILENAME = readPath(metInputSubmenu, "Met input file path (string)"); input.MET_DT = parseDoubleString(metInputSubmenu["Time series data timestep [hr] (double)"].as(), "Time series data timestep [hr] (double)"); - input.MET_LOADTEMP = parseBoolString(metInputSubmenu["Init temp. from met. (T/F)"].as(), "Init temp. from met. (T/F)"); input.MET_TEMPTIMESERIES = parseBoolString(metInputSubmenu["Temp. time series input (T/F)"].as(), "Temp. time series input (T/F)"); input.MET_INTERPTEMPDATA = parseBoolString(metInputSubmenu["Interpolate temp. met. data (T/F)"].as(), "Interpolate temp. met. data (T/F)"); - input.MET_LOADRH = parseBoolString(metInputSubmenu["Init RH from met. (T/F)"].as(), "Init RH from met. (T/F)"); input.MET_RHTIMESERIES = parseBoolString(metInputSubmenu["RH time series input (T/F)"].as(), "RH time series input (T/F)"); input.MET_INTERPRHDATA = parseBoolString(metInputSubmenu["Interpolate RH met. data (T/F)"].as(), "Interpolate RH met. data (T/F)"); - input.MET_LOADSHEAR = parseBoolString(metInputSubmenu["Init wind shear from met. (T/F)"].as(), "Init wind shear from met. (T/F)"); input.MET_SHEARTIMESERIES = parseBoolString(metInputSubmenu["Wind shear time series input (T/F)"].as(), "Wind shear time series input (T/F)"); input.MET_INTERPSHEARDATA = parseBoolString(metInputSubmenu["Interpolate shear met. data (T/F)"].as(), "Interpolate shear met. data (T/F)"); - input.MET_LOADVERTVELOC = parseBoolString(metInputSubmenu["Init vert. veloc. from met. data (T/F)"].as(), "Init vert. veloc. from met. data (T/F)"); input.MET_VERTVELOCTIMESERIES = parseBoolString(metInputSubmenu["Vert. veloc. time series input (T/F)"].as(), "Vert. veloc. time series input (T/F)"); input.MET_INTERPVERTVELOC = parseBoolString(metInputSubmenu["Interpolate vert. veloc. met. data (T/F)"].as(), "Interpolate vert. veloc. met. data (T/F)"); @@ -448,23 +469,10 @@ namespace YamlInputReader{ input.MET_TEMP_PERTURB_AMPLITUDE = parseDoubleString( tempPerturbMenu["Temp. Perturb. Amplitude (double)"].as(), "Temp. Perturb. Amplitude (double)" ); } void readDiagMenu(OptInput& input, const YAML::Node& diagNode){ - input.DIAG_FILENAME = diagNode["netCDF filename format (string)"].as(); - - YAML::Node specTsSubmenu = diagNode["SPECIES TIMESERIES SUBMENU"]; - input.TS_SPEC = parseBoolString(specTsSubmenu["Save species timeseries (T/F)"].as(), "Save species timeseries (T/F)"); - input.TS_FILENAME = specTsSubmenu["Inst timeseries file (string)"].as(); - input.TS_SPECIES = parseVectorIntString(specTsSubmenu["Species indices to include (list of ints)"].as(), "Species indices to include (list of ints)"); - input.TS_FREQ = parseDoubleString(specTsSubmenu["Save frequency [min] (double)"].as(), "Save frequency [min] (double)"); - YAML::Node aeroTsSubmenu = diagNode["AEROSOL TIMESERIES SUBMENU"]; input.TS_AERO = parseBoolString(aeroTsSubmenu["Save aerosol timeseries (T/F)"].as(), "Save aerosol timeseries (T/F)"); input.TS_AERO_FILENAME = aeroTsSubmenu["Inst timeseries file (string)"].as(); - input.TS_AEROSOL = parseVectorIntString(aeroTsSubmenu["Aerosol indices to include (list of ints)"].as(), "Aerosol indices to include (list of ints)"); input.TS_AERO_FREQ = parseDoubleString(aeroTsSubmenu["Save frequency [min] (double)"].as(), "Save frequency [min] (double)"); - - YAML::Node plSubmenu = diagNode["PRODUCTION & LOSS SUBMENU"]; - input.PL_PL = parseBoolString(plSubmenu["Turn on P/L diag (T/F)"].as(), "Turn on P/L diag (T/F)"); - input.PL_O3 = parseBoolString(plSubmenu["Save O3 P/L (T/F)"].as(), "Save O3 P/L (T/F)"); } void readAdvancedMenu(OptInput& input, const YAML::Node& advancedNode) { @@ -475,12 +483,6 @@ namespace YamlInputReader{ input.ADV_GRID_XLIM_LEFT = parseDoubleString(gridSubmenu["XLIM_LEFT (positive double)"].as(), "XLIM_LEFT (positive double)"); input.ADV_GRID_YLIM_UP = parseDoubleString(gridSubmenu["YLIM_UP (positive double)"].as(), "YLIM_UP (positive double)"); input.ADV_GRID_YLIM_DOWN = parseDoubleString(gridSubmenu["YLIM_DOWN (positive double)"].as(), "YLIM_DOWN (positive double)"); - - YAML::Node csizeSubmenu = advancedNode["INITIAL CONTRAIL SIZE SUBMENU"]; - input.ADV_CSIZE_DEPTH_BASE = parseDoubleString(csizeSubmenu["Base Contrail Depth [m] (double)"].as(), "Base Contrail Depth [m] (double)"); - input.ADV_CSIZE_DEPTH_SCALING_FACTOR = parseDoubleString(csizeSubmenu["Contrail Depth Scaling Factor [-] (double)"].as(), "Contrail Depth Scaling Factor [-] (double)"); - input.ADV_CSIZE_WIDTH_BASE = parseDoubleString(csizeSubmenu["Base Contrail Width [m] (double)"].as(), "Base Contrail Width [m] (double)"); - input.ADV_CSIZE_WIDTH_SCALING_FACTOR = parseDoubleString(csizeSubmenu["Contrail Width Scaling Factor [-] (double)"].as(), "Contrail Width Scaling Factor [-] (double)"); input.ADV_AMBIENT_LAPSERATE = parseDoubleString(advancedNode["Ambient Lapse Rate [K/km] (double)"].as(), "Ambient Lapse Rate [K/km] (double)"); input.ADV_TROPOPAUSE_PRESSURE = parseDoubleString(advancedNode["Tropopause Pressure [Pa] (double)"].as(), "Tropopause Pressure [Pa] (double)"); diff --git a/Code.v05-00/src/YamlInputReader/YamlPathUtils.cpp b/Code.v05-00/src/YamlInputReader/YamlPathUtils.cpp index 92f88faa6..73470489c 100644 --- a/Code.v05-00/src/YamlInputReader/YamlPathUtils.cpp +++ b/Code.v05-00/src/YamlInputReader/YamlPathUtils.cpp @@ -35,11 +35,9 @@ namespace YamlInputReader{ // directory. static const std::set PATH_KEYS = { "SIMULATION MENU -> OUTPUT SUBMENU -> Output folder (string)", - "SIMULATION MENU -> FFTW WISDOM SUBMENU -> Dir w/ write permission (string)", "SIMULATION MENU -> Input background condition (string)", "SIMULATION MENU -> Input engine emissions (string)", "SIMULATION MENU -> External EPM NetCDF file", - "CHEMISTRY MENU -> Photolysis rates folder (string)", "METEOROLOGY MENU -> METEOROLOGICAL INPUT SUBMENU -> Met input file path (string)", }; diff --git a/Code.v05-00/tests/input-yamls/test.yaml b/Code.v05-00/tests/input-yamls/test.yaml index 2b9e50201..15511382f 100644 --- a/Code.v05-00/tests/input-yamls/test.yaml +++ b/Code.v05-00/tests/input-yamls/test.yaml @@ -5,21 +5,8 @@ SIMULATION MENU: OUTPUT SUBMENU: Output folder (string): ./ Overwrite if folder exists (T/F): T - Use threaded FFT (T/F): T - FFTW WISDOM SUBMENU: - Use FFTW WISDOM (T/F): T - Dir w/ write permission (string): ./ Input background condition (string): =DEFAULT= Input engine emissions (string): =DEFAULT= - SAVE FORWARD RESULTS SUBMENU: - Save forward results (T/F): T - netCDF filename format (string): APCEMM_Case_* - ADJOINT OPTIMIZATION SUBMENU: - Turn on adjoint optim. (T/F): T - netCDF filename format (string): APCEMM_ADJ_Case_* - BOX MODEL SUBMENU: - Run box model (T/F): T - netCDF filename format (string): APCEMM_BOX_CASE_* EPM type (original/external/new): original External EPM NetCDF file: =MISSING= RANDOM NUMBER GENERATION SUBMENU: @@ -46,9 +33,6 @@ PARAMETER MENU: CH4 [ppm] (double): 1.76 SO2 [ppt] (double): 7.25 EMISSION INDICES SUBMENU: - NOx [g(NO2)/kg_fuel] (double): 10 - CO [g/kg_fuel] (double): 1 - UHC [g/kg_fuel] (double): 0.6 SO2 [g/kg_fuel] (double): 0.1 SO2 to SO4 conv [%] (double): 5 Soot [g/kg_fuel] (double): 0.06 @@ -63,67 +47,37 @@ PARAMETER MENU: TRANSPORT MENU: Turn on Transport (T/F): T - Fill Negative Values (T/F): T Transport Timestep [min] (double): 10 - PLUME UPDRAFT SUBMENU: - Turn on plume updraft (T/F): T - Updraft timescale [s] (double): 3600 - Updraft veloc. [cm/s] (double): 5 - -CHEMISTRY MENU: - Turn on Chemistry (T/F): T - Perform hetero. chem. (T/F): T - Chemistry Timestep [min] (double): 10 - Photolysis rates folder (string): /net/d04/data/fritzt/APCEMM_Data/J-Rates AEROSOL MENU: Turn on grav. settling (T/F): T Turn on solid coagulation (T/F): T - Turn on liquid coagulation (T/F): T - Coag. timestep [min] (double): 60 Turn on ice growth (T/F): T Ice growth timestep [min] (double): 10 METEOROLOGY MENU: METEOROLOGICAL INPUT SUBMENU: - Use met. input (T/F): T Met input file path (string): /path/to/met/input Time series data timestep [hr] (double): 1.0 - Init temp. from met. (T/F): T Temp. time series input (T/F): T Interpolate temp. met. data (T/F): T - Init RH from met. (T/F): T RH time series input (T/F): T Interpolate RH met. data (T/F): T - Init wind shear from met. (T/F): T Wind shear time series input (T/F): T Interpolate shear met. data (T/F): T - Init vert. veloc. from met. data (T/F): T Vert. veloc. time series input (T/F): T Interpolate vert. veloc. met. data (T/F): T TEMPERATURE PERTURBATION SUBMENU: Enable Temp. Pert. (T/F): T Temp. Perturb. Amplitude (double): 2.0 - Temp. Perturb. Timescale (min): 10 DIAGNOSTIC MENU: - netCDF filename format (string): trac_avg.apcemm.hhmm - SPECIES TIMESERIES SUBMENU: - Save species timeseries (T/F): T - Inst timeseries file (string): ts_hhmm.nc - #list input: separate by spaces. e.g. 1 2 3 4 5 - Species indices to include (list of ints): 1 2 3 - Save frequency [min] (double): 10 AEROSOL TIMESERIES SUBMENU: Save aerosol timeseries (T/F): T Inst timeseries file (string): ts_aerosol_hhmm.nc #list input: separate by spaces. e.g. 1 2 3 4 5 - Aerosol indices to include (list of ints): 1 3 5 Save frequency [min] (double): 10 - PRODUCTION & LOSS SUBMENU: - Turn on P/L diag (T/F): T - Save O3 P/L (T/F): T - + #Sometimes you have to change YLIM_DOWN here if the supersaturated layer is very thick #because YLIM_DOWN must be larger than the layer thickness. ADVANCED OPTIONS MENU: @@ -136,13 +90,6 @@ ADVANCED OPTIONS MENU: XLIM_LEFT (positive double): 1.0e+3 YLIM_UP (positive double): 300 YLIM_DOWN (positive double): 1.5e+3 - INITIAL CONTRAIL SIZE SUBMENU: - #Depth = BaseDepth + DepthScalingFactor * Default_Depth - #Same formula for width - Base Contrail Depth [m] (double): 180.0 - Contrail Depth Scaling Factor [-] (double): 0.5 - Base Contrail Width [m] (double): 100.0 - Contrail Width Scaling Factor [-] (double): 0.5 Ambient Lapse Rate [K/km] (double): -3.0 Tropopause Pressure [Pa] (double): 2.0e+4 EARLY PLUME SUBMENU: diff --git a/Code.v05-00/tests/input-yamls/test1.yaml b/Code.v05-00/tests/input-yamls/test1.yaml index 828a35d11..1f36a69e6 100644 --- a/Code.v05-00/tests/input-yamls/test1.yaml +++ b/Code.v05-00/tests/input-yamls/test1.yaml @@ -5,21 +5,8 @@ SIMULATION MENU: OUTPUT SUBMENU: Output folder (string): ./ Overwrite if folder exists (T/F): T - Use threaded FFT (T/F): T - FFTW WISDOM SUBMENU: - Use FFTW WISDOM (T/F): T - Dir w/ write permission (string): ./ Input background condition (string): =DEFAULT= Input engine emissions (string): =DEFAULT= - SAVE FORWARD RESULTS SUBMENU: - Save forward results (T/F): T - netCDF filename format (string): APCEMM_Case_* - ADJOINT OPTIMIZATION SUBMENU: - Turn on adjoint optim. (T/F): T - netCDF filename format (string): APCEMM_ADJ_Case_* - BOX MODEL SUBMENU: - Run box model (T/F): T - netCDF filename format (string): APCEMM_BOX_CASE_* EPM type (original/external/new): original PARAMETER MENU: @@ -41,9 +28,6 @@ PARAMETER MENU: CH4 [ppm] (double): 1.76 SO2 [ppt] (double): 7.25 EMISSION INDICES SUBMENU: - NOx [g(NO2)/kg_fuel] (double): 10 - CO [g/kg_fuel] (double): 1 - UHC [g/kg_fuel] (double): 0.6 SO2 [g/kg_fuel] (double): 0.1 SO2 to SO4 conv [%] (double): 5 Soot [g/kg_fuel] (double): 0.06 @@ -58,66 +42,36 @@ PARAMETER MENU: TRANSPORT MENU: Turn on Transport (T/F): T - Fill Negative Values (T/F): T Transport Timestep [min] (double): 10 - PLUME UPDRAFT SUBMENU: - Turn on plume updraft (T/F): T - Updraft timescale [s] (double): 3600 - Updraft veloc. [cm/s] (double): 5 - -CHEMISTRY MENU: - Turn on Chemistry (T/F): T - Perform hetero. chem. (T/F): T - Chemistry Timestep [min] (double): 10 - Photolysis rates folder (string): /net/d04/data/fritzt/APCEMM_Data/J-Rates AEROSOL MENU: Turn on grav. settling (T/F): T Turn on solid coagulation (T/F): T - Turn on liquid coagulation (T/F): T - Coag. timestep [min] (double): 60 Turn on ice growth (T/F): T Ice growth timestep [min] (double): 10 METEOROLOGY MENU: METEOROLOGICAL INPUT SUBMENU: - Use met. input (T/F): F Met input file path (string): /path/to/met/input Time series data timestep [hr] (double): 1.0 - Init temp. from met. (T/F): T Temp. time series input (T/F): T Interpolate temp. met. data (T/F): T - Init RH from met. (T/F): T RH time series input (T/F): T Interpolate RH met. data (T/F): T - Init wind shear from met. (T/F): T Wind shear time series input (T/F): T Interpolate shear met. data (T/F): T - Init vert. veloc. from met. data (T/F): T Vert. veloc. time series input (T/F): T Interpolate vert. veloc. met. data (T/F): T TEMPERATURE PERTURBATION SUBMENU: Enable Temp. Pert. (T/F): F Temp. Perturb. Amplitude (double): 1.0 - Temp. Perturb. Timescale (min): 10 DIAGNOSTIC MENU: - netCDF filename format (string): trac_avg.apcemm.hhmm - SPECIES TIMESERIES SUBMENU: - Save species timeseries (T/F): T - Inst timeseries file (string): ts_hhmm.nc - #list input: separate by spaces. e.g. 1 2 3 4 5 - Species indices to include (list of ints): 1 2 3 - Save frequency [min] (double): 10 AEROSOL TIMESERIES SUBMENU: Save aerosol timeseries (T/F): T Inst timeseries file (string): ts_aerosol_hhmm.nc #list input: separate by spaces. e.g. 1 2 3 4 5 - Aerosol indices to include (list of ints): 1 3 5 Save frequency [min] (double): 10 - PRODUCTION & LOSS SUBMENU: - Turn on P/L diag (T/F): T - Save O3 P/L (T/F): T #Sometimes you have to change YLIM_DOWN here if the supersaturated layer is very thick #because YLIM_DOWN must be larger than the layer thickness. @@ -130,12 +84,5 @@ ADVANCED OPTIONS MENU: XLIM_LEFT (positive double): 1.0e+3 YLIM_UP (positive double): 300 YLIM_DOWN (positive double): 1.5e+3 - INITIAL CONTRAIL SIZE SUBMENU: - #Depth = BaseDepth + DepthScalingFactor * Default_Depth - #Same formula for width - Base Contrail Depth [m] (double): 180.0 - Contrail Depth Scaling Factor [-] (double): 0.5 - Base Contrail Width [m] (double): 100.0 - Contrail Width Scaling Factor [-] (double): 0.5 Ambient Lapse Rate [K/km] (double): -3.0 Tropopause Pressure [Pa] (double): 2.0e+4 diff --git a/Code.v05-00/tests/input-yamls/test17.yaml b/Code.v05-00/tests/input-yamls/test17.yaml new file mode 100644 index 000000000..682b7a989 --- /dev/null +++ b/Code.v05-00/tests/input-yamls/test17.yaml @@ -0,0 +1,6 @@ +# A removed leaf key. It must be rejected by name, with the unused-option message +# and not the parameter sweep one. +SIMULATION MENU: + OUTPUT SUBMENU: + Output folder (string): ./ + Use threaded FFT (T/F): F diff --git a/Code.v05-00/tests/input-yamls/test4.yaml b/Code.v05-00/tests/input-yamls/test4.yaml index c80d8c7e0..7c37f9dec 100644 --- a/Code.v05-00/tests/input-yamls/test4.yaml +++ b/Code.v05-00/tests/input-yamls/test4.yaml @@ -3,7 +3,6 @@ PARAMETER MENU: METEOROLOGY MENU: METEOROLOGICAL INPUT SUBMENU: - Use met. input (T/F): F Met input file path (string): /path/to/met/input INVALID YAML KEY: BAD FIELD: 0 diff --git a/Code.v05-00/tests/input-yamls/test5.yaml b/Code.v05-00/tests/input-yamls/test5.yaml index cd5baff31..63d49be08 100644 --- a/Code.v05-00/tests/input-yamls/test5.yaml +++ b/Code.v05-00/tests/input-yamls/test5.yaml @@ -1,6 +1,5 @@ METEOROLOGY MENU: METEOROLOGICAL INPUT SUBMENU: - Use met. input (T/F): F # This is a valid value in the default yaml # but it is not a valid key! Should throw Met input file path (string): diff --git a/Code.v05-00/tests/input-yamls/test8.yaml b/Code.v05-00/tests/input-yamls/test8.yaml index 4130a55bf..d60e9908c 100644 --- a/Code.v05-00/tests/input-yamls/test8.yaml +++ b/Code.v05-00/tests/input-yamls/test8.yaml @@ -2,7 +2,7 @@ # compiled defaults untouched, at the top level and inside a submenu. # The output folder is required, so it is the one value this file sets. SIMULATION MENU: - SAVE FORWARD RESULTS SUBMENU: + RANDOM NUMBER GENERATION SUBMENU: OUTPUT SUBMENU: Output folder (string): ./ PARAMETER MENU: diff --git a/Code.v05-00/tests/multithreading/inputs/base.yaml b/Code.v05-00/tests/multithreading/inputs/base.yaml index 337dce1f3..9e4175eff 100644 --- a/Code.v05-00/tests/multithreading/inputs/base.yaml +++ b/Code.v05-00/tests/multithreading/inputs/base.yaml @@ -9,25 +9,9 @@ SIMULATION MENU: # Output folder (string): APCEMM_out/ Overwrite if folder exists (T/F): T - # FFT options (for spectral solver) - Use threaded FFT (T/F): F - FFTW WISDOM SUBMENU: - Use FFTW WISDOM (T/F): T - Dir w/ write permission (string): ./ # This mostly contains information on background aerosol concentration; Not too relevant for contrail behavior Input background condition (string): =DEFAULT= - # All parameters here are overwritten in EMISSION INDICES SUBMENU Input engine emissions (string): =DEFAULT= - # Ignore/Don't change these, these are deprecated features. - SAVE FORWARD RESULTS SUBMENU: - Save forward results (T/F): F - netCDF filename format (string): APCEMM_Case_* - ADJOINT OPTIMIZATION SUBMENU: - Turn on adjoint optim. (T/F): F - netCDF filename format (string): APCEMM_ADJ_Case_* - BOX MODEL SUBMENU: - Run box model (T/F): F - netCDF filename format (string): APCEMM_BOX_CASE_* RANDOM NUMBER GENERATION SUBMENU: Force seed value (T/F): T Seed value (positive int): 0 @@ -64,10 +48,6 @@ PARAMETER MENU: EMISSION INDICES SUBMENU: # Engine specific parameters # Default parameters are estimates for a 737-800 at 35k ft - # Affects EPM mostly: - NOx [g(NO2)/kg_fuel] (double): 10 # EDB for CFM56-5B3 - CO [g/kg_fuel] (double): 1 - UHC [g/kg_fuel] (double): 0.6 # Affects contrail diffusion model: SO2 [g/kg_fuel] (double): 1.2 # Assuming 600ppm of Sulfur SO2 to SO4 conv [%] (double): 2 # AEDT paper, Barrett et al. (2010) @@ -86,60 +66,31 @@ PARAMETER MENU: TRANSPORT MENU: # Keep on Turn on Transport (T/F): T - # Outdated, not used (was used by spectral solver) - Fill Negative Values (T/F): T Transport Timestep [min] (double): 1 - # Keep off: not sure of the effect yet + met updraft is included (if met file input) - PLUME UPDRAFT SUBMENU: - Turn on plume updraft (T/F): F - Updraft timescale [s] (double): 3600 - Updraft veloc. [cm/s] (double): 5 - -# Chemistry component of APCEMM hasn't been touched in a long time; leave off if only interested in contrail simulation -CHEMISTRY MENU: - Turn on Chemistry (T/F): F - Perform hetero. chem. (T/F): F - Chemistry Timestep [min] (double): 10 - Photolysis rates folder (string): /path/to/input/ AEROSOL MENU: # Keep on Turn on grav. settling (T/F): T # Keep on Turn on solid coagulation (T/F): T - # Keep off - Turn on liquid coagulation (T/F): F - Coag. timestep [min] (double): 60 # Keep on Turn on ice growth (T/F): T Ice growth timestep [min] (double): 1 -# At least one of "Use met. input", "Impose moist layer depth", or "Impose lapse rate" must be true -# Imposing moist layer depth will automatically calculate the lapse rate and override the imposed lapse rate - -# If using met. input: -# Exactly one of "Init temp. from met." and "Impose lapse rate" must be true -# Exactly one of "Init RH from met." and "Impose moist layer depth" must be true METEOROLOGY MENU: # --- MET INPUT OPTIONS ---+ METEOROLOGICAL INPUT SUBMENU: - Use met. input (T/F): T Met input file path (string): ../../../../examples/issl_rhi140/example_met_file.nc # Frequency of met data availability Time series data timestep [hr] (double): 1.0 - # If off, uses the parameter specified in METEOROLOGICAL PARAMETERS SUBMENU - Init temp. from met. (T/F): T Temp. time series input (T/F): T # Always interpolates in time, this controls spatial interpolation Interpolate temp. met. data (T/F): T # Same options as the ones for Temperature: - Init RH from met. (T/F): T RH time series input (T/F): T Interpolate RH met. data (T/F): T - Init wind shear from met. (T/F): T Wind shear time series input (T/F): T Interpolate shear met. data (T/F): F - Init vert. veloc. from met. data (T/F): T Vert. veloc. time series input (T/F): F Interpolate vert. veloc. met. data (T/F): F # Option to modify NWP RH data @@ -154,29 +105,13 @@ METEOROLOGY MENU: TEMPERATURE PERTURBATION SUBMENU: Enable Temp. Pert. (T/F): F Temp. Perturb. Amplitude (double): 1.0 - Temp. Perturb. Timescale (min): 10 # The only thing that should be changed here is the save frequency DIAGNOSTIC MENU: - netCDF filename format (string): trac_avg.apcemm.hhmm - # Leave "save species timeseries" off. It will do nothing without also turning chemistry on. - SPECIES TIMESERIES SUBMENU: - Save species timeseries (T/F): F - Inst timeseries file (string): ts_hhmm.nc - #list input: separate by spaces. e.g. 1 2 3 4 5 - Species indices to include (list of ints): 1 - Save frequency [min] (double): 10 - # Index 1 (ice) is the only relevant thing to save AEROSOL TIMESERIES SUBMENU: Save aerosol timeseries (T/F): T Inst timeseries file (string): ts_aerosol_hhmm.nc - #list input: separate by spaces. e.g. 1 2 3 4 5 - Aerosol indices to include (list of ints): 1 Save frequency [min] (double): 30 - # Keep off if chemistry is also off - PRODUCTION & LOSS SUBMENU: - Turn on P/L diag (T/F): F - Save O3 P/L (T/F): F # Sometimes you have to change YLIM_DOWN here if the supersaturated layer is very thick # because YLIM_DOWN must be larger than the layer thickness. @@ -190,13 +125,6 @@ ADVANCED OPTIONS MENU: XLIM_LEFT (positive double): 1.0e+3 YLIM_UP (positive double): 300 YLIM_DOWN (positive double): 1.5e+3 - INITIAL CONTRAIL SIZE SUBMENU: - #Depth = BaseDepth + DepthScalingFactor * Default_Depth - #Same formula for width - Base Contrail Depth [m] (double): 0.0 - Contrail Depth Scaling Factor [-] (double): 1.0 - Base Contrail Width [m] (double): 0.0 - Contrail Width Scaling Factor [-] (double): 1.0 Ambient Lapse Rate [K/km] (double): -3.0 Tropopause Pressure [Pa] (double): 2.0e+4 EARLY PLUME SUBMENU: diff --git a/Code.v05-00/tests/test_yamlreader.cpp b/Code.v05-00/tests/test_yamlreader.cpp index 7c4c65daf..5c57ce990 100644 --- a/Code.v05-00/tests/test_yamlreader.cpp +++ b/Code.v05-00/tests/test_yamlreader.cpp @@ -201,15 +201,6 @@ TEST_CASE("Read Yaml File"){ REQUIRE(input.SIMULATION_OMP_NUM_THREADS == 8); #endif REQUIRE(input.SIMULATION_OVERWRITE == true); - REQUIRE(input.SIMULATION_THREADED_FFT == true); - REQUIRE(input.SIMULATION_USE_FFTW_WISDOM == true); - REQUIRE(input.SIMULATION_SAVE_FORWARD == true); - REQUIRE(input.SIMULATION_FORWARD_FILENAME == "APCEMM_Case_*"); - REQUIRE(input.SIMULATION_ADJOINT == true); - REQUIRE(input.SIMULATION_ADJOINT_FILENAME == "APCEMM_ADJ_Case_*"); - REQUIRE(input.SIMULATION_BOXMODEL == true); - REQUIRE(input.SIMULATION_BOX_FILENAME == "APCEMM_BOX_CASE_*"); - } SECTION("Read Param Menu"){ // readParamMenu fills an Input object directly, with hPa converted to @@ -235,9 +226,6 @@ TEST_CASE("Read Yaml File"){ REQUIRE(scenario.backgCH4() == 1.76); REQUIRE(scenario.backgSO2() == 7.25); - REQUIRE(scenario.EI_NOx() == 10); - REQUIRE(scenario.EI_CO() == 1); - REQUIRE(scenario.EI_HC() == 0.6); REQUIRE(scenario.EI_SO2() == 0.1); REQUIRE(scenario.EI_SO2TOSO4() == 0.05); REQUIRE(scenario.EI_Soot() == 0.06); @@ -255,25 +243,13 @@ TEST_CASE("Read Yaml File"){ OptInput input; readTransportMenu(input, data["TRANSPORT MENU"]); REQUIRE(input.TRANSPORT_TRANSPORT == true); - REQUIRE(input.TRANSPORT_FILL == true); REQUIRE(input.TRANSPORT_TIMESTEP == 10); - REQUIRE(input.TRANSPORT_UPDRAFT == true); - REQUIRE(input.TRANSPORT_UPDRAFT_TIMESCALE == 3600); - REQUIRE(input.TRANSPORT_UPDRAFT_VELOCITY == 5); - } - SECTION("Read Chemistry Menu"){ - OptInput input; - readChemMenu(input, data["CHEMISTRY MENU"]); - REQUIRE(input.CHEMISTRY_CHEMISTRY == true); - REQUIRE(input.CHEMISTRY_HETCHEM == true); - REQUIRE(input.CHEMISTRY_JRATE_FOLDER == "/net/d04/data/fritzt/APCEMM_Data/J-Rates"); } SECTION("Read Aerosol Menu"){ OptInput input; readAeroMenu(input, data["AEROSOL MENU"]); REQUIRE(input.AEROSOL_GRAVSETTLING == true); REQUIRE(input.AEROSOL_COAGULATION_SOLID == true); - REQUIRE(input.AEROSOL_COAGULATION_LIQUID == true); REQUIRE(input.AEROSOL_ICE_GROWTH == true); REQUIRE(input.AEROSOL_ICE_GROWTH_TIMESTEP == 10); } @@ -287,19 +263,14 @@ TEST_CASE("Read Yaml File"){ error = e.what(); } - REQUIRE(input.MET_LOADMET == true); REQUIRE(input.MET_FILENAME == "/path/to/met/input"); REQUIRE(input.MET_DT == 1.0); - REQUIRE(input.MET_LOADTEMP == true); REQUIRE(input.MET_TEMPTIMESERIES == true); REQUIRE(input.MET_INTERPTEMPDATA == true); - REQUIRE(input.MET_LOADRH == true); REQUIRE(input.MET_RHTIMESERIES == true); REQUIRE(input.MET_INTERPRHDATA == true); - REQUIRE(input.MET_LOADSHEAR == true); REQUIRE(input.MET_SHEARTIMESERIES == true); REQUIRE(input.MET_INTERPSHEARDATA == true); - REQUIRE(input.MET_LOADVERTVELOC == true); REQUIRE(input.MET_VERTVELOCTIMESERIES == true); REQUIRE(input.MET_INTERPVERTVELOC == true); REQUIRE(input.MET_ENABLE_TEMP_PERTURB == true); @@ -309,19 +280,9 @@ TEST_CASE("Read Yaml File"){ SECTION("Read Diagnostic Menu"){ OptInput input; readDiagMenu(input, data["DIAGNOSTIC MENU"]); - REQUIRE(input.DIAG_FILENAME == "trac_avg.apcemm.hhmm"); - REQUIRE(input.TS_SPEC == true); - REQUIRE(input.TS_FILENAME == "ts_hhmm.nc"); - REQUIRE(input.TS_SPECIES.size() == 3); - REQUIRE(input.TS_SPECIES[2] == 3); - REQUIRE(input.TS_FREQ == 10); REQUIRE(input.TS_AERO == true); REQUIRE(input.TS_AERO_FILENAME == "ts_aerosol_hhmm.nc"); - REQUIRE(input.TS_AEROSOL.size() == 3); - REQUIRE(input.TS_AEROSOL[2] == 5); REQUIRE(input.TS_AERO_FREQ == 10); - REQUIRE(input.PL_PL == true); - REQUIRE(input.PL_O3 == true); } SECTION("Read Advanced Options Menu") { OptInput input; @@ -332,10 +293,6 @@ TEST_CASE("Read Yaml File"){ REQUIRE(input.ADV_GRID_XLIM_RIGHT == 1.0e+3); REQUIRE(input.ADV_GRID_YLIM_DOWN == 1.5e+3); REQUIRE(input.ADV_GRID_YLIM_UP == 300); - REQUIRE(input.ADV_CSIZE_DEPTH_BASE == 180.0); - REQUIRE(input.ADV_CSIZE_DEPTH_SCALING_FACTOR == 0.5); - REQUIRE(input.ADV_CSIZE_WIDTH_BASE == 100.0); - REQUIRE(input.ADV_CSIZE_WIDTH_SCALING_FACTOR == 0.5); REQUIRE(input.ADV_AMBIENT_LAPSERATE == -3.0); REQUIRE(input.ADV_TROPOPAUSE_PRESSURE == 2.0e+4); @@ -364,9 +321,6 @@ TEST_CASE("Read one input file into a scenario"){ REQUIRE(scenario.backgCO() == 40); REQUIRE(scenario.backgCH4() == 1.76); REQUIRE(scenario.backgSO2() == 7.25); - REQUIRE(scenario.EI_NOx() == 10); - REQUIRE(scenario.EI_CO() == 1); - REQUIRE(scenario.EI_HC() == 0.6); REQUIRE(scenario.EI_SO2() == 0.1); REQUIRE(scenario.EI_SO2TOSO4() == 0.05); REQUIRE(scenario.EI_Soot() == 0.06); @@ -412,10 +366,21 @@ TEST_CASE("Reject input files written for the removed multi-case runs"){ ); } - SECTION("Deprecated options do not cause validation failure"){ - // Deprecated timesteps in user YAML should be accepted with a warning rather than throwing - string filename = string(APCEMM_TESTS_DIR) + YAML_DIR + "/test1.yaml"; - REQUIRE_NOTHROW(YamlInputReader::mergeYamlInputFiles({filename})); +} + +TEST_CASE("Reject input files naming an option that was removed for being unused"){ + // Test that obsolete options are correctly reporting an error with a descriptive error message + SECTION("A removed leaf key is named in the error"){ + string filename = string(APCEMM_TESTS_DIR) + YAML_DIR + "/test17.yaml"; + REQUIRE_THROWS_WITH( + YamlInputReader::mergeYamlInputFiles({filename}), + Catch::Matchers::ContainsSubstring("Removed option found") && + Catch::Matchers::ContainsSubstring("SIMULATION MENU -> Use threaded FFT (T/F)") && + Catch::Matchers::ContainsSubstring("never changed a result") && + Catch::Matchers::ContainsSubstring("test17.yaml") && + // Check that the message overrides the default "Unknow key found" + !Catch::Matchers::ContainsSubstring("Unknown key found") + ); } } @@ -557,9 +522,6 @@ TEST_CASE("Merge Input Files"){ REQUIRE(scenario.backgCO() == 40); REQUIRE(scenario.backgCH4() == 1.76); REQUIRE(scenario.backgSO2() == 7.25); - REQUIRE(scenario.EI_NOx() == 10); - REQUIRE(scenario.EI_CO() == 1); - REQUIRE(scenario.EI_HC() == 0.6); REQUIRE(scenario.EI_SO2() == 0.1); REQUIRE(scenario.EI_SO2TOSO4() == 0.05); REQUIRE(scenario.EI_Soot() == 0.06); @@ -640,7 +602,8 @@ TEST_CASE("Validate Input Files"){ YAML::Node merged; REQUIRE_NOTHROW(merged = YamlInputReader::mergeYamlInputFiles({filename6})); REQUIRE_NOTHROW(YamlInputReader::populateInput(input, scenario, merged)); - REQUIRE(input.SIMULATION_FORWARD_FILENAME == "APCEMM_Case_*"); + REQUIRE(input.SIMULATION_FORCE_SEED == false); + REQUIRE(input.SIMULATION_SEED_VALUE == 0); } SECTION("Empty input file stays valid"){ @@ -649,7 +612,7 @@ TEST_CASE("Validate Input Files"){ // leaves every compiled default in place. YAML::Node merged; REQUIRE_NOTHROW(merged = YamlInputReader::mergeYamlInputFiles({filename7})); - REQUIRE(merged["SIMULATION MENU"]["SAVE FORWARD RESULTS SUBMENU"]["netCDF filename format (string)"].as() == "APCEMM_Case_*"); + REQUIRE(merged["SIMULATION MENU"]["RANDOM NUMBER GENERATION SUBMENU"]["Seed value (positive int)"].as() == "0"); REQUIRE(merged["SIMULATION MENU"]["OUTPUT SUBMENU"]["Output folder (string)"].as() == "=MISSING="); } @@ -870,7 +833,7 @@ TEST_CASE("checkDefaultPaths guards the compiled-in defaults"){ } } -TEST_CASE("An unset output folder is reported while reading the input"){ +TEST_CASE("Not setting output folder is an error"){ // 'Output folder (string)' is required and the defaults is set to '=MISSING='. // Check that populateInput throws if the output dir is unspecified. // Without this check APCEMM creates a directory named '=MISSING=' in the diff --git a/examples/issl_rhi140/input.yaml b/examples/issl_rhi140/input.yaml index e630a1098..45b5ec0ba 100644 --- a/examples/issl_rhi140/input.yaml +++ b/examples/issl_rhi140/input.yaml @@ -4,25 +4,9 @@ SIMULATION MENU: OUTPUT SUBMENU: Output folder (string): APCEMM_out/ Overwrite if folder exists (T/F): T - # FFT options (for spectral solver) - Use threaded FFT (T/F): F - FFTW WISDOM SUBMENU: - Use FFTW WISDOM (T/F): T - Dir w/ write permission (string): ./ # This mostly contains information on background aerosol concentration; Not too relevant for contrail behavior Input background condition (string): =DEFAULT= - # All parameters here are overwritten in EMISSION INDICES SUBMENU Input engine emissions (string): =DEFAULT= - # Ignore/Don't change these, these are deprecated features. - SAVE FORWARD RESULTS SUBMENU: - Save forward results (T/F): F - netCDF filename format (string): APCEMM_Case_* - ADJOINT OPTIMIZATION SUBMENU: - Turn on adjoint optim. (T/F): F - netCDF filename format (string): APCEMM_ADJ_Case_* - BOX MODEL SUBMENU: - Run box model (T/F): F - netCDF filename format (string): APCEMM_BOX_CASE_* RANDOM NUMBER GENERATION SUBMENU: Force seed value (T/F): T Seed value (positive int): 0 @@ -59,10 +43,6 @@ PARAMETER MENU: EMISSION INDICES SUBMENU: # Engine specific parameters # Default parameters are estimates for a 737-800 at 35k ft - # Affects EPM mostly: - NOx [g(NO2)/kg_fuel] (double): 10 # EDB for CFM56-5B3 - CO [g/kg_fuel] (double): 1 - UHC [g/kg_fuel] (double): 0.6 # Affects contrail diffusion model: SO2 [g/kg_fuel] (double): 1.2 # Assuming 600ppm of Sulfur SO2 to SO4 conv [%] (double): 2 # AEDT paper, Barrett et al. (2010) @@ -81,60 +61,31 @@ PARAMETER MENU: TRANSPORT MENU: # Keep on Turn on Transport (T/F): T - # Outdated, not used (was used by spectral solver) - Fill Negative Values (T/F): T Transport Timestep [min] (double): 1 - # Keep off: not sure of the effect yet + met updraft is included (if met file input) - PLUME UPDRAFT SUBMENU: - Turn on plume updraft (T/F): F - Updraft timescale [s] (double): 3600 - Updraft veloc. [cm/s] (double): 5 - -# Chemistry component of APCEMM hasn't been touched in a long time; leave off if only interested in contrail simulation -CHEMISTRY MENU: - Turn on Chemistry (T/F): F - Perform hetero. chem. (T/F): F - Chemistry Timestep [min] (double): 10 - Photolysis rates folder (string): /path/to/input/ AEROSOL MENU: # Keep on Turn on grav. settling (T/F): T # Keep on Turn on solid coagulation (T/F): T - # Keep off - Turn on liquid coagulation (T/F): F - Coag. timestep [min] (double): 60 # Keep on Turn on ice growth (T/F): T Ice growth timestep [min] (double): 1 -# At least one of "Use met. input", "Impose moist layer depth", or "Impose lapse rate" must be true -# Imposing moist layer depth will automatically calculate the lapse rate and override the imposed lapse rate - -# If using met. input: -# Exactly one of "Init temp. from met." and "Impose lapse rate" must be true -# Exactly one of "Init RH from met." and "Impose moist layer depth" must be true METEOROLOGY MENU: # --- MET INPUT OPTIONS ---+ METEOROLOGICAL INPUT SUBMENU: - Use met. input (T/F): T Met input file path (string): example_met_file.nc # Frequency of met data availability Time series data timestep [hr] (double): 1.0 - # If off, uses the parameter specified in METEOROLOGICAL PARAMETERS SUBMENU - Init temp. from met. (T/F): T Temp. time series input (T/F): T # Always interpolates in time, this controls spatial interpolation Interpolate temp. met. data (T/F): T # Same options as the ones for Temperature: - Init RH from met. (T/F): T RH time series input (T/F): T Interpolate RH met. data (T/F): T - Init wind shear from met. (T/F): T Wind shear time series input (T/F): T Interpolate shear met. data (T/F): F - Init vert. veloc. from met. data (T/F): T Vert. veloc. time series input (T/F): F Interpolate vert. veloc. met. data (T/F): F # Option to modify NWP RH data @@ -149,29 +100,13 @@ METEOROLOGY MENU: TEMPERATURE PERTURBATION SUBMENU: Enable Temp. Pert. (T/F): F Temp. Perturb. Amplitude (double): 1.0 - Temp. Perturb. Timescale (min): 10 # The only thing that should be changed here is the save frequency DIAGNOSTIC MENU: - netCDF filename format (string): trac_avg.apcemm.hhmm - # Leave "save species timeseries" off. It will do nothing without also turning chemistry on. - SPECIES TIMESERIES SUBMENU: - Save species timeseries (T/F): F - Inst timeseries file (string): ts_hhmm.nc - #list input: separate by spaces. e.g. 1 2 3 4 5 - Species indices to include (list of ints): 1 - Save frequency [min] (double): 10 - # Index 1 (ice) is the only relevant thing to save AEROSOL TIMESERIES SUBMENU: Save aerosol timeseries (T/F): T Inst timeseries file (string): ts_aerosol_hhmm.nc - #list input: separate by spaces. e.g. 1 2 3 4 5 - Aerosol indices to include (list of ints): 1 Save frequency [min] (double): 10 - # Keep off if chemistry is also off - PRODUCTION & LOSS SUBMENU: - Turn on P/L diag (T/F): F - Save O3 P/L (T/F): F # Sometimes you have to change YLIM_DOWN here if the supersaturated layer is very thick # because YLIM_DOWN must be larger than the layer thickness. @@ -185,13 +120,6 @@ ADVANCED OPTIONS MENU: XLIM_LEFT (positive double): 1.0e+3 YLIM_UP (positive double): 300 YLIM_DOWN (positive double): 1.5e+3 - INITIAL CONTRAIL SIZE SUBMENU: - #Depth = BaseDepth + DepthScalingFactor * Default_Depth - #Same formula for width - Base Contrail Depth [m] (double): 0.0 - Contrail Depth Scaling Factor [-] (double): 1.0 - Base Contrail Width [m] (double): 0.0 - Contrail Width Scaling Factor [-] (double): 1.0 Ambient Lapse Rate [K/km] (double): -3.0 Tropopause Pressure [Pa] (double): 2.0e+4 EARLY PLUME SUBMENU: