49 Foam::waveModels::irregular::coeffs(
const label i)
const
51 return AiryCoeffs(depth_, amplitudes_[i], lengths_[i],
g());
61 spectrum_(
wave.spectrum_, false),
64 formatter_(
wave.formatter_, false),
65 amplitudes_(
wave.amplitudes_),
66 lengths_(
wave.lengths_),
79 depth_(
dict.lookupOrDefault<scalar>(
"depth", great)),
82 span_(
dict.lookupOrDefault(
"span",
Pair<scalar>(0.01, 0.99))),
96 spectrum_->fFraction(span_.
first()),
97 spectrum_->fFraction(span_.
second())
113 const label j0 = n_ - 1 - i,
j1 = n_ - i;
118 amplitudes_[i] =
sqrt(2*(integralS[
j1] - integralS[
j0]));
123 (integralS[
j1] - integralS[
j0])/(integralFS[
j1] - integralFS[
j0]);
145 const scalar avgAmplitude =
147 const scalar avgPeroid =
149 /(integralFS.
last() - integralFS.
first());
150 const scalar avgLength =
154 waveModel::typeName.length() + modelName.length() + 2;
155 Info<< waveModel::typeName <<
": " << modelName
156 <<
": min/average/max period = "
157 << periods.
first() <<
'/' << avgPeroid <<
'/' << periods.
last()
159 <<
" min/average/max length = "
160 << lengths_.
first() <<
'/' << avgLength <<
'/' << lengths_.
last()
166 static const scalar t = 0.1;
174 const label nn = 1024;
182 /waveModel::typeName +
"s"
183 /modelName + spectrum_->type().capitalise(),
201 SS[3*i - 1] =
sqr(amplitudes_[n_ - i])/2/(
f[i] -
f[i - 1]);
210 SS[3*i + 1] =
sqr(amplitudes_[n_ - 1 - i])/2/(
f[i + 1] -
f[i]);
218 /waveModel::typeName +
"s"
219 /modelName + spectrum_->type().capitalise(),
239 return coeffs(amplitudes_.size() - 1).celerity();
254 result += coeffs(i).elevation(phases_[i], t,
x);
272 result += coeffs(i).velocity(phases_[i], t, xz);
283 if (!coeffs(amplitudes_.size() - 1).deep())
288 writeEntry(os,
"spectrum", spectrum_->type());
290 os <<
indent <<
word(spectrum_->type() +
"Coeffs") <<
nl
292 spectrum_->
write(os);
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
graph_traits< Graph >::vertices_size_type size_type
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
void size(const label)
Override size to be inconsistent with allocated storage.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
virtual Ostream & write(const char)=0
Write character.
An ordered pair of two objects of type <T> with first() and second() elements.
const Type & second() const
Return second.
const Type & first() const
Return first.
T & first()
Return the first element of the list.
T & last()
Return the last element of the list.
static bool master(const label communicator=0)
Am I the master process.
Holds list of sampling positions.
A list of keyword definitions, which are a keyword followed by any number of values (e....
static const word outputPrefix
Directory prefix.
Base class for writing coordinate sets with data.
A class for handling character strings derived from std::string.
A class for managing temporary objects.
T & ref() const
Return non-const reference or generate a fatal error.
Generic base class for waves. Derived classes must implement field functions which return the elevati...
scalar g() const
Get the value of gravity.
virtual void write(Ostream &os) const
Write.
Calculation engine for the Airy wave model and other models that are a correction on top of the Airy ...
scalar celerity() const
The wave celerity [m/s].
const scalar length
Wavelength [m].
Irregular wave model. Phase fraction and velocity field are built up from multiple first-order waves,...
virtual scalar celerity() const
The wave celerity [m/s].
virtual tmp< scalarField > elevation(const scalar t, const scalarField &x) const
Get the wave elevation at a given time and local coordinates. Local.
virtual void write(Ostream &os) const
Write.
irregular(const irregular &wave)
Construct a copy.
virtual tmp< vector2DField > velocity(const scalar t, const vector2DField &xz) const
Get the wave velocity at a given time and local coordinates. Local.
virtual ~irregular()
Destructor.
Base class for wave spectra.
A class for handling words, derived from string.
const scalar twoPi(2 *pi)
label wave(const fvMesh &mesh, const List< labelPair > &changedPatchAndFaces, const label nCorrections, GeometricField< scalar, PatchField, GeoMesh > &distance, TrackingData &td, GeometricField< DataType, PatchField, GeoMesh > &... data)
Wave distance (and maybe additional) data from faces. If nCorrections is.
const FieldField< fvPatchField, Type > & ff(const FieldField< fvPatchField, Type > &bf)
defineTypeNameAndDebug(Airy, 0)
addToRunTimeSelectionTable(waveModel, Airy, dictionary)
fileName cwd()
Return current working directory path name.
void writeEntryIfDifferent(Ostream &os, const word &entryName, const EntryType &value1, const EntryType &value2)
Helper function to write the keyword and entry only if the.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensionedScalar j1(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
List< scalar > scalarList
A List of scalars.
Field< vector2D > vector2DField
Forward declarations of the specialisation of Field<T> for vector2D.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
dimensionedScalar sqrt(const dimensionedScalar &ds)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
Ostream & indent(Ostream &os)
Indent stream.
dimensionedScalar j0(const dimensionedScalar &ds)
randomGenerator rndGen(653213)