コード例 #1
0
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
コード例 #2
0

# Donor mesh
ni = 11
nj = 11
nk = 11
m = G.cartNGon((0, 0, 0), (10. / (ni - 1), 10. / (nj - 1), 1), (ni, nj, nk))
C._initVars(m, '{F}={CoordinateX}+2*{CoordinateY}+3*{CoordinateZ}')
C._initVars(m, '{G}=10*{CoordinateX}')
C._initVars(m, 'centers:G', 1.)
# Receiver mesh
a = G.cart((0, 0, 0), (10. / (ni - 1), 10. / (nj - 1), 1), (ni, nj, nk))
a[0] = 'extraction'
C._initVars(a, 'F', -1000.)
C._initVars(a, 'G', -1000.)

# 2nd order, nodes, direct storage
t = C.newPyTree(['Rcv', 'Dnr'])
t[2][1][2] = [a]
t[2][2][2] = [m]
C._initVars(t[2][1], 'cellN', 2)
t[2][2] = X.setInterpData(t[2][1],
                          t[2][2],
                          loc='nodes',
                          storage='inverse',
                          order=2,
                          method='leastsquares')
info = X.setInterpTransfersD(t[2][2])
test.testO(info)
test.testA([info[0][1]], 2)
コード例 #3
0
# Blanking
bodies = [[s]]
BM = N.array([[1]], N.int32)
t = X.blankCells(t, bodies, BM, blankingType='center_in')
t = X.setHoleInterpolatedPoints(t, depth=-2)

# Dist2Walls
t = DTW.distance2Walls(t, [s], type='ortho', loc='centers', signed=1)
t = C.center2Node(t, 'centers:TurbulentDistance')
# Gradient de distance localise en centres => normales
t = P.computeGrad(t, 'TurbulentDistance')
t = C.rmVars(t, ['TurbulentDistance'])
t = I.initConst(t, MInf=0.2, loc='centers')
tc = C.node2Center(t)
tc = X.setIBCData(t, tc, loc='centers', storage='inverse')
info = X.setInterpTransfersD(tc)
test.testO(info)
test.testA([info[0][1]], 2)
#
# variable turbulente SA
#
tc = C.initVars(tc, 'TurbulentSANuTilde', 15.)
vars = [
    'Density', 'MomentumX', 'MomentumY', 'MomentumZ',
    'EnergyStagnationDensity', 'TurbulentSANuTilde'
]
info = X.setInterpTransfersD(tc, bcType=0, varType=11, variablesIBC=vars)
test.testO(info, 3)
test.testA([info[0][1]], 4)

info = X.setInterpTransfersD(tc, bcType=1, varType=11, variablesIBC=vars)