23namespace ThermoMechanicalPhaseField
25template <
int DisplacementDim>
30 std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&&
32 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const&
34 unsigned const integration_order,
35 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>&&
39 int const mechanics_related_process_id,
40 int const phase_field_process_id,
41 int const heat_conduction_process_id)
42 :
Process(std::move(name), mesh, std::move(jacobian_assembler), parameters,
43 integration_order, std::move(process_variables),
44 std::move(secondary_variables), false),
45 _process_data(std::move(process_data)),
46 _mechanics_related_process_id(mechanics_related_process_id),
47 _phase_field_process_id(phase_field_process_id),
48 _heat_conduction_process_id(heat_conduction_process_id)
52template <
int DisplacementDim>
58template <
int DisplacementDim>
61 const int process_id)
const
63 if (process_id == _mechanics_related_process_id)
65 auto const& l = *_local_to_global_index_map;
66 return {l.dofSizeWithoutGhosts(), l.dofSizeWithoutGhosts(),
67 &l.getGhostIndices(), &this->_sparsity_pattern};
71 auto const& l = *_local_to_global_index_map_single_component;
72 return {l.dofSizeWithoutGhosts(), l.dofSizeWithoutGhosts(),
73 &l.getGhostIndices(), &_sparsity_pattern_with_single_component};
76template <
int DisplacementDim>
79 const int process_id)
const
81 if (process_id == _mechanics_related_process_id)
83 return *_local_to_global_index_map;
87 return *_local_to_global_index_map_single_component;
90template <
int DisplacementDim>
93 const int process_id)
const
95 if (process_id == _mechanics_related_process_id)
97 return *_local_to_global_index_map;
101 return *_local_to_global_index_map_single_component;
104template <
int DisplacementDim>
108 constructDofTableOfSpecifiedProcessStaggeredScheme(
109 _mechanics_related_process_id);
113 std::vector<MeshLib::MeshSubset> all_mesh_subsets_single_component{
114 *_mesh_subset_all_nodes};
115 _local_to_global_index_map_single_component =
116 std::make_unique<NumLib::LocalToGlobalIndexMap>(
117 std::move(all_mesh_subsets_single_component),
121 assert(_local_to_global_index_map_single_component);
125 *_local_to_global_index_map_single_component, _mesh);
128template <
int DisplacementDim>
132 unsigned const integration_order)
138 _process_data, _mechanics_related_process_id, _phase_field_process_id,
139 _heat_conduction_process_id);
141 _secondary_variables.addSecondaryVariable(
145 DisplacementDim>::RowsAtCompileTime,
146 getExtrapolator(), _local_assemblers,
149 _secondary_variables.addSecondaryVariable(
152 DisplacementDim>::RowsAtCompileTime,
153 getExtrapolator(), _local_assemblers,
157 _secondary_variables.addSecondaryVariable(
167 *_local_to_global_index_map);
170template <
int DisplacementDim>
173 std::map<
int, std::shared_ptr<MaterialPropertyLib::Medium>>
const&
178 initializeProcessBoundaryConditionsAndSourceTerms(
179 getDOFTableByProcessID(_mechanics_related_process_id),
180 _mechanics_related_process_id, media);
182 initializeProcessBoundaryConditionsAndSourceTerms(
183 getDOFTableByProcessID(_phase_field_process_id),
184 _phase_field_process_id, media);
186 initializeProcessBoundaryConditionsAndSourceTerms(
187 getDOFTableByProcessID(_heat_conduction_process_id),
188 _heat_conduction_process_id, media);
191template <
int DisplacementDim>
194 std::vector<GlobalVector*>
const& x,
195 std::vector<GlobalVector*>
const& x_prev,
199 DBUG(
"Assemble the equations for ThermoMechanicalPhaseFieldProcess.");
201 std::vector<NumLib::LocalToGlobalIndexMap const*> dof_table = {
202 _local_to_global_index_map.get()};
207 getActiveElementIDs(), dof_table, t, dt, x, x_prev, process_id, &M, &K,
211template <
int DisplacementDim>
214 const double t,
double const dt, std::vector<GlobalVector*>
const& x,
215 std::vector<GlobalVector*>
const& x_prev,
int const process_id,
219 if (process_id == _mechanics_related_process_id)
222 "Assemble the Jacobian equations of "
223 "temperature-deformation in ThermoMechanicalPhaseFieldProcess for "
224 "the staggered scheme.");
227 if (process_id == _phase_field_process_id)
230 "Assemble the Jacobian equations ofphase field in "
231 "ThermoMechanicalPhaseFieldProcess for the staggered scheme.");
236 "Assemble the Jacobian equations of heat conduction in "
237 "ThermoMechanicalPhaseFieldProcess for the staggered scheme.");
240 std::vector<NumLib::LocalToGlobalIndexMap const*> dof_tables;
241 dof_tables.emplace_back(
242 &getDOFTableByProcessID(_heat_conduction_process_id));
243 dof_tables.emplace_back(
244 &getDOFTableByProcessID(_mechanics_related_process_id));
245 dof_tables.emplace_back(&getDOFTableByProcessID(_phase_field_process_id));
249 _local_assemblers, getActiveElementIDs(), dof_tables, t, dt, x, x_prev,
250 process_id, &b, &Jac);
253template <
int DisplacementDim>
258 const int process_id)
260 DBUG(
"PreTimestep ThermoMechanicalPhaseFieldProcess.");
262 if (process_id != _mechanics_related_process_id)
269 _local_assemblers, getActiveElementIDs(), getDOFTable(process_id),
270 *x[process_id], t, dt);
273template <
int DisplacementDim>
276 std::vector<GlobalVector*>
const& x_prev,
279 int const process_id)
286 DBUG(
"PostTimestep ThermoMechanicalPhaseFieldProcess.");
290 _local_assemblers, getActiveElementIDs(), getDOFTables(x.size()), x,
291 x_prev, t, dt, process_id);
294template <
int DisplacementDim>
297 std::vector<GlobalVector*>
const& x_prev,
298 const double t,
double const dt,
299 const int process_id)
301 if (process_id != _mechanics_related_process_id)
306 DBUG(
"PostNonLinearSolver ThermoMechanicalPhaseFieldProcess.");
311 getActiveElementIDs(), getDOFTables(x.size()), x, x_prev, t, dt,
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Global vector based on Eigen vector.
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).
void postNonLinearSolver(std::size_t const mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, double const t, double const dt, int const process_id)
virtual void postTimestep(std::size_t const mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, double const t, double const dt, int const process_id)
virtual void preTimestep(std::size_t const mesh_item_id, NumLib::LocalToGlobalIndexMap const &dof_table, GlobalVector const &x, double const t, double const delta_t)
virtual void initialize(std::size_t const mesh_item_id, NumLib::LocalToGlobalIndexMap const &dof_table)
Handles configuration of several secondary variables from the project file.
A class to simulate thermo-mechanical fracturing process using phase-field approach in solids describ...
NumLib::LocalToGlobalIndexMap const & getDOFTable(const int process_id) const 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
void preTimestepConcreteProcess(std::vector< GlobalVector * > const &x, double const t, double const dt, const int process_id) override
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
MathLib::MatrixSpecifications getMatrixSpecifications(const int process_id) const override
NumLib::LocalToGlobalIndexMap & getDOFTableByProcessID(const int process_id) const
void constructDofTable() override
void postNonLinearSolverConcreteProcess(std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, const double t, double const dt, int const process_id) override
void initializeBoundaryConditions(std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media) override
bool isLinear() const override
ThermoMechanicalPhaseFieldProcess(std::string name, MeshLib::Mesh &mesh, std::unique_ptr< ProcessLib::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, ThermoMechanicalPhaseFieldProcessData< DisplacementDim > &&process_data, SecondaryVariableCollection &&secondary_variables, int const mechanics_related_process_id, int const phase_field_process_id, int const heat_conduction_process_id)
void postTimestepConcreteProcess(std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, double const t, double const dt, int const process_id) override
void initializeConcreteProcess(NumLib::LocalToGlobalIndexMap const &dof_table, MeshLib::Mesh const &mesh, unsigned const integration_order) override
Process specific initialization called by initialize().
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)
Eigen::Matrix< double, kelvin_vector_dimensions(DisplacementDim), 1, Eigen::ColMajor > KelvinVectorType
@ BY_LOCATION
Ordering data by spatial location.
GlobalSparsityPattern computeSparsityPattern(LocalToGlobalIndexMap const &dof_table, MeshLib::Mesh const &mesh)
Computes a sparsity pattern for the given inputs.
SecondaryVariableFunctions makeExtrapolator(const unsigned num_components, NumLib::Extrapolator &extrapolator, LocalAssemblerCollection const &local_assemblers, typename NumLib::ExtrapolatableLocalAssemblerCollection< LocalAssemblerCollection >::IntegrationPointValuesMethod integration_point_values_method)
static void executeSelectedMemberOnDereferenced(Method method, Container const &container, std::vector< std::size_t > const &active_container_ids, Args &&... args)
static void executeSelectedMemberDereferenced(Object &object, Method method, Container const &container, std::vector< std::size_t > const &active_container_ids, Args &&... args)
static void executeMemberOnDereferenced(Method method, Container const &container, Args &&... args)
virtual std::vector< double > const & getIntPtSigma(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 & getIntPtHeatFlux(const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::vector< double > &cache) const =0