ENH: waveModel - updated restart method

This commit is contained in:
Andrew Heather
2016-11-23 15:48:56 +00:00
parent c7b51f98e7
commit bc05a40b56
22 changed files with 66 additions and 86 deletions

View File

@ -50,7 +50,7 @@ Foam::waveModels::waveAbsorptionModel::waveAbsorptionModel
{
if (readFields)
{
read();
read(dict);
}
}
@ -63,9 +63,9 @@ Foam::waveModels::waveAbsorptionModel::~waveAbsorptionModel()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::waveAbsorptionModel::read()
bool Foam::waveModels::waveAbsorptionModel::read(const dictionary& overrideDict)
{
if (waveModel::read())
if (waveModel::read(overrideDict))
{
// Note: always set to true
activeAbsorption_ = true;

View File

@ -70,7 +70,7 @@ public:
// Public Member Functions
//- Read from dictionary
virtual bool read();
virtual bool read(const dictionary& overrideDict);
};

View File

@ -92,7 +92,7 @@ Foam::waveModels::shallowWaterAbsorption::shallowWaterAbsorption
{
if (readFields)
{
read();
read(dict);
}
}
@ -105,9 +105,12 @@ Foam::waveModels::shallowWaterAbsorption::~shallowWaterAbsorption()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::shallowWaterAbsorption::read()
bool Foam::waveModels::shallowWaterAbsorption::read
(
const dictionary& overrideDict
)
{
return waveAbsorptionModel::read();
return waveAbsorptionModel::read(overrideDict);
}

View File

@ -94,7 +94,7 @@ public:
// Public Member Functions
//- Read from dictionary
virtual bool read();
virtual bool read(const dictionary& overrideDict);
};

View File

@ -76,7 +76,7 @@ Foam::waveModels::regularWaveModel::regularWaveModel
{
if (readFields)
{
read();
read(dict);
}
}
@ -89,9 +89,9 @@ Foam::waveModels::regularWaveModel::~regularWaveModel()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::regularWaveModel::read()
bool Foam::waveModels::regularWaveModel::read(const dictionary& overrideDict)
{
if (waveGenerationModel::read())
if (waveGenerationModel::read(overrideDict))
{
lookup("wavePeriod") >> wavePeriod_;
if (wavePeriod_ < 0)

View File

@ -99,7 +99,7 @@ public:
// Public Member Functions
//- Read from dictionary
virtual bool read();
virtual bool read(const dictionary& overrideDict);
//- Info
virtual void info(Ostream& os) const;

View File

@ -56,7 +56,7 @@ Foam::waveModels::solitaryWaveModel::solitaryWaveModel
{
if (readFields)
{
read();
read(dict);
}
}
@ -69,9 +69,9 @@ Foam::waveModels::solitaryWaveModel::~solitaryWaveModel()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::solitaryWaveModel::read()
bool Foam::waveModels::solitaryWaveModel::read(const dictionary& overrideDict)
{
if (waveGenerationModel::read())
if (waveGenerationModel::read(overrideDict))
{
return true;
}

View File

@ -81,7 +81,7 @@ public:
// Public Member Functions
//- Read from dictionary
virtual bool read();
virtual bool read(const dictionary& overrideDict);
//- Info
virtual void info(Ostream& os) const;

View File

@ -55,7 +55,7 @@ Foam::waveModels::waveGenerationModel::waveGenerationModel
{
if (readFields)
{
read();
read(dict);
}
}
@ -68,9 +68,9 @@ Foam::waveModels::waveGenerationModel::~waveGenerationModel()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::waveGenerationModel::read()
bool Foam::waveModels::waveGenerationModel::read(const dictionary& overrideDict)
{
if (waveModel::read())
if (waveModel::read(overrideDict))
{
lookup("rampTime") >> rampTime_;
lookup("activeAbsorption") >> activeAbsorption_;

View File

@ -80,7 +80,7 @@ public:
// Public Member Functions
//- Read from dictionary
virtual bool read();
virtual bool read(const dictionary& overrideDict);
//- Info
virtual void info(Ostream& os) const;

View File

@ -179,7 +179,7 @@ Foam::waveModels::Boussinesq::Boussinesq
{
if (readFields)
{
read();
read(dict);
}
}
@ -192,9 +192,9 @@ Foam::waveModels::Boussinesq::~Boussinesq()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::Boussinesq::read()
bool Foam::waveModels::Boussinesq::read(const dictionary& overrideDict)
{
if (solitaryWaveModel::read())
if (solitaryWaveModel::read(overrideDict))
{
return true;
}

View File

@ -127,7 +127,7 @@ public:
// Public Member Functions
//- Read from dictionary
virtual bool read();
virtual bool read(const dictionary& overrideDict);
//- Info
virtual void info(Ostream& os) const;

View File

@ -155,7 +155,7 @@ Foam::waveModels::StokesI::StokesI
{
if (readFields)
{
read();
read(dict);
}
}
@ -168,9 +168,9 @@ Foam::waveModels::StokesI::~StokesI()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::StokesI::read()
bool Foam::waveModels::StokesI::read(const dictionary& overrideDict)
{
if (regularWaveModel::read())
if (regularWaveModel::read(overrideDict))
{
waveLength_ = waveLength(waterDepthRef_, wavePeriod_);

View File

@ -120,7 +120,7 @@ public:
// Public Member Functions
//- Read from dictionary
virtual bool read();
virtual bool read(const dictionary& overrideDict);
//- Info
virtual void info(Ostream& os) const;

View File

@ -148,7 +148,7 @@ Foam::waveModels::StokesII::StokesII
{
if (readFields)
{
read();
read(dict);
}
}
@ -161,9 +161,9 @@ Foam::waveModels::StokesII::~StokesII()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::StokesII::read()
bool Foam::waveModels::StokesII::read(const dictionary& overrideDict)
{
if (StokesI::read())
if (StokesI::read(overrideDict))
{
return true;
}

View File

@ -110,7 +110,7 @@ public:
// Public Member Functions
//- Read from dictionary
virtual bool read();
virtual bool read(const dictionary& overrideDict);
//- Info
virtual void info(Ostream& os) const;

View File

@ -788,7 +788,7 @@ Foam::waveModels::StokesV::StokesV
{
if (readFields)
{
read();
read(dict);
}
}
@ -801,9 +801,9 @@ Foam::waveModels::StokesV::~StokesV()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::StokesV::read()
bool Foam::waveModels::StokesV::read(const dictionary& overrideDict)
{
if (regularWaveModel::read())
if (regularWaveModel::read(overrideDict))
{
scalar f1;
scalar f2;

View File

@ -209,7 +209,7 @@ public:
// Public Member Functions
//- Read from dictionary
virtual bool read();
virtual bool read(const dictionary& overrideDict);
//- Info
virtual void info(Ostream& os) const;

View File

@ -277,7 +277,7 @@ Foam::waveModels::cnoidal::cnoidal
{
if (readFields)
{
read();
read(dict);
}
}
@ -290,9 +290,9 @@ Foam::waveModels::cnoidal::~cnoidal()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::cnoidal::read()
bool Foam::waveModels::cnoidal::read(const dictionary& overrideDict)
{
if (regularWaveModel::read())
if (regularWaveModel::read(overrideDict))
{
// Initialise m parameter and wavelength
initialise

View File

@ -156,7 +156,7 @@ public:
// Public Member Functions
//- Read from dictionary
virtual bool read();
virtual bool read(const dictionary& overrideDict);
//- Info
virtual void info(Ostream& os) const;

View File

@ -51,39 +51,6 @@ Foam::word Foam::waveModel::modelName(const word& patchName)
// * * * * * * * * * * * * 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()
{
// Determine local patch co-ordinate system given by:
@ -274,7 +241,18 @@ Foam::waveModel::waveModel
const bool readFields
)
:
IOdictionary(initialiseDict(mesh, patch.name())),
IOdictionary
(
IOobject
(
modelName(patch.name()),
Time::timeName(mesh.time().startTime().value()),
"uniform",
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
)
),
mesh_(mesh),
patch_(patch),
g_(mesh.lookupObject<uniformDimensionedVectorField>("g").value()),
@ -297,11 +275,9 @@ Foam::waveModel::waveModel
U_(patch.size(), vector::zero),
alpha_(patch.size(), 0)
{
merge(dict);
if (readFields)
{
read();
read(dict);
}
}
@ -314,8 +290,16 @@ Foam::waveModel::~waveModel()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModel::read()
bool Foam::waveModel::read(const dictionary& overrideDict)
{
readOpt() = IOobject::READ_IF_PRESENT;
if (headerOk())
{
IOdictionary::regIOobject::read();
}
merge(overrideDict);
readIfPresent("U", UName_);
readIfPresent("alpha", alphaName_);

View File

@ -132,13 +132,6 @@ protected:
// Protected Member Functions
//- Initialise dictionary
virtual IOdictionary initialiseDict
(
const fvMesh& mesh,
const word& patchName
);
//- Initialise
virtual void initialiseGeometry();
@ -237,7 +230,7 @@ public:
static word modelName(const word& patchName);
//- Read from dictionary
virtual bool read();
virtual bool read(const dictionary& overrideDict);
//- Return the latest wave velocity prediction
virtual const vectorField& U() const;