mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
extend fvSolution re-write to also include the 'smooth' entry
This commit is contained in:
@ -90,7 +90,12 @@ int main(int argc, char *argv[])
|
|||||||
solutionDict.objectPath() + ".old"
|
solutionDict.objectPath() + ".old"
|
||||||
);
|
);
|
||||||
|
|
||||||
solutionDict.regIOobject::write();
|
solutionDict.writeObject
|
||||||
|
(
|
||||||
|
IOstream::ASCII,
|
||||||
|
IOstream::currentVersion,
|
||||||
|
IOstream::UNCOMPRESSED
|
||||||
|
);
|
||||||
|
|
||||||
Info<< "Backup to " << (solutionDict.objectPath() + ".old") << nl
|
Info<< "Backup to " << (solutionDict.objectPath() + ".old") << nl
|
||||||
<< "Write to " << solutionDict.objectPath() << nl << endl;
|
<< "Write to " << solutionDict.objectPath() << nl << endl;
|
||||||
|
|||||||
@ -396,6 +396,9 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
//- Find the smoother name (directly or from a sub-dictionary)
|
||||||
|
static word getName(const dictionary&);
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
virtual const word& type() const = 0;
|
virtual const word& type() const = 0;
|
||||||
|
|
||||||
|
|||||||
@ -36,6 +36,29 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::word
|
||||||
|
Foam::lduMatrix::smoother::getName
|
||||||
|
(
|
||||||
|
const dictionary& solverControls
|
||||||
|
)
|
||||||
|
{
|
||||||
|
word name;
|
||||||
|
|
||||||
|
// handle primitive or dictionary entry
|
||||||
|
const entry& e = solverControls.lookupEntry("smoother", false, false);
|
||||||
|
if (e.isDict())
|
||||||
|
{
|
||||||
|
e.dict().lookup("smoother") >> name;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e.stream() >> name;
|
||||||
|
}
|
||||||
|
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::autoPtr<Foam::lduMatrix::smoother> Foam::lduMatrix::smoother::New
|
Foam::autoPtr<Foam::lduMatrix::smoother> Foam::lduMatrix::smoother::New
|
||||||
(
|
(
|
||||||
const word& fieldName,
|
const word& fieldName,
|
||||||
|
|||||||
@ -27,13 +27,23 @@ License
|
|||||||
#include "solution.H"
|
#include "solution.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
|
|
||||||
// these two are for old syntax compatibility:
|
// these are for old syntax compatibility:
|
||||||
#include "BICCG.H"
|
#include "BICCG.H"
|
||||||
#include "ICCG.H"
|
#include "ICCG.H"
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
#include "IStringStream.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
int Foam::solution::debug(::Foam::debug::debugSwitch("solution", 0));
|
int Foam::solution::debug(::Foam::debug::debugSwitch("solution", 0));
|
||||||
|
|
||||||
|
// list of sub-dictionaries to rewrite
|
||||||
|
//! @cond localScope
|
||||||
|
static const Foam::List<Foam::word> subDictNames
|
||||||
|
(
|
||||||
|
Foam::IStringStream("(preconditioner smoother)")()
|
||||||
|
);
|
||||||
|
//! @endcond localScope
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::solution::solution(const objectRegistry& obr, const fileName& dictName)
|
Foam::solution::solution(const objectRegistry& obr, const fileName& dictName)
|
||||||
@ -91,31 +101,32 @@ Foam::label Foam::solution::upgradeSolverDict
|
|||||||
subdict.add("solver", name);
|
subdict.add("solver", name);
|
||||||
subdict <<= dictionary(is);
|
subdict <<= dictionary(is);
|
||||||
|
|
||||||
// preconditioner can be a primitiveEntry w/o settings,
|
// preconditioner and smoother entries can be
|
||||||
// or a dictionaryEntry.
|
// 1) primitiveEntry w/o settings,
|
||||||
|
// 2) or a dictionaryEntry.
|
||||||
// transform primitiveEntry with settings -> dictionaryEntry
|
// transform primitiveEntry with settings -> dictionaryEntry
|
||||||
entry* precond = subdict.lookupEntryPtr
|
forAll(subDictNames, dictI)
|
||||||
(
|
|
||||||
"preconditioner",
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
if (precond && !precond->isDict())
|
|
||||||
{
|
{
|
||||||
Istream& is = precond->stream();
|
const word& dictName = subDictNames[dictI];
|
||||||
|
entry* ePtr = subdict.lookupEntryPtr(dictName,false,false);
|
||||||
|
|
||||||
|
if (ePtr && !ePtr->isDict())
|
||||||
|
{
|
||||||
|
Istream& is = ePtr->stream();
|
||||||
is >> name;
|
is >> name;
|
||||||
|
|
||||||
if (!is.eof())
|
if (!is.eof())
|
||||||
{
|
{
|
||||||
dictionary precondDict;
|
dictionary newDict;
|
||||||
precondDict.add("preconditioner", name);
|
newDict.add(dictName, name);
|
||||||
precondDict <<= dictionary(is);
|
newDict <<= dictionary(is);
|
||||||
|
|
||||||
subdict.set("preconditioner", precondDict);
|
subdict.set(dictName, newDict);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// write out information to help people adjust to the new syntax
|
// write out information to help people adjust to the new syntax
|
||||||
if (verbose)
|
if (verbose)
|
||||||
|
|||||||
Reference in New Issue
Block a user