OGS
TemperatureDependentDiffusion.cpp
Go to the documentation of this file.
1 
11 
12 #include <algorithm>
13 #include <cmath>
14 #include <iterator>
15 
17 
18 namespace MaterialPropertyLib
19 {
21 {
22  if (!std::holds_alternative<Component*>(scale_))
23  {
24  OGS_FATAL(
25  "The property 'TemperatureDependentDiffusion' is "
26  "implemented on the 'component' scale only.");
27  }
28 }
29 
31  VariableArray const& variable_array,
32  ParameterLib::SpatialPosition const& pos, double const t,
33  double const /*dt*/) const
34 {
35  auto const T = std::get<double>(variable_array[static_cast<int>(
37  double const gas_constant = MaterialLib::PhysicalConstant::IdealGasConstant;
38  double const Arrhenius_exponent =
39  std::exp(Ea_ / gas_constant * (1 / T0_ - 1 / T));
40 
41  auto const D0_data = D0_(t, pos);
42  std::vector<double> D;
43  std::transform(D0_data.cbegin(), D0_data.cend(), std::back_inserter(D),
44  [&Arrhenius_exponent](double const D0_component)
45  { return D0_component * Arrhenius_exponent; });
46 
47  return fromVector(D);
48 }
49 } // namespace MaterialPropertyLib
#define OGS_FATAL(...)
Definition: Error.h:26
virtual PropertyDataType value() const
Definition: Property.cpp:72
std::variant< Medium *, Phase *, Component * > scale_
Definition: Property.h:287
ParameterLib::Parameter< double > const & D0_
the molecular diffusion at the reference temperature
double const Ea_
the activition energy for diffusion
PropertyDataType fromVector(std::vector< double > const &values)
Definition: Property.cpp:23
std::variant< double, Eigen::Matrix< double, 2, 1 >, Eigen::Matrix< double, 3, 1 >, Eigen::Matrix< double, 2, 2 >, Eigen::Matrix< double, 3, 3 >, Eigen::Matrix< double, 4, 1 >, Eigen::Matrix< double, 6, 1 > > PropertyDataType
Definition: Property.h:35
std::array< VariableType, static_cast< int >(Variable::number_of_variables)> VariableArray
Definition: VariableType.h:108