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 -------------------------------------------------------------------------------
11 License
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 
29 #include "shallowWaterAbsorption.H"
30 #include "volFields.H"
31 #include "fvPatchFields.H"
33 
34 
35 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
36 
37 namespace Foam
38 {
39 namespace waveModels
40 {
43 }
44 }
45 
46 
47 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
48 
50 (
51  const scalar t,
52  const scalar tCoeff,
53  scalarField& level
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  U_.replace(0, 0);
71  U_.replace(1, 0);
72 }
73 
74 
76 (
77  const scalarField& level
78 )
79 {
80  // Set alpha as zero-gradient
81  const volScalarField& alpha =
82  mesh_.lookupObject<volScalarField>(alphaName_);
83 
84  alpha_ = alpha.boundaryField()[patch_.index()].patchInternalField();
85 }
86 
87 
88 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
89 
91 (
92  const dictionary& dict,
93  const fvMesh& mesh,
94  const polyPatch& patch,
95  const bool readFields
96 )
97 :
99 {
100  if (readFields)
101  {
102  readDict(dict);
103  }
104 }
105 
106 
107 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
108 
110 (
111  const dictionary& overrideDict
112 )
113 {
114  return waveAbsorptionModel::readDict(overrideDict);
115 }
116 
117 
118 // ************************************************************************* //
volFields.H
Foam::waveModels::shallowWaterAbsorption::readDict
virtual bool readDict(const dictionary &overrideDict)
Read from dictionary.
Definition: shallowWaterAbsorption.C:110
Foam::GeometricField::replace
void replace(const direction d, const GeometricField< cmptType, PatchField, GeoMesh > &gcf)
Replace specified field component with content from another field.
Foam::constant::atomic::alpha
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Definition: readThermalProperties.H:212
Foam::waveModels::addToRunTimeSelectionTable
addToRunTimeSelectionTable(waveModel, shallowWaterAbsorption, patch)
Foam::waveModels::waveAbsorptionModel
Definition: waveAbsorptionModel.H:49
Foam::waveModels::shallowWaterAbsorption::setLevel
virtual void setLevel(const scalar t, const scalar tCoeff, scalarField &level) const
Set the water level.
Definition: shallowWaterAbsorption.C:50
Foam::waveModels::shallowWaterAbsorption::setVelocity
virtual void setVelocity(const scalar t, const scalar tCoeff, const scalarField &level)
Calculate the wave model velocity.
Definition: shallowWaterAbsorption.C:61
Foam::waveModels::shallowWaterAbsorption::shallowWaterAbsorption
shallowWaterAbsorption(const dictionary &dict, const fvMesh &mesh, const polyPatch &patch, const bool readFields=true)
Constructor.
Definition: shallowWaterAbsorption.C:91
Foam::Field< scalar >
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:68
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::readFields
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const wordHashSet &selectedFields, LIFOStack< regIOobject * > &storedObjects)
Read the selected GeometricFields of the templated type.
Definition: ReadFieldsTemplates.C:312
U
U
Definition: pEqn.H:72
shallowWaterAbsorption
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
fvPatchFields.H
shallowWaterAbsorption.H
Foam::waveModels::shallowWaterAbsorption::setAlpha
virtual void setAlpha(const scalarField &level)
Set the alpha field based on the water level.
Definition: shallowWaterAbsorption.C:76
Foam::GeometricField< vector, fvPatchField, volMesh >
Foam::waveModels::defineTypeNameAndDebug
defineTypeNameAndDebug(waveAbsorptionModel, 0)