Flow123d
master-9c1c1b8e5
|
Go to the documentation of this file.
18 #ifndef ASSEMBLY_ELASTICITY_HH_
19 #define ASSEMBLY_ELASTICITY_HH_
34 template <
unsigned int dim>
41 static constexpr
const char *
name() {
return "StiffnessAssemblyElasticity"; }
63 shared_ptr<FE_P<dim>> fe_p = std::make_shared< FE_P<dim> >(1);
64 shared_ptr<
FE_P<dim-1>> fe_p_low = std::make_shared<
FE_P<dim-1> >(1);
65 fe_ = std::make_shared<FESystem<dim>>(fe_p,
FEVector, 3);
83 for (
uint m=0; m<2; ++m) {
85 for (
uint n=0; n<2; ++n)
97 if (cell.
dim() != dim)
return;
105 for (
unsigned int i=0; i<
n_dofs_; i++)
106 for (
unsigned int j=0; j<
n_dofs_; j++)
110 for (
auto p : this->
bulk_points(element_patch_idx) )
112 for (
unsigned int i=0; i<
n_dofs_; i++)
114 for (
unsigned int j=0; j<
n_dofs_; j++)
128 ASSERT_EQ(cell_side.
dim(), dim).error(
"Dimension of element mismatch!");
136 for (
unsigned int i=0; i<
n_dofs_; i++)
137 for (
unsigned int j=0; j<
n_dofs_; j++)
143 double side_measure = cell_side.
measure();
148 for (
unsigned int i=0; i<
n_dofs_; i++)
149 for (
unsigned int j=0; j<
n_dofs_; j++)
159 for (
unsigned int i=0; i<
n_dofs_; i++)
160 for (
unsigned int j=0; j<
n_dofs_; j++)
174 if (dim == 1)
return;
175 ASSERT_EQ(cell_lower_dim.
dim(), dim-1).error(
"Dimension of element mismatch!");
186 bool own_element_id[2];
187 own_element_id[0] = cell_lower_dim.
is_own();
188 own_element_id[1] = cell_higher_dim.
is_own();
190 for (
unsigned int n=0; n<2; ++n)
191 for (
unsigned int i=0; i<
n_dofs_; i++)
192 for (
unsigned int m=0; m<2; ++m)
193 for (
unsigned int j=0; j<
n_dofs_; j++)
200 auto p_low = p_high.lower_dim(cell_lower_dim);
203 for (
int n=0; n<2; n++)
205 if (!own_element_id[n])
continue;
213 for (
int m=0; m<2; m++)
218 double divuft = (m==0) ? arma::trace(guft) : 0;
236 for (
unsigned int n=0; n<2; ++n)
237 for (
unsigned int m=0; m<2; ++m)
252 shared_ptr<FiniteElement<dim>>
fe_;
277 template <
template<
IntDim...>
class DimAssembly>
283 template <
unsigned int dim>
290 static constexpr
const char *
name() {
return "RhsAssemblyElasticity"; }
317 shared_ptr<FE_P<dim>> fe_p = std::make_shared< FE_P<dim> >(1);
318 shared_ptr<
FE_P<dim-1>> fe_p_low = std::make_shared<
FE_P<dim-1> >(1);
319 fe_ = std::make_shared<FESystem<dim>>(fe_p,
FEVector, 3);
349 if (cell.
dim() != dim)
return;
350 if (!cell.
is_own())
return;
364 for (
auto p : this->
bulk_points(element_patch_idx) )
366 for (
unsigned int i=0; i<
n_dofs_; i++)
390 ASSERT_EQ(cell_side.
dim(), dim).error(
"Dimension of element mismatch!");
411 for (
unsigned int i=0; i<
n_dofs_; i++)
422 double side_measure = cell_side.
measure();
426 for (
unsigned int i=0; i<
n_dofs_; i++)
435 double side_measure = cell_side.
measure();
439 for (
unsigned int i=0; i<
n_dofs_; i++)
452 for (
unsigned int i=0; i<
n_dofs_; i++)
464 for (
unsigned int i=0; i<
n_dofs_; i++)
484 if (dim == 1)
return;
485 ASSERT_EQ(cell_lower_dim.
dim(), dim-1).error(
"Dimension of element mismatch!");
496 bool own_element_id[2];
497 own_element_id[0] = cell_lower_dim.
is_own();
498 own_element_id[1] = cell_higher_dim.
is_own();
500 for (
unsigned int n=0; n<2; ++n)
501 for (
unsigned int i=0; i<
n_dofs_; i++)
508 auto p_low = p_high.lower_dim(cell_lower_dim);
511 for (
int n=0; n<2; n++)
513 if (!own_element_id[n])
continue;
527 for (
unsigned int n=0; n<2; ++n)
534 shared_ptr<FiniteElement<dim>>
fe_;
562 template <
template<
IntDim...>
class DimAssembly>
567 template <
unsigned int dim>
574 static constexpr
const char *
name() {
return "OutpuFieldsAssemblyElasticity"; }
594 shared_ptr<FE_P<dim>> fe_p = std::make_shared< FE_P<dim> >(1);
595 fe_ = std::make_shared<FESystem<dim>>(fe_p,
FEVector, 3);
617 if (cell.
dim() != dim)
return;
618 if (!cell.
is_own())
return;
622 auto elm = cell.
elm();
629 auto p = *( this->
bulk_points(element_patch_idx).begin() );
633 for (
unsigned int i=0; i<
n_dofs_; i++)
640 arma::mat33 stress_dev = stress - arma::trace(stress)/3*arma::eye(3,3);
641 double von_mises_stress = sqrt(1.5*arma::dot(stress_dev, stress_dev));
642 double mean_stress = arma::trace(stress) / 3;
645 for (
unsigned int i=0; i<3; i++)
646 for (
unsigned int j=0; j<3; j++)
657 if (dim == 1)
return;
658 ASSERT_EQ(cell_lower_dim.
dim(), dim-1).error(
"Dimension of element mismatch!");
670 auto p_low = p_high.lower_dim(cell_lower_dim);
672 for (
unsigned int i=0; i<
n_dofs_; i++)
681 for (
unsigned int i=0; i<3; i++)
682 for (
unsigned int j=0; j<3; j++)
691 shared_ptr<FiniteElement<dim>>
fe_;
721 template <
template<
IntDim...>
class DimAssembly>
731 template <
unsigned int dim>
738 static constexpr
const char *
name() {
return "ConstraintAssemblyElasticity"; }
755 shared_ptr<FE_P<dim>> fe_p = std::make_shared< FE_P<dim> >(1);
756 fe_ = std::make_shared<FESystem<dim>>(fe_p,
FEVector, 3);
769 if (dim == 1)
return;
770 if (!cell_lower_dim.
is_own())
return;
772 ASSERT_EQ(cell_lower_dim.
dim(), dim-1).error(
"Dimension of element mismatch!");
779 for (
unsigned int i=0; i<
n_dofs_; i++)
786 double local_vector = 0;
789 auto p_low = p_high.lower_dim(cell_lower_dim);
794 for (
unsigned int i=0; i<
n_dofs_; i++)
812 shared_ptr<FiniteElement<dim>>
fe_;
829 template <
template<
IntDim...>
class DimAssembly>
unsigned int n_neighs_vb() const
Return number of neighbours.
shared_ptr< FiniteElement< dim > > fe_
Finite element for the solution of the advection-diffusion equation.
Elasticity::EqData EqData
Field< 3, FieldValue< 3 >::Scalar > cross_section_min
arma::Col< IntIdx > LocDofVec
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::TensorFixed > > output_stress_ptr
const FEValuesViews::Vector< 3 > * vec_view_sub_
Vector view of low dim element in neighbour calculation.
@ update_gradients
Shape function gradients.
shared_ptr< FiniteElement< dim > > fe_
Finite element for the solution of the advection-diffusion equation.
BCField< 3, FieldValue< 3 >::TensorFixed > bc_stress
shared_ptr< FiniteElement< dim-1 > > fe_low_
Finite element for the solution of the advection-diffusion equation (dim-1).
const FEValuesViews::Vector< spacedim > & vector_view(unsigned int i) const
Accessor to vector values of multicomponent FE.
Side side() const
Return Side of given cell and side_idx.
Elasticity::EqFields EqFields
double divergence(unsigned int function_no, unsigned int point_no) const
Return divergence of vector-valued shape function.
static constexpr const char * name()
const FEValuesViews::Vector< 3 > * vec_view_
Vector view in cell integral calculation.
void dimjoin_intergral(DHCellAccessor cell_lower_dim, DHCellSide neighb_side)
Assembles between elements of different dimensions.
FEValues< 3 > fe_values_bdr_side_
FEValues of side (boundary integral) object.
Field< 3, FieldValue< 3 >::TensorFixed > initial_stress
FieldSet used_fields_
Sub field set contains fields used in calculation.
FEValues< 3 > fe_values_sub_
FEValues of lower dimension cell object.
const FEValuesViews::Vector< 3 > * vec_view_side_
Vector view in boundary / neighbour calculation.
vector< vector< PetscScalar > > local_rhs_ngh_
Auxiliary vectors for assemble ngh integral.
Quadrature * quad_low_
Quadrature used in assembling methods (dim-1).
arma::vec::fixed< spacedim > normal_vector(unsigned int point_no)
Returns the normal vector to a side at given quadrature point.
unsigned int n_dofs_sub_
Number of dofs (on lower dim element)
void cell_integral(DHCellAccessor cell, unsigned int element_patch_idx)
Assemble integral over element.
LinSys * ls
Linear algebraic system.
double JxW(const unsigned int point_no)
Return the product of Jacobian determinant and the quadrature weight at given quadrature point.
Directing class of FieldValueCache.
unsigned int get_dof_indices(std::vector< LongIdx > &indices) const
Fill vector of the global indices of dofs associated to the cell.
FEValues< 3 > fe_values_sub_
FEValues of lower dimension cell object.
BCField< 3, FieldValue< 3 >::Enum > bc_type
EqFields * eq_fields_
Data objects shared with Elasticity.
Class FEValues calculates finite element data on the actual cells such as shape function values,...
bool is_own() const
Return true if accessor represents own element (false for ghost element)
shared_ptr< FiniteElement< dim > > fe_
Finite element for the solution of the advection-diffusion equation.
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > output_mean_stress_ptr
unsigned int n_dofs_
Number of dofs.
~StiffnessAssemblyElasticity()
Destructor.
@ update_values
Shape function values.
~RhsAssemblyElasticity()
Destructor.
vector< PetscScalar > local_matrix_
Auxiliary vector for assemble methods.
void initialize(Quadrature &_quadrature, FiniteElement< DIM > &_fe, UpdateFlags _flags)
Initialize structures and calculates cell-independent data.
double normal_displacement_
Holds constributions of normal displacement.
vector< vector< LongIdx > > side_dof_indices_
2 items vector of DOF indices in neighbour calculation.
std::vector< unsigned int > n_dofs_ngh_
Number of dofs on lower and higher dimension element (vector of 2 items)
@ update_quadrature_points
Transformed quadrature points.
unsigned int dim() const
Return dimension of element appropriate to cell.
@ update_normal_vectors
Normal vectors.
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > output_div_ptr
unsigned int dim() const
Return dimension of element appropriate to the side.
FEValues< 3 > fe_values_
FEValues of cell object (FESystem of P disc finite element type)
LocDofVec dof_indices_
Vector of local DOF indices of vector fields.
std::shared_ptr< DOFHandlerMultiDim > dh_
Objects for distribution of dofs.
Elasticity::EqFields EqFields
shared_ptr< FiniteElement< dim-1 > > fe_low_
Finite element for the solution of the advection-diffusion equation (dim-1).
void initialize(ElementCacheMap *element_cache_map)
Initialize auxiliary vectors and other data members.
Definitions of basic Lagrangean finite elements with polynomial shape functions.
void set(unsigned int pos, double val)
Set value on given position.
void cell_integral(DHCellAccessor cell, unsigned int element_patch_idx)
Assemble integral over element.
FieldSet used_fields_
Sub field set contains fields used in calculation.
~ConstraintAssemblyElasticity()
Destructor.
Side accessor allows to iterate over sides of DOF handler cell.
static constexpr const char * name()
void initialize(ElementCacheMap *element_cache_map)
Initialize auxiliary vectors and other data members.
arma::mat::fixed< spacedim, spacedim > sym_grad(unsigned int function_no, unsigned int point_no) const
Return symmetric gradient of vector-valued shape function.
Field< 3, FieldValue< 3 >::Scalar > fracture_sigma
Transition parameter for diffusive transfer on fractures.
Elasticity::EqData EqData
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > output_von_mises_stress_ptr
FEValues< 3 > fe_values_
FEValues of cell object (FESystem of P disc finite element type)
BCField< 3, FieldValue< 3 >::VectorFixed > bc_displacement
DHCellAccessor cell_with_other_dh(const DOFHandlerMultiDim *dh) const
Create new accessor with same local idx and given DOF handler. Actual and given DOF handler must be c...
const FEValuesViews::Vector< 3 > * vec_view_side_
Vector view in neighbour calculation.
const DHCellAccessor & cell() const
Return DHCellAccessor appropriate to the side.
vector< PetscScalar > local_matrix_
Auxiliary vector for assemble methods.
VectorMPI output_vec_
Data vectors of output fields (FieldFE).
Conforming Lagrangean finite element on dim dimensional simplex.
arma::mat33 normal_stress_
Holds constributions of normal stress.
FEM for linear elasticity.
Definitions of particular quadrature rules on simplices.
const FEValuesViews::Vector< 3 > * vec_view_
Vector view in cell integral calculation.
vector< LongIdx > dof_indices_
Vector of global DOF indices.
Elasticity::EqFields EqFields
EqFields * eq_fields_
Data objects shared with Elasticity.
const FEValuesViews::Vector< 3 > * vec_view_side_
Vector view in neighbour calculation.
ConstraintAssemblyElasticity(EqFields *eq_fields, EqData *eq_data)
Constructor.
const ElementAccessor< 3 > elm() const
Return ElementAccessor to element of loc_ele_idx_.
StiffnessAssemblyElasticity(EqFields *eq_fields, EqData *eq_data)
Constructor.
Field< 3, FieldValue< 3 >::Scalar > lame_mu
VectorMPI output_von_mises_stress_vec_
VectorMPI output_mean_stress_vec_
#define ASSERT_EQ(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
arma::mat::fixed< spacedim, spacedim > grad(unsigned int function_no, unsigned int point_no) const
Return gradient of vector-valued shape function.
arma::mat33 mat_t(const arma::mat33 &m, const arma::vec3 &n)
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::VectorFixed > > output_field_ptr
RhsAssemblyElasticity(EqFields *eq_fields, EqData *eq_data)
Constructor.
Field< 3, FieldValue< 3 >::Scalar > cross_section
Pointer to DarcyFlow field cross_section.
vector< vector< LongIdx > > side_dof_indices_
2 items vector of DOF indices in neighbour calculation.
void cell_integral(DHCellAccessor cell, unsigned int element_patch_idx)
Assemble integral over element.
Container for various descendants of FieldCommonBase.
unsigned int n_dofs_sub_
Number of dofs (on lower dim element)
const FEValuesViews::Vector< 3 > * vec_view_sub_
Vector view of low dim element in neighbour calculation.
ElementAccessor< 3 > element_accessor()
shared_ptr< FiniteElement< dim > > fe_
Finite element for the solution of the advection-diffusion equation.
unsigned int elm_idx() const
Return serial idx to element of loc_ele_idx_.
vector< LongIdx > dof_indices_
Vector of global DOF indices.
LocDofVec dof_indices_tensor_
Vector of local DOF indices of tensor fields.
virtual void rhs_set_values(int nrow, int *rows, double *vals)=0
Abstract class for the description of a general finite element on a reference simplex in dim dimensio...
VectorMPI output_div_vec_
void add(unsigned int pos, double val)
Add value to item on given position.
unsigned int n_dofs_
Number of dofs.
FEValues< 3 > fe_values_side_
FEValues of side object.
ElementAccessor< 3 > element() const
VectorMPI output_cross_sec_vec_
Range< BulkPoint > bulk_points(unsigned int element_patch_idx) const
Return BulkPoint range of appropriate dimension.
Field< 3, FieldValue< 3 >::Scalar > ref_potential_load
Potential of reference external load on boundary. TODO: Switch to BCField when possible.
OutpuFieldsAssemblyElasticity(EqFields *eq_fields, EqData *eq_data)
Constructor.
const FEValuesViews::Vector< 3 > * vec_view_side_
Vector view in boundary / neighbour calculation.
FEValues< 3 > fsv_
FEValues of side (neighbour integral) object.
std::shared_ptr< DOFHandlerMultiDim > dh_tensor_
BCField< 3, FieldValue< 3 >::VectorFixed > bc_traction
Elasticity::EqFields EqFields
Cell accessor allow iterate over DOF handler cells.
void dimjoin_intergral(DHCellAccessor cell_lower_dim, DHCellSide neighb_side)
Assembles between elements of different dimensions.
FEValues< 3 > fe_values_side_
FEValues of side object.
vector< LongIdx > dof_indices_
Vector of global DOF indices.
Field< 3, FieldValue< 3 >::Scalar > dirichlet_penalty
vector< vector< vector< PetscScalar > > > local_matrix_ngh_
Auxiliary vectors for assemble ngh integral.
Field< 3, FieldValue< 3 >::Scalar > lame_lambda
Field< 3, FieldValue< 3 >::VectorFixed > load
static constexpr const char * name()
int active_integrals_
Holds mask of active integrals.
@ update_JxW_values
Transformed quadrature weights.
LocDofVec get_loc_dof_indices() const
Returns the local indices of dofs associated to the cell on the local process.
arma::vec::fixed< spacedim > value(unsigned int function_no, unsigned int point_no) const
Return value of vector-valued shape function.
EqFields * eq_fields_
Data objects shared with Elasticity.
void initialize(ElementCacheMap *element_cache_map)
Initialize auxiliary vectors and other data members.
unsigned int idx() const
We need this method after replacing Region by RegionIdx, and movinf RegionDB instance into particular...
double get(unsigned int pos) const
Return value on given position.
void dimjoin_intergral(DHCellAccessor cell_lower_dim, DHCellSide neighb_side)
Assembles between elements of different dimensions.
void reinit(const ElementAccessor< spacedim > &cell)
Update cell-dependent data (gradients, Jacobians etc.)
Elasticity::EqData EqData
VectorMPI output_stress_vec_
@ update_side_JxW_values
Transformed quadrature weight for cell sides.
FEValues< 3 > fv_
FEValues of cell object (FESystem of P disc finite element type)
const FEValuesViews::Vector< 3 > * vec_view_
Vector view in cell integral calculation.
FieldSet used_fields_
Sub field set contains fields used in calculation.
void dimjoin_intergral(DHCellAccessor cell_lower_dim, DHCellSide neighb_side)
Assembles between elements of different dimensions.
Range< CouplingPoint > coupling_points(const DHCellSide &cell_side) const
Return CouplingPoint range of appropriate dimension.
void initialize(ElementCacheMap *element_cache_map)
Initialize auxiliary vectors and other data members.
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > output_cross_section_ptr
unsigned int n_dofs_
Number of dofs.
FieldSet used_fields_
Sub field set contains fields used in calculation.
std::shared_ptr< DOFHandlerMultiDim > dh_scalar_
void boundary_side_integral(DHCellSide cell_side)
Assembles boundary integral.
std::map< LongIdx, LongIdx > constraint_idx
void boundary_side_integral(DHCellSide cell_side)
Assembles boundary integral.
Generic class of assemblation.
Compound finite element on dim dimensional simplex.
static constexpr const char * name()
FEValues< 3 > fe_values_side_
FEValues of side (neighbour integral) object.
EqFields * eq_fields_
Data objects shared with Elasticity.
Range< BoundaryPoint > boundary_points(const DHCellSide &cell_side) const
Return BoundaryPoint range of appropriate dimension.
Elasticity::EqData EqData
unsigned int n_dofs_
Number of dofs.
ElementCacheMap * element_cache_map_
ElementCacheMap shared with GenericAssembly object.
std::vector< unsigned int > n_dofs_ngh_
Number of dofs on lower and higher dimension element (vector of 2 items)
LocDofVec dof_indices_scalar_
Vector of local DOF indices of scalar fields.
Field< 3, FieldValue< 3 >::Scalar > potential_load
Potential of an additional (external) load.
vector< vector< LongIdx > > side_dof_indices_
2 items vector of DOF indices in neighbour calculation.
double measure() const
Computes the measure of the element.
const FEValuesViews::Vector< 3 > * vec_view_bdr_
Vector view in boundary calculation.
Quadrature * quad_
Quadrature used in assembling methods.
virtual void mat_set_values(int nrow, int *rows, int ncol, int *cols, double *vals)=0
vector< PetscScalar > local_rhs_
Auxiliary vector for assemble methods.
@ bc_type_displacement_normal
~OutpuFieldsAssemblyElasticity()
Destructor.
unsigned int IntDim
A dimension index type.