hkmoffat / cantera

Automatically exported from code.google.com/p/cantera
0 stars 0 forks source link

Increase value of 'Tiny' for ctml.cpp #88

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Solution data can sometimes contain mass fractions a little below zero due to 
roundoff errors. When restoring data that has such information (in ctml.cpp), 
Cantera might throw a warning that this value is not physical. To ignore the 
numerical errors, this warning is only given when the value is significantly 
below zero. This difference is defined by the value 'Tiny' in ct_defs.h, line 
174, which is set to 1E-20.

However, in my simulations, I often get mass fractions of the order -2E-18, 
which exceeds this limit. While I consider this still the simulation as 
accurate enough, I do get a lot of warnings when restoring the simulation. It's 
not a big issue, but annoying;)

I therefore request two options:
a)  Increase the value 'Tiny' in ct_defs.h, line 174, to 1E-17, or
b)  exchange this variable for something like 'Tiny_ctml' or 'Small' for the 
use in ctml.cpp.

I use r1513 on OS X 10.6

Thanks a lot!

BTW: I found out that the value 'tiny' is also used in MultiPhaseEquil.cpp as 
'TINY', which might be redundant.

Original issue reported on code.google.com by thetruet...@googlemail.com on 4 Jun 2012 at 12:16

GoogleCodeExporter commented 9 years ago
I think that this form of range checking at the XML-reading stage doesn't make 
very much sense in the first place. If the values are outside the acceptable 
range, that should have been detected and dealt with when the file was written.

I'm inclined to remove the bounds definitions when the file is saved, and in a 
later release changing the signature of the addFloatArray function to remove 
the minval andm axval arguments.

Original comment by yarmond on 6 Jun 2012 at 7:02

GoogleCodeExporter commented 9 years ago
Thank you for dealing with this issue! I also think that capturing this effect 
before the solution file is written is a good idea. Still, I personally would 
say that the range check does make sense for the case that someone tempers with 
the solution file.

Original comment by thetruet...@googlemail.com on 18 Jun 2012 at 12:11

GoogleCodeExporter commented 9 years ago

Original comment by yarmond on 21 Jun 2012 at 8:07

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r2230.

Original comment by yarmond on 12 Apr 2013 at 11:07