141 #if !defined(LIBMESH_HAVE_PETSC) && (!defined(LIBMESH_TRILINOS_HAVE_NOX) || !defined(LIBMESH_TRILINOS_HAVE_EPETRA)) 142 libmesh_example_requires(
false,
"--enable-petsc or --enable-trilinos");
147 libMesh::err <<
"This example requires a NonlinearSolver, and therefore does not " 148 <<
"support --use-eigen on the command line." 153 #ifndef LIBMESH_ENABLE_AMR 154 libmesh_example_requires(
false,
"--enable-amr");
158 GetPot command_line (argc, argv);
161 libmesh_error_msg_if(argc < 3,
"Usage:\n" <<
"\t " << argv[0] <<
" -r 2");
167 for (
int i=1; i<argc; i++)
176 std::string order =
"FIRST";
181 std::string family =
"LAGRANGE";
186 libmesh_error_msg_if((family ==
"MONOMIAL") || (family ==
"XYZ"),
187 "This example requires a C^0 (or higher) FE basis.");
191 #ifdef LIBMESH_HAVE_PETSC 193 # if PETSC_VERSION_LESS_THAN(3,7,0) 194 LibmeshPetscCall2(
init.comm(), PetscOptionsSetValue(
"-snes_mf_operator",
195 LIBMESH_PETSC_NULLPTR));
197 LibmeshPetscCall2(
init.comm(), PetscOptionsSetValue(LIBMESH_PETSC_NULLPTR,
"-snes_mf_operator",
198 LIBMESH_PETSC_NULLPTR));
201 libMesh::err <<
"Must be using PETSc to use jacobian based preconditioning" << std::endl;
205 #endif //LIBMESH_HAVE_PETSC 209 libmesh_example_requires(2 <= LIBMESH_DIM,
"2D support");
217 if (order !=
"FIRST")
237 equation_systems.parameters.set<
unsigned int> (
"nonlinear solver maximum iterations") = 50;
243 Utility::string_to_enum<Order> (order),
244 Utility::string_to_enum<FEFamily>(family));
254 equation_systems.init();
257 equation_systems.print_info();
261 equation_systems.get_system(
"Laplace-Young").solve();
266 libMesh::out <<
"Laplace-Young system solved at nonlinear iteration " 268 <<
" , final nonlinear residual norm: " 272 #ifdef LIBMESH_HAVE_EXODUS_API 276 #endif // #ifdef LIBMESH_HAVE_EXODUS_API 277 #endif // #ifndef LIBMESH_ENABLE_AMR
T command_line_next(std::string name, T default_value)
Use GetPot's search()/next() functions to get following arguments from the command line...
This is the EquationSystems class.
virtual void read(const std::string &name, void *mesh_data=nullptr, bool skip_renumber_nodes_and_elements=false, bool skip_find_neighbors=false)=0
Interfaces for reading/writing a mesh to/from a file.
std::unique_ptr< NonlinearSolver< Number > > nonlinear_solver
The NonlinearSolver defines the default interface used to solve the nonlinear_implicit system...
The ExodusII_IO class implements reading meshes in the ExodusII file format from Sandia National Labs...
unsigned int n_nonlinear_iterations() const
The LibMeshInit class, when constructed, initializes the dependent libraries (e.g.
Parameters parameters
Parameters for the system. If a parameter is not provided, it should be retrieved from the EquationSy...
Real final_nonlinear_residual() const
Implements (adaptive) mesh refinement algorithms for a MeshBase.
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.
A class which provides the residual and jacobian assembly functions for the Laplace-Young system of e...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
T & set(const std::string &)
void all_second_order(const bool full_ordered=true)
Calls the range-based version of this function with a range consisting of all elements in the mesh...
bool on_command_line(std::string arg)
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
void uniformly_refine(unsigned int n=1)
Uniformly refines the mesh n times.