Skip to content

Commit

Permalink
merging
Browse files Browse the repository at this point in the history
  • Loading branch information
K20shores committed Jan 19, 2024
2 parents 2a35273 + 80da0d7 commit 12734bd
Show file tree
Hide file tree
Showing 38 changed files with 1,336 additions and 27 deletions.
4 changes: 2 additions & 2 deletions examples/full_configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
{
"type": "EMISSION",
"gas phase": "gas",
"reactants": [
"products": [
{
"species name": "B",
"coefficient": 1
Expand All @@ -210,7 +210,7 @@
{
"type": "FIRST_ORDER_LOSS",
"gas phase": "gas",
"products": [
"reactants": [
{
"species name": "C",
"coefficient": 1
Expand Down
3 changes: 2 additions & 1 deletion include/open_atmos/mechanism_configuration/parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ namespace open_atmos
PhaseRequiresUnknownSpecies,
ReactionRequiresUnknownSpecies,
UnknownPhase,
RequestedAerosolSpeciesNotIncludedInAerosolPhase
RequestedAerosolSpeciesNotIncludedInAerosolPhase,
TooManyReactionComponents
};
std::string configParseStatusToString(const ConfigParseStatus &status);

Expand Down
30 changes: 30 additions & 0 deletions include/open_atmos/mechanism_configuration/validation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,18 @@ namespace open_atmos
const std::string gas_phase_products = "gas-phase products";
const std::string aerosol_phase = "aerosol phase";

// Photolysis
const std::string Photolysis_key = "PHOTOLYSIS";
const std::string scaling_factor = "scaling factor";

// Emissions
const std::string Emission_key = "EMISSION";
// also scaling factor

// First Order Loss
const std::string FirstOrderLoss_key = "FIRST_ORDER_LOSS";
// also scaling factor

} keys;

struct Configuration
Expand Down Expand Up @@ -167,6 +179,24 @@ namespace open_atmos
const std::vector<std::string> optional_keys{ keys.name, keys.reaction_probability };
} surface;

struct Photolysis
{
const std::vector<std::string> required_keys{ keys.reactants, keys.products, keys.type, keys.gas_phase };
const std::vector<std::string> optional_keys{ keys.name, keys.scaling_factor };
} photolysis;

struct Emission
{
const std::vector<std::string> required_keys{ keys.products, keys.type, keys.gas_phase };
const std::vector<std::string> optional_keys{ keys.name, keys.scaling_factor };
} emission;

struct FirstOrderLoss
{
const std::vector<std::string> required_keys{ keys.reactants, keys.type, keys.gas_phase };
const std::vector<std::string> optional_keys{ keys.name, keys.scaling_factor };
} first_order_loss;

struct Mechanism
{
const std::vector<std::string> required_keys{};
Expand Down
47 changes: 47 additions & 0 deletions include/open_atmos/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,50 @@ namespace open_atmos
std::unordered_map<std::string, std::string> unknown_properties;
};

struct Photolysis
{
/// @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 gas phase this reaction takes place in
std::string gas_phase;
/// @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
std::string name;
/// @brief An identifier indicating which gas phase this reaction takes place in
std::string gas_phase;
/// @brief Unknown properties, prefixed with two underscores (__)
std::unordered_map<std::string, std::string> unknown_properties;
};

struct FirstOrderLoss
{
/// @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 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 Unknown properties, prefixed with two underscores (__)
std::unordered_map<std::string, std::string> unknown_properties;
};

struct Reactions
{
std::vector<types::Arrhenius> arrhenius;
Expand All @@ -187,6 +231,9 @@ namespace open_atmos
std::vector<types::Branched> branched;
std::vector<types::Tunneling> tunneling;
std::vector<types::Surface> surface;
std::vector<types::Photolysis> photolysis;
std::vector<types::Emission> emission;
std::vector<types::FirstOrderLoss> first_order_loss;
};

struct Mechanism
Expand Down
Loading

0 comments on commit 12734bd

Please sign in to comment.