Isosurface

Description

Perform an isosurface using VTK.

iso1 ==> iso2

On the left: initial unstructured multi-element mesh and \(\rho u_x\) field.

On the right: resulting unstructured mesh after Isosurface Treatment with value = 0.

Construction

import antares
myt = antares.Treatment('isosurface')

Parameters

  • base: antares.Base

    The base on which the isosurfacing will be applied.

  • coordinates: list(str), default= <base>.coordinate_names

    The variable names that define the set of coordinates. The default coordinates comes from the input base attribute coordinate_names.

  • variable: str,

    Name of the variable to make the isosurface.

  • value: float or list(float),

    Value of the isosurface or list of values for isosurfaces.

  • with_families: bool, default= False

    If True, the output of the treatment contains rebuilt families based on the input base. All the families and all the levels of sub-families are rebuilt, but only attributes and Zone are transfered (not yet implemented for Boundary and Window).

Preconditions

Coordinates and variables must be available at nodes.

Zones may be either structured or unstructured.

Zones may contain multiple instants.

Postconditions

The output base is always unstructured. If with_families is enabled, the output base contains the reconstructed families of base.

Example

This example shows how to extract an isosurface. To be able to use this functionnality you must have vtk installed.

import antares

myt = Treatment('isosurface')
myt['base'] = base
myt['variable'] = 'Ux'
myt['value'] = 0.
base_iso = myt.execute()

Warning

dependency on VTK

Main functions

class antares.treatment.TreatmentIsosurface.TreatmentIsosurface

Class for isosurfaces.

execute()

Create isosurfaces.

Returns

an unstructured base or a list of unstructured bases sorted as the list of provided iso values.

Return type

antares.Base or list(antares.Base)

Example

"""
This example shows how to extract an isosurface.
To be able to use this functionnality you must have vtk installed.
"""
import os
if not os.path.isdir('OUTPUT'):
    os.makedirs('OUTPUT')

from antares import Reader, Treatment, Writer

# ------------------
# Reading the files
# ------------------
reader = Reader('bin_tp')
reader['filename'] = os.path.join('..', 'data', 'ROTOR37', 'GENERIC', 'flow_<zone>_ite0.dat')
ini_base = reader.read()

# -----------
# Isosurface
# -----------
treatment = Treatment('isosurface')
treatment['base'] = ini_base
treatment['variable'] = 'rovx'
treatment['value'] = 0.
result = treatment.execute()

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

# -----------
# Isosurfaces
# -----------
treatment = Treatment('isosurface')
treatment['base'] = ini_base
treatment['variable'] = 'rovx'
treatment['value'] = [0., 0.01]
result = treatment.execute()

for num, base in enumerate(result):
    writer = Writer('bin_tp')
    writer['filename'] = os.path.join('OUTPUT', 'ex_isosurface{}.plt'.format(num))
    writer['base'] = base
    writer.dump()