21 #include "libmesh/newmark_system.h" 22 #include "libmesh/equation_systems.h" 23 #include "libmesh/sparse_matrix.h" 24 #include "libmesh/libmesh_logging.h" 25 #include "libmesh/numeric_vector.h" 39 const std::string & name_in,
40 const unsigned int number_in) :
42 _a_0 (1./(_default_alpha*_default_timestep*_default_timestep)),
43 _a_1 (_default_delta/(_default_alpha*_default_timestep)),
44 _a_2 (1./(_default_alpha*_default_timestep)),
45 _a_3 (1./(2.*_default_alpha)-1.),
46 _a_4 (_default_delta/_default_alpha -1.),
47 _a_5 (_default_timestep/2.*(_default_delta/_default_alpha-2.)),
48 _a_6 (_default_timestep*(1.-_default_delta)),
49 _a_7 (_default_delta*_default_timestep),
50 _finished_assemble (false)
120 libmesh_not_implemented();
149 LOG_SCOPE(
"initial_conditions ()",
"NewmarkSystem");
182 LOG_SCOPE(
"update_rhs ()",
"NewmarkSystem");
217 LOG_SCOPE(
"update_u_v_a ()",
"NewmarkSystem");
250 libmesh_assert_not_equal_to (delta_T, 0.);
265 _a_0 = 1./(alpha*delta_T*delta_T);
266 _a_1 = delta/(alpha*delta_T);
267 _a_2 = 1./(alpha*delta_T);
268 _a_3 = 1./(2.*alpha)-1.;
269 _a_4 = delta/alpha -1.;
270 _a_5 = delta_T/2.*(delta/alpha-2.);
271 _a_6 = delta_T*(1.-delta);
272 _a_7 = delta*delta_T;
virtual void assemble() override
Prepares matrix and _dof_map for matrix assembly.
This is the EquationSystems class.
void set_newmark_parameters(const Real delta_T=_default_timestep, const Real alpha=_default_alpha, const Real delta=_default_delta)
Set the time step size and the newmark parameter alpha and delta and calculate the constant parameter...
Manages consistently variables, degrees of freedom, coefficient vectors, matrices and linear solvers ...
virtual void add_vector(const T *v, const std::vector< numeric_index_type > &dof_indices)
Computes , where v is a pointer and each dof_indices[i] specifies where to add value v[i]...
const EquationSystems & get_equation_systems() const
NumericVector< Number > * rhs
The system matrix.
virtual void user_initialization()
Calls user's attached initialization function, or is overridden by the user in derived classes...
bool _finished_assemble
true if the matrix assembly is finished.
NumericVector< Number > & add_vector(std::string_view vec_name, const bool projections=true, const ParallelType type=PARALLEL)
Adds the additional vector vec_name to this system.
The libMesh namespace provides an interface to certain functionality in the library.
virtual void assemble() override
Assemble the linear system.
virtual void zero()=0
Set all entries to zero.
virtual void add(const numeric_index_type i, const numeric_index_type j, const T value)=0
Add value to the element (i,j).
virtual void clear() override
Clear all the data structures associated with the system.
void update_rhs()
Update the rhs.
Real _a_0
Constants used for the time integration.
virtual void scale(const T factor)=0
Scale each element of the vector by the given factor.
virtual void zero()=0
Set all entries to 0.
virtual void reinit() override
Reinitializes the member data fields associated with the system, so that, e.g., assemble() may be use...
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
static const Real _default_delta
Default Newmark delta.
void initial_conditions()
Apply initial conditions.
virtual void close()=0
Calls the NumericVector's internal assembly routines, ensuring that the values are consistent across ...
void update_u_v_a()
Update displacement, velocity and acceleration.
virtual void close()=0
Calls the SparseMatrix's internal assembly routines, ensuring that the values are consistent across p...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
T & set(const std::string &)
SparseMatrix< Number > * matrix
The system matrix.
static const Real _default_timestep
Default Newmark time step.
NewmarkSystem(EquationSystems &es, const std::string &name, const unsigned int number)
Constructor.
void compute_matrix()
Compute the global matrix by adding up scaled mass damping and stiffness matrix.
static const Real _default_alpha
Default Newmark alpha.
Parameters parameters
Data structure holding arbitrary parameters.
virtual void clear() override
Clear all the data structures associated with the system.
virtual void add(const numeric_index_type i, const T value)=0
Adds value to the vector entry specified by i.
SparseMatrix< Number > & add_matrix(std::string_view mat_name, ParallelType type=PARALLEL, MatrixBuildType mat_build_type=MatrixBuildType::AUTOMATIC)
Adds the additional matrix mat_name to this system.
const SparseMatrix< Number > & get_matrix(std::string_view mat_name) const
const NumericVector< Number > & get_vector(std::string_view vec_name) const