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 "ExternalPetscTimeStepper.h" 11 : #include "ExternalPETScProblem.h" 12 : 13 : #include "libmesh/petsc_solver_exception.h" 14 : 15 : registerMooseObject("ExternalPetscSolverApp", ExternalPetscTimeStepper); 16 : 17 : InputParameters 18 740 : ExternalPetscTimeStepper::validParams() 19 : { 20 740 : InputParameters params = TimeStepper::validParams(); 21 : 22 740 : params.addClassDescription("Timestepper that queries the step size of the external petsc solver, " 23 : "and use that as the time step size."); 24 740 : return params; 25 0 : } 26 : 27 370 : ExternalPetscTimeStepper::ExternalPetscTimeStepper(const InputParameters & parameters) 28 : : TimeStepper(parameters), 29 : // ExternalPetscTimeStepper always requires ExternalPETScProblem 30 370 : _external_petsc_problem(static_cast<ExternalPETScProblem &>(_fe_problem)) 31 : { 32 370 : } 33 : 34 : Real 35 550 : ExternalPetscTimeStepper::computeInitialDT() 36 : { 37 : // Query the time step size of PETSc solver 38 : PetscReal dt; 39 550 : LibmeshPetscCall(TSGetTimeStep(_external_petsc_problem.getPetscTS(), &dt)); 40 550 : return dt; 41 : } 42 : 43 : Real 44 3736 : ExternalPetscTimeStepper::computeDT() 45 : { 46 : // Query the time step size of PETSc solver 47 : PetscReal dt; 48 3736 : LibmeshPetscCall(TSGetTimeStep(_external_petsc_problem.getPetscTS(), &dt)); 49 3736 : return dt; 50 : }