LCOV - code coverage report
Current view: top level - src/problems - ExternalProblem.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 28 29 96.6 %
Date: 2026-05-29 20:35:17 Functions: 3 3 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             : // MOOSE includes
      11             : #include "ExternalProblem.h"
      12             : #include "NonlinearSystem.h"
      13             : #include "AuxiliarySystem.h"
      14             : 
      15             : InputParameters
      16       16947 : ExternalProblem::validParams()
      17             : {
      18       16947 :   InputParameters params = FEProblemBase::validParams();
      19       33894 :   params.set<bool>("skip_nl_system_check") = true;
      20             : 
      21             :   // there is no nonlinear system (we set it as empty in the constructor)
      22       33894 :   params.suppressParameter<bool>("ignore_zeros_in_jacobian");
      23       33894 :   params.suppressParameter<MooseEnum>("kernel_coverage_check");
      24       33894 :   params.suppressParameter<std::vector<NonlinearSystemName>>("nl_sys_names");
      25       33894 :   params.suppressParameter<bool>("previous_nl_solution_required");
      26       33894 :   params.suppressParameter<bool>("skip_nl_system_check");
      27       33894 :   params.suppressParameter<bool>("use_nonlinear");
      28             : 
      29       16947 :   params.addClassDescription("Problem extension point for wrapping external applications");
      30       16947 :   return params;
      31           0 : }
      32             : 
      33        1790 : ExternalProblem::ExternalProblem(const InputParameters & parameters) : FEProblemBase(parameters)
      34             : {
      35             :   /**
      36             :    * Ideally the nonlinear system should not exist since we won't ever use it or call solve on it.
      37             :    * However, MOOSE currently expects it to exist in several locations throughout the framework.
      38             :    * Luckily, it can just be empty (no variables).
      39             :    */
      40        1790 :   if (_num_nl_sys)
      41             :   {
      42        1790 :     _nl[0] = std::make_shared<NonlinearSystem>(*this, "nl0");
      43        1790 :     _solver_systems[0] = std::dynamic_pointer_cast<SolverSystem>(_nl[0]);
      44             :   }
      45        1790 :   _aux = std::make_shared<AuxiliarySystem>(*this, "aux0");
      46             : 
      47             :   // Set the current nonlinear system to the null system we created.
      48        1790 :   setCurrentNonlinearSystem(0);
      49             : 
      50             :   /**
      51             :    * We still need to create Assembly objects to hold the data structures for working with Aux
      52             :    * Variables, which will be used in the external problem.
      53             :    */
      54        1790 :   newAssemblyArray(_solver_systems);
      55             : 
      56             :   // Create extra vectors and matrices if any
      57        1790 :   createTagVectors();
      58             : 
      59             :   // Create extra solution vectors if any
      60        1790 :   createTagSolutions();
      61        1790 : }
      62             : 
      63             : void
      64         184 : ExternalProblem::solve(const unsigned int)
      65             : {
      66         920 :   TIME_SECTION("solve", 1, "Solving", false)
      67             : 
      68         184 :   syncSolutions(Direction::TO_EXTERNAL_APP);
      69         184 :   if (shouldSolve())
      70         145 :     externalSolve();
      71         184 :   syncSolutions(Direction::FROM_EXTERNAL_APP);
      72         184 : }

Generated by: LCOV version 1.14