wallDistData.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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2018 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
29#include "wallDistData.H"
30#include "patchDataWave.H"
31#include "wallPolyPatch.H"
32#include "emptyFvPatchFields.H"
33
34// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
35
36template<class TransferType>
38(
39 const Foam::fvMesh& mesh,
41 const bool correctWalls
42)
43:
45 (
47 (
48 "y",
49 mesh.time().timeName(),
50 mesh
51 ),
52 mesh,
53 dimensionedScalar("y", dimLength, GREAT)
54 ),
56 field_(field),
57 correctWalls_(correctWalls),
58 nUnset_(0)
59{
60 correct();
61}
62
63
64// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
65
66template<class TransferType>
68{}
69
70
71// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
72
73template<class TransferType>
75{
77
78 //
79 // Fill data on wall patches with initial values
80 //
81
82 // Get patchids of walls
83 labelHashSet wallPatchIDs(getPatchIDs<wallPolyPatch>());
84
85 // Collect pointers to data on patches
87
89 Boundary& fieldBf = field_.boundaryFieldRef();
90
91 forAll(fieldBf, patchi)
92 {
93 patchData.set(patchi, &fieldBf[patchi]);
94 }
95
96 // Do mesh wave
98 (
99 mesh,
100 wallPatchIDs,
101 patchData,
102 correctWalls_
103 );
104
105 // Transfer cell values from wave into *this and field_
106 transfer(wave.distance());
107
108 field_.transfer(wave.cellData());
109
110 volScalarField::Boundary& bf = boundaryFieldRef();
111
112 // Transfer values on patches into boundaryField of *this and field_
113 forAll(bf, patchi)
114 {
115 scalarField& waveFld = wave.patchDistance()[patchi];
116
117 if (!isA<emptyFvPatchScalarField>(bf[patchi]))
118 {
119 bf[patchi].transfer(waveFld);
120 Field<Type>& wavePatchData = wave.patchData()[patchi];
121 fieldBf[patchi].transfer(wavePatchData);
122 }
123 }
124
125 // Transfer number of unset values
126 nUnset_ = wave.nUnset();
127}
128
129
130// ************************************************************************* //
Generic GeometricField class.
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
void transfer(List< T > &list)
Definition: List.C:447
void transfer(PtrList< T > &list)
Transfer into this list and annul the argument list.
Definition: PtrListI.H:269
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Definition: UPtrList.H:71
const T * set(const label i) const
Definition: UPtrList.H:248
label size() const noexcept
The number of elements in the list.
Definition: UPtrListI.H:106
Collection of functions used in wall distance calculation.
Definition: cellDistFuncs.H:64
const polyMesh & mesh() const
Access mesh.
Definition: cellDistFuncs.H:92
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
Takes a set of patches to start MeshWave from.
Definition: patchDataWave.H:69
const FieldField< Field, scalar > & patchDistance() const
const Field< Type > & cellData() const
label nUnset() const
const FieldField< Field, Type > & patchData() const
const scalarField & distance() const
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Definition: polyMesh.H:456
Wall distance calculation. Like wallDist but also transports extra data (template argument).
Definition: wallDistData.H:63
virtual void correct()
Correct for mesh geom/topo changes.
Definition: wallDistData.C:74
virtual ~wallDistData()
Destructor.
Definition: wallDistData.C:67
rDeltaTY field()
dynamicFvMesh & mesh
word timeName
Definition: getTimeIndex.H:3
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:52
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333