mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
solverPerformance: added a "max" function
Improves the handling of residuals from the segregated solution of vectors and tensors.
This commit is contained in:
@ -210,6 +210,16 @@ public:
|
|||||||
void print() const;
|
void print() const;
|
||||||
|
|
||||||
|
|
||||||
|
// Friend functions
|
||||||
|
|
||||||
|
//- Return the element-wise maximum of two solverPerformances
|
||||||
|
friend solverPerformance max
|
||||||
|
(
|
||||||
|
const solverPerformance&,
|
||||||
|
const solverPerformance&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// Ostream Operator
|
// Ostream Operator
|
||||||
|
|
||||||
friend Ostream& operator<<(Ostream&, const solverPerformance&);
|
friend Ostream& operator<<(Ostream&, const solverPerformance&);
|
||||||
|
|||||||
@ -118,6 +118,25 @@ void Foam::lduMatrix::solverPerformance::print() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::lduMatrix::solverPerformance::solverPerformance Foam::max
|
||||||
|
(
|
||||||
|
const lduMatrix::solverPerformance& sp1,
|
||||||
|
const lduMatrix::solverPerformance& sp2
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return lduMatrix::solverPerformance
|
||||||
|
(
|
||||||
|
sp1.solverName(),
|
||||||
|
sp1.fieldName_,
|
||||||
|
max(sp1.initialResidual(), sp2.initialResidual()),
|
||||||
|
max(sp1.finalResidual(), sp2.finalResidual()),
|
||||||
|
max(sp1.nIterations(), sp2.nIterations()),
|
||||||
|
sp1.converged() && sp2.converged(),
|
||||||
|
sp1.singular() || sp2.singular()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::Ostream& Foam::operator<<
|
Foam::Ostream& Foam::operator<<
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
@ -137,4 +156,5 @@ Foam::Ostream& Foam::operator<<
|
|||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -149,14 +149,7 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::solve
|
|||||||
|
|
||||||
solverPerf.print();
|
solverPerf.print();
|
||||||
|
|
||||||
if
|
solverPerfVec = max(solverPerfVec, solverPerf);
|
||||||
(
|
|
||||||
solverPerf.initialResidual() > solverPerfVec.initialResidual()
|
|
||||||
&& !solverPerf.singular()
|
|
||||||
)
|
|
||||||
{
|
|
||||||
solverPerfVec = solverPerf;
|
|
||||||
}
|
|
||||||
|
|
||||||
psi.internalField().replace(cmpt, psiCmpt);
|
psi.internalField().replace(cmpt, psiCmpt);
|
||||||
diag() = saveDiag;
|
diag() = saveDiag;
|
||||||
|
|||||||
Reference in New Issue
Block a user