diff --git a/bin/tools/RunFunctions b/bin/tools/RunFunctions index c3c6be8948..59e1d66194 100755 --- a/bin/tools/RunFunctions +++ b/bin/tools/RunFunctions @@ -148,8 +148,9 @@ runParallel() # Store any parsed additional arguments e.g. decomposeParDict APP_PARARGS= - # Check the default decomposeParDict if available - nProcs=$(getNumberOfProcessors system/decomposeParDict) + + # Initialise number of procs to unset value + nProcs=-1 # Parse options and executable while [ $# -gt 0 ] && [ -z "$APP_RUN" ]; do @@ -185,6 +186,8 @@ runParallel() shift done + [ "$nProcs" -eq -1 ] && nProcs=$(getNumberOfProcessors system/decomposeParDict) + if [ -f log.$LOG_SUFFIX ] && [ "$LOG_IGNORE" = "false" ] then echo "$APP_NAME already run on $PWD:" \ @@ -213,7 +216,7 @@ cloneCase() else echo "Cloning $2 case from $1" mkdir $2 - cpfiles="0 system constant" + cpfiles="0.orig 0 system constant" for f in $cpfiles do \cp -r $1/$f $2 diff --git a/src/OpenFOAM/db/functionObjects/stateFunctionObject/stateFunctionObject.H b/src/OpenFOAM/db/functionObjects/stateFunctionObject/stateFunctionObject.H index 09cd289b9e..d523042910 100644 --- a/src/OpenFOAM/db/functionObjects/stateFunctionObject/stateFunctionObject.H +++ b/src/OpenFOAM/db/functionObjects/stateFunctionObject/stateFunctionObject.H @@ -32,7 +32,7 @@ Description Note: cannot access the state dictionary until after construction of the function objects, since the owner container functionObjectList is owned by time, and time owns the state dictionary. I.e. need to wait for time - to be fully consttucted. + to be fully constructed. See also Foam::functionObject diff --git a/src/OpenFOAM/db/functionObjects/writeFile/writeFile.H b/src/OpenFOAM/db/functionObjects/writeFile/writeFile.H index c05a1ffe4d..1f7f1edfce 100644 --- a/src/OpenFOAM/db/functionObjects/writeFile/writeFile.H +++ b/src/OpenFOAM/db/functionObjects/writeFile/writeFile.H @@ -51,7 +51,7 @@ namespace functionObjects { /*---------------------------------------------------------------------------*\ - Class functionObjectFile Declaration + Class writeFile Declaration \*---------------------------------------------------------------------------*/ class writeFile diff --git a/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.H index 52170caa29..7b4916c136 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.H @@ -34,7 +34,7 @@ Description Usage \table Property | Description | Required | Default value - valueFraction | fraction od value used for boundary [0-1] | yes | + valueFraction | fraction of value used for boundary [0-1] | yes | \endtable Example of the boundary condition specification: diff --git a/src/finiteVolume/fields/fvPatchFields/derived/slip/slipFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/slip/slipFvPatchField.C index 83340f3fe5..e2f04b79ea 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/slip/slipFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/slip/slipFvPatchField.C @@ -34,7 +34,7 @@ Foam::slipFvPatchField::slipFvPatchField const DimensionedField& iF ) : - basicSymmetryFvPatchField(p, iF) + basicSymmetryFvPatchField(p, iF) {} diff --git a/src/functionObjects/graphics/runTimePostProcessing/runTimePostProcessing.H b/src/functionObjects/graphics/runTimePostProcessing/runTimePostProcessing.H index c531f5070b..0f93924c2b 100644 --- a/src/functionObjects/graphics/runTimePostProcessing/runTimePostProcessing.H +++ b/src/functionObjects/graphics/runTimePostProcessing/runTimePostProcessing.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Class - Foam::functionObjects::runTimePostProcessing + Foam::functionObjects::runTimePostPro::runTimePostProcessing Group grpGraphicsFunctionObjects diff --git a/src/sampling/sampledSurface/sampledPlane/sampledPlane.C b/src/sampling/sampledSurface/sampledPlane/sampledPlane.C index 135338d1fa..33ace2cd2c 100644 --- a/src/sampling/sampledSurface/sampledPlane/sampledPlane.C +++ b/src/sampling/sampledSurface/sampledPlane/sampledPlane.C @@ -27,7 +27,7 @@ License #include "dictionary.H" #include "polyMesh.H" #include "volFields.H" - +#include "coordinateSystem.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // diff --git a/src/sampling/sampledSurface/sampledSurface/sampledSurface.H b/src/sampling/sampledSurface/sampledSurface/sampledSurface.H index b625675eff..f0148f8ca6 100644 --- a/src/sampling/sampledSurface/sampledSurface/sampledSurface.H +++ b/src/sampling/sampledSurface/sampledSurface/sampledSurface.H @@ -63,7 +63,6 @@ SourceFiles #include "surfaceFieldsFwd.H" #include "surfaceMesh.H" #include "polyMesh.H" -#include "coordinateSystems.H" #include "interpolation.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/sampling/surfMeshSampler/plane/surfMeshPlaneSampler.C b/src/sampling/surfMeshSampler/plane/surfMeshPlaneSampler.C index b01b09a355..dea10f0fd3 100644 --- a/src/sampling/surfMeshSampler/plane/surfMeshPlaneSampler.C +++ b/src/sampling/surfMeshSampler/plane/surfMeshPlaneSampler.C @@ -27,6 +27,7 @@ License #include "dictionary.H" #include "polyMesh.H" #include "volFields.H" +#include "coordinateSystem.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // diff --git a/src/sampling/surfMeshSampler/surfMeshSampler/surfMeshSampler.H b/src/sampling/surfMeshSampler/surfMeshSampler/surfMeshSampler.H index 010429e390..6cfcee3309 100644 --- a/src/sampling/surfMeshSampler/surfMeshSampler/surfMeshSampler.H +++ b/src/sampling/surfMeshSampler/surfMeshSampler/surfMeshSampler.H @@ -52,7 +52,6 @@ SourceFiles #include "volFieldsFwd.H" #include "surfaceFieldsFwd.H" #include "polyMesh.H" -#include "coordinateSystems.H" #include "interpolation.H" #include "error.H" #include "IOobjectList.H" diff --git a/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceShading/faceShading.C b/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceShading/faceShading.C index f976ceb902..b522df0e56 100644 --- a/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceShading/faceShading.C +++ b/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceShading/faceShading.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -264,15 +264,13 @@ void Foam::faceShading::calculate() { includeAllFacesPerPatch[patchI].insert ( - faceI //pp.start() + faceI ); } } } } - labelList triSurfaceToAgglom(5*nFaces); - triSurface localSurface = triangulate ( includePatches, @@ -294,9 +292,10 @@ void Foam::faceShading::calculate() dict ); - surfacesMesh.searchableSurface::write(); - - triSurfaceToAgglom.resize(surfacesMesh.size()); + if (debug) + { + surfacesMesh.searchableSurface::write(); + } scalar maxBounding = 5.0*mag(mesh_.bounds().max() - mesh_.bounds().min()); @@ -324,7 +323,7 @@ void Foam::faceShading::calculate() const vector d(direction_*maxBounding); - start.append(fc - SMALL*d); + start.append(fc - 0.001*d); startIndex.append(myFaceId); @@ -355,7 +354,7 @@ void Foam::faceShading::calculate() ( mesh_.time().path()/"allVisibleFaces.obj", end, - Cfs + start ); } 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;