Skip to content

Commit f59fcf6

Browse files
authored
Merge pull request #59 from Kenneth-T-Moore/interp
For tabular aero, use the 3d-slinear if possible.
2 parents d2f89d4 + 4782d4f commit f59fcf6

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

pycycle/thermo/tabular/tabular_thermo.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,26 @@ def setup(self):
1616
spec = self.options['spec']
1717
composition = self.options['composition']
1818

19-
if composition is None:
19+
if composition is None:
2020
composition = TAB_AIR_FUEL_COMPOSITION
2121

2222
sorted_compo = sorted(composition.keys())
2323

2424
interp = om.MetaModelStructuredComp(method=interp_method, extrapolate=True)
25-
self.add_subsystem('tab', interp, promotes_inputs=['P', 'T'],
25+
self.add_subsystem('tab', interp, promotes_inputs=['P', 'T'],
2626
promotes_outputs=['h', 'S', 'gamma', 'Cp', 'Cv', 'rho', 'R'])
2727

28-
for i, param in enumerate(sorted_compo):
28+
for i, param in enumerate(sorted_compo):
2929
interp.add_input(param, composition[param], training_data=spec[param])
3030
self.promotes('tab', inputs=[(param, 'composition')], src_indices=[i,])
3131
self.set_input_defaults('composition', src_shape=len(composition))
3232

3333
interp.add_input('P', 101325.0, units='Pa', training_data=spec['P'])
3434
interp.add_input('T', 273.0, units='degK', training_data=spec['T'])
3535

36+
if len(sorted_compo) == 1 and interp_method == 'slinear':
37+
interp.options['method'] = '3D-slinear'
38+
3639
interp.add_output('h', 1.0, units='J/kg', training_data=spec['h'])
3740
interp.add_output('S', 1.0, units='J/kg/degK', training_data=spec['S'])
3841
interp.add_output('gamma', 1.4, units=None, training_data=spec['gamma'])
@@ -42,6 +45,6 @@ def setup(self):
4245
interp.add_output('R', 287.0, units='J/kg/degK', training_data=spec['R'])
4346

4447
# required part of the SetTotalTP API for flow setup
45-
# use a sorted list of keys, so dictionary hash ordering doesn't bite us
48+
# use a sorted list of keys, so dictionary hash ordering doesn't bite us
4649
# loop over keys and create a vector of mass fractions
4750
self.composition = [composition[k] for k in sorted_compo]

0 commit comments

Comments
 (0)