Flow123d
JS_before_hm-1727-ga1133b990
|
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.")
131 "Type of boundary condition.")
133 .input_default(
"\"traction\"")
134 .input_selection( get_bc_type_selection() )
137 *
this+=bc_displacement
138 .name(
"bc_displacement")
139 .description(
"Prescribed displacement on boundary.")
141 .input_default(
"0.0")
146 .description(
"Prescribed traction on boundary.")
148 .input_default(
"0.0")
153 .description(
"Prescribed bulk load.")
154 .units(
UnitSI().N().m(-3) )
155 .input_default(
"0.0")
159 .name(
"young_modulus")
160 .description(
"Young's modulus.")
162 .input_default(
"0.0")
163 .flags_add(in_main_matrix & in_rhs);
166 .name(
"poisson_ratio")
167 .description(
"Poisson's ratio.")
168 .units(
UnitSI().dimensionless() )
169 .input_default(
"0.0")
170 .flags_add(in_main_matrix & in_rhs);
172 *
this+=fracture_sigma
173 .name(
"fracture_sigma")
175 "Coefficient of transfer of forces through fractures.")
177 .input_default(
"1.0")
178 .flags_add(in_main_matrix & in_rhs);
180 *
this += region_id.name(
"region_id")
184 *
this += subdomain.name(
"subdomain")
189 .name(
"cross_section")
190 .units(
UnitSI().m(3).md() )
191 .flags(input_copy & in_time_term & in_main_matrix & in_rhs);
193 *
this+=potential_load
194 .name(
"potential_load")
196 .flags(input_copy & in_rhs);
199 .name(
"displacement")
200 .description(
"Displacement vector field output.")
202 .flags(equation_result);
204 *
this += output_stress
206 .description(
"Stress tensor output.")
208 .flags(equation_result);
210 *
this += output_von_mises_stress
211 .name(
"von_mises_stress")
212 .description(
"von Mises stress output.")
214 .flags(equation_result);
216 *
this += output_cross_section
217 .name(
"cross_section_updated")
218 .description(
"Cross-section after deformation - output.")
220 .flags(equation_result);
222 *
this += output_divergence
223 .name(
"displacement_divergence")
224 .description(
"Displacement divergence output.")
225 .units(
UnitSI().dimensionless() )
226 .flags(equation_result);
228 *
this +=
lame_mu.name(
"lame_mu")
229 .description(
"Field lame_mu.")
230 .input_default(
"0.0")
234 .description(
"Field lame_lambda.")
235 .input_default(
"0.0")
238 *
this += dirichlet_penalty.name(
"dirichlet_penalty")
239 .description(
"Field dirichlet_penalty.")
240 .input_default(
"0.0")
244 output_fields += *
this;
250 ASSERT_EQ(fe_order, 1)(fe_order).error(
"Unsupported polynomial order for finite elements in Elasticity");
254 std::shared_ptr<DiscreteSpace> ds = std::make_shared<EqualOrderDiscreteSpace>(mesh, fe);
255 dh_ = std::make_shared<DOFHandlerMultiDim>(*mesh);
257 dh_->distribute_dofs(ds);
261 dh_scalar_ = make_shared<DOFHandlerMultiDim>(*mesh);
262 std::shared_ptr<DiscreteSpace> ds_scalar = std::make_shared<EqualOrderDiscreteSpace>( mesh, fe_p_disc);
263 dh_scalar_->distribute_dofs(ds_scalar);
267 dh_tensor_ = make_shared<DOFHandlerMultiDim>(*mesh);
268 std::shared_ptr<DiscreteSpace> dst = std::make_shared<EqualOrderDiscreteSpace>( mesh, fe_t);
269 dh_tensor_->distribute_dofs(dst);
276 stiffness_assembly_(nullptr),
277 rhs_assembly_(nullptr),
278 output_fields_assembly_(nullptr)
284 eq_data_ = std::make_shared<EqData>();
297 ASSERT( time_from_rec.
is_default() ).error(
"Duplicate key 'time', time in elasticity is already initialized from parent class!");
310 DebugOut().fmt(
"Mechanics: solution size {}\n",
eq_data_->dh_->n_global_dofs());
333 eq_fields_->output_field_ptr = create_field_fe<3, FieldValue<3>::VectorFixed>(
eq_data_->dh_);
337 eq_fields_->output_stress_ptr = create_field_fe<3, FieldValue<3>::TensorFixed>(
eq_data_->dh_tensor_);
341 eq_fields_->output_von_mises_stress_ptr = create_field_fe<3, FieldValue<3>::Scalar>(
eq_data_->dh_scalar_);
345 eq_fields_->output_cross_section_ptr = create_field_fe<3, FieldValue<3>::Scalar>(
eq_data_->dh_scalar_);
349 eq_fields_->output_div_ptr = create_field_fe<3, FieldValue<3>::Scalar>(
eq_data_->dh_scalar_);
363 std::string petsc_default_opts;
364 petsc_default_opts =
"-ksp_type cg -pc_type hypre -pc_hypre_type boomeramg";
401 eq_fields_->output_field_ptr->vec().local_to_ghost_begin();
402 eq_fields_->output_field_ptr->vec().local_to_ghost_end();
405 eq_fields_->output_stress_ptr->vec().zero_entries();
406 eq_fields_->output_cross_section_ptr->vec().zero_entries();
407 eq_fields_->output_div_ptr->vec().zero_entries();
411 eq_fields_->output_stress_ptr->vec().local_to_ghost_begin();
412 eq_fields_->output_stress_ptr->vec().local_to_ghost_end();
413 eq_fields_->output_von_mises_stress_ptr->vec().local_to_ghost_begin();
414 eq_fields_->output_von_mises_stress_ptr->vec().local_to_ghost_end();
415 eq_fields_->output_cross_section_ptr->vec().local_to_ghost_begin();
416 eq_fields_->output_cross_section_ptr->vec().local_to_ghost_end();
417 eq_fields_->output_div_ptr->vec().local_to_ghost_begin();
418 eq_fields_->output_div_ptr->vec().local_to_ghost_end();
429 std::stringstream ss;
443 MatSetOption(*
eq_data_->ls->get_matrix(), MAT_KEEP_NONZERO_PATTERN, PETSC_TRUE);
450 MessageOut().fmt(
"[mech solver] lin. it: {}, reason: {}, residual: {}\n",
498 if (
eq_data_->ls->get_matrix() == NULL
501 DebugOut() <<
"Mechanics: Assembling matrix.\n";
512 DebugOut() <<
"Mechanics: Assembling right hand side.\n";
521 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.