예제 #1
0
# - cartPenta (pyTree)-
import Generator.PyTree as G
import Converter.PyTree as C

a = G.cartPenta((0., 0., 0.), (0.1, 0.1, 0.2), (10, 10, 10))
C.convertPyTree2File(a, 'out.cgns')
import Converter.PyTree as C
import Connector.PyTree as X
import Generator.PyTree as G
import Transform.PyTree as T
import KCore.test as test


def sphere(x, y, z):
    if x * x + y * y + z * z < 0.5**2: return 0.
    else: return 1.


#
# Champ en noeuds non structure PENTA
#
a = G.cartPenta((-2., -1., -1.), (0.1, 0.1, 0.1), (21, 21, 21))
b = T.translate(a, (2, 0, 0))
b[0] = 'cart2'
t = C.newPyTree(['Cart'])
t[2][1][2] += [a, b]
t = C.initVars(t, 'Density', 1.)
t = C.initVars(t, 'cellN', sphere,
               ['CoordinateX', 'CoordinateY', 'CoordinateZ'])
nod = 1
for d in [-2, -1, 0, 1, 2, 5]:
    t2 = X.setHoleInterpolatedPoints(t, depth=d)
    test.testT(t2, nod)
    nod += 1

# Champ cellN en centres
a = G.cartPenta((-2., -1., -1.), (0.1, 0.1, 0.1), (21, 21, 21))
예제 #3
0
a1 = G.cart((0., 0., 0.), (1., 1., 1), (11, 11, 10))
a1 = C.addBC2Zone(a1, 'wall', 'BCWall', 'imin')
a1 = C.addBC2Zone(a1, 'ov', 'BCOverlap', 'imax')
a1 = C.addBC2Zone(a1, 'match1', 'BCMatch', 'jmin', a1, 'jmax')
a2 = G.cartHexa((10., 0., 0.), (1., 1., 1), (11, 11, 10))
a1 = C.initVars(a1, 'F', 2)
a1 = C.initVars(a1, 'centers:G', 1)
a2 = C.initVars(a2, 'F', 3)
a2 = C.initVars(a2, 'centers:G', 3)
t = C.newPyTree(['Base', 3])
a = T.join(a1, a2)
t[2][1][2].append(a)
test.testT(t, 2)

# Join 2 NON-STRUCT PENTA
a1 = G.cartPenta((0., 0., 0.), (1., 1., 1), (11, 11, 10))
a2 = G.cartPenta((10., 0., 0.), (1., 1., 1), (10, 10, 10))
a1 = C.initVars(a1, 'F', 2)
a1 = C.initVars(a1, 'centers:G', 1)
a2 = C.initVars(a2, 'F', 3)
a2 = C.initVars(a2, 'centers:G', 3)
t = C.newPyTree(['Base', 2])
a = T.join(a1, a2)
t[2][1][2].append(a)
test.testT(t, 9)

# Join 2 NON-STRUCT PYRA
a1 = G.cartPyra((0., 0., 0.), (1., 1., 1), (11, 11, 10))
a2 = G.cartPyra((10., 0., 0.), (1., 1., 1), (10, 10, 10))
a1 = C.initVars(a1, 'F', 2)
a1 = C.initVars(a1, 'centers:G', 1)
예제 #4
0
a = C.addVars(a,'Density'); a = C.initVars(a,'centers:cellN',1.)
a2 = G.close(a, 1.e-1)
test.testT(a2,3)

# test 3D cylindre HEXA
ni = 20; nj = 20; nk = 5
a0 = G.cylinder((0.,0.,0.), 0., 1., 0., 359, 1., (ni,nj,nk)) 
a0 = T.subzone(a0,(1,10,1),(20,13,5))
a = C.convertArray2Hexa(a0)
a = C.addVars(a,'Density'); a = C.initVars(a,'centers:cellN',1.)
a2 = G.close(a, 1.e-2)
test.testT(a2,4)

# test 3D TETRA
a = C.convertArray2Tetra(a0)
a = C.addVars(a,'Density'); a = C.initVars(a,'centers:cellN',1.)
a2 = G.close(a,2.e-2)
test.testT(a2,5)

# test 3D PENTA
a = G.cartPenta((0.,0.,0.), (0.1,0.1,0.2), (10,10,10)); a = C.addVars(a,'F')
a = C.addVars(a,'Density'); a = C.initVars(a,'centers:cellN',1.)
a2 = G.close(a, 2.e-2)
test.testT([a2],6)

# test 3D PYRA
a = G.cartPyra((0.,0.,0.), (0.1,0.1,0.2), (10,10,10)); a = C.addVars(a,'F')
a = C.addVars(a,'Density'); a = C.initVars(a,'centers:cellN',1.)
a2 = G.close(a, 2.e-2)
test.testT([a2],7)