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);
5 label nWallFaces(0);
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-wall 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;
forAll
forAll(patches, patchi)
Definition: interrogateWallPatches.H:10
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:52
nWallFaces
label nWallFaces(0)
y
scalarField y(wallNormal &(mesh.C().primitiveField() - mesh.C().boundaryField()[patchId][faceId]))
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
patches
const fvPatchList & patches
Definition: interrogateWallPatches.H:8
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
Foam::vectorField
Field< vector > vectorField
Specialisation of Field<T> for vector.
Definition: primitiveFieldsFwd.H:54
Foam::fvPatchList
PtrList< fvPatch > fvPatchList
container classes for fvPatch
Definition: fvPatchList.H:47
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
faceId
label faceId(-1)
Foam::FatalError
error FatalError
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::vector
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:51
cellId
label cellId
Definition: interrogateWallPatches.H:67
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Foam::nl
constexpr char nl
Definition: Ostream.H:404
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
patchId
label patchId(-1)
wallNormal
vector wallNormal(Zero)