Radial distribution¶
Compute the radial distribution by performing an azimuthal average over an ‘x’-plane. The mass-flow variable is used as the averaging variable (\(\displaystyle \rho v_x \partial \theta\))
Parameters¶
- base:
Base
The base must contain:
the mesh coordinates x, y, and z
the solution
‘hb_computation’ as an
Base.attrs
(if HB/TSM type).
- base:
- family_name: str, default= None
The name of the family from which the percent will be computed.
- r_percent: tuple(float), default= None
The radius value given as a percentage of the radius. The argument should be a tuple of min and max values. These limits the lower/upper bounds of the radial distribution. If not given, the lower/upper bounds of the radial distribution are computed.
- x_value: float, default= None
The absolute position value of the plane.
- r_value: tuple(float), default= None
The radius value. The argument should be a tuple of min and max values.
- vectors: list(tuple(str), default= []
If the base contains vectors, they must be rotated. It is assumed that they are expressed in cartesian coordinates.
- var-equ: list(str), default= []
Compute these values/equations on the ‘x’-plane. Values and equations must be ordered so as to avoid dependency issues.
- num: int, default= 100
The number of points in the radial distribution.
Preconditions¶
The coordinate variables must be available at node and the integration will be performed on all the other variables.
Main functions¶
Example¶
import os
if not os.path.isdir('OUTPUT'):
os.makedirs('OUTPUT')
import numpy as np
from antares import Reader, Treatment, Writer
#
# Data can be downloaded from
# https://cerfacs.fr/antares/downloads/application1_tutorial_data.tgz
r = Reader('bin_tp')
r['filename'] = os.path.join('..', 'data', 'ROTOR37', 'ELSA_CASE', 'MESH',
'mesh_<zone>.dat')
r['zone_prefix'] = 'Block'
r['topology_file'] = os.path.join('..', 'data', 'ROTOR37', 'ELSA_CASE',
'script_topo.py')
r['shared'] = True
base = r.read()
print(base.families)
r = Reader('bin_tp')
r['base'] = base
r['filename'] = os.path.join('..', 'data', 'ROTOR37', 'ELSA_CASE', 'FLOW',
'flow_<zone>.dat')
r['zone_prefix'] = 'Block'
r['location'] = 'cell'
r.read()
base.set_computer_model('internal')
# Needed for turbomachinery dedicated treatments
base.cell_to_node()
base = base.get_location('node')
print(base.families)
base.compute('psta')
base.compute('Pi')
base.compute('theta')
P0_INF = 1.9
base.compute('MachIs = (((%f/psta)**((gamma-1)/gamma)-1.) * (2./(gamma-1.)) )**0.5' % P0_INF)
# Definition of the treatment
t = Treatment('azimuthalmean')
t['base'] = base
t['family_name'] = 'BLADE'
t['num'] = 60
writer = Writer('column') # for 2D plot
# Azimuthal mean
res_dir = os.path.join('OUTPUT', 'AZ_MEAN')
if not os.path.isdir(res_dir):
os.makedirs(res_dir)
NUM = 9
x = np.linspace(-12.5, 12.5, NUM)
for i in range(0, NUM):
print('radial distribution at x = {}'.format(x[i]))
t['x_value'] = x[i]
azim_base = t.execute()
writer['filename'] = os.path.join(res_dir, 'flow_azim_%i.plt' % x[i])
writer['base'] = azim_base[:, :, ('R', 'rovx', 'vx', 'ro')]
writer.dump()