Grid line

Grid line extraction using topology information

Parameters

  • base: Base

    The base in which search the grid line.

  • indices: list(int)

    List of indices of the grid line starting point.

  • indices_location: str, default= ‘node’

    Location of the given indices.

  • zone_name: str

    Name of the zone of the grid line starting point.

  • line_type: str

    Type of grid line, should be in [‘I’, ‘J’, ‘K’, ‘+I’, ‘+J’, ‘+K’, ‘-I’, ‘-J’, ‘-K’].

Preconditions

This only works structured grids. The base must only contain variables located at the given location.

Main functions

class antares.treatment.TreatmentGridline.TreatmentGridline
execute()

Execute the treatment.

Returns:

the family containing the Window corresponding to the grid line

Return type:

Family

line_types = ['I', 'J', 'K', '+I', '+J', '+K', '-I', '-J', '-K']

Example

"""
This example illustrates how to extract a topological grid line
from a multi-block multi-instant dataset using the gridline 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 gridline family
# -----------------------------
treatment = Treatment('gridline')
treatment['base'] = base
treatment['zone_name'] = 'Block0000'
treatment['line_type'] = 'K'
treatment['indices'] = (10, 2, 1)
gridline_family = treatment.execute()

print(gridline_family)
# >>>  Family object
#      - objects : ['Block0000_11_11_3_3_1_29', 'Block0001_19_19_3_3_1_117']


# add the family to the base
base.families['my_grid_line'] = gridline_family


# extract the data on the gridline
gridline = base[gridline_family]

print(gridline)
# >>>  Base object
#      - zones : ['Block0000_11_11_3_3_1_29', 'Block0001_19_19_3_3_1_117']


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