diff --git a/src/waveModels/waveAbsorptionModels/base/waveAbsorptionModel/waveAbsorptionModel.C b/src/waveModels/waveAbsorptionModels/base/waveAbsorptionModel/waveAbsorptionModel.C index a0f47ef919..1cadfeefa0 100644 --- a/src/waveModels/waveAbsorptionModels/base/waveAbsorptionModel/waveAbsorptionModel.C +++ b/src/waveModels/waveAbsorptionModels/base/waveAbsorptionModel/waveAbsorptionModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015 IH-Cantabria ------------------------------------------------------------------------------- License @@ -62,7 +62,7 @@ Foam::waveModels::waveAbsorptionModel::waveAbsorptionModel { if (readFields) { - read(dict); + readDict(dict); } } @@ -75,9 +75,12 @@ Foam::waveModels::waveAbsorptionModel::~waveAbsorptionModel() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::waveModels::waveAbsorptionModel::read(const dictionary& overrideDict) +bool Foam::waveModels::waveAbsorptionModel::readDict +( + const dictionary& overrideDict +) { - if (waveModel::read(overrideDict)) + if (waveModel::readDict(overrideDict)) { // Note: always set to true activeAbsorption_ = true; diff --git a/src/waveModels/waveAbsorptionModels/base/waveAbsorptionModel/waveAbsorptionModel.H b/src/waveModels/waveAbsorptionModels/base/waveAbsorptionModel/waveAbsorptionModel.H index 0201aaaab7..e30b6b5ee7 100644 --- a/src/waveModels/waveAbsorptionModels/base/waveAbsorptionModel/waveAbsorptionModel.H +++ b/src/waveModels/waveAbsorptionModels/base/waveAbsorptionModel/waveAbsorptionModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015 IH-Cantabria ------------------------------------------------------------------------------- License @@ -77,7 +77,7 @@ public: // Public Member Functions //- Read from dictionary - virtual bool read(const dictionary& overrideDict); + virtual bool readDict(const dictionary& overrideDict); }; diff --git a/src/waveModels/waveAbsorptionModels/derived/shallowWaterAbsorption/shallowWaterAbsorption.C b/src/waveModels/waveAbsorptionModels/derived/shallowWaterAbsorption/shallowWaterAbsorption.C index d6c7de6040..e4e47820fb 100644 --- a/src/waveModels/waveAbsorptionModels/derived/shallowWaterAbsorption/shallowWaterAbsorption.C +++ b/src/waveModels/waveAbsorptionModels/derived/shallowWaterAbsorption/shallowWaterAbsorption.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015 IH-Cantabria ------------------------------------------------------------------------------- License @@ -96,7 +96,7 @@ Foam::waveModels::shallowWaterAbsorption::shallowWaterAbsorption { if (readFields) { - read(dict); + readDict(dict); } } @@ -109,12 +109,12 @@ Foam::waveModels::shallowWaterAbsorption::~shallowWaterAbsorption() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::waveModels::shallowWaterAbsorption::read +bool Foam::waveModels::shallowWaterAbsorption::readDict ( const dictionary& overrideDict ) { - return waveAbsorptionModel::read(overrideDict); + return waveAbsorptionModel::readDict(overrideDict); } diff --git a/src/waveModels/waveAbsorptionModels/derived/shallowWaterAbsorption/shallowWaterAbsorption.H b/src/waveModels/waveAbsorptionModels/derived/shallowWaterAbsorption/shallowWaterAbsorption.H index bbc31f7878..e390fbfff0 100644 --- a/src/waveModels/waveAbsorptionModels/derived/shallowWaterAbsorption/shallowWaterAbsorption.H +++ b/src/waveModels/waveAbsorptionModels/derived/shallowWaterAbsorption/shallowWaterAbsorption.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015 IH-Cantabria ------------------------------------------------------------------------------- License @@ -94,7 +94,7 @@ public: // Public Member Functions //- Read from dictionary - virtual bool read(const dictionary& overrideDict); + virtual bool readDict(const dictionary& overrideDict); }; diff --git a/src/waveModels/waveGenerationModels/base/regularWaveModel/regularWaveModel.C b/src/waveModels/waveGenerationModels/base/regularWaveModel/regularWaveModel.C index efaa83b552..030c590d2a 100644 --- a/src/waveModels/waveGenerationModels/base/regularWaveModel/regularWaveModel.C +++ b/src/waveModels/waveGenerationModels/base/regularWaveModel/regularWaveModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015 IH-Cantabria ------------------------------------------------------------------------------- License @@ -86,7 +86,7 @@ Foam::waveModels::regularWaveModel::regularWaveModel { if (readFields) { - read(dict); + readDict(dict); } } @@ -99,9 +99,12 @@ Foam::waveModels::regularWaveModel::~regularWaveModel() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::waveModels::regularWaveModel::read(const dictionary& overrideDict) +bool Foam::waveModels::regularWaveModel::readDict +( + const dictionary& overrideDict +) { - if (waveGenerationModel::read(overrideDict)) + if (waveGenerationModel::readDict(overrideDict)) { lookup("rampTime") >> rampTime_; diff --git a/src/waveModels/waveGenerationModels/base/regularWaveModel/regularWaveModel.H b/src/waveModels/waveGenerationModels/base/regularWaveModel/regularWaveModel.H index 13b6bfda73..43a9a9096f 100644 --- a/src/waveModels/waveGenerationModels/base/regularWaveModel/regularWaveModel.H +++ b/src/waveModels/waveGenerationModels/base/regularWaveModel/regularWaveModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015 IH-Cantabria ------------------------------------------------------------------------------- License @@ -105,12 +105,13 @@ public: // Public Member Functions //- Read from dictionary - virtual bool read(const dictionary& overrideDict); + virtual bool readDict(const dictionary& overrideDict); //- Info virtual void info(Ostream& os) const; }; + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace waveModels diff --git a/src/waveModels/waveGenerationModels/base/solitaryWaveModel/solitaryWaveModel.C b/src/waveModels/waveGenerationModels/base/solitaryWaveModel/solitaryWaveModel.C index 332d7e0304..d8d6ab3458 100644 --- a/src/waveModels/waveGenerationModels/base/solitaryWaveModel/solitaryWaveModel.C +++ b/src/waveModels/waveGenerationModels/base/solitaryWaveModel/solitaryWaveModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015 IH-Cantabria ------------------------------------------------------------------------------- License @@ -70,7 +70,7 @@ Foam::waveModels::solitaryWaveModel::solitaryWaveModel { if (readFields) { - read(dict); + readDict(dict); } } @@ -83,9 +83,12 @@ Foam::waveModels::solitaryWaveModel::~solitaryWaveModel() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::waveModels::solitaryWaveModel::read(const dictionary& overrideDict) +bool Foam::waveModels::solitaryWaveModel::readDict +( + const dictionary& overrideDict +) { - if (waveGenerationModel::read(overrideDict)) + if (waveGenerationModel::readDict(overrideDict)) { return true; } diff --git a/src/waveModels/waveGenerationModels/base/solitaryWaveModel/solitaryWaveModel.H b/src/waveModels/waveGenerationModels/base/solitaryWaveModel/solitaryWaveModel.H index f01dff404c..e0724d3413 100644 --- a/src/waveModels/waveGenerationModels/base/solitaryWaveModel/solitaryWaveModel.H +++ b/src/waveModels/waveGenerationModels/base/solitaryWaveModel/solitaryWaveModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015 IH-Cantabria ------------------------------------------------------------------------------- License @@ -87,12 +87,13 @@ public: // Public Member Functions //- Read from dictionary - virtual bool read(const dictionary& overrideDict); + virtual bool readDict(const dictionary& overrideDict); //- Info virtual void info(Ostream& os) const; }; + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace waveModels diff --git a/src/waveModels/waveGenerationModels/base/waveGenerationModel/waveGenerationModel.C b/src/waveModels/waveGenerationModels/base/waveGenerationModel/waveGenerationModel.C index 44cf01006b..5e52d9de93 100644 --- a/src/waveModels/waveGenerationModels/base/waveGenerationModel/waveGenerationModel.C +++ b/src/waveModels/waveGenerationModels/base/waveGenerationModel/waveGenerationModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015 IH-Cantabria ------------------------------------------------------------------------------- License @@ -55,7 +55,7 @@ Foam::waveModels::waveGenerationModel::waveGenerationModel { if (readFields) { - read(dict); + readDict(dict); } } @@ -68,9 +68,12 @@ Foam::waveModels::waveGenerationModel::~waveGenerationModel() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::waveModels::waveGenerationModel::read(const dictionary& overrideDict) +bool Foam::waveModels::waveGenerationModel::readDict +( + const dictionary& overrideDict +) { - if (waveModel::read(overrideDict)) + if (waveModel::readDict(overrideDict)) { lookup("activeAbsorption") >> activeAbsorption_; diff --git a/src/waveModels/waveGenerationModels/base/waveGenerationModel/waveGenerationModel.H b/src/waveModels/waveGenerationModels/base/waveGenerationModel/waveGenerationModel.H index c0ed643e7b..aee9213ed6 100644 --- a/src/waveModels/waveGenerationModels/base/waveGenerationModel/waveGenerationModel.H +++ b/src/waveModels/waveGenerationModels/base/waveGenerationModel/waveGenerationModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015 IH-Cantabria ------------------------------------------------------------------------------- License @@ -80,7 +80,7 @@ public: // Public Member Functions //- Read from dictionary - virtual bool read(const dictionary& overrideDict); + virtual bool readDict(const dictionary& overrideDict); //- Info virtual void info(Ostream& os) const; diff --git a/src/waveModels/waveGenerationModels/derived/Boussinesq/BoussinesqWaveModel.C b/src/waveModels/waveGenerationModels/derived/Boussinesq/BoussinesqWaveModel.C index d7e4dca2fc..a81f32dd8a 100644 --- a/src/waveModels/waveGenerationModels/derived/Boussinesq/BoussinesqWaveModel.C +++ b/src/waveModels/waveGenerationModels/derived/Boussinesq/BoussinesqWaveModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015 IH-Cantabria ------------------------------------------------------------------------------- License @@ -101,7 +101,7 @@ Foam::vector Foam::waveModels::Boussinesq::Deta } -Foam::vector Foam::waveModels::Boussinesq::U +Foam::vector Foam::waveModels::Boussinesq::Uf ( const scalar H, const scalar h, @@ -139,6 +139,8 @@ Foam::vector Foam::waveModels::Boussinesq::U } +// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // + void Foam::waveModels::Boussinesq::setLevel ( const scalar t, @@ -165,44 +167,6 @@ void Foam::waveModels::Boussinesq::setLevel } -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::waveModels::Boussinesq::Boussinesq -( - const dictionary& dict, - const fvMesh& mesh, - const polyPatch& patch, - const bool readFields -) -: - solitaryWaveModel(dict, mesh, patch, false) -{ - if (readFields) - { - read(dict); - } -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::waveModels::Boussinesq::~Boussinesq() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -bool Foam::waveModels::Boussinesq::read(const dictionary& overrideDict) -{ - if (solitaryWaveModel::read(overrideDict)) - { - return true; - } - - return false; -} - - void Foam::waveModels::Boussinesq::setVelocity ( const scalar t, @@ -224,7 +188,7 @@ void Foam::waveModels::Boussinesq::setVelocity { const label paddlei = faceToPaddle_[facei]; - const vector Uf = U + const vector Uf = this->Uf ( waveHeight_, waterDepthRef_, @@ -242,6 +206,44 @@ void Foam::waveModels::Boussinesq::setVelocity } +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::waveModels::Boussinesq::Boussinesq +( + const dictionary& dict, + const fvMesh& mesh, + const polyPatch& patch, + const bool readFields +) +: + solitaryWaveModel(dict, mesh, patch, false) +{ + if (readFields) + { + readDict(dict); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::waveModels::Boussinesq::~Boussinesq() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::waveModels::Boussinesq::readDict(const dictionary& overrideDict) +{ + if (solitaryWaveModel::readDict(overrideDict)) + { + return true; + } + + return false; +} + + void Foam::waveModels::Boussinesq::info(Ostream& os) const { solitaryWaveModel::info(os); diff --git a/src/waveModels/waveGenerationModels/derived/Boussinesq/BoussinesqWaveModel.H b/src/waveModels/waveGenerationModels/derived/Boussinesq/BoussinesqWaveModel.H index ff76841a81..b5071d2817 100644 --- a/src/waveModels/waveGenerationModels/derived/Boussinesq/BoussinesqWaveModel.H +++ b/src/waveModels/waveGenerationModels/derived/Boussinesq/BoussinesqWaveModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015 IH-Cantabria ------------------------------------------------------------------------------- License @@ -49,12 +49,12 @@ class Boussinesq : public solitaryWaveModel { -protected: +private: - // Protected Member Functions + // Private Member Functions //- Wave height - virtual scalar eta + scalar eta ( const scalar H, const scalar h, @@ -66,7 +66,7 @@ protected: ) const; //- Wave - virtual vector Deta + vector Deta ( const scalar H, const scalar h, @@ -78,7 +78,7 @@ protected: ) const; //- Wave velocity - virtual vector U + vector Uf ( const scalar H, const scalar h, @@ -90,6 +90,11 @@ protected: const scalar z ) const; + +protected: + + // Protected Member Functions + //- Set the water level virtual void setLevel ( @@ -128,12 +133,13 @@ public: // Public Member Functions //- Read from dictionary - virtual bool read(const dictionary& overrideDict); + virtual bool readDict(const dictionary& overrideDict); //- Info virtual void info(Ostream& os) const; }; + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace waveModels diff --git a/src/waveModels/waveGenerationModels/derived/StokesI/StokesIWaveModel.C b/src/waveModels/waveGenerationModels/derived/StokesI/StokesIWaveModel.C index 8a67ea2a2d..b160934851 100644 --- a/src/waveModels/waveGenerationModels/derived/StokesI/StokesIWaveModel.C +++ b/src/waveModels/waveGenerationModels/derived/StokesI/StokesIWaveModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015 IH-Cantabria ------------------------------------------------------------------------------- License @@ -48,6 +48,26 @@ namespace waveModels // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // +Foam::scalar Foam::waveModels::StokesI::eta +( + const scalar H, + const scalar Kx, + const scalar x, + const scalar Ky, + const scalar y, + const scalar omega, + const scalar t, + const scalar phase +) const +{ + scalar phaseTot = Kx*x + Ky*y - omega*t + phase; + + return H*0.5*cos(phaseTot); +} + + +// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // + Foam::scalar Foam::waveModels::StokesI::waveLength ( const scalar h, @@ -66,24 +86,7 @@ Foam::scalar Foam::waveModels::StokesI::waveLength } -Foam::scalar Foam::waveModels::StokesI::eta -( - const scalar H, - const scalar Kx, - const scalar x, - const scalar Ky, - const scalar y, - const scalar omega, - const scalar t, - const scalar phase -) const -{ - scalar phaseTot = Kx*x + Ky*y - omega*t + phase; - - return H*0.5*cos(phaseTot); -} - -Foam::vector Foam::waveModels::StokesI::U +Foam::vector Foam::waveModels::StokesI::UfBase ( const scalar H, const scalar h, @@ -141,46 +144,6 @@ void Foam::waveModels::StokesI::setLevel } -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::waveModels::StokesI::StokesI -( - const dictionary& dict, - const fvMesh& mesh, - const polyPatch& patch, - const bool readFields -) -: - regularWaveModel(dict, mesh, patch, false) -{ - if (readFields) - { - read(dict); - } -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::waveModels::StokesI::~StokesI() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -bool Foam::waveModels::StokesI::read(const dictionary& overrideDict) -{ - if (regularWaveModel::read(overrideDict)) - { - waveLength_ = waveLength(waterDepthRef_, wavePeriod_); - - return true; - } - - return false; -} - - void Foam::waveModels::StokesI::setVelocity ( const scalar t, @@ -207,7 +170,7 @@ void Foam::waveModels::StokesI::setVelocity { const label paddlei = faceToPaddle_[facei]; - const vector Uf = U + const vector Uf = UfBase ( waveHeight_, waterDepthRef_, @@ -227,6 +190,46 @@ void Foam::waveModels::StokesI::setVelocity } +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::waveModels::StokesI::StokesI +( + const dictionary& dict, + const fvMesh& mesh, + const polyPatch& patch, + const bool readFields +) +: + regularWaveModel(dict, mesh, patch, false) +{ + if (readFields) + { + readDict(dict); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::waveModels::StokesI::~StokesI() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::waveModels::StokesI::readDict(const dictionary& overrideDict) +{ + if (regularWaveModel::readDict(overrideDict)) + { + waveLength_ = waveLength(waterDepthRef_, wavePeriod_); + + return true; + } + + return false; +} + + void Foam::waveModels::StokesI::info(Ostream& os) const { regularWaveModel::info(os); diff --git a/src/waveModels/waveGenerationModels/derived/StokesI/StokesIWaveModel.H b/src/waveModels/waveGenerationModels/derived/StokesI/StokesIWaveModel.H index 82213261bf..23a3f67e42 100644 --- a/src/waveModels/waveGenerationModels/derived/StokesI/StokesIWaveModel.H +++ b/src/waveModels/waveGenerationModels/derived/StokesI/StokesIWaveModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015 IH-Cantabria ------------------------------------------------------------------------------- License @@ -49,15 +49,12 @@ class StokesI : public regularWaveModel { -protected: +private: - // Protected Member Functions - - //- Return the wavelength - virtual scalar waveLength(const scalar h, const scalar T) const; + // Private Member Functions //- Wave height - virtual scalar eta + scalar eta ( const scalar H, const scalar Kx, @@ -69,8 +66,16 @@ protected: const scalar phase ) const; + +protected: + + // Protected Member Functions + + //- Return the wavelength + virtual scalar waveLength(const scalar h, const scalar T) const; + //- Wave velocity - virtual vector U + virtual vector UfBase ( const scalar H, const scalar h, @@ -84,7 +89,6 @@ protected: const scalar z ) const; - //- Set the water level virtual void setLevel ( @@ -123,12 +127,13 @@ public: // Public Member Functions //- Read from dictionary - virtual bool read(const dictionary& overrideDict); + virtual bool readDict(const dictionary& overrideDict); //- Info virtual void info(Ostream& os) const; }; + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace waveModels diff --git a/src/waveModels/waveGenerationModels/derived/StokesII/StokesIIWaveModel.C b/src/waveModels/waveGenerationModels/derived/StokesII/StokesIIWaveModel.C index b867959f8c..e77122fd05 100644 --- a/src/waveModels/waveGenerationModels/derived/StokesII/StokesIIWaveModel.C +++ b/src/waveModels/waveGenerationModels/derived/StokesII/StokesIIWaveModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015 IH-Cantabria ------------------------------------------------------------------------------- License @@ -71,7 +71,9 @@ Foam::scalar Foam::waveModels::StokesII::eta } -Foam::vector Foam::waveModels::StokesII::U +// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // + +Foam::vector Foam::waveModels::StokesII::UfBase ( const scalar H, const scalar h, @@ -148,7 +150,7 @@ Foam::waveModels::StokesII::StokesII { if (readFields) { - read(dict); + readDict(dict); } } @@ -161,9 +163,9 @@ Foam::waveModels::StokesII::~StokesII() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::waveModels::StokesII::read(const dictionary& overrideDict) +bool Foam::waveModels::StokesII::readDict(const dictionary& overrideDict) { - if (StokesI::read(overrideDict)) + if (StokesI::readDict(overrideDict)) { return true; } diff --git a/src/waveModels/waveGenerationModels/derived/StokesII/StokesIIWaveModel.H b/src/waveModels/waveGenerationModels/derived/StokesII/StokesIIWaveModel.H index 044eba4bc5..c82325b5f5 100644 --- a/src/waveModels/waveGenerationModels/derived/StokesII/StokesIIWaveModel.H +++ b/src/waveModels/waveGenerationModels/derived/StokesII/StokesIIWaveModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015 IH-Cantabria ------------------------------------------------------------------------------- License @@ -49,12 +49,12 @@ class StokesII : public StokesI { -protected: +private: - // Protected Member Functions + // Private Member Functions //- Wave height - virtual scalar eta + scalar eta ( const scalar H, const scalar h, @@ -67,8 +67,13 @@ protected: const scalar phase ) const; + +protected: + + // Protected Member Functions + //- Wave velocity - virtual vector U + virtual vector UfBase ( const scalar H, const scalar h, @@ -112,12 +117,13 @@ public: // Public Member Functions //- Read from dictionary - virtual bool read(const dictionary& overrideDict); + virtual bool readDict(const dictionary& overrideDict); //- Info virtual void info(Ostream& os) const; }; + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace waveModels diff --git a/src/waveModels/waveGenerationModels/derived/StokesV/StokesVWaveModel.C b/src/waveModels/waveGenerationModels/derived/StokesV/StokesVWaveModel.C index 643acedeb2..4ba32ea445 100644 --- a/src/waveModels/waveGenerationModels/derived/StokesV/StokesVWaveModel.C +++ b/src/waveModels/waveGenerationModels/derived/StokesV/StokesVWaveModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015 IH-Cantabria ------------------------------------------------------------------------------- License @@ -680,7 +680,7 @@ Foam::scalar Foam::waveModels::StokesV::eta } -Foam::vector Foam::waveModels::StokesV::U +Foam::vector Foam::waveModels::StokesV::Uf ( const scalar d, const scalar kx, @@ -722,17 +722,17 @@ Foam::vector Foam::waveModels::StokesV::U scalar u = a1u*cosh(k*z)*cos(theta) - + a2u*cosh(2.0*k*z)*cos(2.0*(theta)) - + a3u*cosh(3.0*k*z)*cos(3.0*(theta)) - + a4u*cosh(4.0*k*z)*cos(4.0*(theta)) - + a5u*cosh(5.0*k*z)*cos(5.0*(theta)); + + a2u*cosh(2*k*z)*cos(2*theta) + + a3u*cosh(3*k*z)*cos(3*theta) + + a4u*cosh(4*k*z)*cos(4*theta) + + a5u*cosh(5*k*z)*cos(5*theta); scalar w = a1u*sinh(k*z)*sin(theta) - + a2u*sinh(2.0*k*z)*sin(2.0*(theta)) - + a3u*sinh(3.0*k*z)*sin(3.0*(theta)) - + a4u*sinh(4.0*k*z)*sin(4.0*(theta)) - + a5u*sinh(5.0*k*z)*sin(5.0*(theta)); + + a2u*sinh(2*k*z)*sin(2*theta) + + a3u*sinh(3*k*z)*sin(3*theta) + + a4u*sinh(4*k*z)*sin(4*theta) + + a5u*sinh(5*k*z)*sin(5*theta); scalar v = u*sin(waveAngle_); u *= cos(waveAngle_); @@ -741,6 +741,8 @@ Foam::vector Foam::waveModels::StokesV::U } +// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // + void Foam::waveModels::StokesV::setLevel ( const scalar t, @@ -773,71 +775,6 @@ void Foam::waveModels::StokesV::setLevel } -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::waveModels::StokesV::StokesV -( - const dictionary& dict, - const fvMesh& mesh, - const polyPatch& patch, - const bool readFields -) -: - regularWaveModel(dict, mesh, patch, false), - lambda_(0) -{ - if (readFields) - { - read(dict); - } -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::waveModels::StokesV::~StokesV() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -bool Foam::waveModels::StokesV::read(const dictionary& overrideDict) -{ - if (regularWaveModel::read(overrideDict)) - { - scalar f1; - scalar f2; - scalar waveK; - - initialise - ( - waveHeight_, - waterDepthRef_, - wavePeriod_, - waveK, - lambda_, - f1, - f2 - ); - - if (f1 > 0.001 || f2 > 0.001) - { - FatalErrorInFunction - << "No convergence for Stokes V wave theory" << nl - << " f1: " << f1 << nl - << " f2: " << f2 << nl - << exit(FatalError); - } - - waveLength_ = 2.0*mathematical::pi/waveK; - - return true; - } - - return false; -} - - void Foam::waveModels::StokesV::setVelocity ( const scalar t, @@ -863,7 +800,7 @@ void Foam::waveModels::StokesV::setVelocity { const label paddlei = faceToPaddle_[facei]; - const vector Uf = U + const vector Uf = this->Uf ( waterDepthRef_, waveKx, @@ -883,9 +820,72 @@ void Foam::waveModels::StokesV::setVelocity } +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::waveModels::StokesV::StokesV +( + const dictionary& dict, + const fvMesh& mesh, + const polyPatch& patch, + const bool readFields +) +: + StokesI(dict, mesh, patch, false), + lambda_(0) +{ + if (readFields) + { + readDict(dict); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::waveModels::StokesV::~StokesV() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::waveModels::StokesV::readDict(const dictionary& overrideDict) +{ + if (StokesI::readDict(overrideDict)) + { + scalar f1; + scalar f2; + scalar waveK; + + initialise + ( + waveHeight_, + waterDepthRef_, + wavePeriod_, + waveK, + lambda_, + f1, + f2 + ); + + if (f1 > 0.001 || f2 > 0.001) + { + FatalErrorInFunction + << "No convergence for Stokes V wave theory" << nl + << " f1: " << f1 << nl + << " f2: " << f2 << nl + << exit(FatalError); + } + + return true; + } + + return false; +} + + void Foam::waveModels::StokesV::info(Ostream& os) const { - regularWaveModel::info(os); + StokesI::info(os); os << " Lambda : " << lambda_ << nl << " Wave type : " << waveType() << nl; diff --git a/src/waveModels/waveGenerationModels/derived/StokesV/StokesVWaveModel.H b/src/waveModels/waveGenerationModels/derived/StokesV/StokesVWaveModel.H index 225bb9bf1f..1450fca0a0 100644 --- a/src/waveModels/waveGenerationModels/derived/StokesV/StokesVWaveModel.H +++ b/src/waveModels/waveGenerationModels/derived/StokesV/StokesVWaveModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015 IH-Cantabria ------------------------------------------------------------------------------- License @@ -39,7 +39,7 @@ Description #ifndef waveModels_StokesV_H #define waveModels_StokesV_H -#include "regularWaveModel.H" +#include "StokesIWaveModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -54,71 +54,65 @@ namespace waveModels class StokesV : - public regularWaveModel + public StokesI { -protected: +private: - // Proteced Data - - //- - scalar lambda_; - - - // Protected Member Functions + // Private Member Functions // Model coefficients - virtual scalar A11(const scalar h, const scalar k) const; + scalar A11(const scalar h, const scalar k) const; - virtual scalar A13(const scalar h, const scalar k) const; + scalar A13(const scalar h, const scalar k) const; - virtual scalar A15(const scalar h, const scalar k) const; + scalar A15(const scalar h, const scalar k) const; - virtual scalar A22(const scalar h, const scalar k) const; + scalar A22(const scalar h, const scalar k) const; - virtual scalar A24(const scalar h, const scalar k) const; + scalar A24(const scalar h, const scalar k) const; - virtual scalar A33(const scalar h, const scalar k) const; + scalar A33(const scalar h, const scalar k) const; - virtual scalar A35(const scalar h, const scalar k) const; + scalar A35(const scalar h, const scalar k) const; - virtual scalar A44(const scalar h, const scalar k) const; + scalar A44(const scalar h, const scalar k) const; - virtual scalar A55(const scalar h, const scalar k) const; + scalar A55(const scalar h, const scalar k) const; - virtual scalar B22(const scalar h, const scalar k) const; + scalar B22(const scalar h, const scalar k) const; - virtual scalar B24(const scalar h, const scalar k) const; + scalar B24(const scalar h, const scalar k) const; - virtual scalar B33(const scalar h, const scalar k) const; + scalar B33(const scalar h, const scalar k) const; - virtual scalar B33k(const scalar h, const scalar k) const; + scalar B33k(const scalar h, const scalar k) const; - virtual scalar B35(const scalar h, const scalar k) const; + scalar B35(const scalar h, const scalar k) const; - virtual scalar B35k(const scalar h, const scalar k) const; + scalar B35k(const scalar h, const scalar k) const; - virtual scalar B44(const scalar h, const scalar k) const; + scalar B44(const scalar h, const scalar k) const; - virtual scalar B55(const scalar h, const scalar k) const; + scalar B55(const scalar h, const scalar k) const; - virtual scalar B55k(const scalar h, const scalar k) const; + scalar B55k(const scalar h, const scalar k) const; - virtual scalar C1(const scalar h, const scalar k) const; + scalar C1(const scalar h, const scalar k) const; - virtual scalar C1k(const scalar h, const scalar k) const; + scalar C1k(const scalar h, const scalar k) const; - virtual scalar C2(const scalar h, const scalar k) const; + scalar C2(const scalar h, const scalar k) const; - virtual scalar C2k(const scalar h, const scalar k) const; + scalar C2k(const scalar h, const scalar k) const; - virtual scalar C3(const scalar h, const scalar k) const; + scalar C3(const scalar h, const scalar k) const; - virtual scalar C4(const scalar h, const scalar k) const; + scalar C4(const scalar h, const scalar k) const; //- Model intialisation - virtual void initialise + void initialise ( const scalar H, const scalar d, @@ -130,7 +124,7 @@ protected: ) const; //- Wave height - virtual scalar eta + scalar eta ( const scalar h, const scalar kx, @@ -144,7 +138,7 @@ protected: ) const; //- Wave velocity - virtual vector U + vector Uf ( const scalar d, const scalar kx, @@ -158,6 +152,17 @@ protected: const scalar z ) const; + +protected: + + // Proteced Data + + //- + scalar lambda_; + + + // Protected Member Functions + //- Set the water level virtual void setLevel ( @@ -196,12 +201,13 @@ public: // Public Member Functions //- Read from dictionary - virtual bool read(const dictionary& overrideDict); + virtual bool readDict(const dictionary& overrideDict); //- Info virtual void info(Ostream& os) const; }; + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace waveModels diff --git a/src/waveModels/waveGenerationModels/derived/cnoidal/cnoidalWaveModel.C b/src/waveModels/waveGenerationModels/derived/cnoidal/cnoidalWaveModel.C index 98c3873451..efa9481f8f 100644 --- a/src/waveModels/waveGenerationModels/derived/cnoidal/cnoidalWaveModel.C +++ b/src/waveModels/waveGenerationModels/derived/cnoidal/cnoidalWaveModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015 IH-Cantabria ------------------------------------------------------------------------------- License @@ -189,7 +189,7 @@ Foam::vector Foam::waveModels::cnoidal::dEtaDx } -Foam::vector Foam::waveModels::cnoidal::U +Foam::vector Foam::waveModels::cnoidal::Uf ( const scalar H, const scalar h, @@ -231,6 +231,8 @@ Foam::vector Foam::waveModels::cnoidal::U } +// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // + void Foam::waveModels::cnoidal::setLevel ( const scalar t, @@ -262,55 +264,6 @@ void Foam::waveModels::cnoidal::setLevel } -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::waveModels::cnoidal::cnoidal -( - const dictionary& dict, - const fvMesh& mesh, - const polyPatch& patch, - const bool readFields -) -: - regularWaveModel(dict, mesh, patch, false), - m_(0) -{ - if (readFields) - { - read(dict); - } -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::waveModels::cnoidal::~cnoidal() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -bool Foam::waveModels::cnoidal::read(const dictionary& overrideDict) -{ - if (regularWaveModel::read(overrideDict)) - { - // Initialise m parameter and wavelength - initialise - ( - waveHeight_, - waterDepthRef_, - wavePeriod_, - m_, - waveLength_ - ); - - return true; - } - - return false; -} - - void Foam::waveModels::cnoidal::setVelocity ( const scalar t, @@ -336,7 +289,7 @@ void Foam::waveModels::cnoidal::setVelocity { const label paddlei = faceToPaddle_[facei]; - const vector Uf = U + const vector Uf = this->Uf ( waveHeight_, waterDepthRef_, @@ -356,6 +309,55 @@ void Foam::waveModels::cnoidal::setVelocity } +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::waveModels::cnoidal::cnoidal +( + const dictionary& dict, + const fvMesh& mesh, + const polyPatch& patch, + const bool readFields +) +: + regularWaveModel(dict, mesh, patch, false), + m_(0) +{ + if (readFields) + { + readDict(dict); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::waveModels::cnoidal::~cnoidal() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::waveModels::cnoidal::readDict(const dictionary& overrideDict) +{ + if (regularWaveModel::readDict(overrideDict)) + { + // Initialise m parameter and wavelength + initialise + ( + waveHeight_, + waterDepthRef_, + wavePeriod_, + m_, + waveLength_ + ); + + return true; + } + + return false; +} + + void Foam::waveModels::cnoidal::info(Ostream& os) const { regularWaveModel::info(os); diff --git a/src/waveModels/waveGenerationModels/derived/cnoidal/cnoidalWaveModel.H b/src/waveModels/waveGenerationModels/derived/cnoidal/cnoidalWaveModel.H index 3c78658154..5dd6162bf3 100644 --- a/src/waveModels/waveGenerationModels/derived/cnoidal/cnoidalWaveModel.H +++ b/src/waveModels/waveGenerationModels/derived/cnoidal/cnoidalWaveModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015 IH-Cantabria ------------------------------------------------------------------------------- License @@ -49,16 +49,11 @@ class cnoidal : public regularWaveModel { -protected: +private: - // Protected data - - //- `m' coefficient - scalar m_; - - - // Protected Member Functions + // Private Member Functions + //- Initialise void initialise ( const scalar H, @@ -69,7 +64,7 @@ protected: ) const; //- Wave height - virtual scalar eta + scalar eta ( const scalar H, const scalar Kx, @@ -107,7 +102,7 @@ protected: ) const; //- Wave velocity - virtual vector U + vector Uf ( const scalar H, const scalar h, @@ -121,6 +116,18 @@ protected: const scalar z ) const; + +protected: + + // Protected data + + //- `m' coefficient + scalar m_; + + + // Protected Member Functions + + //- Set the water level virtual void setLevel ( @@ -159,12 +166,13 @@ public: // Public Member Functions //- Read from dictionary - virtual bool read(const dictionary& overrideDict); + virtual bool readDict(const dictionary& overrideDict); //- Info virtual void info(Ostream& os) const; }; + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace waveModels diff --git a/src/waveModels/waveModel/waveModel.C b/src/waveModels/waveModel/waveModel.C index bb859aacda..1f86780e88 100644 --- a/src/waveModels/waveModel/waveModel.C +++ b/src/waveModels/waveModel/waveModel.C @@ -277,7 +277,7 @@ Foam::waveModel::waveModel { if (readFields) { - read(dict); + readDict(dict); } } @@ -290,7 +290,7 @@ Foam::waveModel::~waveModel() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::waveModel::read(const dictionary& overrideDict) +bool Foam::waveModel::readDict(const dictionary& overrideDict) { readOpt() = IOobject::READ_IF_PRESENT; if (headerOk()) diff --git a/src/waveModels/waveModel/waveModel.H b/src/waveModels/waveModel/waveModel.H index 7a0efd4570..f7cea6c719 100644 --- a/src/waveModels/waveModel/waveModel.H +++ b/src/waveModels/waveModel/waveModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015 IH-Cantabria ------------------------------------------------------------------------------- License @@ -231,7 +231,7 @@ public: static word modelName(const word& patchName); //- Read from dictionary - virtual bool read(const dictionary& overrideDict); + virtual bool readDict(const dictionary& overrideDict); //- Return the latest wave velocity prediction virtual const vectorField& U() const;