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-2020 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 {
43  defineTypeNameAndDebug(surfaceInterpolation, 0);
44 }
45 
46 
47 // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
48 
50 {
51  weights_.clear();
52  deltaCoeffs_.clear();
53  nonOrthDeltaCoeffs_.clear();
54  nonOrthCorrectionVectors_.clear();
55 }
56 
57 
58 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
59 
61 :
62  mesh_(fvm),
63  weights_(nullptr),
64  deltaCoeffs_(nullptr),
65  nonOrthDeltaCoeffs_(nullptr),
66  nonOrthCorrectionVectors_(nullptr)
67 {}
68 
69 
70 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
71 
73 {
74  clearOut();
75 }
76 
77 
78 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
79 
81 {
82  if (!geometryPtr_.valid())
83  {
84  geometryPtr_ = fvGeometryScheme::New
85  (
86  mesh_,
87  mesh_.schemesDict().subOrEmptyDict("geometry"),
88  basicFvGeometryScheme::typeName
89  );
90  }
91 
92  return geometryPtr_();
93 }
94 
95 
97 {
98  geometryPtr_ = schemePtr;
99 }
100 
101 
103 {
104  if (!weights_.valid())
105  {
106  weights_.set(geometry().weights().ptr());
107  }
108 
109  return weights_();
110 }
111 
112 
114 {
115  if (!deltaCoeffs_.valid())
116  {
117  deltaCoeffs_.set(geometry().deltaCoeffs().ptr());
118  }
119 
120  return deltaCoeffs_();
121 }
122 
123 
126 {
127  if (!nonOrthDeltaCoeffs_.valid())
128  {
129  nonOrthDeltaCoeffs_.set(geometry().nonOrthDeltaCoeffs().ptr());
130  }
131 
132  return nonOrthDeltaCoeffs_();
133 }
134 
135 
138 {
139  if (!nonOrthCorrectionVectors_.valid())
140  {
141  nonOrthCorrectionVectors_.set
142  (
143  geometry().nonOrthCorrectionVectors().ptr()
144  );
145  }
146 
147  return nonOrthCorrectionVectors_();
148 }
149 
150 
152 {
153  if (debug)
154  {
155  Pout<< "surfaceInterpolation::movePoints() : "
156  << "Updating geometric properties using the fvGeometryScheme"
157  << endl;
158  }
159 
160  // Do any primitive geometry calculation
161  const_cast<fvGeometryScheme&>(geometry()).movePoints();
162 
163  weights_.clear();
164  deltaCoeffs_.clear();
165  nonOrthDeltaCoeffs_.clear();
166  nonOrthCorrectionVectors_.clear();
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 
183 
184 // ************************************************************************* //
Foam::expressions::patchExpr::debug
int debug
Static debugging option.
Foam::surfaceInterpolation::clearOut
void clearOut()
Clear all geometry and addressing.
Definition: surfaceInterpolation.C:49
volFields.H
Foam::surfaceInterpolation::nonOrthDeltaCoeffs
virtual const surfaceScalarField & nonOrthDeltaCoeffs() const
Return reference to non-orthogonal cell-centre difference.
Definition: surfaceInterpolation.C:125
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::surfaceInterpolation::geometry
virtual const fvGeometryScheme & geometry() const
Return reference to geometry calculation scheme.
Definition: surfaceInterpolation.C:80
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
surfaceFields.H
Foam::surfaceFields.
Foam::Pout
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
Foam::surfaceInterpolation::deltaCoeffs
virtual const surfaceScalarField & deltaCoeffs() const
Return reference to cell-centre difference coefficients.
Definition: surfaceInterpolation.C:113
coupledFvPatch.H
Foam::fvGeometryScheme
Abstract base class for geometry calculation schemes.
Definition: fvGeometryScheme.H:56
Foam::surfaceInterpolation::movePoints
virtual bool movePoints()
Do what is necessary if the mesh has moved.
Definition: surfaceInterpolation.C:151
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
surfaceInterpolation.H
Foam::surfaceInterpolation::nonOrthCorrectionVectors
virtual const surfaceVectorField & nonOrthCorrectionVectors() const
Return reference to non-orthogonality correction vectors.
Definition: surfaceInterpolation.C:137
Foam::surfaceInterpolation::weights
virtual const surfaceScalarField & weights() const
Return reference to linear difference weighting factors.
Definition: surfaceInterpolation.C:102
Foam::surfaceInterpolation::updateGeom
virtual void updateGeom()
Update all geometric data.
Definition: surfaceInterpolation.C:172
Foam::surfaceInterpolation::surfaceInterpolation
surfaceInterpolation(const fvMesh &)
Construct given an fvMesh.
Definition: surfaceInterpolation.C:60
Foam::surfaceInterpolation::~surfaceInterpolation
virtual ~surfaceInterpolation()
Destructor.
Definition: surfaceInterpolation.C:72
Foam::fvGeometryScheme::New
static tmp< fvGeometryScheme > New(const fvMesh &mesh, const dictionary &dict, const word &defaultScheme)
Return new tmp interpolation scheme.
Definition: fvGeometryScheme.C:44
Foam::GeometricField< scalar, fvsPatchField, surfaceMesh >
basicFvGeometryScheme.H
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)