OGS
TemperatureDependentDiffusion.cpp
Go to the documentation of this file.
1
10
#include "
TemperatureDependentDiffusion.h
"
11
12
#include <algorithm>
13
#include <cmath>
14
#include <iterator>
15
16
#include "
MaterialLib/PhysicalConstant.h
"
17
18
namespace
MaterialPropertyLib
19
{
20
void
TemperatureDependentDiffusion::checkScale
()
const
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
30
PropertyDataType
TemperatureDependentDiffusion::value
(
31
VariableArray
const
& variable_array,
32
ParameterLib::SpatialPosition
const
& pos,
double
const
t,
33
double
const
/*dt*/
)
const
34
{
35
auto
const
T = variable_array.
temperature
;
36
double
const
gas_constant =
MaterialLib::PhysicalConstant::IdealGasConstant
;
37
double
const
Arrhenius_exponent =
38
std::exp(
Ea_
/ gas_constant * (1 /
T0_
- 1 / T));
39
40
auto
const
D0_data =
D0_
(t, pos);
41
std::vector<double> D;
42
std::transform(D0_data.cbegin(), D0_data.cend(), std::back_inserter(D),
43
[&Arrhenius_exponent](
double
const
D0_component)
44
{ return D0_component * Arrhenius_exponent; });
45
46
return
fromVector
(D);
47
}
48
}
// namespace MaterialPropertyLib
OGS_FATAL
#define OGS_FATAL(...)
Definition
Error.h:26
PhysicalConstant.h
TemperatureDependentDiffusion.h
MaterialPropertyLib::Property::value
virtual PropertyDataType value() const
Definition
Property.cpp:76
MaterialPropertyLib::Property::scale_
std::variant< Medium *, Phase *, Component * > scale_
Definition
Property.h:297
MaterialPropertyLib::TemperatureDependentDiffusion::D0_
ParameterLib::Parameter< double > const & D0_
the molecular diffusion at the reference temperature
Definition
TemperatureDependentDiffusion.h:52
MaterialPropertyLib::TemperatureDependentDiffusion::Ea_
double const Ea_
the activition energy for diffusion
Definition
TemperatureDependentDiffusion.h:54
MaterialPropertyLib::TemperatureDependentDiffusion::checkScale
void checkScale() const override
Definition
TemperatureDependentDiffusion.cpp:20
MaterialPropertyLib::TemperatureDependentDiffusion::T0_
double const T0_
the reference temperature
Definition
TemperatureDependentDiffusion.h:56
MaterialPropertyLib::VariableArray
Definition
VariableType.h:99
MaterialPropertyLib::VariableArray::temperature
double temperature
Definition
VariableType.h:191
ParameterLib::SpatialPosition
Definition
SpatialPosition.h:27
MaterialLib::PhysicalConstant::IdealGasConstant
constexpr double IdealGasConstant
Definition
PhysicalConstant.h:31
MaterialPropertyLib
Definition
ChemicalSolverInterface.h:21
MaterialPropertyLib::fromVector
PropertyDataType fromVector(std::vector< double > const &values)
Definition
Property.cpp:23
MaterialPropertyLib::PropertyDataType
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 >, Eigen::MatrixXd > PropertyDataType
Definition
Property.h:31
MaterialLib
MPL
Properties
TemperatureDependentDiffusion.cpp
Generated by
1.11.0