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/twostep_time_solver.h"
44 #include "libmesh/newmark_solver.h"
59 _adapt_time_step_options(input),
60 _is_second_order_in_time(false)
65 libMesh::UnsteadySolver* time_solver = NULL;
69 time_solver =
new libMesh::EulerSolver( *(system) );
71 this->set_theta<libMesh::EulerSolver>(time_solver);
75 time_solver =
new libMesh::Euler2Solver( *(system) );
77 this->set_theta<libMesh::Euler2Solver>(time_solver);
81 time_solver =
new libMesh::NewmarkSolver( *(system) );
89 libMesh::TwostepTimeSolver *outer_solver =
90 new libMesh::TwostepTimeSolver(*system);
96 outer_solver->quiet =
false;
98 outer_solver->core_time_solver =
99 libMesh::UniquePtr<libMesh::UnsteadySolver>(time_solver);
100 system->time_solver = libMesh::UniquePtr<libMesh::TimeSolver>(outer_solver);
104 system->time_solver = libMesh::UniquePtr<libMesh::TimeSolver>(time_solver);
112 libmesh_assert( context.
system );
116 libMesh::Real sim_time;
128 std::time_t first_wall_time = std::time(NULL);
132 for (
unsigned int t_step=0; t_step < this->
_n_timesteps; t_step++)
134 std::time_t latest_wall_time = std::time(NULL);
136 std::cout <<
"==========================================================" << std::endl
137 <<
" Beginning time step " << t_step <<
138 ", t = " << context.
system->time <<
139 ", dt = " << context.
system->deltat <<
140 ", runtime = " << (latest_wall_time - first_wall_time) <<
142 <<
"==========================================================" << std::endl;
151 sim_time = context.
system->time;
165 libMesh::perflog.print_log();
171 context.
system->time_solver->advance_timestep();
174 std::time_t final_wall_time = std::time(NULL);
175 std::cout <<
"==========================================================" << std::endl
176 <<
" Ending time stepping, t = " << context.
system->time <<
177 ", runtime = " << (final_wall_time - first_wall_time) <<
179 <<
"==========================================================" << std::endl;
188 bool have_nonlinear_dirichlet_bc =
false;
189 bool have_time_dependence =
false;
191 const libMesh::DirichletBoundaries &db =
192 *context.
system->get_dof_map().get_dirichlet_boundaries();
194 for (libMesh::DirichletBoundaries::const_iterator
195 it = db.begin(); it != db.end(); ++it)
197 const libMesh::DirichletBoundary* bdy = *it;
200 if (bdy->f_fem.get())
201 have_nonlinear_dirichlet_bc =
true;
205 if( bdy->f->is_time_dependent() )
206 have_time_dependence =
true;
208 if( have_nonlinear_dirichlet_bc || have_time_dependence )
217 if (have_nonlinear_dirichlet_bc || have_time_dependence )
219 context.
system->reinit_constraints();
220 context.
system->get_dof_map().enforce_constraints_exactly(*context.
system);
221 context.
system->get_dof_map().enforce_constraints_exactly(*context.
system,
222 dynamic_cast<libMesh::UnsteadySolver*>(context.
system->time_solver.get())->old_local_nonlinear_solution.get());
229 libMesh::TimeSolver& base_time_solver = context.
system->get_time_solver();
231 libMesh::NewmarkSolver& time_solver = libMesh::libmesh_cast_ref<libMesh::NewmarkSolver&>(base_time_solver);
235 time_solver.set_initial_accel_avail(
true);
240 libMesh::out <<
"==========================================================" << std::endl
241 <<
" Computing Initital Acceleration" << std::endl
242 <<
"==========================================================" << std::endl;
244 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