Flow123d  DF_patch_fe_mechanics-24d9721
elasticity.cc
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 transport_dg.cc
15  * @brief Discontinuous Galerkin method for equation of transport with dispersion.
16  * @author Jan Stebel
17  */
18 
19 #include "system/sys_profiler.hh"
20 #include "mechanics/elasticity.hh"
22 
23 #include "io/output_time.hh"
25 #include "fem/fe_values.hh"
26 #include "fem/fe_p.hh"
27 #include "fem/fe_rt.hh"
28 #include "fem/fe_system.hh"
29 #include "fields/field_fe.hh"
30 #include "la/linsys_PETSC.hh"
31 #include "la/linsys_PERMON.hh"
32 #include "coupling/balance.hh"
33 #include "mesh/neighbours.h"
35 
36 #include "fields/multi_field.hh"
37 #include "fields/generic_field.hh"
38 #include "fields/field_model.hh"
39 #include "input/factory.hh"
40 
41 
42 
43 
44 using namespace Input::Type;
45 
46 
47 
49  std::string equation_name = std::string(name_) + "_FE";
50  return IT::Record(
51  std::string(equation_name),
52  "FEM for linear elasticity.")
55  .declare_key("balance", Balance::get_input_type(), Default("{}"),
56  "Settings for computing balance.")
58  "Parameters of output stream.")
60  "Linear solver for elasticity.")
61  .declare_key("input_fields", Array(
63  .make_field_descriptor_type(equation_name)),
65  "Input fields of the equation.")
66  .declare_key("output",
67  EqFields().output_fields.make_output_type(equation_name, ""),
68  IT::Default("{ \"fields\": [ \"displacement\" ] }"),
69  "Setting of the field output.")
70  .declare_key("contact", Bool(), IT::Default("false"), "Indicates the use of contact conditions on fractures.")
71  .close();
72 }
73 
74 const int Elasticity::registrar =
75  Input::register_class< Elasticity, Mesh &, const Input::Record>(std::string(name_) + "_FE") +
77 
78 
79 
80 double lame_mu(double young, double poisson)
81 {
82  return young*0.5/(poisson+1.);
83 }
84 
85 
86 double lame_lambda(double young, double poisson)
87 {
88  return young*poisson/((poisson+1.)*(1.-2.*poisson));
89 }
90 
91 // Functor computing lame_mu
92 struct fn_lame_mu {
93  inline double operator() (double young, double poisson) {
94  return young * 0.5 / (poisson+1.);
95  }
96 };
97 
98 // Functor computing lame_lambda
100  inline double operator() (double young, double poisson) {
101  return young * poisson / ((poisson+1.)*(1.-2.*poisson));
102  }
103 };
104 
105 // Functor computing base of dirichlet_penalty (without dividing by side meassure)
107  inline double operator() (double lame_mu, double lame_lambda) {
108  return 1e3 * (2 * lame_mu + lame_lambda);
109  }
110 };
111 
112 
113 
114 
115 
116 
118  return Selection("Elasticity_BC_Type", "Types of boundary conditions for mechanics.")
119  .add_value(bc_type_displacement, "displacement",
120  "Prescribed displacement.")
121  .add_value(bc_type_displacement_normal, "displacement_n",
122  "Prescribed displacement in the normal direction to the boundary.")
123  .add_value(bc_type_traction, "traction",
124  "Prescribed traction.")
125  .add_value(bc_type_stress, "stress",
126  "Prescribed stress tensor.")
127  .close();
128 }
129 
130 
132 {
133  *this+=bc_type
134  .name("bc_type")
135  .description(
136  "Type of boundary condition.")
137  .units( UnitSI::dimensionless() )
138  .input_default("\"traction\"")
139  .input_selection( get_bc_type_selection() )
141 
142  *this+=bc_displacement
143  .name("bc_displacement")
144  .description("Prescribed displacement on boundary.")
145  .units( UnitSI().m() )
146  .input_default("0.0")
147  .flags_add(in_rhs);
148 
149  *this+=bc_traction
150  .name("bc_traction")
151  .description("Prescribed traction on boundary.")
152  .units( UnitSI().Pa() )
153  .input_default("0.0")
154  .flags_add(in_rhs);
155 
156  *this+=bc_stress
157  .name("bc_stress")
158  .description("Prescribed stress on boundary.")
159  .units( UnitSI().Pa() )
160  .input_default("0.0")
161  .flags_add(in_rhs);
162 
163  *this+=load
164  .name("load")
165  .description("Prescribed bulk load.")
166  .units( UnitSI().N().m(-3) )
167  .input_default("0.0")
168  .flags_add(in_rhs);
169 
170  *this+=young_modulus
171  .name("young_modulus")
172  .description("Young's modulus.")
173  .units( UnitSI().Pa() )
174  .input_default("0.0")
175  .flags_add(in_main_matrix & in_rhs);
176 
177  *this+=poisson_ratio
178  .name("poisson_ratio")
179  .description("Poisson's ratio.")
180  .units( UnitSI().dimensionless() )
181  .input_default("0.0")
182  .flags_add(in_main_matrix & in_rhs);
183 
184  *this+=fracture_sigma
185  .name("fracture_sigma")
186  .description(
187  "Coefficient of transfer of forces through fractures.")
188  .units( UnitSI::dimensionless() )
189  .input_default("1.0")
190  .flags_add(in_main_matrix & in_rhs);
191 
192  *this+=initial_stress
193  .name("initial_stress")
194  .description("Initial stress tensor.")
195  .units( UnitSI().Pa() )
196  .input_default("0.0")
197  .flags_add(in_rhs);
198 
199  *this += region_id.name("region_id")
200  .units( UnitSI::dimensionless())
202 
203  *this += subdomain.name("subdomain")
204  .units( UnitSI::dimensionless() )
206 
207  *this+=cross_section
208  .name("cross_section")
209  .units( UnitSI().m(3).md() )
210  .flags(input_copy & in_time_term & in_main_matrix & in_rhs);
211 
212  *this+=cross_section_min
213  .name("cross_section_min")
214  .description("Minimal cross-section of fractures.")
215  .units( UnitSI().m(3).md() )
216  .input_default("0.0");
217 
218  *this+=potential_load
219  .name("potential_load")
220  .units( UnitSI().m() )
221  .flags(input_copy & in_rhs);
222 
223  *this+=output_field
224  .name("displacement")
225  .description("Displacement vector field output.")
226  .units( UnitSI().m() )
227  .flags(equation_result);
228 
229  *this += output_stress
230  .name("stress")
231  .description("Stress tensor output.")
232  .units( UnitSI().Pa() )
233  .flags(equation_result);
234 
235  *this += output_von_mises_stress
236  .name("von_mises_stress")
237  .description("von Mises stress output.")
238  .units( UnitSI().Pa() )
239  .flags(equation_result);
240 
241  *this += output_mean_stress
242  .name("mean_stress")
243  .description("mean stress output.")
244  .units( UnitSI().Pa() )
245  .flags(equation_result);
246 
247  *this += output_cross_section
248  .name("cross_section_updated")
249  .description("Cross-section after deformation - output.")
250  .units( UnitSI().m() )
251  .flags(equation_result);
252 
253  *this += output_divergence
254  .name("displacement_divergence")
255  .description("Displacement divergence output.")
256  .units( UnitSI().dimensionless() )
257  .flags(equation_result);
258 
259  *this += lame_mu.name("lame_mu")
260  .description("Field lame_mu.")
261  .input_default("0.0")
262  .units( UnitSI().Pa() );
263 
264  *this += lame_lambda.name("lame_lambda")
265  .description("Field lame_lambda.")
266  .input_default("0.0")
267  .units( UnitSI().Pa() );
268 
269  *this += dirichlet_penalty.name("dirichlet_penalty")
270  .description("Field dirichlet_penalty.")
271  .input_default("0.0")
272  .units( UnitSI().Pa() );
273 
274  // add all input fields to the output list
275  output_fields += *this;
276 
277  this->add_coords_field();
278  this->set_default_fieldset();
279 
280 }
281 
283 {
284  ASSERT_EQ(quad_order(), 1).error("Unsupported polynomial order for finite elements in Elasticity");
285  MixedPtr<FE_P> fe_p( quad_order() );
287 
288  std::shared_ptr<DiscreteSpace> ds = std::make_shared<EqualOrderDiscreteSpace>(mesh, fe);
289  dh_ = std::make_shared<DOFHandlerMultiDim>(*mesh);
290 
291  dh_->distribute_dofs(ds);
292 }
293 
295 {
296  ASSERT_EQ(quad_order(), 0).error("Unsupported polynomial order for output in Elasticity");
297 
298  MixedPtr<FE_P_disc> fe_p_disc( quad_order() );
299  dh_scalar_ = make_shared<DOFHandlerMultiDim>(*mesh);
300  std::shared_ptr<DiscreteSpace> ds_scalar = std::make_shared<EqualOrderDiscreteSpace>( mesh, fe_p_disc);
301  dh_scalar_->distribute_dofs(ds_scalar);
302 
303 
305  dh_tensor_ = make_shared<DOFHandlerMultiDim>(*mesh);
306  std::shared_ptr<DiscreteSpace> dst = std::make_shared<EqualOrderDiscreteSpace>( mesh, fe_t);
307  dh_tensor_->distribute_dofs(dst);
308 }
309 
310 
311 Elasticity::Elasticity(Mesh & init_mesh, const Input::Record in_rec, TimeGovernor *tm)
312  : EquationBase(init_mesh, in_rec),
313  input_rec(in_rec),
314  stiffness_assembly_(nullptr),
315  rhs_assembly_(nullptr),
316  constraint_assembly_(nullptr),
317  output_fields_assembly_(nullptr)
318 {
319  // Can not use name() + "constructor" here, since START_TIMER only accepts const char *
320  // due to constexpr optimization.
322 
323  eq_data_ = std::make_shared<EqData>();
324  output_eq_data_ = std::make_shared<OutputEqData>();
325  eq_fields_ = std::make_shared<EqFields>();
326  this->eq_fieldset_ = eq_fields_;
327 
328  auto time_rec = in_rec.val<Input::Record>("time");
329  if (tm == nullptr)
330  {
331  time_ = new TimeGovernor(time_rec);
332  }
333  else
334  {
335  TimeGovernor time_from_rec(time_rec);
336  ASSERT( time_from_rec.is_default() ).error("Duplicate key 'time', time in elasticity is already initialized from parent class!");
337  time_ = tm;
338  }
339 
340 
341  // Set up physical parameters.
342  eq_fields_->set_mesh(init_mesh);
345  eq_data_->balance_ = this->balance();
346 
347  // create finite element structures and distribute DOFs
348  eq_data_->create_dh(mesh_);
349  output_eq_data_->create_dh(mesh_);
350  DebugOut().fmt("Mechanics: solution size {}\n", eq_data_->dh_->n_global_dofs());
351 
352 }
353 
354 
356 {
357  output_stream_ = OutputTime::create_output_stream("mechanics", input_rec.val<Input::Record>("output_stream"), time().get_unit_conversion());
358 
359  eq_fields_->set_components({"displacement"});
360  eq_fields_->set_input_list( input_rec.val<Input::Array>("input_fields"), time() );
361 
362 // balance_ = std::make_shared<Balance>("mechanics", mesh_);
363 // balance_->init_from_input(input_rec.val<Input::Record>("balance"), *time_);
364  // initialization of balance object
365 // eq_data_->balance_idx_ = {
366 // balance_->add_quantity("force_x"),
367 // balance_->add_quantity("force_y"),
368 // balance_->add_quantity("force_z")
369 // };
370 // balance_->units(UnitSI().kg().m().s(-2));
371 
372  // create shared pointer to a FieldFE, pass FE data and push this FieldFE to output_field on all regions
373  eq_fields_->output_field_ptr = create_field_fe<3, FieldValue<3>::VectorFixed>(eq_data_->dh_);
374  eq_fields_->output_field.set(eq_fields_->output_field_ptr, 0.);
375 
376  // setup output stress
377  eq_fields_->output_stress_ptr = create_field_fe<3, FieldValue<3>::TensorFixed>(output_eq_data_->dh_tensor_);
378  eq_fields_->output_stress.set(eq_fields_->output_stress_ptr, 0.);
379 
380  // setup output von Mises stress
381  eq_fields_->output_von_mises_stress_ptr = create_field_fe<3, FieldValue<3>::Scalar>(output_eq_data_->dh_scalar_);
382  eq_fields_->output_von_mises_stress.set(eq_fields_->output_von_mises_stress_ptr, 0.);
383 
384  // setup output mean stress
385  eq_fields_->output_mean_stress_ptr = create_field_fe<3, FieldValue<3>::Scalar>(output_eq_data_->dh_scalar_);
386  eq_fields_->output_mean_stress.set(eq_fields_->output_mean_stress_ptr, 0.);
387 
388  // setup output cross-section
389  eq_fields_->output_cross_section_ptr = create_field_fe<3, FieldValue<3>::Scalar>(output_eq_data_->dh_scalar_);
390  eq_fields_->output_cross_section.set(eq_fields_->output_cross_section_ptr, 0.);
391 
392  // setup output divergence
394  eq_fields_->output_divergence.set(eq_fields_->output_div_ptr, 0.);
395 
396  // read optional user fields
397  Input::Array user_fields_arr;
398  if (input_rec.opt_val("user_fields", user_fields_arr)) {
399  this->init_user_fields(user_fields_arr, eq_fields_->output_fields);
400  }
401 
402  eq_fields_->output_fields.set_mesh(*mesh_);
403  eq_fields_->output_field.output_type(OutputTime::CORNER_DATA);
404 
405  // set time marks for writing the output
406  eq_fields_->output_fields.initialize(output_stream_, mesh_, input_rec.val<Input::Record>("output"), this->time());
407 
408  // set instances of FieldModel
409  eq_fields_->lame_mu.set(Model<3, FieldValue<3>::Scalar>::create(fn_lame_mu(), eq_fields_->young_modulus, eq_fields_->poisson_ratio), 0.0);
410  eq_fields_->lame_lambda.set(Model<3, FieldValue<3>::Scalar>::create(fn_lame_lambda(), eq_fields_->young_modulus, eq_fields_->poisson_ratio), 0.0);
411  eq_fields_->dirichlet_penalty.set(Model<3, FieldValue<3>::Scalar>::create(fn_dirichlet_penalty(), eq_fields_->lame_mu, eq_fields_->lame_lambda), 0.0);
412 
413  // equation default PETSc solver options
414  std::string petsc_default_opts;
415  petsc_default_opts = "-ksp_type cg -pc_type hypre -pc_hypre_type boomeramg";
416 
417  // allocate matrix and vector structures
418  LinSys *ls;
419  has_contact_ = input_rec.val<bool>("contact");
420  if (has_contact_) {
421 #ifndef FLOW123D_HAVE_PERMON
422  ASSERT(false).error("Flow123d was not built with PERMON library, therefore contact conditions are unsupported.");
423 #endif //FLOW123D_HAVE_PERMON
424  ls = new LinSys_PERMON(eq_data_->dh_->distr().get(), petsc_default_opts);
425 
426  // allocate constraint matrix and vector
427  unsigned int n_own_constraints = 0; // count locally owned cells with neighbours
428  for (auto cell : eq_data_->dh_->own_range())
429  if (cell.elm()->n_neighs_vb() > 0)
430  n_own_constraints++;
431  unsigned int n_constraints = 0; // count all cells with neighbours
432  for (auto elm : mesh_->elements_range())
433  if (elm->n_neighs_vb() > 0)
434  eq_data_->constraint_idx[elm.idx()] = n_constraints++;
435  unsigned int nnz = eq_data_->dh_->ds()->fe()[1_d]->n_dofs()*mesh_->max_edge_sides(1) +
436  eq_data_->dh_->ds()->fe()[2_d]->n_dofs()*mesh_->max_edge_sides(2) +
437  eq_data_->dh_->ds()->fe()[3_d]->n_dofs()*mesh_->max_edge_sides(3);
438  MatCreateAIJ(PETSC_COMM_WORLD, n_own_constraints, eq_data_->dh_->lsize(), PETSC_DECIDE, PETSC_DECIDE, nnz, 0, nnz, 0, &eq_data_->constraint_matrix);
439  VecCreateMPI(PETSC_COMM_WORLD, n_own_constraints, PETSC_DECIDE, &eq_data_->constraint_vec);
440  ((LinSys_PERMON*)ls)->set_inequality(eq_data_->constraint_matrix,eq_data_->constraint_vec);
441 
443  } else {
444  ls = new LinSys_PETSC(eq_data_->dh_->distr().get(), petsc_default_opts);
445  ((LinSys_PETSC*)ls)->set_initial_guess_nonzero();
446  }
447  ls->set_from_input( input_rec.val<Input::Record>("solver") );
448  ls->set_solution(eq_fields_->output_field_ptr->vec().petsc_vec());
449  eq_data_->ls = ls;
450 
454 
455  // initialization of balance object
456 // balance_->allocate(eq_data_->dh_->distr()->lsize(),
457 // max(feo->fe<1>()->n_dofs(), max(feo->fe<2>()->n_dofs(), feo->fe<3>()->n_dofs())));
458 
459 }
460 
461 
463 {
464 // delete time_;
465 
466  if (stiffness_assembly_!=nullptr) delete stiffness_assembly_;
467  if (rhs_assembly_!=nullptr) delete rhs_assembly_;
468  if (constraint_assembly_ != nullptr) delete constraint_assembly_;
470 
471  eq_data_.reset();
472  eq_fields_.reset();
473 }
474 
475 
476 
478 {
479  eq_fields_->set_time(time_->step(), LimitSide::right);
480 
481  // update ghost values of solution vector and prepare dependent fields
482  eq_fields_->output_field_ptr->vec().local_to_ghost_begin();
483  eq_fields_->output_stress_ptr->vec().zero_entries();
484  eq_fields_->output_cross_section_ptr->vec().zero_entries();
485  eq_fields_->output_div_ptr->vec().zero_entries();
486  eq_fields_->output_field_ptr->vec().local_to_ghost_end();
487 
488  // compute new output fields depending on solution (stress, divergence etc.)
490 
491  // update ghost values of computed fields
492  eq_fields_->output_stress_ptr->vec().local_to_ghost_begin();
493  eq_fields_->output_von_mises_stress_ptr->vec().local_to_ghost_begin();
494  eq_fields_->output_mean_stress_ptr->vec().local_to_ghost_begin();
495  eq_fields_->output_cross_section_ptr->vec().local_to_ghost_begin();
496  eq_fields_->output_div_ptr->vec().local_to_ghost_begin();
497  eq_fields_->output_stress_ptr->vec().local_to_ghost_end();
498  eq_fields_->output_von_mises_stress_ptr->vec().local_to_ghost_end();
499  eq_fields_->output_mean_stress_ptr->vec().local_to_ghost_end();
500  eq_fields_->output_cross_section_ptr->vec().local_to_ghost_end();
501  eq_fields_->output_div_ptr->vec().local_to_ghost_end();
502 }
503 
504 
505 
506 
508 {
510  eq_fields_->mark_input_times( *time_ );
511  eq_fields_->set_time(time_->step(), LimitSide::right);
512  std::stringstream ss; // print warning message with table of uninitialized fields
513  if ( FieldCommon::print_message_table(ss, "mechanics") ) {
514  WarningOut() << ss.str();
515  }
516 
517  preallocate();
518 
519 
520  // after preallocation we assemble the matrices and vectors required for balance of forces
521 // for (auto subst_idx : eq_data_->balance_idx_)
522 // balance_->calculate_instant(subst_idx, eq_data_->ls->get_solution());
523 
524 // update_solution();
525  eq_data_->ls->start_add_assembly();
526  MatSetOption(*eq_data_->ls->get_matrix(), MAT_KEEP_NONZERO_PATTERN, PETSC_TRUE);
527  eq_data_->ls->mat_zero_entries();
528  eq_data_->ls->rhs_zero_entries();
531  eq_data_->ls->finish_assembly();
532  LinSys::SolveInfo si = eq_data_->ls->solve();
533  MessageOut().fmt("[mech solver] lin. it: {}, reason: {}, residual: {}\n",
534  si.n_iterations, si.converged_reason, eq_data_->ls->compute_residual());
535  output_data();
536 }
537 
538 
539 
541 {
542  // preallocate system matrix
543  eq_data_->ls->start_allocation();
546 
547  if (has_contact_)
549 }
550 
551 
552 
553 
555 {
556  START_TIMER("DG-ONE STEP");
557 
558  next_time();
560 
562 
563  output_data();
564 
565  END_TIMER("DG-ONE STEP");
566 }
567 
569 {
570  time_->next_time();
571  time_->view("MECH");
572 
573 }
574 
575 
576 
578 {
579  START_TIMER("data reinit");
580  eq_fields_->set_time(time_->step(), LimitSide::right);
581  END_TIMER("data reinit");
582 
583  // assemble stiffness matrix
584  if (eq_data_->ls->get_matrix() == NULL
585  || eq_fields_->subset(FieldFlag::in_main_matrix).changed())
586  {
587  DebugOut() << "Mechanics: Assembling matrix.\n";
588  eq_data_->ls->start_add_assembly();
589  eq_data_->ls->mat_zero_entries();
591  eq_data_->ls->finish_assembly();
592  }
593 
594  // assemble right hand side (due to sources and boundary conditions)
595  if (eq_data_->ls->get_rhs() == NULL
596  || eq_fields_->subset(FieldFlag::in_rhs).changed())
597  {
598  DebugOut() << "Mechanics: Assembling right hand side.\n";
599  eq_data_->ls->start_add_assembly();
600  eq_data_->ls->rhs_zero_entries();
602  eq_data_->ls->finish_assembly();
603  }
604 
605  START_TIMER("solve");
606  LinSys::SolveInfo si = eq_data_->ls->solve();
607  MessageOut().fmt("[mech solver] lin. it: {}, reason: {}, residual: {}\n",
608  si.n_iterations, si.converged_reason, eq_data_->ls->compute_residual());
609  END_TIMER("solve");
610 }
611 
612 
613 
614 
615 
616 
618 {
619  START_TIMER("MECH-OUTPUT");
620 
621  // gather the solution from all processors
622  eq_fields_->output_fields.set_time( this->time().step(), LimitSide::left);
623  //if (eq_fields_->output_fields.is_field_output_time(eq_fields_->output_field, this->time().step()) )
625  eq_fields_->output_fields.output(this->time().step());
626 
627 // START_TIMER("MECH-balance");
628 // balance_->calculate_instant(subst_idx, eq_data_->ls->get_solution());
629 // balance_->output();
630 // END_TIMER("MECH-balance");
631 
632  END_TIMER("MECH-OUTPUT");
633 }
634 
635 
636 
637 
639 {
640 // if (balance_->cumulative())
641 // {
642 // balance_->calculate_cumulative(subst_idx, eq_data_->ls->get_solution());
643 // }
644 }
645 
646 
648 {
649  MatZeroEntries(eq_data_->constraint_matrix);
650  VecZeroEntries(eq_data_->constraint_vec);
652  MatAssemblyBegin(eq_data_->constraint_matrix, MAT_FINAL_ASSEMBLY);
653  MatAssemblyEnd(eq_data_->constraint_matrix, MAT_FINAL_ASSEMBLY);
654  VecAssemblyBegin(eq_data_->constraint_vec);
655  VecAssemblyEnd(eq_data_->constraint_vec);
656 }
657 
658 
#define ASSERT(expr)
Definition: asserts.hh:351
#define ASSERT_EQ(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
Definition: asserts.hh:333
static const Input::Type::Record & get_input_type()
Main balance input record type.
Definition: balance.cc:53
void create_dh(Mesh *mesh)
Create DOF handler objects.
Definition: elasticity.cc:282
static const Input::Type::Selection & get_bc_type_selection()
Definition: elasticity.cc:117
void create_dh(Mesh *mesh)
Create DOF handler objects.
Definition: elasticity.cc:294
std::shared_ptr< EqData > eq_data_
Data for model parameters.
Definition: elasticity.hh:263
static const int registrar
Registrar of class to factory.
Definition: elasticity.hh:248
void update_solution() override
Computes the solution in one time instant.
Definition: elasticity.cc:554
GenericAssembly< RhsAssemblyElasticity > * rhs_assembly_
Definition: elasticity.hh:293
void update_output_fields()
Definition: elasticity.cc:477
void assemble_constraint_matrix()
Definition: elasticity.cc:647
GenericAssembly< OutpuFieldsAssemblyElasticity > * output_fields_assembly_
Definition: elasticity.hh:295
static constexpr const char * name_
Definition: elasticity.hh:288
GenericAssembly< StiffnessAssemblyElasticity > * stiffness_assembly_
general assembly objects, hold assembly objects of appropriate dimension
Definition: elasticity.hh:292
void solve_linear_system()
Solve without updating time step and without output.
Definition: elasticity.cc:577
std::shared_ptr< OutputTime > output_stream_
Definition: elasticity.hh:279
void initialize() override
Definition: elasticity.cc:355
Input::Record input_rec
Record with input specification.
Definition: elasticity.hh:282
void calculate_cumulative_balance()
Definition: elasticity.cc:638
void output_data()
Postprocesses the solution and writes to output file.
Definition: elasticity.cc:617
~Elasticity()
Destructor.
Definition: elasticity.cc:462
static const Input::Type::Record & get_input_type()
Declare input record type for the equation TransportDG.
Definition: elasticity.cc:48
bool has_contact_
Indicator of contact conditions on fractures.
Definition: elasticity.hh:269
GenericAssembly< ConstraintAssemblyElasticity > * constraint_assembly_
Definition: elasticity.hh:294
Elasticity(Mesh &init_mesh, const Input::Record in_rec, TimeGovernor *tm=nullptr)
Constructor.
Definition: elasticity.cc:311
void zero_time_step() override
Initialize solution in the zero time.
Definition: elasticity.cc:507
std::shared_ptr< OutputEqData > output_eq_data_
Data for output parameters.
Definition: elasticity.hh:266
std::shared_ptr< EqFields > eq_fields_
Fields for model parameters.
Definition: elasticity.hh:260
void preallocate()
Definition: elasticity.cc:540
void next_time()
Pass to next time and update equation data.
Definition: elasticity.cc:568
std::shared_ptr< Balance > balance() const
Definition: equation.hh:189
static Input::Type::Record & record_template()
Template Record with common keys for derived equations.
Definition: equation.cc:39
std::shared_ptr< FieldSet > eq_fieldset_
Definition: equation.hh:249
void init_user_fields(Input::Array user_fields, FieldSet &output_fields)
Definition: equation.cc:84
TimeGovernor * time_
Definition: equation.hh:241
static Input::Type::Record & user_fields_template(std::string equation_name)
Template Record with common key user_fields for derived equations.
Definition: equation.cc:46
Mesh * mesh_
Definition: equation.hh:240
TimeGovernor & time()
Definition: equation.hh:151
static bool print_message_table(ostream &stream, std::string equation_name)
Definition: field_common.cc:95
static constexpr Mask equation_external_output
Match an output field, that can be also copy of other field.
Definition: field_flag.hh:58
static constexpr Mask in_rhs
A field is part of the right hand side of the equation.
Definition: field_flag.hh:51
static constexpr Mask in_main_matrix
A field is part of main "stiffness matrix" of the equation.
Definition: field_flag.hh:49
void assemble(std::shared_ptr< DOFHandlerMultiDim > dh) override
General assemble methods.
static auto region_id(Mesh &mesh) -> IndexField
static auto subdomain(Mesh &mesh) -> IndexField
Accessor to input data conforming to declared Array.
Definition: accessors.hh:566
Accessor to the data with type Type::Record.
Definition: accessors.hh:291
bool opt_val(const string &key, Ret &value) const
const Ret val(const string &key) const
Class for declaration of inputs sequences.
Definition: type_base.hh:339
Class for declaration of the input of type Bool.
Definition: type_base.hh:452
Class Input::Type::Default specifies default value of keys of a Input::Type::Record.
Definition: type_record.hh:61
static Default obligatory()
The factory function to make an empty default value which is obligatory.
Definition: type_record.hh:110
Record type proxy class.
Definition: type_record.hh:182
unsigned int size() const
Returns number of keys in the Record.
Definition: type_record.hh:602
Record & close() const
Close the Record for further declarations of keys.
Definition: type_record.cc:304
Record & copy_keys(const Record &other)
Copy keys from other record.
Definition: type_record.cc:216
Record & declare_key(const string &key, std::shared_ptr< TypeBase > type, const Default &default_value, const string &description, TypeBase::attribute_map key_attributes=TypeBase::attribute_map())
Declares a new key of the Record.
Definition: type_record.cc:503
Template for classes storing finite set of named values.
Selection & add_value(const int value, const std::string &key, const std::string &description="", TypeBase::attribute_map attributes=TypeBase::attribute_map())
Adds one new value with name given by key to the Selection.
const Selection & close() const
Close the Selection, no more values can be added.
static const Input::Type::Record & get_input_type()
Definition: linsys_PETSC.cc:32
void set_solution(Vec sol_vec)
Definition: linsys.hh:290
virtual void set_from_input(const Input::Record in_rec)
Definition: linsys.hh:641
Range< ElementAccessor< 3 > > elements_range() const
Returns range of mesh elements.
Definition: mesh.cc:1174
unsigned int max_edge_sides(unsigned int dim) const
Definition: mesh.h:145
Definition: mesh.h:362
static const Input::Type::Record & get_input_type()
The specification of output stream.
Definition: output_time.cc:38
static std::shared_ptr< OutputTime > create_output_stream(const std::string &equation_name, const Input::Record &in_rec, const std::shared_ptr< TimeUnitConversion > &time_unit_conv)
This method delete all object instances of class OutputTime stored in output_streams vector.
Definition: output_time.cc:187
Basic time management functionality for unsteady (and steady) solvers (class Equation).
void view(const char *name="") const
const TimeStep & step(int index=-1) const
void next_time()
Proceed to the next time according to current estimated time step.
Class for representation SI units of Fields.
Definition: unit_si.hh:40
static UnitSI & dimensionless()
Returns dimensionless unit.
Definition: unit_si.cc:55
double lame_mu(double young, double poisson)
Definition: elasticity.cc:80
double lame_lambda(double young, double poisson)
Definition: elasticity.cc:86
FEM for linear elasticity.
Definitions of basic Lagrangean finite elements with polynomial shape functions.
Definitions of Raviart-Thomas finite elements.
Class FESystem for compound finite elements.
MixedPtr< FESystem > mixed_fe_system(MixedPtr< FiniteElement > fe, Args &&... args)
Definition: fe_system.hh:176
Class FEValues calculates finite element data on the actual cells such as shape function values,...
@ FETensor
@ FEVector
PERMON QP solvers and FETI.
Solver based on the original PETSc solver using MPIAIJ matrix and succesive Schur complement construc...
#define WarningOut()
Macro defining 'warning' record of log.
Definition: logger.hh:278
#define MessageOut()
Macro defining 'message' record of log.
Definition: logger.hh:275
#define DebugOut()
Macro defining 'debug' record of log.
Definition: logger.hh:284
double Scalar
Definitions of particular quadrature rules on simplices.
int converged_reason
Definition: linsys.hh:108
#define END_TIMER(tag)
Ends a timer with specified tag.
#define START_TIMER(tag)
Starts a timer with specified tag.