|
[Sponsors] |
[snappyHexMesh] Fixing boundary coordinates snappyHexMesh |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 22, 2019, 07:16 |
Fixing boundary coordinates snappyHexMesh
|
#1 |
New Member
Tim
Join Date: Jul 2019
Posts: 7
Rep Power: 7 |
Hi
I am attempting a meshing strategy that involves
Defining the interface patches that were created in step 2 as outerMesh_innerBoundary and innerMesh_outerBoundary, what appears to happen is that during the snapping phase of step 3, the boundary coordinates of the "innerMesh_outerBoundary" patch seem to move a little, which means I can't get stitchMesh "perfect" to work when I try to recombine the patch with the "outerMesh_innerBoundary" patch in step 4. I was hoping someone might know if there was a quick trick to fix/constrain the "innerMesh_outerBoundary" coordinates during snapping? The number of faces on "innerMesh_outerBoundary" patch has not changed during snapping, but it seems that snapping process relaxes the coordinates of the whole mesh. The interface patches are not smooth and have lots of "kinks" (like a castellated mesh); so, I don't think that the other stitchMesh options will work for this mesh (or at least I haven't managed to get them to work with a toleranceDict). I know I could try the directional refinement now available in snappyHexMesh, but I would rather not go back to the drawing board if there was quick fix to constrain the coordinates. Thanks in advance for any assistance. Last edited by botman; July 24, 2019 at 11:04. |
|
July 23, 2019, 03:26 |
|
#2 |
New Member
Tim
Join Date: Jul 2019
Posts: 7
Rep Power: 7 |
In the off chance this is of use to others, below is the workaround I am adopting using the python package Ofpp. The script just shifts the points of the innerMesh_outerBoundary patch to match those of outerMesh_innerBoundary. I can then use stitchMesh perfect. Note that I have merged the meshes before running the script, and the script only works if the interfacing patches are almost perfect.
Code:
import numpy as np import Ofpp mesh = Ofpp.FoamMesh('.') bi = mesh.boundary[b'innerMesh_outerBoundary'] bo = mesh.boundary[b'outerMesh_innerBoundary'] fList_i = np.array(range(bi.start, bi.start + bi.num)) fList_o = np.array(range(bo.start, bo.start + bo.num)) mpts_i = np.zeros((len(fList_i), 3)) mpts_o = np.zeros((len(fList_o), 3)) # Compute the mid-points of the boundary faces for k in range(len(fList_i)): mpts_i[k] = np.average( mesh.points[np.ix_(mesh.faces[fList_i[k]])], axis=0) mpts_o[k] = np.average( mesh.points[np.ix_(mesh.faces[fList_o[k]])], axis=0) # Set the points on the inner patch to match the outer patch for i, mi in enumerate(mpts_i): j = np.argmin(np.linalg.norm(mpts_o-mi, axis=1)) point_i = mesh.points[mesh.faces[fList_i[i]]] point_o = mesh.points[mesh.faces[fList_o[j]]] point_o2i = point_o[[np.argmin(np.linalg.norm( point_o-pi, axis=1)) for pi in point_i]] mesh.points[mesh.faces[fList_i[i]]] = point_o2i # ... then you just export the updated points matrix to constant/polyMesh and then "stitchMesh -perfect" should run ok Last edited by botman; July 24, 2019 at 11:04. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Wind turbine simulation | Saturn | CFX | 60 | July 17, 2024 06:45 |
Out File does not show Imbalance in % | Mmaragann | CFX | 5 | January 20, 2017 11:20 |
Multiphase flow - incorrect velocity on inlet | Mike_Tom | CFX | 6 | September 29, 2016 02:27 |
Velocity vector in impeller passage | ngoc_tran_bao | CFX | 24 | May 3, 2016 22:16 |
Waterwheel shaped turbine inside a pipe simulation problem | mshahed91 | CFX | 3 | January 10, 2015 12:19 |