interrogateWallPatches.H
Go to the documentation of this file.
1 // Search for wall patches faces and store normals
2 
3 label faceId(-1);
4 label patchId(-1);
7 
8 const fvPatchList& patches = mesh.boundary();
9 
10 forAll(patches, patchi)
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 
55 if (nWallFaces == 0)
56 {
58  << exit(FatalError);
59 }
60 else
61 {
62  Info<< "Generating wall data for patch: " << patches[patchId].name()
63  << endl;
64 }
65 
66 // store local id of near-walll cell to process
67 label cellId = patches[patchId].faceCells()[faceId];
68 
69 // create position array for graph generation
71 (
73  & (mesh.C().primitiveField() - mesh.C().boundaryField()[patchId][faceId])
74 );
75 
76 Info<< " Height to first cell centre y0 = " << y[cellId] << endl;
const fvPatchList & patches
label patchId(-1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
label faceId(-1)
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
error FatalError
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:253
volVectorField vectorField(fieldObject, mesh)
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:49
scalarField y(wallNormal &(mesh.C().primitiveField()-mesh.C().boundaryField()[patchId][faceId]))
dynamicFvMesh & mesh
static const zero Zero
Definition: zero.H:91
volScalarField scalarField(fieldObject, mesh)
static const char nl
Definition: Ostream.H:262
label nWallFaces(0)
PtrList< fvPatch > fvPatchList
container classes for fvPatch
Definition: fvPatchList.H:45
label patchi
label cellId
messageStream Info
dimensioned< scalar > mag(const dimensioned< Type > &)
vector wallNormal(Zero)
forAll(patches, patchi)