ENH: avoid the build-up of the background solver dictionary

The solverPerformanceDict gets larger due to the addition of a SolverPerformance
data per field at every outer iteration within the same main iteration/time
step.

However, the subsequent functionalities seem to use only the first and last
element of this dictionary per field; therefore, storing the interim values
was revealed to be redundant.

The change removes the interim values by transforming the `List` container
into the `Pair` container, and modifying the relevant algorithms.
This commit is contained in:
Kutalmis Bercin
2025-05-01 14:56:31 +01:00
parent 5bb030480d
commit ebbeef27b4
5 changed files with 17 additions and 8 deletions

View File

@ -43,7 +43,7 @@ equationInitialResidualCondition::setResidual
if (canSet && mesh.foundObject<volFieldType>(fieldName))
{
const List<SolverPerformance<Type>> sp(dict.lookup(fieldName));
const Pair<SolverPerformance<Type>> sp(dict.lookup(fieldName));
const Type& allComponents = sp.first().initialResidual();
if (componenti != -1)

View File

@ -107,7 +107,7 @@ bool Foam::functionObjects::runTimeControls::equationMaxIterCondition::apply()
if (solverDict.found(fieldName))
{
const List<solverPerformance> sp(solverDict.lookup(fieldName));
const Pair<solverPerformance> sp(solverDict.lookup(fieldName));
const label nIterations = sp.first().nIterations();
result[fieldi] = nIterations;

View File

@ -119,7 +119,7 @@ void Foam::functionObjects::solverInfo::updateSolverInfo(const word& fieldName)
if (solverDict.found(fieldName))
{
const List<SolverPerformance<Type>> sp
const Pair<SolverPerformance<Type>> sp
(
solverDict.lookup(fieldName)
);