3 #include "rb_classes.h" 6 #include "libmesh/sparse_matrix.h" 7 #include "libmesh/numeric_vector.h" 8 #include "libmesh/dense_matrix.h" 9 #include "libmesh/dense_submatrix.h" 10 #include "libmesh/dense_vector.h" 11 #include "libmesh/dense_subvector.h" 12 #include "libmesh/fe.h" 13 #include "libmesh/fe_interface.h" 14 #include "libmesh/fe_base.h" 15 #include "libmesh/elem_assembly.h" 16 #include "libmesh/quadrature_gauss.h" 17 #include "libmesh/boundary_info.h" 18 #include "libmesh/node.h" 23 #ifdef LIBMESH_ENABLE_DIRICHLET 40 return i == j ? 1. : 0.;
53 const Real lambda_1 = E * nu / ((1. + nu) * (1. - 2.*nu));
54 const Real lambda_2 = 0.5 * E / (1. + nu);
64 libmesh_assert_less_equal(n_components, 3);
70 FEBase * elem_fe =
nullptr;
73 const std::vector<Real> & JxW = elem_fe->get_JxW();
77 const std::vector<std::vector<RealGradient>> & dphi = elem_fe->get_dphi();
82 std::vector<unsigned int> n_var_dofs(n_components);
89 for (
unsigned int C_i = 0; C_i < n_components; C_i++)
92 for (
unsigned int C_k = 0; C_k < n_components; C_k++)
93 for (
unsigned int C_l = 1; C_l < n_components; C_l++)
96 for (
unsigned int qp=0; qp<n_qpoints; qp++)
97 for (
unsigned int i=0; i<n_var_dofs[C_i]; i++)
98 for (
unsigned int j=0; j<n_var_dofs[C_k]; j++)
100 JxW[qp]*(C_ijkl * dphi[i][qp](C_j)*dphi[j][qp](C_l));
104 for (
unsigned int C_i = 0; C_i < n_components; C_i++)
105 for (
unsigned int C_j = 1; C_j < n_components; C_j++)
106 for (
unsigned int C_k = 0; C_k < n_components; C_k++)
108 unsigned int C_l = 0;
111 for (
unsigned int qp=0; qp<n_qpoints; qp++)
112 for (
unsigned int i=0; i<n_var_dofs[C_i]; i++)
113 for (
unsigned int j=0; j<n_var_dofs[C_k]; j++)
115 JxW[qp]*(C_ijkl * dphi[i][qp](C_j)*dphi[j][qp](C_l));
124 libmesh_assert_less_equal(n_components, 3);
130 FEBase * elem_fe =
nullptr;
133 const std::vector<Real> & JxW = elem_fe->get_JxW();
137 const std::vector<std::vector<RealGradient>> & dphi = elem_fe->get_dphi();
142 std::vector<unsigned int> n_var_dofs(n_components);
144 if (n_components > 1)
146 if (n_components > 2)
149 for (
unsigned int C_i = 0; C_i < n_components; C_i++)
150 for (
unsigned int C_j = 1; C_j < n_components; C_j++)
151 for (
unsigned int C_k = 0; C_k < n_components; C_k++)
152 for (
unsigned int C_l = 1; C_l < n_components; C_l++)
155 for (
unsigned int qp=0; qp<n_qpoints; qp++)
156 for (
unsigned int i=0; i<n_var_dofs[C_i]; i++)
157 for (
unsigned int j=0; j<n_var_dofs[C_k]; j++)
159 JxW[qp]*(C_ijkl * dphi[i][qp](C_j)*dphi[j][qp](C_l));
167 libmesh_assert_less_equal(n_components, 3);
173 FEBase * elem_fe =
nullptr;
176 const std::vector<Real> & JxW = elem_fe->get_JxW();
180 const std::vector<std::vector<RealGradient>> & dphi = elem_fe->get_dphi();
185 std::vector<unsigned int> n_var_dofs(n_components);
187 if (n_components > 1)
189 if (n_components > 2)
192 for (
unsigned int C_i = 0; C_i < n_components; C_i++)
194 unsigned int C_j = 0;
196 for (
unsigned int C_k = 0; C_k < n_components; C_k++)
198 unsigned int C_l = 0;
201 for (
unsigned int qp=0; qp<n_qpoints; qp++)
202 for (
unsigned int i=0; i<n_var_dofs[C_i]; i++)
203 for (
unsigned int j=0; j<n_var_dofs[C_k]; j++)
205 JxW[qp]*(C_ijkl * dphi[i][qp](C_j)*dphi[j][qp](C_l));
215 const unsigned int u_var = 0;
217 FEBase * side_fe =
nullptr;
220 const std::vector<Real> & JxW_side = side_fe->get_JxW();
222 const std::vector<std::vector<Real>> & phi_side = side_fe->get_phi();
231 for (
unsigned int qp=0; qp < n_qpoints; qp++)
232 for (
unsigned int i=0; i < n_u_dofs; i++)
233 Fu(i) += JxW_side[qp] * (1. * phi_side[i][qp]);
242 const unsigned int u_var = 0;
243 const unsigned int v_var = 1;
245 FEBase * side_fe =
nullptr;
248 const std::vector<Real> & JxW_side = side_fe->get_JxW();
250 const std::vector<std::vector<Real>> & phi_side = side_fe->get_phi();
259 for (
unsigned int qp=0; qp < n_qpoints; qp++)
260 for (
unsigned int i=0; i < n_v_dofs; i++)
261 Fv(i) += JxW_side[qp] * (1. * phi_side[i][qp]);
270 const unsigned int u_var = 0;
271 const unsigned int w_var = 2;
273 FEBase * side_fe =
nullptr;
276 const std::vector<Real> & JxW_side = side_fe->get_JxW();
278 const std::vector<std::vector<Real>> & phi_side = side_fe->get_phi();
287 for (
unsigned int qp=0; qp < n_qpoints; qp++)
288 for (
unsigned int i=0; i < n_w_dofs; i++)
289 Fw(i) += JxW_side[qp] * (1. * phi_side[i][qp]);
300 if (sys.get_mesh().get_boundary_info().has_boundary_id
301 (&node, NODE_BOUNDARY_ID))
304 node.dof_number(sys.number(), sys.variable_number(
"u"), 0);
305 values[dof_index] = 1.;
316 if (sys.get_mesh().get_boundary_info().has_boundary_id
317 (&node, NODE_BOUNDARY_ID))
320 node.dof_number(sys.number(), sys.variable_number(
"v"), 0);
321 values[dof_index] = 1.;
332 if (sys.get_mesh().get_boundary_info().has_boundary_id
333 (&node, NODE_BOUNDARY_ID))
336 node.dof_number(sys.number(), sys.variable_number(
"w"), 0);
337 values[dof_index] = 1.;
345 libmesh_assert_less_equal(n_components, 3);
351 FEBase * elem_fe =
nullptr;
354 const std::vector<Real> & JxW = elem_fe->get_JxW();
358 const std::vector<std::vector<RealGradient>>& dphi = elem_fe->get_dphi();
367 std::reference_wrapper<DenseSubMatrix<Number>> Kdiag[3] =
374 for (
unsigned int qp=0; qp<n_qpoints; qp++)
375 for (
unsigned int d=0; d<n_components; ++d)
376 for (
unsigned int i=0; i<n_dofs; i++)
377 for (
unsigned int j=0; j<n_dofs; j++)
378 Kdiag[d](i,j) += JxW[qp]*(dphi[i][qp]*dphi[j][qp]);
381 #endif // LIBMESH_ENABLE_DIRICHLET RealVectorValue RealGradient
const DenseMatrix< Number > & get_elem_jacobian() const
Const accessor for element Jacobian.
virtual void get_nodal_rhs_values(std::map< numeric_index_type, Number > &values, const System &sys, const Node &node)
void get_side_fe(unsigned int var, FEGenericBase< OutputShape > *&fe) const
Accessor for edge/face (2D/3D) finite element object for variable var for the largest dimension in th...
bool has_boundary_id(const Node *const node, const boundary_id_type id) const
Real elasticity_tensor(unsigned int i, unsigned int j, unsigned int k, unsigned int l)
Real kronecker_delta(unsigned int i, unsigned int j)
const Elem & get_elem() const
Accessor for current Elem object.
virtual void get_nodal_rhs_values(std::map< numeric_index_type, Number > &values, const System &sys, const Node &node)
virtual void boundary_assembly(FEMContext &c)
Perform the element boundary assembly.
unsigned int u_var
Variable numbers and approximation order.
ElasticityRBConstruction & rb_sys
The ElasticityRBConstruction object that will use this assembly.
virtual void boundary_assembly(FEMContext &c)
Perform the element boundary assembly.
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
const MeshBase & get_mesh() const
virtual void boundary_assembly(FEMContext &c)
Perform the element boundary assembly.
virtual void interior_assembly(FEMContext &c)
Perform the element interior assembly.
dof_id_type numeric_index_type
virtual void interior_assembly(FEMContext &c)
Perform the element interior assembly.
This class provides all data required for a physics package (e.g.
const std::vector< dof_id_type > & get_dof_indices() const
Accessor for element dof indices.
unsigned int n_points() const
FEGenericBase< Real > FEBase
virtual void get_nodal_rhs_values(std::map< numeric_index_type, Number > &values, const System &sys, const Node &node)
This class provides an encapsulated access to all static public member functions of finite element cl...
virtual void interior_assembly(FEMContext &c)
Perform the element interior assembly.
const DenseVector< Number > & get_elem_residual() const
Const accessor for element residual.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
unsigned char side
Current side for side_* to examine.
ElemAssembly provides a per-element (interior and boundary) assembly functionality.
virtual void interior_assembly(FEMContext &c)
Perform the element interior assembly.
void get_element_fe(unsigned int var, FEGenericBase< OutputShape > *&fe) const
Accessor for interior finite element object for variable var for the largest dimension in the mesh...
This class is part of the rbOOmit framework.
unsigned int n_vars() const
A Point defines a location in LIBMESH_DIM dimensional Real space.
const QBase & get_element_qrule() const
Accessor for element interior quadrature rule for the dimension of the current _elem.
const QBase & get_side_qrule() const
Accessor for element side quadrature rule for the dimension of the current _elem. ...