68 scalar Xa = -
C*t + ts -
X0 +
x*
cos(theta) +
y*
sin(theta);
84 scalar m = newtonRapsonF1(xin,
H,
h);
87 scalar c1 =
sin(m + (1.0 + (2.0*
H/(3.0*
h))));
88 scalar
n = (2.0/3.0)*
sqr(c1);
103 scalar maxval = 10000.0;
111 scalar a =
x + 1.0 + 2.0*
H/(3.0*
h);
112 scalar
b = 0.5*
x*(1.0 +
H/
h);
113 scalar c = 0.5*
x*(1.0 +
h/
H);
115 scalar fx = (2.0/3.0)*
sqr(c1) -
x*
H/(
h*
tan(
b));
123 else if ((iter > 1) && (residual > maxval))
126 <<
"Newton-Raphson iterations diverging: "
127 <<
"iterations = " << iter
128 <<
", residual = " << residual
133 scalar c2 = 1.0/
tan(c);
134 scalar c3 = 1.0/
sin(
b);
136 scalar fprime = (4.0/3.0)*c1*
cos(a) - c2*
h/
H -
b*
sqr(c3);
143 <<
"Failed to converge in " << iter <<
" iterations. Residual = "
144 << residual <<
nl <<
endl;
162 scalar maxval = 10000;
170 scalar a = m*(1.0 +
x/
h);
174 scalar fx =
x - (
h*
n/m*(c2/(c1 +
cosh(m*xa/
h))));
182 else if ((iter > 1) && (residual > maxval))
185 <<
"Newton-Raphson iterations diverging: "
186 <<
"iterations = " << iter
187 <<
", residual = " << residual
192 scalar c3 =
cosh(xa*m/
h) + c1;
193 scalar fprime = 1 -
n/c3*(c1 -
sqr(c2)/c3);
200 <<
"Failed to converge in " << iter <<
" iterations. Residual = "
201 << residual <<
nl <<
endl;
220 const scalar mm = vec[0];
221 const scalar nn = vec[1];
224 const scalar ts = 3.5*
h/
sqrt(
H/
h);
225 const scalar Xa = -
C*t + ts -
X0 +
x*
cos(theta) +
y*
sin(theta);
227 scalar outa =
C*nn*(1.0 +
cos(mm*z/
h)*
cosh(mm*Xa/
h));
230 scalar u = outa/outb;
234 const scalar w = outa/outb;
279 solitaryWaveModel(
dict,
mesh, patch, false)
316 setPaddlePropeties(level, facei, fraction, z);
320 const label paddlei = faceToPaddle_[facei];
334 U_[facei] = fraction*
Uf*tCoeff;
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Graphite solid properties.
InfoProxy< IOobject > info() const noexcept
Return info proxy, for printing information to a stream.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Mesh data needed to do the Finite Volume discretisation.
A patch is a list of labels that address the faces in the global face list.
Base class for waveModels.
const vector & g_
Gravity.
vectorField U_
Velocity field.
scalar waterDepthRef_
Reference water depth / [m].
virtual void setPaddlePropeties(const scalarField &level, const label facei, scalar &fraction, scalar &z) const
Set the paddle coverage fraction and reference height.
scalarField yPaddle_
Paddle y coordinates / [m].
scalarField xPaddle_
Paddle x coordinates / [m].
labelList faceToPaddle_
Addressing from patch face index to paddle index.
virtual scalar newtonRapsonF2(const scalar x0, const scalar H, const scalar h, const scalar xa, const scalar m, const scalar n) const
virtual scalar newtonRapsonF1(const scalar x0, const scalar H, const scalar h) const
McCowan(const dictionary &dict, const fvMesh &mesh, const polyPatch &patch, const bool readFields=true)
Constructor.
virtual void setVelocity(const scalar t, const scalar tCoeff, const scalarField &level)
Calculate the wave model velocity.
virtual void setLevel(const scalar t, const scalar tCoeff, scalarField &level) const
Set the water level.
virtual vector mn(const scalar H, const scalar h) const
virtual scalar eta(const scalar H, const scalar h, const scalar x, const scalar y, const scalar theta, const scalar t, const scalar X0) const
Wave height.
virtual vector Uf(const scalar H, const scalar h, const scalar x, const scalar y, const scalar theta, const scalar t, const scalar X0, const scalar z) const
Wave velocity.
virtual bool readDict(const dictionary &overrideDict)
Read from dictionary.
solitaryWaveModel(const dictionary &dict, const fvMesh &mesh, const polyPatch &patch, const bool readFields=true)
Constructor.
scalar waveHeight_
Wave height / [m].
scalar waveAngle_
Wave angle / [rad] (read in degrees).
virtual bool readDict(const dictionary &overrideDict)
Read from dictionary.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
volScalarField H(IOobject("H", runTime.timeName(), mesh.thisDb(), IOobject::NO_READ, IOobject::AUTO_WRITE), mesh, dimensionedScalar(dimLength, Zero))
autoPtr< surfaceVectorField > Uf
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
#define WarningInFunction
Report a warning using Foam::Warning.
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const NameMatchPredicate &selectedFields, DynamicList< regIOobject * > &storedObjects)
Read the selected GeometricFields of the templated type and store on the objectRegistry.
dimensionedScalar tan(const dimensionedScalar &ds)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensionedScalar cosh(const dimensionedScalar &ds)
dimensionedScalar sin(const dimensionedScalar &ds)
dimensionedScalar sinh(const dimensionedScalar &ds)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensionedScalar cos(const dimensionedScalar &ds)
constexpr char nl
The newline '\n' character (0x0a).
scalarList X0(nSpecie, Zero)
#define forAll(list, i)
Loop across all elements in list.
const Vector< label > N(dict.get< Vector< label > >("N"))