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

Why is Sundials CVODE ode-solver so slow?

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By luiscardona
  • 1 Post By dlahaye

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 27, 2014, 05:49
Default Why is Sundials CVODE ode-solver so slow?
  #1
New Member
 
James Behzadi
Join Date: Oct 2011
Location: Sydney, Australia
Posts: 27
Rep Power: 15
JBUNSW is on a distinguished road
Dear all,

I implemented SUNDIALS CVODE 2.7 in OpenFOAM 2.0.x. I pretty much followed the instructions given here. I am using BDF with Newton linear solver. I tested my implementation with OpenFOAM's native "test-ode.C" solver and it works fine.

However, when I use it to integrate the ODE system in a 58 species chemistry mechanism which is highly stiff, the cpu-time dramatically increases. It becomes even slower than OpenFOAM's native ODE-solver "RK" which is an explicit ODE solver.

The problem, I guess, is the jacobian. The chemistry mechanism I am using is in the form of a Fortran subroutine that outputs the derivatives "only". I don't have any information on the jacobian. That's why I can not provide the jacobian function as input to CVODE, and consequently CVODE calculates the jacobian by its internal "difference-quotient" jacobian estimator.

Any help is highly appreciated.

Jalal
JBUNSW is offline   Reply With Quote

Old   February 27, 2014, 12:06
Default
  #2
New Member
 
Luis Cardona
Join Date: Mar 2011
Location: Medellin, Colombia
Posts: 6
Rep Power: 15
luiscardona is on a distinguished road
@JBUNSW

After several tests I reached similar conclusions about CVODE. So in my case I had to use SIBS.

In order to speed up a bit my simulation, which also involved a chemical mechanism, I ended using a tabulation technique (ISAT) and got a faster simulation by a factor of 2 or more (28 species mechanism). Perhaps it wouldn't be possible to use in your case, because your mechanism comes from a FORTRAN routine...
JBUNSW likes this.
luiscardona is offline   Reply With Quote

Old   March 6, 2014, 20:52
Default
  #3
New Member
 
James Behzadi
Join Date: Oct 2011
Location: Sydney, Australia
Posts: 27
Rep Power: 15
JBUNSW is on a distinguished road
Thanks Luis for your feedback.

Anyone else has anything to share, please? Any tips are highly appreciated.
JBUNSW is offline   Reply With Quote

Old   April 30, 2014, 15:23
Default
  #4
Senior Member
 
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 16
adhiraj is on a distinguished road
I have also noticed it. For mechanisms that are important for my work,
(~100-200 species), CVODE slows to a crawl, or cannot solve the system at all.
On the other hand for the large mechanisms, SIBS seems to run.
adhiraj is offline   Reply With Quote

Old   September 10, 2020, 08:15
Default
  #5
Senior Member
 
Reviewer #2
Join Date: Jul 2015
Location: Knoxville, TN
Posts: 141
Rep Power: 11
randolph is on a distinguished road
Quote:
Originally Posted by adhiraj View Post
I have also noticed it. For mechanisms that are important for my work,
(~100-200 species), CVODE slows to a crawl, or cannot solve the system at all.
On the other hand for the large mechanisms, SIBS seems to run.
Adhiraj,

I am planning to follow your path to use CVODE with OpenFOAM. Before I put in the effort (and after your observation of performance of CVODE), I would like to consult you, if possible.

I am trying to solve ODE with fraction orders such as dy/dx = -1*sqrt(y). I tried the ODE solver in OpenFOAM. The explicit solver RK family and Euler require an extreme small time step to integrate. And all the other ODE solvers complain about singular matrix. After some google, I realize the ODE that I try to solve is a type of fractional ODE and is difficult to solve (I may be wrong).

Here is the definition of the ODE in the ODE-test that I use to solve dy/dx = -1*sqrt(y). Did I made some mistakes? Do you think I can benefit from CVODE?

Code:
    void derivatives
    (
        const scalar x,
        const scalarField& y,
        scalarField& dydx
    ) const
    {
        dydx[0] = -1*Foam::pow(y[0],0.5);
    }

    void jacobian
    (
        const scalar x,
        const scalarField& y,
        scalarField& dfdx,
        scalarSquareMatrix& dfdy
    ) const
    {
        dfdx[0] = 0.0;
        dfdy(0, 0) = -1*0.5*Foam::pow(y[0],0.5-1.0);
    }
Thanks,
Rdf
randolph is offline   Reply With Quote

Old   September 13, 2020, 15:56
Default
  #6
Senior Member
 
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 16
adhiraj is on a distinguished road
It has been some time since I have used CVODE, and there have been newer versions of the code. If you need help with CVODE, I would ask you to read the documentation of the code, and ask questions on their mailing list.
adhiraj is offline   Reply With Quote

Old   September 22, 2022, 05:45
Default
  #7
Member
 
bany
Join Date: Nov 2019
Posts: 50
Rep Power: 8
bany is on a distinguished road
Quote:
Originally Posted by JBUNSW View Post
Dear all,

I implemented SUNDIALS CVODE 2.7 in OpenFOAM 2.0.x. I pretty much followed the instructions given here. I am using BDF with Newton linear solver. I tested my implementation with OpenFOAM's native "test-ode.C" solver and it works fine.

However, when I use it to integrate the ODE system in a 58 species chemistry mechanism which is highly stiff, the cpu-time dramatically increases. It becomes even slower than OpenFOAM's native ODE-solver "RK" which is an explicit ODE solver.

The problem, I guess, is the jacobian. The chemistry mechanism I am using is in the form of a Fortran subroutine that outputs the derivatives "only". I don't have any information on the jacobian. That's why I can not provide the jacobian function as input to CVODE, and consequently CVODE calculates the jacobian by its internal "difference-quotient" jacobian estimator.

Any help is highly appreciated.

Jalal

Dear JBUNSW, i like follow your work implementing CVODE into OpenFOAM. Sorry to recall this post. Are you solve the problem that slower calculation when used CVODE?

Thanks a lot
bany is offline   Reply With Quote

Old   September 25, 2022, 16:12
Default
  #8
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 802
Blog Entries: 1
Rep Power: 18
dlahaye is on a distinguished road
https://github.com/blttkgl/DLBFoam-1.0
francescomarra likes this.
dlahaye is offline   Reply With Quote

Reply

Tags
cvode, dq jacobian


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
Is it possible to accelerate the ode solver of reactingFoam? pajofego OpenFOAM Running, Solving & CFD 2 August 10, 2014 06:38
Need ODE solver Levi Main CFD Forum 3 April 9, 2003 23:38
CFX 5.5 Roued CFX 1 October 2, 2001 17:49
Setting a B.C using UserFortran in 4.3 tokai CFX 10 July 17, 2001 17:25
Error during Solver cfd guy CFX 4 May 8, 2001 07:04


All times are GMT -4. The time now is 17:05.