Skip to content

Commit

Permalink
Added 1 bar reference pressure to cantera conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholaswogan committed Apr 24, 2024
1 parent 3f1ee7e commit a3c20e6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions photochem/utils/_convert_cantera.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ def photochem2cantera_main(data):

# Cantera can't handle > 2 temperature ranges for thermodynamic data
for i in range(len(data['species'])):
if len(data['species'][i]['thermo']['temperature-ranges']) > 3:
data['species'][i]['thermo']['reference-pressure'] = '1.0e6' # dynes/cm^2
if len(data['species'][i]['thermo']['temperature-ranges']) > 3 and data['species'][i]['thermo']['model'] == 'Shomate':
data['species'][i]['thermo']['temperature-ranges'] = data['species'][i]['thermo']['temperature-ranges'][:3]
data['species'][i]['thermo']['data'] = data['species'][i]['thermo']['data'][:2]

Expand All @@ -76,7 +77,7 @@ def photochem2cantera_main(data):
phases[0]["species"] = blockseqtrue(species)
phases[0]["kinetics"] = "gas"
phases[0]["reactions"] = "all"
phases[0]["state"] = flowmap({"T": 300.0,"P":1.0e5})
phases[0]["state"] = flowmap({"T": 300.0,"P": 1.0e5})

data = FormatReactions_main(data)
data['units'] = units
Expand Down
7 changes: 4 additions & 3 deletions photochem/utils/_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,12 @@ def FormatReactions_main(data):
data['species'][i]['composition'] = flowmap(data['species'][i]['composition'])
if 'thermo' in data['species'][i].keys():

order = ['model','temperature-ranges','data','note']
order = ['model', 'reference-pressure','temperature-ranges','data']
copy = data['species'][i]['thermo'].copy()
data['species'][i]['thermo'].clear()
for key in copy:
data['species'][i]['thermo'][key] = copy[key]
for key in order:
if key in copy.keys():
data['species'][i]['thermo'][key] = copy[key]

data['species'][i]['thermo']['temperature-ranges'] = blockseqtrue(data['species'][i]['thermo']['temperature-ranges'])

Expand Down

0 comments on commit a3c20e6

Please sign in to comment.