Esempio n. 1
0
def createBCFamily(event=None):
    if CTK.t == []: return
    name = VARS[1].get()
    if name == '':
        CTK.TXT.insert('START', 'FamilyZone name is invalid.\n')
        CTK.TXT.insert('START', 'Error: ', 'Error'); return
    nzs = CPlot.getSelectedZones()
    CTK.saveTree()
    if CTK.__MAINTREE__ <= 0 or nzs == []:
        bases = CTK.t[2]
        for b in bases:
            if b[3] == 'CGNSBase_t':
                C._addFamily2Base(b, name, 'UserDefined')
        CTK.TXT.insert('START', 'BC Family '+name+' added to all bases.\n')
    else:
        nob = CTK.Nb[nzs[0]]+1
        noz = CTK.Nz[nzs[0]]
        z = CTK.t[2][nob][2][noz]
        C._addFamily2Base(CTK.t[2][nob], name, 'UserDefined')
        CTK.TXT.insert('START', 'BC Family '+name+' added to base '+CTK.t[2][nob][0]+'.\n')
    CTK.TKTREE.updateApp()
# - getFamilyBCNamesDict (pyTree) -
import Converter.PyTree as C
import Generator.PyTree as G

a = G.cart((0., 0., 0), (0.01, 0.01, 1.), (20, 20, 2))
b = G.cart((1., 0., 0), (0.01, 0.01, 1.), (20, 20, 2))

a = C.addBC2Zone(a, 'walla', 'FamilySpecified:CARTER', 'imin')
b = C.addBC2Zone(b, 'wallb', 'FamilySpecified:CARTER', 'jmin')

t = C.newPyTree(['Base', a, b])

C._addFamily2Base(t[2][1], 'CARTER', bndType='BCWall')

# Toutes les familyBCs
dict = C.getFamilyBCNamesDict(t)
print(dict)
#>> {'CARTER': 'BCWall'}
# - getFamilyZones (pyTree) -
import Converter.PyTree as C
import Generator.PyTree as G

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

C._tagWithFamily(a, 'CYLINDER')
C._tagWithFamily(b, 'CYLINDER')
C._tagWithFamily(c, 'CART')

t = C.newPyTree(['Base',a,b,c])
C._addFamily2Base(t[2][1], 'CYLINDER')
C._addFamily2Base(t[2][1], 'CART')
zones = C.getFamilyZones(t, 'CYLINDER')
for z in zones: print(z[0])
#>> cylinder cylinder.0
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))

# 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=['FamilySpecified:FENTE'],
              rangeDonor='doubly_defined')
C._tagWithFamily(b, 'FENTE')
t = C.newPyTree(['Cylinder', a, 'Slot', b])
C._addFamily2Base(t[2][2], 'FENTE')
tp = CE.overlapGC2BC(t)
test.testT(tp, 2)
# in place
CE._overlapGC2BC(t)
test.testT(t, 2)
Esempio n. 5
0
# - getFamilyZoneNames (pyTree) -
import Converter.PyTree as C
import Generator.PyTree as G

a = G.cart((0., 0., 0), (0.01, 0.01, 1.), (20, 20, 2))
b = G.cart((1., 0., 0), (0.01, 0.01, 1.), (20, 20, 2))
C._tagWithFamily(a, 'CARTER')
C._tagWithFamily(b, 'CARTER')

t = C.newPyTree(['Base', a, b])
C._addFamily2Base(t[2][1], 'CARTER')

# Toutes les family zone names de l'arbre
names = C.getFamilyZoneNames(t)
print names
#>> ['CARTER']
# - 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)
# - addFamily2Base (pyTree) -
import Converter.PyTree as C
import Generator.PyTree as G

a = G.cylinder((0, 0, 0), 1., 1.5, 0, 360, 1, (50, 20, 20))
t = C.newPyTree(['Base', a])
# Add family name referencing a BCWall BC type
C._addFamily2Base(t[2][1], 'flap', 'BCWall')
# Add just a family name
C._addFamily2Base(t[2][1], 'component1')
C.convertPyTree2File(t, 'out.cgns')