Functions | |
void | relaxMatrix (SparseMatrix< Number > &matrix_in, const Real relaxation_parameter, NumericVector< Number > &diff_diagonal) |
Relax the matrix to ensure diagonal dominance, we hold onto the difference in diagonals for later use in relaxing the right hand side. More... | |
void | relaxRightHandSide (NumericVector< Number > &rhs_in, const NumericVector< Number > &solution_in, const NumericVector< Number > &diff_diagonal) |
Relax the right hand side of an equation, this needs to be called once and the system matrix has been relaxed and the field describing the difference in the diagonals of the system matrix is already available. More... | |
void | relaxSolutionUpdate (NumericVector< Number > &vec_new, const NumericVector< Number > &vec_old, const Real relaxation_factor) |
Relax the update on a solution field using the following approach: $u = u_{old}+ (u - u_{old})$. More... | |
void | limitSolutionUpdate (NumericVector< Number > &solution, const Real min_limit=std::numeric_limits< Real >::epsilon(), const Real max_limit=1e10) |
Limit a solution to its minimum and maximum bounds: $u = min(max(u, min_limit), max_limit)$. More... | |
Real | computeNormalizationFactor (const NumericVector< Number > &solution, const SparseMatrix< Number > &mat, const NumericVector< Number > &rhs) |
Compute a normalization factor which is applied to the linear residual to determine convergence. More... | |
void | constrainSystem (SparseMatrix< Number > &mx, NumericVector< Number > &rhs, const Real desired_value, const dof_id_type dof_id) |
Implicitly constrain the system by adding a factor*(u-u_desired) to it at a desired dof value. More... | |
dof_id_type | findPointDoFID (const MooseVariableFieldBase &variable, const MooseMesh &mesh, const Point &point) |
Find the ID of the degree of freedom which corresponds to the variable and a given point on the mesh. More... | |
bool | converged (const std::vector< std::pair< unsigned int, Real >> &residuals, const std::vector< Real > &abs_tolerances) |
Based on the residuals, determine if the iterative process converged or not. More... | |
Real NS::FV::computeNormalizationFactor | ( | const NumericVector< Number > & | solution, |
const SparseMatrix< Number > & | mat, | ||
const NumericVector< Number > & | rhs | ||
) |
Compute a normalization factor which is applied to the linear residual to determine convergence.
This function is based on the description provided here: {greenshields2022notes, title={Notes on computational fluid dynamics: General principles}, author={Greenshields, Christopher J and Weller, Henry G}, journal={(No Title)}, year={2022} }
solution | The solution vector |
mat | The system matrix |
rhs | The system right hand side |
Definition at line 135 of file SegregatedSolverUtils.C.
Referenced by SIMPLESolveNonlinearAssembly::solveAdvectedSystem(), LinearAssemblySegregatedSolve::solveAdvectedSystem(), SIMPLESolveNonlinearAssembly::solveMomentumPredictor(), LinearAssemblySegregatedSolve::solveMomentumPredictor(), SIMPLESolveNonlinearAssembly::solvePressureCorrector(), LinearAssemblySegregatedSolve::solvePressureCorrector(), LinearAssemblySegregatedSolve::solveSolidEnergy(), and SIMPLESolveNonlinearAssembly::solveSolidEnergySystem().
void NS::FV::constrainSystem | ( | SparseMatrix< Number > & | mx, |
NumericVector< Number > & | rhs, | ||
const Real | desired_value, | ||
const dof_id_type | dof_id | ||
) |
Implicitly constrain the system by adding a factor*(u-u_desired) to it at a desired dof value.
To make sure the conditioning of the matrix does not change significantly, factor is chosen to be the diagonal component of the matrix coefficients for a given dof.
mx | The matrix of the system which needs to be constrained |
rhs | The right hand side of the system which needs to be constrained |
value | The desired value for the solution field at a dof |
dof_id | The ID of the dof which needs to be constrained |
Definition at line 180 of file SegregatedSolverUtils.C.
Referenced by SIMPLESolveNonlinearAssembly::solvePressureCorrector(), and LinearAssemblySegregatedSolve::solvePressureCorrector().
bool NS::FV::converged | ( | const std::vector< std::pair< unsigned int, Real >> & | residuals, |
const std::vector< Real > & | abs_tolerances | ||
) |
Based on the residuals, determine if the iterative process converged or not.
residuals | The current (number of iterations, residual) pairs |
abs_tolerances | The corresponding absolute tolerances. |
Definition at line 229 of file SegregatedSolverUtils.C.
Referenced by MechanicalContactConstraint::AugmentedLagrangianContactConverged(), GeneralizedReturnMappingSolutionTempl< is_ad >::convergedAcceptable(), SingleVariableReturnMappingSolutionTempl< is_ad >::convergedAcceptable(), SingularShapeTensorEliminatorUserObjectPD::execute(), externalPETScDiffusionFDMSolve(), GeneralizedReturnMappingSolutionTempl< is_ad >::internalSolve(), SingleVariableReturnMappingSolutionTempl< is_ad >::internalSolve(), FluidPropertiesUtils::NewtonSolve(), FluidPropertiesUtils::NewtonSolve2D(), ExplicitMixedOrder::performExplicitSolve(), LinearAssemblySegregatedSolve::solve(), SIMPLESolveNonlinearAssembly::solve(), ExplicitMixedOrder::solve(), and AdjointTransientSolve::solve().
dof_id_type NS::FV::findPointDoFID | ( | const MooseVariableFieldBase & | variable, |
const MooseMesh & | mesh, | ||
const Point & | point | ||
) |
Find the ID of the degree of freedom which corresponds to the variable and a given point on the mesh.
variable | Reference to the moose variable whose dof should be fetched |
mesh | The moose mesh where the element is |
point | The point on the mesh |
Definition at line 197 of file SegregatedSolverUtils.C.
Referenced by SIMPLESolveBase::setupPressurePin().
void NS::FV::limitSolutionUpdate | ( | NumericVector< Number > & | solution, |
const Real | min_limit = std::numeric_limits<Real>::epsilon() , |
||
const Real | max_limit = 1e10 |
||
) |
Limit a solution to its minimum and maximum bounds: $u = min(max(u, min_limit), max_limit)$.
system_in | The system whose solution shall be limited |
min_limit | = 0.0 The minimum limit for the solution |
max_limit | = 1e10 The maximum limit for the solution |
Definition at line 123 of file SegregatedSolverUtils.C.
Referenced by SIMPLESolveNonlinearAssembly::solve().
void NS::FV::relaxMatrix | ( | SparseMatrix< Number > & | matrix_in, |
const Real | relaxation_parameter, | ||
NumericVector< Number > & | diff_diagonal | ||
) |
Relax the matrix to ensure diagonal dominance, we hold onto the difference in diagonals for later use in relaxing the right hand side.
For the details of this relaxation process, see
Juretic, Franjo. Error analysis in finite volume CFD. Diss. Imperial College London (University of London), 2005.
matrix_in | The matrix that needs to be relaxed |
relaxation_parameter | The scale which described how much the matrix is relaxed |
diff_diagonal | A vector holding the $A_{diag}-A_{diag, relaxed}$ entries for further use in the relaxation of the right hand side |
Definition at line 25 of file SegregatedSolverUtils.C.
Referenced by SIMPLESolveNonlinearAssembly::solveAdvectedSystem(), LinearAssemblySegregatedSolve::solveAdvectedSystem(), SIMPLESolveNonlinearAssembly::solveMomentumPredictor(), and LinearAssemblySegregatedSolve::solveMomentumPredictor().
void NS::FV::relaxRightHandSide | ( | NumericVector< Number > & | rhs_in, |
const NumericVector< Number > & | solution_in, | ||
const NumericVector< Number > & | diff_diagonal | ||
) |
Relax the right hand side of an equation, this needs to be called once and the system matrix has been relaxed and the field describing the difference in the diagonals of the system matrix is already available.
The relaxation process needs modification to both the system matrix and the right hand side. For more information see:
Juretic, Franjo. Error analysis in finite volume CFD. Diss. Imperial College London (University of London), 2005.
rhs_in | The unrelaxed right hand side that needs to be relaxed |
solution_in | The solution |
diff_diagonal | The diagonal correction used for the corresponding system matrix |
Definition at line 91 of file SegregatedSolverUtils.C.
Referenced by SIMPLESolveNonlinearAssembly::solveAdvectedSystem(), LinearAssemblySegregatedSolve::solveAdvectedSystem(), SIMPLESolveNonlinearAssembly::solveMomentumPredictor(), and LinearAssemblySegregatedSolve::solveMomentumPredictor().
void NS::FV::relaxSolutionUpdate | ( | NumericVector< Number > & | vec_new, |
const NumericVector< Number > & | vec_old, | ||
const Real | relaxation_factor | ||
) |
Relax the update on a solution field using the following approach: $u = u_{old}+ (u - u_{old})$.
vector_new | The new solution vector |
vec_old | The old solution vector |
relaxation_factor | The lambda parameter in the expression above |
Definition at line 112 of file SegregatedSolverUtils.C.
Referenced by LinearAssemblySegregatedSolve::correctVelocity(), and SIMPLESolveNonlinearAssembly::solve().