Exemple #1
0
import Converter.PyTree as C
import Converter.Internal as Internal
import Transform.PyTree as T
import Connector.PyTree as X
import KCore.test as test

a = G.cart((1,1,1), (1.,1.,1.), (4,2,3)); a[0]='cart1'
b = G.cart((4,1,1), (0.5,1.,1.), (4,2,3)); b[0]='cart2'
c = G.cart((1,1,-3), (1.,1.,0.5), (4,2,9)); c[0]='cart3'

a = T.reorder(a, (-2,1,3))
b = T.reorder(b, (1,2,3))
c = T.reorder(c, (3,1,2))

# Physical BC (here BCWall)
C._addBC2Zone(a, 'wall1', 'BCWall', 'jmin')

# Chimere
#-----------------------------
# initialisation cellNatureField
C._initVars(a, 'centers:cellN', 1.)
C._initVars(b, 'centers:cellN', 0.)
#-----------------------------
# initialisation density
C._initVars(a, '{Density}=3.*{CoordinateX}+2.*{CoordinateY}')
C._initVars(a, 'StagnationPressure', 0.5)
C._initVars(c, 'StagnationPressure', 1.)
t = C.newPyTree(['Base',a,b,c])
# Matching BC
t = X.connectMatch(t)
a = t[2][1][2][0]
# - overlapGC2BC (pyTree) -
import Converter.PyTree as C
import Generator.PyTree as G
import Converter.elsAProfile as CE
import KCore.test as test

# - Structured grids -
a = G.cylinder((0, 0, 0), 1., 1.5, 0., 360., 1., (80, 30, 2))
b = G.cart((-0.1, 0.9, 0), (0.01, 0.01, 1.), (20, 20, 2))

# Physical BC (here BCWall)
C._addBC2Zone(a, 'wall1', 'BCWall', 'jmin')
# Overlap BC (with automatic donor zones)
C._addBC2Zone(a, 'overlap1', 'BCOverlap', [1, 80, 30, 30, 1, 2])
# Overlap BC (with given donor zones and doubly defined)
C._addBC2Zone(a,
              'overlap2',
              'BCOverlap',
              'jmin',
              zoneDonor=[b],
              rangeDonor='doubly_defined')
t = C.newPyTree(['BaseA', a, 'BaseB', b])
tp = CE.overlapGC2BC(t)
test.testT(tp, 1)
# in place
CE._overlapGC2BC(t)
test.testT(t, 1)

# - Structured grids -
a = G.cylinder((0, 0, 0), 1., 1.5, 0., 360., 1., (80, 30, 2))
b = G.cart((-0.1, 0.9, 0), (0.01, 0.01, 1.), (20, 20, 2))
Exemple #3
0
# - setDoublyDefinedBC (pyTree) -
import Converter.PyTree as C
import Connector.PyTree as X
import Generator.PyTree as G
import Transform.PyTree as T
import Converter.Internal as Internal
a = G.cart((0, 0, 0), (1, 1, 1), (10, 10, 10))
b = G.cart((2.5, 2.5, -2.5), (0.5, 0.5, 0.5), (10, 10, 30))
b[0] = 'fente'
b = T.splitNParts(b, 2)
C._addBC2Zone(a,
              'overlap1',
              'BCOverlap',
              'kmin',
              zoneDonor=['FamilySpecified:FENTE'],
              rangeDonor='doubly_defined')
t = C.newPyTree(['Base1', 'Base2'])
t[2][1][2].append(a)
t[2][2][2] += b
C._addFamily2Base(t[2][2], 'FENTE')
for z in Internal.getZones(t[2][2]):
    C._tagWithFamily(z, 'FENTE')
C._initVars(t, 'centers:cellN', 1)
t = X.applyBCOverlaps(t)
t = X.setDoublyDefinedBC(t)
C.convertPyTree2File(t, 'out.cgns')
# - addGhostCells with periodicity -
import Generator.PyTree as G
import Converter.PyTree as C
import Converter.Internal as Internal
import math
import KCore.test as test
ni = 11; nj = 5; nk = 3
dk = 1./max(1,(nk-1))
a = G.cart((0.2,0,0),(1./(ni-1), 1./(nj-1),dk),(ni,nj,nk))
C._initVars(a,'{VelocityX}={CoordinateX}')
C._initVars(a,'{VelocityY}={CoordinateY}')
C._initVars(a,'VelocityZ', 1.)
C._addBC2Zone(a,'per1','BCMatch',[1,1,1,nj,1,nk], zoneDonor=a,
              rangeDonor=[ni,ni,1,nj,1,nk], trirac=[1,2,3],
              rotationCenter=(0,0,0), rotationAngle=(0.,0.,0.),
              translation=(+1.,0.,0.))
C._addBC2Zone(a,'per2','BCMatch',[ni,ni,1,nj,1,nk], zoneDonor=a,
              rangeDonor=[1,1,1,nj,1,nk], trirac=[1,2,3],
              rotationCenter=(0,0,0), rotationAngle=(0.,0.,0.),
              translation=(-1.,0.,0.))

t = C.newPyTree(['Base',a])
t = Internal.addGhostCells(t,t,2,adaptBCs=1,fillCorner=1)
test.testT(t,1)

# cas periodicite par rotation
ni = 91; nj = 21; nk = 1
alpha = 90.
a = G.cylinder((0,0,0),0.5,1.,0.,alpha,1.,(ni,nj,nk))
C._initVars(a,'VelocityX', 0.)
C._initVars(a,'VelocityY', 0.)
# - setInterpData (pyTree)-
# cas structure 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, 3) )
b = G.cylinder( (0,0,0), 1, 2, 3, 160, 1, (30, 20, 3) )
C._addBC2Zone(a, 'wall', 'FamilySpecified:SKN1', 'jmin') 
C._addBC2Zone(a, 'match', 'BCMatch', 'imin', a, 'imax', trirac=[1,2,3])
C._addBC2Zone(a, 'match', 'BCMatch', 'imax', a, 'imin', trirac=[1,2,3])
C._addBC2Zone(b, 'wall', 'BCWall', 'jmin')
C._addBC2Zone(b, 'wall', 'FamilySpecified:SKN2', 'jmin') 
C._addBC2Zone(b, 'overlap', 'BCOverlap', 'imin')
C._addBC2Zone(b, 'overlap', 'BCOverlap', 'imax')
t = C.newPyTree(['Base',a,'Base2',b])
C._fillEmptyBCWith(t,'nref','BCFarfield')
C._initVars(t,'Density',1.); C._initVars(t,'centers:G',10.)
C._addState(t[2][1], 'EquationDimension',2)
C._addFamily2Base(t[2][1], 'SKN1', bndType="BCWall") 
C._addFamily2Base(t[2][2], 'SKN2', bndType="BCWall") 

t1 = X.applyBCOverlaps(t, depth=2) 
t1[2][2] = X.setInterpData(t1[2][2],t1[2][1], double_wall=0,loc='centers')
test.testT(t1,1)
Exemple #6
0
def setBCWith():
    if CTK.t == []: return
    if CTK.__MAINTREE__ != CTK.UNDEFINEDBC:
        CTK.TXT.insert('START',
                       'Fail on a this tree (view undefined BC before).\n')
        CTK.TXT.insert('START', 'Error: ', 'Error')
        return

    nzs = CPlot.getSelectedZones()
    if nzs == []: return
    typeBC = VARS[6].get()
    if typeBC not in Internal.KNOWNBCS:
        nameBC = typeBC
        typeBC = 'FamilySpecified:' + typeBC
    else:
        nameBC = typeBC

    node = Internal.getNodeFromName(CTK.t, 'EquationDimension')
    if node is not None: ndim = Internal.getValue(node)
    else:
        CTK.TXT.insert('START',
                       'EquationDimension not found (tkState). Using 3D.\n')
        CTK.TXT.insert('START', 'Warning: ', 'Warning')
        ndim = 3

    splitFactor = 180. - WIDGETS['splitFactor'].get() * 180. / 100.
    if __SPLITFACTOR__ != splitFactor:
        CTK.TXT.insert('START',
                       'Split factor changed: view undefinedBC again.\n')
        CTK.TXT.insert('START', 'Error: ', 'Error')
        return

    CTK.saveTree()
    wins = C.getEmptyBC(CTK.t, ndim, splitFactor)
    bases = Internal.getBases(CTK.t)
    for nz in nzs:  # pour chaque zone selectionnee
        c = 0
        nob = 0
        for wb in wins:  # par base
            b = bases[nob]
            zones = Internal.getNodesFromType1(b, 'Zone_t')
            noz = 0
            for wz in wb:  # par zone
                z = zones[noz]
                dim = Internal.getZoneDim(z)
                for w in wz:
                    if c == nz:
                        if dim[0] == 'Structured':  # structure
                            C._addBC2Zone(z, nameBC, typeBC, w)
                        elif dim[0] == 'Unstructured' and dim[3] == 'NGON':
                            C._addBC2Zone(z, nameBC, typeBC, faceList=w)
                        else:  # BE + BCC
                            zp = T.subzone(z, w, type='faces')
                            zp[0] = C.getZoneName(zp[0])
                            C._addBC2Zone(z, nameBC, typeBC, subzone=zp)
                    c += 1
                noz += 1
            nob += 1
        #print 'BC is ', w, 'corresponding ', nob-1, noz-1
    CTK.TXT.insert('START', 'BCs set to %s.\n' % typeBC)
    CTK.TKTREE.updateApp()
    check()
Exemple #7
0
    I.newDataArray('SkewAngle', value=skewang, parent=f)
    I.newDataArray('GrowthZ', value=growthz, parent=f)
    I.newDataArray('GrowthN', value=growthn, parent=f)
    C.convertPyTree2File(t, f'{project_name}.dat', format='fmt_tp')

    # Create Family
    fwall = I.newFamily(name='Wall', parent=b)
    fnref = I.newFamily(name='NRef', parent=b)
    fsym = I.newFamily(name='Sym', parent=b)

    # Create join
    t = X.connectMatch(t, tol=1.e-9, dim=3 if dz > 0. else 2)

    # Create BC
    if sharp:
        C._addBC2Zone(t, 'nref', 'FamilySpecified:NRef', 'imin')
        C._addBC2Zone(t, 'nref', 'FamilySpecified:NRef', 'imax')
        C._addBC2Zone(t, 'wall', 'FamilySpecified:Wall', 'jmin')
        C._addBC2Zone(t, 'nref', 'FamilySpecified:NRef', 'jmax')
    else:
        C._addBC2Zone(t, 'wall', 'FamilySpecified:Wall', 'jmin')
        C._addBC2Zone(t, 'nref', 'FamilySpecified:NRef', 'jmax')

    if dz > 0.:
        C._addBC2Zone(t, 'sym', 'FamilySpecified:Sym', 'kmin')
        C._addBC2Zone(t, 'sym', 'FamilySpecified:Sym', 'kmax')

    # allbcs = []
    # nref = trf.BCNRef(t, fnref)
    # allbcs.append(nref)
    # wall = trf.BCWallAdia(t, fwall)
# - blanCells (pyTree) -
# - cas 2D -
import Converter.PyTree as C
import Connector.PyTree as X
import Generator.PyTree as G
import Geom.PyTree as D
import KCore.test as test

surf = D.circle((0,0,0), 0.5, 20)

a = G.cart((-1.,-1.,0.),(0.1,0.1,1), (20,20,1))
C._addBC2Zone(a, 'ov', 'BCOverlap', 'jmin')
t = C.newPyTree(['Cart',2,a])
t[2][1] = C.addState(t[2][1], 'EquationDimension', 2)
C._fillEmptyBCWith(t, 'wall', 'BCWall')
C._addVars(t, 'Density')
C._initVars(t, 'centers:cellN', 1.)
bodies = [[surf]]
criterions = ['cell_intersect', 'cell_intersect_opt', 'center_in']
# Matrice de masquage (arbre d'assemblage)
import numpy
BM = numpy.array([[1]])
c = 1
for delta in [0.,0.1]:
    for type in criterions:
        if (type == 'cell_intersect_opt' and delta > 0): c += 1
        else:
            t2 = X.blankCells(t, bodies, BM,
                              blankingType=type, delta=delta,
                              dim=2)
            test.testT(t2,c)
    d = Internal.newBCData('BCNeumann', parent=d)
    if dim == 2: nfaces = (N - 1)
    else: nfaces = (N - 1)**2
    d1 = Internal.newDataArray('Density', value=nfaces * [1. * nobc], parent=d)
    d2 = Internal.newDataArray('G', value=nfaces * [-1. * nobc], parent=d)
    nobc += 1
C._initVars(a, 'centers:Density', 2.)
C._initVars(a, 'centers:G', 2.)
t = C.newPyTree(['Base', a, dim])
t = Internal.addGhostCells(t, t, 2)
test.testT(t, 1)
#
N = 10
dim = 3
a = G.cart((0, 0, 0), (1, 1, 1), (N, N, N))
C._addBC2Zone(a, 'wall', 'BCWall', 'imin')
C._addBC2Zone(a, 'wall', 'BCWall', 'jmax')
nobc = 1
for b in Internal.getNodesFromName(a, 'wall*'):
    d = Internal.newBCDataSet(name='BCDataSet',
                              value='UserDefined',
                              gridLocation='FaceCenter',
                              parent=b)
    d = Internal.newBCData('BCNeumann', parent=d)
    if dim == 2: nfaces = (N - 1)
    else: nfaces = (N - 1)**2
    d1 = Internal.newDataArray('Density', value=nfaces * [1. * nobc], parent=d)
    d2 = Internal.newDataArray('G', value=nfaces * [-1. * nobc], parent=d)
    nobc += 1
C._initVars(a, 'centers:Density', 2.)
C._initVars(a, 'centers:G', 2.)
Exemple #10
0
# - addGhostCells (pyTree) -
import Generator.PyTree as G
import Converter.PyTree as C
import Converter.Internal as Internal
import Transform.PyTree as T
import Connector.PyTree as X
import KCore.test as test
#
# 3D Case
y0 = 0.; dimPb = 3; nk = 3
a = G.cart((0.,0.,0.), (0.1, 0.1, 0.1), (11, 21,nk))
C._initVars(a, '{centers:Density}={centers:CoordinateX}')
C._initVars(a, '{F}={CoordinateY}*{CoordinateX}')
C._addBC2Zone(a, 'wall1', 'BCWall', 'jmin')
# partiellement coincident
a2 = G.cart((1.,y0, 0.), (0.1, 0.1, 0.1), (11, 21,nk))
a2 = T.oneovern(a2,(2,2,1))
C._initVars(a2, '{centers:Density}={centers:CoordinateX}')
C._initVars(a2, '{F}={CoordinateY}*{CoordinateX}')
C._addBC2Zone(a2, 'overlap1', 'BCOverlap', 'imax')
t = C.newPyTree(['Base',a,a2])
t = X.connectNearMatch(t,2,dim=dimPb)
t = Internal.addGhostCells(t,t,2,adaptBCs=0,fillCorner=1)
test.testT(t,1)
#
t = C.newPyTree(['Base',a,a2])
C._addState(t[2][1], 'EquationDimension',dimPb)
t = X.connectNearMatch(t,2)
t = Internal.addGhostCells(t,t,2,adaptBCs=1,fillCorner=1)
test.testT(t,2)
Exemple #11
0
# - fillNeighbourList (pyTree) -
import Converter.PyTree as C
import Generator.PyTree as G
import Converter.elsAProfile as elsAProfile

# - Structured grids -
a = G.cylinder((0, 0, 0), 1., 1.5, 0., 360., 1., (80, 30, 2))
b = G.cart((-0.1, 0.9, 0), (0.01, 0.01, 1.), (20, 20, 2))
# Physical BC (here BCWall)
C._addBC2Zone(a, 'wall1', 'BCWall', 'jmin')
# Overlap BC (with automatic donor zones)
C._addBC2Zone(a, 'overlap', 'BCOverlap', 'imin')
C._addBC2Zone(a, 'overlap1', 'BCOverlap', [1, 80, 30, 30, 1, 2])
# Overlap BC (with given donor zones and doubly defined)
C._addBC2Zone(a,
              'overlap2',
              'BCOverlap',
              'jmin',
              zoneDonor=[b],
              rangeDonor='doubly_defined')
C._addBC2Zone(b,
              "OverlapDD",
              "BCOverlap",
              'imin',
              zoneDonor=[a],
              rangeDonor='doubly_defined')
t = C.newPyTree(['BaseA', 'BaseB'])
t[2][1][2] = [a]
t[2][2][2] = [b]
elsAProfile._overlapGC2BC(t)
elsAProfile._rmGCOverlap(t)
# - setInterpData (pyTree)-
# cas structure 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, 3) )
b = G.cylinder( (0,0,0), 1, 2, 3, 160, 1, (30, 20, 3) )
C._addBC2Zone(a, 'wall', 'BCWall', 'jmin')
C._addBC2Zone(a, 'match', 'BCMatch', 'imin', a, 'imax', trirac=[1,2,3])
C._addBC2Zone(a, 'match', 'BCMatch', 'imax', a, 'imin', trirac=[1,2,3])
C._addBC2Zone(b, 'wall', 'BCWall', 'jmin')
#b = C.addBC2Zone(b, 'wall', 'FamilySpecified:SKN', 'jmin') 
C._addBC2Zone(b, 'overlap', 'BCOverlap', 'imin')
C._addBC2Zone(b, 'overlap', 'BCOverlap', 'imax')
t = C.newPyTree(['Base',a,'Base2',b])
C._fillEmptyBCWith(t,'nref','BCFarfield')
C._initVars(t,'Density',1.); C._initVars(t,'centers:G',10.)
C._addState(t[2][1], 'EquationDimension',2)

t1 = X.applyBCOverlaps(t, depth=2) 
t1[2][2] = X.setInterpData(t1[2][2],t1[2][1], double_wall=0, loc='centers')
test.testT(t1,1)

t1 = X.applyBCOverlaps(t, depth=2)
t1 = C.center2Node(t1,['centers:cellN'])
t1[2][2] = X.setInterpData(t1[2][2],t1[2][1], double_wall=0, loc='nodes')
test.testT(t1,2)    
H2 = 4 * H
NK = 2 * int(H2) + 1
b = G.cylinder((0., 0., -H), 0.1, 1., -30., 120., 3 * H, (11, 11, NK))
t[2][2][2] += [b]
# Same as second test, but now using an intersection dictionnary
InterDict = X.getIntersectingDomains(t, method='hybrid')
t2 = X.optimizeOverlap(t, intersectionsDict=interDict)
test.testT(t2, 5)
# Second test:
t = X.optimizeOverlap(t)
test.testT(t, 2)

# cas double wall
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))
C._addBC2Zone(a, 'wall', 'BCWall', 'jmin')
C._addBC2Zone(a, 'match', 'BCMatch', 'imin', a, 'imax', trirac=[1, 2, 3])
C._addBC2Zone(a, 'match', 'BCMatch', 'imax', a, 'imin', trirac=[1, 2, 3])
C._addBC2Zone(a, 'nref', 'BCFarfield', 'jmax')
C._addBC2Zone(b, 'wall', 'BCWall', 'jmin')
C._fillEmptyBCWith(b, 'overlap', 'BCOverlap', dim=2)
t = C.newPyTree(['Base', a, 'Base2', b])
C._initVars(t, 'Density', 1.)
C._initVars(t, 'centers:cellN', 1)
C._addState(t[2][1], 'EquationDimension', 2)
t = X.connectMatchPeriodic(t, translation=(0, 0, 1))
# Same as third test, but now using an Intersection Dictionnary
InterDict = X.getIntersectingDomains(t, method='hybrid')
t3 = X.optimizeOverlap(t,
                       double_wall=1,
                       priorities=['Base2', 0, 'Base', 1],
import Connector.PyTree as X
import Converter.PyTree as C
import Converter.Internal as Internal
import Transform.PyTree as T
import KCore.test as test

LOCAL = test.getLocal()

NK = 2
DIM = 3
if NK == 2: DIM = 2
a = G.cylinder((0, 0, 0), 1, 2, 10, 130, 1, (60, 20, NK))
a[0] = 'cyl1'
b = G.cylinder((0, 0, 0), 1, 1.5, 0, 30, 1, (30, 20, NK))
b[0] = 'cyl2'
C._addBC2Zone(a, 'wall', 'BCWall', 'jmin')
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,
# - subzone (pyTree)-
# Maillages structures + frontieres
import Converter.PyTree as C
import Transform.PyTree as T
import Generator.PyTree as G
import KCore.test as test

# 3d structure
a = G.cart((0, 0, 0), (1, 1, 1), (10, 20, 10))
C._addBC2Zone(a, 'wall1', 'BCWall', 'jmin')
C._addBC2Zone(a, 'match1', 'BCMatch', 'imax', a, 'imin', [1, 2, 3])
C._addBC2Zone(a, 'overlap1', 'BCOverlap', 'jmax')
C._initVars(a, 'centers:celln', 1.)
C._initVars(a, '{centers:G}={centers:CoordinateX}')
C._initVars(a, '{Density}=3*{CoordinateX}*{CoordinateY}')
t = C.newPyTree(['Base'])
t[2][1][2].append(a)
t[2][1] = C.addState(t[2][1], 'EquationDimension', 3)
t = T.subzone(t, (3, 1, 3), (7, 8, 5))
test.testT(t, 1)
#
# 2D structure
#
a = G.cart((0, 0, 0), (1, 1, 1), (10, 20, 1))
C._addBC2Zone(a, 'wall1', 'BCWall', 'jmin')
C._addBC2Zone(a, 'match1', 'BCMatch', 'imax', a, 'imin', [1, 2])
C._addBC2Zone(a, 'overlap1', 'BCOverlap', 'jmax')
C._initVars(a, 'centers:celln', 1.)
C._initVars(a, '{centers:G}={centers:CoordinateX}')
C._initVars(a, '{Density}=3*{CoordinateX}*{CoordinateY}')
t = C.newPyTree(['Base', 2])
Exemple #16
0
# - prefixDnrInSubRegions (pyTree) -
import Converter.PyTree as C
import Generator.PyTree as G
import Connector.PyTree as X
import Converter.elsAProfile as elsAProfile

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')
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)
C._fillEmptyBCWith(t, 'nref', 'BCFarfield', dim=2)
t = X.applyBCOverlaps(t, depth=1)
t = X.setInterpolations(t, loc='cell')
elsAProfile._prefixDnrInSubRegions(t)
C.convertPyTree2File(t, "out.cgns")
# - addFlowSolution (pyTree) -
import Converter.PyTree as C
import Generator.PyTree as G
import Converter.elsAProfile as elsAProfile
import KCore.test as test

a = G.cart( (0,0,0), (1,1,1), (10,10,10) )
C._addBC2Zone(a,"wall","BCWall","imin")
C._initVars(a,'centers:Density',1.)

t = C.newPyTree(['Base', a])
C.addState2Node__(t[2][1],'GoverningEquations','Euler')
notest = 1
VARS_CONS=["Density","MomentumX","MomentumY","MomentumZ","EnergyStagnationDensity"]
VARS_SA = ["TurbulentSANuTildeDensity"]
outputDict={}
outputDict["tata"]=0
outputDict["toto"]='machaine'
notest = 1
for name in ["","#OUT"]:
    tp = elsAProfile.addFlowSolution(t, name=name,variables=[])
    test.testT(tp,notest)
    notest+=1
for loc in ["Vertex","CellCenter","cellfict"]:
    tp = elsAProfile.addFlowSolution(t,loc=loc,variables=[])
    test.testT(tp,notest)
    notest+=1
for variables in [None,[],VARS_CONS,VARS_CONS+VARS_SA]:
    tp = elsAProfile.addFlowSolution(t,variables=variables)
    test.testT(tp,notest)
    notest+=1
Exemple #18
0
# - importVariables (pyTree) -
import Converter.PyTree as C
import Generator.PyTree as G
import Post.PyTree as P
import Converter.Internal as Internal
import KCore.test as test

# z2 sans solutions
z1 = G.cart((0., 0., 0.), (0.1, 0.1, 0.1), (3, 3, 3))
C._addBC2Zone(z1, 'overlap', 'BCOverlap', 'imin')
C._fillEmptyBCWith(z1, 'nref', 'BCFarfield')
t1 = C.newPyTree(['Base', z1])
t2 = Internal.copyRef(t1)
C._initVars(t1, 'centers:cellN', 1.)
C._initVars(t1, 'Pressure', 10.)
C._initVars(t1, 'Density', 1.)
C._addState(t1[2][1], 'Mach', 0.6)
C._addState(t2[2][1], 'Mach', 0.6)
t2 = P.importVariables(t1, t2)
test.testT(t2, 1)

# z2 avec cellN = 0
C._initVars(t2, 'centers:cellN', 0.)
t2 = P.importVariables(t1, t2)
test.testT(t2, 2)

# z1 en centres avec z2 sans solution
Internal._rmNodesByType(t2, 'FlowSolution_t')
t1 = C.node2Center(t1)
t2 = P.importVariables(t1, t2)
test.testT(t2, 3)
Exemple #19
0
# - close (pyTree) -
import Converter.PyTree as C
import Generator.PyTree as G
import KCore.test as test

a1 = G.cart((0, 0, 0), (1, 1, 1), (10, 10, 1))
a1[0] = 'cart1'
a2 = G.cart((9 + 1.e-2, 0, 0), (1, 1, 1), (10, 10, 1))
a2[0] = 'cart2'
a3 = G.cart((0, -5.01, 0), (1, 1, 1), (19, 6, 1))
a3[0] = 'cart3'
a4 = G.cart((0, 9.0001, 0), (1, 1, 1), (10, 6, 1))
a4[0] = 'cart4'
a5 = G.cart((9.01, 9.0002, 0), (1, 1, 1), (10, 6, 1))
a5[0] = 'cart5'

zones = [a1, a2, a3, a4, a5]
for z in zones:
    C._addBC2Zone(z, 'match1', 'BCMatch', 'imin', z, 'imax', [1, 2])
    C._addBC2Zone(z, 'match2', 'BCMatch', 'imax', z, 'imin', [1, 2])
    C._addBC2Zone(z, 'wall1', 'BCWall', 'jmin')
    C._addBC2Zone(z, 'wall2', 'BCWall', 'jmax')

zones = C.addVars(zones, 'Density')
zones = C.addVars(zones, 'centers:cellN')

# Close une liste de maillages structures
zones = G.close(zones, 1e-1)
test.testT(zones, 1)