Skip to content

Commit

Permalink
Add header file for nonlinear SIMPLE solve object. (idaholab#28819)
Browse files Browse the repository at this point in the history
  • Loading branch information
grmnptr committed Oct 17, 2024
1 parent e28fc83 commit eb58bda
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/navier_stokes/include/executioners/SIMPLESolveBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ class SIMPLESolveBase : public SolveObject, public UserObjectInterface
/// The maximum number of momentum-pressure iterations
const unsigned int _num_iterations;

/// If solve should continue if maximum number of iterations is hit
const bool _continue_on_max_its;

// ************************ Other Variables ****************************** //

/// Debug parameter which allows printing the coupling and solution vectors/matrices
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//* This file is part of the MOOSE framework
//* https://www.mooseframework.org
//*
//* All rights reserved, see COPYRIGHT for full restrictions
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
//*
//* Licensed under LGPL 2.1, please see LICENSE for details
//* https://www.gnu.org/licenses/lgpl-2.1.html

#pragma once

// Moose includes
#include "RhieChowMassFlux.h"
#include "SIMPLESolveBase.h"

/**
* SIMPLE-based solution object with nonlinear FV system assembly.
*/
class SIMPLESolveNonlinearAssembly : public SIMPLESolveBase
{
public:
SIMPLESolveNonlinearAssembly(Executioner & ex);

static InputParameters validParams();

/// Fetch the Rhie Chow user object that
virtual void linkRhieChowUserObject() override;

/**
* Performs the momentum pressure coupling.
* @return True if solver is converged.
*/
virtual bool solve() override;

protected:
virtual std::vector<std::pair<unsigned int, Real>> solveMomentumPredictor() override;
virtual std::pair<unsigned int, Real> solvePressureCorrector() override;

/// The number(s) of the system(s) corresponding to the momentum equation(s)
std::vector<unsigned int> _momentum_system_numbers;

/// Pointer(s) to the system(s) corresponding to the momentum equation(s)
std::vector<NonlinearSystem *> _momentum_systems;

/// The number of the system corresponding to the pressure equation
const unsigned int _pressure_sys_number;

/// Reference to the nonlinear system corresponding to the pressure equation
NonlinearSystem & _pressure_system;

/// Pointer to the segregated RhieChow interpolation object
RhieChowMassFlux * _rc_uo;
};
2 changes: 2 additions & 0 deletions modules/navier_stokes/src/executioners/SIMPLESolve.C
Original file line number Diff line number Diff line change
Expand Up @@ -277,5 +277,7 @@ SIMPLESolve::solve()
converged = NS::FV::converged(ns_residuals, ns_abs_tols);
}

converged = _continue_on_max_its ? true : converged;

return converged;
}
3 changes: 3 additions & 0 deletions modules/navier_stokes/src/executioners/SIMPLESolveBase.C
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ SIMPLESolveBase::validParams()
10000,
"The maximum allowed iterations in the linear solver of the momentum equation.");

params.addParam<bool>("continue_on_max_its", false, "If solve should continue if maximum number of iterations is hit.");

params.addParamNamesToGroup(
"momentum_equation_relaxation momentum_petsc_options momentum_petsc_options_iname "
"momentum_petsc_options_value momentum_petsc_options_value momentum_absolute_tolerance "
Expand Down Expand Up @@ -164,6 +166,7 @@ SIMPLESolveBase::SIMPLESolveBase(Executioner & ex)
_pin_pressure(getParam<bool>("pin_pressure")),
_pressure_pin_value(getParam<Real>("pressure_pin_value")),
_num_iterations(getParam<unsigned int>("num_iterations")),
_continue_on_max_its(getParam<bool>("continue_on_max_its")),
_print_fields(getParam<bool>("print_fields"))
{
const auto & momentum_petsc_options = getParam<MultiMooseEnum>("momentum_petsc_options");
Expand Down

0 comments on commit eb58bda

Please sign in to comment.