38 #include "libmesh/dirichlet_boundaries.h"
39 #include "libmesh/dof_map.h"
40 #include "libmesh/getpot.h"
41 #include "libmesh/euler_solver.h"
42 #include "libmesh/euler2_solver.h"
43 #include "libmesh/function_base.h"
44 #include "libmesh/twostep_time_solver.h"
45 #include "libmesh/newmark_solver.h"
46 #include "libmesh/function_base.h"
61 _adapt_time_step_options(input),
62 _is_second_order_in_time(false)
67 libMesh::UnsteadySolver* time_solver = NULL;
71 time_solver =
new libMesh::EulerSolver( *(system) );
73 this->set_theta<libMesh::EulerSolver>(time_solver);
77 time_solver =
new libMesh::Euler2Solver( *(system) );
79 this->set_theta<libMesh::Euler2Solver>(time_solver);
83 time_solver =
new libMesh::NewmarkSolver( *(system) );
91 libMesh::TwostepTimeSolver *outer_solver =
92 new libMesh::TwostepTimeSolver(*system);
98 outer_solver->quiet =
false;
100 outer_solver->core_time_solver =
101 libMesh::UniquePtr<libMesh::UnsteadySolver>(time_solver);
102 system->time_solver = libMesh::UniquePtr<libMesh::TimeSolver>(outer_solver);
106 system->time_solver = libMesh::UniquePtr<libMesh::TimeSolver>(time_solver);
114 libmesh_assert( context.
system );
118 libMesh::Real sim_time;
130 std::time_t first_wall_time = std::time(NULL);
134 for (
unsigned int t_step=0; t_step < this->
_n_timesteps; t_step++)
136 std::time_t latest_wall_time = std::time(NULL);
138 std::cout <<
"==========================================================" << std::endl
139 <<
" Beginning time step " << t_step <<
140 ", t = " << context.
system->time <<
141 ", dt = " << context.
system->deltat <<
142 ", runtime = " << (latest_wall_time - first_wall_time) <<
144 <<
"==========================================================" << std::endl;
152 sim_time = context.
system->time;
166 libMesh::perflog.print_log();
172 context.
system->time_solver->advance_timestep();
175 std::time_t final_wall_time = std::time(NULL);
176 std::cout <<
"==========================================================" << std::endl
177 <<
" Ending time stepping, t = " << context.
system->time <<
178 ", runtime = " << (final_wall_time - first_wall_time) <<
180 <<
"==========================================================" << std::endl;
189 bool have_nonlinear_dirichlet_bc =
false;
190 bool have_time_dependence =
false;
192 const libMesh::DirichletBoundaries &db =
193 *context.
system->get_dof_map().get_dirichlet_boundaries();
195 for (libMesh::DirichletBoundaries::const_iterator
196 it = db.begin(); it != db.end(); ++it)
198 const libMesh::DirichletBoundary* bdy = *it;
201 if (bdy->f_fem.get())
202 have_nonlinear_dirichlet_bc =
true;
206 if( bdy->f->is_time_dependent() )
207 have_time_dependence =
true;
209 if( have_nonlinear_dirichlet_bc || have_time_dependence )
218 if (have_nonlinear_dirichlet_bc || have_time_dependence )
220 context.
system->reinit_constraints();
221 context.
system->get_dof_map().enforce_constraints_exactly(*context.
system);
222 context.
system->get_dof_map().enforce_constraints_exactly(*context.
system,
223 dynamic_cast<libMesh::UnsteadySolver*>(context.
system->time_solver.get())->old_local_nonlinear_solution.get());
230 libMesh::TimeSolver& base_time_solver = context.
system->get_time_solver();
232 libMesh::NewmarkSolver& time_solver = libMesh::cast_ref<libMesh::NewmarkSolver&>(base_time_solver);
236 time_solver.set_initial_accel_avail(
true);
241 libMesh::out <<
"==========================================================" << std::endl
242 <<
" Computing Initital Acceleration" << std::endl
243 <<
"==========================================================" << std::endl;
245 time_solver.compute_initial_accel();
std::string _time_solver_name
double target_tolerance() const
unsigned int _n_timesteps
SharedPtr< libMesh::EquationSystems > equation_system
SharedPtr< PostProcessedQuantities< libMesh::Real > > postprocessing
double max_growth() const
UnsteadySolver(const GetPot &input)
static const std::string libmesh_euler2_solver()
const libMesh::SystemNorm & component_norm()
unsigned int timesteps_per_perflog
virtual void init_time_solver(GRINS::MultiphysicsSystem *system)
AdaptiveTimeSteppingOptions _adapt_time_step_options
bool _is_second_order_in_time
Track whether is this a second order (in time) solver or not.
unsigned int timesteps_per_vis
unsigned int _backtrack_deltat
double upper_tolerance() const
GRINS::MultiphysicsSystem * system
SharedPtr< GRINS::Visualization > vis
void print_scalar_vars(SolverContext &context)
Interface with libMesh for solving Multiphysics problems.
virtual void solve(SolverContext &context)
static const std::string libmesh_euler_solver()
Simple class to hold objects passed to Solver::solve.
static const std::string libmesh_newmark_solver()
void update_dirichlet_bcs(SolverContext &context)
Updates Dirichlet boundary conditions.
void init_second_order_in_time_solvers(SolverContext &context)
bool is_time_adaptive() const