Loading...
Searching...
No Matches
shallowWaterAbsorption.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2015 IH-Cantabria
9 Copyright (C) 2016-2017 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
30#include "volFields.H"
31#include "fvPatchFields.H"
33
35// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
36
37namespace Foam
38{
39namespace waveModels
40{
43}
44}
45
46
47// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
48
50(
51 const scalar t,
52 const scalar tCoeff,
54) const
55{
56 level = waterDepthRef_;
57}
58
59
61(
62 const scalar t,
63 const scalar tCoeff,
64 const scalarField& level
65)
66{
67 // Apply zero-gradient condition to z-component of velocity only
68 const volVectorField& U = mesh_.lookupObject<volVectorField>(UName_);
69 U_ = U.boundaryField()[patch_.index()].patchInternalField();
70
71 for (vector& vel : U_)
72 {
73 vel.x() = 0;
74 vel.y() = 0;
75 }
76}
77
78
80(
81 const scalarField& level
82)
83{
84 // Set alpha as zero-gradient
85 const volScalarField& alpha =
86 mesh_.lookupObject<volScalarField>(alphaName_);
88 alpha_ = alpha.boundaryField()[patch_.index()].patchInternalField();
89}
90
91
92// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
93
95(
96 const dictionary& dict,
97 const fvMesh& mesh,
98 const polyPatch& patch,
99 const bool readFields
100)
101:
102 waveAbsorptionModel(dict, mesh, patch, false)
103{
104 if (readFields)
105 {
107 }
108}
109
110
111// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
112
114(
115 const dictionary& overrideDict
116)
117{
118 return waveAbsorptionModel::readDict(overrideDict);
119}
120
121
122// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
A patch is a list of labels that address the faces in the global face list.
Definition polyPatch.H:73
Base class for waveModels.
Definition waveModel.H:55
const polyPatch & patch_
Reference to the polyPatch.
Definition waveModel.H:68
const fvMesh & mesh_
Reference to the mesh database.
Definition waveModel.H:63
word UName_
Name of velocity field, default = "U".
Definition waveModel.H:78
virtual const scalarField & alpha() const
Return the latest wave indicator field prediction.
Definition waveModel.C:408
scalarField alpha_
Wave indicator field.
Definition waveModel.H:171
virtual const vectorField & U() const
Return the latest wave velocity prediction.
Definition waveModel.C:402
vectorField U_
Velocity field.
Definition waveModel.H:166
scalar waterDepthRef_
Reference water depth / [m].
Definition waveModel.H:143
waveModel(const dictionary &dict, const fvMesh &mesh, const polyPatch &patch, const bool readFields=true)
Constructor.
Definition waveModel.C:238
word alphaName_
Name of phase fraction field, default = "alpha".
Definition waveModel.H:83
virtual void setVelocity(const scalar t, const scalar tCoeff, const scalarField &level)
Calculate the wave model velocity.
shallowWaterAbsorption(const dictionary &dict, const fvMesh &mesh, const polyPatch &patch, const bool readFields=true)
Constructor.
virtual void setLevel(const scalar t, const scalar tCoeff, scalarField &level) const
Set the water level.
virtual void setAlpha(const scalarField &level)
Set the alpha field based on the water level.
virtual bool readDict(const dictionary &overrideDict)
Read from dictionary.
waveAbsorptionModel(const dictionary &dict, const fvMesh &mesh, const polyPatch &patch, const bool readFields=true)
Constructor.
virtual bool readDict(const dictionary &overrideDict)
Read from dictionary.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
U
Definition pEqn.H:72
dynamicFvMesh & mesh
Namespace for OpenFOAM.
GeometricField< vector, fvPatchField, volMesh > volVectorField
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.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Vector< scalar > vector
Definition vector.H:57
volScalarField & alpha
dictionary dict