LCOV - code coverage report
Current view: top level - include/problems - ExternalPETScProblem.h (source / functions) Hit Total Coverage
Test: idaholab/moose external_petsc_solver: #31405 (292dce) with base fef103 Lines: 2 2 100.0 %
Date: 2025-09-04 07:53:02 Functions: 1 1 100.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 "ExternalProblem.h"
      13             : #include "PETScDiffusionFDM.h"
      14             : #include "ExternalPetscSolverApp.h"
      15             : 
      16             : /**
      17             :  * This is an interface to call a pure PETSc solver.
      18             :  * We also sync the PETSc solution to moose variables,
      19             :  * and then these variables can be coupled to other
      20             :  * moose applications
      21             :  */
      22             : class ExternalPETScProblem : public ExternalProblem
      23             : {
      24             : public:
      25             :   static InputParameters validParams();
      26             : 
      27             :   ExternalPETScProblem(const InputParameters & params);
      28             : 
      29             :   ~ExternalPETScProblem();
      30             : 
      31             :   virtual void externalSolve() override;
      32             :   virtual void syncSolutions(Direction /*direction*/) override;
      33             : 
      34        5925 :   virtual bool converged(unsigned int) override { return _petsc_converged; }
      35             : 
      36             :   virtual void advanceState() override;
      37             : 
      38             :   virtual Real computeResidualL2Norm() override;
      39             : 
      40             :   Vec & solutionOld() { return _petsc_sol_old; }
      41             : 
      42             :   Vec & currentSolution() { return _petsc_sol; }
      43             : 
      44             :   Vec & udot() { return _petsc_udot; }
      45             : 
      46        4286 :   TS & getPetscTS() { return _ts; }
      47             : 
      48             : private:
      49             :   /// The name of the variable to transfer to
      50             :   const VariableName & _sync_to_var_name;
      51             :   /// If PETSc solver converged
      52             :   PetscBool _petsc_converged;
      53             :   ExternalPetscSolverApp & _external_petsc_app;
      54             :   /// PETSc solver
      55             :   TS & _ts;
      56             :   /// PETSc solver solution
      57             :   Vec & _petsc_sol;
      58             :   /// Solution at the previous time step
      59             :   Vec & _petsc_sol_old;
      60             :   /// Udot (u_n-u_{n-1})/dt
      61             :   Vec & _petsc_udot;
      62             :   /// RHS vector
      63             :   Vec _petsc_rhs;
      64             : };

Generated by: LCOV version 1.14