23 std::unique_ptr<AbstractJacobianAssembler>&& jacobian_assembler,
24 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters,
25 unsigned const integration_order,
26 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>&&
30 :
Process(std::move(name), mesh, std::move(jacobian_assembler), parameters,
31 integration_order, std::move(process_variables),
32 std::move(secondary_variables))
34 DBUG(
"Create TESProcess.");
38 std::vector<std::pair<std::string, double*>> params{
40 {
"fluid_specific_heat_source",
45 {
"solid_specific_heat_source",
54 {
"diffusion_coefficient",
63 for (
auto const& p : params)
69 DBUG(
"setting parameter `{:s}' to value `{:g}'", p.first, *par);
77 std::vector<std::pair<std::string, Trafo*>>
const params{
85 for (
auto const& p : params)
91 INFO(
"setting parameter `{:s}' to value `{:g}'", p.first, *par);
92 *p.second =
Trafo{*par};
101 "solid_hydraulic_permeability"))
104 "setting parameter `solid_hydraulic_permeability' to isotropic "
109 Eigen::MatrixXd::Identity(dim, dim) * (*par);
118 if (
auto const param =
122 DBUG(
"output_element_matrices: {:s}", (*param) ?
"true" :
"false");
131 config.getConfigParameterOptional<bool>("output_global_matrix"))
133 DBUG("output_global_matrix: {:s}", (*param) ? "true" : "false");
135 this->_process_output.output_global_matrix = *param;
142 unsigned const integration_order)
144 ProcessLib::createLocalAssemblers<TESLocalAssembler>(
161 [&](
unsigned const n_components,
164 std::vector<GlobalVector*>
const& ,
167 std::vector<double>& )
174 add2nd(
"solid_density",
177 add2nd(
"reaction_rate",
180 add2nd(
"darcy_velocity",
186 "reaction_damping_factor",
189 add2nd(
"vapour_partial_pressure",
194 add2nd(
"relative_humidity",
199 add2nd(
"equilibrium_loading",
207 const double t,
double const dt, std::vector<GlobalVector*>
const& x,
208 std::vector<GlobalVector*>
const& x_prev,
int const process_id,
211 DBUG(
"Assemble TESProcess.");
213 std::vector<NumLib::LocalToGlobalIndexMap const*> dof_table = {
224 const double t,
double const dt, std::vector<GlobalVector*>
const& x,
225 std::vector<GlobalVector*>
const& x_prev,
int const process_id,
228 std::vector<NumLib::LocalToGlobalIndexMap const*> dof_table = {
235 process_id, &b, &Jac);
240 const double delta_t,
241 const int process_id)
243 DBUG(
"new timestep");
264 bool check_passed =
true;
271 std::vector<GlobalIndexType> indices_cache;
272 std::vector<double> local_x_cache;
273 std::vector<double> local_x_prev_ts_cache;
277 auto check_variable_bounds =
282 local_x_cache = x.
get(r_c_indices.rows);
285 if (!loc_asm.checkBounds(local_x_cache, local_x_prev_ts_cache))
287 check_passed =
false;
301 DBUG(
"ts {:d} iteration {:d} (in current ts: {:d}) try {:d} accepted",
313 std::vector<GlobalVector*>
const& x,
314 std::vector<NumLib::LocalToGlobalIndexMap const*>
const& dof_table,
315 std::unique_ptr<GlobalVector>& result_cache)
317 constexpr int process_id = 0;
322 {dof_table_single.dofSizeWithoutGhosts(),
323 dof_table_single.dofSizeWithoutGhosts(),
324 &dof_table_single.getGhostIndices(),
nullptr});
340 result_cache->set(node_id, p * x_nV);
343 return *result_cache;
348 std::vector<GlobalVector*>
const& xs,
349 std::vector<NumLib::LocalToGlobalIndexMap const*>
const& dof_table,
350 std::unique_ptr<GlobalVector>& result_cache)
352 constexpr int process_id = 0;
357 {dof_table_single.dofSizeWithoutGhosts(),
358 dof_table_single.dofSizeWithoutGhosts(),
359 &dof_table_single.getGhostIndices(),
nullptr});
363 auto const& x = *xs[0];
380 result_cache->set(node_id, p * x_nV / p_S);
383 return *result_cache;
388 std::vector<GlobalVector*>
const& xs,
389 std::vector<NumLib::LocalToGlobalIndexMap const*>
const& dof_table,
390 std::unique_ptr<GlobalVector>& result_cache)
392 constexpr int process_id = 0;
397 {dof_table_single.dofSizeWithoutGhosts(),
398 dof_table_single.dofSizeWithoutGhosts(),
399 &dof_table_single.getGhostIndices(),
nullptr});
403 auto const& x = *xs[0];
417 auto const p_V = p * x_nV;
423 result_cache->set(node_id, C_eq);
426 return *result_cache;
GlobalMatrix::IndexType GlobalIndexType
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
static double getMolarFraction(double xm, double M_this, double M_other)
static double getEquilibriumVapourPressure(const double T_Ads)
static std::unique_ptr< Reaction > newInstance(BaseLib::ConfigTree const &conf)
std::optional< T > getConfigParameterOptional(std::string const ¶m) const
ConfigTree getConfigSubtree(std::string const &root) const
Global vector based on Eigen vector.
double get(IndexType rowId) const
get entry
bool isAxiallySymmetric() const
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
std::size_t getNumberOfNodes() const
Get the number of nodes.
std::vector< std::size_t > const & getActiveElementIDs() const
NumLib::LocalToGlobalIndexMap const & getSingleComponentDOFTable() const
SecondaryVariableCollection _secondary_variables
VectorMatrixAssembler _global_assembler
std::unique_ptr< NumLib::LocalToGlobalIndexMap > _local_to_global_index_map
NumLib::Extrapolator & getExtrapolator() const
Handles configuration of several secondary variables from the project file.
void addSecondaryVariable(std::string const &internal_name, SecondaryVariableFunctions &&fcts)
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
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 & 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 & 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
std::vector< std::unique_ptr< TESLocalAssemblerInterface > > _local_assemblers
TESProcess(std::string name, MeshLib::Mesh &mesh, std::unique_ptr< AbstractJacobianAssembler > &&jacobian_assembler, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const ¶meters, unsigned const integration_order, std::vector< std::vector< std::reference_wrapper< ProcessVariable > > > &&process_variables, SecondaryVariableCollection &&secondary_variables, BaseLib::ConfigTree const &config)
void initializeSecondaryVariables()
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)
void preTimestepConcreteProcess(std::vector< GlobalVector * > const &x, const double t, const double delta_t, const int process_id) override
NumLib::IterationResult postIterationConcreteProcess(GlobalVector const &x) override
std::unique_ptr< GlobalVector > _x_previous_timestep
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)
void assembleConcreteProcess(const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, int const process_id, GlobalMatrix &M, GlobalMatrix &K, GlobalVector &b) override
void assembleWithJacobianConcreteProcess(const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, int const process_id, 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)
void initializeConcreteProcess(NumLib::LocalToGlobalIndexMap const &dof_table, MeshLib::Mesh const &mesh, unsigned const integration_order) override
Process specific initialization called by initialize().
void preIterationConcreteProcess(const unsigned iter, GlobalVector const &x) override
AssemblyParams _assembly_params
void assemble(std::size_t const mesh_item_id, LocalAssemblerInterface &local_assembler, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, double const t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, int const process_id, GlobalMatrix *M, GlobalMatrix *K, GlobalVector *b)
void assembleWithJacobian(std::size_t const mesh_item_id, LocalAssemblerInterface &local_assembler, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, int const process_id, GlobalVector *b, GlobalMatrix *Jac)
IterationResult
Status flags telling the NonlinearSolver if an iteration succeeded.
void setLocalAccessibleVector(PETScVector const &x)
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)
NumLib::LocalToGlobalIndexMap::RowColumnIndices getRowColumnIndices(std::size_t const id, NumLib::LocalToGlobalIndexMap const &dof_table, std::vector< GlobalIndexType > &indices)
const unsigned COMPONENT_ID_MASS_FRACTION
const unsigned COMPONENT_ID_TEMPERATURE
const unsigned COMPONENT_ID_PRESSURE
SecondaryVariableFunctions makeExtrapolator(const unsigned num_components, NumLib::Extrapolator &extrapolator, LocalAssemblerCollection const &local_assemblers, typename NumLib::ExtrapolatableLocalAssemblerCollection< LocalAssemblerCollection >::IntegrationPointValuesMethod integration_point_values_method)
static void executeSelectedMemberDereferenced(Object &object, Method method, Container const &container, std::vector< std::size_t > const &active_container_ids, Args &&... args)
static void executeDereferenced(F const &f, C const &c, Args_ &&... args)
std::size_t timestep
Output global matrix/rhs after first iteration.
bool output_element_matrices
double diffusion_coefficient_component
unsigned number_of_try_of_iteration
Eigen::MatrixXd solid_perm_tensor
double solid_specific_heat_source
std::size_t total_iteration
std::unique_ptr< Adsorption::Reaction > react_sys
double fluid_specific_heat_source
unsigned iteration_in_current_timestep
double initial_solid_density
static const bool constrained