Пример #1
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)
# - 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', storage='direct')
test.testT(t1, 1)
# depth = 1
t2 = X.applyBCOverlaps(t, depth=1)
t2 = X.setInterpolations(t2, loc='face', storage='direct')
t2 = X.setInterpolations(t2, loc='cell', storage='direct')
test.testT(t2, 2)
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'])
t[2][1][2].append(a)
Пример #4
0
# - chimeraInfo (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)
t = X.setInterpolations(t, loc='cell', double_wall=1, storage='direct')
t = X.chimeraInfo(t, type='interpolated')
C.convertPyTree2File(t, "out.cgns")
# - setInterpolation (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,2)); 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,2)); b[0] = 'cylindre2'
b = C.addBC2Zone(b, 'wall1', 'BCWall', 'jmin')
b = C.addBC2Zone(b, 'ov1', 'BCOverlap', 'jmax')
c = G.cart((-5.,-7.5,0), (15./200,15./200,1), (200,200,2))
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=2)
t = C.fillEmptyBCWith(t,'nref','BCFarfield', dim=2)
t = X.applyBCOverlaps(t, depth=1)
t = X.setInterpolations(t, loc='cell')
C.convertPyTree2File(t,"out.cgns")
C._addBC2Zone(b, 'wall', 'BCWall', 'jmin')
C._fillEmptyBCWith(b, 'overlap', 'BCOverlap', dim=DIM)
t = C.newPyTree(['Base', 'Base2'])
t[2][1][2] = [a]
t[2][2][2] = [b]
C._initVars(t, 'Density', 1.)
C._initVars(t, 'centers:cellN', 1)
t = X.connectMatchPeriodic(t,
                           rotationCenter=[0., 0., 0.],
                           rotationAngle=[0., 0., 120.],
                           dim=DIM)
C._fillEmptyBCWith(t, 'nref', 'BCFarfield', dim=DIM)
C._addState(t[2][1], 'EquationDimension', DIM)
t = X.applyBCOverlaps(t, depth=1)
t = X.setInterpolations(t,
                        double_wall=1,
                        storage='direct',
                        prefixFile=LOCAL + '/chm')
C.convertPyTree2File(t, "out.cgns")
test.testT(t, 1)
# test avec Chimere periodique
NK = 51
a = G.cylinder((0, 0, 0), 1, 2, 10, 130, 4., (60, 20, NK))
a[0] = 'cyl1'
b = G.cart((0.4, 1.2, -0.3), (0.04, 0.04, 0.1), (11, 11, 21))
a = X.connectMatchPeriodic(a,
                           rotationCenter=[0., 0., 0.],
                           rotationAngle=[0., 0., 120.])
C._fillEmptyBCWith(a, "wall", "BCWall")
C._addBC2Zone(a,
              'overlapdd',
              'BCOverlap',
# - setInterpolation (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, 2))
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, 2))
b[0] = 'cylindre2'
b = C.addBC2Zone(b, 'wall1', 'BCWall', 'jmin')
b = C.addBC2Zone(b, 'ov1', 'BCOverlap', 'jmax')
c = G.cart((-5., -7.5, 0), (15. / 200, 15. / 200, 1), (200, 200, 2))
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=2)
t = C.fillEmptyBCWith(t, 'nref', 'BCFarfield', dim=2)
t = X.applyBCOverlaps(t, depth=1)
t = X.setInterpolations(t, loc='cell', prefixFile='chimData')
C.convertPyTree2File(t, "out.cgns")
# - setInterpolations (pyTree)-
# Cas double wall avec stockage inverse
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, 2, 0, 360, 1, (60, 20, 2))
b = G.cylinder((0, 0, 0), 1, 2, 3, 160, 1, (30, 20, 2))
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])
a = C.addBC2Zone(a, 'nref', 'BCFarfield', 'jmax')
b = C.addBC2Zone(b, 'wall', 'BCWall', 'jmin')
b = C.fillEmptyBCWith(b, 'overlap', 'BCOverlap', dim=2)
t = C.newPyTree(['Base', 'Base2'])
t[2][1][2] = [a]
t[2][2][2] = [b]
t = C.initVars(t, 'Density', 1.)
t = C.initVars(t, 'centers:G', 10.)
t[2][1] = C.addState(t[2][1], 'EquationDimension', 2)
# depth = 2
t1 = X.applyBCOverlaps(t, depth=2)
t1 = X.setInterpolations(t1, loc='cell', double_wall=1, storage='inverse')
test.testT(t1, 1)
# depth = 1
t2 = X.applyBCOverlaps(t, depth=1)
t2 = X.setInterpolations(t2, loc='face', double_wall=1, storage='inverse')
t2 = X.setInterpolations(t2, loc='cell', double_wall=1, storage='inverse')
test.testT(t2, 2)
Пример #9
0
a = G.cylinder((0, 0, 0), 1., 3., 360, 0, 1, (200, 30, 4))
a[0] = 'cylindre1'
C._addBC2Zone(a, 'wall1', 'BCWall', 'jmin')
C._addBC2Zone(a, 'ov1', 'BCOverlap', 'jmax')
b = G.cylinder((4, 0, 0), 1., 3., 360, 0, 1, (200, 30, 4))
b[0] = 'cylindre2'
C._addBC2Zone(b, 'wall1', 'BCWall', 'jmin')
C._addBC2Zone(b, 'ov1', 'BCOverlap', 'jmax')
t = C.newPyTree(['Corps1', 'Corps2'])
t[2][1][2].append(a)
t[2][2][2].append(b)
t = X.connectMatch(t, dim=3)
C._fillEmptyBCWith(t, 'nref', 'BCFarfield', dim=3)
C._addState(t, 'EquationDimension', 3)
C._initVars(t, 'F', 0.)
C._initVars(t, 'centers:G', 1.)
t = X.applyBCOverlaps(t, depth=1)
t1 = X.setInterpolations(t, loc='cell', storage='direct')
X._chimeraInfo(t1, type='interpolated')
X._chimeraInfo(t1, type='extrapolated')
X._chimeraInfo(t1, type='orphan')
interpPts = X.extractChimeraInfo(t1, type='interpolated', loc='centers')
test.testT(interpPts, 1)
extrapPts = X.extractChimeraInfo(t1, type='extrapolated', loc='centers')
test.testT(extrapPts, 2)
cfExtrapPts = X.extractChimeraInfo(t1, type='cf>1.5', loc='centers')
test.testO(cfExtrapPts, 3)
orphanPts = X.extractChimeraInfo(t1, type='orphan', loc='centers')
test.testT(orphanPts, 4)
Пример #10
0
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')
t = C.newPyTree(['Corps1', 'Corps2'])
t[2][1][2].append(a)
t[2][2][2].append(b)
t = X.connectMatch(t, dim=3)
t = C.fillEmptyBCWith(t, 'nref', 'BCFarfield', dim=3)
t = C.addState(t, 'EquationDimension', 3)
t = C.addVars(t, 'F')
t = C.initVars(t, 'centers:G', 1.)
t = X.applyBCOverlaps(t, depth=1)
t1 = X.setInterpolations(t, loc='cell', storage='direct')
t1 = X.chimeraInfo(t1, type='interpolated')
t1 = X.chimeraInfo(t1, type='extrapolated')
t1 = X.chimeraInfo(t1, type='orphan')
t1 = X.chimeraInfo(t1, type='cellRatio')
t1 = X.chimeraInfo(t1, type='donorAspect')
test.testT(t1, 1)

t2 = X.setInterpolations(t, loc='cell', storage='inverse')
t2 = X.chimeraInfo(t2, type='interpolated')
t2 = X.chimeraInfo(t2, type='extrapolated')
t2 = X.chimeraInfo(t2, type='orphan')
t2 = X.chimeraInfo(t2, type='cellRatio')
t2 = X.chimeraInfo(t2, type='donorAspect')
test.testT(t2, 2)
import Connector.PyTree as X
import Converter.elsAProfile as CE
import KCore.test as test
a = G.cylinder((0, 0, 0), 1., 3., 360, 0, 1, (200, 30, 2))
a[0] = 'cylindre1'
C._addBC2Zone(a, 'wall1', 'BCWall', 'jmin')
C._addBC2Zone(a, 'ov1', 'BCOverlap', 'jmax')
b = G.cylinder((4, 0, 0), 1., 3., 360, 0, 1, (200, 30, 2))
b[0] = 'cylindre2'
C._addBC2Zone(b, 'wall1', 'BCWall', 'jmin')
C._addBC2Zone(b, 'ov1', 'BCOverlap', 'jmax')
c1 = G.cart((-5., -7.5, 0), (15. / 200, 15. / 200, 1), (100, 200, 2))
c2 = G.cart((2.425, -7.5, 0), (15. / 200, 15. / 100, 1), (100, 100, 2))
t = C.newPyTree(['Corps1', 'Corps2', 'Bgrd'])
t[2][1][2].append(a)
t[2][2][2].append(b)
t[2][3][2] += [c1, c2]
t = X.connectMatch(t, dim=2)
t = X.connectNearMatch(t, dim=2)
t = X.applyBCOverlaps(t, depth=1)
# blanking
C._initVars(
    t[2][3],
    '{centers:cellN}={centers:cellN}*(1.-({centers:CoordinateX}<2)*({centers:CoordinateX}>-2)*({centers:CoordinateY}<2)*({centers:CoordinateY}>-2))'
)
t = X.setInterpolations(t, loc='cell', storage='inverse')
t = X.cellN2OversetHoles(t)
#C._initVars(t,"centers:TurbulentDistance",1.)
CE._convert2elsAxdt(t)
test.testT(t, 1)
Пример #12
0
import Generator.PyTree as G
import Connector.PyTree as X

a = G.cylinder((0,0,0),1.,3.,360,0,1,(200,30,3)); 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,3)); b[0] = 'cylindre2'
b = C.addBC2Zone(b, 'wall1', 'BCWall', 'jmin')
b = C.addBC2Zone(b, 'ov1', 'BCOverlap', 'jmax')
c = G.cart((-5.,-7.5,0), (15./200,15./200,1), (200,200,3))
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=2)
t = C.fillEmptyBCWith(t,'nref','BCFarfield', dim=3)
t = X.applyBCOverlaps(t, depth=2)
t = X.setInterpolations(t, storage = 'direct')

C._addVars(t,'centers:Density')
C._addVars(t,'centers:MomentumX')
C._addVars(t,'centers:MomentumY') 
C._addVars(t,'centers:MomentumZ')
C._addVars(t,'centers:StagnationEnergy')
for i in range(len(t[2])):
    C._initVars(t[2][i], 'centers:Density', float(i+1))
    C._initVars(t[2][i], 'centers:MomentumX', float(i+1))
    C._initVars(t[2][i], 'centers:MomentumY', float(i+1))
    C._initVars(t[2][i], 'centers:MomentumZ', float(i+1))
    C._initVars(t[2][i], 'centers:StagnationEnergy', float(i+1))
t = X.chimeraTransfer(t, storage='direct', variables=['centers:Density','centers:MomentumX','centers:MomentumY','centers:MomentumZ','centers:StagnationEnergy'])
C.convertPyTree2File(t, 'out.cgns')
# - setInterpolations (pyTree)-
# Cas double wall
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, 2, 0, 360, 1, (60, 20, 2) )
b = G.cylinder( (0,0,0), 1, 2, 3, 160, 1, (30, 20, 2) )
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])
a = C.addBC2Zone(a, 'nref', 'BCFarfield', 'jmax')
b = C.addBC2Zone(b, 'wall', 'BCWall', 'jmin')
b = C.fillEmptyBCWith(b,'overlap','BCOverlap',dim=2)
t = C.newPyTree(['Base','Base2']); t[2][1][2] = [a]; t[2][2][2] = [b]
t = C.initVars(t,'Density',1.); t = C.initVars(t,'centers:G',10.)
t[2][1] = C.addState(t[2][1], 'EquationDimension',2)
# # depth = 2
t1 = X.applyBCOverlaps(t, depth=2)
t1 = X.setInterpolations(t1, loc='cell', double_wall=1)
test.testT(t1,1)
# depth = 1
t2 = X.applyBCOverlaps(t, depth=1)
t2 = X.setInterpolations(t2, loc='face', double_wall=1)
t2 = X.setInterpolations(t2, loc='cell', double_wall=1)
test.testT(t2,2)

# blanking
t = X.blankCells(t, bodies, BM, depth=DEPTH, dim=2)
# compute OversetHoles nodes
t = X.cellN2OversetHoles(t)
# set interpolated points around blanked points
t = X.setHoleInterpolatedPoints(t, depth=DEPTH)

# ==============================================================================
# 3. Compute interpolation coefficients
#    and generate files readable by elsA with keys:
#    num.set('chm_conn_io','read')
#    num.set('chm_conn_fprefix','...')
# ==============================================================================
# for interpolated cell centers
t = X.setInterpolations(t,
                        loc='cell',
                        prefixFile='interpolationFile',
                        sameBase=1)

# for interpolated interface (only for depth = 1)
if DEPTH == 1:
    t = X.setInterpolations(t,
                            loc='face',
                            prefixFile='interpolationFile',
                            sameBase=1)

# ==============================================================================
# 4. Optional: Convert tree to elsAxdt profile (for rereading by elsAxdt)
# ==============================================================================
t = CE.convert2elsAxdt(t)

# ==============================================================================