OGS
ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim > Class Template Reference

Detailed Description

template<typename ShapeFunction, int DisplacementDim>
class ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >

Definition at line 106 of file HMPhaseFieldFEM.h.

#include <HMPhaseFieldFEM.h>

Inheritance diagram for ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >:
[legend]
Collaboration diagram for ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >:
[legend]

Public Types

using ShapeMatricesType
using ShapeMatrices = typename ShapeMatricesType::ShapeMatrices
using BMatricesType = BMatrixPolicyType<ShapeFunction, DisplacementDim>
using NodalForceVectorType = typename BMatricesType::NodalForceVectorType
using GlobalDimVectorType = typename ShapeMatricesType::GlobalDimVectorType
using DeformationVector
using DeformationMatrix
using PhaseFieldVector
using PhaseFieldMatrix
using PressureVector
using PressureMatrix
using NodalMatrixType = typename ShapeMatricesType::NodalMatrixType
using NodalVectorType = typename ShapeMatricesType::NodalVectorType
using IpData
using Invariants = MathLib::KelvinVector::Invariants<KelvinVectorSize>

Public Member Functions

 HMPhaseFieldLocalAssembler (HMPhaseFieldLocalAssembler const &)=delete
 HMPhaseFieldLocalAssembler (HMPhaseFieldLocalAssembler &&)=delete
 HMPhaseFieldLocalAssembler (MeshLib::Element const &e, std::size_t const, NumLib::GenericIntegrationMethod const &integration_method, bool const is_axially_symmetric, HMPhaseFieldProcessData< DisplacementDim > &process_data)
void assembleWithJacobianForStaggeredScheme (double const t, double const dt, Eigen::VectorXd const &local_x, Eigen::VectorXd const &local_x_prev, int const process_id, std::vector< double > &local_b_data, std::vector< double > &local_Jac_data) override
void initializeConcrete () override
void postTimestepConcrete (Eigen::VectorXd const &, Eigen::VectorXd const &, double const, double const, int const) override
void postNonLinearSolverConcrete (Eigen::VectorXd const &local_x, Eigen::VectorXd const &local_x_prev, double const t, double const dt, int const process_id) override
void approximateFractureWidth (std::size_t mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, std::vector< GlobalVector * > const &x, double const t, double const dt) override
void computeEnergy (std::size_t mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, std::vector< GlobalVector * > const &x, double const t, double &elastic_energy, double &surface_energy, double &pressure_work) override
double heaviside (double const v)
Eigen::Map< const Eigen::RowVectorXd > getShapeMatrix (const unsigned integration_point) const override
 Provides the shape matrix at the given integration point.
std::vector< double > const & getIntPtWidth (const double, std::vector< GlobalVector * > const &, std::vector< NumLib::LocalToGlobalIndexMap const * > const &, std::vector< double > &cache) const override
Public Member Functions inherited from ProcessLib::LocalAssemblerInterface
virtual ~LocalAssemblerInterface ()=default
virtual void setInitialConditions (std::size_t const mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, std::vector< GlobalVector * > const &x, double const t, int const process_id)
virtual void initialize (std::size_t const mesh_item_id, NumLib::LocalToGlobalIndexMap const &dof_table)
virtual void preAssemble (double const, double const, std::vector< double > const &)
virtual void assemble (double const t, double const dt, std::vector< double > const &local_x, std::vector< double > const &local_x_prev, std::vector< double > &local_M_data, std::vector< double > &local_K_data, std::vector< double > &local_b_data)
virtual void assembleForStaggeredScheme (double const t, double const dt, Eigen::VectorXd const &local_x, Eigen::VectorXd const &local_x_prev, int const process_id, std::vector< double > &local_M_data, std::vector< double > &local_K_data, std::vector< double > &local_b_data)
virtual void assembleWithJacobian (double const t, double const dt, std::vector< double > const &local_x, std::vector< double > const &local_x_prev, std::vector< double > &local_b_data, std::vector< double > &local_Jac_data)
virtual void computeSecondaryVariable (std::size_t const mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, double const t, double const dt, std::vector< GlobalVector * > const &x, GlobalVector const &x_prev, 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 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)
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 Eigen::Vector3d getFlux (MathLib::Point3d const &, double const, std::vector< double > const &) const
virtual Eigen::Vector3d getFlux (MathLib::Point3d const &, double const, std::vector< std::vector< double > > const &) const
 Fits to staggered scheme.
virtual int getNumberOfVectorElementsForDeformation () const
Public Member Functions inherited from NumLib::ExtrapolatableElement
virtual ~ExtrapolatableElement ()=default

Static Public Attributes

static int const KelvinVectorSize
static constexpr auto & N_u_op

Private Member Functions

std::vector< double > const & getIntPtSigma (const double, std::vector< GlobalVector * > const &, std::vector< NumLib::LocalToGlobalIndexMap const * > const &, std::vector< double > &cache) const override
std::vector< double > const & getIntPtEpsilon (const double, std::vector< GlobalVector * > const &, std::vector< NumLib::LocalToGlobalIndexMap const * > const &, std::vector< double > &cache) const override
void assembleWithJacobianHydroEquations (const double t, double const dt, Eigen::VectorXd const &local_x, Eigen::VectorXd const &local_x_prev, std::vector< double > &local_b_data, std::vector< double > &local_Jac_data)
void assembleWithJacobianPhaseFieldEquations (double const t, double const dt, Eigen::VectorXd const &local_x, std::vector< double > &local_b_data, std::vector< double > &local_Jac_data)
void assembleWithJacobianForDeformationEquations (double const t, double const dt, Eigen::VectorXd const &local_x, std::vector< double > &local_b_data, std::vector< double > &local_Jac_data)

Private Attributes

HMPhaseFieldProcessData< DisplacementDim > & _process_data
std::vector< IpData, Eigen::aligned_allocator< IpData > > _ip_data
NumLib::GenericIntegrationMethod const & _integration_method
MeshLib::Element const & _element
SecondaryData< typename ShapeMatrices::ShapeType > _secondary_data
bool const _is_axially_symmetric

Static Private Attributes

static constexpr int phasefield_index = 0
static constexpr int phasefield_size = ShapeFunction::NPOINTS
static constexpr int pressure_index = phasefield_index + phasefield_size
static constexpr int pressure_size = ShapeFunction::NPOINTS
static constexpr int displacement_index = pressure_index + pressure_size
static constexpr int displacement_size

Member Typedef Documentation

◆ BMatricesType

template<typename ShapeFunction, int DisplacementDim>
using ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::BMatricesType = BMatrixPolicyType<ShapeFunction, DisplacementDim>

Definition at line 123 of file HMPhaseFieldFEM.h.

◆ DeformationMatrix

template<typename ShapeFunction, int DisplacementDim>
using ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::DeformationMatrix
Initial value:
typename ShapeMatricesType::template MatrixType<displacement_size,

Definition at line 131 of file HMPhaseFieldFEM.h.

◆ DeformationVector

template<typename ShapeFunction, int DisplacementDim>
using ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::DeformationVector
Initial value:
typename ShapeMatricesType::template VectorType<displacement_size>

Definition at line 129 of file HMPhaseFieldFEM.h.

◆ GlobalDimVectorType

template<typename ShapeFunction, int DisplacementDim>
using ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::GlobalDimVectorType = typename ShapeMatricesType::GlobalDimVectorType

Definition at line 127 of file HMPhaseFieldFEM.h.

◆ Invariants

template<typename ShapeFunction, int DisplacementDim>
using ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::Invariants = MathLib::KelvinVector::Invariants<KelvinVectorSize>

Definition at line 156 of file HMPhaseFieldFEM.h.

◆ IpData

◆ NodalForceVectorType

template<typename ShapeFunction, int DisplacementDim>
using ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::NodalForceVectorType = typename BMatricesType::NodalForceVectorType

Definition at line 125 of file HMPhaseFieldFEM.h.

◆ NodalMatrixType

template<typename ShapeFunction, int DisplacementDim>
using ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::NodalMatrixType = typename ShapeMatricesType::NodalMatrixType

Definition at line 145 of file HMPhaseFieldFEM.h.

◆ NodalVectorType

template<typename ShapeFunction, int DisplacementDim>
using ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::NodalVectorType = typename ShapeMatricesType::NodalVectorType

Definition at line 146 of file HMPhaseFieldFEM.h.

◆ PhaseFieldMatrix

template<typename ShapeFunction, int DisplacementDim>
using ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::PhaseFieldMatrix
Initial value:
typename ShapeMatricesType::template MatrixType<phasefield_size,

Definition at line 136 of file HMPhaseFieldFEM.h.

◆ PhaseFieldVector

template<typename ShapeFunction, int DisplacementDim>
using ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::PhaseFieldVector
Initial value:
typename ShapeMatricesType::template VectorType<phasefield_size>

Definition at line 134 of file HMPhaseFieldFEM.h.

◆ PressureMatrix

template<typename ShapeFunction, int DisplacementDim>
using ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::PressureMatrix
Initial value:
typename ShapeMatricesType::template MatrixType<pressure_size,

Definition at line 141 of file HMPhaseFieldFEM.h.

◆ PressureVector

template<typename ShapeFunction, int DisplacementDim>
using ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::PressureVector
Initial value:
typename ShapeMatricesType::template VectorType<pressure_size>

Definition at line 139 of file HMPhaseFieldFEM.h.

◆ ShapeMatrices

template<typename ShapeFunction, int DisplacementDim>
using ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::ShapeMatrices = typename ShapeMatricesType::ShapeMatrices

Definition at line 121 of file HMPhaseFieldFEM.h.

◆ ShapeMatricesType

template<typename ShapeFunction, int DisplacementDim>
using ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::ShapeMatricesType
Initial value:
EigenFixedShapeMatrixPolicy< ShapeFunction, GlobalDim > ShapeMatrixPolicyType

Definition at line 118 of file HMPhaseFieldFEM.h.

Constructor & Destructor Documentation

◆ HMPhaseFieldLocalAssembler() [1/3]

template<typename ShapeFunction, int DisplacementDim>
ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::HMPhaseFieldLocalAssembler ( HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim > const & )
delete

◆ HMPhaseFieldLocalAssembler() [2/3]

template<typename ShapeFunction, int DisplacementDim>
ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::HMPhaseFieldLocalAssembler ( HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim > && )
delete

◆ HMPhaseFieldLocalAssembler() [3/3]

template<typename ShapeFunction, int DisplacementDim>
ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::HMPhaseFieldLocalAssembler ( MeshLib::Element const & e,
std::size_t const ,
NumLib::GenericIntegrationMethod const & integration_method,
bool const is_axially_symmetric,
HMPhaseFieldProcessData< DisplacementDim > & process_data )
inline

Definition at line 161 of file HMPhaseFieldFEM.h.

169 _element(e),
171 {
172 unsigned const n_integration_points =
173 _integration_method.getNumberOfPoints();
174
177
178 auto& solid_material =
180 _process_data.solid_materials,
181 _process_data.material_ids,
182 e.getID());
183
184 auto const shape_matrices =
188
190 x_position.setElementID(_element.getID());
191
192 for (unsigned ip = 0; ip < n_integration_points; ip++)
193 {
194 _ip_data.emplace_back(solid_material);
195 auto& ip_data = _ip_data[ip];
196 ip_data.integration_weight =
197 _integration_method.getWeightedPoint(ip).getWeight() *
198 shape_matrices[ip].integralMeasure * shape_matrices[ip].detJ;
199
200 static const int kelvin_vector_size =
203 ip_data.eps_tensile.setZero(kelvin_vector_size);
204 ip_data.eps.setZero(kelvin_vector_size);
205 ip_data.eps_prev.resize(kelvin_vector_size);
208 ip_data.C_compressive.setZero(kelvin_vector_size,
210
211 ip_data.sigma_tensile.setZero(kelvin_vector_size);
212 ip_data.sigma_compressive.setZero(kelvin_vector_size);
213 ip_data.sigma.setZero(kelvin_vector_size);
214 ip_data.strain_energy_tensile = 0.0;
215 ip_data.elastic_energy = 0.0;
216 ip_data.width_ip = 0.0;
217
219 ip_data.dNdx = shape_matrices[ip].dNdx;
220
222 }
223 }
std::vector< IpData, Eigen::aligned_allocator< IpData > > _ip_data
HMPhaseFieldProcessData< DisplacementDim > & _process_data
ShapeMatrixPolicyType< ShapeFunction, DisplacementDim > ShapeMatricesType
NumLib::GenericIntegrationMethod const & _integration_method
SecondaryData< typename ShapeMatrices::ShapeType > _secondary_data
auto & selectSolidConstitutiveRelation(SolidMaterialsMap const &constitutive_relations, MeshLib::PropertyVector< int > const *const material_ids, std::size_t const element_id)
constexpr int kelvin_vector_dimensions(int const displacement_dim)
Kelvin vector dimensions for given displacement dimension.

References _element, _integration_method, _ip_data, _is_axially_symmetric, _process_data, _secondary_data, MeshLib::Element::getID(), NumLib::initShapeMatrices(), MathLib::KelvinVector::kelvin_vector_dimensions(), MaterialLib::Solids::selectSolidConstitutiveRelation(), and ParameterLib::SpatialPosition::setElementID().

Member Function Documentation

◆ approximateFractureWidth()

template<typename ShapeFunction, int DisplacementDim>
void ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::approximateFractureWidth ( std::size_t mesh_item_id,
std::vector< NumLib::LocalToGlobalIndexMap const * > const & dof_tables,
std::vector< GlobalVector * > const & x,
double const t,
double const dt )
overridevirtual

Implements ProcessLib::HMPhaseField::HMPhaseFieldLocalAssemblerInterface.

Definition at line 450 of file HMPhaseFieldFEM-impl.h.

456{
458 indices_of_processes.reserve(dof_tables.size());
459 std::transform(dof_tables.begin(), dof_tables.end(),
461 [&](auto const dof_table)
462 { return NumLib::getIndices(mesh_item_id, *dof_table); });
463
465 assert(local_coupled_xs.size() ==
467
470
472 x_position.setElementID(_element.getID());
473
474 double const ele_d = std::clamp(d.sum() / d.size(), 0.0, 1.0);
475 (*_process_data.ele_d)[_element.getID()] = ele_d;
476
477 if ((*_process_data.ele_d)[_element.getID()] <
478 _process_data.irreversible_threshold)
479 {
480 double const width_init = _process_data.width_init(t, x_position)[0];
481 double const k = _process_data.residual_stiffness(t, x_position)[0];
482 double const ls = _process_data.crack_length_scale(t, x_position)[0];
483 double const he = ls / _process_data.diffused_range_parameter;
484
485 int const n_integration_points =
486 _integration_method.getNumberOfPoints();
487 double width = 0.0;
488 for (int ip = 0; ip < n_integration_points; ip++)
489 {
490 auto eps_tensor =
494 double const max_principal_strain =
495 eigen_solver.eigenvalues().real().maxCoeff(&maxIndex);
496 auto const max_eigen_vector =
497 eigen_solver.eigenvectors().real().col(maxIndex);
498
499 // Fracture aperture estimation
500 auto& width_ip = _ip_data[ip].width_ip;
503 width += width_ip;
504
505 // Fracture direction estimation
506 auto& normal_ip = _ip_data[ip].normal_ip;
508 {
509 for (int i = 0; i < DisplacementDim; i++)
510 {
512 }
513 }
514
515 // Fracture enhanced porosity
517 _ip_data[ip].fracture_enhanced_porosity;
519 }
520
521 // Update aperture for the fractured element
522 (*_process_data.width)[_element.getID()] = width / n_integration_points;
523 }
524}
Eigen::Matrix< double, 3, 3 > kelvinVectorToTensor(Eigen::Matrix< double, 4, 1, Eigen::ColMajor, 4, 1 > const &v)
std::vector< double > getCoupledLocalSolutions(std::vector< GlobalVector * > const &global_solutions, std::vector< std::vector< GlobalIndexType > > const &indices)

References _element, _integration_method, _ip_data, _process_data, displacement_size, ProcessLib::getCoupledLocalSolutions(), MathLib::KelvinVector::kelvinVectorToTensor(), phasefield_index, phasefield_size, pressure_size, and ParameterLib::SpatialPosition::setElementID().

◆ assembleWithJacobianForDeformationEquations()

template<typename ShapeFunction, int DisplacementDim>
void ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::assembleWithJacobianForDeformationEquations ( double const t,
double const dt,
Eigen::VectorXd const & local_x,
std::vector< double > & local_b_data,
std::vector< double > & local_Jac_data )
private

Definition at line 54 of file HMPhaseFieldFEM-impl.h.

58{
60 auto const u =
62 auto const p = local_x.template segment<pressure_size>(pressure_index);
63
66
69
70 auto const& medium = _process_data.media_map.getMedium(_element.getID());
71 auto const& solid = medium->phase("Solid");
72 auto const& fluid = fluidPhase(*medium);
74
75 auto const& identity2 = Invariants::identity2;
76
77 int const n_integration_points = _integration_method.getNumberOfPoints();
78 for (int ip = 0; ip < n_integration_points; ip++)
79 {
80 auto const& w = _ip_data[ip].integration_weight;
81 auto const& N = _ip_data[ip].N;
82 auto const& dNdx = _ip_data[ip].dNdx;
83 double const d_ip = N.dot(d);
84 double const p_ip = N.dot(p);
85
87 std::nullopt, this->_element.getID(),
90 this->_element, N))};
91
92 auto const x_coord =
93 x_position.getCoordinates().value()[0]; // r for axisymmetry
94
95 auto const& B =
100
101 auto& eps = _ip_data[ip].eps;
102 eps.noalias() = B * u;
103
104 double const k = _process_data.residual_stiffness(t, x_position)[0];
105 double const ls = _process_data.crack_length_scale(t, x_position)[0];
106
107 double const degradation =
108 _process_data.degradation_derivative->degradation(d_ip, k, ls);
109 _ip_data[ip].updateConstitutiveRelation(
111 _process_data.energy_split_model);
112
113 auto const& sigma = _ip_data[ip].sigma;
114 auto const& D = _ip_data[ip].D;
115
116 auto& biot_coefficient = _ip_data[ip].biot_coefficient;
117 auto& biot_modulus_inv = _ip_data[ip].biot_modulus_inv;
118 auto const& fracture_enhanced_porosity =
119 _ip_data[ip].fracture_enhanced_porosity;
120
121 // Update the effective bulk modulus
123 auto const D_sph = P_sph * D * identity2;
124 double const bulk_modulus_eff = Invariants::trace(D_sph) / 9.;
125
126 auto const& solid_material =
128 _process_data.solid_materials, _process_data.material_ids,
129 _element.getID());
130 auto const bulk_modulus = solid_material.getBulkModulus(t, x_position);
131 auto const alpha_0 =
133 .template value<double>(vars, x_position, t, dt);
134 auto const porosity_0 =
136 .template value<double>(vars, x_position, t, dt);
138
139 // Update Biot's coefficient
141
142 // The reference porosity
144
145 // Update Biot's modulus
147 (1. - alpha_0) / bulk_modulus;
148
149 auto const rho_sr =
151 .template value<double>(vars, x_position, t, dt);
152 auto const rho_fr =
154 .template value<double>(vars, x_position, t, dt);
155
156 auto const rho =
158 auto const& b = _process_data.specific_body_force;
159
160 local_rhs.noalias() -=
161 (B.transpose() * (sigma - biot_coefficient * p_ip * identity2) -
162 N_u_op(N).transpose() * rho * b) *
163 w;
164 local_Jac.noalias() += B.transpose() * D * B * w;
165 }
166}
MatrixType< _kelvin_vector_size, _number_of_dof > BMatrixType
Eigen::Map< Vector > createZeroedVector(std::vector< double > &data, Eigen::VectorXd::Index size)
Eigen::Map< Matrix > createZeroedMatrix(std::vector< double > &data, Eigen::MatrixXd::Index rows, Eigen::MatrixXd::Index cols)
static Eigen::Matrix< double, KelvinVectorSize, KelvinVectorSize > const spherical_projection
static Eigen::Matrix< double, KelvinVectorSize, 1 > const identity2
Kelvin mapping of 2nd order identity tensor.
static double trace(Eigen::Matrix< double, KelvinVectorSize, 1 > const &v)
Trace of the corresponding tensor.

References _element, _integration_method, _ip_data, _is_axially_symmetric, _process_data, MaterialPropertyLib::biot_coefficient, ProcessLib::LinearBMatrix::computeBMatrix(), MathLib::createZeroedMatrix(), MathLib::createZeroedVector(), MaterialPropertyLib::density, displacement_index, displacement_size, ParameterLib::SpatialPosition::getCoordinates(), MathLib::KelvinVector::Invariants< KelvinVectorSize >::identity2, NumLib::interpolateCoordinates(), N_u_op, phasefield_index, MaterialPropertyLib::porosity, pressure_index, MaterialLib::Solids::selectSolidConstitutiveRelation(), MathLib::KelvinVector::Invariants< KelvinVectorSize >::spherical_projection, and MathLib::KelvinVector::Invariants< KelvinVectorSize >::trace().

Referenced by assembleWithJacobianForStaggeredScheme().

◆ assembleWithJacobianForStaggeredScheme()

template<typename ShapeFunction, int DisplacementDim>
void ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::assembleWithJacobianForStaggeredScheme ( double const t,
double const dt,
Eigen::VectorXd const & local_x,
Eigen::VectorXd const & local_x_prev,
int const process_id,
std::vector< double > & local_b_data,
std::vector< double > & local_Jac_data )
overridevirtual

Reimplemented from ProcessLib::LocalAssemblerInterface.

Definition at line 24 of file HMPhaseFieldFEM-impl.h.

31{
32 // For the equations with phase field.
33 if (process_id == _process_data._phasefield_process_id)
34 {
37 return;
38 }
39
40 // For the equations for hydro
41 if (process_id == _process_data._hydro_process_id)
42 {
45 return;
46 }
47
48 // For the equations with deformation
51}
void assembleWithJacobianPhaseFieldEquations(double const t, double const dt, Eigen::VectorXd const &local_x, std::vector< double > &local_b_data, std::vector< double > &local_Jac_data)
void assembleWithJacobianHydroEquations(const double t, double const dt, Eigen::VectorXd const &local_x, Eigen::VectorXd const &local_x_prev, std::vector< double > &local_b_data, std::vector< double > &local_Jac_data)
void assembleWithJacobianForDeformationEquations(double const t, double const dt, Eigen::VectorXd const &local_x, std::vector< double > &local_b_data, std::vector< double > &local_Jac_data)

References _process_data, assembleWithJacobianForDeformationEquations(), assembleWithJacobianHydroEquations(), and assembleWithJacobianPhaseFieldEquations().

◆ assembleWithJacobianHydroEquations()

template<typename ShapeFunction, int DisplacementDim>
void ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::assembleWithJacobianHydroEquations ( const double t,
double const dt,
Eigen::VectorXd const & local_x,
Eigen::VectorXd const & local_x_prev,
std::vector< double > & local_b_data,
std::vector< double > & local_Jac_data )
private

Definition at line 169 of file HMPhaseFieldFEM-impl.h.

175{
176 auto const d = local_x.template segment<phasefield_size>(phasefield_index);
177
178 auto const p = local_x.template segment<pressure_size>(pressure_index);
179 auto const p_prev =
181
184
187
190
193
196
198 x_position.setElementID(_element.getID());
199
200 auto const& medium = _process_data.media_map.getMedium(_element.getID());
201 auto const& fluid = fluidPhase(*medium);
203
206 auto const& identity2 = Invariants::identity2;
207 auto const& ones2 = Invariants::ones2;
208
209 double const k = _process_data.residual_stiffness(t, x_position)[0];
210 double const ls = _process_data.crack_length_scale(t, x_position)[0];
211 double const width = (*_process_data.width)[_element.getID()];
212 double const fracture_threshold = _process_data.fracture_threshold;
214 _process_data.fracture_permeability_parameter;
216 _process_data.fixed_stress_stabilization_parameter;
218 _process_data.spatial_stabilization_parameter;
219 auto const he =
220 ls / _process_data.diffused_range_parameter; // element size
221
222 int const n_integration_points = _integration_method.getNumberOfPoints();
223 for (int ip = 0; ip < n_integration_points; ip++)
224 {
225 auto const& w = _ip_data[ip].integration_weight;
226 auto const& N = _ip_data[ip].N;
227 auto const& dNdx = _ip_data[ip].dNdx;
228 double const d_ip = N.dot(d);
229
230 auto const rho_fr =
232 .template value<double>(vars, x_position, t, dt);
233 double const cf = _process_data.fluid_compressibility;
234 auto const Km = medium->property(MPL::PropertyType::permeability)
235 .template value<double>(vars, x_position, t, dt);
237 auto const mu = fluid.property(MPL::PropertyType::viscosity)
238 .template value<double>(vars, x_position, t, dt);
239
242 auto const& biot_coefficient = _ip_data[ip].biot_coefficient;
243 auto const& biot_modulus_inv = _ip_data[ip].biot_modulus_inv;
244 auto const& fracture_enhanced_porosity =
245 _ip_data[ip].fracture_enhanced_porosity;
246
247 // The reference porosity
248 auto const porosity_0 =
250 .template value<double>(vars, x_position, t, dt);
252
253 double const dv_dt = (vol_strain - vol_strain_prev) / dt;
254
255 // The degraded shear modulus
256 auto const& D = _ip_data[ip].D;
257 auto const D_sph = P_sph * D * identity2;
258 auto const D_dev = P_dev * D * (ones2 - identity2) / std::sqrt(2.);
259 auto const degraded_shear_modulus =
262
263 double const residual_bulk_modulus = [&]
264 {
265 if ((*_process_data.ele_d)[_element.getID()] <
266 _process_data.fracture_threshold)
267 {
268 // The residual bulk modulus in the fractured element
269 double const degradation_threshold =
270 _process_data.degradation_derivative->degradation(
272 auto const& D_threshold =
273 degradation_threshold * _ip_data[ip].C_tensile +
274 _ip_data[ip].C_compressive;
276
278 }
280 }();
281
285
286 double const stablization_spatial =
289 stabilizing.noalias() +=
290 dNdx.transpose() * stablization_spatial * dNdx * w;
291
292 mass.noalias() +=
294 N.transpose() * N * w;
295
296 auto const K_over_mu = K / mu;
297 laplace.noalias() += dNdx.transpose() * K_over_mu * dNdx * w;
298 auto const& b = _process_data.specific_body_force;
299
300 // bodyforce-driven Darcy flow
301 local_rhs.noalias() += dNdx.transpose() * rho_fr * K_over_mu * b * w;
302
303 local_rhs.noalias() -= (biot_coefficient * dv_dt -
304 modulus_rm * _ip_data[ip].coupling_pressure) *
305 N.transpose() * w;
306
307 if ((*_process_data.ele_d)[_element.getID()] <
308 _process_data.irreversible_threshold)
309 {
310 // Fracture-enhanced permeability
311 auto const& normal_ip = _ip_data[ip].normal_ip;
312 auto const Kf =
314 width * width / he / 12.0 *
317 normal_ip * normal_ip.transpose());
318 laplace.noalias() += dNdx.transpose() * Kf / mu * dNdx * w;
319 }
320 }
321 local_Jac.noalias() = laplace + mass / dt + stabilizing / dt;
322
323 local_rhs.noalias() -= laplace * p + mass * (p - p_prev) / dt +
324 stabilizing * (p - p_prev) / dt;
325}
constexpr Eigen::Matrix< double, GlobalDim, GlobalDim > formEigenTensor(MaterialPropertyLib::PropertyDataType const &values)
MatrixType< ShapeFunction::NPOINTS, ShapeFunction::NPOINTS > NodalMatrixType
static double FrobeniusNorm(Eigen::Matrix< double, KelvinVectorSize, 1 > const &deviatoric_v)
Get the norm of the deviatoric stress.
static Eigen::Matrix< double, KelvinVectorSize, KelvinVectorSize > const deviatoric_projection
static Eigen::Matrix< double, KelvinVectorSize, 1 > const ones2

References _element, _integration_method, _ip_data, _process_data, MathLib::createZeroedMatrix(), MathLib::createZeroedVector(), MaterialPropertyLib::density, MathLib::KelvinVector::Invariants< KelvinVectorSize >::deviatoric_projection, MaterialPropertyLib::formEigenTensor(), MathLib::KelvinVector::Invariants< KelvinVectorSize >::FrobeniusNorm(), MathLib::KelvinVector::Invariants< KelvinVectorSize >::identity2, MathLib::KelvinVector::Invariants< KelvinVectorSize >::ones2, MaterialPropertyLib::permeability, phasefield_index, MaterialPropertyLib::porosity, pressure_index, pressure_size, ParameterLib::SpatialPosition::setElementID(), MathLib::KelvinVector::Invariants< KelvinVectorSize >::spherical_projection, MathLib::KelvinVector::Invariants< KelvinVectorSize >::trace(), and MaterialPropertyLib::viscosity.

Referenced by assembleWithJacobianForStaggeredScheme().

◆ assembleWithJacobianPhaseFieldEquations()

template<typename ShapeFunction, int DisplacementDim>
void ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::assembleWithJacobianPhaseFieldEquations ( double const t,
double const dt,
Eigen::VectorXd const & local_x,
std::vector< double > & local_b_data,
std::vector< double > & local_Jac_data )
private

Definition at line 328 of file HMPhaseFieldFEM-impl.h.

333{
334 auto const d = local_x.template segment<phasefield_size>(phasefield_index);
335 auto const p = local_x.template segment<pressure_size>(pressure_index);
336 auto const u =
338
343
345 x_position.setElementID(_element.getID());
346
347 auto const& solid_material =
349 _process_data.solid_materials, _process_data.material_ids,
350 _element.getID());
351
352 auto const bulk_modulus = solid_material.getBulkModulus(t, x_position);
353 auto const& medium = _process_data.media_map.getMedium(_element.getID());
354 auto const& solid = medium->phase("Solid");
356
357 double const k = _process_data.residual_stiffness(t, x_position)[0];
358 double const ls = _process_data.crack_length_scale(t, x_position)[0];
359 double const gc = _process_data.crack_resistance(t, x_position)[0];
360
361 auto const& identity2 = Invariants::identity2;
362
363 int const n_integration_points = _integration_method.getNumberOfPoints();
364 for (int ip = 0; ip < n_integration_points; ip++)
365 {
366 auto const& w = _ip_data[ip].integration_weight;
367 auto const& N = _ip_data[ip].N;
368 auto const& dNdx = _ip_data[ip].dNdx;
369
370 double const d_ip = N.dot(d);
371 double const p_ip = N.dot(p);
372 double const degradation =
373 _process_data.degradation_derivative->degradation(d_ip, k, ls);
374 double const degradation_df1 =
375 _process_data.degradation_derivative->degradationDf1(d_ip, k, ls);
376 double const degradation_df2 =
377 _process_data.degradation_derivative->degradationDf2(d_ip, k, ls);
378
379 _ip_data[ip].updateConstitutiveRelation(
381 _process_data.energy_split_model);
382
383 auto& biot_coefficient = _ip_data[ip].biot_coefficient;
384 auto& biot_modulus_inv = _ip_data[ip].biot_modulus_inv;
385
386 auto const alpha_0 =
388 .template value<double>(vars, x_position, t, dt);
389 auto const porosity_0 =
391 .template value<double>(vars, x_position, t, dt);
392
393 auto const& D = _ip_data[ip].D;
395 auto const D_sph = P_sph * D * identity2;
396 double const bulk_modulus_eff = Invariants::trace(D_sph) / 9.;
398
399 // Update Biot's coefficient
401
402 // Update Biot's modulus
404 (1. - alpha_0) / bulk_modulus;
405
406 auto const& strain_energy_tensile = _ip_data[ip].strain_energy_tensile;
407 auto const& C_tensile = _ip_data[ip].C_tensile;
408 auto const C_tensile_sph = P_sph * C_tensile * identity2;
410
411 auto const driven_energy =
412 N.transpose() *
415 (1. - alpha_0) / bulk_modulus) *
416 w;
417
418 local_Jac.noalias() += driven_energy * N * degradation_df2;
419
421
423 decltype(dNdx), decltype(N), decltype(w), decltype(d),
424 decltype(local_Jac), decltype(local_rhs)>(
425 dNdx, N, w, d, local_Jac, local_rhs, gc, ls,
426 _process_data.phasefield_model);
427 }
428}

References _element, _integration_method, _ip_data, _process_data, MaterialPropertyLib::biot_coefficient, MathLib::createZeroedMatrix(), MathLib::createZeroedVector(), displacement_index, MathLib::KelvinVector::Invariants< KelvinVectorSize >::identity2, phasefield_index, phasefield_size, MaterialPropertyLib::porosity, pressure_index, MaterialLib::Solids::selectSolidConstitutiveRelation(), ParameterLib::SpatialPosition::setElementID(), MathLib::KelvinVector::Invariants< KelvinVectorSize >::spherical_projection, and MathLib::KelvinVector::Invariants< KelvinVectorSize >::trace().

Referenced by assembleWithJacobianForStaggeredScheme().

◆ computeEnergy()

template<typename ShapeFunction, int DisplacementDim>
void ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::computeEnergy ( std::size_t mesh_item_id,
std::vector< NumLib::LocalToGlobalIndexMap const * > const & dof_tables,
std::vector< GlobalVector * > const & x,
double const t,
double & elastic_energy,
double & surface_energy,
double & pressure_work )
overridevirtual

Implements ProcessLib::HMPhaseField::HMPhaseFieldLocalAssemblerInterface.

Definition at line 527 of file HMPhaseFieldFEM-impl.h.

532{
534 indices_of_processes.reserve(dof_tables.size());
535 std::transform(dof_tables.begin(), dof_tables.end(),
537 [&](auto const dof_table)
538 { return NumLib::getIndices(mesh_item_id, *dof_table); });
539
540 auto const local_coupled_xs =
542 assert(local_coupled_xs.size() ==
544
551
553 x_position.setElementID(_element.getID());
554
555 double element_elastic_energy = 0.0;
556 double element_surface_energy = 0.0;
557 double element_pressure_work = 0.0;
558
559 double const gc = _process_data.crack_resistance(t, x_position)[0];
560 double const ls = _process_data.crack_length_scale(t, x_position)[0];
561 int const n_integration_points = _integration_method.getNumberOfPoints();
562 for (int ip = 0; ip < n_integration_points; ip++)
563 {
564 auto const& w = _ip_data[ip].integration_weight;
565 auto const& N = _ip_data[ip].N;
566 auto const& dNdx = _ip_data[ip].dNdx;
567 double const d_ip = N.dot(d);
568 double const p_ip = N.dot(p);
569
570 element_elastic_energy += _ip_data[ip].elastic_energy * w;
571
572 switch (_process_data.phasefield_model)
573 {
575 {
577 gc * 0.375 *
578 ((1 - d_ip) / ls + (dNdx * d).dot((dNdx * d)) * ls) * w;
579
580 break;
581 }
583 {
584 element_surface_energy += 0.5 * gc *
585 ((1 - d_ip) * (1 - d_ip) / ls +
586 (dNdx * d).dot((dNdx * d)) * ls) *
587 w;
588 break;
589 }
591 {
594 ((1 - d_ip * d_ip) / ls + (dNdx * d).dot((dNdx * d)) * ls) *
595 w;
596 break;
597 }
598 }
599
600 element_pressure_work += p_ip * (N_u_op(N) * u).dot(dNdx * d) * w;
601 }
602
603#ifdef USE_PETSC
604 int const n_all_nodes = indices_of_processes[1].size();
605 int const n_regular_nodes = std::count_if(
607 [](GlobalIndexType const& index) { return index >= 0; });
609 {
611 static_cast<double>(n_regular_nodes) / n_all_nodes;
613 static_cast<double>(n_regular_nodes) / n_all_nodes;
615 static_cast<double>(n_regular_nodes) / n_all_nodes;
616 }
617#endif // USE_PETSC
621}

References _element, _integration_method, _ip_data, _process_data, MaterialLib::Solids::Phasefield::AT1, MaterialLib::Solids::Phasefield::AT2, MaterialLib::Solids::Phasefield::COHESIVE, displacement_index, displacement_size, ProcessLib::getCoupledLocalSolutions(), N_u_op, phasefield_index, phasefield_size, pressure_index, pressure_size, and ParameterLib::SpatialPosition::setElementID().

◆ getIntPtEpsilon()

template<typename ShapeFunction, int DisplacementDim>
std::vector< double > const & ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::getIntPtEpsilon ( const double ,
std::vector< GlobalVector * > const & ,
std::vector< NumLib::LocalToGlobalIndexMap const * > const & ,
std::vector< double > & cache ) const
inlineoverrideprivatevirtual

◆ getIntPtSigma()

template<typename ShapeFunction, int DisplacementDim>
std::vector< double > const & ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::getIntPtSigma ( const double ,
std::vector< GlobalVector * > const & ,
std::vector< NumLib::LocalToGlobalIndexMap const * > const & ,
std::vector< double > & cache ) const
inlineoverrideprivatevirtual

◆ getIntPtWidth()

template<typename ShapeFunction, int DisplacementDim>
std::vector< double > const & ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::getIntPtWidth ( const double ,
std::vector< GlobalVector * > const & ,
std::vector< NumLib::LocalToGlobalIndexMap const * > const & ,
std::vector< double > & cache ) const
overridevirtual

◆ getShapeMatrix()

template<typename ShapeFunction, int DisplacementDim>
Eigen::Map< const Eigen::RowVectorXd > ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::getShapeMatrix ( const unsigned integration_point) const
inlineoverridevirtual

Provides the shape matrix at the given integration point.

Implements NumLib::ExtrapolatableElement.

Definition at line 289 of file HMPhaseFieldFEM.h.

291 {
292 auto const& N = _secondary_data.N[integration_point];
293
294 // assumes N is stored contiguously in memory
295 return Eigen::Map<const Eigen::RowVectorXd>(N.data(), N.size());
296 }

References _secondary_data.

◆ heaviside()

template<typename ShapeFunction, int DisplacementDim>
double ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::heaviside ( double const v)
inline

Definition at line 287 of file HMPhaseFieldFEM.h.

287{ return (v < 0) ? 0.0 : 1.0; }

◆ initializeConcrete()

template<typename ShapeFunction, int DisplacementDim>
void ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::initializeConcrete ( )
inlineoverridevirtual

Reimplemented from ProcessLib::LocalAssemblerInterface.

Definition at line 231 of file HMPhaseFieldFEM.h.

232 {
233 unsigned const n_integration_points =
234 _integration_method.getNumberOfPoints();
235
236 for (unsigned ip = 0; ip < n_integration_points; ip++)
237 {
238 _ip_data[ip].pushBackState();
239
240 // Specify the direction of preexisting fracture if it exists. The
241 // default value is zero.
242 auto& normal_ip = _ip_data[ip].normal_ip;
243 auto const fracture_normal =
244 _process_data.specific_fracture_direction;
246 }
247 // Specify the aperture of preexisting fractures if they exist. The
248 // default value is zero.
250 x_position.setElementID(_element.getID());
251 auto const width_init = _process_data.width_init(0, x_position)[0];
252 (*_process_data.width)[_element.getID()] = width_init;
253 }

References _element, _integration_method, _ip_data, _process_data, and ParameterLib::SpatialPosition::setElementID().

◆ postNonLinearSolverConcrete()

template<typename ShapeFunction, int DisplacementDim>
void ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::postNonLinearSolverConcrete ( Eigen::VectorXd const & local_x,
Eigen::VectorXd const & local_x_prev,
double const t,
double const dt,
int const process_id )
overridevirtual

Reimplemented from ProcessLib::LocalAssemblerInterface.

Definition at line 431 of file HMPhaseFieldFEM-impl.h.

436{
437 int const n_integration_points = _integration_method.getNumberOfPoints();
438 auto const p = local_x.template segment<pressure_size>(pressure_index);
439 auto const p_prev =
441
442 for (int ip = 0; ip < n_integration_points; ip++)
443 {
444 auto const& N = _ip_data[ip].N;
445 _ip_data[ip].coupling_pressure = N.dot(p - p_prev) / dt;
446 }
447}

References _integration_method, _ip_data, and pressure_index.

◆ postTimestepConcrete()

template<typename ShapeFunction, int DisplacementDim>
void ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::postTimestepConcrete ( Eigen::VectorXd const & ,
Eigen::VectorXd const & ,
double const ,
double const ,
int const  )
inlineoverridevirtual

Reimplemented from ProcessLib::LocalAssemblerInterface.

Definition at line 255 of file HMPhaseFieldFEM.h.

259 {
260 unsigned const n_integration_points =
261 _integration_method.getNumberOfPoints();
262
263 for (unsigned ip = 0; ip < n_integration_points; ip++)
264 {
265 _ip_data[ip].pushBackState();
266 }
267 }

References _integration_method, and _ip_data.

Member Data Documentation

◆ _element

◆ _integration_method

◆ _ip_data

◆ _is_axially_symmetric

template<typename ShapeFunction, int DisplacementDim>
bool const ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::_is_axially_symmetric
private

◆ _process_data

◆ _secondary_data

template<typename ShapeFunction, int DisplacementDim>
SecondaryData<typename ShapeMatrices::ShapeType> ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::_secondary_data
private

Definition at line 344 of file HMPhaseFieldFEM.h.

Referenced by HMPhaseFieldLocalAssembler(), and getShapeMatrix().

◆ displacement_index

template<typename ShapeFunction, int DisplacementDim>
int ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::displacement_index = pressure_index + pressure_size
staticconstexprprivate

◆ displacement_size

template<typename ShapeFunction, int DisplacementDim>
int ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::displacement_size
staticconstexprprivate
Initial value:
=
ShapeFunction::NPOINTS * DisplacementDim

Definition at line 114 of file HMPhaseFieldFEM.h.

Referenced by approximateFractureWidth(), assembleWithJacobianForDeformationEquations(), and computeEnergy().

◆ KelvinVectorSize

template<typename ShapeFunction, int DisplacementDim>
int const ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::KelvinVectorSize
static
Initial value:

Definition at line 150 of file HMPhaseFieldFEM.h.

◆ N_u_op

template<typename ShapeFunction, int DisplacementDim>
auto& ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::N_u_op
staticconstexpr
Initial value:
DisplacementDim, typename ShapeMatricesType::NodalRowVectorType>
constexpr Eigen::CwiseNullaryOp< EigenBlockMatrixViewFunctor< D, M >, typename EigenBlockMatrixViewFunctor< D, M >::Matrix > eigenBlockMatrixView(const Eigen::MatrixBase< M > &matrix)
RowVectorType< ShapeFunction::NPOINTS > NodalRowVectorType

Definition at line 153 of file HMPhaseFieldFEM.h.

Referenced by assembleWithJacobianForDeformationEquations(), and computeEnergy().

◆ phasefield_index

◆ phasefield_size

template<typename ShapeFunction, int DisplacementDim>
int ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::phasefield_size = ShapeFunction::NPOINTS
staticconstexprprivate

◆ pressure_index

◆ pressure_size

template<typename ShapeFunction, int DisplacementDim>
int ProcessLib::HMPhaseField::HMPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::pressure_size = ShapeFunction::NPOINTS
staticconstexprprivate

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