コード例 #1
0
nj = 11
nk = 1
a = G.cart((0, 0, 0), (1. / (ni - 1), 1. / (nj - 1), 1.), (ni, nj, nk))
a = C.addBC2Zone(a, 'overlap', 'BCOverlap', 'imin')
a = C.fillEmptyBCWith(a, 'nref', 'BCFarfield')


# Create a function
def F(x, y, z):
    return 2 * x * x * x * x * x + 2. * y * y * z + z * z


val0 = F(0.55, 0.38, 0.)  # reference
# init by function
a = C.initVars(a, 'F', F, ['CoordinateX', 'CoordinateY', 'CoordinateZ'])
val = P.extractPoint(a, (0.55, 0.38, 0.))
test.testO(val)

# sur un arbre
t = C.newPyTree(['Base', 2])
t[2][1] = C.addState(t[2][1], 'Mach', 0.6)
t[2][1][2].append(a)
t = C.initVars(t, 'F', F, ['CoordinateX', 'CoordinateY', 'CoordinateZ'])
t = C.initVars(t, 'centers:G', 3.)
val = P.extractPoint(t, (0.55, 0.38, 0.))
test.testO(val, 2)

# non structure
a = C.convertArray2Tetra(a)
t = C.newPyTree(['Base', 2])
t[2][1] = C.addState(t[2][1], 'Mach', 0.6)
コード例 #2
0
# - extractPoint (pyTree) -
import Converter.PyTree as C
import Generator.PyTree as G
import Post.PyTree as P

ni = 10
nj = 10
nk = 10
a = G.cart((0, 0, 0), (1. / (ni - 1), 1. / (nj - 1), 1. / (nk - 1)),
           (ni, nj, nk))


def F(x, y, z):
    return x + 2. * y + 3. * z


a = C.initVars(a, 'F', F, ['CoordinateX', 'CoordinateY', 'CoordinateZ'])

# Utilisation directe
val = P.extractPoint(a, (0.55, 0.38, 0.12), 2)
print val

# Utilisation avec un hook
hook = C.createHook(a, function='extractMesh')
val = P.extractPoint(a, (0.55, 0.38, 0.12), 2, hook=hook)
print val
コード例 #3
0
nk = 10
a = G.cart((0, 0, 0), (1. / (ni - 1), 1. / (nj - 1), 1. / (nk - 1)),
           (ni, nj, nk))


# Create a function
def F(x, y, z):
    return 2 * x * x * x * x * x + 2. * y * y * z + z * z


# Init by function
a = C.initVars(a, 'F', F, ['CoordinateX', 'CoordinateY', 'CoordinateZ'])
a = C.initVars(a, 'centers:G', 1.)

# 2nd order
val = P.extractPoint(a, (0.55, 0.38, 0.12), 2)
ref = [0.15309556470050301, 1.0]
print("Test1... done.")
for i in range(len(val)):
    if abs(val[i] - ref[i]) > 1.e-10:
        print('DIFF: reference: ' + str(ref[i]) + '.')
        print('DIFF: courant: ' + str(val[i]) + '.')

# 3rd order
val = P.extractPoint(a, (0.55, 0.38, 0.12), 3)
ref = [0.1502804068485496, 1.0]
print("Test2... done.")
for i in range(len(val)):
    if abs(val[i] - ref[i]) > 1.e-10:
        print('DIFF: reference: ' + str(ref[i]) + '.')
        print('DIFF: courant: ' + str(val[i]) + '.')