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 : #include "ExplicitEuler.h" 11 : #include "NonlinearSystem.h" 12 : #include "FEProblem.h" 13 : 14 : registerMooseObject("MooseApp", ExplicitEuler); 15 : 16 : InputParameters 17 14616 : ExplicitEuler::validParams() 18 : { 19 14616 : InputParameters params = TimeIntegrator::validParams(); 20 14616 : params.addClassDescription("Time integration using the explicit Euler method."); 21 14616 : return params; 22 0 : } 23 : 24 234 : ExplicitEuler::ExplicitEuler(const InputParameters & parameters) : TimeIntegrator(parameters) {} 25 : 26 : void 27 1666 : ExplicitEuler::preSolve() 28 : { 29 1666 : if (_dt == _dt_old) 30 1666 : _fe_problem.setConstJacobian(true); 31 : else 32 0 : _fe_problem.setConstJacobian(false); 33 1666 : } 34 : 35 : void 36 6330 : ExplicitEuler::computeTimeDerivatives() 37 : { 38 6330 : if (!_sys.solutionUDot()) 39 0 : mooseError("ExplicitEuler: Time derivative of solution (`u_dot`) is not stored. Please set " 40 : "uDotRequested() to true in FEProblemBase before requesting `u_dot`."); 41 : 42 6330 : NumericVector<Number> & u_dot = *_sys.solutionUDot(); 43 6330 : u_dot = *_solution; 44 6330 : computeTimeDerivativeHelper(u_dot, _solution_old); 45 6330 : u_dot.close(); 46 6330 : computeDuDotDu(); 47 6330 : } 48 : 49 : void 50 0 : ExplicitEuler::computeADTimeDerivatives(ADReal & ad_u_dot, 51 : const dof_id_type & dof, 52 : ADReal & /*ad_u_dotdot*/) const 53 : { 54 0 : computeTimeDerivativeHelper(ad_u_dot, _solution_old(dof)); 55 0 : } 56 : 57 : void 58 3017 : ExplicitEuler::postResidual(NumericVector<Number> & residual) 59 : { 60 3017 : residual += *_Re_time; 61 3017 : residual += *_Re_non_time; 62 3017 : residual.close(); 63 3017 : }