solidBodyMotionDisplacementPointPatchVectorField.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) 2013-2016 OpenFOAM Foundation
9 Copyright (C) 2020 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
30#include "transformField.H"
32#include "pointPatchFields.H"
33
34// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35
36namespace Foam
37{
38
39// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
40
41solidBodyMotionDisplacementPointPatchVectorField::
42solidBodyMotionDisplacementPointPatchVectorField
43(
44 const pointPatch& p,
46)
47:
48 fixedValuePointPatchVectorField(p, iF),
49 SBMFPtr_(nullptr),
50 localPoints0Ptr_(nullptr)
51{}
52
53
54solidBodyMotionDisplacementPointPatchVectorField::
55solidBodyMotionDisplacementPointPatchVectorField
56(
57 const pointPatch& p,
59 const dictionary& dict
60)
61:
62 fixedValuePointPatchVectorField(p, iF, dict, false),
63 SBMFPtr_(solidBodyMotionFunction::New(dict, this->db().time())),
64 localPoints0Ptr_(nullptr)
65{
66 if (!dict.found("value"))
67 {
68 // Determine current local points and offset
69 fixedValuePointPatchVectorField::operator==
70 (
71 transformPoints(SBMFPtr_().transformation(), localPoints0())
73 );
74 }
75}
76
77
78solidBodyMotionDisplacementPointPatchVectorField::
79solidBodyMotionDisplacementPointPatchVectorField
80(
82 const pointPatch& p,
84 const pointPatchFieldMapper& mapper
85)
86:
87 fixedValuePointPatchVectorField(ptf, p, iF, mapper),
88 SBMFPtr_(ptf.SBMFPtr_().clone()),
89 localPoints0Ptr_(nullptr)
90{
91 // For safety re-evaluate
92
93 fixedValuePointPatchVectorField::operator==
94 (
95 transformPoints(SBMFPtr_().transformation(), localPoints0())
97 );
98}
99
100
101solidBodyMotionDisplacementPointPatchVectorField::
102solidBodyMotionDisplacementPointPatchVectorField
103(
105)
106:
107 fixedValuePointPatchVectorField(ptf),
108 SBMFPtr_(ptf.SBMFPtr_().clone()),
109 localPoints0Ptr_(nullptr)
110{}
111
112
113solidBodyMotionDisplacementPointPatchVectorField::
114solidBodyMotionDisplacementPointPatchVectorField
115(
118)
119:
120 fixedValuePointPatchVectorField(ptf, iF),
121 SBMFPtr_(ptf.SBMFPtr_().clone()),
122 localPoints0Ptr_(nullptr)
123{
124 // For safety re-evaluate
125
126 fixedValuePointPatchVectorField::operator==
127 (
128 transformPoints(SBMFPtr_().transformation(), localPoints0())
129 -localPoints0()
130 );
131}
132
133
134// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
135
136const pointField&
138{
139 if (!localPoints0Ptr_)
140 {
142 (
144 (
145 "points",
146 this->db().time().constant(),
148 this->db(),
151 false
152 )
153 );
154
155 localPoints0Ptr_.reset(new pointField(points0, patch().meshPoints()));
156 }
157
158 return *localPoints0Ptr_;
159}
160
161
163{
164 if (this->updated())
165 {
166 return;
167 }
168
169 // Determine current local points and offset
170 fixedValuePointPatchVectorField::operator==
171 (
172 transformPoints(SBMFPtr_().transformation(), localPoints0())
173 -localPoints0()
174 );
175
176 fixedValuePointPatchVectorField::updateCoeffs();
177}
178
179
181write(Ostream& os) const
182{
183 // Note: write value
184 fixedValuePointPatchVectorField::write(os);
185
187
188 os << indent << word(SBMFPtr_->type() + "Coeffs");
189 SBMFPtr_->writeData(os);
190}
191
192
193// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194
196(
199);
200
201
202// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203
204} // End namespace Foam
205
206// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A primitive field of type <T> with automated input and output.
Definition: IOField.H:58
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:239
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
Definition: dictionaryI.H:87
virtual bool write()
Write the output fields.
constant condensation/saturation model.
Foam::pointPatchFieldMapper.
Basic pointPatch represents a set of points from the mesh.
Definition: pointPatch.H:64
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
Definition: polyMesh.H:324
Enables the specification of a fixed value boundary condition using the solid body motion functions.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Base class for defining solid-body motions.
A class for handling words, derived from Foam::string.
Definition: word.H:68
volScalarField & p
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:44
Ostream & indent(Ostream &os)
Indent stream.
Definition: Ostream.H:342
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
void transformPoints(vectorField &, const septernion &, const vectorField &)
Transform given vectorField of coordinates with the given septernion.
#define makePointPatchTypeField(PatchTypeField, typePatchTypeField)
dictionary dict
static const char *const typeName
The type name used in ensight case files.
Spatial transformation functions for primitive fields.
pointField points0(pointIOField(IOobject("points", mesh.time().constant(), polyMesh::meshSubDir, mesh, IOobject::MUST_READ, IOobject::NO_WRITE, false)))