LCOV - code coverage report
Current view: top level - include/solvers - euler_solver.h (source / functions) Hit Total Coverage
Test: libMesh/libmesh: #4229 (6a9aeb) with base 727f46 Lines: 1 1 100.0 %
Date: 2025-08-19 19:27:09 Functions: 2 2 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_EULER_SOLVER_H
      21             : #define LIBMESH_EULER_SOLVER_H
      22             : 
      23             : // Local includes
      24             : #include "libmesh/first_order_unsteady_solver.h"
      25             : 
      26             : // C++ includes
      27             : 
      28             : namespace libMesh
      29             : {
      30             : 
      31             : /**
      32             :  * This class defines a theta-method Euler (defaulting to Backward
      33             :  * Euler with theta = 1.0) solver to handle
      34             :  * time integration of DifferentiableSystems.
      35             :  *
      36             :  * This class is part of the new DifferentiableSystem framework,
      37             :  * which is still experimental.  Users of this framework should
      38             :  * beware of bugs and future API changes.
      39             :  *
      40             :  * \author Roy H. Stogner
      41             :  * \date 2006
      42             :  */
      43         208 : class EulerSolver : public FirstOrderUnsteadySolver
      44             : {
      45             : public:
      46             :   /**
      47             :    * The parent class
      48             :    */
      49             :   typedef FirstOrderUnsteadySolver Parent;
      50             : 
      51             :   /**
      52             :    * Constructor. Requires a reference to the system
      53             :    * to be solved.
      54             :    */
      55             :   explicit
      56             :   EulerSolver (sys_type & s);
      57             : 
      58             :   /**
      59             :    * Destructor.
      60             :    */
      61             :   virtual ~EulerSolver ();
      62             : 
      63             :   /**
      64             :    * Error convergence order: 2 for Crank-Nicolson, 1 otherwise
      65             :    */
      66             :   virtual Real error_order() const override;
      67             : 
      68             :   /**
      69             :    * This method uses the DifferentiablePhysics'
      70             :    * element_time_derivative() and element_constraint()
      71             :    * to build a full residual on an element.  What combination
      72             :    * it uses will depend on theta.
      73             :    */
      74             :   virtual bool element_residual (bool request_jacobian,
      75             :                                  DiffContext &) override;
      76             : 
      77             :   /**
      78             :    * This method uses the DifferentiablePhysics'
      79             :    * side_time_derivative() and side_constraint()
      80             :    * to build a full residual on an element's side.
      81             :    * What combination it uses will depend on theta.
      82             :    */
      83             :   virtual bool side_residual (bool request_jacobian,
      84             :                               DiffContext &) override;
      85             : 
      86             :   /**
      87             :    * This method uses the DifferentiablePhysics'
      88             :    * nonlocal_time_derivative() and nonlocal_constraint()
      89             :    * to build a full residual for non-local terms.
      90             :    * What combination it uses will depend on theta.
      91             :    */
      92             :   virtual bool nonlocal_residual (bool request_jacobian,
      93             :                                   DiffContext &) override;
      94             : 
      95             :   /**
      96             :    * A method to integrate the system::QoI functionals.
      97             :    */
      98             :   virtual void integrate_qoi_timestep() override;
      99             : 
     100             : #ifdef LIBMESH_ENABLE_AMR
     101             :   /**
     102             :    * A method to compute the adjoint refinement error estimate at the current timestep.
     103             :    * int_{tstep_start}^{tstep_end} R(u^h,z) dt
     104             :    * The user provides an initialized ARefEE object.
     105             :    * Fills in an ErrorVector that contains the weighted sum of errors from all the QoIs and can be used to guide AMR.
     106             :    * The integration scheme used is consistent with the theta used for the unsteady solution.
     107             :    * CURRENTLY ONLY SUPPORTED for Backward Euler.
     108             :    */
     109             :   virtual void integrate_adjoint_refinement_error_estimate(AdjointRefinementEstimator & adjoint_refinement_error_estimator, ErrorVector & QoI_elementwise_error) override;
     110             : #endif // LIBMESH_ENABLE_AMR
     111             : 
     112             :   /**
     113             :    * The value for the theta method to employ: 1.0 corresponds
     114             :    * to backwards Euler, 0.0 corresponds to forwards Euler,
     115             :    * 0.5 corresponds to Crank-Nicolson.
     116             :    */
     117             :   Real theta;
     118             : 
     119             : protected:
     120             : 
     121             :   /**
     122             :    * This method is the underlying implementation of the public
     123             :    * residual methods.
     124             :    */
     125             :   virtual bool _general_residual (bool request_jacobian,
     126             :                                   DiffContext &,
     127             :                                   ResFuncType mass,
     128             :                                   ResFuncType damping,
     129             :                                   ResFuncType time_deriv,
     130             :                                   ResFuncType constraint,
     131             :                                   ReinitFuncType reinit,
     132             :                                   bool compute_second_order_eqns);
     133             : };
     134             : 
     135             : 
     136             : } // namespace libMesh
     137             : 
     138             : 
     139             : #endif // LIBMESH_EULER_SOLVER_H

Generated by: LCOV version 1.14