import Converter.PyTree as C import Dist2Walls.PyTree as DTW import Generator.PyTree as G import Geom.PyTree as D import Connector.PyTree as X import Transform.PyTree as T import Connector.ToolboxIBM as TIBM N = 11 N2 = 2 * N - 1 h = 1. / (N - 1) a = G.cart((-1., -1., -1.), (h, h, h), (N2, N2, 2)) zmean = C.getMeanValue(a, 'CoordinateZ') surf = D.sphere((0, 0, zmean), 0.5, 20) t = C.newPyTree(['Cart', a]) C.convertPyTree2File(surf, "in.cgns") bodies = [[surf]] # Matrice de masquage (arbre d'assemblage) import numpy BM = numpy.array([[1]]) C._initVars(t, 'centers:cellN', 1.) t = X.blankCells(t, bodies, BM, blankingType='center_in', delta=0.) DTW._distance2Walls(t, surf, loc='centers', type='ortho') C._initVars(t, "{centers:F}={centers:cellN}") TIBM._blankClosestTargetCells(t) C.convertPyTree2File(t, 'out.cgns')
N = 41 a = G.cart((0, 0, 0), (1. / (N - 1), 1. / (N - 1), 1. / (N - 1)), (N, N, N)) xm = 0.5 * N / (N - 1) s = D.sphere((xm, xm, xm), 0.1, N=20) s = C.convertArray2Tetra(s) s = G.close(s) t = C.newPyTree(['Base', a]) # Blanking bodies = [[s]] BM = numpy.array([[1]], numpy.int32) t = X.blankCells(t, bodies, BM, blankingType='center_in') t = X.setHoleInterpolatedPoints(t, depth=-2) # Dist2Walls DTW._distance2Walls(t, [s], type='ortho', loc='centers', signed=1) t = C.center2Node(t, 'centers:TurbulentDistance') # Gradient de distance localise en centres => normales t = P.computeGrad(t, 'TurbulentDistance') I._initConst(t, MInf=0.2, loc='centers') tc = C.node2Center(t) tb = C.newPyTree(['Base', s]) C._addState(tb, 'EquationDimension', 3) C._addState(tb, 'GoverningEquations', 'NSTurbulent') tp = X.setIBCData(t, tc, loc='centers', storage='direct', bcType=0) t2 = X.setInterpTransfers(tp, tc, bcType=0, varType=1) z = IBM.extractIBMWallFields(t2, tb=tb) test.testT(z, 1)
import Converter.PyTree as C import Generator.PyTree as G import Connector.ToolboxIBM as IBM import Post.PyTree as P import Geom.PyTree as D import Dist2Walls.PyTree as DTW import KCore.test as test N = 21 a = G.cart((0, 0, 0), (1. / (N - 1), 1. / (N - 1), 1. / (N - 1)), (N, N, N)) body = D.sphere((0.5, 0, 0), 0.1, N=20) tb = C.newPyTree(['Base', body]) C._addState(tb, 'EquationDimension', 3) C._addState(tb, 'GoverningEquations', 'NSTurbulent') t = C.newPyTree(['Base', a]) DTW._distance2Walls(t, bodies=tb, loc='centers', type='ortho') C._initVars(t, 'centers:cellN', 1.) t, tc = IBM.prepareIBMData(t, tb, DEPTH=2, frontType=0, interpDataType=1) res = IBM.extractIBMInfo(tc) test.testT(tc, 1) # front 1 tb = C.newPyTree(['Base', body]) C._addState(tb, 'EquationDimension', 3) C._addState(tb, 'GoverningEquations', 'NSTurbulent') DTW._distance2Walls(t, bodies=tb, loc='centers', type='ortho') C._initVars(t, 'centers:cellN', 1.) t, tc = IBM.prepareIBMData(t, tb, DEPTH=2, frontType=1, interpDataType=1) test.testT(tc, 12) # front2