32 return std::make_unique<TESFEMReactionAdaptorAdsorption>(data);
36 return std::make_unique<TESFEMReactionAdaptorInert>(data);
40 return std::make_unique<TESFEMReactionAdaptorSinusoidal>(data);
44 return std::make_unique<TESFEMReactionAdaptorCaOH2>(data);
47 OGS_FATAL(
"No suitable TESFEMReactionAdaptor found. Aborting.");
55 : _bounds_violation(data.solid_density.size(), false), _d(data)
59 "Reactive system has wrong type.");
65 const unsigned int_pt)
88 else if (
_d.
p_V < 100.0 ||
90 getEquilibriumVapourPressure(
_d.
T))
101 const double delta_pV = pV_eq -
_d.
p_V;
102 const double delta_rhoV =
105 const double delta_rhoSR = delta_rhoV / (
_d.
ap.
poro - 1.0);
106 double react_rate_R2 = delta_rhoSR /
_d.
ap.
delta_t;
110 react_rate_R2 *= 0.5;
117 std::abs(react_rate_R2) > std::abs(react_rate_R)) ||
119 std::abs(react_rate_R2) < std::abs(react_rate_R)))
121 react_rate_R = react_rate_R2;
134 react_rate_R = 1.0 / (1.0 + N) *
152 if (std::abs(react_rate_R) > std::abs(r))
158 return {react_rate_R,
163 const double p_V0,
const double C0)
const
165 auto f = [
this, p_V0, C0](
double pV) ->
double
191 return rf.getResult();
195 std::vector<double>
const& local_x,
196 std::vector<double>
const& local_x_prev_ts)
200 const double min_xmV = 1e-6;
201 const std::size_t nnodes = local_x.size() /
NODAL_DOF;
204 for (std::size_t i = 0; i < nnodes; ++i)
206 auto const xnew = local_x[xmV_offset + i];
207 auto const xold = local_x_prev_ts[xmV_offset + i];
211 const auto a = xold / (xold - xnew);
212 alpha = std::min(alpha, a);
217 const auto a = xold / (xnew - xold);
218 alpha = std::min(alpha, a);
283 "Reactive system has wrong type.");
292 const double rhoSR0 = 1.0;
293 const double rhoTil = 0.1;
294 const double omega = 2.0 * 3.1416;
297 return {rhoTil * omega * cos(omega * t) / (1.0 - poro),
298 rhoSR0 + rhoTil * std::sin(omega * t) / (1.0 - poro)};
304 _react(dynamic_cast<
Adsorption::ReactionCaOH2&>(*data.ap.react_sys))
311 auto f = [
this](
const double ,
335 const double xv_NR = 0.0;
336 const double rho_NR = 0.0;
338 const double t0 = 0.0;
351 const double time_reached =
_ode_solver->getTime();
353 assert(std::abs(t_end - time_reached) <
354 std::numeric_limits<double>::epsilon());
357 auto const& y_dot_new =
_ode_solver->getYDot(t_end, y_new);
373 rho_react = y_new[0];
376 return {y_dot_new[0] * (1.0 - xv_NR),
377 (1.0 - xv_NR) * rho_react + xv_NR * rho_NR};
static double getEquilibriumVapourPressure(const double T_Ads)
static double getLoading(const double rho_curr, const double rho_dry)
static MATERIALLIB_EXPORT constexpr double rho_low
lower density limit
void updateParam(double T_solid, double p_gas, double x_react, double rho_s_initial)
static MATERIALLIB_EXPORT constexpr double rho_up
upper density limit
double getReactionRate(const double, const double, const double, const double) const override
const BaseLib::ConfigTree & getOdeSolverConfig() const
ReactionRate initReaction_slowDownUndershootStrategy(const unsigned int_pt)
TESFEMReactionAdaptorAdsorption(TESLocalAssemblerData const &data)
double estimateAdsorptionEquilibrium(const double p_V0, const double C0) const
std::vector< bool > _bounds_violation
bool checkBounds(std::vector< double > const &local_x, std::vector< double > const &local_x_prev_ts) override
double _reaction_damping_factor
void preZerothTryAssemble() override
TESLocalAssemblerData const & _d
ReactionRate initReaction(const unsigned) override
TESFEMReactionAdaptorCaOH2(TESLocalAssemblerData const &data)
std::unique_ptr< MathLib::ODE::ODESolver< 1 > > _ode_solver
ReactionRate initReaction(const unsigned int_pt) override
TESFEMReactionAdaptorInert(TESLocalAssemblerData const &)
TESLocalAssemblerData const & _d
TESLocalAssemblerData const & _d
ReactionRate initReaction(const unsigned) override
TESFEMReactionAdaptorSinusoidal(TESLocalAssemblerData const &data)
static std::unique_ptr< TESFEMReactionAdaptor > newInstance(TESLocalAssemblerData const &data)
MappedConstMatrix< N, 1 > MappedConstVector
MappedMatrix< N, 1 > MappedVector
std::unique_ptr< ODESolver< NumEquations > > createODESolver(BaseLib::ConfigTree const &config)
constexpr double IdealGasConstant
RegulaFalsi< SubType, Function > makeRegulaFalsi(Function &&f, double const a, double const b)
const unsigned COMPONENT_ID_MASS_FRACTION
unsigned number_of_try_of_iteration
std::unique_ptr< Adsorption::Reaction > react_sys
unsigned iteration_in_current_timestep
std::vector< double > solid_density_prev_ts
double vapour_mass_fraction
std::vector< double > solid_density
std::vector< double > reaction_rate
AssemblyParams const & ap