STYLE: avoid unrestricted dictionary lookup in randomProcesses, waveModels

- ref issue #762

STYLE: consistency in file vs files for pointNoise and surfaceNoise

- use "files" when available, fallback to "file" otherwise.
This commit is contained in:
Mark Olesen
2018-07-23 18:13:43 +02:00
parent 18b134319d
commit 9f0a80a655
56 changed files with 153 additions and 312 deletions

View File

@ -144,8 +144,8 @@ Foam::fft::realTransform1D(const scalarField& field)
fftw_execute(plan); fftw_execute(plan);
// field[0] = DC component // field[0] = DC component
tmp<complexField> tresult(new complexField(nBy2 + 1)); auto tresult = tmp<complexField>::New(nBy2 + 1);
complexField& result = tresult.ref(); auto& result = tresult.ref();
result[0].Re() = out[0]; result[0].Re() = out[0];
result[nBy2].Re() = out[nBy2]; result[nBy2].Re() = out[nBy2];
@ -237,7 +237,7 @@ Foam::tmp<Foam::complexField> Foam::fft::forwardTransform
const UList<int>& nn const UList<int>& nn
) )
{ {
tmp<complexField> tresult(new complexField(tfield)); auto tresult = tmp<complexField>::New(tfield);
transform(tresult.ref(), nn, FORWARD_TRANSFORM); transform(tresult.ref(), nn, FORWARD_TRANSFORM);
@ -253,7 +253,7 @@ Foam::tmp<Foam::complexField> Foam::fft::reverseTransform
const UList<int>& nn const UList<int>& nn
) )
{ {
tmp<complexField> tresult(new complexField(tfield)); auto tresult = tmp<complexField>::New(tfield);
transform(tresult.ref(), nn, REVERSE_TRANSFORM); transform(tresult.ref(), nn, REVERSE_TRANSFORM);

View File

@ -43,10 +43,10 @@ Foam::tmp<Foam::scalarField> Foam::noiseFFT::frequencies
const scalar deltaT const scalar deltaT
) )
{ {
tmp<scalarField> tf(new scalarField(N/2, 0)); auto tf = tmp<scalarField>::New(N/2, Zero);
scalarField& f = tf.ref(); auto& f = tf.ref();
scalar deltaf = 1.0/(N*deltaT); const scalar deltaf = 1.0/(N*deltaT);
forAll(f, i) forAll(f, i)
{ {
f[i] = i*deltaf; f[i] = i*deltaf;
@ -297,8 +297,8 @@ Foam::tmp<Foam::scalarField> Foam::noiseFFT::Pf
const label n = planInfo_.windowSize; const label n = planInfo_.windowSize;
const label nBy2 = n/2; const label nBy2 = n/2;
tmp<scalarField> tresult(new scalarField(nBy2 + 1)); auto tresult = tmp<scalarField>::New(nBy2 + 1);
scalarField& result = tresult.ref(); auto& result = tresult.ref();
// 0 th value = DC component // 0 th value = DC component
// nBy2 th value = real only if n is even // nBy2 th value = real only if n is even
@ -312,10 +312,8 @@ Foam::tmp<Foam::scalarField> Foam::noiseFFT::Pf
return tresult; return tresult;
} }
else
{ return mag(fft::realTransform1D(tpn));
return mag(fft::realTransform1D(tpn));
}
} }

View File

@ -109,7 +109,7 @@ public:
//- Construct from pressure field //- Construct from pressure field
noiseFFT(const scalar deltaT, const label windowSize = -1); noiseFFT(const scalar deltaT, const label windowSize = -1);
//- Destructor //- Destructor. Cleanup/destroy plan
~noiseFFT(); ~noiseFFT();

View File

@ -183,12 +183,6 @@ Foam::noiseModel::noiseModel(const dictionary& dict, const bool readFields)
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::noiseModel::~noiseModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::noiseModel::read(const dictionary& dict) bool Foam::noiseModel::read(const dictionary& dict)

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015-2017 OpenCFD Ltd. \\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -66,7 +66,6 @@ Description
writeOctaves | Write octaves data | no | yes writeOctaves | Write octaves data | no | yes
\endtable \endtable
SourceFiles SourceFiles
noiseModel.C noiseModel.C
@ -92,18 +91,6 @@ namespace Foam
class noiseModel class noiseModel
{ {
private:
// Private Member Functions
//- No copy construct
noiseModel(const noiseModel&) = delete;
//- No copy assignment
void operator=(const noiseModel&) = delete;
protected: protected:
// Protected Data // Protected Data
@ -196,6 +183,13 @@ protected:
fileName baseFileDir(const label dataseti) const; fileName baseFileDir(const label dataseti) const;
//- No copy construct
noiseModel(const noiseModel&) = delete;
//- No copy assignment
void operator=(const noiseModel&) = delete;
public: public:
//- Runtime type information //- Runtime type information
@ -220,7 +214,7 @@ public:
noiseModel(const dictionary& dict, const bool readFields = true); noiseModel(const dictionary& dict, const bool readFields = true);
//- Destructor //- Destructor
virtual ~noiseModel(); virtual ~noiseModel() = default;
// Public Member Functions // Public Member Functions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -29,7 +29,7 @@ License
Foam::autoPtr<Foam::noiseModel> Foam::noiseModel::New(const dictionary& dict) Foam::autoPtr<Foam::noiseModel> Foam::noiseModel::New(const dictionary& dict)
{ {
const word modelType(dict.lookup("noiseModel")); const word modelType(dict.get<word>("noiseModel"));
Info<< "Selecting noiseModel " << modelType << endl; Info<< "Selecting noiseModel " << modelType << endl;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015-2017 OpenCFD Ltd. \\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -226,12 +226,6 @@ pointNoise::pointNoise(const dictionary& dict, const bool readFields)
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
pointNoise::~pointNoise()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void pointNoise::calculate() void pointNoise::calculate()
@ -242,7 +236,6 @@ void pointNoise::calculate()
return; return;
} }
forAll(inputFileNames_, filei) forAll(inputFileNames_, filei)
{ {
fileName fName = inputFileNames_[filei]; fileName fName = inputFileNames_[filei];
@ -264,10 +257,10 @@ bool pointNoise::read(const dictionary& dict)
{ {
if (!dict.readIfPresent("files", inputFileNames_)) if (!dict.readIfPresent("files", inputFileNames_))
{ {
inputFileNames_.setSize(1); inputFileNames_.resize(1);
// Note: lookup uses same keyword as used by the CSV constructor // Note: lookup uses same keyword as used by the CSV constructor
dict.lookup("file") >> inputFileNames_[0]; dict.read("file", inputFileNames_.first());
} }
return true; return true;

View File

@ -130,7 +130,7 @@ public:
pointNoise(const dictionary& dict, const bool readFields = true); pointNoise(const dictionary& dict, const bool readFields = true);
//- Destructor //- Destructor
virtual ~pointNoise(); virtual ~pointNoise() = default;
// Public Member Functions // Public Member Functions

View File

@ -428,22 +428,18 @@ bool surfaceNoise::read(const dictionary& dict)
{ {
if (noiseModel::read(dict)) if (noiseModel::read(dict))
{ {
if (dict.found("file")) if (!dict.readIfPresent("files", inputFileNames_))
{ {
inputFileNames_.setSize(1); inputFileNames_.resize(1);
dict.lookup("file") >> inputFileNames_[0]; dict.read("file", inputFileNames_.first());
}
else
{
dict.lookup("files") >> inputFileNames_;
} }
dict.readIfPresent("fftWriteInterval", fftWriteInterval_); dict.readIfPresent("fftWriteInterval", fftWriteInterval_);
dict.readIfPresent("p", pName_); dict.readIfPresent("p", pName_);
dict.lookup("reader") >> readerType_; dict.read("reader", readerType_);
word writerType(dict.lookup("writer")); const word writerType(dict.get<word>("writer"));
dictionary optDict dictionary optDict
( (
dict.subOrEmptyDict("writeOptions").subOrEmptyDict(writerType) dict.subOrEmptyDict("writeOptions").subOrEmptyDict(writerType)

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015-2017 OpenCFD Ltd. \\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

@ -63,10 +63,10 @@ UOprocess::UOprocess
RootDeltaT(sqrt(DeltaT)), RootDeltaT(sqrt(DeltaT)),
UOfield(Mesh.size()), UOfield(Mesh.size()),
Alpha(readScalar(UOdict.lookup("UOalpha"))), Alpha(UOdict.get<scalar>("UOalpha")),
Sigma(readScalar(UOdict.lookup("UOsigma"))), Sigma(UOdict.get<scalar>("UOsigma")),
Kupper(readScalar(UOdict.lookup("UOKupper"))), Kupper(UOdict.get<scalar>("UOKupper")),
Klower(readScalar(UOdict.lookup("UOKlower"))), Klower(UOdict.get<scalar>("UOKlower")),
Scale((Kupper - Klower)*pow(scalar(Mesh.size()), 1.0/vector::dim)) Scale((Kupper - Klower)*pow(scalar(Mesh.size()), 1.0/vector::dim))
{ {
const vectorField& K = Mesh; const vectorField& K = Mesh;

View File

@ -45,13 +45,13 @@ addToRunTimeSelectionTable(windowModel, Hanning, dictionary);
Hanning::Hanning(const dictionary& dict, const label nSamples) Hanning::Hanning(const dictionary& dict, const label nSamples)
: :
windowModel(dict, nSamples), windowModel(dict, nSamples),
symmetric_(readBool(dict.lookup("symmetric"))), symmetric_(dict.get<bool>("symmetric")),
extended_(readBool(dict.lookup("extended"))), extended_(dict.get<bool>("extended")),
alpha_(dict.lookupOrDefault("alpha", 0.5)) // Hamming = 0.54 alpha_(dict.lookupOrDefault("alpha", 0.5)) // Hamming = 0.54
{ {
// Extend range if required // Extend range if required
label offset = extended_ ? 1 : 0; const label offset = extended_ ? 1 : 0;
scalar m = nSamples - 1 + 2*offset; const scalar m = nSamples - 1 + 2*offset;
scalarField t(nSamples); scalarField t(nSamples);
forAll(t, i) forAll(t, i)
@ -81,19 +81,13 @@ Hanning::Hanning(const dictionary& dict, const label nSamples)
} }
} }
scalar sumSqr = sum(sqr(wf)); const scalar sumSqr = sum(sqr(wf));
// Normalisation // Normalisation
wf *= sqrt(nSamples/sumSqr); wf *= sqrt(nSamples/sumSqr);
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Hanning::~Hanning()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Hanning::symmetric() const bool Hanning::symmetric() const

View File

@ -97,7 +97,7 @@ public:
Hanning(const dictionary& dict, const label nSamples); Hanning(const dictionary& dict, const label nSamples);
//- Destructor //- Destructor
virtual ~Hanning(); virtual ~Hanning() = default;
// Public Member Functions // Public Member Functions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -45,19 +45,13 @@ addToRunTimeSelectionTable(windowModel, uniform, dictionary);
uniform::uniform(const dictionary& dict, const label nSamples) uniform::uniform(const dictionary& dict, const label nSamples)
: :
windowModel(dict, nSamples), windowModel(dict, nSamples),
value_(readScalar(dict.lookup("value"))) value_(dict.get<scalar>("value"))
{ {
scalarField& wf = *this; scalarField& wf = *this;
wf = value_; wf = value_;
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
uniform::~uniform()
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace windowModels } // End namespace windowModels

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -73,7 +73,7 @@ public:
uniform(const dictionary& dict, const label nSamples); uniform(const dictionary& dict, const label nSamples);
//- Destructor //- Destructor
virtual ~uniform(); virtual ~uniform() = default;
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -42,17 +42,13 @@ Foam::windowModel::windowModel(const dictionary& dict, const label nSamples)
nOverlapSamples_(0), nOverlapSamples_(0),
nWindow_(dict.lookupOrDefault("nWindow", -1)) nWindow_(dict.lookupOrDefault("nWindow", -1))
{ {
scalar prc = readScalar(dict.lookup("overlapPercent")); nOverlapSamples_ = floor
nOverlapSamples_ = floor(prc/scalar(100)*nSamples); (
dict.get<scalar>("overlapPercent")/scalar(100)*nSamples
);
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::windowModel::~windowModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::label Foam::windowModel::nSamples() const Foam::label Foam::windowModel::nSamples() const
@ -87,7 +83,7 @@ Foam::label Foam::windowModel::validate(const label nSamplesTotal)
<< exit(FatalError); << exit(FatalError);
} }
label nWindowAvailable = nWindowsTotal(nSamplesTotal); const label nWindowAvailable = nWindowsTotal(nSamplesTotal);
if (nWindow_ == -1) if (nWindow_ == -1)
{ {
@ -107,7 +103,7 @@ Foam::label Foam::windowModel::validate(const label nSamplesTotal)
<< exit(FatalError); << exit(FatalError);
} }
label nRequiredSamples = const label nRequiredSamples =
nWindow_*nSamples - (nWindow_ - 1)*nOverlapSamples_; nWindow_*nSamples - (nWindow_ - 1)*nOverlapSamples_;
Info<< "Windowing:" << nl Info<< "Windowing:" << nl

View File

@ -2,8 +2,8 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -98,7 +98,7 @@ public:
//- Destructor //- Destructor
virtual ~windowModel(); virtual ~windowModel() = default;
// Public Member Functions // Public Member Functions

View File

@ -33,7 +33,7 @@ Foam::autoPtr<Foam::windowModel> Foam::windowModel::New
const label nSamples const label nSamples
) )
{ {
const word modelType(dict.lookup("windowModel")); const word modelType(dict.get<word>("windowModel"));
Info<< "Selecting windowModel " << modelType << endl; Info<< "Selecting windowModel " << modelType << endl;
@ -53,7 +53,6 @@ Foam::autoPtr<Foam::windowModel> Foam::windowModel::New
( (
cstrIter()(dict.subDict(modelType + "Coeffs"), nSamples) cstrIter()(dict.subDict(modelType + "Coeffs"), nSamples)
); );
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -48,8 +48,8 @@ Foam::tmp<Foam::Field<Type>> Foam::windowModel::apply
} }
tmp<Field<Type>> tresult(new Field<Type>(nSamples, pTraits<Type>::zero)); auto tresult = tmp<Field<Type>>::New(nSamples, Zero);
Field<Type>& result = tresult.ref(); auto& result = tresult.ref();
label nWindow = nWindowsTotal(fld.size()); label nWindow = nWindowsTotal(fld.size());
if (windowI >= nWindow) if (windowI >= nWindow)

View File

@ -53,7 +53,7 @@ namespace fv
Foam::tmp<Foam::volScalarField> Foam::tmp<Foam::volScalarField>
Foam::fv::multiphaseMangrovesSource::dragCoeff(const volVectorField& U) const Foam::fv::multiphaseMangrovesSource::dragCoeff(const volVectorField& U) const
{ {
tmp<volScalarField> tdragCoeff = tmp<volScalarField>::New auto tdragCoeff = tmp<volScalarField>::New
( (
IOobject IOobject
( (
@ -66,8 +66,7 @@ Foam::fv::multiphaseMangrovesSource::dragCoeff(const volVectorField& U) const
mesh_, mesh_,
dimensionedScalar(dimless/dimTime, Zero) dimensionedScalar(dimless/dimTime, Zero)
); );
auto& dragCoeff = tdragCoeff.ref();
volScalarField& dragCoeff = tdragCoeff.ref();
forAll(zoneIDs_, i) forAll(zoneIDs_, i)
{ {
@ -99,7 +98,7 @@ Foam::fv::multiphaseMangrovesSource::dragCoeff(const volVectorField& U) const
Foam::tmp<Foam::volScalarField> Foam::tmp<Foam::volScalarField>
Foam::fv::multiphaseMangrovesSource::inertiaCoeff() const Foam::fv::multiphaseMangrovesSource::inertiaCoeff() const
{ {
tmp<volScalarField> tinertiaCoeff = tmp<volScalarField>::New auto tinertiaCoeff = tmp<volScalarField>::New
( (
IOobject IOobject
( (
@ -112,8 +111,7 @@ Foam::fv::multiphaseMangrovesSource::inertiaCoeff() const
mesh_, mesh_,
dimensionedScalar(dimless, Zero) dimensionedScalar(dimless, Zero)
); );
auto& inertiaCoeff = tinertiaCoeff.ref();
volScalarField& inertiaCoeff = tinertiaCoeff.ref();
const scalar pi = constant::mathematical::pi; const scalar pi = constant::mathematical::pi;
@ -229,7 +227,7 @@ bool Foam::fv::multiphaseMangrovesSource::read(const dictionary& dict)
const word& regionName = regionNames[i]; const word& regionName = regionNames[i];
const dictionary& modelDict = regionsDict.subDict(regionName); const dictionary& modelDict = regionsDict.subDict(regionName);
const word& zoneName = modelDict.lookup("cellZone"); const word zoneName(modelDict.get<word>("cellZone"));
zoneIDs_[i] = mesh_.cellZones().findIndices(zoneName); zoneIDs_[i] = mesh_.cellZones().findIndices(zoneName);
if (zoneIDs_[i].empty()) if (zoneIDs_[i].empty())
{ {
@ -239,18 +237,16 @@ bool Foam::fv::multiphaseMangrovesSource::read(const dictionary& dict)
<< exit(FatalError); << exit(FatalError);
} }
modelDict.lookup("a") >> aZone_[i]; modelDict.read("a", aZone_[i]);
modelDict.lookup("N") >> NZone_[i]; modelDict.read("N", NZone_[i]);
modelDict.lookup("Cm") >> CmZone_[i]; modelDict.read("Cm", CmZone_[i]);
modelDict.lookup("Cd") >> CdZone_[i]; modelDict.read("Cd", CdZone_[i]);
} }
return true; return true;
} }
else
{ return false;
return false;
}
} }

View File

@ -47,12 +47,12 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declarations
class MangrovesModel; class MangrovesModel;
namespace fv namespace fv
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class multiphaseMangrovesSource Declaration Class multiphaseMangrovesSource Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -63,12 +63,11 @@ class multiphaseMangrovesSource
{ {
// Private Member Functions // Private Member Functions
//- Disallow default bitwise copy construct //- No copy construct
multiphaseMangrovesSource(const multiphaseMangrovesSource&); multiphaseMangrovesSource(const multiphaseMangrovesSource&) = delete;
//- Disallow default bitwise assignment
void operator=(const multiphaseMangrovesSource&);
//- No copy assignment
void operator=(const multiphaseMangrovesSource&) = delete;
protected: protected:
@ -124,8 +123,7 @@ public:
//- Destructor //- Destructor
virtual ~multiphaseMangrovesSource() virtual ~multiphaseMangrovesSource() = default;
{}
// Member Functions // Member Functions

View File

@ -55,7 +55,7 @@ Foam::fv::multiphaseMangrovesTurbulenceModel::kCoeff
const volVectorField& U const volVectorField& U
) const ) const
{ {
tmp<volScalarField> tkCoeff = tmp<volScalarField>::New auto tkCoeff = tmp<volScalarField>::New
( (
IOobject IOobject
( (
@ -101,7 +101,7 @@ Foam::fv::multiphaseMangrovesTurbulenceModel::epsilonCoeff
const volVectorField& U const volVectorField& U
) const ) const
{ {
tmp<volScalarField> tepsilonCoeff = tmp<volScalarField>::New auto tepsilonCoeff = tmp<volScalarField>::New
( (
IOobject IOobject
( (
@ -177,16 +177,16 @@ void Foam::fv::multiphaseMangrovesTurbulenceModel::addSup
if (eqn.psi().name() == epsilonName_) if (eqn.psi().name() == epsilonName_)
{ {
fvMatrix<scalar> epsilonEqn fvMatrix<scalar> epsilonEqn
( (
- fvm::Sp(epsilonCoeff(U), eqn.psi()) - fvm::Sp(epsilonCoeff(U), eqn.psi())
); );
eqn += epsilonEqn; eqn += epsilonEqn;
} }
else if (eqn.psi().name() == kName_) else if (eqn.psi().name() == kName_)
{ {
fvMatrix<scalar> kEqn fvMatrix<scalar> kEqn
( (
- fvm::Sp(kCoeff(U), eqn.psi()) - fvm::Sp(kCoeff(U), eqn.psi())
); );
eqn += kEqn; eqn += kEqn;
@ -258,7 +258,8 @@ bool Foam::fv::multiphaseMangrovesTurbulenceModel::read(const dictionary& dict)
const word& regionName = regionNames[i]; const word& regionName = regionNames[i];
const dictionary& modelDict = regionsDict.subDict(regionName); const dictionary& modelDict = regionsDict.subDict(regionName);
const word& zoneName = modelDict.lookup("cellZone"); const word zoneName(modelDict.get<word>("cellZone"));
zoneIDs_[i] = mesh_.cellZones().findIndices(zoneName); zoneIDs_[i] = mesh_.cellZones().findIndices(zoneName);
if (zoneIDs_[i].empty()) if (zoneIDs_[i].empty())
{ {
@ -268,19 +269,17 @@ bool Foam::fv::multiphaseMangrovesTurbulenceModel::read(const dictionary& dict)
<< exit(FatalError); << exit(FatalError);
} }
modelDict.lookup("a") >> aZone_[i]; modelDict.read("a", aZone_[i]);
modelDict.lookup("N") >> NZone_[i]; modelDict.read("N", NZone_[i]);
modelDict.lookup("Ckp") >> CkpZone_[i]; modelDict.read("Ckp", CkpZone_[i]);
modelDict.lookup("Cep") >> CepZone_[i]; modelDict.read("Cep", CepZone_[i]);
modelDict.lookup("Cd") >> CdZone_[i]; modelDict.read("Cd", CdZone_[i]);
} }
return true; return true;
} }
else
{ return false;
return false;
}
} }

View File

@ -50,7 +50,6 @@ namespace Foam
namespace fv namespace fv
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class multiphaseMangrovesTurbulenceModel Declaration Class multiphaseMangrovesTurbulenceModel Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -61,14 +60,14 @@ class multiphaseMangrovesTurbulenceModel
{ {
// Private Member Functions // Private Member Functions
//- Disallow default bitwise copy construct //- No copy construct
multiphaseMangrovesTurbulenceModel multiphaseMangrovesTurbulenceModel
( (
const multiphaseMangrovesTurbulenceModel& const multiphaseMangrovesTurbulenceModel&
); ) = delete;
//- Disallow default bitwise assignment //- No copy assignment
void operator=(const multiphaseMangrovesTurbulenceModel&); void operator=(const multiphaseMangrovesTurbulenceModel&) = delete;
@ -137,8 +136,7 @@ public:
//- Destructor //- Destructor
virtual ~multiphaseMangrovesTurbulenceModel() virtual ~multiphaseMangrovesTurbulenceModel() = default;
{}
// Member Functions // Member Functions

View File

@ -43,7 +43,7 @@ Foam::scalar Foam::waveModels::waveAbsorptionModel::timeCoeff
const scalar t const scalar t
) const ) const
{ {
// No time ramping applied applied for absorption // No time ramping applied for absorption
return 1; return 1;
} }
@ -67,12 +67,6 @@ Foam::waveModels::waveAbsorptionModel::waveAbsorptionModel
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::waveModels::waveAbsorptionModel::~waveAbsorptionModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::waveAbsorptionModel::readDict bool Foam::waveModels::waveAbsorptionModel::readDict

View File

@ -71,7 +71,7 @@ public:
); );
//- Destructor //- Destructor
virtual ~waveAbsorptionModel(); virtual ~waveAbsorptionModel() = default;
// Public Member Functions // Public Member Functions

View File

@ -101,12 +101,6 @@ Foam::waveModels::shallowWaterAbsorption::shallowWaterAbsorption
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::waveModels::shallowWaterAbsorption::~shallowWaterAbsorption()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::shallowWaterAbsorption::readDict bool Foam::waveModels::shallowWaterAbsorption::readDict

View File

@ -88,7 +88,7 @@ public:
); );
//- Destructor //- Destructor
virtual ~shallowWaterAbsorption(); virtual ~shallowWaterAbsorption() = default;
// Public Member Functions // Public Member Functions

View File

@ -24,9 +24,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "irregularWaveModel.H" #include "irregularWaveModel.H"
#include "mathematicalConstants.H"
using namespace Foam::constant;
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -70,12 +67,6 @@ Foam::waveModels::irregularWaveModel::irregularWaveModel
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::waveModels::irregularWaveModel::~irregularWaveModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::irregularWaveModel::readDict bool Foam::waveModels::irregularWaveModel::readDict
@ -85,7 +76,7 @@ bool Foam::waveModels::irregularWaveModel::readDict
{ {
if (waveGenerationModel::readDict(overrideDict)) if (waveGenerationModel::readDict(overrideDict))
{ {
lookup("rampTime") >> rampTime_; rampTime_ = get<scalar>("rampTime");
return true; return true;
} }

View File

@ -48,13 +48,11 @@ class irregularWaveModel
: :
public waveGenerationModel public waveGenerationModel
{ {
// Private Member Functions //- No copy construct
irregularWaveModel(const irregularWaveModel&) = delete;
//- Disallow default bitwise copy construct //- No copy assignment
irregularWaveModel(const irregularWaveModel&); void operator=(const irregularWaveModel&) = delete;
//- Disallow default bitwise assignment
void operator=(const irregularWaveModel&);
protected: protected:
@ -86,7 +84,7 @@ public:
); );
//- Destructor //- Destructor
virtual ~irregularWaveModel(); virtual ~irregularWaveModel() = default;
// Public Member Functions // Public Member Functions

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "regularWaveModel.H" #include "regularWaveModel.H"
#include "mathematicalConstants.H" #include "unitConversion.H"
using namespace Foam::constant; using namespace Foam::constant;
@ -83,12 +83,6 @@ Foam::waveModels::regularWaveModel::regularWaveModel
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::waveModels::regularWaveModel::~regularWaveModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::regularWaveModel::readDict bool Foam::waveModels::regularWaveModel::readDict
@ -101,7 +95,7 @@ bool Foam::waveModels::regularWaveModel::readDict
waveHeight_ = readWaveHeight(); waveHeight_ = readWaveHeight();
waveAngle_ = readWaveAngle(); waveAngle_ = readWaveAngle();
lookup("wavePeriod") >> wavePeriod_; wavePeriod_ = get<scalar>("wavePeriod");
if (wavePeriod_ < 0) if (wavePeriod_ < 0)
{ {
FatalIOErrorInFunction(*this) FatalIOErrorInFunction(*this)
@ -126,7 +120,7 @@ void Foam::waveModels::regularWaveModel::info(Ostream& os) const
irregularWaveModel::info(os); irregularWaveModel::info(os);
os << " Wave height : " << waveHeight_ << nl os << " Wave height : " << waveHeight_ << nl
<< " Wave angle : " << 180/mathematical::pi*waveAngle_ << nl << " Wave angle : " << radToDeg(waveAngle_) << nl
<< " Wave period : " << wavePeriod_ << nl << " Wave period : " << wavePeriod_ << nl
<< " Wave length : " << waveLength_ << nl << " Wave length : " << waveLength_ << nl
<< " Wave phase : " << wavePhase_ << nl; << " Wave phase : " << wavePhase_ << nl;

View File

@ -99,7 +99,7 @@ public:
); );
//- Destructor //- Destructor
virtual ~regularWaveModel(); virtual ~regularWaveModel() = default;
// Public Member Functions // Public Member Functions

View File

@ -26,11 +26,7 @@ License
#include "solitaryWaveModel.H" #include "solitaryWaveModel.H"
#include "polyPatch.H" #include "polyPatch.H"
#include "SubField.H" #include "SubField.H"
#include "unitConversion.H"
#include "mathematicalConstants.H"
using namespace Foam::constant;
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -82,12 +78,6 @@ Foam::waveModels::solitaryWaveModel::solitaryWaveModel
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::waveModels::solitaryWaveModel::~solitaryWaveModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::solitaryWaveModel::readDict bool Foam::waveModels::solitaryWaveModel::readDict
@ -112,7 +102,7 @@ void Foam::waveModels::solitaryWaveModel::info(Ostream& os) const
waveGenerationModel::info(os); waveGenerationModel::info(os);
os << " Wave height : " << waveHeight_ << nl os << " Wave height : " << waveHeight_ << nl
<< " Wave angle : " << 180/mathematical::pi*waveAngle_ << nl << " Wave angle : " << radToDeg(waveAngle_) << nl
<< " x0: " << x0_ << nl; << " x0: " << x0_ << nl;
} }

View File

@ -87,7 +87,7 @@ public:
); );
//- Destructor //- Destructor
virtual ~solitaryWaveModel(); virtual ~solitaryWaveModel() = default;
// Public Member Functions // Public Member Functions

View File

@ -24,9 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "waveGenerationModel.H" #include "waveGenerationModel.H"
#include "mathematicalConstants.H" #include "unitConversion.H"
using namespace Foam::constant;
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -43,7 +41,7 @@ namespace waveModels
Foam::scalar Foam::waveModels::waveGenerationModel::readWaveHeight() const Foam::scalar Foam::waveModels::waveGenerationModel::readWaveHeight() const
{ {
scalar h(readScalar(lookup("waveHeight"))); const scalar h(get<scalar>("waveHeight"));
if (h < 0) if (h < 0)
{ {
FatalIOErrorInFunction(*this) FatalIOErrorInFunction(*this)
@ -58,8 +56,7 @@ Foam::scalar Foam::waveModels::waveGenerationModel::readWaveHeight() const
Foam::scalar Foam::waveModels::waveGenerationModel::readWaveAngle() const Foam::scalar Foam::waveModels::waveGenerationModel::readWaveAngle() const
{ {
scalar angle(readScalar(lookup("waveAngle"))); return degToRad(get<scalar>("waveAngle"));
return angle* mathematical::pi/180;
} }
@ -82,12 +79,6 @@ Foam::waveModels::waveGenerationModel::waveGenerationModel
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::waveModels::waveGenerationModel::~waveGenerationModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::waveGenerationModel::readDict bool Foam::waveModels::waveGenerationModel::readDict
@ -97,7 +88,7 @@ bool Foam::waveModels::waveGenerationModel::readDict
{ {
if (waveModel::readDict(overrideDict)) if (waveModel::readDict(overrideDict))
{ {
lookup("activeAbsorption") >> activeAbsorption_; activeAbsorption_ = get<bool>("activeAbsorption");
return true; return true;
} }

View File

@ -74,7 +74,7 @@ public:
); );
//- Destructor //- Destructor
virtual ~waveGenerationModel(); virtual ~waveGenerationModel() = default;
// Public Member Functions // Public Member Functions

View File

@ -225,12 +225,6 @@ Foam::waveModels::Boussinesq::Boussinesq
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::waveModels::Boussinesq::~Boussinesq()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::Boussinesq::readDict(const dictionary& overrideDict) bool Foam::waveModels::Boussinesq::readDict(const dictionary& overrideDict)

View File

@ -127,7 +127,7 @@ public:
); );
//- Destructor //- Destructor
virtual ~Boussinesq(); virtual ~Boussinesq() = default;
// Public Member Functions // Public Member Functions

View File

@ -192,12 +192,6 @@ Foam::waveModels::Grimshaw::Grimshaw
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::waveModels::Grimshaw::~Grimshaw()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::Grimshaw::readDict(const dictionary& overrideDict) bool Foam::waveModels::Grimshaw::readDict(const dictionary& overrideDict)

View File

@ -117,7 +117,7 @@ public:
); );
//- Destructor //- Destructor
virtual ~Grimshaw(); virtual ~Grimshaw() = default;
// Public Member Functions // Public Member Functions

View File

@ -282,12 +282,6 @@ Foam::waveModels::McCowan::McCowan
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::waveModels::McCowan::~McCowan()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::McCowan::readDict(const dictionary& overrideDict) bool Foam::waveModels::McCowan::readDict(const dictionary& overrideDict)

View File

@ -133,7 +133,7 @@ public:
); );
//- Destructor //- Destructor
virtual ~McCowan(); virtual ~McCowan() = default;
// Public Member Functions // Public Member Functions

View File

@ -209,12 +209,6 @@ Foam::waveModels::StokesI::StokesI
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::waveModels::StokesI::~StokesI()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::StokesI::readDict(const dictionary& overrideDict) bool Foam::waveModels::StokesI::readDict(const dictionary& overrideDict)

View File

@ -121,7 +121,7 @@ public:
); );
//- Destructor //- Destructor
virtual ~StokesI(); virtual ~StokesI() = default;
// Public Member Functions // Public Member Functions

View File

@ -155,12 +155,6 @@ Foam::waveModels::StokesII::StokesII
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::waveModels::StokesII::~StokesII()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::StokesII::readDict(const dictionary& overrideDict) bool Foam::waveModels::StokesII::readDict(const dictionary& overrideDict)

View File

@ -111,7 +111,7 @@ public:
); );
//- Destructor //- Destructor
virtual ~StokesII(); virtual ~StokesII() = default;
// Public Member Functions // Public Member Functions

View File

@ -846,12 +846,6 @@ Foam::waveModels::StokesV::StokesV
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::waveModels::StokesV::~StokesV()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::StokesV::readDict(const dictionary& overrideDict) bool Foam::waveModels::StokesV::readDict(const dictionary& overrideDict)

View File

@ -195,7 +195,7 @@ public:
); );
//- Destructor //- Destructor
virtual ~StokesV(); virtual ~StokesV() = default;
// Public Member Functions // Public Member Functions

View File

@ -329,12 +329,6 @@ Foam::waveModels::cnoidal::cnoidal
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::waveModels::cnoidal::~cnoidal()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::cnoidal::readDict(const dictionary& overrideDict) bool Foam::waveModels::cnoidal::readDict(const dictionary& overrideDict)

View File

@ -160,7 +160,7 @@ public:
); );
//- Destructor //- Destructor
virtual ~cnoidal(); virtual ~cnoidal() = default;
// Public Member Functions // Public Member Functions

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "irregularMultiDirectionalWaveModel.H" #include "irregularMultiDirectionalWaveModel.H"
#include "mathematicalConstants.H" #include "unitConversion.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
using namespace Foam::constant; using namespace Foam::constant;
@ -253,12 +253,6 @@ Foam::waveModels::irregularMultiDirectional::irregularMultiDirectional
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::waveModels::irregularMultiDirectional::~irregularMultiDirectional()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::irregularMultiDirectional::readDict bool Foam::waveModels::irregularMultiDirectional::readDict
@ -268,10 +262,10 @@ bool Foam::waveModels::irregularMultiDirectional::readDict
{ {
if (irregularWaveModel::readDict(overrideDict)) if (irregularWaveModel::readDict(overrideDict))
{ {
lookup("wavePeriods") >> irregWavePeriods_; dictionary::read("wavePeriods", irregWavePeriods_);
lookup("waveHeights") >> irregWaveHeights_; dictionary::read("waveHeights", irregWaveHeights_);
lookup("wavePhases") >> irregWavePhases_; dictionary::read("wavePhases", irregWavePhases_);
lookup("waveDirs") >> irregWaveDirs_; dictionary::read("waveDirs", irregWaveDirs_);
irregWaveLengths_ = irregWaveHeights_; irregWaveLengths_ = irregWaveHeights_;
@ -282,7 +276,7 @@ bool Foam::waveModels::irregularMultiDirectional::readDict
irregWaveLengths_[ii][jj] = irregWaveLengths_[ii][jj] =
waveLength(waterDepthRef_, irregWavePeriods_[ii][jj]); waveLength(waterDepthRef_, irregWavePeriods_[ii][jj]);
irregWaveDirs_[ii][jj] = irregWaveDirs_[ii][jj] =
irregWaveDirs_[ii][jj]*mathematical::pi/180; degToRad(irregWaveDirs_[ii][jj]);
} }
} }

View File

@ -33,6 +33,7 @@ Description
#define waveModels_irregularMultiDirectional_H #define waveModels_irregularMultiDirectional_H
#include "irregularWaveModel.H" #include "irregularWaveModel.H"
#include "scalarList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -54,20 +55,20 @@ private:
// Proteced Data // Proteced Data
//- Wave periods for irregularMultiDirectional case [seconds] //- Wave periods for irregularMultiDirectional case [seconds]
List<List<scalar>> irregWavePeriods_; List<scalarList> irregWavePeriods_;
//- Wave heights for irregularMultiDirectional case [metres] //- Wave heights for irregularMultiDirectional case [metres]
List<List<scalar>> irregWaveHeights_; List<scalarList> irregWaveHeights_;
//- Wave lengths for irregularMultiDirectional case [metres] //- Wave lengths for irregularMultiDirectional case [metres]
List<List<scalar>> irregWaveLengths_; List<scalarList> irregWaveLengths_;
//- Wave phases for irregularMultiDirectional case [radians] //- Wave phases for irregularMultiDirectional case [radians]
List<List<scalar>> irregWavePhases_; List<scalarList> irregWavePhases_;
//- Direction of propagation for irregularMultiDirectional case //- Direction of propagation for irregularMultiDirectional case
//- [degrees] from X axis //- [degrees] from X axis
List<List<scalar>> irregWaveDirs_; List<scalarList> irregWaveDirs_;
// Private Member Functions // Private Member Functions
@ -151,7 +152,7 @@ public:
); );
//- Destructor //- Destructor
virtual ~irregularMultiDirectional(); virtual ~irregularMultiDirectional() = default;
// Public Member Functions // Public Member Functions

View File

@ -67,8 +67,7 @@ Foam::scalar Foam::waveModels::streamFunction::eta
forAll(Ejs_, iterSF) forAll(Ejs_, iterSF)
{ {
strfnAux += strfnAux +=
Ejs_[iterSF]*cos((iterSF + 1) Ejs_[iterSF]*cos((iterSF + 1) *(kx*x + ky*y - omega*t + phase));
*(kx*x + ky*y - omega*t + phase));
} }
return (1/k)*strfnAux; return (1/k)*strfnAux;
@ -135,12 +134,12 @@ void Foam::waveModels::streamFunction::setLevel
this->eta this->eta
( (
waterDepthRef_, waterDepthRef_,
waveKx, waveKx,
waveKy, waveKy,
wavePeriod_, wavePeriod_,
xPaddle_[paddlei], xPaddle_[paddlei],
yPaddle_[paddlei], yPaddle_[paddlei],
waveOmega, waveOmega,
t, t,
wavePhase_ wavePhase_
); );
@ -184,7 +183,7 @@ void Foam::waveModels::streamFunction::setVelocity
wavePeriod_, wavePeriod_,
xPaddle_[paddlei], xPaddle_[paddlei],
yPaddle_[paddlei], yPaddle_[paddlei],
waveOmega, waveOmega,
t, t,
wavePhase_, wavePhase_,
z z
@ -218,22 +217,16 @@ Foam::waveModels::streamFunction::streamFunction
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::waveModels::streamFunction::~streamFunction()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModels::streamFunction::readDict(const dictionary& overrideDict) bool Foam::waveModels::streamFunction::readDict(const dictionary& overrideDict)
{ {
if (regularWaveModel::readDict(overrideDict)) if (regularWaveModel::readDict(overrideDict))
{ {
overrideDict.lookup("uMean") >> uMean_; overrideDict.read("uMean", uMean_);
overrideDict.lookup("waveLength") >> waveLength_; overrideDict.read("waveLength", waveLength_);
overrideDict.lookup("Bjs") >> Bjs_; overrideDict.read("Bjs", Bjs_);
overrideDict.lookup("Ejs") >> Ejs_; overrideDict.read("Ejs", Ejs_);
return true; return true;
} }

View File

@ -132,7 +132,7 @@ public:
); );
//- Destructor //- Destructor
virtual ~streamFunction(); virtual ~streamFunction() = default;
// Public Member Functions // Public Member Functions

View File

@ -126,8 +126,8 @@ void Foam::waveModel::initialiseGeometry()
Foam::tmp<Foam::scalarField> Foam::waveModel::waterLevel() const Foam::tmp<Foam::scalarField> Foam::waveModel::waterLevel() const
{ {
// Note: initialising as initial depth // Note: initialising as initial depth
tmp<scalarField> tlevel(new scalarField(nPaddle_, initialDepth_)); auto tlevel = tmp<scalarField>::New(nPaddle_, initialDepth_);
scalarField& level = tlevel.ref(); auto& level = tlevel.ref();
const volScalarField& alpha = const volScalarField& alpha =
mesh_.lookupObject<volScalarField>(alphaName_); mesh_.lookupObject<volScalarField>(alphaName_);
@ -288,12 +288,6 @@ Foam::waveModel::waveModel
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::waveModel::~waveModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::waveModel::readDict(const dictionary& overrideDict) bool Foam::waveModel::readDict(const dictionary& overrideDict)
@ -309,7 +303,7 @@ bool Foam::waveModel::readDict(const dictionary& overrideDict)
readIfPresent("U", UName_); readIfPresent("U", UName_);
readIfPresent("alpha", alphaName_); readIfPresent("alpha", alphaName_);
lookup("nPaddle") >> nPaddle_; nPaddle_ = get<label>("nPaddle");
if (nPaddle_ < 1) if (nPaddle_ < 1)
{ {
FatalIOErrorInFunction(*this) FatalIOErrorInFunction(*this)

View File

@ -222,7 +222,7 @@ public:
//- Destructor //- Destructor
virtual ~waveModel(); virtual ~waveModel() = default;
//- Dictionary name //- Dictionary name
static const word dictName; static const word dictName;

View File

@ -51,7 +51,7 @@ Foam::autoPtr<Foam::waveModel> Foam::waveModel::New
if (waveDict.found(patch.name())) if (waveDict.found(patch.name()))
{ {
patchDict = waveDict.subDict(patch.name()); patchDict = waveDict.subDict(patch.name());
patchDict.lookup("waveModel") >> modelType; patchDict.read("waveModel", modelType);
} }
else else
{ {