LCOV - code coverage report
Current view: top level - src/problems - ExternalProblem.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 419b9d Lines: 26 27 96.3 %
Date: 2025-08-08 20:01:16 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       52243 : ExternalProblem::validParams()
      17             : {
      18       52243 :   InputParameters params = FEProblemBase::validParams();
      19       52243 :   params.set<bool>("skip_nl_system_check") = true;
      20             : 
      21             :   // there is no nonlinear system (we set it as empty in the constructor)
      22       52243 :   params.suppressParameter<bool>("ignore_zeros_in_jacobian");
      23       52243 :   params.suppressParameter<MooseEnum>("kernel_coverage_check");
      24       52243 :   params.suppressParameter<std::vector<NonlinearSystemName>>("nl_sys_names");
      25       52243 :   params.suppressParameter<bool>("previous_nl_solution_required");
      26       52243 :   params.suppressParameter<bool>("skip_nl_system_check");
      27       52243 :   params.suppressParameter<bool>("use_nonlinear");
      28             : 
      29       52243 :   params.addClassDescription("Problem extension point for wrapping external applications");
      30       52243 :   return params;
      31           0 : }
      32             : 
      33         412 : 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         412 :   if (_num_nl_sys)
      41             :   {
      42         412 :     _nl[0] = std::make_shared<NonlinearSystem>(*this, "nl0");
      43         412 :     _solver_systems[0] = std::dynamic_pointer_cast<SolverSystem>(_nl[0]);
      44             :   }
      45         412 :   _aux = std::make_shared<AuxiliarySystem>(*this, "aux0");
      46             : 
      47             :   /**
      48             :    * We still need to create Assembly objects to hold the data structures for working with Aux
      49             :    * Variables, which will be used in the external problem.
      50             :    */
      51         412 :   newAssemblyArray(_solver_systems);
      52             : 
      53             :   // Create extra vectors and matrices if any
      54         412 :   createTagVectors();
      55             : 
      56             :   // Create extra solution vectors if any
      57         412 :   createTagSolutions();
      58         412 : }
      59             : 
      60             : void
      61         134 : ExternalProblem::solve(const unsigned int)
      62             : {
      63         134 :   TIME_SECTION("solve", 1, "Solving", false)
      64             : 
      65         134 :   syncSolutions(Direction::TO_EXTERNAL_APP);
      66         134 :   externalSolve();
      67         134 :   syncSolutions(Direction::FROM_EXTERNAL_APP);
      68         134 : }

Generated by: LCOV version 1.14