View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001314OpenFOAM[All Projects] Bugpublic2014-06-05 09:512014-06-06 09:23
Reportersebastianb 
Assigned Towill 
PrioritynormalSeveritytrivialReproducibilityhave not tried
StatusresolvedResolutionfixed 
Platformx86_64OSopensuseOS Version12.1
Product Version2.3.x 
Target VersionFixed in Version 
Summary0001314: sigsegv in reactingfoam for single species reaction
Descriptioncomputing reactions involving only two species leads to segmentation fault.

e.g. reaction
reactants = products
Steps To Reproducerun reactingfoam with the following simple reaction

reaction
    {
        type irreversibleArrheniusReaction;
        reaction "rectants = products";
        A 1.04e5;
        beta 1;
        Ta 10800;
    }
Additional InformationIn function omega in chemistryModel.C on lines 191 and 234 a loop over some array starts at 1. Apparently the array is shorter for such simple reactions above.

TagsNo tags attached.
Attached Fileszip file icon counterFlowFlame2D.zip [^] (11,246 bytes) 2014-06-05 12:35
zip file icon duct.zip [^] (9,968 bytes) 2014-06-05 14:18

- Relationships

-  Notes
(0003102)
will (developer)
2014-06-05 11:01

The loops seem correct to me. The index is set to zero and then the loop starts from 1. The loop picks the index of smallest concentration involved in the reaction. If the number of reactants/products is one, the loop is never entered, and the zero index is retained by default.

I've modified the counterFlowFlame2D case to use just an "A = B" type reaction, and it runs fine. The segfault may be from somewhere else. Could you please upload a small case which fails?
(0003104)
sebastianb (reporter)
2014-06-05 12:37

OK. I've done the same thing as you did. Additionally I remove all other species.
Now I get a sigfpe from the chemistryreader.
Note that if you add N2 back into the species section of the reactions file it'll work.
(0003105)
will (developer)
2014-06-05 13:40

Your two species are both set to zero. Multi-component thermo normalises the fractions by dividing by the total fraction. In this case, that results in a divide by zero error.

The error is a floating point error (sigFpe) and not a segfault (sigSegv).

Is this the same error as your original case? If so, there doesn't appear to be a bug here.
(0003106)
sebastianb (reporter)
2014-06-05 14:23

First of all thank you for the immediate response.

OK. I set up another test case. as simple as possible.
It runs fine with just 2 species. Please ignore any warnings from janaf thermo.

However, I get sigfpe from the chemistryReader if I use constant transport and thermo packages.
(0003107)
sebastianb (reporter)
2014-06-05 14:34

By the way, the very same case runs fine with OF-2.1.x
(0003109)
will (developer)
2014-06-06 09:23

There was a bug. Reaction.C creates a thermo for RHS minus LHS of the reaction, so it can calculate changes in enthalpy/free energy/etc... It was also creating a transport model, which it doesn't need. The mixing rules for the transport models can divide by zero if the left and right hand sides are identical, as is the case with your "A = B" reaction.

Commit 645a94ec380c54329c3510083532acd73bee2381 fixes this. The reaction class now only creates the thermo, and not the transport. Thanks for the report.

- Issue History
Date Modified Username Field Change
2014-06-05 09:51 sebastianb New Issue
2014-06-05 11:01 will Note Added: 0003102
2014-06-05 12:35 sebastianb File Added: counterFlowFlame2D.zip
2014-06-05 12:37 sebastianb Note Added: 0003104
2014-06-05 13:40 will Note Added: 0003105
2014-06-05 14:18 sebastianb File Added: duct.zip
2014-06-05 14:23 sebastianb Note Added: 0003106
2014-06-05 14:34 sebastianb Note Added: 0003107
2014-06-06 09:23 will Note Added: 0003109
2014-06-06 09:23 will Status new => resolved
2014-06-06 09:23 will Resolution open => fixed
2014-06-06 09:23 will Assigned To => will