Amandus: Simulations based on multilevel Schwarz methods
elasticity/integrators.h
Go to the documentation of this file.
1 
2 
3 namespace Elasticity
4 {
10 namespace StVenantKirchhoff
11 {
21 template <int dim, typename number>
22 inline void
24  dealii::Vector<number>& result, const dealii::FEValuesBase<dim>& fe,
25  const dealii::VectorSlice<const std::vector<std::vector<dealii::Tensor<1, dim>>>>& input,
26  double lambda = 0., double mu = 1.)
27 {
28  const unsigned int nq = fe.n_quadrature_points;
29  const unsigned int n_dofs = fe.dofs_per_cell;
30 
31  // AssertDimension(fe.get_fe().n_components(), dim);
32  // AssertVectorVectorDimension(input, dim, fe.n_quadrature_points);
33  // Assert(result.size() == n_dofs, ExcDimensionMismatch(result.size(), n_dofs));
34 
35  for (unsigned int k = 0; k < nq; ++k)
36  {
37  const double dx = fe.JxW(k);
38  // Deformation gradient F = I + grad u
39  dealii::Tensor<2, dim> F;
40  // The Green - St. Venant strain tensor (F^TF - I)/2
41  dealii::Tensor<2, dim> E;
42  for (unsigned int d1 = 0; d1 < dim; ++d1)
43  {
44  F[d1][d1] = 1.;
45  for (unsigned int d2 = 0; d2 < dim; ++d2)
46  {
47  F[d1][d2] += input[d1][k][d2];
48  E[d1][d2] = .5 * (input[d1][k][d2] + input[d2][k][d1]);
49  for (unsigned int dd = 0; dd < dim; ++dd)
50  E[d1][d2] += .5 * input[dd][k][d1] * input[dd][k][d2];
51  }
52  }
53 
54  double trace = 0.;
55  for (unsigned int dd = 0; dd < dim; ++dd)
56  trace += E[dd][dd];
57  for (unsigned int dd = 0; dd < dim; ++dd)
58  E[dd][dd] += lambda / (2. * mu) * trace;
59 
60  // Now that we have all the variables, let's test against
61  // the gradient(!) of the test functions
62 
63  for (unsigned int i = 0; i < n_dofs; ++i)
64  {
65  for (unsigned int d1 = 0; d1 < dim; ++d1)
66  for (unsigned int d2 = 0; d2 < dim; ++d2)
67  {
68  double dv = fe.shape_grad_component(i, k, d1)[d2];
69  // Compute (F Sigma)_ij (Ciarlet Theorem 2.6.2)
70 
71  double stress = 0.;
72  for (unsigned int dd = 0; dd < dim; ++dd)
73  stress += 2. * mu * F[d1][dd] * E[dd][d2];
74 
75  result(i) += dx * stress * dv;
76  }
77  }
78  }
79 }
80 }
81 }
Definition: elasticity/eigen.h:25
void cell_residual(dealii::Vector< number > &result, const dealii::FEValuesBase< dim > &fe, const dealii::VectorSlice< const std::vector< std::vector< dealii::Tensor< 1, dim >>>> &input, double lambda=0., double mu=1.)
Definition: elasticity/integrators.h:23