initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / sampling / include / mapPatch.H
blobaabec554a8d904fb599f71d3ca2e69acbf0ef540
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         }
36         
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          );
65           
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         );
77                 
78         U.boundaryField()[targetPatchNumber] ==
79             U.boundaryField()[targetPatchNumber] * (Qbar/Q);
80         
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     }