Skip to content

Commit

Permalink
Fetch systems for momentum and pressure in 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 3723807 commit 5f46b34
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
39 changes: 39 additions & 0 deletions modules/navier_stokes/include/executioners/SIMPLESolve.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#pragma once

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

class SIMPLESolve : public SolveObject
{
Expand All @@ -28,4 +29,42 @@ class SIMPLESolve : public SolveObject
{
mooseError("Cannot set inner solve for SIMPLESolve");
}

/// Fetch the Rhie Chow
void linkRhieChowUserObject();

const RhieChowMassFlux & getRCUserObject() { return *_rc_uo; }

protected:
/// Solve a momentum predictor step with a fixed pressure field
/// @return A vector of (number of linear iterations, normalized residual norm) pairs for
/// the momentum equations. The length of the vector equals the dimensionality of
/// the domain.
std::vector<std::pair<unsigned int, Real>> solveMomentumPredictor();

/// Solve a pressure corrector step.
/// @return The number of linear iterations and the normalized residual norm of
/// the pressure equation.
std::pair<unsigned int, Real> solvePressureCorrector();

/// The names of the momentum systems.
const std::vector<SolverSystemName> & _momentum_system_names;

/// 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<LinearSystem *> _momentum_systems;

/// The name of the pressure system
const SolverSystemName & _pressure_system_name;

/// 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
LinearSystem & _pressure_system;

/// Pointer to the segregated RhieChow interpolation object
RhieChowMassFlux * _rc_uo;
};
16 changes: 15 additions & 1 deletion modules/navier_stokes/src/executioners/SIMPLESolve.C
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,21 @@ SIMPLESolve::validParams()
return params;
}

SIMPLESolve::SIMPLESolve(Executioner & ex) : SolveObject(ex) {}
SIMPLESolve::SIMPLESolve(Executioner & ex)
: SolveObject(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))
{
// We fetch the system numbers for the momentum components plus add vectors
// for removing the contribution from the pressure gradient terms.
for (auto system_i : index_range(_momentum_system_names))
{
_momentum_system_numbers.push_back(_problem.linearSysNum(_momentum_system_names[system_i]));
_momentum_systems.push_back(&_problem.getLinearSystem(_momentum_system_numbers[system_i]));
}
}

bool
SIMPLESolve::solve()
Expand Down

0 comments on commit 5f46b34

Please sign in to comment.