Пример #1
0
# - dist2WallsEikonal (pyTree) -
import Converter.PyTree as C
import Connector.PyTree as X
import Converter.Internal as Internal
import Dist2Walls.PyTree as DTW
import Geom.PyTree as D
import Generator.PyTree as G
import numpy

DEPTH = 2
snear = 0.4; vmin = 21

# Init wall
body = D.circle((0,0,0),1.,N=60)
res = G.octree([body],[snear], dfar=5., balancing=1)
res = G.octree2Struct(res, vmin=vmin, ext=DEPTH+1,merged=1)
t = C.newPyTree(['Base']); t[2][1][2] = res

# Mark solid and fluid points
t = X.applyBCOverlaps(t,depth=DEPTH,loc='nodes')
tc = Internal.copyRef(t)
tc = X.setInterpData(t,tc,loc='nodes',storage="inverse")
C._initVars(t,"cellN",1.)
t = X.blankCells(t, [[body]], numpy.array([[1]]), blankingType='node_in')
t = X.setHoleInterpolatedPoints(t,depth=1,loc='nodes')
C._initVars(t,'flag=({cellN}>1.)')
t = DTW.distance2WallsEikonal(t,body,tc=tc,DEPTH=DEPTH,nitmax=10)
C.convertPyTree2File(t, 'out.cgns')
# Init wall
body = D.circle((0, 0, 0), 1., N=60)
res = G.octree([body], [snear], dfar=5., balancing=1)
res = G.octree2Struct(res, vmin=vmin, ext=DEPTH + 1, merged=1)
t = C.newPyTree(['Base', res])

# Mark solid and fluid points
X._applyBCOverlaps(t, depth=DEPTH, loc='nodes')
tc = Internal.copyRef(t)
tc = X.setInterpData(t, tc, loc='nodes', storage="inverse")
C._initVars(t, "cellN", 1.)
t = X.blankCells(t, [[body]], numpy.array([[1]]), blankingType='node_in')
X._setHoleInterpolatedPoints(t, depth=1, loc='nodes')
C._initVars(t, '{flag}=({cellN}>1.)')
t = DTW.distance2WallsEikonal(t, body, tc=tc, DEPTH=DEPTH, nitmax=10)
test.testT(t, 1)
# aux centres
t = C.newPyTree(['Base'])
t[2][1][2] = res
Internal._rmNodesFromName(t, "FlowSolution")
# Mark solid and fluid points
X._applyBCOverlaps(t, depth=DEPTH, loc='centers')
tc = C.node2Center(t)
tc = X.setInterpData(t, tc, loc='centers', storage="inverse")
C._initVars(t, "centers:cellN", 1.)
t = X.blankCells(t, [[body]], numpy.array([[1]]), blankingType='center_in')
X._setHoleInterpolatedPoints(t, depth=1)
C._initVars(t, '{centers:flag}=({centers:cellN}>1.)')
t = DTW.distance2WallsEikonal(t,
                              body,
Пример #3
0
DEPTH = 2
# Bloc cartesien
N = 128; h = 0.1
a = G.cart((0.,0.,0.),(h,h,h),(N,N,1))
# Init wall
sphere = D.sphere((6.4,6.4,0), 1., 100)
sphere = C.convertArray2Tetra(sphere)
sphere = G.close(sphere)
t = C.newPyTree(['Base']); t[2][1][2] = [a]; 
C._initVars(t,'cellN=1')
t = X.blankCellsTri(t, [[sphere]], numpy.array([[1]]), blankingType='node_in')
# Condition aux limites
t = X.setHoleInterpolatedPoints(t,depth=1,loc='nodes')
C._initVars(t,'flag=({cellN}>1.)')
t = DTW.distance2WallsEikonal(t,sphere,DEPTH=DEPTH,nitmax=10)
C.convertPyTree2File(t, 'out.cgns')

# Bloc cartesien
N = 64; h = 0.2
a = G.cart((0.,0.,0.),(h,h,h),(N,N,1)); a[0] = 'cart2'
# Init wall
sphere = D.sphere((6.4,6.4,0), 1., 100)
sphere = C.convertArray2Tetra(sphere)
sphere = G.close(sphere)
t = C.newPyTree(['Base']); t[2][1][2] = [a]
C._initVars(t,'cellN=1.')
t = X.blankCellsTri(t, [[sphere]], numpy.array([[1]]), blankingType='node_in')
t = X.setHoleInterpolatedPoints(t,depth=1,loc='nodes')
# Initialise le front
C._initVars(t,'flag=({cellN}>1.)')
Пример #4
0
# Bloc cartesien
N = 128
h = 0.1
a = G.cart((0., 0., 0.), (h, h, h), (N, N, 1))

# Init wall
sphere = D.sphere((6.4, 6.4, 0), 1., 100)
sphere = C.convertArray2Tetra(sphere)
sphere = G.close(sphere)
t = C.newPyTree(['Base', a])
C._initVars(t, 'cellN', 1)
t = X.blankCellsTri(t, [[sphere]], numpy.array([[1]]), blankingType='node_in')
# Condition aux limites
t = X.setHoleInterpolatedPoints(t, depth=1, loc='nodes')
C._initVars(t, '{flag}=({cellN}>1.)')
t = DTW.distance2WallsEikonal(t, sphere, tc=None, DEPTH=DEPTH, nitmax=10)
test.testT(t, 1)

# En centres
# Bloc cartesien
N = 128
h = 0.1
a = G.cart((0., 0., 0.), (h, h, h), (N, N, 1))

# Init wall
sphere = D.sphere((6.4, 6.4, 0), 1., 100)
sphere = C.convertArray2Tetra(sphere)
sphere = G.close(sphere)
t = C.newPyTree(['Base'])
t[2][1][2] = [a]
C._initVars(t, 'centers:cellN', 1)