[SciPy-user] integrate.odeint , stiff chemical equations and mass conservation -any hint?

Sebastian Walter sebastian.walter at gmail.com
Wed Jun 3 03:18:30 EDT 2009


On Wed, Jun 3, 2009 at 3:31 AM, Joshua Stults <joshua.stults at gmail.com> wrote:
> I think the standard way to "fix" stiff problems is to go to implicit
> time-stepping.
>
> Here's a nice write-up about using implicit time-stepping for chemical kinetics:
> http://www.osti.gov/bridge/servlets/purl/45627-eDTnun/webviewable/45627.pdf
>
> It's over a decade old, but might give you some hints on how to solve
> your problem.
>
> If you are integrating the system accurately you should be conserving
> mass, even with big implicit time-steps, your production and loss
> terms should balance at each step.
>
> On Tue, Jun 2, 2009 at 4:43 PM, Anne Archibald
> <peridot.faceted at gmail.com> wrote:
>> 2009/6/2 ms <devicerandom at gmail.com>:
>>> Hi Anne,
>>>
>>> Thanks for the suggestions! I didn't know about pydstool and I will
>>> definitely try it.
>>>
>>>> On the other hand, it may be more valuable to keep the total mass as a
>>>> free parameter so that you can judge the quality of your solutions by
>>>> looking at how much it varies. After all, the total mass is only one
>>>> direction in which your approximate solution can deviate from the true
>>>> solution.
>>>
>>> True; however we want to use the model to predict somehow the
>>> concentrations of species in a chemical system, and if mass is not
>>> conserved (it goes up like 10 times) such prediction won't look good :)
>>
>> Indeed not, but it seems to me that there's a risk that enforcing mass
>> conservation will avoid that problem but then leave you with answers
>> that are just as wrong but not in an obvious way.
>>
>> Anne
>
> I agree with Anne, mass conservation is a good diagnostic to help you
> catch errors (modeling, coding or otherwise).

Well, I don't know. To omit crucial information of a model is unlikely
to improve the overall quality of the solution.

I'd go with a BDF method to solve the DAE system with enforced mass
conservation.
For example with:

https://computation.llnl.gov/casc/sundials/main.html

or
http://www.iwr.uni-heidelberg.de/~Jan.Albersmeyer/solvind/index.php?t=0

Both packages have the advantage that they can compute not only the
solution in a robust way but also give you derivative information that
you need if you want to solve an optimization problem with DAE
constraint.





>
>>
>>>> It's also, of course, possible there's a bug in your derivative
>>>> function - it's worth checking that the derivative vector is always
>>>> orthogonal to the gradient of mass-as-a-function-of-your-parameters.
>>>
>>> Thanks for the hint, I will check it.
>>>
>>> m.
>>> _______________________________________________
>>> SciPy-user mailing list
>>> SciPy-user at scipy.org
>>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>>
>> _______________________________________________
>> SciPy-user mailing list
>> SciPy-user at scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>
>
> --
> Joshua Stults
> Website: http://j-stults.blogspot.com
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>



More information about the SciPy-User mailing list