nearWallDist.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "nearWallDist.H"
00028 #include "fvMesh.H"
00029 #include "cellDistFuncs.H"
00030 #include "wallFvPatch.H"
00031 #include "surfaceFields.H"
00032
00033
00034
00035 void Foam::nearWallDist::doAll()
00036 {
00037 cellDistFuncs wallUtils(mesh_);
00038
00039
00040 labelHashSet wallPatchIDs
00041 (
00042 wallUtils.getPatchIDs
00043 (
00044 wallPolyPatch::typeName
00045 )
00046 );
00047
00048
00049
00050 labelList neighbours(wallUtils.maxPatchSize(wallPatchIDs));
00051
00052
00053
00054
00055 const volVectorField& cellCentres = mesh_.C();
00056
00057 forAll(mesh_.boundary(), patchI)
00058 {
00059 fvPatchScalarField& ypatch = operator[](patchI);
00060
00061 const fvPatch& patch = mesh_.boundary()[patchI];
00062
00063 if (patch.type() == wallFvPatch::typeName)
00064 {
00065 const polyPatch& pPatch = patch.patch();
00066
00067 const unallocLabelList& faceCells = patch.faceCells();
00068
00069
00070 forAll(patch, patchFaceI)
00071 {
00072 label nNeighbours = wallUtils.getPointNeighbours
00073 (
00074 pPatch,
00075 patchFaceI,
00076 neighbours
00077 );
00078
00079 label minFaceI = -1;
00080
00081 ypatch[patchFaceI] = wallUtils.smallestDist
00082 (
00083 cellCentres[faceCells[patchFaceI]],
00084 pPatch,
00085 nNeighbours,
00086 neighbours,
00087 minFaceI
00088 );
00089 }
00090 }
00091 else
00092 {
00093 ypatch = 0.0;
00094 }
00095 }
00096 }
00097
00098
00099
00100
00101 Foam::nearWallDist::nearWallDist(const Foam::fvMesh& mesh)
00102 :
00103 volScalarField::GeometricBoundaryField
00104 (
00105 mesh.boundary(),
00106 mesh.V(),
00107 calculatedFvPatchScalarField::typeName
00108 ),
00109 mesh_(mesh)
00110 {
00111 doAll();
00112 }
00113
00114
00115
00116
00117 Foam::nearWallDist::~nearWallDist()
00118 {}
00119
00120
00121
00122
00123 void Foam::nearWallDist::correct()
00124 {
00125 if (mesh_.changing())
00126 {
00127
00128 forAll(mesh_.boundary(), patchI)
00129 {
00130 operator[](patchI).setSize(mesh_.boundary()[patchI].size());
00131 }
00132 }
00133
00134 doAll();
00135 }
00136
00137
00138
Copyright © 2000-2009 OpenCFD Ltd