LCOV - code coverage report
Current view: top level - src/executioners - FixedPointSolve.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: fef103 Lines: 255 282 90.4 %
Date: 2025-09-03 20:01:23 Functions: 11 11 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             : #include "FixedPointSolve.h"
      11             : 
      12             : #include "FEProblem.h"
      13             : #include "Executioner.h"
      14             : #include "MooseMesh.h"
      15             : #include "NonlinearSystem.h"
      16             : #include "AuxiliarySystem.h"
      17             : #include "AllLocalDofIndicesThread.h"
      18             : #include "Console.h"
      19             : #include "EigenExecutionerBase.h"
      20             : #include "Convergence.h"
      21             : #include "ConvergenceIterationTypes.h"
      22             : #include "MooseUtils.h"
      23             : 
      24             : InputParameters
      25      489650 : FixedPointSolve::fixedPointDefaultConvergenceParams()
      26             : {
      27      489650 :   InputParameters params = emptyInputParameters();
      28             : 
      29     1468950 :   params.addParam<unsigned int>(
      30      979300 :       "fixed_point_min_its", 1, "Specifies the minimum number of fixed point iterations.");
      31     1468950 :   params.addParam<unsigned int>(
      32      979300 :       "fixed_point_max_its", 1, "Specifies the maximum number of fixed point iterations.");
      33     1468950 :   params.addParam<bool>("disable_fixed_point_residual_norm_check",
      34      979300 :                         false,
      35             :                         "Disable the residual norm evaluation thus the three parameters "
      36             :                         "fixed_point_rel_tol, fixed_point_abs_tol and fixed_point_force_norms.");
      37     1468950 :   params.addParam<bool>(
      38             :       "fixed_point_force_norms",
      39      979300 :       false,
      40             :       "Force the evaluation of both the TIMESTEP_BEGIN and TIMESTEP_END norms regardless of the "
      41             :       "existence of active MultiApps with those execute_on flags, default: false.");
      42     1468950 :   params.addParam<bool>(
      43             :       "accept_on_max_fixed_point_iteration",
      44      979300 :       false,
      45             :       "True to treat reaching the maximum number of fixed point iterations as converged.");
      46     2448250 :   params.addRangeCheckedParam<Real>("fixed_point_rel_tol",
      47      979300 :                                     1e-8,
      48             :                                     "fixed_point_rel_tol>0",
      49             :                                     "The relative nonlinear residual drop to shoot for "
      50             :                                     "during fixed point iterations. This check is "
      51             :                                     "performed based on the main app's nonlinear "
      52             :                                     "residual.");
      53     2448250 :   params.addRangeCheckedParam<Real>("fixed_point_abs_tol",
      54      979300 :                                     1e-50,
      55             :                                     "fixed_point_abs_tol>0",
      56             :                                     "The absolute nonlinear residual to shoot for "
      57             :                                     "during fixed point iterations. This check is "
      58             :                                     "performed based on the main app's nonlinear "
      59             :                                     "residual.");
      60             : 
      61     1958600 :   params.addParam<PostprocessorName>("custom_pp",
      62             :                                      "Postprocessor for custom fixed point convergence check.");
      63     1468950 :   params.addParam<bool>("direct_pp_value",
      64      979300 :                         false,
      65             :                         "True to use direct postprocessor value "
      66             :                         "(scaled by value on first iteration). "
      67             :                         "False (default) to use difference in postprocessor "
      68             :                         "value between fixed point iterations.");
      69     2448250 :   params.addRangeCheckedParam<Real>("custom_rel_tol",
      70      979300 :                                     1e-8,
      71             :                                     "custom_rel_tol>0",
      72             :                                     "The relative nonlinear residual drop to shoot for "
      73             :                                     "during fixed point iterations. This check is "
      74             :                                     "performed based on the postprocessor defined by "
      75             :                                     "custom_pp residual.");
      76     2448250 :   params.addRangeCheckedParam<Real>("custom_abs_tol",
      77      979300 :                                     1e-50,
      78             :                                     "custom_abs_tol>0",
      79             :                                     "The absolute nonlinear residual to shoot for "
      80             :                                     "during fixed point iterations. This check is "
      81             :                                     "performed based on postprocessor defined by "
      82             :                                     "the custom_pp residual.");
      83             : 
      84     1468950 :   params.addParamNamesToGroup(
      85             :       "fixed_point_min_its fixed_point_max_its disable_fixed_point_residual_norm_check "
      86             :       "accept_on_max_fixed_point_iteration fixed_point_rel_tol fixed_point_abs_tol "
      87             :       "fixed_point_force_norms custom_pp direct_pp_value custom_abs_tol custom_rel_tol",
      88             :       "Fixed point iterations");
      89             : 
      90      489650 :   return params;
      91           0 : }
      92             : 
      93             : InputParameters
      94      343765 : FixedPointSolve::validParams()
      95             : {
      96      343765 :   InputParameters params = emptyInputParameters();
      97      343765 :   params += FixedPointSolve::fixedPointDefaultConvergenceParams();
      98             : 
      99     1375060 :   params.addParam<ConvergenceName>(
     100             :       "multiapp_fixed_point_convergence",
     101             :       "Name of the Convergence object to use to assess convergence of the "
     102             :       "MultiApp fixed point solve. If not provided, a default Convergence "
     103             :       "will be constructed internally from the executioner parameters.");
     104             : 
     105             :   // Parameters for relaxing the fixed point process
     106     1718825 :   params.addRangeCheckedParam<Real>("relaxation_factor",
     107      687530 :                                     1.0,
     108             :                                     "relaxation_factor>0 & relaxation_factor<2",
     109             :                                     "Fraction of newly computed value to keep."
     110             :                                     "Set between 0 and 2.");
     111     1031295 :   params.addParam<std::vector<std::string>>(
     112             :       "transformed_variables",
     113      687530 :       std::vector<std::string>(),
     114             :       "List of main app variables to transform during fixed point iterations");
     115     1031295 :   params.addParam<std::vector<PostprocessorName>>(
     116             :       "transformed_postprocessors",
     117      687530 :       std::vector<PostprocessorName>(),
     118             :       "List of main app postprocessors to transform during fixed point iterations");
     119     1718825 :   params.addDeprecatedParam<std::vector<std::string>>(
     120             :       "relaxed_variables",
     121      687530 :       std::vector<std::string>(),
     122             :       "List of main app variables to relax during fixed point iterations",
     123             :       "Relaxed variables is deprecated, use transformed_variables instead.");
     124             : 
     125     1375060 :   params.addParam<bool>("auto_advance",
     126             :                         "Whether to automatically advance sub-applications regardless of whether "
     127             :                         "their solve converges, for transient executioners only.");
     128             : 
     129     1375060 :   params.addParamNamesToGroup(
     130             :       "multiapp_fixed_point_convergence "
     131             :       "relaxation_factor transformed_variables transformed_postprocessors auto_advance",
     132             :       "Fixed point iterations");
     133             : 
     134     1031295 :   params.addParam<unsigned int>(
     135             :       "max_xfem_update",
     136      687530 :       std::numeric_limits<unsigned int>::max(),
     137             :       "Maximum number of times to update XFEM crack topology in a step due to evolving cracks");
     138     1031295 :   params.addParam<bool>("update_xfem_at_timestep_begin",
     139      687530 :                         false,
     140             :                         "Should XFEM update the mesh at the beginning of the timestep");
     141             : 
     142     1031295 :   params.addParamNamesToGroup("max_xfem_update update_xfem_at_timestep_begin",
     143             :                               "XFEM fixed point iterations");
     144             : 
     145      343765 :   return params;
     146           0 : }
     147             : 
     148       62886 : FixedPointSolve::FixedPointSolve(Executioner & ex)
     149             :   : SolveObject(ex),
     150      187080 :     _has_fixed_point_its(getParam<unsigned int>("fixed_point_max_its") > 1 ||
     151      246810 :                          isParamSetByUser("multiapp_fixed_point_convergence")),
     152      125772 :     _relax_factor(getParam<Real>("relaxation_factor")),
     153      125772 :     _transformed_vars(getParam<std::vector<std::string>>("transformed_variables")),
     154      125772 :     _transformed_pps(getParam<std::vector<PostprocessorName>>("transformed_postprocessors")),
     155             :     // this value will be set by MultiApp
     156       62886 :     _secondary_relaxation_factor(1.0),
     157       62886 :     _fixed_point_it(0),
     158       62886 :     _fixed_point_status(MooseFixedPointConvergenceReason::UNSOLVED),
     159      125772 :     _max_xfem_update(getParam<unsigned int>("max_xfem_update")),
     160      125772 :     _update_xfem_at_timestep_begin(getParam<bool>("update_xfem_at_timestep_begin")),
     161       62886 :     _xfem_update_count(0),
     162       62886 :     _xfem_repeat_step(false),
     163       62886 :     _old_entering_time(_problem.time() - 1),
     164       62886 :     _fail_step(false),
     165      125772 :     _auto_advance_set_by_user(isParamValid("auto_advance")),
     166      188668 :     _auto_advance_user_value(_auto_advance_set_by_user ? getParam<bool>("auto_advance") : true)
     167             : {
     168             :   // Handle deprecated parameters
     169      188658 :   if (!parameters().isParamSetByAddParam("relaxed_variables"))
     170           0 :     _transformed_vars = getParam<std::vector<std::string>>("relaxed_variables");
     171             : 
     172       62886 :   if (_transformed_vars.size() > 0 && _transformed_pps.size() > 0)
     173           0 :     mooseWarning(
     174             :         "Both variable and postprocessor transformation are active. If the two share dofs, the "
     175             :         "transformation will not be correct.");
     176             : 
     177       62886 :   if (!_app.isUltimateMaster())
     178             :   {
     179       12408 :     _secondary_relaxation_factor = _app.fixedPointConfig().sub_relaxation_factor;
     180       12408 :     _secondary_transformed_variables = _app.fixedPointConfig().sub_transformed_vars;
     181       12408 :     _secondary_transformed_pps = _app.fixedPointConfig().sub_transformed_pps;
     182             :   }
     183             : 
     184      188658 :   if (isParamValid("multiapp_fixed_point_convergence"))
     185         270 :     _problem.setMultiAppFixedPointConvergenceName(
     186             :         getParam<ConvergenceName>("multiapp_fixed_point_convergence"));
     187             :   else
     188       62796 :     _problem.setNeedToAddDefaultMultiAppFixedPointConvergence();
     189       62886 : }
     190             : 
     191             : void
     192       59203 : FixedPointSolve::initialSetup()
     193             : {
     194       59203 :   SolveObject::initialSetup();
     195             : 
     196       59203 :   allocateStorage(true);
     197             : 
     198       59203 :   if (_has_fixed_point_its)
     199             :   {
     200        1626 :     auto & conv = _problem.getConvergence(_problem.getMultiAppFixedPointConvergenceName());
     201        1626 :     conv.checkIterationType(ConvergenceIterationTypes::MULTIAPP_FIXED_POINT);
     202             :   }
     203       59199 : }
     204             : 
     205             : bool
     206      284106 : FixedPointSolve::solve()
     207             : {
     208      852318 :   TIME_SECTION("PicardSolve", 1);
     209             : 
     210      284106 :   Real current_dt = _problem.dt();
     211             : 
     212      284106 :   bool converged = true;
     213             : 
     214             :   // need to back up multi-apps even when not doing fixed point iteration for recovering from failed
     215             :   // multiapp solve
     216      284106 :   _problem.backupMultiApps(EXEC_MULTIAPP_FIXED_POINT_BEGIN);
     217      284106 :   _problem.backupMultiApps(EXEC_TIMESTEP_BEGIN);
     218      284106 :   _problem.backupMultiApps(EXEC_TIMESTEP_END);
     219      284106 :   _problem.backupMultiApps(EXEC_MULTIAPP_FIXED_POINT_END);
     220             : 
     221             :   // Prepare to relax variables as a main app
     222      284106 :   std::set<dof_id_type> transformed_dofs;
     223      284106 :   if ((_relax_factor != 1.0 || !dynamic_cast<PicardSolve *>(this)) && _transformed_vars.size() > 0)
     224             :   {
     225             :     // Snag all of the local dof indices for all of these variables
     226        1818 :     AllLocalDofIndicesThread aldit(_problem, _transformed_vars);
     227        1818 :     libMesh::ConstElemRange & elem_range = *_problem.mesh().getActiveLocalElementRange();
     228        1818 :     Threads::parallel_reduce(elem_range, aldit);
     229             : 
     230        1818 :     transformed_dofs = aldit.getDofIndices();
     231        1818 :   }
     232             : 
     233             :   // Prepare to relax variables as a subapp
     234      284106 :   std::set<dof_id_type> secondary_transformed_dofs;
     235      284106 :   if (_secondary_relaxation_factor != 1.0 || !dynamic_cast<PicardSolve *>(this))
     236             :   {
     237       36550 :     if (_secondary_transformed_variables.size() > 0)
     238             :     {
     239             :       // Snag all of the local dof indices for all of these variables
     240        6081 :       AllLocalDofIndicesThread aldit(_problem, _secondary_transformed_variables);
     241        6081 :       libMesh::ConstElemRange & elem_range = *_problem.mesh().getActiveLocalElementRange();
     242        6081 :       Threads::parallel_reduce(elem_range, aldit);
     243             : 
     244        6081 :       secondary_transformed_dofs = aldit.getDofIndices();
     245        6081 :     }
     246             : 
     247             :     // To detect a new time step
     248       59460 :     if (_old_entering_time == _problem.time() &&
     249       22910 :         _fixed_point_status != MooseFixedPointConvergenceReason::UNSOLVED)
     250             :     {
     251             :       // Keep track of the iteration number of the main app
     252       22866 :       _main_fixed_point_it++;
     253             : 
     254             :       // Save variable values before the solve. Solving will provide new values
     255       22866 :       if (!_app.isUltimateMaster())
     256       22823 :         saveVariableValues(/*is parent app of this iteration=*/false);
     257             :     }
     258             :     else
     259       13684 :       _main_fixed_point_it = 0;
     260             :   }
     261             : 
     262      284106 :   if (_has_fixed_point_its)
     263             :   {
     264       12249 :     auto & convergence = _problem.getConvergence(_problem.getMultiAppFixedPointConvergenceName());
     265       12249 :     convergence.initialize();
     266             :   }
     267             : 
     268      284106 :   _fixed_point_it = 0;
     269             :   while (true)
     270             :   {
     271      332978 :     if (_has_fixed_point_its)
     272             :     {
     273       61121 :       if (_fixed_point_it != 0)
     274             :       {
     275             :         // For every iteration other than the first, we need to restore the state of the MultiApps
     276       48872 :         _problem.restoreMultiApps(EXEC_TIMESTEP_BEGIN);
     277       48872 :         _problem.restoreMultiApps(EXEC_TIMESTEP_END);
     278             :       }
     279             : 
     280       61117 :       _console << COLOR_MAGENTA << "Beginning fixed point iteration " << _fixed_point_it
     281       61117 :                << COLOR_DEFAULT << std::endl
     282       61117 :                << std::endl;
     283             :     }
     284             : 
     285             :     // Solve a single application for one time step
     286      332974 :     const bool solve_converged = solveStep(transformed_dofs);
     287             : 
     288      332626 :     if (solve_converged)
     289             :     {
     290      328491 :       if (_has_fixed_point_its)
     291             :       {
     292       61096 :         _problem.outputStep(EXEC_MULTIAPP_FIXED_POINT_ITERATION_END);
     293             : 
     294             :         // Examine convergence metrics & properties and set the convergence reason
     295       61096 :         bool break_out = examineFixedPointConvergence(converged);
     296             : 
     297       61096 :         if (break_out)
     298             :         {
     299             :           // Except DefaultMultiAppFixedPointConvergence, convergence objects will not
     300             :           // update _fixed_point_status, so we give those cases generic values:
     301       12224 :           if (_fixed_point_status == MooseFixedPointConvergenceReason::CONVERGED_NONLINEAR)
     302             :           {
     303          48 :             if (converged)
     304          48 :               _fixed_point_status = MooseFixedPointConvergenceReason::CONVERGED_OBJECT;
     305             :             else
     306           0 :               _fixed_point_status = MooseFixedPointConvergenceReason::DIVERGED_OBJECT;
     307             :           }
     308             : 
     309       12224 :           break;
     310             :         }
     311             :       }
     312             :     }
     313             :     else
     314             :     {
     315             :       // If the last solve didn't converge then we need to exit this step completely (even in the
     316             :       // case of coupling). So we can retry...
     317        4135 :       converged = false;
     318        4135 :       break;
     319             :     }
     320             : 
     321      316267 :     _problem.dt() =
     322             :         current_dt; // _dt might be smaller than this at this point for multistep methods
     323             : 
     324      316267 :     _fixed_point_it++;
     325             : 
     326      316267 :     if (!_has_fixed_point_its)
     327      267395 :       break;
     328       48872 :   }
     329             : 
     330      283754 :   if (converged)
     331             :   {
     332             :     // Fixed point iteration loop ends right above
     333      279322 :     _problem.execute(EXEC_MULTIAPP_FIXED_POINT_END);
     334      279322 :     _problem.execTransfers(EXEC_MULTIAPP_FIXED_POINT_END);
     335      279322 :     if (!_problem.execMultiApps(EXEC_MULTIAPP_FIXED_POINT_END, autoAdvance()))
     336             :     {
     337           0 :       _fixed_point_status = MooseFixedPointConvergenceReason::DIVERGED_FAILED_MULTIAPP;
     338           0 :       return false;
     339             :     }
     340      279322 :     _problem.outputStep(EXEC_MULTIAPP_FIXED_POINT_END);
     341             :   }
     342             : 
     343             :   // Save postprocessors after the solve and their potential timestep_end execution
     344             :   // The postprocessors could be overwritten at timestep_begin, which is why they are saved
     345             :   // after the solve. They could also be saved right after the transfers.
     346      283754 :   if (_old_entering_time == _problem.time())
     347       47187 :     savePostprocessorValues(false);
     348             : 
     349      283754 :   if (converged)
     350             :   {
     351             :     // Update the subapp using the fixed point algorithm
     352      279322 :     if (_secondary_transformed_variables.size() > 0 &&
     353      279322 :         useFixedPointAlgorithmUpdateInsteadOfPicard(false) && _old_entering_time == _problem.time())
     354        3357 :       transformVariables(secondary_transformed_dofs, false);
     355             : 
     356             :     // Update the entering time, used to detect failed solves
     357      279322 :     _old_entering_time = _problem.time();
     358             :   }
     359             : 
     360      283754 :   if (_has_fixed_point_its)
     361       12245 :     printFixedPointConvergenceReason();
     362             : 
     363      283754 :   return converged;
     364      283754 : }
     365             : 
     366             : void
     367      332874 : FixedPointSolve::saveAllValues(const bool primary)
     368             : {
     369      332874 :   saveVariableValues(primary);
     370      332874 :   savePostprocessorValues(primary);
     371      332874 : }
     372             : 
     373             : bool
     374      332974 : FixedPointSolve::solveStep(const std::set<dof_id_type> & transformed_dofs)
     375             : {
     376      332974 :   bool auto_advance = autoAdvance();
     377             : 
     378      332974 :   _executioner.preSolve();
     379      332974 :   _problem.execTransfers(EXEC_TIMESTEP_BEGIN);
     380             : 
     381      332974 :   if (_fixed_point_it == 0)
     382             :   {
     383      284106 :     _problem.execute(EXEC_MULTIAPP_FIXED_POINT_BEGIN);
     384      284106 :     _problem.execTransfers(EXEC_MULTIAPP_FIXED_POINT_BEGIN);
     385      284106 :     if (!_problem.execMultiApps(EXEC_MULTIAPP_FIXED_POINT_BEGIN, autoAdvance()))
     386             :     {
     387           0 :       _fixed_point_status = MooseFixedPointConvergenceReason::DIVERGED_FAILED_MULTIAPP;
     388           0 :       return false;
     389             :     }
     390      284106 :     _problem.outputStep(EXEC_MULTIAPP_FIXED_POINT_BEGIN);
     391             :   }
     392             : 
     393      332974 :   if (!_problem.execMultiApps(EXEC_TIMESTEP_BEGIN, auto_advance))
     394             :   {
     395          21 :     _fixed_point_status = MooseFixedPointConvergenceReason::DIVERGED_FAILED_MULTIAPP;
     396          21 :     return false;
     397             :   }
     398             : 
     399      332882 :   if (_problem.haveXFEM() && _update_xfem_at_timestep_begin)
     400           0 :     _problem.updateMeshXFEM();
     401             : 
     402      332882 :   _problem.execute(EXEC_TIMESTEP_BEGIN);
     403             : 
     404             :   // Transform the fixed point postprocessors before solving, but after the timestep_begin transfers
     405             :   // have been received
     406      332878 :   if (_transformed_pps.size() > 0 && useFixedPointAlgorithmUpdateInsteadOfPicard(true))
     407       13781 :     transformPostprocessors(true);
     408      336515 :   if (_secondary_transformed_pps.size() > 0 && useFixedPointAlgorithmUpdateInsteadOfPicard(false) &&
     409        3637 :       _problem.time() == _old_entering_time)
     410        3637 :     transformPostprocessors(false);
     411             : 
     412      332878 :   if (_has_fixed_point_its)
     413             :   {
     414       61096 :     auto & convergence = _problem.getConvergence(_problem.getMultiAppFixedPointConvergenceName());
     415       61096 :     convergence.preExecute();
     416             :   }
     417             : 
     418             :   // Perform output for timestep begin
     419      332878 :   _problem.outputStep(EXEC_TIMESTEP_BEGIN);
     420             : 
     421             :   // Update warehouse active objects
     422      332874 :   _problem.updateActiveObjects();
     423             : 
     424             :   // Save the current values of variables and postprocessors, before the solve
     425      332874 :   saveAllValues(true);
     426             : 
     427             :   // Save the previous fixed point iteration solution and aux variables
     428      332874 :   _solver_sys.copyPreviousFixedPointSolutions();
     429      332874 :   _aux.copyPreviousFixedPointSolutions();
     430             : 
     431      332874 :   if (_has_fixed_point_its)
     432       61096 :     _console << COLOR_MAGENTA << "\nMain app solve:" << COLOR_DEFAULT << std::endl;
     433      332874 :   if (!_inner_solve->solve())
     434             :   {
     435        3925 :     _fixed_point_status = MooseFixedPointConvergenceReason::DIVERGED_NONLINEAR;
     436             : 
     437             :     // Perform the output of the current, failed time step (this only occurs if desired)
     438        3925 :     _problem.outputStep(EXEC_FAILED);
     439        3925 :     return false;
     440             :   }
     441             :   else
     442      328865 :     _fixed_point_status = MooseFixedPointConvergenceReason::CONVERGED_NONLINEAR;
     443             : 
     444             :   // Use the fixed point algorithm if the conditions (availability of values, etc) are met
     445      328865 :   if (_transformed_vars.size() > 0 && useFixedPointAlgorithmUpdateInsteadOfPicard(true))
     446        6062 :     transformVariables(transformed_dofs, true);
     447             : 
     448      328865 :   if (_problem.haveXFEM() && (_xfem_update_count < _max_xfem_update) && _problem.updateMeshXFEM())
     449             :   {
     450           0 :     _console << "\nXFEM modified mesh, repeating step" << std::endl;
     451           0 :     _xfem_repeat_step = true;
     452           0 :     ++_xfem_update_count;
     453             :   }
     454             :   else
     455             :   {
     456      328865 :     if (_problem.haveXFEM())
     457             :     {
     458           0 :       _xfem_repeat_step = false;
     459           0 :       _xfem_update_count = 0;
     460           0 :       _console << "\nXFEM did not modify mesh, continuing" << std::endl;
     461             :     }
     462             : 
     463      328865 :     _problem.onTimestepEnd();
     464      328865 :     _problem.execute(EXEC_TIMESTEP_END);
     465             : 
     466      328740 :     _problem.execTransfers(EXEC_TIMESTEP_END);
     467      328740 :     if (!_problem.execMultiApps(EXEC_TIMESTEP_END, auto_advance))
     468             :     {
     469          84 :       _fixed_point_status = MooseFixedPointConvergenceReason::DIVERGED_FAILED_MULTIAPP;
     470          84 :       return false;
     471             :     }
     472             :   }
     473             : 
     474      328596 :   if (_fail_step)
     475             :   {
     476         105 :     _fail_step = false;
     477         105 :     return false;
     478             :   }
     479             : 
     480      328491 :   _executioner.postSolve();
     481             : 
     482      328491 :   return true;
     483             : }
     484             : 
     485             : bool
     486       61096 : FixedPointSolve::examineFixedPointConvergence(bool & converged)
     487             : {
     488       61096 :   _problem.execute(EXEC_MULTIAPP_FIXED_POINT_CONVERGENCE);
     489             : 
     490       61096 :   auto & convergence = _problem.getConvergence(_problem.getMultiAppFixedPointConvergenceName());
     491       61096 :   const auto status = convergence.checkConvergence(_fixed_point_it);
     492       61096 :   switch (status)
     493             :   {
     494       11927 :     case Convergence::MooseConvergenceStatus::CONVERGED:
     495       11927 :       converged = true;
     496       11927 :       return true;
     497         297 :     case Convergence::MooseConvergenceStatus::DIVERGED:
     498         297 :       converged = false;
     499         297 :       return true;
     500       48872 :     case Convergence::MooseConvergenceStatus::ITERATING:
     501       48872 :       converged = false;
     502       48872 :       return false;
     503           0 :     default:
     504           0 :       mooseError("Should not reach here");
     505             :   }
     506             : }
     507             : 
     508             : void
     509       12245 : FixedPointSolve::printFixedPointConvergenceReason()
     510             : {
     511       12245 :   _console << "Fixed point convergence reason: ";
     512       12245 :   switch (_fixed_point_status)
     513             :   {
     514        3703 :     case MooseFixedPointConvergenceReason::CONVERGED_ABS:
     515        3703 :       _console << "CONVERGED_ABS";
     516        3703 :       break;
     517        8051 :     case MooseFixedPointConvergenceReason::CONVERGED_RELATIVE:
     518        8051 :       _console << "CONVERGED_RELATIVE";
     519        8051 :       break;
     520          44 :     case MooseFixedPointConvergenceReason::CONVERGED_PP:
     521          44 :       _console << "CONVERGED_PP";
     522          44 :       break;
     523          81 :     case MooseFixedPointConvergenceReason::REACH_MAX_ITS:
     524          81 :       _console << "REACH_MAX_ITS";
     525          81 :       break;
     526          48 :     case MooseFixedPointConvergenceReason::CONVERGED_OBJECT:
     527          48 :       _console << "CONVERGED_OBJECT (see Convergence object)";
     528          48 :       break;
     529         297 :     case MooseFixedPointConvergenceReason::DIVERGED_MAX_ITS:
     530         297 :       _console << "DIVERGED_MAX_ITS";
     531         297 :       break;
     532           0 :     case MooseFixedPointConvergenceReason::DIVERGED_NONLINEAR:
     533           0 :       _console << "DIVERGED_NONLINEAR";
     534           0 :       break;
     535          21 :     case MooseFixedPointConvergenceReason::DIVERGED_FAILED_MULTIAPP:
     536          21 :       _console << "DIVERGED_FAILED_MULTIAPP";
     537          21 :       break;
     538           0 :     case MooseFixedPointConvergenceReason::DIVERGED_OBJECT:
     539           0 :       _console << "DIVERGED_OBJECT (see Convergence object)";
     540           0 :       break;
     541           0 :     default:
     542             :       // UNSOLVED and CONVERGED_NONLINEAR should not be hit when coupling
     543             :       // iteration is not on here
     544           0 :       mooseError("Internal error: wrong fixed point status!");
     545             :       break;
     546             :   }
     547       12245 :   _console << std::endl;
     548       12245 : }
     549             : 
     550             : bool
     551     1096187 : FixedPointSolve::autoAdvance() const
     552             : {
     553     1096187 :   bool auto_advance = !(_has_fixed_point_its && _problem.isTransient());
     554             : 
     555     1096187 :   if (dynamic_cast<EigenExecutionerBase *>(&_executioner) && _has_fixed_point_its)
     556           0 :     auto_advance = true;
     557             : 
     558     1096187 :   if (_auto_advance_set_by_user)
     559         194 :     auto_advance = _auto_advance_user_value;
     560             : 
     561     1096187 :   return auto_advance;
     562             : }
     563             : 
     564             : bool
     565      659562 : FixedPointSolve::performingRelaxation(const bool primary) const
     566             : {
     567      659562 :   if (primary)
     568      618630 :     return !MooseUtils::absoluteFuzzyEqual(_relax_factor, 1.0);
     569             :   else
     570       40932 :     return !MooseUtils::absoluteFuzzyEqual(_secondary_relaxation_factor, 1.0);
     571             : }

Generated by: LCOV version 1.14