# - coarsen (pyTree)-
import Post.PyTree as P
import Converter.PyTree as C
import Generator.PyTree as G
import Transform.PyTree as T

ni = 21; nj = 21; nk = 1
hi = 2./(ni-1); hj = 2./(nj-1)
m = G.cart((0.,0.,0.),(hi,hj,1.), (ni,nj,nk)); m = T.perturbate(m, 0.51)
tri = G.delaunay(m); tri = C.initVars(tri, 'centers:indic', 1.)

sol = P.coarsen(tri, 'indic'); sol[0] = 'coarse'

C.convertPyTree2File([sol,tri], 'out.cgns')
# - perturbate (PyTree) -
import Generator.PyTree as G
import Transform.PyTree as T
import Converter.PyTree as C

a = G.cart((0, 0, 0), (1, 1, 1), (10, 10, 2))
b = T.perturbate(a, 0.1)
b[0] = 'cart2'
C.convertPyTree2File([a, b], "out.cgns")
Example #3
0
# - refine (pyTree)-
import Post.PyTree as P
import Converter.PyTree as C
import Generator.PyTree as G
import Transform.PyTree as T
import KCore.test as test

# test sur une zone
ni = 21
nj = 21
nk = 1
hi = 2. / (ni - 1)
hj = 2. / (nj - 1)
m = G.cart((0., 0., 0.), (hi, hj, 1.), (ni, nj, nk))
m = T.perturbate(m, 0.51)
tri = G.delaunay(m)
tri = C.initVars(tri, 'centers:indic', 1.)
tri = C.initVars(tri, 'G', 2.)
sol = P.refine(tri, 'indic')
test.testT(sol, 1)

# test sur une base
m = G.cartTetra((2, 2, 2), (0.1, 0.1, 0.1), (10, 5, 1))
m = C.initVars(m, 'centers:indic', 1)
m = C.initVars(m, 'G', 0)
t = C.newPyTree(['Base', 2])
t[2][1][2] += [m, tri]
t[2][1] = C.addState(t[2][1], 'Mach', 0.6)
sol = P.refine(t[2][1], 'indic')
test.testT(sol, 2)
# - perturbate (pyTree) -
import Transform.PyTree as T
import Generator.PyTree as G
import Converter.PyTree as C
import KCore.test as test

# Traitements sur une zone
# Structure 3D 
a = G.cart( (0,0,0), (1,1,1), (10,10,10))
a = C.addVars(a,'Density'); a = C.initVars(a,'centers:cellN',1.)
a = C.addBC2Zone(a, 'wall','BCWall','imin')
a = C.addBC2Zone(a, 'overlap','BCOverlap','jmin')
a = C.addBC2Zone(a, 'match1', 'BCMatch', 'imax', a, 'imin', [1,2,3]) 
a = T.perturbate(a, 0.1)
test.testT(a,1)

# Structure 2D 
a = G.cart( (0,0,0), (1,1,1), (10,10,1))
a = C.addVars(a,'Density'); a = C.initVars(a,'centers:cellN',1.)
a = C.addBC2Zone(a, 'wall','BCWall','imin')
a = C.addBC2Zone(a, 'overlap','BCOverlap','jmin')
a = T.perturbate(a, 0.1)
test.testT(a,2)

# Traitements sur un arbre
# Structure 3D 
a = G.cart( (0,0,0), (1,1,1), (10,10,10))
a = C.addVars(a,'Density'); a = C.initVars(a,'centers:cellN',1.)
a = C.addBC2Zone(a, 'wall','BCWall','imin')
a = C.addBC2Zone(a, 'overlap','BCOverlap','jmin')
a = C.addBC2Zone(a, 'match1', 'BCMatch', 'imax', a, 'imin', [1,2,3])