173{
174 libmesh_assert_equal_to (system_name, "Elasticity");
175
177
179
181
185
190 fe->attach_quadrature_rule (&qrule);
191
194 fe_face->attach_quadrature_rule (&qface);
195
196 const std::vector<Real> & JxW = fe->get_JxW();
197 const std::vector<std::vector<RealGradient>> & dphi = fe->get_dphi();
198
201
203 Kuu(Ke), Kuv(Ke),
204 Kvu(Ke), Kvv(Ke);
206
208 Fu(Fe),
209 Fv(Fe);
210
211 std::vector<dof_id_type> dof_indices;
212 std::vector<dof_id_type> dof_indices_u;
213 std::vector<dof_id_type> dof_indices_v;
214 std::vector<dof_id_type> dof_indices_lambda;
215
217
218 for (
const auto & elem :
mesh.active_local_element_ptr_range())
219 {
223 dof_map.
dof_indices (elem, dof_indices_lambda, lambda_var);
224
225 const unsigned int n_dofs = dof_indices.size();
226 const unsigned int n_u_dofs = dof_indices_u.size();
227 const unsigned int n_v_dofs = dof_indices_v.size();
228 const unsigned int n_lambda_dofs = dof_indices_lambda.size();
229
230 fe->reinit (elem);
231
232 Ke.
resize (n_dofs, n_dofs);
234
235 Kuu.reposition (u_var*n_u_dofs, u_var*n_u_dofs, n_u_dofs, n_u_dofs);
236 Kuv.reposition (u_var*n_u_dofs, v_var*n_u_dofs, n_u_dofs, n_v_dofs);
237
238 Kvu.reposition (v_var*n_v_dofs, u_var*n_v_dofs, n_v_dofs, n_u_dofs);
239 Kvv.reposition (v_var*n_v_dofs, v_var*n_v_dofs, n_v_dofs, n_v_dofs);
240
241
242 Kv_lambda.reposition (v_var*n_u_dofs, v_var*n_u_dofs+n_v_dofs, n_v_dofs, 1);
243 Klambda_v.reposition (v_var*n_v_dofs+n_v_dofs, v_var*n_v_dofs, 1, n_v_dofs);
244
245 Fu.reposition (u_var*n_u_dofs, n_u_dofs);
246 Fv.reposition (v_var*n_u_dofs, n_v_dofs);
247
248 for (unsigned int qp=0; qp<qrule.n_points(); qp++)
249 {
250 for (unsigned int i=0; i<n_u_dofs; i++)
251 for (unsigned int j=0; j<n_u_dofs; j++)
252 {
253
254 unsigned int C_i, C_j, C_k, C_l;
255 C_i=0, C_k=0;
256
257 C_j=0, C_l=0;
259
260 C_j=1, C_l=0;
262
263 C_j=0, C_l=1;
265
266 C_j=1, C_l=1;
268 }
269
270 for (unsigned int i=0; i<n_u_dofs; i++)
271 for (unsigned int j=0; j<n_v_dofs; j++)
272 {
273
274 unsigned int C_i, C_j, C_k, C_l;
275 C_i=0, C_k=1;
276
277 C_j=0, C_l=0;
279
280 C_j=1, C_l=0;
282
283 C_j=0, C_l=1;
285
286 C_j=1, C_l=1;
288 }
289
290 for (unsigned int i=0; i<n_v_dofs; i++)
291 for (unsigned int j=0; j<n_u_dofs; j++)
292 {
293
294 unsigned int C_i, C_j, C_k, C_l;
295 C_i=1, C_k=0;
296
297 C_j=0, C_l=0;
299
300 C_j=1, C_l=0;
302
303 C_j=0, C_l=1;
305
306 C_j=1, C_l=1;
308 }
309
310 for (unsigned int i=0; i<n_v_dofs; i++)
311 for (unsigned int j=0; j<n_v_dofs; j++)
312 {
313
314 unsigned int C_i, C_j, C_k, C_l;
315 C_i=1, C_k=1;
316
317 C_j=0, C_l=0;
319
320 C_j=1, C_l=0;
322
323 C_j=0, C_l=1;
325
326 C_j=1, C_l=1;
328 }
329 }
330
331 {
332 std::vector<boundary_id_type> bc_ids;
333 for (auto side : elem->side_index_range())
334 if (elem->neighbor_ptr(side) == nullptr)
335 {
337
338 const std::vector<std::vector<Real>> & phi_face = fe_face->get_phi();
339 const std::vector<Real> & JxW_face = fe_face->get_JxW();
340
341 fe_face->reinit(elem, side);
342
343 for (std::vector<boundary_id_type>::const_iterator
b =
344 bc_ids.begin();
b != bc_ids.end(); ++
b)
345 {
347 for (unsigned int qp=0; qp<qface.n_points(); qp++)
348 {
349
350 if (bc_id == 2)
351 for (unsigned int i=0; i<n_v_dofs; i++)
352 Fv(i) += JxW_face[qp] * (-1.) * phi_face[i][qp];
353
354
355 if (bc_id == 1)
356 {
357 for (unsigned int i=0; i<n_v_dofs; i++)
358 for (unsigned int j=0; j<n_lambda_dofs; j++)
359 Kv_lambda(i,j) += JxW_face[qp] * (-1.) * phi_face[i][qp];
360
361 for (unsigned int i=0; i<n_lambda_dofs; i++)
362 for (unsigned int j=0; j<n_v_dofs; j++)
363 Klambda_v(i,j) += JxW_face[qp] * (-1.) * phi_face[j][qp];
364 }
365 }
366 }
367 }
368 }
369
371
374 }
375}
void boundary_ids(const Node *node, std::vector< boundary_id_type > &vec_to_fill) const
Fills a user-provided std::vector with the boundary ids associated with Node node.
Defines a dense matrix for use in Finite Element-type computations.
void resize(const unsigned int new_m, const unsigned int new_n)
Resizes the matrix to the specified size and calls zero().
Defines a dense submatrix for use in Finite Element-type computations.
Defines a dense subvector for use in finite element computations.
Defines a dense vector for use in Finite Element-type computations.
void resize(const unsigned int n)
Resize the vector.
This class handles the numbering of degrees of freedom on a mesh.
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
const FEType & variable_type(const unsigned int i) const
void constrain_element_matrix_and_vector(DenseMatrix< Number > &matrix, DenseVector< Number > &rhs, std::vector< dof_id_type > &elem_dofs, bool asymmetric_constraint_rows=true) const
Constrains the element matrix and vector.
const MeshBase & get_mesh() const
const T_sys & get_system(std::string_view name) const
NumericVector< Number > * rhs
The system matrix.
static std::unique_ptr< FEGenericBase > build(const unsigned int dim, const FEType &type)
Builds a specific finite element type.
class FEType hides (possibly multiple) FEFamily and approximation orders, thereby enabling specialize...
Order default_quadrature_order() const
const SparseMatrix< Number > & get_system_matrix() const
Manages consistently variables, degrees of freedom, coefficient vectors, matrices and linear solvers ...
This is the MeshBase class.
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
unsigned int mesh_dimension() const
virtual void add_vector(const T *v, const std::vector< numeric_index_type > &dof_indices)
Computes , where v is a pointer and each dof_indices[i] specifies where to add value v[i].
This class implements specific orders of Gauss quadrature.
virtual void add_matrix(const DenseMatrix< T > &dm, const std::vector< numeric_index_type > &rows, const std::vector< numeric_index_type > &cols)=0
Add the full matrix dm to the SparseMatrix.
unsigned int variable_number(std::string_view var) const
const DofMap & get_dof_map() const
Real eval_elasticity_tensor(unsigned int i, unsigned int j, unsigned int k, unsigned int l)