Fixed URL for libccmio-2.6.1 (bug report #5 by Thomas Oliveira)
[foam-extend-3.2.git] / applications / solvers / solidMechanics / icoFsiElasticNonLinULSolidFoam / setInterfaceForce.H
blob0e0941464f66034ce6568d76cdb4f9c566395dc0
2     Info << "Setting traction on solid patch" << endl;
4 //     vectorField fluidPatchTraction =
5 //        -rhoFluid.value()*nu.value()
6 //        *U.boundaryField()[fluidPatchID].snGrad()
7 //       + rhoFluid.value()*p.boundaryField()[fluidPatchID]
8 //        *mesh.boundary()[fluidPatchID].nf();
10     vectorField fluidPatchTraction =
11        -rhoFluid.value()*nu.value()
12        *U.boundaryField()[fluidPatchID].snGrad();
14     scalarField fluidPatchPressure =
15         rhoFluid.value()*p.boundaryField()[fluidPatchID];
17     vectorField fluidZoneTraction
18         (
19             mesh.faceZones()[fluidZoneID].size(),
20             vector::zero
21         );
23     const label fluidPatchStart =
24         mesh.boundaryMesh()[fluidPatchID].start();
26     forAll(fluidPatchTraction, i)
27     {
28         fluidZoneTraction
29         [
30             mesh.faceZones()[fluidZoneID].whichFace(fluidPatchStart + i)
31         ] =
32             fluidPatchTraction[i];
33     }
35     // Parallel data exchange: collect pressure field on all processors
36     reduce(fluidZoneTraction, sumOp<vectorField>());
39     scalarField fluidZonePressure
40         (
41             mesh.faceZones()[fluidZoneID].size(),
42             0.0
43         );
45     forAll(fluidPatchPressure, i)
46     {
47         fluidZonePressure
48         [
49             mesh.faceZones()[fluidZoneID].whichFace(fluidPatchStart + i)
50         ] =
51             fluidPatchPressure[i];
52     }
54     // Parallel data exchange: collect pressure field on all processors
55     reduce(fluidZonePressure, sumOp<scalarField>());
57     vectorField solidZoneTraction =
58         interpolatorFluidSolid.faceInterpolate
59         (
60             fluidZoneTraction
61         );
63     scalarField solidZonePressure =
64         interpolatorFluidSolid.faceInterpolate
65         (
66             fluidZonePressure
67         );
69     const label solidPatchStart =
70         stressMesh.boundaryMesh()[solidPatchID].start();
72     forAll(solidPatchTraction, i)
73     {
74         solidPatchTraction[i] =
75             solidZoneTraction
76             [
77                 stressMesh.faceZones()[solidZoneID]
78                .whichFace(solidPatchStart + i)
79             ];
80     }
82     forAll(solidPatchPressure, i)
83     {
84         solidPatchPressure[i] =
85             solidZonePressure
86             [
87                 stressMesh.faceZones()[solidZoneID]
88                .whichFace(solidPatchStart + i)
89             ];
90     }
92     if (fsi)
93     {
94         tForce.traction() = solidPatchTraction;
95         tForce.pressure() = solidPatchPressure;
96     }
98     vector totalTractionForce =
99         gSum
100         (
101             solidPatchTraction
102            *stressMesh.magSf().boundaryField()[solidPatchID]
103         );
105     Info << "Total traction force = "
106         << totalTractionForce << endl;