-
-
Notifications
You must be signed in to change notification settings - Fork 346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem in vcs_phaseStability #187
Comments
The script: #Script adapted from multiphase_plasma.py to demonstrate the problem described by issue 187.
from Cantera import *
import numpy as np
# create objects representing the gas phase and the condensed
# phases. The gas is a mixture of multiple species, and the condensed
# phases are all modeled as incompressible stoichiometric
# substances. See file KOH.cti for more information.
phases = importPhases('KOH.cti',
['K_solid',
'K_liquid', 'KOH_a', 'KOH_b',
'KOH_liquid', 'K2O2_solid',
'K2O_solid', 'KO2_solid',
'ice', 'liquid_water','KOH_plasma'])
# create the Mixture object from the list of phases
mix = Mixture(phases)
# open the output file and write the column headings
f = open('equil_koh.csv','w')
writeCSV(f,['T']+mix.speciesNames())
# loop over temperature
for t in np.linspace(300,5000,1000):
print 'T = ',t
mix.set(T= t, P = 0.01*OneAtm, Moles="O2:1")
# set the mixture to a state of chemical equilibrium holding
# temperature and pressure fixed
# mix.equilibrate("TP",maxsteps=10000,loglevel=1)
mix.vcs_equilibrate("TP",printLvl=0,maxsteps=10000,loglevel=0)
# write out the moles of each species
writeCSV(f,[t]+ list(mix.speciesMoles()))
# close the output file
f.close() Original comment by |
Original comment by
|
Original comment by
|
Here is a version of the script updated for the 'new' Python module. Running this code in Valgrind shows errors in two locations, both related to using 'kspec - m_numComponents' as an index: One is in VCS_SOLVE::vcs_popPhaseID, where irxn is calculated under the condition 'Vphase->m_singleSpecies'. (Line 285 of vcs_phaseStability.cpp in r2990). The second is the previously-reported one in VCS_SOLVE::vcs_popPhaseRxnStepSizes (Line 367 of vcs_phaseStability.cpp in r2990). Original comment by #Script adapted from multiphase_plasma.py to demonstrate
# the problem described by issue 187.
from cantera import *
import numpy as np
import sys
import time
phases = import_phases('KOH.xml',
['K_solid',
'K_liquid', 'KOH_a', 'KOH_b',
'KOH_liquid', 'K2O2_solid',
'K2O_solid', 'KO2_solid',
'ice', 'liquid_water','KOH_plasma'])
mix = Mixture(phases)
# loop over temperature
print '######### START OF EQUILIBRIUM SOLVES #########'
for t in np.linspace(400.1, 5000, 1000):
print 'T = ',t
sys.stdout.flush()
time.sleep(0.01)
mix.T = t
mix.P = 0.01*one_atm
mix.species_moles = "O2:1"
mix.equilibrate("TP", 'vcs')
print mix.phase_moles() |
An even simpler case that demonstrates this problem (triggering the error in import cantera as ct
gas = ct.Solution('gri30.xml')
carbon = ct.Solution('graphite.xml')
gas.TPX = 923, ct.one_atm, {'H': 0.45, 'O': 0.55}
mix = ct.Mixture([(gas, 1.0), (carbon, 0.0)])
mix.T = 923
mix.P = ct.one_atm
mix.equilibrate('TP', solver='vcs', max_steps=10000) |
Original issue reported on code.google.com by
chdoi...@gmail.com
on 18 Nov 2013 at 5:27The text was updated successfully, but these errors were encountered: