Remove trailing whitespace systematically
[foam-extend-3.2.git] / applications / solvers / solidMechanics / icoFsiElasticNonLinULSolidFoam / createZoneToZoneInterpolators.H
blobfa666a5b914d07d9da095d0a0ed17512c90ca6ae
2 zoneToZoneInterpolation* interpolatorFluidSolidPtr = NULL;
3 zoneToZoneInterpolation* interpolatorSolidFluidPtr = NULL;
6 if(!interpolatorFluidSolidPtr || !interpolatorSolidFluidPtr)
8     deleteDemandDrivenData(interpolatorFluidSolidPtr);
9     deleteDemandDrivenData(interpolatorSolidFluidPtr);
11     Info << "Create fluid-to-solid and solid-to-fluid interpolators" << endl;
13     interpolatorFluidSolidPtr = new zoneToZoneInterpolation
14     (
15         mesh.faceZones()[fluidZoneID](),
16         stressMesh.faceZones()[solidZoneID](),
17         intersection::VISIBLE
18     );
20     interpolatorSolidFluidPtr = new zoneToZoneInterpolation
21     (
22         stressMesh.faceZones()[solidZoneID](),
23         mesh.faceZones()[fluidZoneID](),
24         intersection::VISIBLE
25     );
27     Info << "Check fluid-to-solid and solid-to-fluid interpolators" << endl;
29     {
30         vectorField fluidPatchFaceCentres =
31             vectorField(mesh.boundaryMesh()[fluidPatchID].faceCentres());
33         vectorField fluidZoneFaceCentres
34         (
35             mesh.faceZones()[fluidZoneID].size(),
36             vector::zero
37         );
40         const label fluidPatchStart =
41             mesh.boundaryMesh()[fluidPatchID].start();
43         forAll (fluidPatchFaceCentres, i)
44         {
45             fluidZoneFaceCentres
46             [
47                 mesh.faceZones()[fluidZoneID].whichFace(fluidPatchStart + i)
48             ] =
49                 fluidPatchFaceCentres[i];
50         }
52         // Parallel data exchange: collect faceCentres field on all processors
53         reduce(fluidZoneFaceCentres, sumOp<vectorField>());
55         vectorField solidZoneFaceCentres =
56             interpolatorFluidSolidPtr->faceInterpolate
57             (
58                 fluidZoneFaceCentres
59             );
61         vectorField solidPatchFaceCentres
62             (
63                 stressMesh.boundaryMesh()[solidPatchID].size(),
64                 vector::zero
65             );
67         const label solidPatchStart =
68             stressMesh.boundaryMesh()[solidPatchID].start();
70         forAll(solidPatchFaceCentres, i)
71         {
72             solidPatchFaceCentres[i] =
73                 solidZoneFaceCentres
74                 [
75                     stressMesh.faceZones()[solidZoneID]
76                    .whichFace(solidPatchStart + i)
77                 ];
78         }
80         scalar maxDist = gMax
81         (
82             mag
83             (
84                 solidPatchFaceCentres
85               - stressMesh.boundaryMesh()[solidPatchID].faceCentres()
86             )
87         );
89         Info << "Fluid-to-solid face interpolation error: " << maxDist
90             << endl;
91     }
95     {
96         vectorField solidPatchFaceCentres =
97             vectorField(stressMesh.boundaryMesh()[solidPatchID].faceCentres());
99         vectorField solidZoneFaceCentres
100         (
101             stressMesh.faceZones()[solidZoneID].size(),
102             vector::zero
103         );
105         const label solidPatchStart =
106             stressMesh.boundaryMesh()[solidPatchID].start();
108         forAll (solidPatchFaceCentres, i)
109         {
110             solidZoneFaceCentres
111             [
112                 stressMesh.faceZones()[solidZoneID]
113                .whichFace(solidPatchStart + i)
114             ] =
115                 solidPatchFaceCentres[i];
116         }
118         // Parallel data exchange: collect faceCentres field on all processors
119         reduce(solidZoneFaceCentres, sumOp<vectorField>());
121         vectorField fluidZoneFaceCentres =
122             interpolatorSolidFluidPtr->faceInterpolate
123             (
124                 solidZoneFaceCentres
125             );
127         vectorField fluidPatchFaceCentres
128         (
129             mesh.boundaryMesh()[fluidPatchID].size(),
130             vector::zero
131         );
133         const label fluidPatchStart =
134             mesh.boundaryMesh()[fluidPatchID].start();
136         forAll(fluidPatchFaceCentres, i)
137         {
138             fluidPatchFaceCentres[i] =
139                 fluidZoneFaceCentres
140                 [
141                     mesh.faceZones()[fluidZoneID]
142                    .whichFace(fluidPatchStart + i)
143                 ];
144         }
146         scalar maxDist = gMax
147         (
148             mag
149             (
150                 fluidPatchFaceCentres
151               - mesh.boundaryMesh()[fluidPatchID].faceCentres()
152             )
153         );
155         Info << "Solid-to-fluid face interpolation error: " << maxDist
156             << endl;
157     }
160 zoneToZoneInterpolation& interpolatorFluidSolid =
161     *interpolatorFluidSolidPtr;
163 zoneToZoneInterpolation& interpolatorSolidFluid =
164     *interpolatorSolidFluidPtr;