OGS
ProcessLib::TES::TESFEMReactionAdaptorCaOH2 Class Referencefinal

Detailed Description

Definition at line 109 of file TESReactionAdaptor.h.

#include <TESReactionAdaptor.h>

Inheritance diagram for ProcessLib::TES::TESFEMReactionAdaptorCaOH2:
[legend]
Collaboration diagram for ProcessLib::TES::TESFEMReactionAdaptorCaOH2:
[legend]

Public Member Functions

 TESFEMReactionAdaptorCaOH2 (TESLocalAssemblerData const &data)
 
ReactionRate initReaction (const unsigned) override
 
- Public Member Functions inherited from ProcessLib::TES::TESFEMReactionAdaptor
virtual bool checkBounds (std::vector< double > const &, std::vector< double > const &)
 
virtual void preZerothTryAssemble ()
 
virtual double getReactionDampingFactor () const
 
virtual ~TESFEMReactionAdaptor ()=default
 

Private Types

using Data = TESLocalAssemblerData
 
using React = Adsorption::ReactionCaOH2
 

Static Private Member Functions

static bool odeRhs (const double, MathLib::ODE::MappedConstVector< 1 > const y, MathLib::ODE::MappedVector< 1 > ydot, React &reaction)
 

Private Attributes

Data const & _d
 
React_react
 
std::unique_ptr< MathLib::ODE::ODESolver< 1 > > _ode_solver
 

Additional Inherited Members

- Static Public Member Functions inherited from ProcessLib::TES::TESFEMReactionAdaptor
static std::unique_ptr< TESFEMReactionAdaptornewInstance (TESLocalAssemblerData const &data)
 

Member Typedef Documentation

◆ Data

◆ React

Constructor & Destructor Documentation

◆ TESFEMReactionAdaptorCaOH2()

ProcessLib::TES::TESFEMReactionAdaptorCaOH2::TESFEMReactionAdaptorCaOH2 ( TESLocalAssemblerData const & data)
explicit

Definition at line 301 of file TESReactionAdaptor.cpp.

303 : _d(data),
304 _react(dynamic_cast<Adsorption::ReactionCaOH2&>(*data.ap.react_sys))
305{
306 _ode_solver = MathLib::ODE::createODESolver<1>(_react.getOdeSolverConfig());
307 // TODO invalidate config
308
309 _ode_solver->setTolerance(1e-10, 1e-10);
310
311 auto f = [this](const double /*t*/,
314 ydot) -> bool
315 {
316 ydot[0] = _react.getReactionRate(y[0]);
317 return true;
318 };
319
320 _ode_solver->setFunction(f, nullptr);
321}
double getReactionRate(const double, const double, const double, const double) const override
const BaseLib::ConfigTree & getOdeSolverConfig() const
std::unique_ptr< MathLib::ODE::ODESolver< 1 > > _ode_solver
MappedConstMatrix< N, 1 > MappedConstVector
MappedMatrix< N, 1 > MappedVector

References _ode_solver, _react, Adsorption::ReactionCaOH2::getOdeSolverConfig(), and Adsorption::ReactionCaOH2::getReactionRate().

Member Function Documentation

◆ initReaction()

ReactionRate ProcessLib::TES::TESFEMReactionAdaptorCaOH2::initReaction ( const unsigned )
overridevirtual

Implements ProcessLib::TES::TESFEMReactionAdaptor.

Definition at line 323 of file TESReactionAdaptor.cpp.

324{
325 // TODO if the first holds, the second also has to hold
328 {
329 return {_d.reaction_rate[int_pt], _d.solid_density[int_pt]};
330 }
331
332 // TODO: double check!
333 // const double xv_NR = SolidProp->non_reactive_solid_volume_fraction;
334 // const double rho_NR = SolidProp->non_reactive_solid_density;
335 const double xv_NR = 0.0;
336 const double rho_NR = 0.0;
337
338 const double t0 = 0.0;
339 const double y0 =
340 (_d.solid_density_prev_ts[int_pt] - xv_NR * rho_NR) / (1.0 - xv_NR);
341
342 const double t_end = _d.ap.delta_t;
343
345 _d.solid_density_prev_ts[int_pt]);
346
347 _ode_solver->setIC(t0, {y0});
348 _ode_solver->preSolve();
349 _ode_solver->solve(t_end);
350
351 const double time_reached = _ode_solver->getTime();
352 (void)time_reached;
353 assert(std::abs(t_end - time_reached) <
354 std::numeric_limits<double>::epsilon());
355
356 auto const& y_new = _ode_solver->getSolution();
357 auto const& y_dot_new = _ode_solver->getYDot(t_end, y_new);
358
359 double rho_react;
360
361 // cut off when limits are reached
363 {
365 }
366 else if (y_new[0] >
368 {
370 }
371 else
372 {
373 rho_react = y_new[0];
374 }
375
376 return {y_dot_new[0] * (1.0 - xv_NR),
377 (1.0 - xv_NR) * rho_react + xv_NR * rho_NR};
378}
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

References _d, _ode_solver, _react, ProcessLib::TES::TESLocalAssemblerData::ap, ProcessLib::TES::AssemblyParams::delta_t, ProcessLib::TES::AssemblyParams::iteration_in_current_timestep, ProcessLib::TES::AssemblyParams::number_of_try_of_iteration, ProcessLib::TES::TESLocalAssemblerData::p, ProcessLib::TES::TESLocalAssemblerData::reaction_rate, Adsorption::ReactionCaOH2::rho_low, Adsorption::ReactionCaOH2::rho_up, ProcessLib::TES::TESLocalAssemblerData::solid_density, ProcessLib::TES::TESLocalAssemblerData::solid_density_prev_ts, ProcessLib::TES::TESLocalAssemblerData::T, Adsorption::ReactionCaOH2::updateParam(), and ProcessLib::TES::TESLocalAssemblerData::vapour_mass_fraction.

◆ odeRhs()

static bool ProcessLib::TES::TESFEMReactionAdaptorCaOH2::odeRhs ( const double ,
MathLib::ODE::MappedConstVector< 1 > const y,
MathLib::ODE::MappedVector< 1 > ydot,
React & reaction )
staticprivate

Member Data Documentation

◆ _d

Data const& ProcessLib::TES::TESFEMReactionAdaptorCaOH2::_d
private

Definition at line 119 of file TESReactionAdaptor.h.

Referenced by initReaction().

◆ _ode_solver

std::unique_ptr<MathLib::ODE::ODESolver<1> > ProcessLib::TES::TESFEMReactionAdaptorCaOH2::_ode_solver
private

Definition at line 122 of file TESReactionAdaptor.h.

Referenced by TESFEMReactionAdaptorCaOH2(), and initReaction().

◆ _react

React& ProcessLib::TES::TESFEMReactionAdaptorCaOH2::_react
private

Definition at line 120 of file TESReactionAdaptor.h.

Referenced by TESFEMReactionAdaptorCaOH2(), and initReaction().


The documentation for this class was generated from the following files: