Пример #1
0
def makeCorrectTree(vertexsize, cellsize, ntris):
    T = CGL.newCGNSTree()
    b = CGL.newBase(T, 'Base', 3, 3)
    s = NPY.array([[vertexsize, cellsize, 0]], dtype='int32', order='F')
    z = CGL.newZone(b, 'Zone', s, CGK.Unstructured_s)
    g = CGL.newGridCoordinates(z, 'GridCoordinates')
    d = CGL.newDataArray(g, CGK.CoordinateX_s,
                         NPY.ones((vertexsize), dtype='float64', order='F'))
    d = CGL.newDataArray(g, CGK.CoordinateY_s,
                         NPY.ones((vertexsize), dtype='float64', order='F'))
    d = CGL.newDataArray(g, CGK.CoordinateZ_s,
                         NPY.ones((vertexsize), dtype='float64', order='F'))
    tetras = CGL.newElements(z, 'TETRAS', CGK.TETRA_4_s,
                             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'))
    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)
    return (T, b, z, zbc, n, g)
Пример #2
0
def makeCorrectTree(vertexsize, cellsize):
    T = CGL.newCGNSTree()
    b = CGL.newBase(T, 'Base', 3, 3)
    s = NPY.array([[vertexsize, cellsize, 0]], dtype='int32', order='F')
    z = CGL.newZone(b, 'Zone', s, CGK.Unstructured_s)
    g = CGL.newGridCoordinates(z, 'GridCoordinates')
    d = CGL.newDataArray(g, CGK.CoordinateX_s,
                         NPY.ones((vertexsize), dtype='float64', order='F'))
    d = CGL.newDataArray(g, CGK.CoordinateY_s,
                         NPY.ones((vertexsize), dtype='float64', order='F'))
    d = CGL.newDataArray(g, CGK.CoordinateZ_s,
                         NPY.ones((vertexsize), dtype='float64', order='F'))
    tetras = CGL.newElements(z, 'TETRAS', CGK.TETRA_4_s,
                             NPY.ones((cellsize * 4), dtype='int32'),
                             NPY.array([[1, cellsize]], 'i', order='F'))
    zbc = CGL.newZoneBC(z)
    return (T, b, z, zbc)
Пример #3
0
#  ---------------------------------------------------------------------------
#  pyCGNS - Python package for CFD General Notation System -
#  See license.txt file in the root directory of this Python module source  
#  ---------------------------------------------------------------------------
#
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.newZoneBC(None)

C.newReferenceState(data)
C.newDataClass(data)
C.newDimensionalUnits(data)
C.newUserDefinedData(data, '{UserDefinedData}')
C.newDescriptor(data, '{Descriptor}')

status = '-'
comment = 'SIDS structural node'
pattern = [data, status, comment]
Пример #4
0
d = CGL.newDataClass(z, CGK.NondimensionalParameter_s)
g = CGL.newGridCoordinates(z, CGK.GridCoordinates_s)
w = CGL.newDataArray(g, CGK.CoordinateX_s,
                     NPY.ones((5, 7, 9), dtype='float64', order='F'))
w = CGL.newDataArray(g, CGK.CoordinateY_s,
                     NPY.ones((5, 7, 9), dtype='float64', order='F'))
w = CGL.newDataArray(g, CGK.CoordinateZ_s,
                     NPY.ones((5, 7, 9), dtype='float64', order='F'))
d = CGL.newDataClass(g, CGK.NondimensionalParameter_s)
f = CGL.newFlowSolution(z)
d = CGL.newDataClass(f, CGK.NondimensionalParameter_s)
a = CGL.newDataArray(f,
                     '{DataArray}',
                     value=NPY.ones((4, 6, 8), dtype='float64', order='F'))
d = CGL.newDataClass(a, CGK.NondimensionalParameter_s)
n = CGL.newZoneBC(z)
d = CGL.newDataClass(n, CGK.NondimensionalParameter_s)
q = CGL.newBC(n, '{BC}', family='{Family}')
d = CGL.newDataClass(q, CGK.NondimensionalParameter_s)
s = CGL.newBCDataSet(q, '{Set#01}')
d = CGL.newDataClass(s, CGK.NondimensionalParameter_s)
c = CGL.newBCData(s, CGK.Dirichlet_s)
d = CGL.newDataClass(c, CGK.NondimensionalParameter_s)
r = CGL.newReferenceState(b)
d = CGL.newDataClass(r, CGK.NondimensionalParameter_s)
a = CGL.newAxisymmetry(b)
d = CGL.newDataClass(a, CGK.NondimensionalParameter_s)
a = CGL.newRotatingCoordinates(b)
d = CGL.newDataClass(a, CGK.NondimensionalParameter_s)
a = CGL.newDiscreteData(z, '{DiscreteData}')
d = CGL.newDataClass(a, CGK.NondimensionalParameter_s)
Пример #5
0
cellsize = 7
(T, b, z) = makeCorrectTree(vertexsize, cellsize)
tetras = CGL.newElements(z, 'TETRAS', CGK.TETRA_4_s,
                         NPY.ones((cellsize * 4), dtype='int32'),
                         NPY.array([[1, cellsize]], 'i', order='F'))
TESTS.append((tag, T, diag))

#  -------------------------------------------------------------------------
tag = 'elements bad elementsizeboundary'
diag = False
(T, b, z) = makeCorrectTree(vertexsize, cellsize)
tetras = CGL.newElements(z, 'TETRAS', CGK.TETRA_4_s,
                         NPY.ones((cellsize * 4), dtype='int32'),
                         NPY.array([[1, cellsize]], 'i', order='F'))
tetras[1][1] = cellsize
zbc = CGL.newZoneBC(z)
n = CGL.newBoundary(zbc,
                    'BC', [range(1, cellsize + 1)],
                    btype=CGK.Null_s,
                    family=None,
                    pttype=CGK.PointList_s)
g = CGL.newGridLocation(n, value=CGK.CellCenter_s)
TESTS.append((tag, T, diag))

#  -------------------------------------------------------------------------
tag = 'elements elementsizeboundary BC correctly defined'
diag = True
(T, b, z) = makeCorrectTree(vertexsize, cellsize)
tetras = CGL.newElements(z, 'TETRAS', CGK.TETRA_4_s,
                         NPY.ones((cellsize * 4), dtype='int32'),
                         NPY.array([[1, cellsize]], 'i', order='F'))
Пример #6
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)