|
[Sponsors] |
January 25, 2022, 15:03 |
Calculating Patch Center for Decomposed Case
|
#1 |
Member
Kellis
Join Date: Mar 2017
Posts: 38
Rep Power: 9 |
Good afternoon,
I am trying to write a piece of code that will track the center of a patch as it moves within the dynamic mesh. The center location is needed for calculations in the solver during runtime. Using the following code, I get the expected results when running the case serially: Code:
// Get current patch scalar patchNum = mesh.boundaryMesh().findPatchID(fricPatchList[patchi]); const polyPatch& currPatch = mesh.boundaryMesh()[patchNum]; // Initialize center vector and area vector patchCenter = Zero; scalar patchArea = VSMALL; // Create pointers to face surface area and centers (used by both loops) const surfaceScalarField& magSf = mesh.magSf(); const surfaceVectorField& Cf = mesh.Cf(); // Calculate area-weighted patch center forAll(currPatch, facei) { // Add area-weighted face center and face area to totals patchCenter += Cf.boundaryField()[patchNum][facei]*magSf.boundaryField()[patchNum][facei]; patchArea += magSf.boundaryField()[patchNum][facei]; } // Calculate patch centroid patchCenter = patchCenter / patchArea; Info << "Center for patch " << fricPatchList[patchi] << " found to be at " << patchCenter << endl; So, is there a way to access the full patch data while running in parallel? Or, will I have to come up with a workaround, such as keeping the entire patch on one processor? This would be less than ideal, as the patch is directly next to a finely discretized region in my mesh that should be split up into several parts. Any help would be appreciated. Thanks. Kellis |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Near wall treatment in k-omega SST | Arnoldinho | OpenFOAM Running, Solving & CFD | 38 | March 8, 2017 13:48 |
Possible Bug in pimpleFoam (or createPatch) (or fluent3DMeshToFoam) | cfdonline2mohsen | OpenFOAM | 3 | October 21, 2013 09:28 |
[Commercial meshers] Fluent msh and cyclic boundary | cfdengineering | OpenFOAM Meshing & Mesh Conversion | 48 | January 25, 2013 03:28 |
chtMultiRegionFoam Tutorial | m.nichols19 | OpenFOAM | 12 | September 9, 2010 11:56 |
Free surface boudary conditions with SOLA-VOF | Fan | Main CFD Forum | 10 | September 9, 2006 12:24 |