23#include "libmesh/equation_systems.h"
24#include "libmesh/getpot.h"
25#include "libmesh/libmesh.h"
26#include "libmesh/libmesh_logging.h"
27#include "libmesh/mesh.h"
28#include "libmesh/mesh_generation.h"
29#include "libmesh/numeric_vector.h"
30#include "libmesh/string_to_enum.h"
31#include "libmesh/time_solver.h"
32#include "libmesh/transient_system.h"
33#include "libmesh/vtk_io.h"
34#include "libmesh/enum_solver_package.h"
58 ElemType eltype = Utility::string_to_enum<ElemType>(args(
"mesh/generation/element_type",
"hex8"));
59 int nx = args(
"mesh/generation/num_elem", 4, 0);
60 int ny = args(
"mesh/generation/num_elem", 4, 1);
61 int nz =
dim > 2 ? args(
"mesh/generation/num_elem", 4, 2) : 0;
62 double origx = args(
"mesh/generation/origin", -1.0, 0);
63 double origy = args(
"mesh/generation/origin", -1.0, 1);
64 double origz = args(
"mesh/generation/origin", 0.0, 2);
65 double sizex = args(
"mesh/generation/size", 2.0, 0);
66 double sizey = args(
"mesh/generation/size", 2.0, 1);
67 double sizez = args(
"mesh/generation/size", 2.0, 2);
69 origx, origx+sizex, origy, origy+sizey, origz, origz+sizez, eltype);
99#ifdef LIBMESH_HAVE_VTK
100 std::unique_ptr<VTKIO> io = std::make_unique<VTKIO>(systems.
get_mesh());
103 Real duration = args(
"duration", 1.0);
105 for (
unsigned int t_step = 0; t_step < duration/solid_system.deltat; t_step++)
108 Real progress = t_step * solid_system.deltat / duration;
114 out <<
"===== Time Step " << std::setw(4) << t_step;
115 out <<
" (" << std::fixed << std::setprecision(2) << std::setw(6) << (progress*100.) <<
"%)";
116 out <<
", time = " << std::setw(7) << solid_system.time;
117 out <<
" =====" << std::endl;
120 aux_system.current_local_solution->close();
125 out <<
"Solving Solid" << std::endl;
126 solid_system.solve();
127 aux_system.current_local_solution->close();
128 *aux_system.solution = *aux_system.current_local_solution;
129 aux_system.solution->close();
132 out <<
"Doing a reinit of the equation systems" << std::endl;
135#ifdef LIBMESH_HAVE_VTK
136 if (t_step % args(
"output/frequency", 1) == 0)
138 std::stringstream file_name;
139 file_name << args(
"results_directory",
"./")
146 io->write_equation_systems(file_name.str(), systems);
150 out <<
"Advancing to next step" << std::endl;
151 solid_system.time_solver->advance_timestep();
157int main(
int argc,
char ** argv)
164 "--enable-petsc, --enable-trilinos, or --enable-eigen");
174 libMesh::out <<
"We skip fem_system_ex2 when using threads.\n"
180 GetPot args = GetPot(
"solid.in");
183 args.parse_command_line(argc, argv);
186 int dim = args(
"mesh/generation/dimension", 3);
187 libmesh_example_requires(
dim <= LIBMESH_DIM,
"3D support");
190 Mesh mesh(init.comm(), cast_int<unsigned char>(
dim));
200 out <<
"Finished calculations" << std::endl;
This is the EquationSystems class.
virtual void reinit()
Handle any mesh changes and reinitialize all the systems on the updated mesh.
const MeshBase & get_mesh() const
Parameters parameters
Data structure holding arbitrary parameters.
virtual void init()
Initialize all the systems.
virtual System & add_system(std::string_view system_type, std::string_view name)
Add the system of type system_type named name to the systems array.
const T_sys & get_system(std::string_view name) const
Manages consistently variables, degrees of freedom, and coefficient vectors for explicit systems.
The LibMeshInit class, when constructed, initializes the dependent libraries (e.g.
unsigned int mesh_dimension() const
void print_info(std::ostream &os=libMesh::out, const unsigned int verbosity=0, const bool global=true) const
Prints relevant information about the mesh.
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
virtual void close()=0
Calls the NumericVector's internal assembly routines, ensuring that the values are consistent across ...
T & set(const std::string &)
std::unique_ptr< NumericVector< Number > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
Manages storage and variables for transient systems.
NumericVector< Number > * older_local_solution
All the values I need to compute my contribution to the simulation at hand.
NumericVector< Number > * old_local_solution
All the values I need to compute my contribution to the simulation at hand.
void run_timestepping(EquationSystems &systems, GetPot &args)
void setup(EquationSystems &systems, Mesh &mesh, GetPot &args)
The libMesh namespace provides an interface to certain functionality in the library.
ElemType
Defines an enum for geometric element types.
SolverPackage default_solver_package()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real