ReactionMechanismGenerator / RMG-Py

Python version of the amazing Reaction Mechanism Generator (RMG).
http://reactionmechanismgenerator.github.io/RMG-Py/
Other
382 stars 226 forks source link

Derivative continuity constraints between low- and high-temperature NASA polynomials #22

Closed gmagoon closed 14 years ago

gmagoon commented 14 years ago

Currently, NASA polynomials created from Wilhoit polynomials are constrained to have continuous first and second derivatives at the intermediate temperature. Perhaps we should provide option(s) for relaxation of these constraints to allow discontinuous second-derivatives, and perhaps even discontinuous first derivatives, allowing a better fit.

rwest commented 14 years ago

Would it be a 'better' fit though?

In my experience discontinuities make convergence hard for Cantera at the intermediate temperature. (imagine a Newton-Raphson solve to find T from U when your dU/dT is different at either side of the T you're trying to converge upon)

gmagoon commented 14 years ago

You are right...I should be more precise with the term "better". By "better fit" I mean to say that the resulting NASA polynomial could have smaller (RMS) deviation from the Wilhoit polynomial (and it certainly wouldn't be a "worse fit" (in the same sense)).

Regarding convergence, I see your point, but I think it would not be an issue here. dU/dT = Cp - R (ideal gas) or Cp (incompressible liquid), which would still be continuous with T (i.e. it would still have essentially the same value on either side of the cutoff temperature, and the limit at the cutoff temperature would still be well-defined)...it would just be the second (and potentially first) derivative that could be discontinuous.

rwest commented 14 years ago

Ok, now imagine you're not doing Newton Raphson, but something that takes the second and third derivatives into account...

I remember it being an issue in my thesis work, and having to go to some trouble to ensure a smooth join.

gmagoon commented 14 years ago

OK, so I've pushed an update to my branch that generalizes the constraints and closes this issue, allowing for tighter or looser continuity constraints. The default is continuity of the heat capacity function and its first and second derivatives. The tightest setting makes all derivatives of the heat capacity function continuous and the loosest setting does not constrain continuity at all.

Update: I should note that the tightest case effectively constrains all the coefficients to be equal and is equivalent to fitting only one polynomial (rather than two).

gmagoon commented 14 years ago

generalized continuity constraints in Wilhoit2NASA; closed by f194893bc8c3efd70c2b517a2b8d6458d95ba99e