OGS
TemperatureDependentDiffusion.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
5
6#include <algorithm>
7#include <cmath>
8#include <iterator>
9
11
12namespace MaterialPropertyLib
13{
15{
16 if (!std::holds_alternative<Component*>(scale_))
17 {
19 "The property 'TemperatureDependentDiffusion' is "
20 "implemented on the 'component' scale only.");
21 }
22}
23
25 VariableArray const& variable_array,
26 ParameterLib::SpatialPosition const& pos, double const t,
27 double const /*dt*/) const
28{
29 auto const T = variable_array.temperature;
30 double const gas_constant = MaterialLib::PhysicalConstant::IdealGasConstant;
31 double const Arrhenius_exponent =
32 std::exp(Ea_ / gas_constant * (1 / T0_ - 1 / T));
33
34 auto const D0_data = D0_(t, pos);
35 std::vector<double> D;
36 std::transform(D0_data.cbegin(), D0_data.cend(), std::back_inserter(D),
37 [&Arrhenius_exponent](double const D0_component)
38 { return D0_component * Arrhenius_exponent; });
39
40 return fromVector(D);
41}
42} // namespace MaterialPropertyLib
#define OGS_FATAL(...)
Definition Error.h:19
virtual PropertyDataType value() const
std::variant< Medium *, Phase *, Component * > scale_
ParameterLib::Parameter< double > const & D0_
the molecular diffusion at the reference temperature
double const Ea_
the activation energy for diffusion
PropertyDataType fromVector(std::vector< double > const &values)
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