Grid Plane

Grid plane extraction using topology information (for structured grid only)

Parameters

  • base: Base

    The base in which search the grid plane.

  • index: int

    Grid plane starting index.

  • zone_name: str

    Grid plane starting zone name.

  • plane_type: str

    Type of grid plane, should be in [‘I’, ‘J’, ‘K’].

Main functions

class antares.treatment.TreatmentGridplane.TreatmentGridplane
execute()

Execute the treatment.

Returns:

the family containing the Window corresponding to the grid plane

Return type:

Family

plane_types = ['I', 'J', 'K']

Example

"""
This example illustrates how to extract a topological grid plane
from a multi-block multi-instant dataset using the gridplane treatment.

Note that the treatment is returning a family which
can then be applied to the base to get the data or used
to get the elsA extractor corresponding
"""
import os
if not os.path.isdir('OUTPUT'):
    os.makedirs('OUTPUT')

from antares import Reader, Treatment, Writer

# ----------------------------------------------
# Reading the files and topological information
# ----------------------------------------------
reader = Reader('bin_tp')
reader['filename'] = os.path.join('..', 'data', 'ROTOR37', 'GENERIC', 'flow_<zone>_ite<instant>.dat')
reader['zone_prefix'] = 'Block'
reader['topology_file'] = os.path.join('..', 'data', 'ROTOR37', 'GENERIC', 'script_topology.py')
base = reader.read()

# -----------------------------
# Retreive the gridplane family
# -----------------------------
treatment = Treatment('gridplane')
treatment['base'] = base
treatment['zone_name'] = 'Block0000'
treatment['plane_type'] = 'J'
treatment['index'] = 2
gridplane_family = treatment.execute()

print(gridplane_family)
# >>>  Family object
#      - objects : ['Block0000_1_81_3_3_1_29', 'Block0001_1_29_3_3_1_117',
#                   'Block0002_1_25_3_3_1_33', 'Block0003_1_25_3_3_1_29',
#                   'Block0004_1_21_3_3_1_161', 'Block0005_1_29_3_3_1_117']


# add the family to the base
base.families['my_grid_plane'] = gridplane_family


# extract the data on the gridplane
gridplane = base[gridplane_family]

print(gridplane)
# >>>  Base object
#      - zones : ['Block0000_1_81_3_3_1_29', 'Block0001_1_29_3_3_1_117',
#                 'Block0002_1_25_3_3_1_33', 'Block0003_1_25_3_3_1_29',
#                 'Block0004_1_21_3_3_1_161', 'Block0005_1_29_3_3_1_117']


# -------------------
# Writing the result
# -------------------
writer = Writer('bin_tp')
writer['filename'] = os.path.join('OUTPUT', 'ex_gridplane.plt')
writer['base'] = gridplane
writer.dump()