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"
20 #ifdef LIBMESH_ENABLE_DIRICHLET
37 return i == j ? 1. : 0.;
50 const Real lambda_1 = E * nu / ((1. + nu) * (1. - 2.*nu));
51 const Real lambda_2 = 0.5 * E / (1. + nu);
62 libmesh_assert_equal_to (n_components, 3);
68 FEBase * elem_fe =
nullptr;
71 const std::vector<Real> & JxW = elem_fe->get_JxW();
75 const std::vector<std::vector<RealGradient>> & dphi = elem_fe->get_dphi();
80 std::vector<unsigned int> n_var_dofs(n_components);
85 for (
unsigned int C_i = 0; C_i < n_components; C_i++)
88 for (
unsigned int C_k = 0; C_k < n_components; C_k++)
89 for (
unsigned int C_l = 1; C_l < n_components; C_l++)
92 for (
unsigned int qp=0; qp<n_qpoints; qp++)
93 for (
unsigned int i=0; i<n_var_dofs[C_i]; i++)
94 for (
unsigned int j=0; j<n_var_dofs[C_k]; j++)
96 JxW[qp]*(C_ijkl * dphi[i][qp](C_j)*dphi[j][qp](C_l));
100 for (
unsigned int C_i = 0; C_i < n_components; C_i++)
101 for (
unsigned int C_j = 1; C_j < n_components; C_j++)
102 for (
unsigned int C_k = 0; C_k < n_components; C_k++)
104 unsigned int C_l = 0;
107 for (
unsigned int qp=0; qp<n_qpoints; qp++)
108 for (
unsigned int i=0; i<n_var_dofs[C_i]; i++)
109 for (
unsigned int j=0; j<n_var_dofs[C_k]; j++)
111 JxW[qp]*(C_ijkl * dphi[i][qp](C_j)*dphi[j][qp](C_l));
121 libmesh_assert_equal_to (n_components, 3);
127 FEBase * elem_fe =
nullptr;
130 const std::vector<Real> & JxW = elem_fe->get_JxW();
134 const std::vector<std::vector<RealGradient>> & dphi = elem_fe->get_dphi();
139 std::vector<unsigned int> n_var_dofs(n_components);
144 for (
unsigned int C_i = 0; C_i < n_components; C_i++)
145 for (
unsigned int C_j = 1; C_j < n_components; C_j++)
146 for (
unsigned int C_k = 0; C_k < n_components; C_k++)
147 for (
unsigned int C_l = 1; C_l < n_components; C_l++)
150 for (
unsigned int qp=0; qp<n_qpoints; qp++)
151 for (
unsigned int i=0; i<n_var_dofs[C_i]; i++)
152 for (
unsigned int j=0; j<n_var_dofs[C_k]; j++)
154 JxW[qp]*(C_ijkl * dphi[i][qp](C_j)*dphi[j][qp](C_l));
163 libmesh_assert_equal_to (n_components, 3);
169 FEBase * elem_fe =
nullptr;
172 const std::vector<Real> & JxW = elem_fe->get_JxW();
176 const std::vector<std::vector<RealGradient>> & dphi = elem_fe->get_dphi();
181 std::vector<unsigned int> n_var_dofs(n_components);
186 for (
unsigned int C_i = 0; C_i < n_components; C_i++)
188 unsigned int C_j = 0;
190 for (
unsigned int C_k = 0; C_k < n_components; C_k++)
192 unsigned int C_l = 0;
195 for (
unsigned int qp=0; qp<n_qpoints; qp++)
196 for (
unsigned int i=0; i<n_var_dofs[C_i]; i++)
197 for (
unsigned int j=0; j<n_var_dofs[C_k]; j++)
199 JxW[qp]*(C_ijkl * dphi[i][qp](C_j)*dphi[j][qp](C_l));
209 const unsigned int u_var = 0;
211 FEBase * side_fe =
nullptr;
214 const std::vector<Real> & JxW_side = side_fe->get_JxW();
216 const std::vector<std::vector<Real>> & phi_side = side_fe->get_phi();
225 for (
unsigned int qp=0; qp < n_qpoints; qp++)
226 for (
unsigned int i=0; i < n_u_dofs; i++)
227 Fu(i) += JxW_side[qp] * (1. * phi_side[i][qp]);
236 const unsigned int u_var = 0;
237 const unsigned int v_var = 1;
239 FEBase * side_fe =
nullptr;
242 const std::vector<Real> & JxW_side = side_fe->get_JxW();
244 const std::vector<std::vector<Real>> & phi_side = side_fe->get_phi();
253 for (
unsigned int qp=0; qp < n_qpoints; qp++)
254 for (
unsigned int i=0; i < n_v_dofs; i++)
255 Fv(i) += JxW_side[qp] * (1. * phi_side[i][qp]);
264 const unsigned int u_var = 0;
265 const unsigned int w_var = 2;
267 FEBase * side_fe =
nullptr;
270 const std::vector<Real> & JxW_side = side_fe->get_JxW();
272 const std::vector<std::vector<Real>> & phi_side = side_fe->get_phi();
281 for (
unsigned int qp=0; qp < n_qpoints; qp++)
282 for (
unsigned int i=0; i < n_w_dofs; i++)
283 Fw(i) += JxW_side[qp] * (1. * phi_side[i][qp]);
294 if (sys.get_mesh().get_boundary_info().has_boundary_id
295 (&node, NODE_BOUNDARY_ID))
298 node.dof_number(sys.number(), sys.variable_number(
"u"), 0);
299 values[dof_index] = 1.;
310 if (sys.get_mesh().get_boundary_info().has_boundary_id
311 (&node, NODE_BOUNDARY_ID))
314 node.dof_number(sys.number(), sys.variable_number(
"v"), 0);
315 values[dof_index] = 1.;
326 if (sys.get_mesh().get_boundary_info().has_boundary_id
327 (&node, NODE_BOUNDARY_ID))
330 node.dof_number(sys.number(), sys.variable_number(
"w"), 0);
331 values[dof_index] = 1.;
341 FEBase * elem_fe =
nullptr;
344 const std::vector<Real> & JxW = elem_fe->get_JxW();
348 const std::vector<std::vector<RealGradient>>& dphi = elem_fe->get_dphi();
362 for (
unsigned int qp=0; qp<n_qpoints; qp++)
364 for (
unsigned int i=0; i<n_u_dofs; i++)
365 for (
unsigned int j=0; j<n_u_dofs; j++)
366 Kuu(i,j) += JxW[qp]*(dphi[i][qp]*dphi[j][qp]);
368 for (
unsigned int i=0; i<n_v_dofs; i++)
369 for (
unsigned int j=0; j<n_v_dofs; j++)
370 Kvv(i,j) += JxW[qp]*(dphi[i][qp]*dphi[j][qp]);
372 for (
unsigned int i=0; i<n_w_dofs; i++)
373 for (
unsigned int j=0; j<n_w_dofs; j++)
374 Kww(i,j) += JxW[qp]*(dphi[i][qp]*dphi[j][qp]);
378 #endif // LIBMESH_ENABLE_DIRICHLET