groundDist.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) 1991-2005 OpenCFD Ltd.
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 the
13  Free Software Foundation; either version 2 of the License, or (at your
14  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, write to the Free Software Foundation,
23  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 
25 \*---------------------------------------------------------------------------*/
26 
27 #include "groundDist.H"
28 #include "patchWave.H"
29 #include "fvMesh.H"
30 #include "wallPolyPatch.H"
31 #include "fvPatchField.H"
32 #include "Field.H"
33 #include "emptyFvPatchFields.H"
34 
35 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
36 
37 // Construct from components
38 Foam::groundDist::groundDist(const fvMesh& mesh, labelHashSet patchIDs, const bool correctWalls)
39 :
41  (
42  IOobject
43  (
44  "y",
45  mesh.time().timeName(),
46  mesh
47  ),
48  mesh,
49  dimensionedScalar("y", dimLength, GREAT)
50  ),
52  correctWalls_(correctWalls),
53  nUnset_(0)
54 {
55  Info << "construct class groundDist" << endl;
56  groundDist::correct(patchIDs);
57 }
58 
59 
60 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
61 
63 {}
64 
65 
66 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
67 
68 // Correct for mesh geom/topo changes. Might be more intelligent in the
69 // future (if only small topology change)
71 {
72  Info << "groundDist correct()" << endl;
73  // Get patchids of walls
74  //labelHashSet wallPatchIDs(getPatchIDs(wallPolyPatch::typeName));
75 
76  // Calculate distance starting from wallPatch faces.
77  patchWave wave(cellDistFuncs::mesh(), patchIDs, correctWalls_);
78 
79  // Transfer cell values from wave into *this
80  transfer(wave.distance());
81 
82  // Transfer values on patches into boundaryField of *this
83  forAll(boundaryField(), patchI)
84  {
85  if (boundaryField()[patchI].type() != emptyFvPatchScalarField::typeName)
86  {
87  scalarField& waveFld = wave.patchDistance()[patchI];
88 
89  //boundaryFieldRef()[patchI].transfer(waveFld);
90  boundaryField()[patchI].transfer(waveFld);
91  }
92  }
93 
94  // Transfer number of unset values
95  nUnset_ = wave.nUnset();
96 }
97 
98 
99 // ************************************************************************* //
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Foam::dimLength
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:50
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
groundDist.H
wallPolyPatch.H
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::HashSet< label, Hash< label > >
Foam::groundDist::~groundDist
virtual ~groundDist()
Definition: groundDist.C:61
Foam::groundDist::correct
virtual void correct(labelHashSet patchIDs)
Correct for mesh geom/topo changes.
Definition: groundDist.C:69
Foam::patchWave
Takes a set of patches to start MeshWave from. After construction holds distance at cells and distanc...
Definition: patchWave.H:56
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::Info
messageStream Info
Field.H
emptyFvPatchFields.H
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
boundaryField
cellIbMask *cellIbMaskExt *faceIbMask *cellIbMask boundaryField().evaluateCoupled()
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:41
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
fvMesh.H
Foam::cellDistFuncs::mesh
const polyMesh & mesh() const
Access mesh.
Definition: cellDistFuncs.H:95
Foam::patchWave::patchDistance
const FieldField< Field, scalar > & patchDistance() const
Definition: patchWave.H:136
Foam::cellDistFuncs
Collection of functions used in wall distance calculation.
Definition: cellDistFuncs.H:61
patchWave.H
Foam::patchWave::distance
const scalarField & distance() const
Definition: patchWave.H:125
timeName
word timeName
Definition: getTimeIndex.H:3
Foam::patchWave::nUnset
label nUnset() const
Definition: patchWave.H:120
Foam::type
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:588
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::groundDist::groundDist
groundDist(const groundDist &)
Disallow default bitwise copy construct.
fvPatchField.H