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");
|
||||
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),
|
||||
eqnRelaxDefault_(0),
|
||||
solvers_(dictionary::null),
|
||||
solverPerformance_(dictionary::null),
|
||||
prevTimeIndex_(0)
|
||||
{
|
||||
if (!headerOk())
|
||||
|
@ -411,9 +417,9 @@ bool Foam::solution::writeData(Ostream& os) const
|
|||
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
|
||||
{
|
||||
dictionary& dict = const_cast<dictionary&>(solverPerformanceDict());
|
||||
|
||||
List<lduSolverPerformance> perfs;
|
||||
|
||||
if (prevTimeIndex_ != this->time().timeIndex())
|
||||
{
|
||||
// Reset solver performance between iterations
|
||||
prevTimeIndex_ = this->time().timeIndex();
|
||||
dict.clear();
|
||||
solverPerformance_.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
dict.readIfPresent(name, perfs);
|
||||
solverPerformance_.readIfPresent(name, perfs);
|
||||
}
|
||||
|
||||
// Append to list
|
||||
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 solvers_;
|
||||
|
||||
//- Dictionary of solver performance. Used in convergence check
|
||||
mutable dictionary solverPerformance_;
|
||||
|
||||
//- Previously used time-index, used for reset between iterations
|
||||
mutable label prevTimeIndex_;
|
||||
|
||||
|
@ -151,7 +154,7 @@ public:
|
|||
//- Return the dictionary of solver performance data
|
||||
// which includes initial and final residuals for convergence
|
||||
// checking
|
||||
const dictionary& solverPerformanceDict() const;
|
||||
dictionary& solverPerformanceDict() const;
|
||||
|
||||
//- Add/set the solverPerformance entry for the named field
|
||||
void setSolverPerformance
|
||||
|
|
Reference in a new issue