Node creation presets

Although any tree could be creating using exclusivelly new_node() function, maia.pytree provide some shortcuts to create nodes with relevant information.

In addition of reducing the amount of code to write, it also:

  • hides the node structure details : if you want to create an Unstructured zone, just tell to new_Zone function: you don’t need to know that this information should be stored in a ZoneType node of label ZoneType_t node under the zone;

  • performs checks to prevent you to create non CGNS/SIDS-compliant nodes.

Generalities

Containers fields

When creating a Container node (ie. a node storing some fields, such as a FlowSolution_t), a list of DataArray to create can be provided through the fields parameter, which must be a dictionnary mapping array names to array values: for example,

>>> fields = {'Density' : np.array([1, 1, 1.05], float),
...           'Temperature' : [293., 293., 296.]}

when passed to new_FlowSolution(), will created the requested fields:

>>> fs = PT.new_FlowSolution('FS', fields=fields)
>>> PT.print_tree(fs)
FS FlowSolution_t
├───Density DataArray_t R8 [1.   1.   1.05]
└───Temperature DataArray_t R4 [293. 293. 296.]

Notice that values which are not numpy array instance are converted following set_value() rules.

Parent label check

All the new_...() functions (appart from new_CGNSTree()) take an optionnal parent argument, which can be used to add the created node to the parent children list. In this case, a warning will be issued if the hierarchic relation is not CGNS/SIDS-compliant.

>>> zone = PT.new_Zone()
>>> bc = PT.new_BC(parent=zone)
RuntimeWarning: Attaching node BC (BC_t) under a Zone_t parent
is not SIDS compliant. Admissible parent labels are ['ZoneBC_t'].

Return value

Important

All the functions listed in this page return a single value, which is the created CGNSTree. For more readability, we omit the return section in the API description.

Overview

Functions creating top level structures

new_CGNSTree

Create a CGNSTree_t node

new_CGNSBase

Create a CGNSBase_t node

new_BaseIterativeData

Create a BaseIterativeData_t node

new_Axisymmetry

Create a Axisymmetry_t node

new_Zone

Create a Zone_t node

Functions creating Family related nodes

new_Family

Create a Family_t node

new_FamilyName

Create a FamilyName_t or an AdditionalFamilyName_t node

Functions creating Zone related nodes

new_GridCoordinates

Create a GridCoordinates_t node

new_Elements

Create an Element_t node

new_NFaceElements

Create an Element_t node describing a NFACE_n connectivity

new_NGonElements

Create an Element_t node describing a NGON_n connectivity

new_ZoneBC

Create a ZoneBC_t node

new_ZoneGridConnectivity

Create a ZoneGridConnectivity_t node

new_FlowSolution

Create a FlowSolution_t node

new_DiscreteData

Create a DiscreteData_t node

new_ZoneSubRegion

Create a ZoneSubRegion_t node

new_BC

Create a BC_t node

new_BCDataSet

Create a BCDataSet_t node

new_BCData

Create a BCData_t node

new_GridConnectivity

Create a GridConnectivity_t node

new_GridConnectivity1to1

Create a GridConnectivity1to1_t node

new_GridConnectivityProperty

Create a GridConnectivityProperty node

Functions creating common sub nodes

new_GridLocation

Create a GridLocation_t node

new_DataArray

Create a DataArray_t node

new_IndexArray

Create an IndexArray_t node

new_IndexRange

Create an IndexRange_t node

Functions creating miscellaneous sub nodes

new_UserDefinedData

Create a UserDefinedData_t node

new_ViscosityModel

Create a ViscosityModel_t node

new_Descriptor

Create a Descriptor_t node

new_FlowEquationSet

Create a FlowEquationSet_t node

new_GasModel

Create a GasModel_t node

new_ReferenceState

Create a ReferenceState_t node

API reference

new_Axisymmetry(*, reference_point=None, axis_vector=None, parent=None)

Create a Axisymmetry_t node

Link to corresponding SIDS section: Axisymmetry_t

Parameters
  • reference_point (ArrayLike) – if provided, create a AxisymmetryReferencePoint child array

  • axis_vector (ArrayLike) – if provided, create an AxisymmetryAxisVector child array

  • parent (CGNSTree) – Node to which created node should be attached

Example

>>> node = PT.new_Axisymmetry(reference_point=[0.0, 0.0], axis_vector=[0.0, 1.0])
>>> PT.print_tree(node)
Axisymmetry Axisymmetry_t
├───AxisymmetryReferencePoint DataArray_t R4 [0. 0.]
└───AxisymmetryAxisVector DataArray_t R4 [0. 1.]
new_BC(name='BC', type='Null', *, point_range=None, point_list=None, loc=None, family=None, parent=None)

Create a BC_t node

The patch defining the BC must be provided using either point_range or point_list parameter : both can no be used simultaneously.

Link to corresponding SIDS section: BC_t

Parameters
  • name (str) – Name of the created bc node

  • type (str) – Type of the boundary condition

  • point_range (ArrayLike) – PointRange array defining the BC

  • point_list (ArrayLike) – PointList array defining the BC

  • loc (str) – If specified, create a GridLocation taking this value

  • family (str) – If specified, create a FamilyName taking this value

  • parent (CGNSTree) – Node to which created bc should be attached

Example

>>> node = PT.new_BC('BC', 'BCWall', point_list=[[1,5,10,15]],
...                  loc='FaceCenter', family='WALL')
>>> PT.print_tree(node)
BC BC_t "BCWall"
├───GridLocation GridLocation_t "FaceCenter"
├───FamilyName FamilyName_t "WALL"
└───PointList IndexArray_t I4 [[ 1  5 10 15]]
new_BCData(name, fields={}, parent=None)

Create a BCData_t node

Link to corresponding SIDS section: BCData_t

Parameters
  • name (str) – Name of the created BCData node

  • fields (dict) – fields to create under the container (see fields setting)

  • parent (CGNSTree) – Node to which created data should be attached

Example

>>> node = PT.new_BCData('DirichletData', fields={'Global' : np.float64(4.4), 'Local' : np.ones(100)})
>>> PT.print_tree(node)
DirichletData BCData_t
├───Global DataArray_t R8 [4.4]
└───Local DataArray_t R8 (100,)
new_BCDataSet(name='BCDataSet', type='Null', *, point_range=None, point_list=None, loc=None, parent=None)

Create a BCDataSet_t node

Link to corresponding SIDS section: BCDataSet_t

Parameters
  • name (str) – Name of the created dataset node

  • type (str) – Type of the dataset

  • point_range (ArrayLike) – PointRange array defining the dataset

  • point_list (ArrayLike) – PointList array defining the dataset

  • loc (str) – If specified, create a GridLocation taking this value

  • parent (CGNSTree) – Node to which created bcdataset should be attached

Example

>>> node = PT.new_BCDataSet('BCDS', loc='FaceCenter', point_list=[[1,3,5,7]])
>>> PT.print_tree(node)
BCDS BCDataSet_t "Null"
├───GridLocation GridLocation_t "FaceCenter"
└───PointList IndexArray_t I4 [[1 3 5 7]]
new_BaseIterativeData(name='BaseIterativeData', *, time_values=None, iter_values=None, parent=None)

Create a BaseIterativeData_t node

Link to corresponding SIDS section: BaseIterativeData_t

Parameters
  • name (str) – Name of the created node

  • time_values (ArrayLike) – if provided, create a TimeValues child array

  • iter_values (ArrayLike) – if provided, create an IterationValues child array

  • parent (CGNSTree) – Node to which created node should be attached

Example

>>> node = PT.new_BaseIterativeData(time_values=[0.0, 0.5, 1.0])
>>> PT.print_tree(node)
BaseIterativeData BaseIterativeData_t I4 [3]
└───TimeValues DataArray_t R4 [0.  0.5 1. ]
new_CGNSBase(name='Base', *, cell_dim=3, phy_dim=3, parent=None)

Create a CGNSBase_t node

Link to corresponding SIDS section: CGNSBase_t

Parameters
  • name (str) – Name of the created base

  • cell_dim (one of 1,2,3) – Cell dimension of the mesh

  • phy_dim (one of 1,2,3) – Physical dimension of the mesh

  • parent (CGNSTree) – Node to which created base should be attached

Example

>>> node = PT.new_CGNSBase('Base', cell_dim=2)
>>> PT.print_tree(node)
Base CGNSBase_t I4 [2 3]
new_CGNSTree(*, version=4.2)

Create a CGNSTree_t node

Parameters

version (float) – Number used to fill the CGNSLibraryVersion data

Example

>>> node = PT.new_CGNSTree()
>>> PT.print_tree(node)
CGNSTree CGNSTree_t
└───CGNSLibraryVersion CGNSLibraryVersion_t R4 [4.2]
new_DataArray(name, value, *, dtype=None, parent=None)

Create a DataArray_t node

The datatype of the DataArray can be enforced with the dtype parameter, which must be a str value (eg I4, R8). If not provided, default conversion of set_value() applies.

Link to corresponding SIDS section: DataArray_t

Parameters
  • name (str) – Name of the created data array node

  • value (ArrayLike) – value of the data array

  • dtype (str) – If used, cast value to the specified type

  • parent (CGNSTree) – Node to which created data array should be attached

Example

>>> node = PT.new_DataArray('Data', [1,2,3])
>>> PT.print_tree(node)
Data DataArray_t I4 [1 2 3]
>>> node = PT.new_DataArray('Data', [1,2,3], dtype='R8')
>>> PT.print_tree(node)
Data DataArray_t R8 [1. 2. 3.]
new_Descriptor(name='Descriptor', value='', *, parent=None)

Create a Descriptor_t node

Link to corresponding SIDS section: Descriptor_t

Parameters
  • name (str) – Name of the created descriptor node

  • value (ArrayLike) – Value of the new descriptor

  • parent (CGNSTree) – Parent node to which the new node should be attached

Example

>>> node = PT.new_Descriptor(value="My description node")
>>> PT.print_tree(node)
Descriptor Descriptor_t "My descri[...]node"
new_DiscreteData(name='DiscreteData', *, loc=None, fields={}, parent=None)

Create a DiscreteData_t node

Link to corresponding SIDS section: DiscreteData_t

Parameters
  • name (str) – Name of the created discrete data node

  • loc (str) – If specified, create a GridLocation taking this value

  • fields (dict) – fields to create under the container (see fields setting)

  • parent (CGNSTree) – Node to which created discrete data should be attached

Example

>>> node = PT.new_DiscreteData('DD', loc='Vertex',
...                            fields={'VtxWeight' : np.ones(100)})
>>> PT.print_tree(node)
DD DiscreteData_t
├───GridLocation GridLocation_t "Vertex"
└───VtxWeight DataArray_t R8 (100,)
new_Elements(name='Elements', type='Null', *, erange=None, econn=None, pe=None, parent=None)

Create an Element_t node

This function is designed to create standard elements. See new_NGonElements() or new_NFaceElements() to create polygonal elements.

Link to corresponding SIDS section: Elements_t

Parameters
  • name (str) – Name of the created element node

  • type (str) – CGNSName of the element section, for example PYRA_5

  • erange (ArrayLike) – ElementRange array of the elements

  • econn (ArrayLike) – ElementConnectivity array of the elements

  • pe (ArrayLike) – ParentElements array of the elements

  • parent (CGNSTree) – Node to which created elements should be attached

Example

>>> node = PT.new_Elements('Edges', type='BAR_2', erange=[1,4],
...                        econn=[1,2, 2,3, 3,4, 4,1])
>>> PT.print_tree(node)
Edges Elements_t I4 [3 0]
├───ElementRange IndexRange_t I4 [1 4]
└───ElementConnectivity DataArray_t I4 [1 2 2 3 3 4 4 1]
new_Family(name='Family', *, family_bc=None, parent=None)

Create a Family_t node

Link to corresponding SIDS section: Family_t

Parameters
  • name (str) – Name of the created family

  • family_bc (str) – If specified, create a FamilyBC taking this value under the Family node

  • parent (CGNSTree) – Node to which created family should be attached

Example

>>> node = PT.new_Family('WALL', family_bc='BCWall')
>>> PT.print_tree(node)
WALL Family_t
└───FamilyBC FamilyBC_t "BCWall"
new_FamilyName(family_name, as_additional='', parent=None)

Create a FamilyName_t or an AdditionalFamilyName_t node

Parameters
  • family_name (str) – Name of the family to which the FamilyName node refers

  • as_additional (str) – If provided, node is created as an AdditionalFamilyName_t node named after this str

  • parent (CGNSTree) – Node to which created node should be attached

Example

>>> node = PT.new_FamilyName('MyFamily')
>>> PT.print_tree(node)
FamilyName FamilyName_t "MyFamily"
>>> node = PT.new_FamilyName('MyFamily', as_additional='AddFamName')
>>> PT.print_tree(node)
AddFamName AdditionalFamilyName_t "MyFamily"
new_FlowEquationSet(parent=None)

Create a FlowEquationSet_t node

Link to corresponding SIDS section: FlowEquationSet_t

Parameters

parent (CGNSTree) – Parent node to which the new node should be attached

Example

>>> node = PT.new_FlowEquationSet()
>>> PT.print_tree(node)
FlowEquationSet FlowEquationSet_t
new_FlowSolution(name='FlowSolution', *, loc=None, fields={}, parent=None)

Create a FlowSolution_t node

Link to corresponding SIDS section: FlowSolution_t

Parameters
  • name (str) – Name of the created flow solution node

  • loc (str) – If specified, create a GridLocation taking this value

  • fields (dict) – fields to create under the container (see fields setting)

  • parent (CGNSTree) – Node to which created flow solution should be attached

Example

>>> node = PT.new_FlowSolution('FS', loc='CellCenter',
...                            fields={'Density' : np.ones(125)})
>>> PT.print_tree(node)
FS FlowSolution_t
├───GridLocation GridLocation_t "CellCenter"
└───Density DataArray_t R8 (125,)
new_GasModel(value='Ideal', *, parent=None)

Create a GasModel_t node

Link to corresponding SIDS section: GasModel_t

Parameters
  • value (str) – String value of the gas model node

  • parent (CGNSTree) – Parent node to which the new node should be attached

Example

>>> node = PT.new_GasModel()
>>> PT.print_tree(node)
GasModel GasModel_t "Ideal"
new_GridConnectivity(name='GC', donor_name=None, type='Null', *, loc=None, point_range=None, point_range_donor=None, point_list=None, point_list_donor=None, parent=None)

Create a GridConnectivity_t node

The patch defining the GC must be provided using either point_range or point_list parameter : both can no be used simultaneously. The same applies for the opposite patch definition (using point_range_donor or point_list_donor).

Link to corresponding SIDS section: GridConnectivity_t

Parameters
  • name (str) – Name of the created gc node

  • donor_name (str) – Name or path of the opposite zone

  • type (one of 'Null', 'UserDefined', 'Overset', 'Abutting' or 'Abutting1to1') – Type of the gc node

  • loc (str) – If specified, create a GridLocation taking this value

  • point_range (ArrayLike) – PointRange array defining the current patch

  • point_range_donor (ArrayLike) – PointRange array defining the opposite patch

  • point_list (ArrayLike) – PointList array defining the current patch

  • point_list_donor (ArrayLike) – PointList array defining the opposite patch

  • parent (CGNSTree) – Node to which created gc should be attached

Example

>>> node = PT.new_GridConnectivity('GC', 'Zone', 'Abutting1to1',
...           point_list=[[1,4,7]], point_list_donor=[[3,6,9]])
>>> PT.print_tree(node)
GC GridConnectivity_t "Zone"
├───GridConnectivityType GridConnectivityType_t "Abutting1to1"
├───PointList IndexArray_t I4 [[1 4 7]]
└───PointListDonor IndexArray_t I4 [[3 6 9]]
new_GridConnectivity1to1(name='GC', donor_name=None, *, point_range=None, point_range_donor=None, transform=None, parent=None)

Create a GridConnectivity1to1_t node

GridConnectivity1to1_t are reserved for structured zones. See new_GridConnectivity() to create general GridConnectivity_t nodes.

Link to corresponding SIDS section: GridConnectivity1to1_t

Parameters
  • name (str) – Name of the created gc node

  • donor_name (str) – Name or path of the opposite zone

  • point_range (ArrayLike) – PointRange array defining the current patch

  • point_range_donor (ArrayLike) – PointRange array defining the opposite patch

  • transform (array of int) – short notation of the transformation matrix

  • parent (CGNSTree) – Node to which created gc should be attached

Example

>>> node = PT.new_GridConnectivity1to1('GC', 'Zone', transform=[1,2,3],
...     point_range=[[1,1],[1,10]], point_range_donor=[[5,5],[10,10]])
>>> PT.print_tree(node)
GC GridConnectivity1to1_t "Zone"
├───Transform "int[IndexDimension]" I4 [1 2 3]
├───PointRange IndexRange_t I4 [[ 1  1] [ 1 10]]
└───PointRangeDonor IndexRange_t I4 [[ 5  5] [10 10]]
new_GridConnectivityProperty(periodic={}, parent=None)

Create a GridConnectivityProperty node

The main interest of this function is to add periodic information to a GC_t node; this can be done with the periodic parameter which maps the keys ‘rotation_angle’, ‘rotation_center’ and ‘translation’ to the corresponding arrays.

Missing keys defaults to np.zeros(3), users should be careful if when the physical dimension of the mesh if lower than 3.

Link to corresponding SIDS section: GridConnectivityProperty_t

Parameters
  • periodic (dict) – Name of the created gc node

  • parent (CGNSTree) – Node to which created gc prop should be attached

Example

>>> perio = {"translation" : [1.0, 0.0, 0.0]}
>>> node = PT.new_GridConnectivityProperty(perio)
>>> PT.print_tree(node)
GridConnectivityProperty GridConnectivityProperty_t
└───Periodic Periodic_t
    ├───RotationAngle DataArray_t R4 [0. 0. 0.]
    ├───RotationCenter DataArray_t R4 [0. 0. 0.]
    └───Translation DataArray_t R4 [1. 0. 0.]
new_GridCoordinates(name='GridCoordinates', *, fields={}, parent=None)

Create a GridCoordinates_t node

Link to corresponding SIDS section: GridCoordinates_t

Parameters
  • name (str) – Name of the created gc node

  • fields (dict) – fields to create under the container (see fields setting)

  • parent (CGNSTree) – Node to which created gc should be attached

Example

>>> coords={'CoordinateX' : [1.,2.,3.], 'CoordinateY' : [1.,1.,1.]}
>>> node = PT.new_GridCoordinates(fields=coords)
>>> PT.print_tree(node)
GridCoordinates GridCoordinates_t
├───CoordinateX DataArray_t R4 [1. 2. 3.]
└───CoordinateY DataArray_t R4 [1. 1. 1.]
new_GridLocation(loc, parent=None)

Create a GridLocation_t node

Link to corresponding SIDS section: GridLocation_t

Parameters
  • loc (str) – Value to set in the grid location node

  • parent (CGNSTree) – Node to which created node should be attached

Example

>>> node = PT.new_GridLocation('FaceCenter')
>>> PT.print_tree(node)
GridLocation GridLocation_t "FaceCenter"
new_IndexArray(name='PointList', value=None, parent=None)

Create an IndexArray_t node

Note that the value array will not be reshaped and must consequently match the expected layout (IndexDimension, N).

Link to corresponding SIDS section: IndexArray_t

Parameters
  • name (str) – Name of the created index array node

  • value (ArrayLike) – value of the index array

  • parent (CGNSTree) – Node to which created node should be attached

Example

>>> node = PT.new_IndexArray(value=[[1,2,3]])
>>> PT.print_tree(node)
PointList IndexArray_t I4 [[1 2 3]]
new_IndexRange(name='PointRange', value=None, parent=None)

Create an IndexRange_t node

Note that if needed, the value array will be reshaped to the expected layout (IndexDimension, 2) (see example below).

Link to corresponding SIDS section: IndexRange_t

Parameters
  • name (str) – Name of the created index range node

  • value (ArrayLike) – value of the index range

  • parent (CGNSTree) – Node to which created node should be attached

Example

>>> node = PT.new_IndexRange(value=[[1,10],[1,10]])
>>> PT.print_tree(node)
PointRange IndexRange_t I4 [[ 1 10] [ 1 10]]
>>> node = PT.new_IndexRange(value=[1,10, 1,10, 1,1])
>>> PT.print_tree(node)
PointRange IndexRange_t I4 [[ 1 10] [ 1 10] [ 1  1]]
new_NFaceElements(name='NFaceElements', *, erange=None, eso=None, ec=None, parent=None)

Create an Element_t node describing a NFACE_n connectivity

Link to corresponding SIDS section: Elements_t

Parameters
  • name (str) – Name of the created element node

  • erange (ArrayLike) – ElementRange array of the elements

  • eso (ArrayLike) – ElementStartOffset array of the elements

  • ec (ArrayLike) – ElementConnectivity array of the elements

  • parent (CGNSTree) – Node to which created elements should be attached

Example

>>> node = PT.new_NFaceElements(erange=[5,5], eso=[0,4], ec=[1,2,3,4])
>>> PT.print_tree(node)
NFaceElements Elements_t I4 [23  0]
├───ElementRange IndexRange_t I4 [5 5]
├───ElementStartOffset DataArray_t I4 [0 4]
└───ElementConnectivity DataArray_t I4 [1 2 3 4]
new_NGonElements(name='NGonElements', *, erange=None, eso=None, ec=None, pe=None, pepos=None, parent=None)

Create an Element_t node describing a NGON_n connectivity

Link to corresponding SIDS section: Elements_t

Parameters
  • name (str) – Name of the created element node

  • erange (ArrayLike) – ElementRange array of the elements

  • eso (ArrayLike) – ElementStartOffset array of the elements

  • ec (ArrayLike) – ElementConnectivity array of the elements

  • pe (ArrayLike) – ParentElements array of the elements

  • pepos (ArrayLike) – ParentElementsPosition array of the elements

  • parent (CGNSTree) – Node to which created elements should be attached

Example

>>> node = PT.new_NGonElements(erange=[1,4], eso=[0,3,6,9,12],
...                            ec=[1,3,2, 1,2,4, 2,3,4, 3,1,4])
>>> PT.print_tree(node)
NGonElements Elements_t I4 [22  0]
├───ElementRange IndexRange_t I4 [1 4]
├───ElementStartOffset DataArray_t I4 [ 0  3  6  9 12]
└───ElementConnectivity DataArray_t I4 (12,)
new_ReferenceState(name='ReferenceState', *, fields={}, parent=None)

Create a ReferenceState_t node

Link to corresponding SIDS section: ReferenceState_t

Parameters
  • name (str) – Name of the created reference state node

  • fields (dict) – fields to create under the container (see fields setting)

  • parent (CGNSTree) – Parent node to which the new node should be attached

Example

>>> node = PT.new_ReferenceState("RefState", fields={"Density" : 1.})
>>> PT.print_tree(node)
RefState ReferenceState_t
└───Density DataArray_t R4 [1.]
new_UserDefinedData(name='UserDefined', value=None, *, parent=None)

Create a UserDefinedData_t node

Link to corresponding SIDS section: UserDefinedData_t

Parameters
  • name (str) – Name of the created user-defined data node

  • value (ArrayLike) – Value of the new node

  • parent (CGNSTree) – Parent node to which the new node should be attached

Example

>>> node = PT.new_UserDefinedData('MyUserDefData', value=np.ones(200))
>>> PT.print_tree(node)
MyUserDefData UserDefinedData_t R8 (200,)
new_ViscosityModel(value='SutherlandLaw', *, parent=None)

Create a ViscosityModel_t node

Link to corresponding SIDS section: ViscosityModel_t

Parameters
  • value (str) – String value of the viscosity model node

  • parent (CGNSTree) – Parent node to which the new node should be attached

Example

>>> node = PT.new_ViscosityModel()
>>> PT.print_tree(node)
ViscosityModel ViscosityModel_t "SutherlandLaw"
new_Zone(name='Zone', *, type='Null', size=None, family=None, parent=None)

Create a Zone_t node

Note that the size array will not be reshaped and must consequently match the expected layout

[[n_vtx, n_cell, n_bnd_vtx] for each IndexDimension]

for example, [[11,10,0]] for an unstructured zone or [[11,10,0], [6,5,0]] for a 2D structured zone.

Link to corresponding SIDS section: Zone_t

Parameters
  • name (str) – Name of the created zone

  • type ({'Null', 'UserDefined', 'Structured' or 'Unstructured'}) – Type of the zone

  • size (ArrayLike) – Size of the zone.

  • family (str) – If specified, create a FamilyName refering to this family

  • parent (CGNSTree) – Node to which created Zone should be attached

Example

>>> node = PT.new_Zone('Zone', type='Unstructured',
...                    size=[[11,10,0]], family='Rotor')
>>> PT.print_tree(node)
Zone Zone_t I4 [[11 10  0]]
├───ZoneType ZoneType_t "Unstructured"
└───FamilyName FamilyName_t "Rotor"
new_ZoneBC(parent=None)

Create a ZoneBC_t node

Parameters

parent (CGNSTree) – Node to which created ZBC should be attached

new_ZoneGridConnectivity(name='ZoneGridConnectivity', parent=None)

Create a ZoneGridConnectivity_t node

Parameters
  • name (str) – Name of the created ZoneGridConnectivity node

  • parent (CGNSTree) – Node to which created ZGC should be attached

new_ZoneSubRegion(name='ZoneSubRegion', *, loc=None, point_range=None, point_list=None, bc_name=None, gc_name=None, family=None, fields={}, parent=None)

Create a ZoneSubRegion_t node

The patch defining the ZoneSubRegion must be provided using one of point_range, point_list, bc_name or gc_name parameter : they can no be used simultaneously. Setting a GridLocation with loc parameter makes sens only if a patch is explicitly defined with point_range or point_list.

Link to corresponding SIDS section: ZoneSubRegion_t

Parameters
  • name (str) – Name of the created zsr node

  • loc (str) – If specified, create a GridLocation taking this value

  • point_range (ArrayLike) – PointRange array defining the ZSR extent

  • point_list (ArrayLike) – PointList array defining the ZSR extent

  • bc_name (str) – Name of the BC_t node defining the ZSR extent

  • gc_name (str) – Name of the GC_t node defining the ZSR extent

  • family (str) – If specified, create a FamilyName refering to this family

  • fields (dict) – fields to create under the container (see fields setting)

  • parent (CGNSTree) – Node to which created zsr should be attached

Example

>>> node = PT.new_ZoneSubRegion('Extraction', bc_name = 'Bottom',
...                             fields={'Density' : np.ones(125)})
>>> PT.print_tree(node)
Extraction ZoneSubRegion_t
├───BCRegionName Descriptor_t "Bottom"
└───Density DataArray_t R8 (125,)
>>> node = PT.new_ZoneSubRegion('Probe', loc='CellCenter',
...                             point_list=[[104]])
>>> PT.print_tree(node)
Probe ZoneSubRegion_t
├───GridLocation GridLocation_t "CellCenter"
└───PointList IndexArray_t I4 [[104]]