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  ),
51  cellDistFuncs(mesh),
52  correctWalls_(correctWalls),
53  nUnset_(0)
54 {
55  groundDist::correct(patchIDs);
56 }
57 
58 
59 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
60 
62 {}
63 
64 
65 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
66 
67 // Correct for mesh geom/topo changes. Might be more intelligent in the
68 // future (if only small topology change)
70 {
71  // Get patchids of walls
72  //labelHashSet wallPatchIDs(getPatchIDs(wallPolyPatch::typeName));
73 
74  // Calculate distance starting from wallPatch faces.
75  patchWave wave(cellDistFuncs::mesh(), patchIDs, correctWalls_);
76 
77  // Transfer cell values from wave into *this
78  transfer(wave.distance());
79 
80  // Transfer values on patches into boundaryField of *this
81  forAll(boundaryField(), patchI)
82  {
83  if (boundaryField()[patchI].type() != emptyFvPatchScalarField::typeName)
84  {
85  scalarField& waveFld = wave.patchDistance()[patchI];
86 
87  //boundaryFieldRef()[patchI].transfer(waveFld);
88  boundaryField()[patchI].transfer(waveFld);
89  }
90  }
91 
92  // Transfer number of unset values
93  nUnset_ = wave.nUnset();
94 }
95 
96 
97 // ************************************************************************* //
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:48
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
wallPolyPatch.H
groundDist.H
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
Field.H
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:41
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
emptyFvPatchFields.H
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
boundaryField
cellIbMask *cellIbMaskExt *faceIbMask *cellIbMask boundaryField().evaluateCoupled()
fvMesh.H
Foam::cellDistFuncs::mesh
const polyMesh & mesh() const
Access mesh.
Definition: cellDistFuncs.H:95
patchWave.H
timeName
word timeName
Definition: getTimeIndex.H:3
Foam::type
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:588
Foam::labelHashSet
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
Definition: HashSet.H:210
Foam::groundDist::groundDist
groundDist(const groundDist &)
Disallow default bitwise copy construct.
fvPatchField.H