FreeFOAM The Cross-Platform CFD Toolkit
mapPatch.H
Go to the documentation of this file.
1  if(planeMapping && targetPatchNamePresent && cut.cut())
2  {
3  //Map variables U, phi & k
4  //Info << typeInfo("isoLESmodel") << endl;
5  //Info << "SGS model" << sgsModel.type() << endl;
6 
7  scalarField planek(cutCells.size());
8  scalarField planeNuTilda(cutCells.size());
9  vectorField planeU(cutCells.size());
10 
11  forAll(cutCells, cCellsI)
12  {
13  if(sgsModel.type() == "SpalartAllmaras")
14  {
15  planeNuTilda[cCellsI] = sgsModel.nuTilda()()[cutCells[cCellsI]];
16  }
17  else
18  {
19  planek[cCellsI] = sgsModel.k()()[cutCells[cCellsI]];
20  }
21  planeU[cCellsI] = U[cutCells[cCellsI]];
22  }
23 
24  if(sgsModel.type() == "SpalartAllmaras")
25  {
26  Info << "Mapping NuTilda." << endl;
27  sgsModel.nuTilda()().boundaryField()[targetPatchNumber] ==
28  interPatch.faceInterpolate(planeNuTilda)();
29  }
30  else
31  {
32  Info << "Mapping k." << endl;
33  sgsModel.k()().boundaryField()[targetPatchNumber] ==
34  interPatch.faceInterpolate(planek)();
35  }
36 
37  U.boundaryField()[targetPatchNumber] ==
38  interPatch.faceInterpolate(planeU)();
39 
40 /* sgsModel.k()().boundaryField()[targetPatchNumber] ==
41  toPatchInter.pointToFaceInterpolate
42  (
43  interPatch.pointInterpolate
44  (
45  planePatchInter.faceToPointInterpolate
46  (
47  planek
48  )
49  )
50  );
51 
52  U.boundaryField()[targetPatchNumber] ==
53  toPatchInter.pointToFaceInterpolate
54  (
55  interPatch.pointInterpolate
56  (
57  planePatchInter.faceToPointInterpolate
58  (
59  planeU
60  )
61  )
62  );
63 
64 */
65 
66  scalar Q = sum
67  (
68  mesh.Sf().boundaryField()[targetPatchNumber]
69  & U.boundaryField()[targetPatchNumber]
70  );
71 
72  scalar Qbar = sum
73  (
74  mesh.Sf().boundaryField()[targetPatchNumber] &
75  Ubar.value()
76  );
77 
78  U.boundaryField()[targetPatchNumber] ==
79  U.boundaryField()[targetPatchNumber] * (Qbar/Q);
80 
81  Info << "Mass flux correction factor: " << (Qbar/Q) << endl;
82 
83  phi.boundaryField()[targetPatchNumber] ==
84  (
85  mesh.Sf().boundaryField()[targetPatchNumber] &
86  U.boundaryField()[targetPatchNumber]
87  );
88  }
89 
90 
91 
92 // ************************ vim: set sw=4 sts=4 et: ************************ //