parallelFvGeometryScheme.H
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) 2022 OpenCFD Ltd.
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 Class
27  Foam::parallelFvGeometryScheme
28 
29 Description
30  Geometry calculation scheme with explicit sync of face-geometry
31  across processor patches.
32 
33  - applies face centre and normal (negated) to the neighbour side
34  of a processor boundary.
35  - recalculates the resulting cell volumes.
36  - mainly interesting in single-precision in that it removes the
37  different truncation error from circulating in different order. This
38  can cause problems when calculating global transformations.
39  - it does change the face normal/centre so might affect the
40  cell-closedness of the attached cells.
41 
42 Usage
43  In system/fvSchemes add a geometry scheme:
44  \verbatim
45  geometry
46  {
47  type parallel;
48 
49  // Optional underlying geometry scheme. (default is basic)
50  geometry
51  {
52  type solidBody;
53  }
54  }
55  \endverbatim
56 
57  The default behaviour will print the total number of adjusted face and
58  cell properties:
59  \verbatim
60  parallelFvGeometryScheme::movePoints() :
61  adjusted geometry of faces:113 of cells:54
62  \endverbatim
63  In addition a warning will be printed if an internal face gives a different
64  result.
65 
66 SourceFiles
67  parallelFvGeometryScheme.C
68 
69 \*---------------------------------------------------------------------------*/
70 
71 #ifndef Foam_parallelFvGeometryScheme_H
72 #define Foam_parallelFvGeometryScheme_H
73 
74 #include "basicFvGeometryScheme.H"
75 #include "coupledPolyPatch.H"
76 
77 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
78 
79 namespace Foam
80 {
81 
82 /*---------------------------------------------------------------------------*\
83  Class parallelFvGeometryScheme Declaration
84 \*---------------------------------------------------------------------------*/
85 
87 :
88  public fvGeometryScheme
89 {
90 protected:
91 
92  // Protected Data
93 
94  //- Dictionary for underlying scheme
96 
97  //- Demand-driven construction of underlying scheme
99 
100 
101 private:
102 
103  // Private Member Functions
104 
105  //- Swap processor-face geometry
106  void adjustGeometry();
107 
108  //- No copy construct
110 
111  //- No copy assignment
112  void operator=(const parallelFvGeometryScheme&) = delete;
113 
114 
115 public:
116 
117  // Public classes
118 
119  //- Transformation for oriented fields
120  class transformOriented
121  {
122  public:
123 
124  template<class Type>
125  void operator()(const coupledPolyPatch& cpp, UList<Type>& fld) const
126  {
127  if (cpp.parallel())
128  {
129  for (auto& f : fld)
130  {
131  f = -f;
132  }
133  }
134  else
135  {
136  transformList(-cpp.forwardT(), fld);
137  }
138  }
139  };
140 
141 
142 public:
143 
144  //- Runtime type information
145  TypeName("parallel");
146 
147 
148  // Constructors
149 
150  //- Construct from mesh
151  parallelFvGeometryScheme
152  (
153  const fvMesh& mesh,
154  const dictionary& dict
155  );
156 
157 
158  //- Destructor
159  virtual ~parallelFvGeometryScheme() = default;
160 
161 
162  // Member Functions
163 
164  //- Construct underlying fvGeometryScheme
165  const fvGeometryScheme& geometry() const;
166 
167  //- Do what is necessary if the mesh has moved
168  virtual void movePoints();
169 
170  //- Update mesh for topology changes
171  virtual void updateMesh(const mapPolyMesh& mpm);
172 
173  //- Return linear difference weighting factors
174  virtual tmp<surfaceScalarField> weights() const;
175 
176  //- Return cell-centre difference coefficients
177  virtual tmp<surfaceScalarField> deltaCoeffs() const;
178 
179  //- Return non-orthogonal cell-centre difference coefficients
180  virtual tmp<surfaceScalarField> nonOrthDeltaCoeffs() const;
181 
182  //- Return non-orthogonality correction vectors
183  virtual tmp<surfaceVectorField> nonOrthCorrectionVectors() const;
184 };
185 
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 } // End namespace Foam
190 
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 
193 #endif
194 
195 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
tmp< fvGeometryScheme > geometryPtr_
Demand-driven construction of underlying scheme.
The coupledPolyPatch is an abstract base class for patches that couple regions of the computational d...
virtual const tensorField & forwardT() const
Return face transformation tensor.
Geometry calculation scheme with explicit sync of face-geometry across processor patches.
virtual bool parallel() const
Are the cyclic planes parallel.
void operator()(const coupledPolyPatch &cpp, UList< Type > &fld) const
virtual tmp< surfaceVectorField > nonOrthCorrectionVectors() const
Return non-orthogonality correction vectors.
virtual tmp< surfaceScalarField > weights() const
Return linear difference weighting factors.
virtual tmp< surfaceScalarField > deltaCoeffs() const
Return cell-centre difference coefficients.
const fvMesh & mesh() const
Return mesh reference.
labelList f(nPoints)
virtual void movePoints()
Do what is necessary if the mesh has moved.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
dictionary dict_
Dictionary for underlying scheme.
void transformList(const tensor &rotTensor, UList< T > &field)
Inplace transform a list of elements.
Definition: transformList.C:48
virtual void updateMesh(const mapPolyMesh &mpm)
Update mesh for topology changes.
fvGeometryScheme(const fvMesh &mesh, const dictionary &dict)
Construct from mesh.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
virtual tmp< surfaceScalarField > nonOrthDeltaCoeffs() const
Return non-orthogonal cell-centre difference coefficients.
virtual ~parallelFvGeometryScheme()=default
Destructor.
TypeName("parallel")
Runtime type information.
Abstract base class for geometry calculation schemes.
const fvGeometryScheme & geometry() const
Construct underlying fvGeometryScheme.
Namespace for OpenFOAM.