cellMotionFvPatchField.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 | Copyright (C) 2011-2016 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 
26 #include "cellMotionFvPatchField.H"
27 #include "fvMesh.H"
28 #include "volMesh.H"
29 #include "pointFields.H"
30 
31 
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 
34 template<class Type>
36 (
37  const fvPatch& p,
39 )
40 :
42 {}
43 
44 
45 template<class Type>
47 (
49  const fvPatch& p,
51  const fvPatchFieldMapper& mapper
52 )
53 :
54  fixedValueFvPatchField<Type>(ptf, p, iF, mapper)
55 {}
56 
57 
58 template<class Type>
60 (
61  const fvPatch& p,
63  const dictionary& dict
64 )
65 :
67 {
68  fvPatchField<Type>::operator=(Field<Type>("value", dict, p.size()));
69 }
70 
71 
72 template<class Type>
74 (
76 )
77 :
79 {}
80 
81 
82 template<class Type>
84 (
87 )
88 :
90 {}
91 
92 
93 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
94 
95 template<class Type>
97 {
98  if (this->updated())
99  {
100  return;
101  }
102 
103  const fvPatch& p = this->patch();
104  const polyPatch& pp = p.patch();
105  const fvMesh& mesh = this->internalField().mesh();
106  const pointField& points = mesh.points();
107 
108  word pfName = this->internalField().name();
109  pfName.replace("cell", "point");
110 
112  this->db().objectRegistry::template
113  lookupObject<GeometricField<Type, pointPatchField, pointMesh>>
114  (pfName);
115 
116  forAll(p, i)
117  {
118  this->operator[](i) = pp[i].average(points, pointMotion);
119  }
120 
122 }
123 
124 
125 template<class Type>
127 {
129  this->writeEntry("value", os);
130 }
131 
132 // ************************************************************************* //
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:428
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
void size(const label)
Override size to be inconsistent with allocated storage.
virtual void write(Ostream &) const
Write.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:65
Generic GeometricField class.
Foam::cellMotionFvPatchField.
const polyPatch & patch() const
Return the polyPatch.
Definition: fvPatch.H:143
virtual const pointField & points() const
Return raw points.
Definition: polyMesh.C:979
dynamicFvMesh & mesh
const pointField & points
Pre-declare SubField and related Field type.
Definition: Field.H:57
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A class for handling words, derived from string.
Definition: word.H:59
Foam::fvPatchFieldMapper.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
string & replace(const string &oldStr, const string &newStr, size_type start=0)
Replace first occurence of sub-string oldStr with newStr.
Definition: string.C:56
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
cellMotionFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
volScalarField & p
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
runTime write()