Skip to content

Commit d8ade12

Browse files
Sai KrishnaSam
Sai Krishna
authored and
Sam
committed
ignition delays and jsr simulations successfully work
1 parent 110cfcf commit d8ade12

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

pyteck/simulation.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,10 +272,15 @@ def run_case(self,restart=False):
272272
'temperature': tables.Float64Col(pos=1),
273273
'pressure': tables.Float64Col(pos=2),
274274
'volume': tables.Float64Col(pos=3),
275-
'mass_fractions': tables.Float64Col(
276-
shape=(self.reac.thermo.n_species), pos=4
277-
),
278275
}
276+
if self.kind =='ignition delay':
277+
table_def['mass_fractions']=tables.Float64Col(
278+
shape=(self.reac.thermo.n_species), pos=4
279+
)
280+
elif self.kind == 'species profile':
281+
table_def['mole_fractions']=tables.Float64Col(
282+
shape=(self.reac.thermo.n_species), pos=4
283+
)
279284

280285
with tables.open_file(self.meta['save-file'], mode='w',
281286
title=self.meta['id']
@@ -526,7 +531,7 @@ def __init__(self,*args,target_species_name):
526531

527532
def jsr(self,model_file,species_key,path=''):
528533
self.gas = super(JSRSimulation,self).setup_case(model_file,species_key,path)
529-
self.maxsimulationtime = 60
534+
self.time_end = 60
530535
self.pressurevalcof = 0.01
531536
self.maxpressurerise = 0.01
532537
# Reactor volume needed in m^3 for Cantera
@@ -550,7 +555,8 @@ def jsr(self,model_file,species_key,path=''):
550555
file_path = os.path.join(path, self.meta['id'] + '.h5')
551556
self.meta['save-file'] = file_path
552557
self.meta['target-species-index'] = self.gas.species_index(species_key[self.target_species_name])
553-
558+
def run(self,restart=False):
559+
super(self.__class__,self).run_case(restart=restart)
554560
def process_jsr(self):
555561
table = super(JSRSimulation,self).process_results()
556562
return table.col('mole_fractions')[:,self.meta['target-species-index']][-1]

0 commit comments

Comments
 (0)