|
[Sponsors] |
May 17, 2011, 13:07 |
OpenFOAM 1.7 and CVODE
|
#1 |
Senior Member
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 16 |
Hi,
I am trying to simulate a non premixed laminar flame using OpenFOAM. I am trying to couple the Sundials CVODE solver with OpenFOAM in a way that at runtime I can choose CVODE as one of the options for an ODE solver along with SIBS, RK,KRR4. Has any one done this before? |
|
May 17, 2011, 17:09 |
|
#2 |
Senior Member
Markus Rehm
Join Date: Mar 2009
Location: Erlangen (Germany)
Posts: 184
Rep Power: 17 |
||
May 18, 2011, 17:21 |
|
#3 |
Senior Member
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 16 |
Thanks for replying.
I managed to do that in 1.7, but there must be bugs, for the CVODE solver seems slower than KRR4. |
|
May 19, 2011, 05:29 |
|
#4 |
Senior Member
Markus Rehm
Join Date: Mar 2009
Location: Erlangen (Germany)
Posts: 184
Rep Power: 17 |
Hi,
check if CVODE is compiled with optimization flags turned on (-O3). I recognized with Sundials 2.3 that this was not done by default resulting in double computational time. What kind of Mechanism are you using? For a small number of reactands the overhead in CVODE might be too large. Markus |
|
May 19, 2011, 13:35 |
|
#5 |
Senior Member
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 16 |
Hi Markus, thanks for replying. Actually I am a bit confused about the ODE solvers while solving for chemistry. I tried setting the O3 flag, and tested the case on a very simple problem--a zero D closed chamber, with just 1 cell (Is there an issue with that?) . I see that when using CVODE the reaction proceeds for a while, and then it sort of stops, and gets stuck at the 'solving chemistry' stage for ever.
I tried using a single step methane mechanism (5 species+1 reaction). I figured that the mechanism is stiff, but I am a newbie in this regard. |
|
May 20, 2011, 07:08 |
|
#6 |
Senior Member
Markus Rehm
Join Date: Mar 2009
Location: Erlangen (Germany)
Posts: 184
Rep Power: 17 |
Hello,
try playing around with tolerances to get a solution. Especially with 1-step-Mechs you might need a loose tolerance. You might write out further information from the solver to understand what is going on. To test the Mech you can also use Cantera. As I mentioned CVODE is quite complex solve libarary. If you solve only one reaction and one cell the overhead for loading and initializing is dominating the computational time. |
|
May 22, 2011, 01:01 |
|
#7 |
Senior Member
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 16 |
Hi
I finally had it running. I tested the solver on a perfectly stirred reactor case (CH4 oxidation, 1 reaction, 5 species) and compared it with Chemkin using the same conditions and mechanism/thermo. The results are in very good agreement. I also tried the other solvers, and see that (I did not expect this) the RK solver seems to perform the worst in terms of predicting ignition delay. I coupled CVODE to the ODESolver in a way that in the chemistryProperties file in the case directory you need to specify CVODE in place of SIBS or KRR4. The way OpenFOAM solves chemistry via the ODE solvers is that it splits the CFD time step into tiny parts and sends each part to the ODE solver to proceed though one step. I want to override that since CVODE seems to have its own method for calculating integration steps. Right now I am setting the initial chemical time to be unity in the chemistryProperties file( the idea is to make tChem>>deltaT) so that for each cell per CFD time step CVODE is only called once. This works for me now as I am using a laminar solver based on reacting FOAM. I doubt it would still work in turbulent cases though--as the tChem would be overwritten. Any thoughts on this? |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
CVode error while running | NewKid | OpenFOAM | 2 | April 21, 2011 05:46 |
Problem implementing CVODE ODE solver | markusrehm | OpenFOAM | 20 | October 13, 2010 18:02 |
CVODE Error message | Robert | FLUENT | 2 | February 12, 2003 19:28 |