Added solverPerformance dictionary
This commit is contained in:
parent
60d21de6de
commit
d121c473cb
2 changed files with 16 additions and 9 deletions
|
@ -122,6 +122,11 @@ void Foam::solution::read(const dictionary& dict)
|
||||||
solvers_ = dict.subDict("solvers");
|
solvers_ = dict.subDict("solvers");
|
||||||
upgradeSolverDict(solvers_);
|
upgradeSolverDict(solvers_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dict.found("solverPerformance"))
|
||||||
|
{
|
||||||
|
solverPerformance_ = dict.subDict("solverPerformance");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -147,6 +152,7 @@ Foam::solution::solution(const objectRegistry& obr, const fileName& dictName)
|
||||||
fieldRelaxDefault_(0),
|
fieldRelaxDefault_(0),
|
||||||
eqnRelaxDefault_(0),
|
eqnRelaxDefault_(0),
|
||||||
solvers_(dictionary::null),
|
solvers_(dictionary::null),
|
||||||
|
solverPerformance_(dictionary::null),
|
||||||
prevTimeIndex_(0)
|
prevTimeIndex_(0)
|
||||||
{
|
{
|
||||||
if (!headerOk())
|
if (!headerOk())
|
||||||
|
@ -411,9 +417,9 @@ bool Foam::solution::writeData(Ostream& os) const
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Foam::dictionary& Foam::solution::solverPerformanceDict() const
|
Foam::dictionary& Foam::solution::solverPerformanceDict() const
|
||||||
{
|
{
|
||||||
return subDict("solverPerformance");
|
return solverPerformance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -423,25 +429,23 @@ void Foam::solution::setSolverPerformance
|
||||||
const lduSolverPerformance& sp
|
const lduSolverPerformance& sp
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
dictionary& dict = const_cast<dictionary&>(solverPerformanceDict());
|
|
||||||
|
|
||||||
List<lduSolverPerformance> perfs;
|
List<lduSolverPerformance> perfs;
|
||||||
|
|
||||||
if (prevTimeIndex_ != this->time().timeIndex())
|
if (prevTimeIndex_ != this->time().timeIndex())
|
||||||
{
|
{
|
||||||
// Reset solver performance between iterations
|
// Reset solver performance between iterations
|
||||||
prevTimeIndex_ = this->time().timeIndex();
|
prevTimeIndex_ = this->time().timeIndex();
|
||||||
dict.clear();
|
solverPerformance_.clear();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dict.readIfPresent(name, perfs);
|
solverPerformance_.readIfPresent(name, perfs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Append to list
|
// Append to list
|
||||||
perfs.setSize(perfs.size() + 1, sp);
|
perfs.setSize(perfs.size() + 1, sp);
|
||||||
|
|
||||||
dict.set(name, perfs);
|
solverPerformance_.set(name, perfs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -75,6 +75,9 @@ class solution
|
||||||
//- Dictionary of solver parameters for all the fields
|
//- Dictionary of solver parameters for all the fields
|
||||||
dictionary solvers_;
|
dictionary solvers_;
|
||||||
|
|
||||||
|
//- Dictionary of solver performance. Used in convergence check
|
||||||
|
mutable dictionary solverPerformance_;
|
||||||
|
|
||||||
//- Previously used time-index, used for reset between iterations
|
//- Previously used time-index, used for reset between iterations
|
||||||
mutable label prevTimeIndex_;
|
mutable label prevTimeIndex_;
|
||||||
|
|
||||||
|
@ -151,7 +154,7 @@ public:
|
||||||
//- Return the dictionary of solver performance data
|
//- Return the dictionary of solver performance data
|
||||||
// which includes initial and final residuals for convergence
|
// which includes initial and final residuals for convergence
|
||||||
// checking
|
// checking
|
||||||
const dictionary& solverPerformanceDict() const;
|
dictionary& solverPerformanceDict() const;
|
||||||
|
|
||||||
//- Add/set the solverPerformance entry for the named field
|
//- Add/set the solverPerformance entry for the named field
|
||||||
void setSolverPerformance
|
void setSolverPerformance
|
||||||
|
|
Reference in a new issue