Flux¶
Description¶
Compute fluxes through a surface.
Parameters¶
- base:
Base
The input base on which the integration will be performed for each variable except coordinates.
- base:
- coordinates: list(str)
The variable names that define the set of coordinates used for integration.
- vectors: list(), default= []
List of the vector names and their component variable names.
- Example: [ [“massflow”, (“rhou”, “rhov”, “rhow”)],
[“n”, (“nx”, “ny”, “nz”)] ].
Preconditions¶
The coordinate variables and the normal unit vector must be available at node.
Postconditions¶
Example¶
import antares
myt = antares.Treatment('flux')
Main functions¶
Example¶
"""
This example illustrates how to compute the flux over a surface
"""
import os
if not os.path.isdir('OUTPUT'):
os.makedirs('OUTPUT')
from antares import Reader, Treatment
# ------------------
# Reading the files
# ------------------
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()
outlet_patch = base[base.families['F_row_1_OUTFLOW']]
print(outlet_patch[0][0])
outlet_patch.compute_cell_normal()
# -----------------
# Flux computation
# -----------------
treatment = Treatment('flux')
treatment['base'] = outlet_patch
treatment['vectors'] = [['massflow', ('rovx', 'rovy', 'rovz')]]
result = treatment.execute()
# the result base contain one zone with the integrated data
# the zone contains the values for the different instants
print(result[0])
# in each instant, is stored :
# - for each vector, the integrated flux (scalar product of vector with normal)
# - for each scalar variables (not vectors), the integration along the 3 directions (variable * normal)
# - the surface of the dataset and the surface along each direction
print(result[0][0])
print(result[0][0]['surface'])