hkmoffat / cantera

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

overzealous XML error checking in cantera 2.0? #78

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi, I have an xml file which has served me well with cantera 1.8.  I recently 
tried 2.0 and the file was rejected when a reaction specified an efficiency for 
a species which was not present in the mixture.  

An example reaction:

    <!-- reaction 0001    -->
    <reaction reversible="yes" type="threeBody" id="0001">
      <equation>N2 + M [=] 2 N + M</equation>
      <rateCoeff>
        <Arrhenius>
           <A>7.e+18</A>
           <b>-1.6</b>
           <E units="cal/mol">224801.3</E>
        </Arrhenius>
        <efficiencies default="1.0">N:4.2857 O:4.2857 C:4.2857 H:4.2857 </efficiencies>
      </rateCoeff>
      <reactants>N2:1.0</reactants>
      <products>N:2.0</products>
    </reaction>

Cantera 1.8 would allow me to use this with a mixture containing only N and O 
elements.  Cantera 2.0 aborts when it encounters C and H.

If possible I would really like to maintain the 1.8 capability.  In particular, 
it allows me to define a single set of reactions and use them with many 
different mixtures, reducing the possibility for accidental copy/paste errors 
or reactions getting out of sync.

Is is possible to retain this functionality in 1.8?

I've attached my entire xml file for completeness.

Thanks!

-Ben

Original issue reported on code.google.com by benjamin...@gmail.com on 23 Apr 2012 at 2:13

Attachments:

GoogleCodeExporter commented 9 years ago
This behavior was changed in r1350. You should be aware that before that point, 
third-body efficiencies for undefined species resulted in writing to 
out-of-bounds memory, resulting in unknown behavior.

Your use case seems reasonable, so I think the change to make will be to have 
an option "skip_undeclared_third_bodies" that can be set on a phase definition 
to allow the behavior you specified, leaving the current behavior as default 
(which helps catch typos in the input files).

Original comment by yarmond on 26 Apr 2012 at 8:44

GoogleCodeExporter commented 9 years ago
Thank you very much, that would be very helpful.

And thanks for alerting me to the silent bug in my present usage!

Original comment by benjamin...@gmail.com on 26 Apr 2012 at 8:53

GoogleCodeExporter commented 9 years ago
This feature has been added in r1472.

Original comment by yarmond on 18 May 2012 at 10:45

GoogleCodeExporter commented 9 years ago
Thanks! 

Could you please clarify the syntax for specifying the requisite option 
"skip_undeclared_species" in the XML file? Not sure where it goes...

Original comment by benjamin...@gmail.com on 30 Jul 2012 at 5:58

GoogleCodeExporter commented 9 years ago
In the XML format, the way to add this option is as a child of the 
"reactionArray" element of the "phase" element. If you have:

     <reactionArray datasrc="#reaction_data" />

this should be replaced with:

    <reactionArray datasrc="#reaction_data">
      <skip third_bodies="undeclared" />
    </reactionArray>

Original comment by yarmond on 30 Jul 2012 at 7:48