Slice at an axial position (x-coordinate)¶
Cut at an axial position
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:
- vectors: tuple/list(tuple(str)), default= []
Component names of vectors that need to be rotated. It is assumed that these are given in the cartesian coordinate system.
- nb_duplication: int, default= ‘in_attr’
number of duplications to apply after doing the axial cut if duplicate is True. If set to ‘in_attr’, then it is computed from ‘nb_blade’ in
Instant.attrs
.
- duplicate: bool, default= False
Duplication of the axial cut. Chorochronic if HB/TSM type.
- family_name: str
The name of the family from which the percent will be computed and on which the cut is computed.
- percent: float, default= None
The percentage relative to the family to determine the absolute position value of the cut.
- position: float, default= None
The absolute position value relative to the family where the cut must be made.
Main functions¶
- class antares.treatment.turbomachine.TreatmentSliceX.TreatmentSliceX¶
- execute()¶
Execute the treatment.
This method performs a cut at an axial position. Either the value of the axial position is given, or it is computed knowing the family name and the percentage. The latter are used to determine the absolute position of the cut.
Then, you can make a simple duplication or a chorochronic duplication of this cut.
Warning
The axial coordinate should be named ‘x’.
- Returns:
- Return type:
None or
Base
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)
res_dir = os.path.join('OUTPUT', 'SLICEX')
if not os.path.isdir(res_dir):
os.makedirs(res_dir)
t = Treatment('slicex')
t['base'] = base
t['family_name'] = 'BLADE'
writer = Writer('bin_tp')
NUM = 9
x = np.linspace(-12.5, 12.5, NUM)
for i in range(0, NUM):
print('cut at x = {}'.format(x[i]))
t['position'] = x[i]
base = t.execute()
writer['filename'] = os.path.join(res_dir, 'slicex_%i.plt' % x[i])
writer['base'] = base
writer.dump()