Mallard 0.8.0
Unstructured, GPU accelerated, high-order finite volume CFD solver
Mallard website
Loading...
Searching...
No Matches
units.h
Go to the documentation of this file.
1
12#ifndef CHEMISTRY_UNITS_H
13#define CHEMISTRY_UNITS_H
14
15#include <array>
16#include <string>
17
18#include <yaml-cpp/yaml.h>
19
20namespace chemistry {
21
27struct Dimension {
28 double mass = 0.0;
29 double length = 0.0;
30 double time = 0.0;
31 double temperature = 0.0;
32 double quantity = 0.0;
33 double energy = 0.0;
34 double pressure = 0.0;
35};
36
47 public:
48 UnitSystem() = default;
49
51 explicit UnitSystem(const YAML::Node & units);
52
60 double convert(const YAML::Node & value, const Dimension & dimension, const std::string & what) const;
61
66 double convert_activation_energy(const YAML::Node & value, const std::string & what) const;
67
68 private:
69 // SI factors of the default units, in the order of Dimension
70 std::array<double, 7> defaults = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0};
71 std::string activation_energy_units = "J/kmol";
72};
73
74} // namespace chemistry
75
76#endif // CHEMISTRY_UNITS_H
Default units of a YAML file (its units: map; Cantera's defaults otherwise) and conversion of values ...
Definition units.h:46
double convert_activation_energy(const YAML::Node &value, const std::string &what) const
Activation energy divided by the gas constant, in K: a temperature, a molar energy or an energy per m...
Definition units.cpp:210
double convert(const YAML::Node &value, const Dimension &dimension, const std::string &what) const
Value of a node in SI (kmol) units.
Definition units.cpp:184
KOKKOS_INLINE_FUNCTION rtype dot(const rtype *a, const rtype *b)
Compute the dot product of two arrays.
Definition common_math.h:32
UnitSystem units
Definition mechanism.cpp:51
Definition kinetics.h:25
Exponents of a quantity's dimension in the basis in which a YAML file sets its default units: mass,...
Definition units.h:27
double mass
Definition units.h:28
double time
Definition units.h:30
double quantity
Definition units.h:32
double length
Definition units.h:29
double pressure
Definition units.h:34
double temperature
Definition units.h:31
double energy
Definition units.h:33