nearWallDist.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
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 "nearWallDist.H"
27 #include "fvPatchDistWave.H"
28 #include "wallPolyPatch.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34  defineTypeNameAndDebug(nearWallDist, 0);
35 }
36 
37 
38 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
39 
40 void Foam::nearWallDist::resize()
41 {
42  y_.setSize(mesh().boundary().size());
43 
44  forAll(y_, patchi)
45  {
46  y_.set
47  (
48  patchi,
50  (
51  calculatedFvPatchScalarField::typeName,
52  mesh().boundary()[patchi],
54  )
55  );
56  }
57 }
58 
59 
60 void Foam::nearWallDist::correct()
61 {
63 
65  (
66  mesh(),
67  mesh().boundaryMesh().findPatchIDs<wallPolyPatch>(),
68  -vGreat,
69  2,
70  yVf
71  );
72 
73  forAll(y_, patchi)
74  {
75  const labelUList& faceCells = mesh().boundary()[patchi].faceCells();
76  forAll(y_[patchi], patchFacei)
77  {
78  y_[patchi][patchFacei] = yVf[faceCells[patchFacei]];
79  }
80  }
81 }
82 
83 
84 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
85 
87 :
89  y_
90  (
91  mesh.boundary(),
92  volScalarField::Internal::null(),
93  calculatedFvPatchScalarField::typeName
94  )
95 {
96  correct();
97 }
98 
99 
100 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
101 
103 {}
104 
105 
106 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
107 
109 {
110  resize();
111 
112  correct();
113  return true;
114 }
115 
116 
118 {
119  resize();
120  correct();
121 }
122 
123 
125 {
126  resize();
127  correct();
128 }
129 
130 
132 {
133  resize();
134  correct();
135 }
136 
137 
138 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
static tmp< GeometricField< scalar, fvPatchField, volMesh > > New(const word &name, const Internal &, const PtrList< fvPatchField< scalar >> &)
Return a temporary field constructed from name,.
void correct(const fvMesh &mesh, const labelHashSet &patchIDs, const scalar minFaceFraction, const label nCorrections, GeometricField< scalar, PatchField, GeoMesh > &distance)
Correct distance data from patches.
virtual bool movePoints()
Update the y-field when the mesh moves.
Definition: nearWallDist.C:108
fvMesh & mesh
UList< label > labelUList
Definition: UList.H:65
const dimensionSet dimLength
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:58
Templated abstract base-class for optional mesh objects used to automate their allocation to the mesh...
Definition: MeshObject.H:87
static const DimensionedField< Type, GeoMesh > & null()
Return a null DimensionedField.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
static tmp< fvPatchField< Type > > New(const word &, const fvPatch &, const DimensionedField< Type, volMesh > &)
Return a pointer to a new patchField created on freestore given.
Distance calculation for cells with face on a wall. Searches pointNeighbours to find closest...
Definition: nearWallDist.H:52
faceListList boundary(nPatches)
virtual ~nearWallDist()
Destructor.
Definition: nearWallDist.C:102
virtual void topoChange(const polyTopoChangeMap &)
Update the y-field when the mesh changes.
Definition: nearWallDist.C:117
defineTypeNameAndDebug(combustionModel, 0)
label patchi
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
Definition: nearWallDist.C:124
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:95
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:50
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
Definition: nearWallDist.C:131
Namespace for OpenFOAM.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
Definition: fvMesh.C:800
nearWallDist(const fvMesh &mesh)
Construct from components.
Definition: nearWallDist.C:86