예제 #1
0
    g = CGL.newGridCoordinates(z1, 'GridCoordinates')
    d = CGL.newDataArray(g, CGK.CoordinateX_s,
                         NPY.ones((5, 7, 5), dtype='float64', order='F'))
    d = CGL.newDataArray(g, CGK.CoordinateY_s,
                         NPY.ones((5, 7, 5), dtype='float64', order='F'))
    d = CGL.newDataArray(g, CGK.CoordinateZ_s,
                         NPY.ones((5, 7, 5), dtype='float64', order='F'))
    s = NPY.array([[vertexsize, cellsize, 0]], dtype='int32', order='F')
    z2 = CGU.copyNode(z1, 'Zone2')
    b[2].append(z2)
    z = [z1, z2]
    return (T, b, z)


(T, b, z) = makeCorrectTree()
zgc = CGL.newZoneGridConnectivity(z[0])
gc = CGL.newGridConnectivity1to1(zgc, 'join1_2', 'Zone2',
                                 NPY.array([[1, 1], [1, 7], [1, 5]]),
                                 NPY.array([[1, 5], [1, 7], [5, 5]]),
                                 NPY.array([+1, +2, +3]))
zgc = CGL.newZoneGridConnectivity(z[1])
gc = CGL.newGridConnectivity1to1(zgc, 'join2_1', 'Zone1',
                                 NPY.array([[1, 5], [1, 7], [5, 5]]),
                                 NPY.array([[1, 1], [1, 7], [1, 5]]),
                                 NPY.array([+1, +2, +3]))
TESTS.append((tag, T, diag))

#  -------------------------------------------------------------------------
tag = 'gridconnectivity1to1 bad datatype'
diag = False
(T, b, z) = makeCorrectTree()
예제 #2
0
from __future__ import unicode_literals
import CGNS.PAT.cgnslib as C
import CGNS.PAT.cgnserrors as E
import CGNS.PAT.cgnskeywords as K
import numpy as N

data = C.newZone(None, '{Zone}',
                 N.array([[5, 4, 0], [7, 7, 0], [9, 8, 0]], order='F'))

g1 = C.newGridCoordinates(data, "GridCoordinates")
C.newRigidGridMotion(data, "{RigidGridMotion}")
C.newArbitraryGridMotion(data, "{ArbitraryGridMotion}")
C.newFlowSolution(data, "{FlowSolution}")
C.newDiscreteData(data, "{DiscreteData}")
C.newIntegralData(data, "{IntegralData}")
C.newZoneGridConnectivity(data, "{GridConnectivity}")
C.newBoundary(data, "{BC}", N.array([[0, 0, 0], [0, 0, 0]]))
C.newZoneIterativeData(data, "{ZoneIterativeData}")
C.newReferenceState(data)
C.newRotatingCoordinates(data)
C.newDataClass(data)
C.newDimensionalUnits(data)
C.newFlowEquationSet(data)
C.newConvergenceHistory(data, K.ZoneConvergenceHistory_s)
C.newUserDefinedData(data, '{UserDefinedData}')
C.newDescriptor(data, '{Descriptor}')
C.newOrdinal(data)

status = '6.3'
comment = 'Full SIDS with all optionals'
pattern = [data, status, comment]
예제 #3
0
                         NPY.ones((cellsize * 4), dtype='int32'),
                         NPY.array([[1, cellsize]], 'i', order='F'))
tris = CGL.newElements(
    z, 'TRIS', CGK.TRI_3_s, NPY.ones((ntris * 3), dtype='int32'),
    NPY.array([[cellsize + 1, cellsize + ntris]], 'i', order='F'))
tris[1][1] = ntris
zbc = CGL.newZoneBC(z)
n = CGL.newBoundary(zbc,
                    'BC', [range(cellsize + 1, cellsize + ntris + 1)],
                    btype=CGK.Null_s,
                    family=None,
                    pttype=CGK.PointList_s)
g = CGL.newGridLocation(n, value=CGK.FaceCenter_s)
z2 = CGU.copyNode(z, 'Zone2')
b[2].append(z2)
zgc = CGL.newZoneGridConnectivity(z)
gc = CGL.newGridConnectivity(zgc, 'join1_2', 'Zone2', ctype=CGK.Abutting1to1_s)
CGL.newIndexArray(gc,
                  CGK.PointList_s,
                  value=NPY.array([range(cellsize + 2, cellsize + ntris)],
                                  order='F'))
CGL.newIndexArray(gc,
                  CGK.PointListDonor_s,
                  value=NPY.array([range(cellsize + 2, cellsize + ntris)],
                                  order='F'))
CGL.newGridLocation(gc, value=CGK.FaceCenter_s)
zgc = CGL.newZoneGridConnectivity(z2)
gc = CGL.newGridConnectivity(zgc, 'join2_1', 'Zone', ctype=CGK.Abutting1to1_s)
CGL.newIndexArray(gc,
                  CGK.PointList_s,
                  value=NPY.array([range(cellsize + 2, cellsize + ntris)],
예제 #4
0
a = CGL.newRotatingCoordinates(b)
d = CGL.newDataClass(a, CGK.NondimensionalParameter_s)
a = CGL.newDiscreteData(z, '{DiscreteData}')
d = CGL.newDataClass(a, CGK.NondimensionalParameter_s)
i = CGL.newBaseIterativeData(b, '{BaseIterativeData}')
d = CGL.newDataClass(i, CGK.NondimensionalParameter_s)
i = CGL.newZoneIterativeData(z, '{ZoneIterativeData}')
d = CGL.newDataClass(i, CGK.NondimensionalParameter_s)
m = CGL.newRigidGridMotion(z,
                           '{RigidGridMotion}',
                           vector=NPY.array([[0.0, 0.0], [0.0, 0.0],
                                             [0.0, 0.0]]))
d = CGL.newDataClass(m, CGK.NondimensionalParameter_s)
m = CGL.newArbitraryGridMotion(z, '{ArbitraryGridMotion}')
d = CGL.newDataClass(m, CGK.NondimensionalParameter_s)
x = CGL.newZoneGridConnectivity(z)
x = CGL.newGridConnectivity(x, '{GridConnectivity}', z[0])
CGL.newPointRange(x,
                  value=NPY.array([[1, 1], [1, 1], [1, 1]],
                                  dtype=NPY.int32,
                                  order='Fortran'))
p = CGL.newGridConnectivityProperty(x)
m = CGL.newPeriodic(p)
d = CGL.newDataClass(m, CGK.NondimensionalParameter_s)
w = CGL.newConvergenceHistory(b)
d = CGL.newDataClass(w, CGK.NondimensionalParameter_s)
i = CGL.newIntegralData(b, '{IntegralData}')
d = CGL.newDataClass(i, CGK.NondimensionalParameter_s)
i = CGL.newUserDefinedData(b, '{UserDefinedData}')
d = CGL.newDataClass(i, CGK.NondimensionalParameter_s)
i = CGL.newGravity(b)
예제 #5
0
def makeStTree():
    T = CGL.newCGNSTree()
    b = CGL.newBase(T, '{Base}', 3, 3)
    z1 = CGL.newZone(b, '{Zone1}',
                     NPY.array([[5, 4, 0], [7, 6, 0], [9, 8, 0]], order='F'))
    g = CGL.newGridCoordinates(z1, 'GridCoordinates')
    d = CGL.newDataArray(g, CGK.CoordinateX_s,
                         NPY.ones((5, 7, 9), dtype='float64', order='F'))
    d = CGL.newDataArray(g, CGK.CoordinateY_s,
                         NPY.ones((5, 7, 9), dtype='float64', order='F'))
    d = CGL.newDataArray(g, CGK.CoordinateZ_s,
                         NPY.ones((5, 7, 9), dtype='float64', order='F'))
    z2 = CGU.copyNode(z1, '{Zone2}')
    b[2].append(z2)
    zgc = CGL.newZoneGridConnectivity(z1)
    gc = CGL.newGridConnectivity1to1(zgc, 'join1_2', '{Zone2}',
                                     NPY.array([[1, 1], [1, 4], [1, 9]]),
                                     NPY.array([[5, 5], [3, 7], [1, 9]]),
                                     NPY.array([-1, +2, +3]))
    zgc = CGL.newZoneGridConnectivity(z2)
    gc = CGL.newGridConnectivity1to1(zgc, 'join2_1', '{Zone1}',
                                     NPY.array([[5, 5], [3, 7], [1, 9]]),
                                     NPY.array([[1, 1], [1, 4], [1, 9]]),
                                     NPY.array([-1, +2, +3]))
    zbc = CGL.newZoneBC(z1)
    n = CGL.newBoundary(zbc,
                        '{BC1_1}', [[5, 5], [1, 7], [1, 9]],
                        btype=CGK.Null_s,
                        family=None,
                        pttype=CGK.PointRange_s)
    g = CGL.newGridLocation(n, value=CGK.FaceCenter_s)
    n = CGL.newBoundary(zbc,
                        '{BC1_2}', [[1, 5], [1, 1], [1, 9]],
                        btype=CGK.Null_s,
                        family=None,
                        pttype=CGK.PointRange_s)
    g = CGL.newGridLocation(n, value=CGK.FaceCenter_s)
    n = CGL.newBoundary(zbc,
                        '{BC1_3}', [[1, 5], [7, 7], [1, 9]],
                        btype=CGK.Null_s,
                        family=None,
                        pttype=CGK.PointRange_s)
    g = CGL.newGridLocation(n, value=CGK.FaceCenter_s)
    n = CGL.newBoundary(zbc,
                        '{BC1_4}', [[1, 5], [1, 7], [1, 1]],
                        btype=CGK.Null_s,
                        family=None,
                        pttype=CGK.PointRange_s)
    g = CGL.newGridLocation(n, value=CGK.FaceCenter_s)
    n = CGL.newBoundary(zbc,
                        '{BC1_5}', [[1, 5], [1, 7], [9, 9]],
                        btype=CGK.Null_s,
                        family=None,
                        pttype=CGK.PointRange_s)
    g = CGL.newGridLocation(n, value=CGK.FaceCenter_s)
    n = CGL.newBoundary(zbc,
                        '{BC1_6}', [[1, 1], [4, 7], [1, 9]],
                        btype=CGK.Null_s,
                        family=None,
                        pttype=CGK.PointRange_s)
    g = CGL.newGridLocation(n, value=CGK.FaceCenter_s)
    zbc = CGL.newZoneBC(z2)
    n = CGL.newBoundary(zbc,
                        '{BC2_1}', [[1, 1], [1, 7], [1, 9]],
                        btype=CGK.Null_s,
                        family=None,
                        pttype=CGK.PointRange_s)
    g = CGL.newGridLocation(n, value=CGK.FaceCenter_s)
    n = CGL.newBoundary(zbc,
                        '{BC2_2}', [[1, 5], [1, 1], [1, 9]],
                        btype=CGK.Null_s,
                        family=None,
                        pttype=CGK.PointRange_s)
    g = CGL.newGridLocation(n, value=CGK.FaceCenter_s)
    n = CGL.newBoundary(zbc,
                        '{BC2_3}', [[1, 5], [7, 7], [1, 9]],
                        btype=CGK.Null_s,
                        family=None,
                        pttype=CGK.PointRange_s)
    g = CGL.newGridLocation(n, value=CGK.FaceCenter_s)
    n = CGL.newBoundary(zbc,
                        '{BC2_4}', [[1, 5], [1, 7], [1, 1]],
                        btype=CGK.Null_s,
                        family=None,
                        pttype=CGK.PointRange_s)
    g = CGL.newGridLocation(n, value=CGK.FaceCenter_s)
    n = CGL.newBoundary(zbc,
                        '{BC2_5}', [[1, 5], [1, 7], [9, 9]],
                        btype=CGK.Null_s,
                        family=None,
                        pttype=CGK.PointRange_s)
    g = CGL.newGridLocation(n, value=CGK.FaceCenter_s)
    n = CGL.newBoundary(zbc,
                        '{BC2_6}', [[5, 5], [1, 3], [1, 9]],
                        btype=CGK.Null_s,
                        family=None,
                        pttype=CGK.PointRange_s)
    g = CGL.newGridLocation(n, value=CGK.FaceCenter_s)
    z = [z1, z2]
    return (T, b, z)