1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
24 \*---------------------------------------------------------------------------*/
27 #include "patchWave.H"
29 #include "wallPolyPatch.H"
30 #include "fvPatchField.H"
32 #include "emptyFvPatchFields.H"
34 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
36 Foam::wallDist::wallDist(const fvMesh& mesh, const bool correctWalls)
43 mesh.time().timeName(),
47 dimensionedScalar("y", dimLength, GREAT)
50 correctWalls_(correctWalls),
57 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
59 Foam::wallDist::~wallDist()
63 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
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()
69 // Get patchids of walls
70 labelHashSet wallPatchIDs(getPatchIDs<wallPolyPatch>());
72 // Calculate distance starting from wallPatch faces.
73 patchWave wave(cellDistFuncs::mesh(), wallPatchIDs, correctWalls_);
75 // Transfer cell values from wave into *this
76 transfer(wave.distance());
78 // Transfer values on patches into boundaryField of *this
79 forAll(boundaryField(), patchI)
81 if (!isA<emptyFvPatchScalarField>(boundaryField()[patchI]))
83 scalarField& waveFld = wave.patchDistance()[patchI];
85 boundaryField()[patchI].transfer(waveFld);
89 // Transfer number of unset values
90 nUnset_ = wave.nUnset();
94 // ************************************************************************* //