HB Temporal interpolation

Temporal interpolation for a HB/TSM computation.

Parameters

  • base: Base

    The input base that will be temporally interpolated.

  • hb_computation: :class:`.HbComputation or in_attr, default= ‘in_attr’

    The object that defines the attributes of the current HB/TSM computation.

  • time: float or list(numpy.ndarray) or in_attr, default= 0.

    Time instant at which solution is sought.

  • coordinates: list(str)

    The variable names that define the set of coordinates used for the interpolation. It is assumed that they are cartesian coordinates.

Initialization

To initialize a temporal interpolation object:

>>> treatment = Treatment('hbinterp')

Main functions

class antares.hb.TreatmentHbinterp.TreatmentHbinterp
execute()

Execute the treatment.

Returns

the base containing the results

Return type

Base

Example

"""
This example illustrates the temporal interpolation
treatment on a single frequency (TSM) computation.
"""
import os
if not os.path.isdir('OUTPUT'):
    os.makedirs('OUTPUT')

from antares import HbComputation, Reader, Treatment, Writer

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

# -------------------------------
# Create an HbComputation object
# -------------------------------
hb_comp = HbComputation()
hb_comp['frequencies'] = [6.2344674e-04]
ini_base.attrs['hb_computation'] = hb_comp

# -------------------
# HbInterpolation
# -------------------
treatment = Treatment('hbinterp')
treatment['base'] = ini_base
treatment['time'] = 17.14957
result = treatment.execute()

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