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