mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: waveModel - enable restart
This commit is contained in:
@ -45,19 +45,45 @@ const Foam::word Foam::waveModel::dictName("waveProperties");
|
|||||||
|
|
||||||
Foam::word Foam::waveModel::modelName(const word& patchName)
|
Foam::word Foam::waveModel::modelName(const word& patchName)
|
||||||
{
|
{
|
||||||
word name = dictName + '.' + patchName;
|
return dictName + '.' + patchName;
|
||||||
|
|
||||||
if (Pstream::parRun())
|
|
||||||
{
|
|
||||||
name += ".proc" + Foam::name(Pstream::myProcNo());
|
|
||||||
}
|
|
||||||
|
|
||||||
return name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::IOdictionary Foam::waveModel::initialiseDict
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const word& patchName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
IOobject io
|
||||||
|
(
|
||||||
|
modelName(patchName),
|
||||||
|
Time::timeName(mesh.time().startTime().value()),
|
||||||
|
"uniform",
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
);
|
||||||
|
|
||||||
|
const word oldTypeName = IOdictionary::typeName;
|
||||||
|
|
||||||
|
const_cast<word&>(IOdictionary::typeName) = word::null;
|
||||||
|
|
||||||
|
if (!io.typeHeaderOk<IOdictionary>(false))
|
||||||
|
{
|
||||||
|
io.readOpt() = IOobject::NO_READ;
|
||||||
|
}
|
||||||
|
|
||||||
|
IOdictionary dict(io);
|
||||||
|
|
||||||
|
const_cast<word&>(IOdictionary::typeName) = oldTypeName;
|
||||||
|
|
||||||
|
return dict;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::waveModel::initialiseGeometry()
|
void Foam::waveModel::initialiseGeometry()
|
||||||
{
|
{
|
||||||
// Determine local patch co-ordinate system given by:
|
// Determine local patch co-ordinate system given by:
|
||||||
@ -248,17 +274,7 @@ Foam::waveModel::waveModel
|
|||||||
const bool readFields
|
const bool readFields
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
IOdictionary
|
IOdictionary(initialiseDict(mesh, patch.name())),
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
modelName(patch.name()),
|
|
||||||
mesh.time().timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::NO_READ
|
|
||||||
),
|
|
||||||
dict
|
|
||||||
),
|
|
||||||
mesh_(mesh),
|
mesh_(mesh),
|
||||||
patch_(patch),
|
patch_(patch),
|
||||||
g_(mesh.lookupObject<uniformDimensionedVectorField>("g").value()),
|
g_(mesh.lookupObject<uniformDimensionedVectorField>("g").value()),
|
||||||
@ -281,6 +297,8 @@ Foam::waveModel::waveModel
|
|||||||
U_(patch.size(), vector::zero),
|
U_(patch.size(), vector::zero),
|
||||||
alpha_(patch.size(), 0)
|
alpha_(patch.size(), 0)
|
||||||
{
|
{
|
||||||
|
merge(dict);
|
||||||
|
|
||||||
if (readFields)
|
if (readFields)
|
||||||
{
|
{
|
||||||
read();
|
read();
|
||||||
@ -331,6 +349,9 @@ bool Foam::waveModel::read()
|
|||||||
waterDepthRef_ = level.first();
|
waterDepthRef_ = level.first();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Insert the reference water depth into [this] to enable restart
|
||||||
|
add("waterDepthRef", waterDepthRef_);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -132,6 +132,13 @@ protected:
|
|||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Initialise dictionary
|
||||||
|
virtual IOdictionary initialiseDict
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const word& patchName
|
||||||
|
);
|
||||||
|
|
||||||
//- Initialise
|
//- Initialise
|
||||||
virtual void initialiseGeometry();
|
virtual void initialiseGeometry();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user