Skip to content

Commit

Permalink
merging
Browse files Browse the repository at this point in the history
  • Loading branch information
K20shores committed Jan 23, 2024
2 parents b7be482 + ef7f3a0 commit 09e8273
Show file tree
Hide file tree
Showing 34 changed files with 1,187 additions and 128 deletions.
28 changes: 1 addition & 27 deletions .github/workflows/mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,13 @@ concurrency:
cancel-in-progress: true

jobs:
xcode_macos_12:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
runs-on: macos-12
strategy:
matrix:
# all available versions of xcode: https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md#xcode
xcode: ['13.1', '14.1']
build_type: [Debug, Release]
env:
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer

steps:
- uses: actions/checkout@v3

- name: Run Cmake
run: cmake -S . -B build -D CMAKE_BUILD_TYPE=${{ matrix.build_type }}

- name: Build
run: cmake --build build --parallel 10

- name: Run tests
run: |
cd build
ctest -C ${{ matrix.build_type }} --rerun-failed --output-on-failure . --verbose -j 10
xcode_macos_13:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
runs-on: macos-13
strategy:
matrix:
# all available versions of xcode: https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#xcode
xcode: ['14.1', '15.0']
xcode: ['15.0']
build_type: [Debug, Release]
env:
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer
Expand All @@ -63,7 +38,6 @@ jobs:
strategy:
matrix:
compiler:
- { cpp: g++-11, c: gcc-11}
- { cpp: g++-12, c: gcc-12}
- { cpp: clang++, c: clang}
build_type: [Debug, Release]
Expand Down
9 changes: 0 additions & 9 deletions examples/full_configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,6 @@
"A": 1.14e-2,
"C": 2300.0,
"k_reverse": 0.32,
"ion pair": {
"first": { "species name": "A"},
"second": { "species name": "B"}
},
"reactants": [
{
"species name": "A",
Expand Down Expand Up @@ -212,10 +208,6 @@
{
"species name": "H2O2_aq",
"coefficient": 1
},
{
"species name": "H2O_aq",
"coefficient": 1
}
],
"products": [
Expand Down Expand Up @@ -367,7 +359,6 @@
},
{
"type": "WET_DEPOSITION",
"gas phase": "gas",
"aerosol phase": "cloud",
"name": "rxn cloud",
"scaling factor": 12.3
Expand Down
52 changes: 41 additions & 11 deletions include/open_atmos/mechanism_configuration/validation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ namespace open_atmos
const std::string Photolysis_key = "PHOTOLYSIS";
const std::string scaling_factor = "scaling factor";

// Condensed Phae Photolysis
const std::string CondensedPhasePhotolysis_key = "CONDENSED_PHASE_PHOTOLYSIS";
// also
// scaling factor
// aerosol phase
// aerosol-phase water

// Emissions
const std::string Emission_key = "EMISSION";
// also scaling factor
Expand All @@ -117,10 +124,21 @@ namespace open_atmos
// A
// C
const std::string k_reverse = "k_reverse";
const std::string ion_pair = "ion pair";
// ion pair
const std::string first = "first";
const std::string second = "second";

// Wet Deposition
const std::string WetDeposition_key = "WET_DEPOSITION";
// also
// scaling factor
// aerosol phase

// Henry's Law Phase Transfer
const std::string HenrysLaw_key = "HL_PHASE_TRANSFER";
const std::string gas_phase_species = "gas-phase species";
const std::string aerosol_phase_species = "aerosol-phase species";
// also
// gas phase
// aerosol phase
// aerosol-phase water

} keys;

Expand Down Expand Up @@ -198,6 +216,12 @@ namespace open_atmos
const std::vector<std::string> optional_keys{ keys.name, keys.scaling_factor };
} photolysis;

struct CondensedPhasePhotolysis
{
const std::vector<std::string> required_keys{ keys.reactants, keys.products, keys.type, keys.aerosol_phase, keys.aerosol_phase_water };
const std::vector<std::string> optional_keys{ keys.name, keys.scaling_factor };
} condensed_phase_photolysis;

struct Emission
{
const std::vector<std::string> required_keys{ keys.products, keys.type, keys.gas_phase };
Expand All @@ -210,16 +234,22 @@ namespace open_atmos
const std::vector<std::string> optional_keys{ keys.name, keys.scaling_factor };
} first_order_loss;

struct WetDeposition
{
const std::vector<std::string> required_keys{ keys.aerosol_phase, keys.type };
const std::vector<std::string> optional_keys{ keys.name, keys.scaling_factor };
} wet_deposition;

struct HenrysLaw
{
const std::vector<std::string> required_keys{ keys.type, keys.gas_phase, keys.gas_phase_species, keys.aerosol_phase, keys.aerosol_phase_species, keys.aerosol_phase_water };
const std::vector<std::string> optional_keys{ keys.name };
} henrys_law;

struct AqueousEquilibrium
{
const std::vector<std::string> required_keys{ keys.type, keys.reactants, keys.products, keys.aerosol_phase, keys.aerosol_phase_water, keys.k_reverse };
const std::vector<std::string> optional_keys{ keys.name, keys.A, keys.C, keys.ion_pair };
const std::vector<std::string> optional_keys{ keys.name, keys.A, keys.C };
} aqueous_equilibrium;

struct IonPair
{
const std::vector<std::string> required_keys{ keys.first, keys.second };
const std::vector<std::string> optional_keys{};
} ion_pair;
} // namespace validation
} // namespace open_atmos
70 changes: 59 additions & 11 deletions include/open_atmos/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ namespace open_atmos
struct Photolysis
{
/// @brief Scaling factor to apply to user-provided rate constants
double scaling_factor_{ 1.0 };
double scaling_factor{ 1.0 };
/// @brief A list of reactants
std::vector<ReactionComponent> reactants;
/// @brief A list of products
Expand All @@ -199,10 +199,28 @@ namespace open_atmos
std::unordered_map<std::string, std::string> unknown_properties;
};

struct Emission
struct CondensedPhasePhotolysis
{
/// @brief Scaling factor to apply to user-provided rate constants
double scaling_factor_{ 1.0 };
/// @brief A list of reactants
std::vector<ReactionComponent> reactants;
/// @brief A list of products
std::vector<ReactionComponent> products;
/// @brief An identifier, optional, uniqueness not enforced
std::string name;
/// @brief An identifier indicating which aerosol phase this reaction takes place in
std::string aerosol_phase;
/// @brief An identifier indicating the species label of aqueous phase water
std::string aerosol_phase_water;
/// @brief Unknown properties, prefixed with two underscores (__)
std::unordered_map<std::string, std::string> unknown_properties;
};

struct Emission
{
/// @brief Scaling factor to apply to user-provided rate constants
double scaling_factor{ 1.0 };
/// @brief A list of products
std::vector<ReactionComponent> products;
/// @brief An identifier, optional, uniqueness not enforced
Expand All @@ -216,7 +234,7 @@ namespace open_atmos
struct FirstOrderLoss
{
/// @brief Scaling factor to apply to user-provided rate constants
double scaling_factor_{ 1.0 };
double scaling_factor{ 1.0 };
/// @brief A list of reactants
std::vector<ReactionComponent> reactants;
/// @brief An identifier, optional, uniqueness not enforced
Expand All @@ -226,7 +244,6 @@ namespace open_atmos
/// @brief Unknown properties, prefixed with two underscores (__)
std::unordered_map<std::string, std::string> unknown_properties;
};

struct AqueousEquilibrium
{
/// @brief An identifier, optional, uniqueness not enforced
Expand All @@ -241,8 +258,6 @@ namespace open_atmos
std::vector<ReactionComponent> reactants;
/// @brief A list of products
std::vector<ReactionComponent> products;
/// @brief Optional ion pairs
std::optional<std::array<ReactionComponent, 2>> ion_pair;
/// @brief Pre-exponential factor (s-1)
double A{ 1 };
/// @brief A constant
Expand All @@ -253,18 +268,51 @@ namespace open_atmos
std::unordered_map<std::string, std::string> unknown_properties;
};

struct WetDeposition
{
/// @brief Scaling factor to apply to user-provided rate constants
double scaling_factor{ 1.0 };
/// @brief An identifier, optional, uniqueness not enforced
std::string name;
/// @brief An identifier indicating which aerosol phase this reaction takes place in
std::string aerosol_phase;
/// @brief Unknown properties, prefixed with two underscores (__)
std::unordered_map<std::string, std::string> unknown_properties;
};

struct HenrysLaw
{
/// @brief An identifier, optional, uniqueness not enforced
std::string name;
/// @brief An identifier indicating which gas phase this reaction takes place in
std::string gas_phase;
/// @brief An identifier indicating which gas phase species this reaction involves
std::string gas_phase_species;
/// @brief An identifier indicating which aerosol phase this reaction takes place in
std::string aerosol_phase;
/// @brief An identifier indicating the species label of aqueous phase water
std::string aerosol_phase_water;
/// @brief An identifier indicating which aerosol phase species this reaction involves
std::string aerosol_phase_species;
/// @brief Unknown properties, prefixed with two underscores (__)
std::unordered_map<std::string, std::string> unknown_properties;
};

struct Reactions
{
std::vector<types::Arrhenius> arrhenius;
std::vector<types::CondensedPhaseArrhenius> condensed_phase_arrhenius;
std::vector<types::Troe> troe;
std::vector<types::Branched> branched;
std::vector<types::Tunneling> tunneling;
std::vector<types::Surface> surface;
std::vector<types::Photolysis> photolysis;
std::vector<types::CondensedPhaseArrhenius> condensed_phase_arrhenius;
std::vector<types::CondensedPhasePhotolysis> condensed_phase_photolysis;
std::vector<types::Emission> emission;
std::vector<types::FirstOrderLoss> first_order_loss;
std::vector<types::AqueousEquilibrium> aqueous_equilibrium;
std::vector<types::WetDeposition> wet_deposition;
std::vector<types::HenrysLaw> henrys_law;
std::vector<types::Photolysis> photolysis;
std::vector<types::Surface> surface;
std::vector<types::Troe> troe;
std::vector<types::Tunneling> tunneling;
};

struct Mechanism
Expand Down
Loading

0 comments on commit 09e8273

Please sign in to comment.