OGS
ProcessLib::TES::TESProcess Class Referencefinal

Detailed Description

Definition at line 31 of file TESProcess.h.

#include <TESProcess.h>

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

Public Member Functions

 TESProcess (std::string name, MeshLib::Mesh &mesh, std::unique_ptr< AbstractJacobianAssembler > &&jacobian_assembler, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters, unsigned const integration_order, std::vector< std::vector< std::reference_wrapper< ProcessVariable >>> &&process_variables, SecondaryVariableCollection &&secondary_variables, BaseLib::ConfigTree const &config)
 
void preTimestepConcreteProcess (std::vector< GlobalVector * > const &x, const double t, const double delta_t, const int process_id) override
 
void preIterationConcreteProcess (const unsigned iter, GlobalVector const &x) override
 
NumLib::IterationResult postIterationConcreteProcess (GlobalVector const &x) override
 
bool isLinear () const override
 
- Public Member Functions inherited from ProcessLib::Process
 Process (std::string name_, MeshLib::Mesh &mesh, std::unique_ptr< AbstractJacobianAssembler > &&jacobian_assembler, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters, unsigned const integration_order, std::vector< std::vector< std::reference_wrapper< ProcessVariable >>> &&process_variables, SecondaryVariableCollection &&secondary_variables, const bool use_monolithic_scheme=true)
 
void preTimestep (std::vector< GlobalVector * > const &x, const double t, const double delta_t, const int process_id)
 Preprocessing before starting assembly for new timestep. More...
 
void postTimestep (std::vector< GlobalVector * > const &x, const double t, const double delta_t, int const process_id)
 Postprocessing after a complete timestep. More...
 
void postNonLinearSolver (GlobalVector const &x, GlobalVector const &xdot, const double t, double const dt, int const process_id)
 
void preIteration (const unsigned iter, GlobalVector const &x) final
 
void computeSecondaryVariable (double const t, double const dt, std::vector< GlobalVector * > const &x, GlobalVector const &x_dot, int const process_id)
 compute secondary variables for the coupled equations or for output. More...
 
NumLib::IterationResult postIteration (GlobalVector const &x) final
 
void initialize ()
 
void setInitialConditions (std::vector< GlobalVector * > &process_solutions, std::vector< GlobalVector * > const &process_solutions_prev, double const t, int const process_id)
 
MathLib::MatrixSpecifications getMatrixSpecifications (const int process_id) const override
 
void setCoupledSolutionsForStaggeredScheme (CoupledSolutionsForStaggeredScheme *const coupled_solutions)
 
void updateDeactivatedSubdomains (double const time, const int process_id)
 
bool isMonolithicSchemeUsed () const
 
virtual void setCoupledTermForTheStaggeredSchemeToLocalAssemblers (int const)
 
virtual void extrapolateIntegrationPointValuesToNodes (const double, std::vector< GlobalVector * > const &, std::vector< GlobalVector * > &)
 
void preAssemble (const double t, double const dt, GlobalVector const &x) final
 
void assemble (const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &xdot, int const process_id, GlobalMatrix &M, GlobalMatrix &K, GlobalVector &b) final
 
void assembleWithJacobian (const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &xdot, const double dxdot_dx, const double dx_dx, int const process_id, GlobalMatrix &M, GlobalMatrix &K, GlobalVector &b, GlobalMatrix &Jac) final
 
std::vector< NumLib::IndexValueVector< GlobalIndexType > > const * getKnownSolutions (double const t, GlobalVector const &x, int const process_id) const final
 
virtual NumLib::LocalToGlobalIndexMap const & getDOFTable (const int) const
 
MeshLib::MeshgetMesh () const
 
std::vector< std::reference_wrapper< ProcessVariable > > const & getProcessVariables (const int process_id) const
 
SecondaryVariableCollection const & getSecondaryVariables () const
 
std::vector< std::unique_ptr< IntegrationPointWriter > > const * getIntegrationPointWriter (MeshLib::Mesh const &mesh) const
 
virtual Eigen::Vector3d getFlux (std::size_t, MathLib::Point3d const &, double const, std::vector< GlobalVector * > const &) const
 
virtual void solveReactionEquation (std::vector< GlobalVector * > &, std::vector< GlobalVector * > const &, double const, double const, NumLib::EquationSystem &, int const)
 

Private Member Functions

void initializeConcreteProcess (NumLib::LocalToGlobalIndexMap const &dof_table, MeshLib::Mesh const &mesh, unsigned const integration_order) override
 Process specific initialization called by initialize(). More...
 
void assembleConcreteProcess (const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &xdot, int const process_id, GlobalMatrix &M, GlobalMatrix &K, GlobalVector &b) override
 
void initializeSecondaryVariables ()
 
void assembleWithJacobianConcreteProcess (const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &xdot, const double dxdot_dx, const double dx_dx, int const process_id, GlobalMatrix &M, GlobalMatrix &K, GlobalVector &b, GlobalMatrix &Jac) override
 
GlobalVector const & computeVapourPartialPressure (const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::unique_ptr< GlobalVector > &result_cache)
 
GlobalVector const & computeRelativeHumidity (const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::unique_ptr< GlobalVector > &result_cache)
 
GlobalVector const & computeEquilibriumLoading (const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::unique_ptr< GlobalVector > &result_cache)
 

Private Attributes

std::vector< std::unique_ptr< TESLocalAssemblerInterface > > _local_assemblers
 
AssemblyParams _assembly_params
 
std::unique_ptr< GlobalVector_x_previous_timestep
 

Additional Inherited Members

- Public Types inherited from ProcessLib::Process
using NonlinearSolver = NumLib::NonlinearSolverBase
 
using TimeDiscretization = NumLib::TimeDiscretization
 
- Public Attributes inherited from ProcessLib::Process
std::string const name
 
- Protected Member Functions inherited from ProcessLib::Process
NumLib::ExtrapolatorgetExtrapolator () const
 
NumLib::LocalToGlobalIndexMap const & getSingleComponentDOFTable () const
 
void initializeProcessBoundaryConditionsAndSourceTerms (const NumLib::LocalToGlobalIndexMap &dof_table, const int process_id)
 
virtual void constructDofTable ()
 
void constructMonolithicProcessDofTable ()
 
void constructDofTableOfSpecifiedProcessStaggeredScheme (const int specified_prosess_id)
 
virtual std::tuple< NumLib::LocalToGlobalIndexMap *, bool > getDOFTableForExtrapolatorData () const
 
- Protected Attributes inherited from ProcessLib::Process
MeshLib::Mesh_mesh
 
std::unique_ptr< MeshLib::MeshSubset const > _mesh_subset_all_nodes
 
std::unique_ptr< NumLib::LocalToGlobalIndexMap_local_to_global_index_map
 
SecondaryVariableCollection _secondary_variables
 
VectorMatrixAssembler _global_assembler
 
const bool _use_monolithic_scheme
 
CoupledSolutionsForStaggeredScheme_coupled_solutions
 
unsigned const _integration_order
 
std::vector< std::unique_ptr< IntegrationPointWriter > > _integration_point_writer
 
GlobalSparsityPattern _sparsity_pattern
 
std::vector< std::vector< std::reference_wrapper< ProcessVariable > > > _process_variables
 
std::vector< BoundaryConditionCollection_boundary_conditions
 

Constructor & Destructor Documentation

◆ TESProcess()

ProcessLib::TES::TESProcess::TESProcess ( std::string  name,
MeshLib::Mesh mesh,
std::unique_ptr< AbstractJacobianAssembler > &&  jacobian_assembler,
std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &  parameters,
unsigned const  integration_order,
std::vector< std::vector< std::reference_wrapper< ProcessVariable >>> &&  process_variables,
SecondaryVariableCollection &&  secondary_variables,
BaseLib::ConfigTree const &  config 
)
Input File Parameter:
prj__processes__process__TES__fluid_specific_heat_source
Input File Parameter:
prj__processes__process__TES__fluid_specific_isobaric_heat_capacity
Input File Parameter:
prj__processes__process__TES__solid_specific_heat_source
Input File Parameter:
prj__processes__process__TES__solid_heat_conductivity
Input File Parameter:
prj__processes__process__TES__solid_specific_isobaric_heat_capacity
Input File Parameter:
prj__processes__process__TES__tortuosity
Input File Parameter:
prj__processes__process__TES__diffusion_coefficient
Input File Parameter:
prj__processes__process__TES__porosity
Input File Parameter:
prj__processes__process__TES__solid_density_dry
Input File Parameter:
prj__processes__process__TES__solid_density_initial
Input File Parameter:
special OGS input file parameter
Input File Parameter:
prj__processes__process__TES__characteristic_pressure
Input File Parameter:
prj__processes__process__TES__characteristic_temperature
Input File Parameter:
prj__processes__process__TES__characteristic_vapour_mass_fraction
Input File Parameter:
special OGS input file parameter
Input File Parameter:
prj__processes__process__TES__solid_hydraulic_permeability
Input File Parameter:
prj__processes__process__TES__reactive_system
Input File Parameter:
prj__processes__process__TES__output_element_matrices

Definition at line 20 of file TESProcess.cpp.

30  : Process(std::move(name), mesh, std::move(jacobian_assembler), parameters,
31  integration_order, std::move(process_variables),
32  std::move(secondary_variables))
33 {
34  DBUG("Create TESProcess.");
35 
36  // physical parameters for local assembly
37  {
38  std::vector<std::pair<std::string, double*>> params{
40  {"fluid_specific_heat_source",
43  {"fluid_specific_isobaric_heat_capacity", &_assembly_params.cpG},
45  {"solid_specific_heat_source",
48  {"solid_heat_conductivity", &_assembly_params.solid_heat_cond},
50  {"solid_specific_isobaric_heat_capacity", &_assembly_params.cpS},
52  {"tortuosity", &_assembly_params.tortuosity},
54  {"diffusion_coefficient",
57  {"porosity", &_assembly_params.poro},
59  {"solid_density_dry", &_assembly_params.rho_SR_dry},
61  {"solid_density_initial", &_assembly_params.initial_solid_density}};
62 
63  for (auto const& p : params)
64  {
65  if (auto const par =
67  config.getConfigParameterOptional<double>(p.first))
68  {
69  DBUG("setting parameter `{:s}' to value `{:g}'", p.first, *par);
70  *p.second = *par;
71  }
72  }
73  }
74 
75  // characteristic values of primary variables
76  {
77  std::vector<std::pair<std::string, Trafo*>> const params{
79  {"characteristic_pressure", &_assembly_params.trafo_p},
81  {"characteristic_temperature", &_assembly_params.trafo_T},
83  {"characteristic_vapour_mass_fraction", &_assembly_params.trafo_x}};
84 
85  for (auto const& p : params)
86  {
87  if (auto const par =
89  config.getConfigParameterOptional<double>(p.first))
90  {
91  INFO("setting parameter `{:s}' to value `{:g}'", p.first, *par);
92  *p.second = Trafo{*par};
93  }
94  }
95  }
96 
97  // permeability
98  if (auto par =
100  config.getConfigParameterOptional<double>(
101  "solid_hydraulic_permeability"))
102  {
103  DBUG(
104  "setting parameter `solid_hydraulic_permeability' to isotropic "
105  "value `{:g}'",
106  *par);
107  const auto dim = mesh.getDimension();
109  Eigen::MatrixXd::Identity(dim, dim) * (*par);
110  }
111 
112  // reactive system
115  config.getConfigSubtree("reactive_system"));
116 
117  // debug output
118  if (auto const param =
120  config.getConfigParameterOptional<bool>("output_element_matrices"))
121  {
122  DBUG("output_element_matrices: {:s}", (*param) ? "true" : "false");
123 
125  }
126 
127  // TODO somewhere else
128  /*
129  if (auto const param =
131  config.getConfigParameterOptional<bool>("output_global_matrix"))
132  {
133  DBUG("output_global_matrix: {:s}", (*param) ? "true" : "false");
134 
135  this->_process_output.output_global_matrix = *param;
136  }
137  */
138 }
void INFO(char const *fmt, Args const &... args)
Definition: Logging.h:32
void DBUG(char const *fmt, Args const &... args)
Definition: Logging.h:27
static std::unique_ptr< Reaction > newInstance(BaseLib::ConfigTree const &conf)
Definition: Reaction.cpp:27
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
Definition: Mesh.h:71
std::string const name
Definition: Process.h:323
Process(std::string name_, MeshLib::Mesh &mesh, std::unique_ptr< AbstractJacobianAssembler > &&jacobian_assembler, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters, unsigned const integration_order, std::vector< std::vector< std::reference_wrapper< ProcessVariable >>> &&process_variables, SecondaryVariableCollection &&secondary_variables, const bool use_monolithic_scheme=true)
Definition: Process.cpp:22
AssemblyParams _assembly_params
Definition: TESProcess.h:95
ProcessLib::TrafoScale Trafo
std::unique_ptr< Adsorption::Reaction > react_sys

References _assembly_params, ProcessLib::TES::AssemblyParams::cpG, ProcessLib::TES::AssemblyParams::cpS, DBUG(), ProcessLib::TES::AssemblyParams::diffusion_coefficient_component, ProcessLib::TES::AssemblyParams::fluid_specific_heat_source, BaseLib::ConfigTree::getConfigParameterOptional(), BaseLib::ConfigTree::getConfigSubtree(), MeshLib::Mesh::getDimension(), INFO(), ProcessLib::TES::AssemblyParams::initial_solid_density, Adsorption::Reaction::newInstance(), ProcessLib::TES::AssemblyParams::output_element_matrices, ProcessLib::TES::AssemblyParams::poro, ProcessLib::TES::AssemblyParams::react_sys, ProcessLib::TES::AssemblyParams::rho_SR_dry, ProcessLib::TES::AssemblyParams::solid_heat_cond, ProcessLib::TES::AssemblyParams::solid_perm_tensor, ProcessLib::TES::AssemblyParams::solid_specific_heat_source, ProcessLib::TES::AssemblyParams::tortuosity, ProcessLib::TES::AssemblyParams::trafo_p, ProcessLib::TES::AssemblyParams::trafo_T, and ProcessLib::TES::AssemblyParams::trafo_x.

Member Function Documentation

◆ assembleConcreteProcess()

void ProcessLib::TES::TESProcess::assembleConcreteProcess ( const double  t,
double const  dt,
std::vector< GlobalVector * > const &  x,
std::vector< GlobalVector * > const &  xdot,
int const  process_id,
GlobalMatrix M,
GlobalMatrix K,
GlobalVector b 
)
overrideprivatevirtual

Implements ProcessLib::Process.

Definition at line 212 of file TESProcess.cpp.

217 {
218  DBUG("Assemble TESProcess.");
219 
220  std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>>
221  dof_table = {std::ref(*_local_to_global_index_map)};
222  ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
223 
224  // Call global assembler for each local assembly item.
227  pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, process_id, M, K,
228  b);
229 }
std::vector< std::size_t > const & getActiveElementIDs() const
std::vector< std::reference_wrapper< ProcessVariable > > const & getProcessVariables(const int process_id) const
Definition: Process.h:145
VectorMatrixAssembler _global_assembler
Definition: Process.h:333
std::unique_ptr< NumLib::LocalToGlobalIndexMap > _local_to_global_index_map
Definition: Process.h:329
std::vector< std::unique_ptr< TESLocalAssemblerInterface > > _local_assemblers
Definition: TESProcess.h:93
void assemble(std::size_t const mesh_item_id, LocalAssemblerInterface &local_assembler, std::vector< std::reference_wrapper< NumLib::LocalToGlobalIndexMap >> const &dof_tables, double const t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &xdot, int const process_id, GlobalMatrix &M, GlobalMatrix &K, GlobalVector &b)
static void executeSelectedMemberDereferenced(Object &object, Method method, Container const &container, std::vector< std::size_t > const &active_container_ids, Args &&... args)

References ProcessLib::Process::_global_assembler, _local_assemblers, ProcessLib::Process::_local_to_global_index_map, ProcessLib::VectorMatrixAssembler::assemble(), DBUG(), NumLib::SerialExecutor::executeSelectedMemberDereferenced(), ProcessLib::ProcessVariable::getActiveElementIDs(), and ProcessLib::Process::getProcessVariables().

◆ assembleWithJacobianConcreteProcess()

void ProcessLib::TES::TESProcess::assembleWithJacobianConcreteProcess ( const double  t,
double const  dt,
std::vector< GlobalVector * > const &  x,
std::vector< GlobalVector * > const &  xdot,
const double  dxdot_dx,
const double  dx_dx,
int const  process_id,
GlobalMatrix M,
GlobalMatrix K,
GlobalVector b,
GlobalMatrix Jac 
)
overrideprivatevirtual

Implements ProcessLib::Process.

Definition at line 231 of file TESProcess.cpp.

236 {
237  std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>>
238  dof_table = {std::ref(*_local_to_global_index_map)};
239  ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
240 
241  // Call global assembler for each local assembly item.
244  _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, xdot,
245  dxdot_dx, dx_dx, process_id, M, K, b, Jac);
246 }
void assembleWithJacobian(std::size_t const mesh_item_id, LocalAssemblerInterface &local_assembler, std::vector< std::reference_wrapper< NumLib::LocalToGlobalIndexMap >> const &dof_tables, const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &xdot, const double dxdot_dx, const double dx_dx, int const process_id, GlobalMatrix &M, GlobalMatrix &K, GlobalVector &b, GlobalMatrix &Jac)

References ProcessLib::Process::_global_assembler, _local_assemblers, ProcessLib::Process::_local_to_global_index_map, ProcessLib::VectorMatrixAssembler::assembleWithJacobian(), NumLib::SerialExecutor::executeSelectedMemberDereferenced(), ProcessLib::ProcessVariable::getActiveElementIDs(), and ProcessLib::Process::getProcessVariables().

◆ computeEquilibriumLoading()

GlobalVector const & ProcessLib::TES::TESProcess::computeEquilibriumLoading ( const double  t,
std::vector< GlobalVector * > const &  x,
std::vector< NumLib::LocalToGlobalIndexMap const * > const &  dof_table,
std::unique_ptr< GlobalVector > &  result_cache 
)
private

Definition at line 396 of file TESProcess.cpp.

401 {
402  constexpr int process_id = 0; // monolithic scheme.
403  assert(dof_table[process_id] == _local_to_global_index_map.get());
404 
405  auto const& dof_table_single = getSingleComponentDOFTable();
407  {dof_table_single.dofSizeWithoutGhosts(),
408  dof_table_single.dofSizeWithoutGhosts(),
409  &dof_table_single.getGhostIndices(), nullptr});
410 
411  GlobalIndexType const nnodes = _mesh.getNumberOfNodes();
412 
413  auto const& x = *xs[0]; // monolithic process
414  for (GlobalIndexType node_id = 0; node_id < nnodes; ++node_id)
415  {
416  auto const p = NumLib::getNodalValue(x, _mesh, *dof_table[process_id],
417  node_id, COMPONENT_ID_PRESSURE);
418  auto const T = NumLib::getNodalValue(x, _mesh, *dof_table[process_id],
419  node_id, COMPONENT_ID_TEMPERATURE);
420  auto const x_mV =
421  NumLib::getNodalValue(x, _mesh, *dof_table[process_id], node_id,
423 
426 
427  auto const p_V = p * x_nV;
428  auto const C_eq =
429  (p_V <= 0.0) ? 0.0
430  : _assembly_params.react_sys->getEquilibriumLoading(
431  p_V, T, _assembly_params.M_react);
432 
433  result_cache->set(node_id, C_eq);
434  }
435 
436  return *result_cache;
437 }
GlobalMatrix::IndexType GlobalIndexType
static double getMolarFraction(double xm, double M_this, double M_other)
Definition: Adsorption.cpp:96
std::size_t getNumberOfNodes() const
Get the number of nodes.
Definition: Mesh.h:89
NumLib::LocalToGlobalIndexMap const & getSingleComponentDOFTable() const
Definition: Process.h:190
MeshLib::Mesh & _mesh
Definition: Process.h:326
double getNodalValue(GlobalVector const &x, MeshLib::Mesh const &mesh, NumLib::LocalToGlobalIndexMap const &dof_table, std::size_t const node_id, std::size_t const global_component_id)
const unsigned COMPONENT_ID_MASS_FRACTION
const unsigned COMPONENT_ID_TEMPERATURE
const unsigned COMPONENT_ID_PRESSURE

References _assembly_params, ProcessLib::Process::_local_to_global_index_map, ProcessLib::Process::_mesh, ProcessLib::TES::COMPONENT_ID_MASS_FRACTION, ProcessLib::TES::COMPONENT_ID_PRESSURE, ProcessLib::TES::COMPONENT_ID_TEMPERATURE, Adsorption::AdsorptionReaction::getMolarFraction(), NumLib::getNodalValue(), MeshLib::Mesh::getNumberOfNodes(), ProcessLib::Process::getSingleComponentDOFTable(), ProcessLib::TES::AssemblyParams::M_inert, ProcessLib::TES::AssemblyParams::M_react, and ProcessLib::TES::AssemblyParams::react_sys.

Referenced by initializeSecondaryVariables().

◆ computeRelativeHumidity()

GlobalVector const & ProcessLib::TES::TESProcess::computeRelativeHumidity ( const double  t,
std::vector< GlobalVector * > const &  x,
std::vector< NumLib::LocalToGlobalIndexMap const * > const &  dof_table,
std::unique_ptr< GlobalVector > &  result_cache 
)
private

Definition at line 356 of file TESProcess.cpp.

361 {
362  constexpr int process_id = 0; // monolithic scheme.
363  assert(dof_table[process_id] == _local_to_global_index_map.get());
364 
365  auto const& dof_table_single = getSingleComponentDOFTable();
367  {dof_table_single.dofSizeWithoutGhosts(),
368  dof_table_single.dofSizeWithoutGhosts(),
369  &dof_table_single.getGhostIndices(), nullptr});
370 
371  GlobalIndexType const nnodes = _mesh.getNumberOfNodes();
372 
373  auto const& x = *xs[0]; // monolithic process
374  for (GlobalIndexType node_id = 0; node_id < nnodes; ++node_id)
375  {
376  auto const p = NumLib::getNodalValue(x, _mesh, *dof_table[process_id],
377  node_id, COMPONENT_ID_PRESSURE);
378  auto const T = NumLib::getNodalValue(x, _mesh, *dof_table[process_id],
379  node_id, COMPONENT_ID_TEMPERATURE);
380  auto const x_mV =
381  NumLib::getNodalValue(x, _mesh, *dof_table[process_id], node_id,
383 
386 
387  auto const p_S =
389 
390  result_cache->set(node_id, p * x_nV / p_S);
391  }
392 
393  return *result_cache;
394 }
static double getEquilibriumVapourPressure(const double T_Ads)
Definition: Adsorption.cpp:40

References _assembly_params, ProcessLib::Process::_local_to_global_index_map, ProcessLib::Process::_mesh, ProcessLib::TES::COMPONENT_ID_MASS_FRACTION, ProcessLib::TES::COMPONENT_ID_PRESSURE, ProcessLib::TES::COMPONENT_ID_TEMPERATURE, Adsorption::AdsorptionReaction::getEquilibriumVapourPressure(), Adsorption::AdsorptionReaction::getMolarFraction(), NumLib::getNodalValue(), MeshLib::Mesh::getNumberOfNodes(), ProcessLib::Process::getSingleComponentDOFTable(), ProcessLib::TES::AssemblyParams::M_inert, and ProcessLib::TES::AssemblyParams::M_react.

Referenced by initializeSecondaryVariables().

◆ computeVapourPartialPressure()

GlobalVector const & ProcessLib::TES::TESProcess::computeVapourPartialPressure ( const double  t,
std::vector< GlobalVector * > const &  x,
std::vector< NumLib::LocalToGlobalIndexMap const * > const &  dof_table,
std::unique_ptr< GlobalVector > &  result_cache 
)
private

Definition at line 321 of file TESProcess.cpp.

326 {
327  constexpr int process_id = 0; // monolithic scheme.
328  assert(dof_table[process_id] == _local_to_global_index_map.get());
329 
330  auto const& dof_table_single = getSingleComponentDOFTable();
332  {dof_table_single.dofSizeWithoutGhosts(),
333  dof_table_single.dofSizeWithoutGhosts(),
334  &dof_table_single.getGhostIndices(), nullptr});
335 
336  GlobalIndexType const nnodes = _mesh.getNumberOfNodes();
337 
338  for (GlobalIndexType node_id = 0; node_id < nnodes; ++node_id)
339  {
340  auto const p =
341  NumLib::getNodalValue(*x[process_id], _mesh, *dof_table[process_id],
342  node_id, COMPONENT_ID_PRESSURE);
343  auto const x_mV =
344  NumLib::getNodalValue(*x[process_id], _mesh, *dof_table[process_id],
345  node_id, COMPONENT_ID_MASS_FRACTION);
346 
349 
350  result_cache->set(node_id, p * x_nV);
351  }
352 
353  return *result_cache;
354 }

References _assembly_params, ProcessLib::Process::_local_to_global_index_map, ProcessLib::Process::_mesh, ProcessLib::TES::COMPONENT_ID_MASS_FRACTION, ProcessLib::TES::COMPONENT_ID_PRESSURE, Adsorption::AdsorptionReaction::getMolarFraction(), NumLib::getNodalValue(), MeshLib::Mesh::getNumberOfNodes(), ProcessLib::Process::getSingleComponentDOFTable(), ProcessLib::TES::AssemblyParams::M_inert, and ProcessLib::TES::AssemblyParams::M_react.

Referenced by initializeSecondaryVariables().

◆ initializeConcreteProcess()

void ProcessLib::TES::TESProcess::initializeConcreteProcess ( NumLib::LocalToGlobalIndexMap const &  dof_table,
MeshLib::Mesh const &  mesh,
unsigned const  integration_order 
)
overrideprivatevirtual

Process specific initialization called by initialize().

Implements ProcessLib::Process.

Definition at line 140 of file TESProcess.cpp.

143 {
144  const int monolithic_process_id = 0;
145  ProcessLib::ProcessVariable const& pv =
146  getProcessVariables(monolithic_process_id)[0];
147  ProcessLib::createLocalAssemblers<TESLocalAssembler>(
148  mesh.getDimension(), mesh.getElements(), dof_table,
150  mesh.isAxiallySymmetric(), integration_order, _assembly_params);
151 
153 }
unsigned getShapeFunctionOrder() const

References _assembly_params, _local_assemblers, MeshLib::Mesh::getDimension(), MeshLib::Mesh::getElements(), ProcessLib::Process::getProcessVariables(), ProcessLib::ProcessVariable::getShapeFunctionOrder(), initializeSecondaryVariables(), and MeshLib::Mesh::isAxiallySymmetric().

◆ initializeSecondaryVariables()

void ProcessLib::TES::TESProcess::initializeSecondaryVariables ( )
private

Definition at line 155 of file TESProcess.cpp.

156 {
157  // adds a secondary variables to the collection of all secondary variables.
158  auto add2nd =
159  [&](std::string const& var_name, SecondaryVariableFunctions&& fcts)
160  { _secondary_variables.addSecondaryVariable(var_name, std::move(fcts)); };
161 
162  // creates an extrapolator
163  auto makeEx =
164  [&](unsigned const n_components,
165  std::vector<double> const& (TESLocalAssemblerInterface::*method)(
166  const double /*t*/,
167  std::vector<GlobalVector*> const& /*x*/,
168  std::vector<
169  NumLib::LocalToGlobalIndexMap const*> const& /*dof_table*/,
170  std::vector<double>& /*cache*/)
171  const) -> SecondaryVariableFunctions
172  {
173  return ProcessLib::makeExtrapolator(n_components, getExtrapolator(),
174  _local_assemblers, method);
175  };
176 
177  add2nd("solid_density",
179 
180  add2nd("reaction_rate",
182 
183  add2nd("darcy_velocity",
184  makeEx(_mesh.getDimension(),
186 
187  add2nd("loading", makeEx(1, &TESLocalAssemblerInterface::getIntPtLoading));
188  add2nd(
189  "reaction_damping_factor",
191 
192  add2nd("vapour_partial_pressure",
193  {1,
194  [&](auto&&... args) -> GlobalVector const& {
195  return computeVapourPartialPressure(args...);
196  },
197  nullptr});
198  add2nd("relative_humidity",
199  {1,
200  [&](auto&&... args) -> GlobalVector const& {
201  return computeRelativeHumidity(args...);
202  },
203  nullptr});
204  add2nd("equilibrium_loading",
205  {1,
206  [&](auto&&... args) -> GlobalVector const& {
207  return computeEquilibriumLoading(args...);
208  },
209  nullptr});
210 }
Global vector based on Eigen vector.
Definition: EigenVector.h:26
NumLib::Extrapolator & getExtrapolator() const
Definition: Process.h:185
SecondaryVariableCollection _secondary_variables
Definition: Process.h:331
void addSecondaryVariable(std::string const &internal_name, SecondaryVariableFunctions &&fcts)
virtual std::vector< double > const & getIntPtLoading(const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::vector< double > &cache) const =0
virtual std::vector< double > const & getIntPtDarcyVelocity(const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::vector< double > &cache) const =0
virtual std::vector< double > const & getIntPtReactionRate(const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::vector< double > &cache) const =0
virtual std::vector< double > const & getIntPtReactionDampingFactor(const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::vector< double > &cache) const =0
virtual std::vector< double > const & getIntPtSolidDensity(const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::vector< double > &cache) const =0
GlobalVector const & computeRelativeHumidity(const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::unique_ptr< GlobalVector > &result_cache)
Definition: TESProcess.cpp:356
GlobalVector const & computeEquilibriumLoading(const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::unique_ptr< GlobalVector > &result_cache)
Definition: TESProcess.cpp:396
GlobalVector const & computeVapourPartialPressure(const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::unique_ptr< GlobalVector > &result_cache)
Definition: TESProcess.cpp:321
SecondaryVariableFunctions makeExtrapolator(const unsigned num_components, NumLib::Extrapolator &extrapolator, LocalAssemblerCollection const &local_assemblers, typename NumLib::ExtrapolatableLocalAssemblerCollection< LocalAssemblerCollection >::IntegrationPointValuesMethod integration_point_values_method)

References _local_assemblers, ProcessLib::Process::_mesh, ProcessLib::Process::_secondary_variables, ProcessLib::SecondaryVariableCollection::addSecondaryVariable(), computeEquilibriumLoading(), computeRelativeHumidity(), computeVapourPartialPressure(), MeshLib::Mesh::getDimension(), ProcessLib::Process::getExtrapolator(), ProcessLib::TES::TESLocalAssemblerInterface::getIntPtDarcyVelocity(), ProcessLib::TES::TESLocalAssemblerInterface::getIntPtLoading(), ProcessLib::TES::TESLocalAssemblerInterface::getIntPtReactionDampingFactor(), ProcessLib::TES::TESLocalAssemblerInterface::getIntPtReactionRate(), ProcessLib::TES::TESLocalAssemblerInterface::getIntPtSolidDensity(), and ProcessLib::makeExtrapolator().

Referenced by initializeConcreteProcess().

◆ isLinear()

bool ProcessLib::TES::TESProcess::isLinear ( ) const
inlineoverride

Definition at line 54 of file TESProcess.h.

54 { return false; }

◆ postIterationConcreteProcess()

NumLib::IterationResult ProcessLib::TES::TESProcess::postIterationConcreteProcess ( GlobalVector const &  x)
overridevirtual

Reimplemented from ProcessLib::Process.

Definition at line 271 of file TESProcess.cpp.

273 {
274  bool check_passed = true;
275 
276  if (!Trafo::constrained)
277  {
278  // bounds checking only has to happen if the vapour mass fraction is
279  // non-logarithmic.
280 
281  std::vector<GlobalIndexType> indices_cache;
282  std::vector<double> local_x_cache;
283  std::vector<double> local_x_prev_ts_cache;
284 
286 
287  auto check_variable_bounds =
288  [&](std::size_t id, TESLocalAssemblerInterface& loc_asm)
289  {
290  auto const r_c_indices = NumLib::getRowColumnIndices(
291  id, *this->_local_to_global_index_map, indices_cache);
292  local_x_cache = x.get(r_c_indices.rows);
293  local_x_prev_ts_cache = _x_previous_timestep->get(r_c_indices.rows);
294 
295  if (!loc_asm.checkBounds(local_x_cache, local_x_prev_ts_cache))
296  {
297  check_passed = false;
298  }
299  };
300 
301  GlobalExecutor::executeDereferenced(check_variable_bounds,
303  }
304 
305  if (!check_passed)
306  {
308  }
309 
310  // TODO remove
311  DBUG("ts {:d} iteration {:d} (in current ts: {:d}) try {:d} accepted",
315 
317 
319 }
std::unique_ptr< GlobalVector > _x_previous_timestep
Definition: TESProcess.h:98
void setLocalAccessibleVector(PETScVector const &x)
Definition: LinAlg.cpp:27
NumLib::LocalToGlobalIndexMap::RowColumnIndices getRowColumnIndices(std::size_t const id, NumLib::LocalToGlobalIndexMap const &dof_table, std::vector< GlobalIndexType > &indices)
static void executeDereferenced(F const &f, C const &c, Args_ &&... args)
std::size_t timestep
Output global matrix/rhs after first iteration.

References _assembly_params, _local_assemblers, ProcessLib::Process::_local_to_global_index_map, _x_previous_timestep, ProcessLib::TrafoScale::constrained, DBUG(), NumLib::SerialExecutor::executeDereferenced(), MathLib::EigenVector::get(), NumLib::getRowColumnIndices(), ProcessLib::TES::AssemblyParams::iteration_in_current_timestep, ProcessLib::TES::AssemblyParams::number_of_try_of_iteration, NumLib::REPEAT_ITERATION, MathLib::LinAlg::setLocalAccessibleVector(), NumLib::SUCCESS, ProcessLib::TES::AssemblyParams::timestep, and ProcessLib::TES::AssemblyParams::total_iteration.

◆ preIterationConcreteProcess()

void ProcessLib::TES::TESProcess::preIterationConcreteProcess ( const unsigned  iter,
GlobalVector const &  x 
)
overridevirtual

◆ preTimestepConcreteProcess()

void ProcessLib::TES::TESProcess::preTimestepConcreteProcess ( std::vector< GlobalVector * > const &  x,
const double  t,
const double  delta_t,
const int  process_id 
)
overridevirtual

Member Data Documentation

◆ _assembly_params

◆ _local_assemblers

std::vector<std::unique_ptr<TESLocalAssemblerInterface> > ProcessLib::TES::TESProcess::_local_assemblers
private

◆ _x_previous_timestep

std::unique_ptr<GlobalVector> ProcessLib::TES::TESProcess::_x_previous_timestep
private

Definition at line 98 of file TESProcess.h.

Referenced by postIterationConcreteProcess(), and preTimestepConcreteProcess().


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