1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
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 \*---------------------------------------------------------------------------*/
26 #include "nearWallDistNoSearch.H"
28 #include "wallFvPatch.H"
29 #include "surfaceFields.H"
31 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
33 void Foam::nearWallDistNoSearch::doAll()
35 const volVectorField& cellCentres = mesh_.C();
36 const fvPatchList& patches = mesh_.boundary();
38 forAll(patches, patchI)
40 fvPatchScalarField& ypatch = operator[](patchI);
42 if (isA<wallFvPatch>(patches[patchI]))
44 const labelUList& faceCells = patches[patchI].faceCells();
46 const fvPatchVectorField& patchCentres
47 = cellCentres.boundaryField()[patchI];
49 const fvsPatchVectorField& Apatch
50 = mesh_.Sf().boundaryField()[patchI];
52 const fvsPatchScalarField& magApatch
53 = mesh_.magSf().boundaryField()[patchI];
55 forAll(patchCentres, facei)
62 - cellCentres[faceCells[facei]]
75 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
77 Foam::nearWallDistNoSearch::nearWallDistNoSearch(const Foam::fvMesh& mesh)
79 volScalarField::GeometricBoundaryField
82 mesh.V(), // Dummy internal field
83 calculatedFvPatchScalarField::typeName
91 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
93 Foam::nearWallDistNoSearch::~nearWallDistNoSearch()
97 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
99 void Foam::nearWallDistNoSearch::correct()
101 if (mesh_.changing())
103 // Update size of GeometricBoundaryField
104 forAll(mesh_.boundary(), patchI)
106 operator[](patchI).setSize(mesh_.boundary()[patchI].size());
114 // ************************************************************************* //