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 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
29 #include "pointPatchFields.H"
31 #include "Time.H"
32 #include "polyMesh.H"
33 
34 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
35 
38 (
39  const pointPatch& p,
41 )
42 :
44  amplitude_(Zero),
45  omega_(0.0),
46  waveNumber_(Zero)
47 {}
48 
49 
52 (
53  const pointPatch& p,
55  const dictionary& dict
56 )
57 :
59  amplitude_(dict.lookup("amplitude")),
60  omega_(dict.get<scalar>("omega")),
61  waveNumber_(dict.lookupOrDefault<vector>("waveNumber", Zero))
62 {
63  if (!dict.found("value"))
64  {
65  updateCoeffs();
66  }
67 }
68 
69 
72 (
74  const pointPatch& p,
76  const pointPatchFieldMapper& mapper
77 )
78 :
79  fixedValuePointPatchField<vector>(ptf, p, iF, mapper),
80  amplitude_(ptf.amplitude_),
81  omega_(ptf.omega_),
82  waveNumber_(ptf.waveNumber_)
83 {}
84 
85 
88 (
91 )
92 :
94  amplitude_(ptf.amplitude_),
95  omega_(ptf.omega_),
96  waveNumber_(ptf.waveNumber_)
97 {}
98 
99 
100 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
101 
103 {
104  if (this->updated())
105  {
106  return;
107  }
108 
109  const polyMesh& mesh = this->internalField().mesh()();
110  const Time& t = mesh.time();
111 
112  const scalarField points( waveNumber_ & patch().localPoints());
113 
115  (
116  amplitude_*cos(omega_*t.value() - points)
117  );
118 
120 }
121 
122 
124 {
126  os.writeEntry("amplitude", amplitude_);
127  os.writeEntry("omega", omega_);
128  os.writeEntry("waveNumber", waveNumber_);
129  writeEntry("value", os);
130 }
131 
132 
133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134 
135 namespace Foam
136 {
138  (
141  );
142 }
143 
144 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
Foam::waveDisplacementPointPatchVectorField
Foam::waveDisplacementPointPatchVectorField.
Definition: waveDisplacementPointPatchVectorField.H:50
Foam::Zero
static constexpr const zero Zero
Global zero.
Definition: zero.H:128
Foam::dimensioned::value
const Type & value() const
Return const reference to value.
Definition: dimensionedType.C:404
Foam::pointPatch
Basic pointPatch represents a set of points from the mesh.
Definition: pointPatch.H:58
Foam::waveDisplacementPointPatchVectorField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: waveDisplacementPointPatchVectorField.C:102
polyMesh.H
Foam::pointPatchField
Abstract base class for point-mesh patch fields.
Definition: pointMVCWeight.H:60
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::pointPatchField< vector >::patch
const pointPatch & patch() const
Return patch.
Definition: pointPatchField.H:268
Foam::pointPatchFieldMapper
Foam::pointPatchFieldMapper.
Definition: pointPatchFieldMapper.H:48
Foam::fixedValuePointPatchField< vector >
Foam::makePointPatchTypeField
makePointPatchTypeField(pointPatchVectorField, solidBodyMotionDisplacementPointPatchVectorField)
Foam::Field< scalar >
Foam::valuePointPatchField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: valuePointPatchField.C:135
Foam::pointPatchField< vector >::internalField
const DimensionedField< vector, pointMesh > & internalField() const
Return dimensioned internal field reference.
Definition: pointPatchField.H:275
Foam::pointPatchField::write
virtual void write(Ostream &) const
Write.
Definition: pointPatchField.C:116
Foam::waveDisplacementPointPatchVectorField::write
virtual void write(Ostream &) const
Write.
Definition: waveDisplacementPointPatchVectorField.C:123
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:121
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
waveDisplacementPointPatchVectorField.H
Foam::pointPatchField< vector >::updated
bool updated() const
Return true if the boundary condition has already been updated.
Definition: pointPatchField.H:311
Time.H
Foam::Vector< scalar >
pointPatchFields.H
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::Ostream::writeEntry
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:219
Foam::waveDisplacementPointPatchVectorField::waveDisplacementPointPatchVectorField
waveDisplacementPointPatchVectorField(const pointPatch &, const DimensionedField< vector, pointMesh > &)
Construct from patch and internal field.
Definition: waveDisplacementPointPatchVectorField.C:38
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54
Foam::cos
dimensionedScalar cos(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:265