LCOV - code coverage report
Current view: top level - src/mfem/problem_operators - TimeDomainEquationSystemProblemOperator.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 419b9d Lines: 31 32 96.9 %
Date: 2025-08-08 20:01:16 Functions: 4 4 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             : #ifdef MOOSE_MFEM_ENABLED
      11             : 
      12             : #include "TimeDomainEquationSystemProblemOperator.h"
      13             : 
      14             : namespace Moose::MFEM
      15             : {
      16             : void
      17          49 : TimeDomainEquationSystemProblemOperator::SetGridFunctions()
      18             : {
      19          49 :   _test_var_names = GetEquationSystem()->TestVarNames();
      20          49 :   _trial_var_names = GetEquationSystem()->TrialVarNames();
      21          49 :   TimeDomainProblemOperator::SetGridFunctions();
      22          49 : }
      23             : 
      24             : void
      25          49 : TimeDomainEquationSystemProblemOperator::Init(mfem::BlockVector & X)
      26             : {
      27          49 :   TimeDomainProblemOperator::Init(X);
      28          49 :   GetEquationSystem()->BuildEquationSystem();
      29          49 : }
      30             : 
      31             : void
      32         140 : TimeDomainEquationSystemProblemOperator::ImplicitSolve(const double dt,
      33             :                                                        const mfem::Vector & /*X*/,
      34             :                                                        mfem::Vector & dX_dt)
      35             : {
      36         140 :   dX_dt = 0.0;
      37         140 :   SetTestVariablesFromTrueVectors();
      38         280 :   for (unsigned int ind = 0; ind < _trial_variables.size(); ++ind)
      39             :   {
      40         280 :     _trial_variables.at(ind)->MakeTRef(
      41         140 :         _trial_variables.at(ind)->ParFESpace(), dX_dt, _block_true_offsets[ind]);
      42             :   }
      43         140 :   _problem.coefficients.setTime(GetTime());
      44         140 :   BuildEquationSystemOperator(dt);
      45             : 
      46         140 :   if (_problem.jacobian_solver->isLOR() && _equation_system->_test_var_names.size() > 1)
      47           0 :     mooseError("LOR solve is only supported for single-variable systems");
      48             : 
      49         140 :   _problem.jacobian_solver->updateSolver(
      50         140 :       *_equation_system->_blfs.Get(_equation_system->_test_var_names.at(0)),
      51         140 :       _equation_system->_ess_tdof_lists.at(0));
      52             : 
      53         140 :   _problem.nonlinear_solver->SetSolver(_problem.jacobian_solver->getSolver());
      54         140 :   _problem.nonlinear_solver->SetOperator(*GetEquationSystem());
      55         140 :   _problem.nonlinear_solver->Mult(_true_rhs, dX_dt);
      56         140 :   SetTrialVariablesFromTrueVectors();
      57         140 : }
      58             : 
      59             : void
      60         140 : TimeDomainEquationSystemProblemOperator::BuildEquationSystemOperator(double dt)
      61             : {
      62         140 :   GetEquationSystem()->SetTimeStep(dt);
      63         140 :   GetEquationSystem()->UpdateEquationSystem();
      64         140 :   GetEquationSystem()->BuildJacobian(_true_x, _true_rhs);
      65         140 : }
      66             : 
      67             : } // namespace Moose::MFEM
      68             : 
      69             : #endif

Generated by: LCOV version 1.14