def applyOverlap():
    if CTK.t == []: return
    CTK.saveTree()
    depth = VARS[7].get()
    depth = int(depth)
    CTK.t = X.applyBCOverlaps(CTK.t, depth=depth)
    CTK.t = X.setDoublyDefinedBC(CTK.t, depth=depth)
    CTK.TXT.insert('START', 'cellN variable modified near overlap BCs.\n')
    CTK.TKTREE.updateApp()
    CTK.display(CTK.t)
Esempio n. 2
0
# - dist2WallsEikonal (pyTree) -
import Converter.PyTree as C
import Connector.PyTree as X
import Converter.Internal as Internal
import Dist2Walls.PyTree as DTW
import Geom.PyTree as D
import Generator.PyTree as G
import numpy

DEPTH = 2
snear = 0.4; vmin = 21

# Init wall
body = D.circle((0,0,0),1.,N=60)
res = G.octree([body],[snear], dfar=5., balancing=1)
res = G.octree2Struct(res, vmin=vmin, ext=DEPTH+1,merged=1)
t = C.newPyTree(['Base']); t[2][1][2] = res

# Mark solid and fluid points
t = X.applyBCOverlaps(t,depth=DEPTH,loc='nodes')
tc = Internal.copyRef(t)
tc = X.setInterpData(t,tc,loc='nodes',storage="inverse")
C._initVars(t,"cellN",1.)
t = X.blankCells(t, [[body]], numpy.array([[1]]), blankingType='node_in')
t = X.setHoleInterpolatedPoints(t,depth=1,loc='nodes')
C._initVars(t,'flag=({cellN}>1.)')
t = DTW.distance2WallsEikonal(t,body,tc=tc,DEPTH=DEPTH,nitmax=10)
C.convertPyTree2File(t, 'out.cgns')
Esempio n. 3
0
# - applyBCOverlaps (pyTree) -
import Converter.PyTree as C
import Connector.PyTree as X
import Generator.PyTree as G
import Converter.elsAProfile as elsAProfile
import Converter.Internal as Internal

a = G.cylinder((0, 0, 0), 1., 1.5, 360., 0., 1., (30, 30, 10))
a = C.addBC2Zone(a, 'overlap1', 'BCOverlap', 'jmax')
a = C.addBC2Zone(a, 'wall1', 'BCWall', 'jmin')
b = G.cart((-10., -10., -10.), (0.4, 0.4, 0.4), (50, 50, 50))

t = C.newPyTree(['Cyl', a, 'Cart', b])
t = X.applyBCOverlaps(t)
tp = elsAProfile.buildBCOverlap(t)
tp = elsAProfile.rmGCOverlap__(tp)
tp = elsAProfile.addNeighbours(tp)
C.convertPyTree2File(tp, 'out.cgns')
Esempio n. 4
0
# - setInterpolations (pyTree) -
import Converter.PyTree as C
import Generator.PyTree as G
import Connector.PyTree as X
import KCore.test as test

a = G.cylinder((0, 0, 0), 0., 3., 360, 0, 1, (200, 40, 2))
a[0] = 'cylindre1'
b = G.cylinder((0, 0, 0), 1., 2., 360, 0, 1, (200, 10, 2))
b[0] = 'cylindre2'
a = C.addBC2Zone(a, 'wall1', 'BCWall', 'jmin')
a = C.addBC2Zone(a, 'nref', 'BCFarfield', 'jmax')
b = C.addBC2Zone(b, 'overlap', 'BCOverlap', 'jmin')
b = C.addBC2Zone(b, 'overlap', 'BCOverlap', 'jmax')
t = C.newPyTree(['Cyl1', 'Cyl2'])
t[2][1][2].append(a)
t[2][2][2].append(b)
t = X.connectMatch(t, dim=2)
t = C.fillEmptyBCWith(t, 'nref', 'BCFarfield', dim=2)
for i in range(1, 3):
    t[2][i] = C.addState(t[2][i], 'EquationDimension', 2)
# depth = 2
t1 = X.applyBCOverlaps(t, depth=2)
t1 = X.setInterpolations(t1, loc='cell')
test.testT(t1, 1)
# depth = 1
t2 = X.applyBCOverlaps(t, depth=1)
t2 = X.setInterpolations(t2, loc='face')
t2 = X.setInterpolations(t2, loc='cell')
test.testT(t2, 2)
import KCore.test as test

NBBASES = 2
INTERSECT = 1

a = G.cart((0., 0., 0.), (0.1, 0.1, 0.2), (10, 11, 12))
b = G.cart((1.5, 0., 0.), (0.1, 0.1, 0.2), (15, 15, 8))
a = C.addBC2Zone(a, 'overlap', 'BCOverlap', 'imax')
b = C.addBC2Zone(b, 'overlap', 'BCOverlap', 'imin')
b = C.addBC2Zone(b, 'overlap', 'BCOverlap', 'kmax')

# 1 seule base, pas d'extrapolation
t = C.newPyTree(['Base'])
t[2][1][2].append(a)
t[2][1][2].append(b)
t = X.applyBCOverlaps(t, depth=2)
t = X.setInterpolations(t, loc='cell', storage='direct', sameBase=1)
test.testT(t, 1)

# 1 seule base, extrapolations
a2 = T.rotate(a, (1.5, 0., 0.), (0., 1., 0.), 15.)
b2 = T.rotate(b, (1.5, 0., 0.), (0., 1., 0.), -15.)
t = C.newPyTree(['Base'])
t[2][1][2].append(a2)
t[2][1][2].append(b2)
t = X.applyBCOverlaps(t, depth=2)
t = X.setInterpolations(t, loc='cell', storage='direct', sameBase=1)
test.testT(t, 2)

# 2 bases differentes, pas d'extrapolation
t = C.newPyTree(['Base1', 'Base2'])
# - getOversetInfo (pyTree) -
import Converter.PyTree as C
import Generator.PyTree as G
import Connector.PyTree as X

a = G.cylinder((0, 0, 0), 1., 3., 360, 0, 1, (200, 30, 4))
a[0] = 'cylindre1'
a = C.addBC2Zone(a, 'wall1', 'BCWall', 'jmin')
a = C.addBC2Zone(a, 'ov1', 'BCOverlap', 'jmax')
b = G.cylinder((4, 0, 0), 1., 3., 360, 0, 1, (200, 30, 4))
b[0] = 'cylindre2'
b = C.addBC2Zone(b, 'wall1', 'BCWall', 'jmin')
b = C.addBC2Zone(b, 'ov1', 'BCOverlap', 'jmax')
c = G.cart((-5., -7.5, -2), (15. / 200, 15. / 200, 1), (200, 200, 8))
t = C.newPyTree(['Corps1', 'Corps2', 'Bgrd'])
t[2][1][2].append(a)
t[2][2][2].append(b)
t[2][3][2].append(c)
t = X.connectMatch(t, dim=3)
t = C.fillEmptyBCWith(t, 'nref', 'BCFarfield', dim=3)
t = X.applyBCOverlaps(t, depth=1, loc='centers')
t[2][1][2] = X.setInterpData(t[2][1][2],
                             t,
                             loc='centers',
                             storage='direct',
                             sameName=1)
t = X.getOversetInfo(t, t, loc='centers', type='interpolated')
t = X.getOversetInfo(t, t, loc='centers', type='orphan')
C.convertPyTree2File(t, "out.cgns")
import Connector.PyTree as X
import Generator.PyTree as G

a = G.cylinder( (0,0,0), 1, 2, 0, 360, 1, (60, 20, 3) )
b = G.cylinder( (0,0,0), 1, 2, 3, 160, 1, (30, 10, 3) )
a = C.addBC2Zone(a, 'wall', 'BCWall', 'jmin')
a = C.addBC2Zone(a, 'match', 'BCMatch', 'imin', a, 'imax', trirac=[1,2,3])
a = C.addBC2Zone(a, 'match', 'BCMatch', 'imax', a, 'imin', trirac=[1,2,3])
b = C.addBC2Zone(b, 'wall', 'BCWall', 'jmin')
b = C.addBC2Zone(b, 'overlap', 'BCOverlap', 'imin')
b = C.addBC2Zone(b, 'overlap', 'BCOverlap', 'imax')
tD = C.newPyTree(['Base']); tD[2][1][2] = [a]; 
tR = C.newPyTree(['Base']); tR[2][1][2] = [b]
tD = C.fillEmptyBCWith(tD, 'nref', 'BCFarfield')
tR = C.fillEmptyBCWith(tR, 'nref', 'BCFarfield')

tD = C.initVars(tD, '{Density}=1.')
tD = C.initVars(tD, '{cellN}=1.')
tD = C.initVars(tD, '{MomentumX}= -0.1')
tD = C.initVars(tD, '{MomentumY}= -0.2')

tR = C.initVars(tR, '{centers:Density}=-1.')
tR = C.initVars(tR, '{centers:cellN}=1.')
tR = C.initVars(tR, '{centers:MomentumX}=0.1')
tR = C.initVars(tR, '{centers:MomentumY}=0.2')
tR = X.applyBCOverlaps(tR, depth=1) 
tD = X.setInterpData(tR, tD, double_wall=1, loc='centers',
                     storage='inverse', order=3)
info = X.setInterpTransfersD(tD,variables=['MomentumX'])
print info
Esempio n. 8
0
import Converter.PyTree as C
import Connector.PyTree as X
import Generator.PyTree as G
import KCore.test as test

a = G.cylinder((0, 0, 0), 1., 1.5, 360., 0., 1., (30, 30, 10))
# --- CL
a = C.addBC2Zone(a, 'overlap1', 'BCOverlap', 'jmin')
# --- champ aux noeuds
a = C.initVars(a, 'Density', 1.)
t = C.newPyTree(['Base'])
t[2][1][2].append(a)
# --- Equation state
t[2][1] = C.addState(t[2][1], 'EquationDimension', 3)
# --- Apply on PyTree
t1 = X.applyBCOverlaps(t, depth=1, loc='centers')
test.testT(t1, 1)
# --- Apply on a zone
a2 = X.applyBCOverlaps(a, depth=1, loc='centers')
t2 = C.newPyTree(['Base'])
t2[2][1][2].append(a2)
test.testT(t2, 2)

# depth = 2
t = C.newPyTree(['Base'])
t[2][1][2].append(a)
# --- Equation state
t[2][1] = C.addState(t[2][1], 'EquationDimension', 3)
# --- CL
t2 = X.applyBCOverlaps(t, depth=2, loc='centers')
test.testT(t2, 3)
Esempio n. 9
0
import Generator.PyTree as G

a = G.cylinder((0, 0, 0), 1, 2, 0, 360, 1, (60, 20, 3))
b = G.cylinder((0, 0, 0), 1, 2, 3, 160, 1, (30, 10, 3))
a = C.addBC2Zone(a, 'wall', 'BCWall', 'jmin')
a = C.addBC2Zone(a, 'match', 'BCMatch', 'imin', a, 'imax', trirac=[1, 2, 3])
a = C.addBC2Zone(a, 'match', 'BCMatch', 'imax', a, 'imin', trirac=[1, 2, 3])
b = C.addBC2Zone(b, 'wall', 'BCWall', 'jmin')
b = C.addBC2Zone(b, 'overlap', 'BCOverlap', 'imin')
b = C.addBC2Zone(b, 'overlap', 'BCOverlap', 'imax')
t1 = C.newPyTree(['Base'])
t1[2][1][2] = [a]
t2 = C.newPyTree(['Base'])
t2[2][1][2] = [b]
t1 = C.fillEmptyBCWith(t1, 'nref', 'BCFarfield')
t2 = C.fillEmptyBCWith(t2, 'nref', 'BCFarfield')

t1 = C.initVars(t1, '{Density}= 1.')
t2 = C.initVars(t2, '{Density}=-1.')
t2 = C.node2Center(t2, ['Density'])

t2 = X.applyBCOverlaps(t2, depth=1)
t1 = X.setInterpData(t2,
                     t1,
                     double_wall=1,
                     loc='centers',
                     storage='inverse',
                     order=3)
t2 = X.setInterpTransfers(t2, t1, variables=['Density'])
C.convertPyTree2File(t2, 'out.cgns')
Esempio n. 10
0
a = C.addBC2Zone(a, 'match', 'BCMatch', 'imax', a, 'imin', trirac=[1, 2, 3])
b = C.addBC2Zone(b, 'wall', 'BCWall', 'jmin')
b = C.addBC2Zone(b, 'overlap', 'BCOverlap', 'imin')
b = C.addBC2Zone(b, 'overlap', 'BCOverlap', 'imax')
tD = C.newPyTree(['Base'])
tD[2][1][2] = [a]
tR = C.newPyTree(['Base'])
tR[2][1][2] = [b]
tD = C.fillEmptyBCWith(tD, 'nref', 'BCFarfield')
tR = C.fillEmptyBCWith(tR, 'nref', 'BCFarfield')

tD = C.initVars(tD, '{Density}=1.')
tD = C.initVars(tD, '{cellN}=1.')
tD = C.initVars(tD, '{MomentumX}= -0.1')
tD = C.initVars(tD, '{MomentumY}= -0.2')
tR = X.applyBCOverlaps(tR, depth=1)
tD = X.setInterpData(tR,
                     tD,
                     double_wall=1,
                     loc='centers',
                     storage='inverse',
                     order=3)
info = X.setInterpTransfersD(tD, variables=['MomentumX'])
test.testO(info, 1)
test.testA([info[0][1]], 11)

# Noeuds
tD = C.newPyTree(['Base'])
tD[2][1][2] = [a]
tR = C.newPyTree(['Base'])
tR[2][1][2] = [b]
Esempio n. 11
0
t = C.addBase2PyTree(t, 'CARTESIAN')
t[2][2][2] = res
# ajout d un plan en k
t = T.addkplane(t)
#
#---------------------------
# Assemblage Chimere
#---------------------------
DEPTH = 2
# bodies description
bodies = []
bases = Internal.getNodesFromType(t, 'CGNSBase_t')
for b in bases:
    walls = C.extractBCOfType(b, 'BCWall')
    if walls != []: bodies.append(walls)

# blanking
BM = numpy.array([[0], [1]])
t = X.blankCells(t, bodies, BM, depth=DEPTH, dim=2)
t = X.setHoleInterpolatedPoints(t, depth=DEPTH)
t = X.applyBCOverlaps(t, depth=DEPTH)
t = X.optimizeOverlap(t, priorities=['Cylindre1', 0, 'CARTESIAN', 1])
t = X.maximizeBlankedCells(t, depth=DEPTH)
t = X.setInterpolations(t, loc='cell')

# Arbre a la Cassiopee
C.convertPyTree2File(t, 'out_cassiopee.cgns')

# Arbre a la elsA
t = CE.convert2elsAxdt(t)
C.convertPyTree2File(t, 'out_elsa.cgns')