solidBodyMotionDisplacementPointPatchVectorField.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
27 #include "transformField.H"
29 #include "pointPatchFields.H"
30 
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 
36 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
37 
40 (
41  const pointPatch& p,
43 )
44 :
45  fixedValuePointPatchVectorField(p, iF),
46  SBMFPtr_()
47 {}
48 
49 
52 (
53  const pointPatch& p,
55  const dictionary& dict
56 )
57 :
58  fixedValuePointPatchVectorField(p, iF, dict, false),
59  SBMFPtr_(solidBodyMotionFunction::New(dict, this->db().time()))
60 {
61  if (!dict.found("value"))
62  {
63  // Determine current local points and offset
64  fixedValuePointPatchVectorField::operator==
65  (
66  transformPoints(SBMFPtr_().transformation(), localPoints0())
67  -localPoints0()
68  );
69  }
70 }
71 
72 
75 (
77  const pointPatch& p,
79  const pointPatchFieldMapper& mapper
80 )
81 :
82  fixedValuePointPatchVectorField(ptf, p, iF, mapper),
83  SBMFPtr_(ptf.SBMFPtr_().clone().ptr())
84 {
85  // For safety re-evaluate
86 
87  fixedValuePointPatchVectorField::operator==
88  (
89  transformPoints(SBMFPtr_().transformation(), localPoints0())
90  -localPoints0()
91  );
92 }
93 
94 
97 (
100 )
101 :
102  fixedValuePointPatchVectorField(ptf, iF),
103  SBMFPtr_(ptf.SBMFPtr_().clone().ptr())
104 {
105  // For safety re-evaluate
106 
107  fixedValuePointPatchVectorField::operator==
108  (
109  transformPoints(SBMFPtr_().transformation(), localPoints0())
110  -localPoints0()
111  );
112 }
113 
114 
115 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
116 
117 const pointField&
119 {
120  if (!localPoints0Ptr_.valid())
121  {
122  pointIOField points0
123  (
124  IOobject
125  (
126  "points",
127  this->db().time().constant(),
129  this->db(),
132  false
133  )
134  );
135 
136  localPoints0Ptr_.reset(new pointField(points0, patch().meshPoints()));
137  }
138  return localPoints0Ptr_();
139 }
140 
141 
143 {
144  if (this->updated())
145  {
146  return;
147  }
148 
149  // Determine current local points and offset
150  fixedValuePointPatchVectorField::operator==
151  (
152  transformPoints(SBMFPtr_().transformation(), localPoints0())
153  -localPoints0()
154  );
155 
156  fixedValuePointPatchVectorField::updateCoeffs();
157 }
158 
159 
161 write(Ostream& os) const
162 {
163  // Note: write value
165 
166  writeEntry(os, solidBodyMotionFunction::typeName, SBMFPtr_->type());
167  os << indent << word(SBMFPtr_->type() + "Coeffs");
168  SBMFPtr_->writeData(os);
169 }
170 
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
175 (
178 );
179 
180 
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 
183 } // End namespace Foam
184 
185 // ************************************************************************* //
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Definition: dictionary.C:663
Ostream & indent(Ostream &os)
Indent stream.
Definition: Ostream.H:221
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
Definition: polyMesh.H:328
Foam::pointPatchFieldMapper.
Macros for easy insertion into run-time selection tables.
Spatial transformation functions for primitive fields.
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:42
A class for handling words, derived from string.
Definition: word.H:59
static autoPtr< solidBodyMotionFunction > New(const dictionary &SBMFCoeffs, const Time &runTime)
Select constructed from the SBMFCoeffs dictionary and Time.
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Basic pointPatch represents a set of points from the mesh.
Definition: pointPatch.H:56
void transformPoints(vectorField &, const spatialTransform &, const vectorField &)
Transform given vectorField of coordinates with the given spatialTransform.
Enables the specification of a fixed value boundary condition using the solid body motion functions...
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
solidBodyMotionDisplacementPointPatchVectorField(const pointPatch &, const DimensionedField< vector, pointMesh > &)
Construct from patch and internal field.
makePointPatchTypeField(pointPatchVectorField, solidBodyMotionDisplacementPointPatchVectorField)
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:98
A primitive field of type <T> with automated input and output.
Definition: IOField.H:50
Namespace for OpenFOAM.