Skip to content

Commit

Permalink
ignition delays and jsr simulations successfully work
Browse files Browse the repository at this point in the history
  • Loading branch information
Sai Krishna committed Aug 16, 2019
1 parent 3251de1 commit dfe4261
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions pyteck/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,15 @@ def run_case(self,restart=False):
'temperature': tables.Float64Col(pos=1),
'pressure': tables.Float64Col(pos=2),
'volume': tables.Float64Col(pos=3),
'mass_fractions': tables.Float64Col(
shape=(self.reac.thermo.n_species), pos=4
),
}
if self.kind =='ignition delay':
table_def['mass_fractions']=tables.Float64Col(
shape=(self.reac.thermo.n_species), pos=4
)
elif self.kind == 'species profile':
table_def['mole_fractions']=tables.Float64Col(
shape=(self.reac.thermo.n_species), pos=4
)

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

def jsr(self,model_file,species_key,path=''):
self.gas = super(JSRSimulation,self).setup_case(model_file,species_key,path)
self.maxsimulationtime = 60
self.time_end = 60
self.pressurevalcof = 0.01
self.maxpressurerise = 0.01
# Reactor volume needed in m^3 for Cantera
Expand All @@ -550,7 +555,8 @@ def jsr(self,model_file,species_key,path=''):
file_path = os.path.join(path, self.meta['id'] + '.h5')
self.meta['save-file'] = file_path
self.meta['target-species-index'] = self.gas.species_index(species_key[self.target_species_name])

def run(self,restart=False):
super(self.__class__,self).run_case(restart=restart)
def process_jsr(self):
table = super(JSRSimulation,self).process_results()
return table.col('mole_fractions')[:,self.meta['target-species-index']][-1]

0 comments on commit dfe4261

Please sign in to comment.