LCOV - code coverage report
Current view: top level - include/timeintegrators - ExplicitEuler.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 5 6 83.3 %
Date: 2025-07-17 01:28:37 Functions: 2 5 40.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://mooseframework.inl.gov
       3             : //*
       4             : //* All rights reserved, see COPYRIGHT for full restrictions
       5             : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
       6             : //*
       7             : //* Licensed under LGPL 2.1, please see LICENSE for details
       8             : //* https://www.gnu.org/licenses/lgpl-2.1.html
       9             : 
      10             : #pragma once
      11             : 
      12             : #include "TimeIntegrator.h"
      13             : 
      14             : /**
      15             :  * Explicit Euler time integrator
      16             :  */
      17             : class ExplicitEuler : public TimeIntegrator
      18             : {
      19             : public:
      20             :   static InputParameters validParams();
      21             : 
      22             :   ExplicitEuler(const InputParameters & parameters);
      23             : 
      24             :   virtual void preSolve() override;
      25           0 :   virtual int order() override { return 1; }
      26             :   virtual void computeTimeDerivatives() override;
      27             :   void computeADTimeDerivatives(ADReal & ad_u_dot,
      28             :                                 const dof_id_type & dof,
      29             :                                 ADReal & ad_u_dotdot) const override;
      30             :   virtual void postResidual(NumericVector<Number> & residual) override;
      31        3332 :   virtual bool overridesSolve() const override { return false; }
      32             : 
      33             : protected:
      34             :   /**
      35             :    * Helper function that actually does the math for computing the time derivative
      36             :    */
      37             :   template <typename T, typename T2>
      38             :   void computeTimeDerivativeHelper(T & u_dot, const T2 & u_old) const;
      39             : };
      40             : 
      41             : template <typename T, typename T2>
      42             : void
      43        6330 : ExplicitEuler::computeTimeDerivativeHelper(T & u_dot, const T2 & u_old) const
      44             : {
      45        6330 :   u_dot -= u_old;
      46        6330 :   u_dot *= 1. / _dt;
      47        6330 : }

Generated by: LCOV version 1.14