# #---------- ni = 15 nj = 15 m1 = G.cart((0, 0, 0), (10. / (ni - 1), 10. / (nj - 1), 1.), (ni, nj, 1)) m2 = G.cart((0, 10, 0), (10. / (ni - 1), 10. / (nj - 1), 1.), (ni, nj, 1)) m3 = G.cart((10, 0, 0), (10. / (ni - 1), 10. / (nj - 1), 1.), (ni, nj, 1)) t = C.newPyTree(['Base', m1, m2, m3]) t = X.connectMatch(t, dim=2) t = C.fillEmptyBCWith(t, "wall", 'BCWall') C._initVars(t, '{centers:fldX}= ({centers:CoordinateX})**2') C._initVars(t, '{centers:fldY}= ({centers:CoordinateY})**2') C._initBCDataSet(t, '{fldX}=0.5') C._initBCDataSet(t, '{fldY}=0.5') P._computeDiv2(t, 'centers:fld') test.testT(t, 1) # #---------- # # 3D STRUCT # #---------- ni = 15 nj = 15 nk = 15 m1 = G.cart((0, 0, 0), (10. / (ni - 1), 10. / (nj - 1), 2. / (nk - 1)), (ni, nj, nk)) m2 = G.cart((0, 10, 0), (10. / (ni - 1), 10. / (nj - 1), 2. / (nk - 1)), (ni, nj, nk))
# - initBCDataSet (pyTree) - import Converter.Internal as Internal import Converter.PyTree as C import Generator.PyTree as G N = 10 NFACES = (N - 1) * (N - 1) a = G.cart((0, 0, 0), (1, 1, 1), (N, N, N)) a = C.addBC2Zone(a, 'wall', 'BCWall', 'imin') b = Internal.getNodeFromName2(a, 'wall') d = Internal.newBCDataSet(name='BCDataSet', value='UserDefined', gridLocation='FaceCenter', parent=b) d = Internal.newBCData('BCNeumann', parent=d) d = Internal.newDataArray('Density', value=NFACES * [1.], parent=d) # Init all BCs C._initBCDataSet(a, 'MomentumX=2.*numpy.min({Density},0)') # Init only BC node bc = Internal.getNodeFromName(a, 'wall') C._initBCDataSet(bc, 'MomentumY=3.') C.convertPyTree2File(a, 'out.cgns')
# - rmBCDataVars (pyTree) - import Converter.PyTree as C import Generator.PyTree as G a = G.cart((0, 0, 0), (1, 1, 1), (10, 10, 10)) a = C.addBC2Zone(a, 'wall1', 'BCWall', 'jmin') a = C.addBC2Zone(a, 'wall2', 'BCWall', 'jmax') C._initBCDataSet(a, '{var1}=1.') C._initBCDataSet(a, '{var2}=2.') C._initBCDataSet(a, '{var3}=3.') a = C.rmBCDataVars(a, 'var1') a = C.rmBCDataVars(a, ['var2', 'var3'])
# - initBCDataSet (pyTree) - import Converter.Internal as Internal import Converter.PyTree as C import Generator.PyTree as G import KCore.test as test N = 10 NFACES = (N - 1) * (N - 1) a = G.cart((0, 0, 0), (1, 1, 1), (N, N, N)) a = C.addBC2Zone(a, 'wall', 'BCWall', 'imin') b = Internal.getNodeFromName2(a, 'wall') d = Internal.newBCDataSet(name='BCDataSet', value='UserDefined', gridLocation='FaceCenter', parent=b) d = Internal.newBCData('BCNeumann', parent=d) d = Internal.newDataArray('Density', value=NFACES * [1.], parent=d) # Init all BCs C._initBCDataSet(a, '{MomentumX}=2.*minimum({Density},0)') # Init only BC node bc = Internal.getNodeFromName(a, 'wall') C._initBCDataSet(bc, 'MomentumY', 3.) test.testT(a)