예제 #1
0
s = P.exteriorFaces(s)
t = C.newPyTree(['Base'])
t[2][1][2] = [a]
# 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 = I.initConst(t, MInf=0.2, loc='centers')
tc = C.node2Center(t)
t = X.setIBCData(t, tc, loc='centers', storage='direct')

#test avec arbre tc compact
zones = Internal.getNodesFromType2(t, 'Zone_t')
X.miseAPlatDonnorTree__(zones, t, procDict=None)

t2 = X.setInterpTransfers(t, tc, bcType=0, varType=1)
test.testT(t2, 1)

t2 = X.setInterpTransfers(t, tc, bcType=1, varType=1)
test.testT(t2, 2)

#
# variable turbulente SA
#
t = C.initVars(t, 'centers:TurbulentSANuTilde', 100.)
s = G.close(s)
t = C.newPyTree(['Base', a])

# Blanking
bodies = [[s]]
BM = numpy.array([[1]], numpy.int32)
t = X.blankCells(t, bodies, BM, blankingType='center_in')
t = X.setHoleInterpolatedPoints(t, depth=-2)
# Dist2Walls
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')
I._initConst(t, MInf=0.2, loc='centers')
tc = C.node2Center(t)

tb = C.newPyTree(['Base', s])
C._addState(tb, 'EquationDimension', 3)
C._addState(tb, 'GoverningEquations', 'NSTurbulent')

tp = X.setIBCData(t, tc, loc='centers', storage='direct', bcType=0)
t2 = X.setInterpTransfers(tp, tc, bcType=0, varType=1)
z = IBM.extractIBMWallFields(t2, tb=tb)
test.testT(z, 1)

#
tp = X.setIBCData(t, tc, loc='centers', storage='direct', bcType=3)
t2 = X.setInterpTransfers(tp, tc, bcType=3, varType=1)
z = IBM.extractIBMWallFields(t2, tb=tb)
test.testT(z, 2)
예제 #3
0
t = C.newPyTree(['Base'])
t[2][1][2] = [a]
tb = C.newPyTree(['Base'])
tb[2][1][2] = [s]

# Blanking
bodies = [[s]]
BM = N.array([[1]], N.int32)
t = X.blankCells(t, bodies, BM, blankingType='center_in')
t = X.setHoleInterpolatedPoints(t, depth=-1)
# 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')
t2 = X.setIBCData(t, t, loc='centers', storage='direct')
test.testT(t2, 1)
t2 = X.setIBCData(t, t, loc='centers', storage='direct', hi=0.1)
test.testT(t2, 2)

# NODES
t = C.newPyTree(['Base'])
t[2][1][2] = [a]
# Blanking
bodies = [[s]]
BM = N.array([[1]], N.int32)
t = X.blankCells(t, bodies, BM, blankingType='node_in')
t = X.setHoleInterpolatedPoints(t, depth=-1)
# Dist2Walls
t = DTW.distance2Walls(t, [s], type='ortho', loc='nodes', signed=1)
# Gradient de distance localise en centres => normales
예제 #4
0
# - setIBCData (pyTree) -
import Converter.PyTree as C
import Generator.PyTree as G
import Connector.PyTree as X
import Geom.PyTree as D
import Post.PyTree as P
import numpy as N
import Dist2Walls.PyTree as DTW
import Transform.PyTree as T

a = G.cart((-1,-1,-1),(0.01,0.01,1),(201,201,3))
s = G.cylinder((0,0,-1), 0, 0.4, 360, 0, 4, (30,30,5)) 
s = C.convertArray2Tetra(s); s = T.join(s); s = P.exteriorFaces(s)
t = C.newPyTree(['Base',a])
# 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 = X.setIBCData(t, t, loc='centers', storage='direct',hi=0.03)
C.convertPyTree2File(t, "out.cgns")
s = P.exteriorFaces(s)
t = C.newPyTree(['Base', a])
# 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 = I.initConst(t, MInf=0.2, loc='centers')
tc = C.node2Center(t)
no = 1
for bcType in range(4):
    tp = X.setIBCData(t, tc, loc='centers', storage='direct', bcType=bcType)
    for varType in range(1, 4):
        t2 = X.setInterpTransfers(tp, tc, bcType=bcType, varType=varType)
        test.testT(t2, no)
        no += 1

# Stockage inverse
Internal._rmNodesByName(t, "IBCD_*")
for bcType in range(4):
    tc2 = X.setIBCData(t, tc, loc='centers', storage='inverse', bcType=bcType)
    for varType in range(1, 4):
        X._setInterpTransfers(t, tc2, bcType=bcType, varType=varType)
        test.testT(tc, no)
        no += 1
t[2][1][2] = [a]
# 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)