LCOV - code coverage report
Current view: top level - include/systems - newmark_system.h (source / functions) Hit Total Coverage
Test: libMesh/libmesh: #4229 (6a9aeb) with base 727f46 Lines: 2 2 100.0 %
Date: 2025-08-19 19:27:09 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // The libMesh Finite Element Library.
       2             : // Copyright (C) 2002-2025 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
       3             : 
       4             : // This library is free software; you can redistribute it and/or
       5             : // modify it under the terms of the GNU Lesser General Public
       6             : // License as published by the Free Software Foundation; either
       7             : // version 2.1 of the License, or (at your option) any later version.
       8             : 
       9             : // This library is distributed in the hope that it will be useful,
      10             : // but WITHOUT ANY WARRANTY; without even the implied warranty of
      11             : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      12             : // Lesser General Public License for more details.
      13             : 
      14             : // You should have received a copy of the GNU Lesser General Public
      15             : // License along with this library; if not, write to the Free Software
      16             : // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
      17             : 
      18             : 
      19             : 
      20             : #ifndef LIBMESH_NEWMARK_SYSTEM_H
      21             : #define LIBMESH_NEWMARK_SYSTEM_H
      22             : 
      23             : // Local Includes
      24             : #include "libmesh/linear_implicit_system.h"
      25             : 
      26             : // C++ includes
      27             : 
      28             : namespace libMesh
      29             : {
      30             : 
      31             : /**
      32             :  * This class contains a specific system class.
      33             :  * It provides an implicit time integration scheme
      34             :  * known as the Newmark method.
      35             :  *
      36             :  * In the algorithm implemented here the system is solved for
      37             :  * displacements.
      38             :  * Currently the Newmark scheme is implemented for constant
      39             :  * time step sizes only. This time step is stored in the
      40             :  * \p EquationSystems parameter named \p "Newmark \p time \p step".
      41             :  * For the case of constant time steps the matrix only has to be
      42             :  * assembled once, whereas the rhs has to be updated in each timestep.
      43             :  * Default values of the Newmark parameters \p alpha and \p delta
      44             :  * used for time integration are provided.
      45             :  * For details refer to the examples section.
      46             :  *
      47             :  * \author Steffen Petersen
      48             :  * \date 2003
      49             :  * \brief Implements the Newmark time integration scheme.
      50             :  */
      51           8 : class NewmarkSystem : public LinearImplicitSystem
      52             : {
      53             : public:
      54             : 
      55             :   /**
      56             :    * Constructor.
      57             :    */
      58             :   NewmarkSystem (EquationSystems & es,
      59             :                  const std::string & name,
      60             :                  const unsigned int number);
      61             : 
      62             :   /**
      63             :    * Special functions.
      64             :    * - This class has the same restrictions/defaults as its base class.
      65             :    * - The destructor is defaulted out-of-line.
      66             :    */
      67             :   NewmarkSystem (const NewmarkSystem &) = delete;
      68             :   NewmarkSystem & operator= (const NewmarkSystem &) = delete;
      69             :   NewmarkSystem (NewmarkSystem &&) = default;
      70             :   NewmarkSystem & operator= (NewmarkSystem &&) = delete;
      71             :   virtual ~NewmarkSystem ();
      72             : 
      73             :   /**
      74             :    * The type of system.
      75             :    */
      76             :   typedef NewmarkSystem sys_type;
      77             : 
      78             :   /**
      79             :    * Clear all the data structures associated with
      80             :    * the system.
      81             :    */
      82             :   virtual void clear () override;
      83             : 
      84             :   /**
      85             :    * Reinitializes the member data fields associated with
      86             :    * the system, so that, e.g., \p assemble() may be used.
      87             :    */
      88             :   virtual void reinit () override;
      89             : 
      90             :   /**
      91             :    * Assemble the linear system.  Does not
      92             :    * actually call the solver.
      93             :    */
      94             :   virtual void assemble () override;
      95             : 
      96             :   /**
      97             :    * \returns \p "Newmark".  Helps in identifying
      98             :    * the system type in an equation system file.
      99             :    */
     100          71 :   virtual std::string system_type () const override { return "Newmark"; }
     101             : 
     102             : 
     103             :   //---------------------------------------------------------
     104             :   // These members are specific to the Newmark system
     105             :   //
     106             : 
     107             :   /**
     108             :    * Apply initial conditions.
     109             :    */
     110             :   void initial_conditions ();
     111             : 
     112             :   /**
     113             :    * Compute the global matrix by adding up scaled
     114             :    * mass damping and stiffness matrix.
     115             :    */
     116             :   void compute_matrix ();
     117             : 
     118             :   /**
     119             :    * Update the rhs.
     120             :    */
     121             :   void update_rhs ();
     122             : 
     123             :   /**
     124             :    * Update displacement, velocity and acceleration.
     125             :    */
     126             :   void update_u_v_a ();
     127             : 
     128             :   /**
     129             :    * Set the time step size and the newmark parameter alpha and
     130             :    * delta and calculate the constant parameters used for
     131             :    * time integration.
     132             :    */
     133             :   void set_newmark_parameters (const Real delta_T = _default_timestep,
     134             :                                const Real alpha   = _default_alpha,
     135             :                                const Real delta   = _default_delta);
     136             : 
     137             : private:
     138             : 
     139             :   /**
     140             :    * Constants used for the time integration.
     141             :    */
     142             :   Real _a_0;
     143             :   Real _a_1;
     144             :   Real _a_2;
     145             :   Real _a_3;
     146             :   Real _a_4;
     147             :   Real _a_5;
     148             :   Real _a_6;
     149             :   Real _a_7;
     150             : 
     151             :   /**
     152             :    * \p true if the matrix assembly is finished.
     153             :    */
     154             :   bool _finished_assemble;
     155             : 
     156             :   /**
     157             :    * Default Newmark \p alpha
     158             :    */
     159             :   static const Real _default_alpha;
     160             : 
     161             :   /**
     162             :    * Default Newmark \p delta
     163             :    */
     164             :   static const Real _default_delta;
     165             : 
     166             :   /**
     167             :    * Default Newmark time step
     168             :    */
     169             :   static const Real _default_timestep;
     170             : };
     171             : 
     172             : } // namespace libMesh
     173             : 
     174             : #endif // LIBMESH_NEWMARK_SYSTEM_H

Generated by: LCOV version 1.14