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 "ExplicitTimeIntegrator.h" 13 : 14 : /** 15 : * Implements a truly explicit (no nonlinear solve) first-order, forward Euler 16 : * time integration scheme. 17 : */ 18 : class ActuallyExplicitEuler : public ExplicitTimeIntegrator 19 : { 20 : public: 21 : static InputParameters validParams(); 22 : 23 : ActuallyExplicitEuler(const InputParameters & parameters); 24 : 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 solve() override; 31 : virtual void postResidual(NumericVector<Number> & residual) override; 32 8272 : virtual bool overridesSolve() const override { return true; } 33 : 34 : protected: 35 : /** 36 : * Helper function that actually does the math for computing the time derivative 37 : */ 38 : template <typename T, typename T2> 39 : void computeTimeDerivativeHelper(T & u_dot, const T2 & u_old) const; 40 : 41 : const bool & _constant_mass; 42 : }; 43 : 44 : template <typename T, typename T2> 45 : void 46 4007 : ActuallyExplicitEuler::computeTimeDerivativeHelper(T & u_dot, const T2 & u_old) const 47 : { 48 4007 : u_dot -= u_old; 49 4007 : u_dot *= 1. / _dt; 50 4007 : }