Loading...
Searching...
No Matches
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
43(
44 const pointPatch& p,
46)
48 fixedValuePointPatchVectorField(p, iF),
49 SBMFPtr_(nullptr),
50 localPoints0Ptr_(nullptr)
51{}
52
53
56(
57 const pointPatch& p,
59 const dictionary& dict
60)
61:
62 fixedValuePointPatchVectorField(p, iF, dict, IOobjectOption::NO_READ),
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())
72 -localPoints0()
73 );
74 }
75}
76
77
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==
105)
107 fixedValuePointPatchVectorField(ptf),
108 SBMFPtr_(ptf.SBMFPtr_().clone()),
109 localPoints0Ptr_(nullptr)
110{}
111
112
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(),
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())
174 );
175
176 fixedValuePointPatchVectorField::updateCoeffs();
177}
178
179
181write(Ostream& os) const
182{
183 // Note: write value
185
186 os.writeEntry(solidBodyMotionFunction::typeName, SBMFPtr_->type());
187
188 os << indent << word(SBMFPtr_->type() + "Coeffs");
189 SBMFPtr_->writeData(os);
190}
191
192
193// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194
196(
198 solidBodyMotionDisplacementPointPatchVectorField
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 simple container of IOobject preferences. Can also be used for general handling of read/no-read/rea...
@ NO_REGISTER
Do not request registration (bool: false).
@ MUST_READ
Reading required.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
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
Foam::pointPatchFieldMapper.
Basic pointPatch represents a set of points from the mesh.
Definition pointPatch.H:67
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh").
Definition polyMesh.H:411
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.
solidBodyMotionDisplacementPointPatchVectorField(const pointPatch &, const DimensionedField< vector, pointMesh > &)
Construct from patch and internal field.
virtual autoPtr< pointPatchField< vector > > clone() const
Return a clone.
Base class for defining solid-body motions.
virtual void write(Ostream &) const
Write.
A class for handling words, derived from Foam::string.
Definition word.H:66
volScalarField & p
OBJstream os(runTime.globalPath()/outputName)
Different types of constants.
Namespace for OpenFOAM.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
vectorIOField pointIOField
pointIOField is a vectorIOField.
Ostream & indent(Ostream &os)
Indent stream.
Definition Ostream.H:481
pointPatchField< vector > pointPatchVectorField
vectorField pointField
pointField is a vectorField.
void transformPoints(vectorField &, const septernion &, const vectorField &)
Transform given vectorField of coordinates with the given septernion.
#define makePointPatchTypeField(PatchTypeField, typePatchTypeField)
Define a concrete pointPatchField type and add to run-time tables Example, (pointPatchScalarField,...
dictionary dict
Spatial transformation functions for primitive fields.
pointField points0(pointIOField(IOobject("points", mesh.time().constant(), polyMesh::meshSubDir, mesh, IOobject::MUST_READ, IOobject::NO_WRITE, IOobject::NO_REGISTER)))