CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

OpenFOAM 1.7 and CVODE

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 17, 2011, 13:07
Default OpenFOAM 1.7 and CVODE
  #1
Senior Member
 
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 16
adhiraj is on a distinguished road
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?
adhiraj is offline   Reply With Quote

Old   May 17, 2011, 17:09
Default
  #2
Senior Member
 
Markus Rehm
Join Date: Mar 2009
Location: Erlangen (Germany)
Posts: 184
Rep Power: 17
markusrehm is on a distinguished road
Hi,

have a look at this thread:

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

Markus
markusrehm is offline   Reply With Quote

Old   May 18, 2011, 17:21
Default
  #3
Senior Member
 
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 16
adhiraj is on a distinguished road
Thanks for replying.
I managed to do that in 1.7, but there must be bugs, for the CVODE solver seems slower than KRR4.
adhiraj is offline   Reply With Quote

Old   May 19, 2011, 05:29
Default
  #4
Senior Member
 
Markus Rehm
Join Date: Mar 2009
Location: Erlangen (Germany)
Posts: 184
Rep Power: 17
markusrehm is on a distinguished road
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
markusrehm is offline   Reply With Quote

Old   May 19, 2011, 13:35
Default
  #5
Senior Member
 
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 16
adhiraj is on a distinguished road
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.
adhiraj is offline   Reply With Quote

Old   May 20, 2011, 07:08
Default
  #6
Senior Member
 
Markus Rehm
Join Date: Mar 2009
Location: Erlangen (Germany)
Posts: 184
Rep Power: 17
markusrehm is on a distinguished road
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.
markusrehm is offline   Reply With Quote

Old   May 22, 2011, 01:01
Default
  #7
Senior Member
 
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 16
adhiraj is on a distinguished road
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?
adhiraj is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 01:16.