This repository has been archived on 2023-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
foam-extend4.1-coherent-io/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/createZoneToZoneInterpolators.H

166 lines
4.4 KiB
C
Raw Normal View History

2012-09-11 15:42:55 +00:00
zoneToZoneInterpolation* interpolatorFluidSolidPtr = NULL;
zoneToZoneInterpolation* interpolatorSolidFluidPtr = NULL;
if(!interpolatorFluidSolidPtr || !interpolatorSolidFluidPtr)
{
deleteDemandDrivenData(interpolatorFluidSolidPtr);
deleteDemandDrivenData(interpolatorSolidFluidPtr);
Info << "Create fluid-to-solid and solid-to-fluid interpolators" << endl;
interpolatorFluidSolidPtr = new zoneToZoneInterpolation
(
mesh.faceZones()[fluidZoneID](),
stressMesh.faceZones()[solidZoneID](),
intersection::VISIBLE
);
interpolatorSolidFluidPtr = new zoneToZoneInterpolation
(
stressMesh.faceZones()[solidZoneID](),
mesh.faceZones()[fluidZoneID](),
intersection::VISIBLE
);
Info << "Check fluid-to-solid and solid-to-fluid interpolators" << endl;
{
vectorField fluidPatchFaceCentres =
2012-09-11 15:42:55 +00:00
vectorField(mesh.boundaryMesh()[fluidPatchID].faceCentres());
vectorField fluidZoneFaceCentres
(
mesh.faceZones()[fluidZoneID].size(),
2012-09-11 15:42:55 +00:00
vector::zero
);
const label fluidPatchStart =
2012-09-11 15:42:55 +00:00
mesh.boundaryMesh()[fluidPatchID].start();
forAll (fluidPatchFaceCentres, i)
{
fluidZoneFaceCentres
[
mesh.faceZones()[fluidZoneID].whichFace(fluidPatchStart + i)
] =
2012-09-11 15:42:55 +00:00
fluidPatchFaceCentres[i];
}
// Parallel data exchange: collect faceCentres field on all processors
reduce(fluidZoneFaceCentres, sumOp<vectorField>());
vectorField solidZoneFaceCentres =
interpolatorFluidSolidPtr->faceInterpolate
(
fluidZoneFaceCentres
);
vectorField solidPatchFaceCentres
(
stressMesh.boundaryMesh()[solidPatchID].size(),
2012-09-11 15:42:55 +00:00
vector::zero
);
const label solidPatchStart =
2012-09-11 15:42:55 +00:00
stressMesh.boundaryMesh()[solidPatchID].start();
forAll(solidPatchFaceCentres, i)
{
solidPatchFaceCentres[i] =
solidZoneFaceCentres
[
stressMesh.faceZones()[solidZoneID]
.whichFace(solidPatchStart + i)
];
}
scalar maxDist = gMax
(
mag
(
solidPatchFaceCentres
- stressMesh.boundaryMesh()[solidPatchID].faceCentres()
)
);
Info << "Fluid-to-solid face interpolation error: " << maxDist
2012-09-11 15:42:55 +00:00
<< endl;
}
{
vectorField solidPatchFaceCentres =
2012-09-11 15:42:55 +00:00
vectorField(stressMesh.boundaryMesh()[solidPatchID].faceCentres());
vectorField solidZoneFaceCentres
(
stressMesh.faceZones()[solidZoneID].size(),
2012-09-11 15:42:55 +00:00
vector::zero
);
const label solidPatchStart =
2012-09-11 15:42:55 +00:00
stressMesh.boundaryMesh()[solidPatchID].start();
forAll (solidPatchFaceCentres, i)
{
solidZoneFaceCentres
[
stressMesh.faceZones()[solidZoneID]
.whichFace(solidPatchStart + i)
] =
2012-09-11 15:42:55 +00:00
solidPatchFaceCentres[i];
}
// Parallel data exchange: collect faceCentres field on all processors
reduce(solidZoneFaceCentres, sumOp<vectorField>());
vectorField fluidZoneFaceCentres =
interpolatorSolidFluidPtr->faceInterpolate
(
solidZoneFaceCentres
);
vectorField fluidPatchFaceCentres
(
mesh.boundaryMesh()[fluidPatchID].size(),
2012-09-11 15:42:55 +00:00
vector::zero
);
const label fluidPatchStart =
2012-09-11 15:42:55 +00:00
mesh.boundaryMesh()[fluidPatchID].start();
forAll(fluidPatchFaceCentres, i)
{
fluidPatchFaceCentres[i] =
fluidZoneFaceCentres
[
mesh.faceZones()[fluidZoneID]
.whichFace(fluidPatchStart + i)
];
}
scalar maxDist = gMax
(
mag
(
fluidPatchFaceCentres
- mesh.boundaryMesh()[fluidPatchID].faceCentres()
)
);
Info << "Solid-to-fluid face interpolation error: " << maxDist
<< endl;
}
}
zoneToZoneInterpolation& interpolatorFluidSolid =
2012-09-11 15:42:55 +00:00
*interpolatorFluidSolidPtr;
zoneToZoneInterpolation& interpolatorSolidFluid =
2012-09-11 15:42:55 +00:00
*interpolatorSolidFluidPtr;