# - blankCellsTri (pyTree) - 'NODE IN' import Converter.PyTree as C import Connector.PyTree as X import Generator.PyTree as G import Geom.PyTree as D import Post.PyTree as P # Tet mask m = G.cart((0., 0., 0.), (0.1, 0.1, 0.2), (10, 10, 10)) m = P.exteriorFaces(m) m = C.convertArray2Tetra(m) # Mesh to blank a = G.cart((-5., -5., -5.), (0.5, 0.5, 0.5), (100, 100, 100)) t = C.newPyTree(['Cart', a]) t = C.initVars(t, 'centers:cellN', 1.) masks = [[m]] # Matrice de masquage (arbre d'assemblage) import numpy BM = numpy.array([[1]]) t = X.blankCellsTri(t, masks, BM, blankingType='node_in', tol=1.e-12) C.convertPyTree2File(t, 'out.cgns')
m = G.cart((0., 0., 0.), (0.1, 0.1, 0.2), (10, 10, 10)) m = P.exteriorFaces(m) m = C.convertArray2Tetra(m) m = T.reorder(m, (-1, )) #C.convertPyTree2File(m, 'm.plt') # Mesh to blank a = G.cart((-5., -5., -5.), (0.5, 0.5, 0.5), (100, 100, 100)) t = C.newPyTree(['Cart']) t[2][1][2].append(a) # celln init t = C.initVars(t, 'nodes:cellN', 1.) #C.convertPyTree2File(t, 'b.plt') # Blanking t = X.blankCellsTri(t, [[m]], [], blankingType="node_in", tol=1.e-12, cellnval=4, overwrite=1) #C.convertPyTree2File(t, 'out1t.cgns') test.testT(t, 1) # Test 2 # Tet mask m = G.cart((0., 0., 0.), (0.1, 0.1, 0.2), (10, 10, 10)) m = P.exteriorFaces(m) m = C.convertArray2Tetra(m) m = T.reorder(m, (-1, )) # Mesh to blank a = G.cart((-5., -5., -5.), (0.5, 0.5, 0.5), (100, 100, 100)) #C.convertPyTree2File(a, 'bgm.plt') t = C.newPyTree(['Cart'])
# Test 1 # Tet mask m = G.cart((0.,0.,0.), (0.1,0.1,0.2), (10,10,10)) m = P.exteriorFaces(m) m = C.convertArray2Tetra(m) m = T.reorder(m, (-1,)) #C.convertPyTree2File(m, 'm.plt') # Mesh to blank a = G.cart((-5.,-5.,-5.), (0.5,0.5,0.5), (100,100,100)) t = C.newPyTree(['Cart',a]) # celln init C._initVars(t, 'nodes:cellN', 1.) #C.convertPyTree2File(t, 'b.plt') # Blanking t = X.blankCellsTri(t, [[m]], [], blankingType="node_in", tol=1.e-12) #C.convertPyTree2File(t, 'out1t.cgns') test.testT(t,1) # Test 2 # Tet mask m = G.cart((0.,0.,0.), (0.1,0.1,0.2), (10,10,10)) m = P.exteriorFaces(m) m = C.convertArray2Tetra(m) m = T.reorder(m, (-1,)) # Mesh to blank a = G.cart((-5.,-5.,-5.), (0.5,0.5,0.5), (100,100,100)) #C.convertPyTree2File(a, 'bgm.plt') t = C.newPyTree(['Cart',a]) # celln init C._initVars(t, 'centers:cellN', 1.)
import Dist2Walls.PyTree as DTW import Geom.PyTree as D import Generator.PyTree as G import numpy DEPTH = 2 # Bloc cartesien N = 128; h = 0.1 a = G.cart((0.,0.,0.),(h,h,h),(N,N,1)) # Init wall sphere = D.sphere((6.4,6.4,0), 1., 100) sphere = C.convertArray2Tetra(sphere) sphere = G.close(sphere) t = C.newPyTree(['Base']); t[2][1][2] = [a]; C._initVars(t,'cellN=1') t = X.blankCellsTri(t, [[sphere]], numpy.array([[1]]), blankingType='node_in') # Condition aux limites t = X.setHoleInterpolatedPoints(t,depth=1,loc='nodes') C._initVars(t,'flag=({cellN}>1.)') t = DTW.distance2WallsEikonal(t,sphere,DEPTH=DEPTH,nitmax=10) C.convertPyTree2File(t, 'out.cgns') # Bloc cartesien N = 64; h = 0.2 a = G.cart((0.,0.,0.),(h,h,h),(N,N,1)); a[0] = 'cart2' # Init wall sphere = D.sphere((6.4,6.4,0), 1., 100) sphere = C.convertArray2Tetra(sphere) sphere = G.close(sphere) t = C.newPyTree(['Base']); t[2][1][2] = [a] C._initVars(t,'cellN=1.')
s2 = T.reorder(s2, (1,)) #C.convertPyTree2File(s2, 's2.cgns') snear = 0.15 hWall = 0.1 raison = 1.2 smoothIter = 20 nlayer = 3 dlayer = hWall*(1.-raison**nlayer)/(1.-raison); d = G.cart((0.,0.,0.), (dlayer/nlayer,1,1), (nlayer,1,1)) penta = G.addNormalLayers(s2, d, check=0, niter=smoothIter) #C.convertPyTree2File(penta, 'penta.cgns') t = C.newPyTree(['Pentas']); t[2][1][2].append(penta) # Blanking C._initVars(t, 'centers:cellN', 1.) t = X.blankCellsTri(t, [[s1]], [], blankingType="cell_intersect", tol=1.e-12) #C.convertPyTree2File(t, 'out.cgns') test.testT(t,1) s2 = D.sphere6((1,0,0), 1.5, N=20, ntype='QUAD') pyras = G.quad2Pyra(s2, hratio=1.) t = C.newPyTree(['Pyras']); t[2][1][2].append(pyras) # Blanking C._initVars(t, 'centers:cellN', 1.) t = X.blankCellsTri(t, [[s1]], [], blankingType="cell_intersect", tol=1.e-12) #C.convertPyTree2File(t, 'out2.cgns') test.testT(t,2)