Flow123d
JS_before_hm-2196-g9bdbf60c0
|
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 += region_id.name(
"region_id")
193 *
this += subdomain.name(
"subdomain")
198 .name(
"cross_section")
199 .units(
UnitSI().m(3).md() )
200 .flags(input_copy & in_time_term & in_main_matrix & in_rhs);
202 *
this+=potential_load
203 .name(
"potential_load")
205 .flags(input_copy & in_rhs);
208 .name(
"displacement")
209 .description(
"Displacement vector field output.")
211 .flags(equation_result);
213 *
this += output_stress
215 .description(
"Stress tensor output.")
217 .flags(equation_result);
219 *
this += output_von_mises_stress
220 .name(
"von_mises_stress")
221 .description(
"von Mises stress output.")
223 .flags(equation_result);
225 *
this += output_cross_section
226 .name(
"cross_section_updated")
227 .description(
"Cross-section after deformation - output.")
229 .flags(equation_result);
231 *
this += output_divergence
232 .name(
"displacement_divergence")
233 .description(
"Displacement divergence output.")
234 .units(
UnitSI().dimensionless() )
235 .flags(equation_result);
237 *
this +=
lame_mu.name(
"lame_mu")
238 .description(
"Field lame_mu.")
239 .input_default(
"0.0")
243 .description(
"Field lame_lambda.")
244 .input_default(
"0.0")
247 *
this += dirichlet_penalty.name(
"dirichlet_penalty")
248 .description(
"Field dirichlet_penalty.")
249 .input_default(
"0.0")
253 output_fields += *
this;
259 ASSERT_EQ(fe_order, 1)(fe_order).error(
"Unsupported polynomial order for finite elements in Elasticity");
263 std::shared_ptr<DiscreteSpace> ds = std::make_shared<EqualOrderDiscreteSpace>(mesh, fe);
264 dh_ = std::make_shared<DOFHandlerMultiDim>(*mesh);
266 dh_->distribute_dofs(ds);
270 dh_scalar_ = make_shared<DOFHandlerMultiDim>(*mesh);
271 std::shared_ptr<DiscreteSpace> ds_scalar = std::make_shared<EqualOrderDiscreteSpace>( mesh, fe_p_disc);
272 dh_scalar_->distribute_dofs(ds_scalar);
276 dh_tensor_ = make_shared<DOFHandlerMultiDim>(*mesh);
277 std::shared_ptr<DiscreteSpace> dst = std::make_shared<EqualOrderDiscreteSpace>( mesh, fe_t);
278 dh_tensor_->distribute_dofs(dst);
285 stiffness_assembly_(nullptr),
286 rhs_assembly_(nullptr),
287 output_fields_assembly_(nullptr)
293 eq_data_ = std::make_shared<EqData>();
306 ASSERT( time_from_rec.
is_default() ).error(
"Duplicate key 'time', time in elasticity is already initialized from parent class!");
319 DebugOut().fmt(
"Mechanics: solution size {}\n",
eq_data_->dh_->n_global_dofs());
342 eq_fields_->output_field_ptr = create_field_fe<3, FieldValue<3>::VectorFixed>(
eq_data_->dh_);
346 eq_fields_->output_stress_ptr = create_field_fe<3, FieldValue<3>::TensorFixed>(
eq_data_->dh_tensor_);
350 eq_fields_->output_von_mises_stress_ptr = create_field_fe<3, FieldValue<3>::Scalar>(
eq_data_->dh_scalar_);
354 eq_fields_->output_cross_section_ptr = create_field_fe<3, FieldValue<3>::Scalar>(
eq_data_->dh_scalar_);
358 eq_fields_->output_div_ptr = create_field_fe<3, FieldValue<3>::Scalar>(
eq_data_->dh_scalar_);
373 std::string petsc_default_opts;
374 petsc_default_opts =
"-ksp_type cg -pc_type hypre -pc_hypre_type boomeramg";
413 eq_fields_->output_field_ptr->vec().local_to_ghost_begin();
414 eq_fields_->output_field_ptr->vec().local_to_ghost_end();
417 eq_fields_->output_stress_ptr->vec().zero_entries();
418 eq_fields_->output_cross_section_ptr->vec().zero_entries();
419 eq_fields_->output_div_ptr->vec().zero_entries();
423 eq_fields_->output_stress_ptr->vec().local_to_ghost_begin();
424 eq_fields_->output_stress_ptr->vec().local_to_ghost_end();
425 eq_fields_->output_von_mises_stress_ptr->vec().local_to_ghost_begin();
426 eq_fields_->output_von_mises_stress_ptr->vec().local_to_ghost_end();
427 eq_fields_->output_cross_section_ptr->vec().local_to_ghost_begin();
428 eq_fields_->output_cross_section_ptr->vec().local_to_ghost_end();
429 eq_fields_->output_div_ptr->vec().local_to_ghost_begin();
430 eq_fields_->output_div_ptr->vec().local_to_ghost_end();
441 std::stringstream ss;
455 MatSetOption(*
eq_data_->ls->get_matrix(), MAT_KEEP_NONZERO_PATTERN, PETSC_TRUE);
462 MessageOut().fmt(
"[mech solver] lin. it: {}, reason: {}, residual: {}\n",
510 if (
eq_data_->ls->get_matrix() == NULL
513 DebugOut() <<
"Mechanics: Assembling matrix.\n";
524 DebugOut() <<
"Mechanics: Assembling right hand side.\n";
533 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)
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library.
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)
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.