Flow123d
master-1edfbef2b
|
Go to the documentation of this file.
48 std::string equation_name = std::string(name_) +
"_FE";
50 std::string(equation_name),
51 "FEM for linear elasticity.")
54 "Settings for computing balance.")
56 "Parameters of output stream.")
58 "Linear solver for elasticity.")
61 .make_field_descriptor_type(equation_name)),
63 "Input fields of the equation.")
65 EqFields().output_fields.make_output_type(equation_name,
""),
66 IT::Default(
"{ \"fields\": [ \"displacement\" ] }"),
67 "Setting of the field output.")
72 Input::register_class< Elasticity, Mesh &, const Input::Record>(std::string(name_) +
"_FE") +
77 double lame_mu(
double young,
double poisson)
79 return young*0.5/(poisson+1.);
85 return young*poisson/((poisson+1.)*(1.-2.*poisson));
90 inline double operator() (
double young,
double poisson) {
91 return young * 0.5 / (poisson+1.);
97 inline double operator() (
double young,
double poisson) {
98 return young * poisson / ((poisson+1.)*(1.-2.*poisson));
115 return Selection(
"Elasticity_BC_Type",
"Types of boundary conditions for mechanics.")
116 .
add_value(bc_type_displacement,
"displacement",
117 "Prescribed displacement.")
118 .
add_value(bc_type_displacement_normal,
"displacement_n",
119 "Prescribed displacement in the normal direction to the boundary.")
121 "Prescribed traction.")
123 "Prescribed stress tensor.")
133 "Type of boundary condition.")
135 .input_default(
"\"traction\"")
136 .input_selection( get_bc_type_selection() )
139 *
this+=bc_displacement
140 .name(
"bc_displacement")
141 .description(
"Prescribed displacement on boundary.")
143 .input_default(
"0.0")
148 .description(
"Prescribed traction on boundary.")
150 .input_default(
"0.0")
155 .description(
"Prescribed stress on boundary.")
157 .input_default(
"0.0")
162 .description(
"Prescribed bulk load.")
163 .units(
UnitSI().N().m(-3) )
164 .input_default(
"0.0")
168 .name(
"young_modulus")
169 .description(
"Young's modulus.")
171 .input_default(
"0.0")
172 .flags_add(in_main_matrix & in_rhs);
175 .name(
"poisson_ratio")
176 .description(
"Poisson's ratio.")
177 .units(
UnitSI().dimensionless() )
178 .input_default(
"0.0")
179 .flags_add(in_main_matrix & in_rhs);
181 *
this+=fracture_sigma
182 .name(
"fracture_sigma")
184 "Coefficient of transfer of forces through fractures.")
186 .input_default(
"1.0")
187 .flags_add(in_main_matrix & in_rhs);
189 *
this+=initial_stress
190 .name(
"initial_stress")
191 .description(
"Initial stress tensor.")
193 .input_default(
"0.0")
196 *
this += region_id.name(
"region_id")
200 *
this += subdomain.name(
"subdomain")
205 .name(
"cross_section")
206 .units(
UnitSI().m(3).md() )
207 .flags(input_copy & in_time_term & in_main_matrix & in_rhs);
209 *
this+=potential_load
210 .name(
"potential_load")
212 .flags(input_copy & in_rhs);
215 .name(
"displacement")
216 .description(
"Displacement vector field output.")
218 .flags(equation_result);
220 *
this += output_stress
222 .description(
"Stress tensor output.")
224 .flags(equation_result);
226 *
this += output_von_mises_stress
227 .name(
"von_mises_stress")
228 .description(
"von Mises stress output.")
230 .flags(equation_result);
232 *
this += output_mean_stress
234 .description(
"mean stress output.")
236 .flags(equation_result);
238 *
this += output_cross_section
239 .name(
"cross_section_updated")
240 .description(
"Cross-section after deformation - output.")
242 .flags(equation_result);
244 *
this += output_divergence
245 .name(
"displacement_divergence")
246 .description(
"Displacement divergence output.")
247 .units(
UnitSI().dimensionless() )
248 .flags(equation_result);
250 *
this +=
lame_mu.name(
"lame_mu")
251 .description(
"Field lame_mu.")
252 .input_default(
"0.0")
256 .description(
"Field lame_lambda.")
257 .input_default(
"0.0")
260 *
this += dirichlet_penalty.name(
"dirichlet_penalty")
261 .description(
"Field dirichlet_penalty.")
262 .input_default(
"0.0")
266 output_fields += *
this;
272 ASSERT_EQ(fe_order, 1)(fe_order).error(
"Unsupported polynomial order for finite elements in Elasticity");
276 std::shared_ptr<DiscreteSpace> ds = std::make_shared<EqualOrderDiscreteSpace>(mesh, fe);
277 dh_ = std::make_shared<DOFHandlerMultiDim>(*mesh);
279 dh_->distribute_dofs(ds);
283 dh_scalar_ = make_shared<DOFHandlerMultiDim>(*mesh);
284 std::shared_ptr<DiscreteSpace> ds_scalar = std::make_shared<EqualOrderDiscreteSpace>( mesh, fe_p_disc);
285 dh_scalar_->distribute_dofs(ds_scalar);
289 dh_tensor_ = make_shared<DOFHandlerMultiDim>(*mesh);
290 std::shared_ptr<DiscreteSpace> dst = std::make_shared<EqualOrderDiscreteSpace>( mesh, fe_t);
291 dh_tensor_->distribute_dofs(dst);
298 stiffness_assembly_(nullptr),
299 rhs_assembly_(nullptr),
300 output_fields_assembly_(nullptr)
306 eq_data_ = std::make_shared<EqData>();
319 ASSERT( time_from_rec.
is_default() ).error(
"Duplicate key 'time', time in elasticity is already initialized from parent class!");
332 DebugOut().fmt(
"Mechanics: solution size {}\n",
eq_data_->dh_->n_global_dofs());
355 eq_fields_->output_field_ptr = create_field_fe<3, FieldValue<3>::VectorFixed>(
eq_data_->dh_);
359 eq_fields_->output_stress_ptr = create_field_fe<3, FieldValue<3>::TensorFixed>(
eq_data_->dh_tensor_);
363 eq_fields_->output_von_mises_stress_ptr = create_field_fe<3, FieldValue<3>::Scalar>(
eq_data_->dh_scalar_);
367 eq_fields_->output_mean_stress_ptr = create_field_fe<3, FieldValue<3>::Scalar>(
eq_data_->dh_scalar_);
371 eq_fields_->output_cross_section_ptr = create_field_fe<3, FieldValue<3>::Scalar>(
eq_data_->dh_scalar_);
375 eq_fields_->output_div_ptr = create_field_fe<3, FieldValue<3>::Scalar>(
eq_data_->dh_scalar_);
390 std::string petsc_default_opts;
391 petsc_default_opts =
"-ksp_type cg -pc_type hypre -pc_hypre_type boomeramg";
430 eq_fields_->output_field_ptr->vec().local_to_ghost_begin();
431 eq_fields_->output_stress_ptr->vec().zero_entries();
432 eq_fields_->output_cross_section_ptr->vec().zero_entries();
433 eq_fields_->output_div_ptr->vec().zero_entries();
434 eq_fields_->output_field_ptr->vec().local_to_ghost_end();
440 eq_fields_->output_stress_ptr->vec().local_to_ghost_begin();
441 eq_fields_->output_von_mises_stress_ptr->vec().local_to_ghost_begin();
442 eq_fields_->output_mean_stress_ptr->vec().local_to_ghost_begin();
443 eq_fields_->output_cross_section_ptr->vec().local_to_ghost_begin();
444 eq_fields_->output_div_ptr->vec().local_to_ghost_begin();
445 eq_fields_->output_stress_ptr->vec().local_to_ghost_end();
446 eq_fields_->output_von_mises_stress_ptr->vec().local_to_ghost_end();
447 eq_fields_->output_mean_stress_ptr->vec().local_to_ghost_end();
448 eq_fields_->output_cross_section_ptr->vec().local_to_ghost_end();
449 eq_fields_->output_div_ptr->vec().local_to_ghost_end();
460 std::stringstream ss;
474 MatSetOption(*
eq_data_->ls->get_matrix(), MAT_KEEP_NONZERO_PATTERN, PETSC_TRUE);
481 MessageOut().fmt(
"[mech solver] lin. it: {}, reason: {}, residual: {}\n",
529 if (
eq_data_->ls->get_matrix() == NULL
532 DebugOut() <<
"Mechanics: Assembling matrix.\n";
543 DebugOut() <<
"Mechanics: Assembling right hand side.\n";
552 MessageOut().fmt(
"[mech solver] lin. it: {}, reason: {}, residual: {}\n",
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.
static constexpr Mask in_rhs
A field is part of the right hand side of the equation.
Input::Record input_rec
Record with input specification.
Definitions of Raviart-Thomas finite elements.
void update_output_fields()
static UnitSI & dimensionless()
Returns dimensionless unit.
void next_time()
Pass to next time and update equation data.
void solve_linear_system()
Solve without updating time step and without output.
void set_initial_guess_nonzero(bool set_nonzero=true)
Class FEValues calculates finite element data on the actual cells such as shape function values,...
Solver based on the original PETSc solver using MPIAIJ matrix and succesive Schur complement construc...
static constexpr const char * name_
Class FESystem for compound finite elements.
void assemble(std::shared_ptr< DOFHandlerMultiDim > dh) override
General assemble methods.
static constexpr Mask equation_external_output
Match an output field, that can be also copy of other field.
void calculate_cumulative_balance()
Definitions of basic Lagrangean finite elements with polynomial shape functions.
std::shared_ptr< Balance > balance() const
static const int registrar
Registrar of class to factory.
void initialize() override
FEM for linear elasticity.
Definitions of particular quadrature rules on simplices.
Basic time management functionality for unsteady (and steady) solvers (class Equation).
const TimeStep & step(int index=-1) const
static auto subdomain(Mesh &mesh) -> IndexField
static bool print_message_table(ostream &stream, std::string equation_name)
Class for representation SI units of Fields.
Elasticity(Mesh &init_mesh, const Input::Record in_rec, TimeGovernor *tm=nullptr)
Constructor.
#define ASSERT_EQ(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
MixedPtr< FESystem > mixed_fe_system(MixedPtr< FiniteElement > fe, Args &&... args)
void view(const char *name="") const
std::shared_ptr< OutputTime > output_stream_
static auto region_id(Mesh &mesh) -> IndexField
static constexpr Mask in_main_matrix
A field is part of main "stiffness matrix" of the equation.
void set_from_input(const Input::Record in_rec) override
static const Input::Type::Record & get_input_type()
The specification of output stream.
#define WarningOut()
Macro defining 'warning' record of log.
double lame_mu(double young, double poisson)
static Input::Type::Record & record_template()
Template Record with common keys for derived equations.
void set_solution(Vec sol_vec)
std::shared_ptr< EqFields > eq_fields_
Fields for model parameters.
GenericAssembly< OutpuFieldsAssemblyElasticity > * output_fields_assembly_
static const Input::Type::Record & get_input_type()
Declare input record type for the equation TransportDG.
GenericAssembly< RhsAssemblyElasticity > * rhs_assembly_
void update_solution() override
Computes the solution in one time instant.
double lame_lambda(double young, double poisson)
GenericAssembly< StiffnessAssemblyElasticity > * stiffness_assembly_
general assembly objects, hold assembly objects of appropriate dimension
#define DebugOut()
Macro defining 'debug' record of log.
void next_time()
Proceed to the next time according to current estimated time step.
std::shared_ptr< EqData > eq_data_
Data for model parameters.
void create_dh(Mesh *mesh, unsigned int fe_order)
Create DOF handler objects.
#define START_TIMER(tag)
Starts a timer with specified tag.
void zero_time_step() override
Initialize solution in the zero time.
static const Input::Type::Record & get_input_type()
void output_data()
Postprocesses the solution and writes to output file.
static const Input::Type::Selection & get_bc_type_selection()
static const Input::Type::Record & get_input_type()
Main balance input record type.
#define END_TIMER(tag)
Ends a timer with specified tag.
#define MessageOut()
Macro defining 'message' record of log.