Go to the documentation of this file.
18 #include "libmesh/diff_system.h"
19 #include "libmesh/newmark_solver.h"
20 #include "libmesh/dof_map.h"
21 #include "libmesh/diff_solver.h"
29 _is_accel_solve(false),
30 _initial_accel_set(false)
68 std::unique_ptr<NumericVector<Number>> new_solution_rate = nonlinear_solution.
clone();
69 (*new_solution_rate) -= old_nonlinear_soln;
77 std::unique_ptr<NumericVector<Number>> new_solution_accel =
old_solution_accel.clone();
78 (*new_solution_accel) *= -(1.0/(2.0*
_beta)-1.0);
103 libmesh_not_implemented();
153 std::string error =
"ERROR: Must first set initial acceleration using one of:\n";
154 error +=
"NewmarkSolver::compute_initial_accel()\n";
155 error +=
"NewmarkSolver::project_initial_accel()\n";
156 libmesh_error_msg(error);
209 ResFuncType time_deriv,
210 ResFuncType constraint,
211 ReinitFuncType reinit_func)
221 for (
unsigned int i=0; i != n_dofs; ++i)
222 old_elem_solution_rate(i) =
236 for (
unsigned int i=0; i != n_dofs; ++i)
237 old_elem_solution(i) =
259 request_jacobian =
false;
265 if (request_jacobian)
270 for (
unsigned int i=0; i != n_dofs; ++i)
271 old_elem_solution(i) =
276 for (
unsigned int i=0; i != n_dofs; ++i)
277 old_elem_solution_accel(i) =
312 (context.*reinit_func)(1.);
320 bool jacobian_computed = (
_system.
get_physics()->*time_deriv)(request_jacobian, context);
331 jacobian_computed = (
_system.
get_physics()->*constraint)(jacobian_computed, context) &&
335 if (request_jacobian)
337 if (jacobian_computed)
343 return jacobian_computed;
virtual bool nonlocal_mass_residual(bool request_jacobian, DiffContext &c)
Subtracts any nonlocal mass vector contributions (e.g.
virtual bool side_constraint(bool request_jacobian, DiffContext &)
Adds the constraint contribution on side of elem to elem_residual.
Real deltat
For time-dependent problems, this is the amount delta t to advance the solution in time.
virtual void add(const numeric_index_type i, const T value)=0
Adds value to each entry of the vector.
void project_vector(NumericVector< Number > &new_vector, FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr, int is_adjoint=-1) const
Projects arbitrary functions onto a vector of degree of freedom values for the current system.
const std::vector< dof_id_type > & get_dof_indices() const
Accessor for element dof indices.
virtual bool _general_residual(bool request_jacobian, DiffContext &, ResFuncType mass, ResFuncType damping, ResFuncType time_deriv, ResFuncType constraint, ReinitFuncType reinit)
This method is the underlying implementation of the public residual methods.
virtual void elem_reinit(Real)
Gives derived classes the opportunity to reinitialize data (FE objects in FEMSystem,...
bool _is_accel_solve
Need to be able to indicate to _general_residual if we are doing an acceleration solve or not.
Real _gamma
The value for to employ.
std::unique_ptr< DiffSolver > _diff_solver
An implicit linear or nonlinear solver to use at each timestep.
The libMesh namespace provides an interface to certain functionality in the library.
std::unique_ptr< NumericVector< Number > > _old_local_solution_rate
Serial vector of previous time step velocity .
virtual bool nonlocal_constraint(bool request_jacobian, DiffContext &)
Adds any nonlocal constraint contributions (e.g.
virtual ~NewmarkSolver()
Destructor.
virtual std::unique_ptr< NumericVector< T > > clone() const =0
virtual bool side_damping_residual(bool request_jacobian, DiffContext &)
Subtracts a damping vector contribution on side of elem from elem_residual.
This class provides a specific system class.
virtual void adjoint_advance_timestep() override
This method advances the adjoint solution to the previous timestep, after an adjoint_solve() has been...
virtual void nonlocal_reinit(Real)
Gives derived classes the opportunity to reinitialize data needed for nonlocal calculations at a new ...
bool _eulerian_time_deriv(bool request_jacobian, DiffContext &)
This method simply combines element_time_derivative() and eulerian_residual(), which makes its addres...
Number old_solution_accel(const dof_id_type global_dof_number) const
bool use_fixed_solution
A boolean to be set to true by systems using elem_fixed_solution, for optional use by e....
Number old_nonlinear_solution(const dof_id_type global_dof_number) const
virtual bool nonlocal_time_derivative(bool request_jacobian, DiffContext &)
Adds any nonlocal time derivative contributions (e.g.
virtual bool element_residual(bool request_jacobian, DiffContext &) override
This method uses the DifferentiablePhysics' element_time_derivative() and element_constraint() to bui...
boostcopy::enable_if_c< ScalarTraits< T2 >::value, void >::type add(const T2 factor, const DenseVector< T3 > &vec)
Adds factor times vec to this vector.
Real elem_solution_accel_derivative
The derivative of elem_solution_accel with respect to the current nonlinear solution,...
virtual bool element_constraint(bool request_jacobian, DiffContext &)
Adds the constraint contribution on elem to elem_residual.
void swap(DenseMatrix< T > &other_matrix)
STL-like swap method.
void set_initial_accel_avail(bool initial_accel_set)
Allow the user to (re)set whether the initial acceleration is available.
virtual bool side_mass_residual(bool request_jacobian, DiffContext &)
Subtracts a mass vector contribution on side of elem from elem_residual.
void project_initial_accel(FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr)
Specify non-zero initial acceleration.
bool _initial_accel_set
This method requires an initial acceleration.
Generic class from which second order UnsteadySolvers should subclass.
sys_type & _system
A reference to the system we are solving.
virtual unsigned int size() const override
const std::vector< dof_id_type > & get_send_list() const
This class provides all data required for a physics package (e.g.
Real _beta
The value for the to employ.
Number old_solution_rate(const dof_id_type global_dof_number) const
Real elem_solution_derivative
The derivative of elem_solution with respect to the current nonlinear solution.
virtual void compute_initial_accel()
This method uses the specified initial displacement and velocity to compute the initial acceleration ...
bool first_solve
A bool that will be true the first time solve() is called, and false thereafter.
NewmarkSolver(sys_type &s)
Constructor.
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
Real elem_solution_rate_derivative
The derivative of elem_solution_rate with respect to the current nonlinear solution,...
const DenseMatrix< Number > & get_elem_jacobian() const
Const accessor for element Jacobian.
virtual void advance_timestep() override
This method advances the solution to the next timestep, after a solve() has been performed.
const DenseVector< Number > & get_elem_solution() const
Accessor for element solution.
virtual void advance_timestep() override
This method advances the solution to the next timestep, after a solve() has been performed.
const DifferentiablePhysics * get_physics() const
const DenseVector< Number > & get_elem_fixed_solution() const
Accessor for element fixed solution.
std::unique_ptr< NumericVector< Number > > _old_local_solution_accel
Serial vector of previous time step acceleration .
const DofMap & get_dof_map() const
const DenseVector< Number > & get_elem_solution_rate() const
Accessor for element solution rate of change w.r.t.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual bool mass_residual(bool request_jacobian, DiffContext &)
Subtracts a mass vector contribution on elem from elem_residual.
virtual bool side_time_derivative(bool request_jacobian, DiffContext &)
Adds the time derivative contribution on side of elem to elem_residual.
virtual bool nonlocal_residual(bool request_jacobian, DiffContext &) override
This method uses the DifferentiablePhysics' nonlocal_time_derivative() and nonlocal_constraint() to b...
virtual Real error_order() const override
Error convergence order: 2 for , 1 otherwise.
const DenseVector< Number > & get_elem_solution_accel() const
Accessor for element solution accel of change w.r.t.
const NumericVector< Number > & get_vector(const std::string &vec_name) const
virtual bool side_residual(bool request_jacobian, DiffContext &) override
This method uses the DifferentiablePhysics' side_time_derivative() and side_constraint() to build a f...
virtual void update()
Update the local values to reflect the solution on neighboring processors.
virtual bool damping_residual(bool request_jacobian, DiffContext &)
Subtracts a damping vector contribution on elem from elem_residual.
virtual void solve() override
This method solves for the solution at the next timestep.
virtual void elem_side_reinit(Real)
Gives derived classes the opportunity to reinitialize data needed for a side integration at a new poi...
virtual bool nonlocal_damping_residual(bool request_jacobian, DiffContext &)
Subtracts any nonlocal damping vector contributions (e.g.
virtual void solve() override
This method solves for the solution at the next timestep.