Skip to content

Commit

Permalink
Add linear solver controls for the solve object. (idaholab#28819)
Browse files Browse the repository at this point in the history
  • Loading branch information
grmnptr committed Oct 10, 2024
1 parent 00c0f69 commit e3622e4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
12 changes: 11 additions & 1 deletion modules/navier_stokes/include/executioners/SIMPLESolve.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include "SolveObject.h"
#include "RhieChowMassFlux.h"
#include "SegregatedSolverBase.h"

class SIMPLESolve : public SolveObject
{
Expand All @@ -30,7 +31,7 @@ class SIMPLESolve : public SolveObject
mooseError("Cannot set inner solve for SIMPLESolve");
}

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

const RhieChowMassFlux & getRCUserObject() { return *_rc_uo; }
Expand Down Expand Up @@ -67,4 +68,13 @@ class SIMPLESolve : public SolveObject

/// Pointer to the segregated RhieChow interpolation object
RhieChowMassFlux * _rc_uo;

/// Options for the linear solver of the momentum equation
SIMPLESolverConfiguration _momentum_linear_control;

/// Options for the linear solver of the pressure equation
SIMPLESolverConfiguration _pressure_linear_control;

/// Debug parameter which allows printing the coupling and solution vectors/matrices
const bool _print_fields;
};
13 changes: 12 additions & 1 deletion modules/navier_stokes/src/executioners/SIMPLESolve.C
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ SIMPLESolve::SIMPLESolve(Executioner & ex)
_momentum_system_names(getParam<std::vector<SolverSystemName>>("momentum_systems")),
_pressure_system_name(getParam<SolverSystemName>("pressure_system")),
_pressure_sys_number(_problem.linearSysNum(_pressure_system_name)),
_pressure_system(_problem.getLinearSystem(_pressure_sys_number))
_pressure_system(_problem.getLinearSystem(_pressure_sys_number)),
_print_fields(getParam<bool>("print_fields"))
{
// We fetch the system numbers for the momentum components plus add vectors
// for removing the contribution from the pressure gradient terms.
Expand All @@ -31,6 +32,16 @@ SIMPLESolve::SIMPLESolve(Executioner & ex)
_momentum_system_numbers.push_back(_problem.linearSysNum(_momentum_system_names[system_i]));
_momentum_systems.push_back(&_problem.getLinearSystem(_momentum_system_numbers[system_i]));
}

_momentum_linear_control.real_valued_data["rel_tol"] = getParam<Real>("momentum_l_tol");
_momentum_linear_control.real_valued_data["abs_tol"] = getParam<Real>("momentum_l_abs_tol");
_momentum_linear_control.int_valued_data["max_its"] =
getParam<unsigned int>("momentum_l_max_its");

_pressure_linear_control.real_valued_data["rel_tol"] = getParam<Real>("pressure_l_tol");
_pressure_linear_control.real_valued_data["abs_tol"] = getParam<Real>("pressure_l_abs_tol");
_pressure_linear_control.int_valued_data["max_its"] =
getParam<unsigned int>("pressure_l_max_its");
}

bool
Expand Down

0 comments on commit e3622e4

Please sign in to comment.