1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "wallDistData.H"
28 #include "patchDataWave.H"
29 #include "wallPolyPatch.H"
30 #include "emptyFvPatchFields.H"
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 // Construct from components
35 template<class TransferType>
36 Foam::wallDistData<TransferType>::wallDistData
38 const Foam::fvMesh& mesh,
39 GeometricField<Type, fvPatchField, volMesh>& field,
40 const bool correctWalls
48 mesh.time().timeName(),
52 dimensionedScalar("y", dimLength, GREAT)
56 correctWalls_(correctWalls),
63 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
65 template<class TransferType>
66 Foam::wallDistData<TransferType>::~wallDistData()
70 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
72 // Correct for mesh geom/topo changes
73 template<class TransferType>
74 void Foam::wallDistData<TransferType>::correct()
76 Info<< "wallDistData.correct() called" << endl;
77 const polyMesh& mesh = cellDistFuncs::mesh();
80 // Fill data on wall patches with initial values
83 const polyBoundaryMesh& bMesh = mesh.boundaryMesh();
84 labelHashSet wallPatchIDs(bMesh.size());
87 if (bMesh[patchI].isWall())
89 wallPatchIDs.insert(patchI);
93 // Get patchids of walls
94 // labelHashSet wallPatchIDs(getPatchIDs<wallPolyPatch>());
96 // Collect pointers to data on patches
97 UPtrList<Field<Type> > patchData(mesh.boundaryMesh().size());
99 forAll(field_.boundaryField(), patchI)
101 patchData.set(patchI, &field_.boundaryField()[patchI]);
105 patchDataWave<TransferType> wave
113 // Transfer cell values from wave into *this and field_
114 transfer(wave.distance());
116 field_.transfer(wave.cellData());
118 // Transfer values on patches into boundaryField of *this and field_
119 forAll(boundaryField(), patchI)
121 scalarField& waveFld = wave.patchDistance()[patchI];
123 if (!isA<emptyFvPatchScalarField>(boundaryField()[patchI]))
125 boundaryField()[patchI].transfer(waveFld);
127 Field<Type>& wavePatchData = wave.patchData()[patchI];
129 field_.boundaryField()[patchI].transfer(wavePatchData);
133 // Transfer number of unset values
134 nUnset_ = wave.nUnset();
138 // ************************************************************************* //