surfaceInterpolation.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) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2017-2022 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 Description
28  Cell to face interpolation scheme. Included in fvMesh.
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #include "surfaceInterpolation.H"
33 #include "fvMesh.H"
34 #include "volFields.H"
35 #include "surfaceFields.H"
36 #include "coupledFvPatch.H"
37 #include "basicFvGeometryScheme.H"
38 
39 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
40 
41 namespace Foam
42 {
44 }
45 
46 
47 // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
48 
50 {
51  // TBD: potential to apply partial clear out only?
52  // Move to fvGeometryScheme?
53  weights_.clear();
54  deltaCoeffs_.clear();
55  nonOrthDeltaCoeffs_.clear();
56  nonOrthCorrectionVectors_.clear();
57 }
58 
59 
60 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
61 
63 :
64  mesh_(fvm),
65  geometryPtr_(nullptr),
66  weights_(nullptr),
67  deltaCoeffs_(nullptr),
68  nonOrthDeltaCoeffs_(nullptr),
69  nonOrthCorrectionVectors_(nullptr)
70 {}
71 
72 
73 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
74 
76 {
77  clearOut();
78 }
79 
80 
81 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
82 
84 {
85  if (!geometryPtr_)
86  {
87  geometryPtr_ = fvGeometryScheme::New
88  (
89  mesh_,
90  mesh_.schemesDict().subOrEmptyDict("geometry"),
91  basicFvGeometryScheme::typeName
92  );
93  }
94 
95  return geometryPtr_();
96 }
97 
98 
100 {
101  geometryPtr_ = schemePtr;
102 }
103 
104 
106 {
107  if (!weights_)
108  {
109  weights_.reset(geometry().weights().ptr());
110  }
111 
112  return weights_();
113 }
114 
115 
117 {
118  if (!deltaCoeffs_)
119  {
120  deltaCoeffs_.reset(geometry().deltaCoeffs().ptr());
121  }
123  return deltaCoeffs_();
124 }
125 
126 
129 {
130  if (!nonOrthDeltaCoeffs_)
131  {
132  nonOrthDeltaCoeffs_.reset(geometry().nonOrthDeltaCoeffs().ptr());
133  }
135  return nonOrthDeltaCoeffs_();
136 }
137 
138 
141 {
142  if (!nonOrthCorrectionVectors_)
143  {
144  nonOrthCorrectionVectors_.reset
145  (
146  geometry().nonOrthCorrectionVectors().ptr()
147  );
148  }
149 
150  return nonOrthCorrectionVectors_();
151 }
152 
153 
155 {
156  if (debug)
157  {
158  Pout<< "surfaceInterpolation::movePoints() : "
159  << "Updating geometric properties using the fvGeometryScheme"
160  << endl;
161  }
162 
163  // Do any primitive geometry calculation
164  const_cast<fvGeometryScheme&>(geometry()).movePoints();
165 
166  clearOut();
167 
168  return true;
169 }
170 
171 
173 {
174  if (debug)
175  {
176  Pout<< "surfaceInterpolation::updateGeom() : "
177  << "Updating geometric properties" << endl;
178  }
179 
180  const_cast<fvGeometryScheme&>(geometry()).movePoints();
181 
182  clearOut();
183 }
184 
185 
187 {
188  if (debug)
189  {
190  Pout<< "surfaceInterpolation::updateMesh() : "
191  << "Updating geometric properties" << endl;
192  }
193 
194  const_cast<fvGeometryScheme&>(geometry()).updateMesh(mpm);
195 
196  clearOut();
197 }
198 
199 
200 // ************************************************************************* //
Foam::surfaceFields.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
virtual bool movePoints()
Do what is necessary if the mesh has moved.
Cell to surface interpolation scheme. Included in fvMesh.
virtual const surfaceVectorField & nonOrthCorrectionVectors() const
Return reference to non-orthogonality correction vectors.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:157
virtual const surfaceScalarField & nonOrthDeltaCoeffs() const
Return reference to non-orthogonal cell-centre difference.
virtual const surfaceScalarField & weights() const
Return reference to linear difference weighting factors.
virtual void updateGeom()
Update all geometric data.
virtual void updateMesh(const mapPolyMesh &mpm)
Update mesh for topology changes.
surfaceInterpolation(const fvMesh &)
Construct given an fvMesh.
static tmp< fvGeometryScheme > New(const fvMesh &mesh, const dictionary &dict, const word &defaultScheme)
Return new tmp interpolation scheme.
virtual ~surfaceInterpolation()
Destructor.
int debug
Static debugging option.
defineTypeNameAndDebug(combustionModel, 0)
void clearOut()
Clear all geometry and addressing.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
virtual const fvGeometryScheme & geometry() const
Return reference to geometry calculation scheme.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
virtual const surfaceScalarField & deltaCoeffs() const
Return reference to cell-centre difference coefficients.
Abstract base class for geometry calculation schemes.
Namespace for OpenFOAM.