Loading...
Searching...
No Matches
waveGenerationModel.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
29#include "waveGenerationModel.H"
30#include "unitConversion.H"
32// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33
34namespace Foam
35{
36namespace waveModels
37{
39}
40}
41
42
43// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
44
46{
47 const scalar h(get<scalar>("waveHeight"));
48 if (h < 0)
49 {
51 << "Wave height must be greater than zero. Supplied"
52 << " value waveHeight = " << h
54 }
55
56 return h;
57}
58
59
62 return degToRad(get<scalar>("waveAngle"));
63}
64
65
66// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
67
69(
70 const dictionary& dict,
71 const fvMesh& mesh,
72 const polyPatch& patch,
73 const bool readFields
74)
75:
76 waveModel(dict, mesh, patch, false)
77{
78 if (readFields)
79 {
81 }
82}
83
84
85// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
86
88(
89 const dictionary& overrideDict
90)
91{
92 if (waveModel::readDict(overrideDict))
93 {
94 readEntry("activeAbsorption", activeAbsorption_);
95
96 return true;
97 }
98
99 return false;
100}
101
102
104{
106}
107
108
109// ************************************************************************* //
InfoProxy< IOobject > info() const noexcept
Return info proxy, for printing information to a stream.
Definition IOobject.H:1041
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, IOobjectOption::readOption readOpt=IOobjectOption::MUST_READ) const
Find entry and assign to T val. FatalIOError if it is found and the number of tokens is incorrect,...
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
bool activeAbsorption_
Active wave absorption switch.
Definition waveModel.H:158
waveModel(const dictionary &dict, const fvMesh &mesh, const polyPatch &patch, const bool readFields=true)
Constructor.
Definition waveModel.C:238
virtual bool readDict(const dictionary &overrideDict)
Read from dictionary.
Definition waveModel.C:287
scalar readWaveAngle() const
Helper function to read the wave angle from the coeff dictionary.
scalar readWaveHeight() const
Helper function to read the wave height from the coeff dictionary.
waveGenerationModel(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
dynamicFvMesh & mesh
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition error.H:629
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
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.
constexpr scalar degToRad() noexcept
Multiplication factor for degrees to radians conversion.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition errorManip.H:125
dictionary dict
volScalarField & h
Unit conversion functions.