gas=ct.Solution(... Takes forever

187 views
Skip to first unread message

VNechev

unread,
Nov 19, 2019, 11:28:01 AM11/19/19
to Cantera Users' Group
Hello all,

For starters, thank you to everyone who helped me figure out how to convert my chemkin files into CTI! I'm assuming I made all the correct changes as it successfully converted to a mechanism with 2755 species and 14314 reactions despite receiving a lot of warnings such as:



Around 20 or so of the following:
WARNING:root:Ignoring duplicate transport data for species "ch2och2o2h" on line 1578 of "C:\Users\vnechev\AppData\Local\Continuum\anaconda3\envs\canteraenv\Lib\site-packages\cantera\data\SarathyTran.txt".
WARNING:root:Ignoring duplicate transport data for species "c5h81-3" on line 1720 of "C:\Users\vnechev\AppData\Local\Continuum\anaconda3\envs\canteraenv\Lib\site-packages\cantera\data\SarathyTran.txt".
Eyeballing around 1000 of the following:
INFO:root:Skipping unexpected species "ic13h27cho" while reading thermodynamics entry.
Eyeballing around 100 of the following:
WARNING:root:Found additional thermo entry for species c4h6. If --permissive was given, the first entry is used.



My issue arises now as I am following the batch_reactor_ignition_delay_NTC.ipynb Cantera example online. When I get to the line 
gas = ct.Solution('SarathyChem.cti')
it takes a large amount of time, and finally when I go to compute the ignition delay:
#Tic
t0 = time.time()
# This is a starting estimate. If you do not get an ignition within this time, increase it
estimatedIgnitionDelayTime = 0.1
t = 0
counter = 1;
while(t < estimatedIgnitionDelayTime):
    t = reactorNetwork.step()
    if (counter%100 == 0):
        # We will save only every 10th value. Otherwise, this takes too long
        # Note that the species concentrations are mass fractions
        timeHistory.loc[t] = reactorNetwork.get_state()
    counter+=1
# We will use the 'oh' species to compute the ignition delay
tau = ignitionDelay(timeHistory, 'oh')
#Toc
t1 = time.time()
print('Computed Ignition Delay: {:.3e} seconds. Took {:3.2f}s to compute'.format(tau, t1-t0))
It takes forever (not sure how long as it is currently running).

How can I get the ignition delay time from this simulation faster? As I need to sweep over various temperatures and pressures. Maybe I should change the 'oh' indicator species? I have only made a change to save every 100th value instead of every 10th.

Thanks





SarathyChem.cti

Bulut T

unread,
Nov 19, 2019, 11:56:32 AM11/19/19
to Cantera Users' Group
t
Hey,

The warnings tell you that you have multiple entries for the given species, describing their transport properties. I personally think you can discard them, or just have one of the transport sets for each specie.

As for loading times, as you said you are trying to use a chemical mechanism with 2755 species, so I think it's normal that it takes long (Assuming nothing is wrong with the .cti file). What you can do is you can look at ways to parallelize
the parameters you are going to be looping over. There is a tutorial showing how you can run cantera in multi-processing mode:


Alternatively, you can just utilize some python scripting to pseudo-parallelize the cantera problems. For example if you have n different conditions to investigate and m processors, you can make it so that each processor solves n/m problems, etc.

Best,

Bulut

SERGIO SANCHEZ MARTINEZ

unread,
Nov 19, 2019, 12:09:33 PM11/19/19
to canter...@googlegroups.com
Just to add/mention that:
the CPU time scales by NumberOfSpecies^y, but scales with NumberOfReactions*y.
so it is the # of species which is the real problem in terms of CPU time.    

The best VNechev

--
You received this message because you are subscribed to the Google Groups "Cantera Users' Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cantera-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cantera-users/c7d67874-88d9-4207-a213-4e76a1bbbab4%40googlegroups.com.


--
"La verdad Os hará libres"

Ray Speth

unread,
Nov 21, 2019, 5:32:29 PM11/21/19
to Cantera Users' Group

Hi,

If you’re just doing reactor simulations and not flames, you can speed up the initial import of your mechanism by writing:

gas = ct.Solution('SarathyChem.cti', transport_model=None)

Most of the time taken by the import process is in calculating collision integrals for each pair of species, a process which scales with the number of species squared. If you don’t need transport properties, this step can be skipped.

For the ignition delay calculation, what constitutes “forever”? I tried a case with the mechanism you provided, and it ran in about 2 minutes on my computer (a 5 year old quad-core desktop). This doesn't seem unreasonable for such a large mechanism. I would try adding some print statements inside the while loop to see what progress the integrator is making and how the state of the gas is changing.

Regards,
Ray

Reply all
Reply to author
Forward
0 new messages