Flow123d
JS_before_hm-2198-g122e1f2e2
|
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_mean_stress
227 .description(
"mean stress output.")
229 .flags(equation_result);
231 *
this += output_cross_section
232 .name(
"cross_section_updated")
233 .description(
"Cross-section after deformation - output.")
235 .flags(equation_result);
237 *
this += output_divergence
238 .name(
"displacement_divergence")
239 .description(
"Displacement divergence output.")
240 .units(
UnitSI().dimensionless() )
241 .flags(equation_result);
243 *
this +=
lame_mu.name(
"lame_mu")
244 .description(
"Field lame_mu.")
245 .input_default(
"0.0")
249 .description(
"Field lame_lambda.")
250 .input_default(
"0.0")
253 *
this += dirichlet_penalty.name(
"dirichlet_penalty")
254 .description(
"Field dirichlet_penalty.")
255 .input_default(
"0.0")
259 output_fields += *
this;
265 ASSERT_EQ(fe_order, 1)(fe_order).error(
"Unsupported polynomial order for finite elements in Elasticity");
269 std::shared_ptr<DiscreteSpace> ds = std::make_shared<EqualOrderDiscreteSpace>(mesh, fe);
270 dh_ = std::make_shared<DOFHandlerMultiDim>(*mesh);
272 dh_->distribute_dofs(ds);
276 dh_scalar_ = make_shared<DOFHandlerMultiDim>(*mesh);
277 std::shared_ptr<DiscreteSpace> ds_scalar = std::make_shared<EqualOrderDiscreteSpace>( mesh, fe_p_disc);
278 dh_scalar_->distribute_dofs(ds_scalar);
282 dh_tensor_ = make_shared<DOFHandlerMultiDim>(*mesh);
283 std::shared_ptr<DiscreteSpace> dst = std::make_shared<EqualOrderDiscreteSpace>( mesh, fe_t);
284 dh_tensor_->distribute_dofs(dst);
291 stiffness_assembly_(nullptr),
292 rhs_assembly_(nullptr),
293 output_fields_assembly_(nullptr)
299 eq_data_ = std::make_shared<EqData>();
312 ASSERT( time_from_rec.
is_default() ).error(
"Duplicate key 'time', time in elasticity is already initialized from parent class!");
325 DebugOut().fmt(
"Mechanics: solution size {}\n",
eq_data_->dh_->n_global_dofs());
348 eq_fields_->output_field_ptr = create_field_fe<3, FieldValue<3>::VectorFixed>(
eq_data_->dh_);
352 eq_fields_->output_stress_ptr = create_field_fe<3, FieldValue<3>::TensorFixed>(
eq_data_->dh_tensor_);
356 eq_fields_->output_von_mises_stress_ptr = create_field_fe<3, FieldValue<3>::Scalar>(
eq_data_->dh_scalar_);
360 eq_fields_->output_mean_stress_ptr = create_field_fe<3, FieldValue<3>::Scalar>(
eq_data_->dh_scalar_);
364 eq_fields_->output_cross_section_ptr = create_field_fe<3, FieldValue<3>::Scalar>(
eq_data_->dh_scalar_);
368 eq_fields_->output_div_ptr = create_field_fe<3, FieldValue<3>::Scalar>(
eq_data_->dh_scalar_);
383 std::string petsc_default_opts;
384 petsc_default_opts =
"-ksp_type cg -pc_type hypre -pc_hypre_type boomeramg";
423 eq_fields_->output_field_ptr->vec().local_to_ghost_begin();
424 eq_fields_->output_field_ptr->vec().local_to_ghost_end();
427 eq_fields_->output_stress_ptr->vec().zero_entries();
428 eq_fields_->output_cross_section_ptr->vec().zero_entries();
429 eq_fields_->output_div_ptr->vec().zero_entries();
433 eq_fields_->output_stress_ptr->vec().local_to_ghost_begin();
434 eq_fields_->output_stress_ptr->vec().local_to_ghost_end();
435 eq_fields_->output_von_mises_stress_ptr->vec().local_to_ghost_begin();
436 eq_fields_->output_von_mises_stress_ptr->vec().local_to_ghost_end();
437 eq_fields_->output_mean_stress_ptr->vec().local_to_ghost_begin();
438 eq_fields_->output_mean_stress_ptr->vec().local_to_ghost_end();
439 eq_fields_->output_cross_section_ptr->vec().local_to_ghost_begin();
440 eq_fields_->output_cross_section_ptr->vec().local_to_ghost_end();
441 eq_fields_->output_div_ptr->vec().local_to_ghost_begin();
442 eq_fields_->output_div_ptr->vec().local_to_ghost_end();
453 std::stringstream ss;
467 MatSetOption(*
eq_data_->ls->get_matrix(), MAT_KEEP_NONZERO_PATTERN, PETSC_TRUE);
474 MessageOut().fmt(
"[mech solver] lin. it: {}, reason: {}, residual: {}\n",
522 if (
eq_data_->ls->get_matrix() == NULL
525 DebugOut() <<
"Mechanics: Assembling matrix.\n";
536 DebugOut() <<
"Mechanics: Assembling right hand side.\n";
545 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.