waveDisplacementPointPatchVectorField.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) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2020 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 
30 #include "pointPatchFields.H"
32 #include "Time.H"
33 #include "polyMesh.H"
34 
35 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
36 
39 (
40  const pointPatch& p,
42 )
43 :
45  amplitude_(Zero),
46  omega_(0.0),
47  waveNumber_(Zero)
48 {}
49 
50 
53 (
54  const pointPatch& p,
56  const dictionary& dict
57 )
58 :
60  amplitude_(dict.lookup("amplitude")),
61  omega_(dict.get<scalar>("omega")),
62  waveNumber_(dict.getOrDefault<vector>("waveNumber", Zero))
63 {
64  if (!dict.found("value"))
65  {
67  }
68 }
69 
70 
73 (
74  const waveDisplacementPointPatchVectorField& ptf,
75  const pointPatch& p,
76  const DimensionedField<vector, pointMesh>& iF,
77  const pointPatchFieldMapper& mapper
78 )
79 :
80  fixedValuePointPatchField<vector>(ptf, p, iF, mapper),
81  amplitude_(ptf.amplitude_),
82  omega_(ptf.omega_),
83  waveNumber_(ptf.waveNumber_)
84 {}
85 
86 
89 (
92 )
93 :
95  amplitude_(ptf.amplitude_),
96  omega_(ptf.omega_),
97  waveNumber_(ptf.waveNumber_)
98 {}
99 
100 
101 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
102 
104 {
105  if (this->updated())
106  {
107  return;
108  }
109 
110  const polyMesh& mesh = this->internalField().mesh()();
111  const Time& t = mesh.time();
112 
113  const scalarField points( waveNumber_ & patch().localPoints());
114 
116  (
117  amplitude_*cos(omega_*t.value() - points)
118  );
119 
121 }
122 
123 
125 {
127  os.writeEntry("amplitude", amplitude_);
128  os.writeEntry("omega", omega_);
129  os.writeEntry("waveNumber", waveNumber_);
130  this->writeValueEntry(os);
131 }
132 
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 
136 namespace Foam
137 {
139  (
141  waveDisplacementPointPatchVectorField
142  );
143 }
144 
145 // ************************************************************************* //
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
A FixedValue boundary condition for pointField.
waveDisplacementPointPatchVectorField(const pointPatch &, const DimensionedField< vector, pointMesh > &)
Construct from patch and internal field.
Foam::waveDisplacementPointPatchVectorField.
virtual void write(Ostream &os) const
Write.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:321
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:360
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Lookup type of boundary radiation properties.
Definition: lookup.H:57
Macros for easy insertion into run-time selection tables.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
friend Ostream & operator(Ostream &, const Field< vector > &)
dynamicFvMesh & mesh
dimensionedScalar cos(const dimensionedScalar &ds)
const pointField & points
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Vector< scalar > vector
Definition: vector.H:57
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
OBJstream os(runTime.globalPath()/outputName)
pointPatchField< vector > pointPatchVectorField
Basic pointPatch represents a set of points from the mesh.
Definition: pointPatch.H:61
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
const std::string patch
OpenFOAM patch number as a std::string.
makePointPatchTypeField(pointPatchVectorField, solidBodyMotionDisplacementPointPatchVectorField)
volScalarField & p
Namespace for OpenFOAM.
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:127