517 libmesh_example_requires(LIBMESH_DIM > 2,
"--disable-1D-only --disable-2D-only");
520 #ifndef LIBMESH_ENABLE_DIRICHLET 521 libmesh_example_requires(
false,
"--enable-dirichlet");
524 GetPot infile(
"systems_of_equations_ex7.in");
526 infile.parse_command_line(argc,argv);
528 const Real x_length = infile(
"x_length", 0.);
529 const Real y_length = infile(
"y_length", 0.);
530 const Real z_length = infile(
"z_length", 0.);
531 const int n_elem_x = infile(
"n_elem_x", 0);
532 const int n_elem_y = infile(
"n_elem_y", 0);
533 const int n_elem_z = infile(
"n_elem_z", 0);
534 const std::string approx_order = infile(
"approx_order",
"FIRST");
535 const std::string fe_family = infile(
"fe_family",
"LAGRANGE");
537 const Real young_modulus = infile(
"Young_modulus", 1.0);
538 const Real poisson_ratio = infile(
"poisson_ratio", 0.3);
539 const Real forcing_magnitude = infile(
"forcing_magnitude", 0.001);
541 const Real nonlinear_abs_tol = infile(
"nonlinear_abs_tol", 1.e-8);
542 const Real nonlinear_rel_tol = infile(
"nonlinear_rel_tol", 1.e-8);
543 const unsigned int nonlinear_max_its = infile(
"nonlinear_max_its", 50);
545 const unsigned int n_solves = infile(
"n_solves", 10);
546 const Real force_scaling = infile(
"force_scaling", 5.0);
570 Utility::string_to_enum<Order> (approx_order),
571 Utility::string_to_enum<FEFamily>(fe_family));
575 Utility::string_to_enum<Order> (approx_order),
576 Utility::string_to_enum<FEFamily>(fe_family));
580 Utility::string_to_enum<Order> (approx_order),
581 Utility::string_to_enum<FEFamily>(fe_family));
593 equation_systems.parameters.set<
Real> (
"nonlinear solver absolute residual tolerance") = nonlinear_abs_tol;
594 equation_systems.parameters.set<
Real> (
"nonlinear solver relative residual tolerance") = nonlinear_rel_tol;
595 equation_systems.parameters.set<
unsigned int> (
"nonlinear solver maximum iterations") = nonlinear_max_its;
600 equation_systems.parameters.set<
Real>(
"young_modulus") = young_modulus;
601 equation_systems.parameters.set<
Real>(
"poisson_ratio") = poisson_ratio;
602 equation_systems.parameters.set<
Real>(
"forcing_magnitude") = forcing_magnitude;
604 #ifdef LIBMESH_ENABLE_DIRICHLET 613 #endif // LIBMESH_ENABLE_DIRICHLET 616 equation_systems.init();
617 equation_systems.print_info();
624 for (
unsigned int count=0; count<n_solves; count++)
626 Real previous_forcing_magnitude = equation_systems.parameters.get<
Real>(
"forcing_magnitude");
627 equation_systems.parameters.set<
Real>(
"forcing_magnitude") = previous_forcing_magnitude*force_scaling;
631 <<
", forcing_magnitude: " 632 << equation_systems.parameters.
get<
Real>(
"forcing_magnitude")
639 <<
" , final nonlinear residual norm: " 646 lde.compute_stresses();
648 #ifdef LIBMESH_HAVE_EXODUS_API 649 std::stringstream filename;
650 filename <<
"solution_" << count <<
".exo";
This is the EquationSystems class.
std::unique_ptr< NonlinearSolver< Number > > nonlinear_solver
The NonlinearSolver defines the default interface used to solve the nonlinear_implicit system...
ConstFunction that simply returns 0.
The ExodusII_IO class implements reading meshes in the ExodusII file format from Sandia National Labs...
This class allows one to associate Dirichlet boundary values with a given set of mesh boundary ids an...
unsigned int n_nonlinear_iterations() const
The LibMeshInit class, when constructed, initializes the dependent libraries (e.g.
SolverPackage default_solver_package()
void libmesh_ignore(const Args &...)
Real final_nonlinear_residual() const
virtual void write_equation_systems(const std::string &fname, const EquationSystems &es, const std::set< std::string > *system_names=nullptr) override
Writes out the solution for no specific time or timestep.
void print_info(std::ostream &os=libMesh::out, const unsigned int verbosity=0, const bool global=true) const
Prints relevant information about the mesh.
void init(triangulateio &t)
Initializes the fields of t to nullptr/0 as necessary.
Manages consistently variables, degrees of freedom, coefficient vectors, matrices and non-linear solv...
unsigned int add_variable(std::string_view var, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
Adds the variable var to the list of variables for this system.
void prefer_hash_table_matrix_assembly(bool preference)
Sets whether to use hash table matrix assembly if the matrix sub-classes support it.
virtual void solve() override
Assembles & solves the nonlinear system R(x) = 0.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void add_dirichlet_boundary(const DirichletBoundary &dirichlet_boundary)
Adds a copy of the specified Dirichlet boundary to the system.
streamT * get()
Rather than implement every ostream/ios/ios_base function, we'll be lazy and make esoteric uses go th...
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
const DofMap & get_dof_map() const
Manages consistently variables, degrees of freedom, and coefficient vectors for explicit systems...