Home
Downloads
Documentation
Installation
User Guide
man-pages
API Documentation
README
Release Notes
Changes
License
Support
SourceForge Project
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
finiteVolume
fvMesh
wallDist
wallDist.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-2010 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
13
the Free Software Foundation, either version 3 of the License, or
14
(at your 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, see <http://www.gnu.org/licenses/>.
23
24
\*---------------------------------------------------------------------------*/
25
26
#include "
wallDist.H
"
27
#include <
meshTools/patchWave.H
>
28
#include <
finiteVolume/fvMesh.H
>
29
#include <
OpenFOAM/wallPolyPatch.H
>
30
#include <
finiteVolume/fvPatchField.H
>
31
#include <
OpenFOAM/Field.H
>
32
#include <
finiteVolume/emptyFvPatchFields.H
>
33
34
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
35
36
Foam::wallDist::wallDist(
const
fvMesh
&
mesh
,
const
bool
correctWalls)
37
:
38
volScalarField
39
(
40
IOobject
41
(
42
"y"
,
43
mesh.time().
timeName
(),
44
mesh
45
),
46
mesh,
47
dimensionedScalar
(
"y"
,
dimLength
, GREAT)
48
),
49
cellDistFuncs
(mesh),
50
correctWalls_(correctWalls),
51
nUnset_(0)
52
{
53
wallDist::correct
();
54
}
55
56
57
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
58
59
Foam::wallDist::~wallDist
()
60
{}
61
62
63
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
64
65
// Correct for mesh geom/topo changes. Might be more intelligent in the
66
// future (if only small topology change)
67
void
Foam::wallDist::correct
()
68
{
69
// Get patchids of walls
70
labelHashSet
wallPatchIDs(getPatchIDs<wallPolyPatch>());
71
72
// Calculate distance starting from wallPatch faces.
73
patchWave
wave(
cellDistFuncs::mesh
(), wallPatchIDs, correctWalls_);
74
75
// Transfer cell values from wave into *this
76
transfer(wave.
distance
());
77
78
// Transfer values on patches into boundaryField of *this
79
forAll
(
boundaryField
(), patchI)
80
{
81
if
(!isA<emptyFvPatchScalarField>(
boundaryField
()[patchI]))
82
{
83
scalarField
& waveFld = wave.
patchDistance
()[patchI];
84
85
boundaryField
()[patchI].transfer(waveFld);
86
}
87
}
88
89
// Transfer number of unset values
90
nUnset_ = wave.
nUnset
();
91
}
92
93
94
// ************************ vim: set sw=4 sts=4 et: ************************ //