Flow123d  DF_patch_fe_data_tables-9d4017b
assembly_elasticity.hh
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file assembly_elasticity.hh
15  * @brief
16  */
17 
18 #ifndef ASSEMBLY_ELASTICITY_HH_
19 #define ASSEMBLY_ELASTICITY_HH_
20 
23 #include "mechanics/elasticity.hh"
24 #include "fem/fe_p.hh"
25 #include "fem/fe_values.hh"
27 #include "coupling/balance.hh"
29 
30 
31 /**
32  * Auxiliary container class for Finite element and related objects of given dimension.
33  */
34 template <unsigned int dim>
36 {
37 public:
38  typedef typename Elasticity::EqFields EqFields;
39  typedef typename Elasticity::EqData EqData;
40 
41  static constexpr const char * name() { return "StiffnessAssemblyElasticity"; }
42 
43  /// Constructor.
45  : AssemblyBase<dim>(1), eq_fields_(eq_fields), eq_data_(eq_data),
56  }
57 
58  /// Destructor.
60 
61  /// Initialize auxiliary vectors and other data members
62  void initialize(ElementCacheMap *element_cache_map) {
63  //this->balance_ = eq_data_->balance_;
64  this->element_cache_map_ = element_cache_map;
65 
66  shared_ptr<FE_P<dim>> fe_p = std::make_shared< FE_P<dim> >(1);
67  shared_ptr<FE_P<dim-1>> fe_p_low = std::make_shared< FE_P<dim-1> >(1);
68  fe_ = std::make_shared<FESystem<dim>>(fe_p, FEVector, 3);
69  fe_low_ = std::make_shared<FESystem<dim-1>>(fe_p_low, FEVector, 3);
70  fe_values_.initialize(*this->quad_, *fe_,
74  fe_values_sub_.initialize(*this->quad_low_, *fe_low_,
76 
77  n_dofs_ = fe_->n_dofs();
78  n_dofs_sub_ = fe_low_->n_dofs();
80  dof_indices_.resize(n_dofs_);
81  side_dof_indices_.resize(2);
82  side_dof_indices_[0].resize(n_dofs_sub_); // index 0 = element with lower dimension,
83  side_dof_indices_[1].resize(n_dofs_); // index 1 = side of element with higher dimension
85  local_matrix_ngh_.resize(2);
86  for (uint m=0; m<2; ++m) {
87  local_matrix_ngh_[m].resize(2);
88  for (uint n=0; n<2; ++n)
89  local_matrix_ngh_[m][n].resize(n_dofs_*n_dofs_);
90  }
93  if (dim>1) vec_view_sub_ = &fe_values_sub_.vector_view(0);
94  }
95 
96 
97  /// Reinit PatchFEValues_TEMP objects (all computed elements in one step).
98  void patch_reinit(std::array<PatchElementsList, 4> &patch_elements) override
99  {
100  fe_values_.reinit(patch_elements[dim]);
101  fe_values_side_.reinit(patch_elements[dim]);
102  fe_values_sub_.reinit(patch_elements[dim-1]);
103  }
104 
105 
106  /// Assemble integral over element
107  inline void cell_integral(DHCellAccessor cell, unsigned int element_patch_idx)
108  {
109  if (cell.dim() != dim) return;
110 
111  fe_values_.get_cell(element_patch_idx);
113 
114  // assemble the local stiffness matrix
115  for (unsigned int i=0; i<n_dofs_; i++)
116  for (unsigned int j=0; j<n_dofs_; j++)
117  local_matrix_[i*n_dofs_+j] = 0;
118 
119  unsigned int k=0;
120  for (auto p : this->bulk_points(element_patch_idx) )
121  {
122  for (unsigned int i=0; i<n_dofs_; i++)
123  {
124  for (unsigned int j=0; j<n_dofs_; j++)
126  2*eq_fields_->lame_mu(p)*arma::dot(vec_view_->sym_grad(j,k), vec_view_->sym_grad(i,k))
128  )*fe_values_.JxW(p);
129  }
130  k++;
131  }
133  }
134 
135  /// Assembles boundary integral.
136  inline void boundary_side_integral(DHCellSide cell_side)
137  {
138  ASSERT_EQ(cell_side.dim(), dim).error("Dimension of element mismatch!");
139  if (!cell_side.cell().is_own()) return;
140 
141  Side side = cell_side.side();
142  const DHCellAccessor &dh_cell = cell_side.cell();
143  dh_cell.get_dof_indices(dof_indices_);
145 
146  for (unsigned int i=0; i<n_dofs_; i++)
147  for (unsigned int j=0; j<n_dofs_; j++)
148  local_matrix_[i*n_dofs_+j] = 0;
149 
150  auto p_side = *( this->boundary_points(cell_side).begin() );
151  auto p_bdr = p_side.point_bdr( side.cond().element_accessor() );
152  unsigned int bc_type = eq_fields_->bc_type(p_bdr);
153  double side_measure = cell_side.measure();
154  if (bc_type == EqFields::bc_type_displacement)
155  {
156  unsigned int k=0;
157  for (auto p : this->boundary_points(cell_side) ) {
158  for (unsigned int i=0; i<n_dofs_; i++)
159  for (unsigned int j=0; j<n_dofs_; j++)
160  local_matrix_[i*n_dofs_+j] += (eq_fields_->dirichlet_penalty(p) / side_measure) *
161  arma::dot(vec_view_side_->value(i,k),vec_view_side_->value(j,k)) * fe_values_side_.JxW(p);
162  k++;
163  }
164  }
165  else if (bc_type == EqFields::bc_type_displacement_normal)
166  {
167  unsigned int k=0;
168  for (auto p : this->boundary_points(cell_side) ) {
169  for (unsigned int i=0; i<n_dofs_; i++)
170  for (unsigned int j=0; j<n_dofs_; j++)
171  local_matrix_[i*n_dofs_+j] += (eq_fields_->dirichlet_penalty(p) / side_measure) *
172  arma::dot(vec_view_side_->value(i,k), fe_values_side_.normal_vector(p)) *
174  k++;
175  }
176  }
177 
179  }
180 
181 
182  /// Assembles between elements of different dimensions.
183  inline void dimjoin_intergral(DHCellAccessor cell_lower_dim, DHCellSide neighb_side) {
184  if (dim == 1) return;
185  ASSERT_EQ(cell_lower_dim.dim(), dim-1).error("Dimension of element mismatch!");
186 
187  cell_lower_dim.get_dof_indices(side_dof_indices_[0]);
189 
190  DHCellAccessor cell_higher_dim = eq_data_->dh_->cell_accessor_from_element( neighb_side.element().idx() );
191  cell_higher_dim.get_dof_indices(side_dof_indices_[1]);
192  fe_values_side_.get_side(this->element_cache_map_->position_in_cache(neighb_side.elem_idx()), neighb_side.side_idx());
193 
194  // Element id's for testing if they belong to local partition.
195  bool own_element_id[2];
196  own_element_id[0] = cell_lower_dim.is_own();
197  own_element_id[1] = cell_higher_dim.is_own();
198 
199  for (unsigned int n=0; n<2; ++n)
200  for (unsigned int i=0; i<n_dofs_; i++)
201  for (unsigned int m=0; m<2; ++m)
202  for (unsigned int j=0; j<n_dofs_; j++)
203  local_matrix_ngh_[n][m][i*(n_dofs_)+j] = 0;
204 
205  // set transmission conditions
206  unsigned int k=0;
207  for (auto p_high : this->coupling_points(neighb_side) )
208  {
209  auto p_low = p_high.lower_dim(cell_lower_dim);
211 
212  for (int n=0; n<2; n++)
213  {
214  if (!own_element_id[n]) continue;
215 
216  for (unsigned int i=0; i<n_dofs_ngh_[n]; i++)
217  {
218  arma::vec3 vi = (n==0) ? arma::zeros(3) : vec_view_side_->value(i,k);
219  arma::vec3 vf = (n==1) ? arma::zeros(3) : vec_view_sub_->value(i,k);
220  arma::mat33 gvft = (n==0) ? vec_view_sub_->grad(i,k) : arma::zeros(3,3);
221 
222  for (int m=0; m<2; m++)
223  for (unsigned int j=0; j<n_dofs_ngh_[m]; j++) {
224  arma::vec3 ui = (m==0) ? arma::zeros(3) : vec_view_side_->value(j,k);
225  arma::vec3 uf = (m==1) ? arma::zeros(3) : vec_view_sub_->value(j,k);
226  arma::mat33 guft = (m==0) ? mat_t(vec_view_sub_->grad(j,k),nv) : arma::zeros(3,3);
227  double divuft = (m==0) ? arma::trace(guft) : 0;
228 
229  local_matrix_ngh_[n][m][i*n_dofs_ngh_[m] + j] +=
230  eq_fields_->fracture_sigma(p_low)*(
231  arma::dot(vf-vi,
232  2/eq_fields_->cross_section(p_low)*(eq_fields_->lame_mu(p_low)*(uf-ui)+(eq_fields_->lame_mu(p_low)+eq_fields_->lame_lambda(p_low))*(arma::dot(uf-ui,nv)*nv))
233  + eq_fields_->lame_mu(p_low)*arma::trans(guft)*nv
234  + eq_fields_->lame_lambda(p_low)*divuft*nv
235  )
236  - arma::dot(gvft, eq_fields_->lame_mu(p_low)*arma::kron(nv,ui.t()) + eq_fields_->lame_lambda(p_low)*arma::dot(ui,nv)*arma::eye(3,3))
237  )*fe_values_sub_.JxW(p_low);
238  }
239 
240  }
241  }
242  k++;
243  }
244 
245  for (unsigned int n=0; n<2; ++n)
246  for (unsigned int m=0; m<2; ++m)
248  }
249 
250 
251 
252 private:
253  inline arma::mat33 mat_t(const arma::mat33 &m, const arma::vec3 &n)
254  {
255  arma::mat33 mt = m - m*arma::kron(n,n.t());
256  return mt;
257  }
258 
259 
260 
261  shared_ptr<FiniteElement<dim>> fe_; ///< Finite element for the solution of the advection-diffusion equation.
262  shared_ptr<FiniteElement<dim-1>> fe_low_; ///< Finite element for the solution of the advection-diffusion equation (dim-1).
263 
264  /// Data objects shared with Elasticity
267 
268  /// Sub field set contains fields used in calculation.
270 
271  unsigned int n_dofs_; ///< Number of dofs
272  unsigned int n_dofs_sub_; ///< Number of dofs (on lower dim element)
273  std::vector<unsigned int> n_dofs_ngh_; ///< Number of dofs on lower and higher dimension element (vector of 2 items)
274  PatchFEValues_TEMP<3> fe_values_; ///< FEValues of cell object (FESystem of P disc finite element type)
275  PatchFEValues_TEMP<3> fe_values_side_; ///< FEValues of side object
276  PatchFEValues_TEMP<3> fe_values_sub_; ///< FEValues of lower dimension cell object
277 
278  vector<LongIdx> dof_indices_; ///< Vector of global DOF indices
279  vector<vector<LongIdx> > side_dof_indices_; ///< 2 items vector of DOF indices in neighbour calculation.
280  vector<PetscScalar> local_matrix_; ///< Auxiliary vector for assemble methods
281  vector<vector<vector<PetscScalar>>> local_matrix_ngh_; ///< Auxiliary vectors for assemble ngh integral
282  const FEValuesViews::Vector<PatchFEValues_TEMP<3>, 3> * vec_view_; ///< Vector view in cell integral calculation.
283  const FEValuesViews::Vector<PatchFEValues_TEMP<3>, 3> * vec_view_side_; ///< Vector view in boundary / neighbour calculation.
284  const FEValuesViews::Vector<PatchFEValues_TEMP<3>, 3> * vec_view_sub_; ///< Vector view of low dim element in neighbour calculation.
285 
286  template < template<IntDim...> class DimAssembly>
287  friend class GenericAssembly;
288 
289 };
290 
291 
292 template <unsigned int dim>
294 {
295 public:
296  typedef typename Elasticity::EqFields EqFields;
297  typedef typename Elasticity::EqData EqData;
298 
299  static constexpr const char * name() { return "RhsAssemblyElasticity"; }
300 
301  /// Constructor.
302  RhsAssemblyElasticity(EqFields *eq_fields, EqData *eq_data)
303  : AssemblyBase<dim>(1), eq_fields_(eq_fields), eq_data_(eq_data),
310  this->used_fields_ += eq_fields_->load;
315  this->used_fields_ += eq_fields_->bc_type;
320  }
321 
322  /// Destructor.
324 
325  /// Initialize auxiliary vectors and other data members
326  void initialize(ElementCacheMap *element_cache_map) {
327  //this->balance_ = eq_data_->balance_;
328  this->element_cache_map_ = element_cache_map;
329 
330  shared_ptr<FE_P<dim>> fe_p = std::make_shared< FE_P<dim> >(1);
331  shared_ptr<FE_P<dim-1>> fe_p_low = std::make_shared< FE_P<dim-1> >(1);
332  fe_ = std::make_shared<FESystem<dim>>(fe_p, FEVector, 3);
333  fe_low_ = std::make_shared<FESystem<dim-1>>(fe_p_low, FEVector, 3);
334  fe_values_.initialize(*this->quad_, *fe_,
338  fe_values_side_.initialize(*this->quad_low_, *fe_,
340  fe_values_sub_.initialize(*this->quad_low_, *fe_low_,
342  n_dofs_ = fe_->n_dofs();
343  n_dofs_sub_ = fe_low_->n_dofs();
345  dof_indices_.resize(n_dofs_);
346  side_dof_indices_.resize(2);
347  side_dof_indices_[0].resize(n_dofs_sub_); // index 0 = element with lower dimension,
348  side_dof_indices_[1].resize(n_dofs_); // index 1 = side of element with higher dimension
349  local_rhs_.resize(n_dofs_);
350  local_rhs_ngh_.resize(2);
351  for (uint n=0; n<2; ++n) local_rhs_ngh_[n].resize(n_dofs_);
355  if (dim>1) vec_view_sub_ = &fe_values_sub_.vector_view(0);
356  }
357 
358 
359  /// Reinit PatchFEValues_TEMP objects (all computed elements in one step).
360  void patch_reinit(std::array<PatchElementsList, 4> &patch_elements) override
361  {
362  fe_values_.reinit(patch_elements[dim]);
363  fe_values_bdr_side_.reinit(patch_elements[dim]);
364  fe_values_side_.reinit(patch_elements[dim]);
365  fe_values_sub_.reinit(patch_elements[dim-1]);
366  }
367 
368 
369  /// Assemble integral over element
370  inline void cell_integral(DHCellAccessor cell, unsigned int element_patch_idx)
371  {
372  if (cell.dim() != dim) return;
373  if (!cell.is_own()) return;
374 
375  fe_values_.get_cell(element_patch_idx);
377 
378  // assemble the local stiffness matrix
379  fill_n(&(local_rhs_[0]), n_dofs_, 0);
380  //local_source_balance_vector.assign(n_dofs_, 0);
381  //local_source_balance_rhs.assign(n_dofs_, 0);
382 
383  // compute sources
384  unsigned int k=0;
385  for (auto p : this->bulk_points(element_patch_idx) )
386  {
387  for (unsigned int i=0; i<n_dofs_; i++)
388  local_rhs_[i] += (
389  arma::dot(eq_fields_->load(p), vec_view_->value(i,k))
391  -arma::dot(eq_fields_->initial_stress(p), vec_view_->grad(i,k))
393  ++k;
394  }
396 
397 // for (unsigned int i=0; i<n_dofs_; i++)
398 // {
399 // for (unsigned int k=0; k<qsize_; k++) // point range
400 // local_source_balance_vector[i] -= 0;//sources_sigma[k]*fe_values_[vec_view_].value(i,k)*fe_values_.JxW(k);
401 //
402 // local_source_balance_rhs[i] += local_rhs_[i];
403 // }
404 // balance_->add_source_matrix_values(subst_idx, elm_acc.region().bulk_idx(), dof_indices_, local_source_balance_vector);
405 // balance_->add_source_vec_values(subst_idx, elm_acc.region().bulk_idx(), dof_indices_, local_source_balance_rhs);
406  }
407 
408  /// Assembles boundary integral.
409  inline void boundary_side_integral(DHCellSide cell_side)
410  {
411  ASSERT_EQ(cell_side.dim(), dim).error("Dimension of element mismatch!");
412  if (!cell_side.cell().is_own()) return;
413 
414  Side side = cell_side.side();
415  const DHCellAccessor &dh_cell = cell_side.cell();
416  dh_cell.get_dof_indices(dof_indices_);
418 
419  auto p_side = *( this->boundary_points(cell_side).begin() );
420  auto p_bdr = p_side.point_bdr( side.cond().element_accessor() );
421  unsigned int bc_type = eq_fields_->bc_type(p_bdr);
422 
423  fill_n(&(local_rhs_[0]), n_dofs_, 0);
424  // local_flux_balance_vector.assign(n_dofs_, 0);
425  // local_flux_balance_rhs = 0;
426 
427  unsigned int k = 0;
428 
429  // addtion from initial stress
430  for (auto p : this->boundary_points(cell_side) )
431  {
432  for (unsigned int i=0; i<n_dofs_; i++)
435  vec_view_bdr_->value(i,k)) *
437  ++k;
438  }
439 
440  k = 0;
441  if (bc_type == EqFields::bc_type_displacement)
442  {
443  double side_measure = cell_side.measure();
444  for (auto p : this->boundary_points(cell_side) )
445  {
446  auto p_bdr = p.point_bdr( side.cond().element_accessor() );
447  for (unsigned int i=0; i<n_dofs_; i++)
448  local_rhs_[i] += (eq_fields_->dirichlet_penalty(p) / side_measure) *
449  arma::dot(eq_fields_->bc_displacement(p_bdr), vec_view_bdr_->value(i,k)) *
451  ++k;
452  }
453  }
454  else if (bc_type == EqFields::bc_type_displacement_normal)
455  {
456  double side_measure = cell_side.measure();
457  for (auto p : this->boundary_points(cell_side) )
458  {
459  auto p_bdr = p.point_bdr( side.cond().element_accessor() );
460  for (unsigned int i=0; i<n_dofs_; i++)
461  local_rhs_[i] += (eq_fields_->dirichlet_penalty(p) / side_measure) *
465  ++k;
466  }
467  }
468  else if (bc_type == EqFields::bc_type_traction)
469  {
470  for (auto p : this->boundary_points(cell_side) )
471  {
472  auto p_bdr = p.point_bdr( side.cond().element_accessor() );
473  for (unsigned int i=0; i<n_dofs_; i++)
477  ++k;
478  }
479  }
480  else if (bc_type == EqFields::bc_type_stress)
481  {
482  for (auto p : this->boundary_points(cell_side) )
483  {
484  auto p_bdr = p.point_bdr( side.cond().element_accessor() );
485  for (unsigned int i=0; i<n_dofs_; i++)
486  // stress is multiplied by inward normal to obtain traction
491  ++k;
492  }
493  }
495 
496 
497 // balance_->add_flux_matrix_values(subst_idx, loc_b, side_dof_indices, local_flux_balance_vector);
498 // balance_->add_flux_vec_value(subst_idx, loc_b, local_flux_balance_rhs);
499  // ++loc_b;
500  }
501 
502 
503  /// Assembles between elements of different dimensions.
504  inline void dimjoin_intergral(DHCellAccessor cell_lower_dim, DHCellSide neighb_side) {
505  if (dim == 1) return;
506  ASSERT_EQ(cell_lower_dim.dim(), dim-1).error("Dimension of element mismatch!");
507 
508  cell_lower_dim.get_dof_indices(side_dof_indices_[0]);
510 
511  DHCellAccessor cell_higher_dim = eq_data_->dh_->cell_accessor_from_element( neighb_side.element().idx() );
512  cell_higher_dim.get_dof_indices(side_dof_indices_[1]);
513  fe_values_side_.get_side(this->element_cache_map_->position_in_cache(neighb_side.elem_idx()), neighb_side.side_idx());
514 
515  // Element id's for testing if they belong to local partition.
516  bool own_element_id[2];
517  own_element_id[0] = cell_lower_dim.is_own();
518  own_element_id[1] = cell_higher_dim.is_own();
519 
520  for (unsigned int n=0; n<2; ++n)
521  for (unsigned int i=0; i<n_dofs_; i++)
522  local_rhs_ngh_[n][i] = 0;
523 
524  // set transmission conditions
525  unsigned int k=0;
526  for (auto p_high : this->coupling_points(neighb_side) )
527  {
528  auto p_low = p_high.lower_dim(cell_lower_dim);
530 
531  for (int n=0; n<2; n++)
532  {
533  if (!own_element_id[n]) continue;
534 
535  for (unsigned int i=0; i<n_dofs_ngh_[n]; i++)
536  {
537  arma::vec3 vi = (n==0) ? arma::zeros(3) : vec_view_side_->value(i,k);
538  arma::vec3 vf = (n==1) ? arma::zeros(3) : vec_view_sub_->value(i,k);
539 
540  local_rhs_ngh_[n][i] -= eq_fields_->fracture_sigma(p_low) * eq_fields_->cross_section(p_high) *
541  arma::dot(vf-vi, eq_fields_->potential_load(p_high) * nv) * fe_values_sub_.JxW(p_low);
542  }
543  }
544  ++k;
545  }
546 
547  for (unsigned int n=0; n<2; ++n)
549  }
550 
551 
552 
553 private:
554  shared_ptr<FiniteElement<dim>> fe_; ///< Finite element for the solution of the advection-diffusion equation.
555  shared_ptr<FiniteElement<dim-1>> fe_low_; ///< Finite element for the solution of the advection-diffusion equation (dim-1).
556 
557  /// Data objects shared with Elasticity
560 
561  /// Sub field set contains fields used in calculation.
563 
564  unsigned int n_dofs_; ///< Number of dofs
565  unsigned int n_dofs_sub_; ///< Number of dofs (on lower dim element)
566  std::vector<unsigned int> n_dofs_ngh_; ///< Number of dofs on lower and higher dimension element (vector of 2 items)
567  PatchFEValues_TEMP<3> fe_values_; ///< FEValues of cell object (FESystem of P disc finite element type)
568  PatchFEValues_TEMP<3> fe_values_bdr_side_; ///< FEValues of side (boundary integral) object
569  PatchFEValues_TEMP<3> fe_values_side_; ///< FEValues of side (neighbour integral) object
570  PatchFEValues_TEMP<3> fe_values_sub_; ///< FEValues of lower dimension cell object
571 
572  vector<LongIdx> dof_indices_; ///< Vector of global DOF indices
573  vector<vector<LongIdx> > side_dof_indices_; ///< 2 items vector of DOF indices in neighbour calculation.
574  vector<PetscScalar> local_rhs_; ///< Auxiliary vector for assemble methods
575  vector<vector<PetscScalar>> local_rhs_ngh_; ///< Auxiliary vectors for assemble ngh integral
576  const FEValuesViews::Vector<PatchFEValues_TEMP<3>, 3> * vec_view_; ///< Vector view in cell integral calculation.
577  const FEValuesViews::Vector<PatchFEValues_TEMP<3>, 3> * vec_view_bdr_; ///< Vector view in boundary calculation.
578  const FEValuesViews::Vector<PatchFEValues_TEMP<3>, 3> * vec_view_side_; ///< Vector view in neighbour calculation.
579  const FEValuesViews::Vector<PatchFEValues_TEMP<3>, 3> * vec_view_sub_; ///< Vector view of low dim element in neighbour calculation.
580 
581 
582  template < template<IntDim...> class DimAssembly>
583  friend class GenericAssembly;
584 
585 };
586 
587 template <unsigned int dim>
589 {
590 public:
591  typedef typename Elasticity::EqFields EqFields;
592  typedef typename Elasticity::EqData EqData;
593 
594  static constexpr const char * name() { return "OutpuFieldsAssemblyElasticity"; }
595 
596  /// Constructor.
598  : AssemblyBase<dim>(0), eq_fields_(eq_fields), eq_data_(eq_data),
603  this->used_fields_ += eq_fields_->lame_mu;
606  }
607 
608  /// Destructor.
610 
611  /// Initialize auxiliary vectors and other data members
612  void initialize(ElementCacheMap *element_cache_map) {
613  //this->balance_ = eq_data_->balance_;
614  this->element_cache_map_ = element_cache_map;
615 
616  shared_ptr<FE_P<dim>> fe_p = std::make_shared< FE_P<dim> >(1);
617  fe_ = std::make_shared<FESystem<dim>>(fe_p, FEVector, 3);
618  fv_.initialize(*this->quad_, *fe_,
620  fsv_.initialize(*this->quad_low_, *fe_,
622  n_dofs_ = fe_->n_dofs();
623  vec_view_ = &fv_.vector_view(0);
624  // if (dim>1) ??
626 
633  }
634 
635 
636  /// Reinit PatchFEValues_TEMP objects (all computed elements in one step).
637  void patch_reinit(std::array<PatchElementsList, 4> &patch_elements) override
638  {
639  fv_.reinit(patch_elements[dim]);
640  fsv_.reinit(patch_elements[dim]);
641  }
642 
643 
644  /// Assemble integral over element
645  inline void cell_integral(DHCellAccessor cell, unsigned int element_patch_idx)
646  {
647  if (cell.dim() != dim) return;
648  if (!cell.is_own()) return;
649  DHCellAccessor cell_tensor = cell.cell_with_other_dh(eq_data_->dh_tensor_.get());
650  DHCellAccessor cell_scalar = cell.cell_with_other_dh(eq_data_->dh_scalar_.get());
651 
652  fv_.get_cell(element_patch_idx);
656 
657  auto p = *( this->bulk_points(element_patch_idx).begin() );
658 
660  double div = 0;
661  for (unsigned int i=0; i<n_dofs_; i++)
662  {
663  stress += (2*eq_fields_->lame_mu(p)*vec_view_->sym_grad(i,0) + eq_fields_->lame_lambda(p)*vec_view_->divergence(i,0)*arma::eye(3,3))
666  }
667 
668  arma::mat33 stress_dev = stress - arma::trace(stress)/3*arma::eye(3,3);
669  double von_mises_stress = sqrt(1.5*arma::dot(stress_dev, stress_dev));
670  double mean_stress = arma::trace(stress) / 3;
672 
673  for (unsigned int i=0; i<3; i++)
674  for (unsigned int j=0; j<3; j++)
675  output_stress_vec_.add( dof_indices_tensor_[i*3+j], stress(i,j) );
676  output_von_mises_stress_vec_.set( dof_indices_scalar_[0], von_mises_stress );
678 
680  }
681 
682 
683  /// Assembles between elements of different dimensions.
684  inline void dimjoin_intergral(DHCellAccessor cell_lower_dim, DHCellSide neighb_side) {
685  if (dim == 1) return;
686  ASSERT_EQ(cell_lower_dim.dim(), dim-1).error("Dimension of element mismatch!");
687 
689  normal_stress_.zeros();
690 
691  DHCellAccessor cell_higher_dim = neighb_side.cell();
692  DHCellAccessor cell_tensor = cell_lower_dim.cell_with_other_dh(eq_data_->dh_tensor_.get());
693  DHCellAccessor cell_scalar = cell_lower_dim.cell_with_other_dh(eq_data_->dh_scalar_.get());
694  fsv_.get_side(this->element_cache_map_->position_in_cache(neighb_side.elem_idx()), neighb_side.side_idx());
695 
696  dof_indices_ = cell_higher_dim.get_loc_dof_indices();
697  auto p_high = *( this->coupling_points(neighb_side).begin() );
698  auto p_low = p_high.lower_dim(cell_lower_dim);
699 
700  for (unsigned int i=0; i<n_dofs_; i++)
701  {
703  arma::mat33 grad = -arma::kron(vec_view_side_->value(i,0)*output_vec_.get(dof_indices_[i]), fsv_.normal_vector(p_high).t()) / eq_fields_->cross_section(p_low);
704  normal_stress_ += eq_fields_->lame_mu(p_low)*(grad+grad.t()) + eq_fields_->lame_lambda(p_low)*arma::trace(grad)*arma::eye(3,3);
705  }
706 
709  for (unsigned int i=0; i<3; i++)
710  for (unsigned int j=0; j<3; j++)
714  }
715 
716 
717 
718 private:
719  shared_ptr<FiniteElement<dim>> fe_; ///< Finite element for the solution of the advection-diffusion equation.
720 
721  /// Data objects shared with Elasticity
724 
725  /// Sub field set contains fields used in calculation.
727 
728  unsigned int n_dofs_; ///< Number of dofs
729  PatchFEValues_TEMP<3> fv_; ///< FEValues of cell object (FESystem of P disc finite element type)
730  PatchFEValues_TEMP<3> fsv_; ///< FEValues of side (neighbour integral) object
731 
732  LocDofVec dof_indices_; ///< Vector of local DOF indices of vector fields
733  LocDofVec dof_indices_scalar_; ///< Vector of local DOF indices of scalar fields
734  LocDofVec dof_indices_tensor_; ///< Vector of local DOF indices of tensor fields
735  const FEValuesViews::Vector<PatchFEValues_TEMP<3>, 3> * vec_view_; ///< Vector view in cell integral calculation.
736  const FEValuesViews::Vector<PatchFEValues_TEMP<3>, 3> * vec_view_side_; ///< Vector view in neighbour calculation.
737 
738  double normal_displacement_; ///< Holds constributions of normal displacement.
739  arma::mat33 normal_stress_; ///< Holds constributions of normal stress.
740 
741  /// Data vectors of output fields (FieldFE).
748 
749  template < template<IntDim...> class DimAssembly>
750  friend class GenericAssembly;
751 
752 };
753 
754 
755 
756 /**
757  * Container class for assembly of constraint matrix for contact condition.
758  */
759 template <unsigned int dim>
761 {
762 public:
763  typedef typename Elasticity::EqFields EqFields;
764  typedef typename Elasticity::EqData EqData;
765 
766  static constexpr const char * name() { return "ConstraintAssemblyElasticity"; }
767 
768  /// Constructor.
770  : AssemblyBase<dim>(1), eq_fields_(eq_fields), eq_data_(eq_data),
775  }
776 
777  /// Destructor.
779 
780  /// Initialize auxiliary vectors and other data members
781  void initialize(ElementCacheMap *element_cache_map) {
782  this->element_cache_map_ = element_cache_map;
783 
784  shared_ptr<FE_P<dim>> fe_p = std::make_shared< FE_P<dim> >(1);
785  fe_ = std::make_shared<FESystem<dim>>(fe_p, FEVector, 3);
786  fe_values_side_.initialize(*this->quad_low_, *fe_,
788 
789  n_dofs_ = fe_->n_dofs();
790  dof_indices_.resize(n_dofs_);
791  local_matrix_.resize(n_dofs_*n_dofs_);
793  }
794 
795 
796  /// Reinit PatchFEValues_TEMP objects (all computed elements in one step).
797  void patch_reinit(std::array<PatchElementsList, 4> &patch_elements) override
798  {
799  fe_values_side_.reinit(patch_elements[dim]);
800  }
801 
802 
803  /// Assembles between elements of different dimensions.
804  inline void dimjoin_intergral(DHCellAccessor cell_lower_dim, DHCellSide neighb_side) {
805  if (dim == 1) return;
806  if (!cell_lower_dim.is_own()) return;
807 
808  ASSERT_EQ(cell_lower_dim.dim(), dim-1).error("Dimension of element mismatch!");
809 
810  DHCellAccessor cell_higher_dim = eq_data_->dh_->cell_accessor_from_element( neighb_side.element().idx() );
811  cell_higher_dim.get_dof_indices(dof_indices_);
812 
813  fe_values_side_.get_side(this->element_cache_map_->position_in_cache(neighb_side.elem_idx()), neighb_side.side_idx());
814 
815  for (unsigned int i=0; i<n_dofs_; i++)
816  local_matrix_[i] = 0;
817 
818  // Assemble matrix and vector for contact conditions in the form B*x <= c,
819  // where B*x is the average jump of normal displacements and c is the average cross-section on element.
820  // Positive value means that the fracture closes.
821  unsigned int k=0;
822  double local_vector = 0;
823  for (auto p_high : this->coupling_points(neighb_side) )
824  {
825  auto p_low = p_high.lower_dim(cell_lower_dim);
827 
828  local_vector += (eq_fields_->cross_section(p_low) - eq_fields_->cross_section_min(p_low))*fe_values_side_.JxW(p_high) / cell_lower_dim.elm().measure() / cell_lower_dim.elm()->n_neighs_vb();
829 
830  for (unsigned int i=0; i<n_dofs_; i++)
831  {
832  local_matrix_[i] += eq_fields_->cross_section(p_high)*arma::dot(vec_view_side_->value(i,k), nv)*fe_values_side_.JxW(p_high) / cell_lower_dim.elm().measure();
833  }
834  k++;
835  }
836 
837  int arow[1] = { eq_data_->constraint_idx[cell_lower_dim.elm_idx()] };
838  MatSetValues(eq_data_->constraint_matrix, 1, arow, n_dofs_, dof_indices_.data(), &(local_matrix_[0]), ADD_VALUES);
839  VecSetValue(eq_data_->constraint_vec, arow[0], local_vector, ADD_VALUES);
840  }
841 
842 
843 
844 private:
845 
846 
847 
848  shared_ptr<FiniteElement<dim>> fe_; ///< Finite element for the solution of the advection-diffusion equation.
849 
850  /// Data objects shared with Elasticity
853 
854  /// Sub field set contains fields used in calculation.
856 
857  unsigned int n_dofs_; ///< Number of dofs
858  PatchFEValues_TEMP<3> fe_values_side_; ///< FEValues of side object
859 
860  vector<LongIdx> dof_indices_; ///< Vector of global DOF indices
861  vector<vector<LongIdx> > side_dof_indices_; ///< 2 items vector of DOF indices in neighbour calculation.
862  vector<PetscScalar> local_matrix_; ///< Auxiliary vector for assemble methods
863  const FEValuesViews::Vector<PatchFEValues_TEMP<3>, 3> * vec_view_side_; ///< Vector view in boundary / neighbour calculation.
864 
865  template < template<IntDim...> class DimAssembly>
866  friend class GenericAssembly;
867 
868 };
869 
870 
871 #endif /* ASSEMBLY_ELASTICITY_HH_ */
872 
#define ASSERT_EQ(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
Definition: asserts.hh:333
Range< BulkPoint > bulk_points(unsigned int element_patch_idx) const
Return BulkPoint range of appropriate dimension.
Quadrature * quad_
Quadrature used in assembling methods.
Quadrature * quad_low_
Quadrature used in assembling methods (dim-1).
Range< CouplingPoint > coupling_points(const DHCellSide &cell_side) const
Return CouplingPoint range of appropriate dimension.
int active_integrals_
Holds mask of active integrals.
Range< BoundaryPoint > boundary_points(const DHCellSide &cell_side) const
Return BoundaryPoint range of appropriate dimension.
ElementCacheMap * element_cache_map_
ElementCacheMap shared with GenericAssembly object.
ElementAccessor< 3 > element_accessor()
Auxiliary data class holds number of elements in cache and allow to set this value explicitly (e....
const FEValuesViews::Vector< PatchFEValues_TEMP< 3 >, 3 > * vec_view_side_
Vector view in boundary / neighbour calculation.
PatchFEValues_TEMP< 3 > fe_values_side_
FEValues of side object.
EqFields * eq_fields_
Data objects shared with Elasticity.
void dimjoin_intergral(DHCellAccessor cell_lower_dim, DHCellSide neighb_side)
Assembles between elements of different dimensions.
shared_ptr< FiniteElement< dim > > fe_
Finite element for the solution of the advection-diffusion equation.
static constexpr const char * name()
ConstraintAssemblyElasticity(EqFields *eq_fields, EqData *eq_data)
Constructor.
vector< vector< LongIdx > > side_dof_indices_
2 items vector of DOF indices in neighbour calculation.
vector< PetscScalar > local_matrix_
Auxiliary vector for assemble methods.
unsigned int n_dofs_
Number of dofs.
vector< LongIdx > dof_indices_
Vector of global DOF indices.
void patch_reinit(std::array< PatchElementsList, 4 > &patch_elements) override
Reinit PatchFEValues_TEMP objects (all computed elements in one step).
void initialize(ElementCacheMap *element_cache_map)
Initialize auxiliary vectors and other data members.
FieldSet used_fields_
Sub field set contains fields used in calculation.
Cell accessor allow iterate over DOF handler cells.
bool is_own() const
Return true if accessor represents own element (false for ghost element)
LocDofVec get_loc_dof_indices() const
Returns the local indices of dofs associated to the cell on the local process.
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...
unsigned int get_dof_indices(std::vector< LongIdx > &indices) const
Fill vector of the global indices of dofs associated to the cell.
unsigned int dim() const
Return dimension of element appropriate to cell.
unsigned int elm_idx() const
Return serial idx to element of loc_ele_idx_.
ElementAccessor< 3 > elm() const
Return ElementAccessor to element of loc_ele_idx_.
Side accessor allows to iterate over sides of DOF handler cell.
unsigned int elem_idx() const
Side side() const
Return Side of given cell and side_idx.
const DHCellAccessor & cell() const
Return DHCellAccessor appropriate to the side.
unsigned int dim() const
Return dimension of element appropriate to the side.
double measure() const
ElementAccessor< 3 > element() const
unsigned int side_idx() const
LinSys * ls
Linear algebraic system.
Definition: elasticity.hh:135
std::shared_ptr< DOFHandlerMultiDim > dh_scalar_
Definition: elasticity.hh:128
std::shared_ptr< DOFHandlerMultiDim > dh_tensor_
Definition: elasticity.hh:129
std::shared_ptr< DOFHandlerMultiDim > dh_
Objects for distribution of dofs.
Definition: elasticity.hh:127
std::map< LongIdx, LongIdx > constraint_idx
Definition: elasticity.hh:141
Field< 3, FieldValue< 3 >::Scalar > potential_load
Potential of an additional (external) load.
Definition: elasticity.hh:79
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::TensorFixed > > output_stress_ptr
Definition: elasticity.hh:101
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > output_von_mises_stress_ptr
Definition: elasticity.hh:102
Field< 3, FieldValue< 3 >::Scalar > cross_section_min
Definition: elasticity.hh:78
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > output_cross_section_ptr
Definition: elasticity.hh:104
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::VectorFixed > > output_field_ptr
Definition: elasticity.hh:100
BCField< 3, FieldValue< 3 >::Enum > bc_type
Definition: elasticity.hh:66
Field< 3, FieldValue< 3 >::Scalar > lame_lambda
Definition: elasticity.hh:95
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > output_div_ptr
Definition: elasticity.hh:105
BCField< 3, FieldValue< 3 >::VectorFixed > bc_displacement
Definition: elasticity.hh:67
Field< 3, FieldValue< 3 >::TensorFixed > initial_stress
Definition: elasticity.hh:74
BCField< 3, FieldValue< 3 >::VectorFixed > bc_traction
Definition: elasticity.hh:68
Field< 3, FieldValue< 3 >::Scalar > ref_potential_load
Potential of reference external load on boundary. TODO: Switch to BCField when possible.
Definition: elasticity.hh:80
Field< 3, FieldValue< 3 >::VectorFixed > load
Definition: elasticity.hh:70
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > output_mean_stress_ptr
Definition: elasticity.hh:103
Field< 3, FieldValue< 3 >::Scalar > fracture_sigma
Transition parameter for diffusive transfer on fractures.
Definition: elasticity.hh:73
Field< 3, FieldValue< 3 >::Scalar > dirichlet_penalty
Definition: elasticity.hh:96
Field< 3, FieldValue< 3 >::Scalar > cross_section
Pointer to DarcyFlow field cross_section.
Definition: elasticity.hh:77
BCField< 3, FieldValue< 3 >::TensorFixed > bc_stress
Definition: elasticity.hh:69
Field< 3, FieldValue< 3 >::Scalar > lame_mu
Definition: elasticity.hh:94
double measure() const
Computes the measure of the element.
unsigned int idx() const
We need this method after replacing Region by RegionIdx, and movinf RegionDB instance into particular...
Definition: accessors.hh:215
Directing class of FieldValueCache.
unsigned int position_in_cache(unsigned mesh_elm_idx, bool bdr=false) const
Return position of element stored in ElementCacheMap.
unsigned int n_neighs_vb() const
Return number of neighbours.
Definition: elements.h:65
Compound finite element on dim dimensional simplex.
Definition: fe_system.hh:102
void initialize(Quadrature &_quadrature, FiniteElement< DIM > &_fe, UpdateFlags _flags)
Initialize structures and calculates cell-independent data.
Definition: fe_values.cc:129
const FEValuesViews::Vector< FV, spacedim > & vector_view(unsigned int i) const
Accessor to vector values of multicomponent FE.
Definition: fe_values.hh:176
arma::mat::fixed< spacedim, spacedim > sym_grad(unsigned int function_no, unsigned int point_no) const
Return symmetric gradient of vector-valued shape function.
arma::mat::fixed< spacedim, spacedim > grad(unsigned int function_no, unsigned int point_no) const
Return gradient of vector-valued shape function.
double divergence(unsigned int function_no, unsigned int point_no) const
Return divergence of vector-valued shape function.
arma::vec::fixed< spacedim > value(unsigned int function_no, unsigned int point_no) const
Return value of vector-valued shape function.
Conforming Lagrangean finite element on dim dimensional simplex.
Definition: fe_p.hh:86
Container for various descendants of FieldCommonBase.
Definition: field_set.hh:159
Abstract class for the description of a general finite element on a reference simplex in dim dimensio...
Generic class of assemblation.
virtual void rhs_set_values(int nrow, int *rows, double *vals)=0
virtual void mat_set_values(int nrow, int *rows, int ncol, int *cols, double *vals)=0
LocDofVec dof_indices_scalar_
Vector of local DOF indices of scalar fields.
VectorMPI output_vec_
Data vectors of output fields (FieldFE).
unsigned int n_dofs_
Number of dofs.
FieldSet used_fields_
Sub field set contains fields used in calculation.
const FEValuesViews::Vector< PatchFEValues_TEMP< 3 >, 3 > * vec_view_side_
Vector view in neighbour calculation.
static constexpr const char * name()
LocDofVec dof_indices_
Vector of local DOF indices of vector fields.
shared_ptr< FiniteElement< dim > > fe_
Finite element for the solution of the advection-diffusion equation.
LocDofVec dof_indices_tensor_
Vector of local DOF indices of tensor fields.
PatchFEValues_TEMP< 3 > fsv_
FEValues of side (neighbour integral) object.
EqFields * eq_fields_
Data objects shared with Elasticity.
arma::mat33 normal_stress_
Holds constributions of normal stress.
const FEValuesViews::Vector< PatchFEValues_TEMP< 3 >, 3 > * vec_view_
Vector view in cell integral calculation.
void initialize(ElementCacheMap *element_cache_map)
Initialize auxiliary vectors and other data members.
PatchFEValues_TEMP< 3 > fv_
FEValues of cell object (FESystem of P disc finite element type)
void dimjoin_intergral(DHCellAccessor cell_lower_dim, DHCellSide neighb_side)
Assembles between elements of different dimensions.
void cell_integral(DHCellAccessor cell, unsigned int element_patch_idx)
Assemble integral over element.
double normal_displacement_
Holds constributions of normal displacement.
OutpuFieldsAssemblyElasticity(EqFields *eq_fields, EqData *eq_data)
Constructor.
void patch_reinit(std::array< PatchElementsList, 4 > &patch_elements) override
Reinit PatchFEValues_TEMP objects (all computed elements in one step).
void get_cell(const unsigned int patch_cell_idx)
Set element that is selected for processing. Element is given by index on patch.
Definition: fe_values.hh:516
arma::vec::fixed< spacedim > normal_vector(unsigned int point_no)
Returns the normal vector to a side at given quadrature point.
Definition: fe_values.hh:720
double JxW(const unsigned int point_no)
Return the product of Jacobian determinant and the quadrature weight at given quadrature point.
Definition: fe_values.hh:683
void get_side(unsigned int patch_cell_idx, unsigned int side_idx)
Set element and side that are selected for processing. Element is given by index on patch.
Definition: fe_values.hh:521
void reinit(PatchElementsList patch_elements)
Reinit data.
PatchFEValues_TEMP< 3 > fe_values_sub_
FEValues of lower dimension cell object.
void dimjoin_intergral(DHCellAccessor cell_lower_dim, DHCellSide neighb_side)
Assembles between elements of different dimensions.
vector< LongIdx > dof_indices_
Vector of global DOF indices.
const FEValuesViews::Vector< PatchFEValues_TEMP< 3 >, 3 > * vec_view_bdr_
Vector view in boundary calculation.
shared_ptr< FiniteElement< dim-1 > > fe_low_
Finite element for the solution of the advection-diffusion equation (dim-1).
vector< vector< LongIdx > > side_dof_indices_
2 items vector of DOF indices in neighbour calculation.
vector< vector< PetscScalar > > local_rhs_ngh_
Auxiliary vectors for assemble ngh integral.
EqFields * eq_fields_
Data objects shared with Elasticity.
Elasticity::EqFields EqFields
void initialize(ElementCacheMap *element_cache_map)
Initialize auxiliary vectors and other data members.
shared_ptr< FiniteElement< dim > > fe_
Finite element for the solution of the advection-diffusion equation.
PatchFEValues_TEMP< 3 > fe_values_side_
FEValues of side (neighbour integral) object.
std::vector< unsigned int > n_dofs_ngh_
Number of dofs on lower and higher dimension element (vector of 2 items)
Elasticity::EqData EqData
PatchFEValues_TEMP< 3 > fe_values_
FEValues of cell object (FESystem of P disc finite element type)
RhsAssemblyElasticity(EqFields *eq_fields, EqData *eq_data)
Constructor.
unsigned int n_dofs_sub_
Number of dofs (on lower dim element)
vector< PetscScalar > local_rhs_
Auxiliary vector for assemble methods.
const FEValuesViews::Vector< PatchFEValues_TEMP< 3 >, 3 > * vec_view_sub_
Vector view of low dim element in neighbour calculation.
const FEValuesViews::Vector< PatchFEValues_TEMP< 3 >, 3 > * vec_view_side_
Vector view in neighbour calculation.
void patch_reinit(std::array< PatchElementsList, 4 > &patch_elements) override
Reinit PatchFEValues_TEMP objects (all computed elements in one step).
unsigned int n_dofs_
Number of dofs.
const FEValuesViews::Vector< PatchFEValues_TEMP< 3 >, 3 > * vec_view_
Vector view in cell integral calculation.
void cell_integral(DHCellAccessor cell, unsigned int element_patch_idx)
Assemble integral over element.
static constexpr const char * name()
void boundary_side_integral(DHCellSide cell_side)
Assembles boundary integral.
FieldSet used_fields_
Sub field set contains fields used in calculation.
PatchFEValues_TEMP< 3 > fe_values_bdr_side_
FEValues of side (boundary integral) object.
Boundary cond() const
void dimjoin_intergral(DHCellAccessor cell_lower_dim, DHCellSide neighb_side)
Assembles between elements of different dimensions.
arma::mat33 mat_t(const arma::mat33 &m, const arma::vec3 &n)
FieldSet used_fields_
Sub field set contains fields used in calculation.
PatchFEValues_TEMP< 3 > fe_values_sub_
FEValues of lower dimension cell object.
shared_ptr< FiniteElement< dim > > fe_
Finite element for the solution of the advection-diffusion equation.
static constexpr const char * name()
void patch_reinit(std::array< PatchElementsList, 4 > &patch_elements) override
Reinit PatchFEValues_TEMP objects (all computed elements in one step).
const FEValuesViews::Vector< PatchFEValues_TEMP< 3 >, 3 > * vec_view_side_
Vector view in boundary / neighbour calculation.
PatchFEValues_TEMP< 3 > fe_values_side_
FEValues of side object.
PatchFEValues_TEMP< 3 > fe_values_
FEValues of cell object (FESystem of P disc finite element type)
const FEValuesViews::Vector< PatchFEValues_TEMP< 3 >, 3 > * vec_view_sub_
Vector view of low dim element in neighbour calculation.
shared_ptr< FiniteElement< dim-1 > > fe_low_
Finite element for the solution of the advection-diffusion equation (dim-1).
vector< PetscScalar > local_matrix_
Auxiliary vector for assemble methods.
vector< vector< LongIdx > > side_dof_indices_
2 items vector of DOF indices in neighbour calculation.
const FEValuesViews::Vector< PatchFEValues_TEMP< 3 >, 3 > * vec_view_
Vector view in cell integral calculation.
vector< LongIdx > dof_indices_
Vector of global DOF indices.
EqFields * eq_fields_
Data objects shared with Elasticity.
unsigned int n_dofs_sub_
Number of dofs (on lower dim element)
unsigned int n_dofs_
Number of dofs.
vector< vector< vector< PetscScalar > > > local_matrix_ngh_
Auxiliary vectors for assemble ngh integral.
std::vector< unsigned int > n_dofs_ngh_
Number of dofs on lower and higher dimension element (vector of 2 items)
void initialize(ElementCacheMap *element_cache_map)
Initialize auxiliary vectors and other data members.
void cell_integral(DHCellAccessor cell, unsigned int element_patch_idx)
Assemble integral over element.
StiffnessAssemblyElasticity(EqFields *eq_fields, EqData *eq_data)
Constructor.
void boundary_side_integral(DHCellSide cell_side)
Assembles boundary integral.
double get(unsigned int pos) const
Return value on given position.
Definition: vector_mpi.hh:105
void set(unsigned int pos, double val)
Set value on given position.
Definition: vector_mpi.hh:111
void add(unsigned int pos, double val)
Add value to item on given position.
Definition: vector_mpi.hh:125
FEM for linear elasticity.
Definitions of basic Lagrangean finite elements with polynomial shape functions.
Class FEValues calculates finite element data on the actual cells such as shape function values,...
@ FEVector
@ coupling
@ boundary
@ bulk
arma::Col< IntIdx > LocDofVec
Definition: index_types.hh:28
unsigned int uint
unsigned int IntDim
A dimension index type.
Definition: mixed.hh:19
Definitions of particular quadrature rules on simplices.
@ update_values
Shape function values.
Definition: update_flags.hh:87
@ update_normal_vectors
Normal vectors.
@ update_JxW_values
Transformed quadrature weights.
@ update_side_JxW_values
Transformed quadrature weight for cell sides.
@ update_gradients
Shape function gradients.
Definition: update_flags.hh:95
@ update_quadrature_points
Transformed quadrature points.