From b85a38dc41a40d54ef4f4e6d358a22053e33c53f Mon Sep 17 00:00:00 2001 From: Andrew Heather Date: Fri, 22 Dec 2017 17:06:42 +0000 Subject: [PATCH] INT: streamFunction wave model updates --- .../streamFunction/streamFunctionWaveModel.C | 43 ++++++++------- .../streamFunction/streamFunctionWaveModel.H | 7 +-- .../constant/waveProperties | 52 +++++++++---------- .../system/controlDict | 4 +- 4 files changed, 50 insertions(+), 56 deletions(-) diff --git a/src/waveModels/waveGenerationModels/derived/streamFunction/streamFunctionWaveModel.C b/src/waveModels/waveGenerationModels/derived/streamFunction/streamFunctionWaveModel.C index 30a2e037ec..181e9a4d44 100644 --- a/src/waveModels/waveGenerationModels/derived/streamFunction/streamFunctionWaveModel.C +++ b/src/waveModels/waveGenerationModels/derived/streamFunction/streamFunctionWaveModel.C @@ -66,8 +66,9 @@ Foam::scalar Foam::waveModels::streamFunction::eta scalar strfnAux = 0.0; forAll(Ejs_, iterSF) { - strfnAux += Ejs_[iterSF]*cos((iterSF + 1) - *(kx*x + ky*y - omega*t + phase)); + strfnAux += + Ejs_[iterSF]*cos((iterSF + 1) + *(kx*x + ky*y - omega*t + phase)); } return (1/k)*strfnAux; @@ -95,14 +96,16 @@ Foam::vector Foam::waveModels::streamFunction::Uf forAll(Bjs_, iterSF2) { - u += (iterSF2 + 1)*Bjs_[iterSF2] *cosh((iterSF2 + 1)*k*z) - /cosh((iterSF2 + 1)*k*h)*cos((iterSF2 + 1)*phaseTot); + u += + (iterSF2 + 1)*Bjs_[iterSF2]*cosh((iterSF2 + 1)*k*z) + /cosh((iterSF2 + 1)*k*h)*cos((iterSF2 + 1)*phaseTot); - w += (iterSF2 + 1)*Bjs_[iterSF2]*sinh((iterSF2 + 1)*k*z) - /cosh((iterSF2 + 1)*k*h)*sin((iterSF2 + 1)*phaseTot); + w += + (iterSF2 + 1)*Bjs_[iterSF2]*sinh((iterSF2 + 1)*k*z) + /cosh((iterSF2 + 1)*k*h)*sin((iterSF2 + 1)*phaseTot); } - u = waveLengthSF_/T - uMean_ + sqrt(mag(g_)/k)*u; + u = waveLength_/T - uMean_ + sqrt(mag(g_)/k)*u; w = sqrt(mag(g_)/k)*w; scalar v = u*sin(waveAngle_); @@ -122,7 +125,7 @@ void Foam::waveModels::streamFunction::setLevel ) const { const scalar waveOmega = mathematical::twoPi/wavePeriod_; - const scalar waveK = mathematical::twoPi/waveLengthSF_; + const scalar waveK = mathematical::twoPi/waveLength_; const scalar waveKx = waveK*cos(waveAngle_); const scalar waveKy = waveK*sin(waveAngle_); @@ -132,12 +135,12 @@ void Foam::waveModels::streamFunction::setLevel this->eta ( waterDepthRef_, - waveKx, + waveKx, waveKy, wavePeriod_, xPaddle_[paddlei], yPaddle_[paddlei], - waveOmega, + waveOmega, t, wavePhase_ ); @@ -155,7 +158,7 @@ void Foam::waveModels::streamFunction::setVelocity ) { const scalar waveOmega = mathematical::twoPi/wavePeriod_; - const scalar waveK = mathematical::twoPi/waveLengthSF_; + const scalar waveK = mathematical::twoPi/waveLength_; const scalar waveKx = waveK*cos(waveAngle_); const scalar waveKy = waveK*sin(waveAngle_); @@ -181,7 +184,7 @@ void Foam::waveModels::streamFunction::setVelocity wavePeriod_, xPaddle_[paddlei], yPaddle_[paddlei], - waveOmega, + waveOmega, t, wavePhase_, z @@ -205,9 +208,8 @@ Foam::waveModels::streamFunction::streamFunction : regularWaveModel(dict, mesh, patch, false), uMean_(0), - waveLengthSF_(0), - Bjs_( List (1, -1.0) ), - Ejs_( List (1, -1.0) ) + Bjs_(), + Ejs_() { if (readFields) { @@ -228,10 +230,10 @@ bool Foam::waveModels::streamFunction::readDict(const dictionary& overrideDict) { if (regularWaveModel::readDict(overrideDict)) { - lookup("uMean") >> uMean_; - lookup("waveLengthSF") >> waveLengthSF_; - lookup("Bjs") >> Bjs_; - lookup("Ejs") >> Ejs_; + overrideDict.lookup("uMean") >> uMean_; + overrideDict.lookup("waveLength") >> waveLength_; + overrideDict.lookup("Bjs") >> Bjs_; + overrideDict.lookup("Ejs") >> Ejs_; return true; } @@ -245,9 +247,10 @@ void Foam::waveModels::streamFunction::info(Ostream& os) const regularWaveModel::info(os); os << " uMean : " << uMean_ << nl - << " wave Length streamFunction : " << waveLengthSF_ << nl + << " Stream function wavelength : " << waveLength_ << nl << " Bj coefficients : " << Bjs_ << nl << " Ej coefficients : " << Ejs_ << nl; } +// ************************************************************************* // diff --git a/src/waveModels/waveGenerationModels/derived/streamFunction/streamFunctionWaveModel.H b/src/waveModels/waveGenerationModels/derived/streamFunction/streamFunctionWaveModel.H index 4728c9c1e1..28804d3ee5 100644 --- a/src/waveModels/waveGenerationModels/derived/streamFunction/streamFunctionWaveModel.H +++ b/src/waveModels/waveGenerationModels/derived/streamFunction/streamFunctionWaveModel.H @@ -42,7 +42,7 @@ namespace waveModels { /*---------------------------------------------------------------------------*\ - Class streamFunction Declaration + Class streamFunction Declaration \*---------------------------------------------------------------------------*/ class streamFunction @@ -51,8 +51,6 @@ class streamFunction { private: - - // Private Member Functions //- Wave height @@ -92,9 +90,6 @@ protected: //- Mean fluid speed in frame of reference (stream function) scalar uMean_; - //-Stream waveLength - scalar waveLengthSF_; - //- Stream Function Bj coefficients scalarList Bjs_; diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStreamFunction/constant/waveProperties b/tutorials/multiphase/interFoam/laminar/waveExampleStreamFunction/constant/waveProperties index 762db81aa5..f24465e670 100644 --- a/tutorials/multiphase/interFoam/laminar/waveExampleStreamFunction/constant/waveProperties +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStreamFunction/constant/waveProperties @@ -1,4 +1,4 @@ -/*---------------------------------------------------------------------------*\ +/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: plus | @@ -35,38 +35,36 @@ inlet uMean 2.0825; - waveLengthSF 6.2832; - + waveLength 6.2832; + Bjs - 10 ( - 8.6669014e-002 - 2.4849799e-002 - 7.7446850e-003 - 2.3355420e-003 - 6.4497731e-004 - 1.5205114e-004 - 2.5433769e-005 - -2.2045436e-007 - -2.8711504e-006 - -1.2287334e-006 + 8.6669014e-002 + 2.4849799e-002 + 7.7446850e-003 + 2.3355420e-003 + 6.4497731e-004 + 1.5205114e-004 + 2.5433769e-005 + -2.2045436e-007 + -2.8711504e-006 + -1.2287334e-006 ); Ejs - 10 ( - 5.6009609e-002 - 3.1638171e-002 - 1.5375952e-002 - 7.1743178e-003 - 3.3737077e-003 - 1.6324880e-003 - 8.2331980e-004 - 4.4403497e-004 - 2.7580059e-004 - 2.2810557e-004 + 5.6009609e-002 + 3.1638171e-002 + 1.5375952e-002 + 7.1743178e-003 + 3.3737077e-003 + 1.6324880e-003 + 8.2331980e-004 + 4.4403497e-004 + 2.7580059e-004 + 2.2810557e-004 ); - + } outlet @@ -80,5 +78,3 @@ outlet // ************************************************************************* // - - diff --git a/tutorials/multiphase/interFoam/laminar/waveExampleStreamFunction/system/controlDict b/tutorials/multiphase/interFoam/laminar/waveExampleStreamFunction/system/controlDict index 5539a0a0b2..136f448778 100644 --- a/tutorials/multiphase/interFoam/laminar/waveExampleStreamFunction/system/controlDict +++ b/tutorials/multiphase/interFoam/laminar/waveExampleStreamFunction/system/controlDict @@ -115,7 +115,7 @@ functions start ( 10.0 0.005 0.0 ); end ( 10.0 0.005 1.0 ); nPoints 1001; - } + } line7 { type uniform; @@ -123,7 +123,7 @@ functions start ( 12.0 0.005 0.0 ); end ( 12.0 0.005 1.0 ); nPoints 1001; - } + } line8 { type uniform;