68 "--enable-petsc, --enable-trilinos, or --enable-eigen");
71 libmesh_example_requires(LIBMESH_DIM > 2,
"3D support");
74 #ifndef LIBMESH_ENABLE_DIRICHLET
75 libmesh_example_requires(
false,
"--enable-dirichlet");
79 GetPot infile(
"fem_system_ex3.in");
82 infile.parse_command_line(argc, argv);
85 const Real deltat = infile(
"deltat", 0.25);
86 unsigned int n_timesteps = infile(
"n_timesteps", 1);
88 #ifdef LIBMESH_HAVE_EXODUS_API
89 const unsigned int write_interval = infile(
"write_interval", 1);
93 const unsigned int dim = 3;
96 libmesh_example_requires(
dim == LIBMESH_DIM,
"3D support");
119 side_max_x = 0, side_min_y = 0,
120 side_max_y = 0, side_max_z = 0;
122 found_side_max_x =
false, found_side_max_y =
false,
123 found_side_min_y =
false, found_side_max_z =
false;
124 for (
auto side : elem->side_index_range())
129 found_side_max_x =
true;
135 found_side_min_y =
true;
141 found_side_max_y =
true;
147 found_side_max_z =
true;
154 if (found_side_max_x && found_side_max_y && found_side_max_z)
155 for (
auto n : elem->node_index_range())
156 if (elem->is_node_on_side(n, side_max_x) &&
157 elem->is_node_on_side(n, side_max_y) &&
158 elem->is_node_on_side(n, side_max_z))
164 if (found_side_max_x && found_side_min_y)
165 for (
auto e : elem->edge_index_range())
166 if (elem->is_edge_on_side(e, side_max_x) &&
167 elem->is_edge_on_side(e, side_min_y))
179 std::string time_solver = infile(
"time_solver",
"DIE!");
184 if( time_solver == std::string(
"newmark") )
187 v_system = &equation_systems.add_system<
ExplicitSystem> (
"Velocity");
193 a_system = &equation_systems.add_system<
ExplicitSystem> (
"Acceleration");
199 if (time_solver == std::string(
"newmark"))
200 system.
time_solver = libmesh_make_unique<NewmarkSolver>(system);
202 else if( time_solver == std::string(
"euler") )
204 system.
time_solver = libmesh_make_unique<EulerSolver>(system);
206 euler_solver.
theta = infile(
"theta", 1.0);
209 else if( time_solver == std::string(
"euler2") )
211 system.
time_solver = libmesh_make_unique<Euler2Solver>(system);
213 euler_solver.
theta = infile(
"theta", 1.0);
216 else if( time_solver == std::string(
"steady"))
218 system.
time_solver = libmesh_make_unique<SteadySolver>(system);
219 libmesh_assert_equal_to (n_timesteps, 1);
222 libmesh_error_msg(std::string(
"ERROR: invalid time_solver ")+time_solver);
225 equation_systems.init ();
232 solver.
quiet = infile(
"solver_quiet",
true);
244 equation_systems.print_info();
249 NewtonSolver * newton_solver = dynamic_cast<NewtonSolver *>( &solver );
251 (time_solver == std::string(
"euler") || time_solver == std::string(
"euler2") ) )
253 #ifdef LIBMESH_HAVE_EIGEN_SPARSE
258 if( eigen_linear_solver )
263 if( time_solver == std::string(
"newmark") )
274 #ifdef LIBMESH_HAVE_EXODUS_API
277 std::ostringstream file_name;
280 file_name << std::string(
"out.")+time_solver+std::string(
".e-s.")
292 #endif // #ifdef LIBMESH_HAVE_EXODUS_API
296 for (
unsigned int t_step=0; t_step != n_timesteps; ++t_step)
312 if( time_solver == std::string(
"newmark") )
318 #ifdef LIBMESH_HAVE_EXODUS_API
320 if ((t_step+1)%write_interval == 0)
322 std::ostringstream file_name;
325 file_name << std::string(
"out.")+time_solver+std::string(
".e-s.")
337 #endif // #ifdef LIBMESH_HAVE_EXODUS_API