interrogateWallPatches.H
Go to the documentation of this file.
1// Search for wall patches faces and store normals
2
3label faceId(-1);
4label patchId(-1);
5label nWallFaces(0);
7
8const fvPatchList& patches = mesh.boundary();
9
11{
12 const fvPatch& currPatch = patches[patchi];
13
14 if (isA<wallFvPatch>(currPatch))
15 {
16 const vectorField nf(currPatch.nf());
17
18 forAll(nf, facei)
19 {
20 nWallFaces++;
21
22 if (nWallFaces == 1)
23 {
24 wallNormal = -nf[facei];
25 faceId = facei;
26 patchId = patchi;
27 }
28 else if (nWallFaces == 2)
29 {
30 const vector wallNormal2 = -nf[facei];
31
32 //- Check that wall faces are parallel
33 if
34 (
35 mag(wallNormal & wallNormal2) > 1.01
36 || mag(wallNormal & wallNormal2) < 0.99
37 )
38 {
40 << "wall faces are not parallel for patches "
41 << patches[patchId].name() << " and "
42 << currPatch.name() << nl
43 << exit(FatalError);
44 }
45 }
46 else
47 {
49 << nl << exit(FatalError);
50 }
51 }
52 }
53}
54
55if (nWallFaces == 0)
56{
58 << exit(FatalError);
59}
60else
61{
62 Info<< "Generating wall data for patch: " << patches[patchId].name()
63 << endl;
64}
65
66// store local id of near-wall cell to process
67label cellId = patches[patchId].faceCells()[faceId];
68
69// create position array for graph generation
70scalarField y
71(
73 & (mesh.C().primitiveField() - mesh.C().boundaryField()[patchId][faceId])
74);
75
76Info<< " Height to first cell centre y0 = " << y[cellId] << endl;
scalar y
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
dynamicFvMesh & mesh
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
vector wallNormal(Zero)
label cellId
label patchId(-1)
const fvPatchList & patches
label nWallFaces(0)
label faceId(-1)
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333