waveVelocity_DimensionedFieldFunction.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2026 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
27 #include "fvMesh.H"
28 #include "waveSuperposition.H"
29 #include "levelSet.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 namespace DimensionedFieldFunctions
37 {
39  (
41  0
42  );
43 
47  (
51  );
52 }
53 }
54 
55 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
56 
58 (
59  const dictionary& dict,
61 )
62 :
64 {}
65 
66 
68 (
69  const waveVelocity& dff,
71 )
72 :
74 {}
75 
76 
78 <
80  <
82  >
83 >
85 (
87 ) const
88 {
90  (
91  new waveVelocity(*this, field)
92  );
93 }
94 
95 
96 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
97 
99 {
100  const fvMesh& mesh(this->field_.mesh());
101  const scalar t = mesh.time().value();
102 
104 
105  const pointField& ccs = mesh.cellCentres();
106  const pointField& pts = mesh.points();
107 
108  this->field_.primitiveFieldRef() = levelSetAverage
109  (
110  mesh,
111  waves.height(t, ccs),
112  waves.height(t, pts),
113  waves.UGas(t, ccs)(),
114  waves.UGas(t, pts)(),
115  waves.ULiquid(t, ccs)(),
116  waves.ULiquid(t, pts)()
117  );
118 }
119 
120 
122 (
123  Ostream& os
124 ) const
125 {}
126 
127 
128 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
Base class for run-time selectable internal and patch field initialisation evaluation and update with...
virtual autoPtr< DimensionedFieldFunction< DimensionedField< vector, fvMesh > > > clone() const
Construct and return a clone for the specified field.
Initialises the velocity to that specified by a superposition of wave models. All the wave modelling ...
virtual void evaluate()
Evaluate the function and set the field.
virtual void write(Ostream &os) const
Write data to dictionary stream.
waveVelocity(const dictionary &dict, DimensionedField< vector, fvMesh > &field)
Construct with dictionary to initialise given field.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
const Type & value() const
Return const reference to value.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:98
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:433
virtual const pointField & points() const
Return raw points.
Definition: polyMesh.C:1295
const vectorField & cellCentres() const
A wrapper around a list of wave models. Superimposes the modelled values of elevation and velocity....
virtual tmp< scalarField > height(const scalar t, const vectorField &p) const
Get the height above the waves at a given time and global positions.
virtual tmp< vectorField > ULiquid(const scalar t, const vectorField &p) const
Get the liquid velocity at a given time and global positions.
virtual tmp< vectorField > UGas(const scalar t, const vectorField &p) const
Get the gas velocity at a given time and global positions.
static const waveSuperposition & New(const objectRegistry &db)
Return a reference to the wave model on the given database,.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
defineTypeNameAndDebug(externalWallLayersHeatTransferCoefficient, 0)
addToRunTimeSelectionTable(DimensionedFieldFunctionScalarFvPatch, externalWallLayersHeatTransferCoefficient, dictionary)
DimensionedFieldFunction< DimensionedField< vector, fvMesh > > DimensionedFieldFunctionvectorFvMesh
Namespace for OpenFOAM.
tmp< Field< Type > > levelSetAverage(const fvMesh &mesh, const scalarField &levelC, const scalarField &levelP, const Field< Type > &positiveC, const Field< Type > &positiveP, const Field< Type > &negativeC, const Field< Type > &negativeP)
Calculate the average value of two fields, one on each side of a level set.
dictionary dict