LCOV - code coverage report
Current view: top level - include/solvers - second_order_unsteady_solver.h (source / functions) Hit Total Coverage
Test: libMesh/libmesh: #4229 (6a9aeb) with base 727f46 Lines: 3 3 100.0 %
Date: 2025-08-19 19:27:09 Functions: 2 3 66.7 %
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             : #ifndef LIBMESH_SECOND_ORDER_UNSTEADY_SOLVER_H
      19             : #define LIBMESH_SECOND_ORDER_UNSTEADY_SOLVER_H
      20             : 
      21             : #include "libmesh/unsteady_solver.h"
      22             : 
      23             : namespace libMesh
      24             : {
      25             : 
      26             : // Forward declarations
      27             : template <typename T> class FunctionBase;
      28             : template <typename T> class VectorValue;
      29             : typedef VectorValue<Number> NumberVectorValue;
      30             : typedef NumberVectorValue Gradient;
      31             : 
      32             : /**
      33             :  * Generic class from which second order UnsteadySolvers should subclass.
      34             :  *
      35             :  * Subclasses of this class are meant to solve problems of the form
      36             :  * \f[ M(u)\ddot{u} + C(u)\dot{u} + F(u) = 0 \f]
      37             :  *
      38             :  * This class is part of the new DifferentiableSystem framework,
      39             :  * which is still experimental.  Users of this framework should
      40             :  * beware of bugs and future API changes.
      41             :  *
      42             :  * \author Paul T. Bauman
      43             :  * \date 2015
      44             :  */
      45          36 : class SecondOrderUnsteadySolver : public UnsteadySolver
      46             : {
      47             : public:
      48             :   /**
      49             :    * Constructor. Requires a reference to the system
      50             :    * to be solved.
      51             :    */
      52             :   explicit
      53             :   SecondOrderUnsteadySolver (sys_type & s);
      54             : 
      55             :   /**
      56             :    * Destructor.
      57             :    */
      58             :   virtual ~SecondOrderUnsteadySolver ();
      59             : 
      60     6867345 :   virtual unsigned int time_order() const override
      61     6867345 :   { return 2; }
      62             : 
      63             :   /**
      64             :    * The initialization function.  This method is used to
      65             :    * initialize internal data structures before a simulation begins.
      66             :    */
      67             :   virtual void init () override;
      68             : 
      69             :   /**
      70             :    * The data initialization function.  This method is used to
      71             :    * initialize internal data structures after the underlying System
      72             :    * has been initialized
      73             :    */
      74             :   virtual void init_data () override;
      75             : 
      76             :   /**
      77             :    * The reinitialization function.  This method is used to
      78             :    * resize internal data vectors after a mesh change.
      79             :    */
      80             :   virtual void reinit () override;
      81             : 
      82             :   /**
      83             :    * This method retrieves all the stored solutions at the current
      84             :    * system.time
      85             :    */
      86             :   virtual void retrieve_timestep () override;
      87             : 
      88             :   /**
      89             :    * Specify non-zero initial velocity. Should be called before solve().
      90             :    * The function value f and its gradient g are user-provided cloneable functors.
      91             :    * A gradient g is only required/used for projecting onto finite element spaces
      92             :    * with continuous derivatives.
      93             :    */
      94             :   void project_initial_rate(FunctionBase<Number> * f,
      95             :                             FunctionBase<Gradient> * g = nullptr);
      96             : 
      97             :   /**
      98             :    * \returns The solution rate at the previous time step, \f$\dot{u}_n\f$,
      99             :    * for the specified global DOF.
     100             :    */
     101             :   Number old_solution_rate (const dof_id_type global_dof_number) const;
     102             : 
     103             :   /**
     104             :    * \returns The solution acceleration at the previous time step, \f$\ddot{u}_n\f$,
     105             :    * for the specified global DOF.
     106             :    */
     107             :   Number old_solution_accel (const dof_id_type global_dof_number) const;
     108             : 
     109             : protected:
     110             : 
     111             :   /**
     112             :    * Serial vector of previous time step velocity \f$ \dot{u}_n \f$
     113             :    */
     114             :   std::unique_ptr<NumericVector<Number>> _old_local_solution_rate;
     115             : 
     116             :   /**
     117             :    * Serial vector of previous time step acceleration \f$ \ddot{u}_n \f$
     118             :    */
     119             :   std::unique_ptr<NumericVector<Number>> _old_local_solution_accel;
     120             : };
     121             : 
     122             : } // end namespace libMesh
     123             : 
     124             : # endif // LIBMESH_SECOND_ORDER_UNSTEADY_SOLVER_H

Generated by: LCOV version 1.14