CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   OpenFOAM 1.7 and CVODE (http://www.cfd-online.com/Forums/openfoam/88433-openfoam-1-7-cvode.html)

adhiraj May 17, 2011 12:07

OpenFOAM 1.7 and CVODE
 
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?

markusrehm May 17, 2011 16:09

Hi,

have a look at this thread:

http://www.cfd-online.com/Forums/ope...de-solver.html

Markus

adhiraj May 18, 2011 16:21

Thanks for replying.
I managed to do that in 1.7, but there must be bugs, for the CVODE solver seems slower than KRR4.

markusrehm May 19, 2011 04:29

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

adhiraj May 19, 2011 12:35

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.

markusrehm May 20, 2011 06:08

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.

adhiraj May 22, 2011 00:01

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?


All times are GMT -4. The time now is 10:36.