Merge remote-tracking branch 'origin/nr/multiSolverFix' into nextRelease
[foam-extend-3.2.git] / src / sampling / include / mapPatch.H
blob76d1231c21ff60fdf5fad2d08fa12e02bee822eb
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;
7         scalarField planek(cutCells.size());
8         scalarField planeNuTilda(cutCells.size());
9         vectorField planeU(cutCells.size());
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         }
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         }
37         U.boundaryField()[targetPatchNumber] ==
38             interPatch.faceInterpolate(planeU)();
40 /*         sgsModel.k()().boundaryField()[targetPatchNumber] ==
41          toPatchInter.pointToFaceInterpolate
42          (
43              interPatch.pointInterpolate
44              (
45                  planePatchInter.faceToPointInterpolate
46                  (
47                      planek
48                  )
49              )
50          );
52          U.boundaryField()[targetPatchNumber] ==
53          toPatchInter.pointToFaceInterpolate
54          (
55              interPatch.pointInterpolate
56              (
57                  planePatchInter.faceToPointInterpolate
58                  (
59                      planeU
60                  )
61              )
62          );
66         scalar Q = sum
67         (
68             mesh.Sf().boundaryField()[targetPatchNumber]
69             & U.boundaryField()[targetPatchNumber]
70         );
72         scalar Qbar = sum
73         (
74             mesh.Sf().boundaryField()[targetPatchNumber] &
75             Ubar.value()
76         );
78         U.boundaryField()[targetPatchNumber] ==
79             U.boundaryField()[targetPatchNumber] * (Qbar/Q);
81         Info << "Mass flux correction factor: " << (Qbar/Q) << endl;
83         phi.boundaryField()[targetPatchNumber] ==
84         (
85             mesh.Sf().boundaryField()[targetPatchNumber] &
86             U.boundaryField()[targetPatchNumber]
87         );
88     }