|
[Sponsors] |
A trial of implementing of CVODE as ODESolver |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 11, 2012, 05:06 |
A trial of implementing of CVODE as ODESolver
|
#1 |
Member
|
Greetings, dear colleagues.
I tried to implement CVODE solver (from sundials-2.3) as ODESolver in OF-1.6-ext. In CVODE I used backward differencing (BDF). The library compiled successfully but when I try to compile some chemistry solver with BDF support I have an error on linking stage (undefined reference to ODESolver constructor). I post the code just in case. If someone will handle with the error, I hope, the library could be useful for community. Best regards, Aleksey. |
|
February 11, 2012, 16:52 |
|
#2 |
Senior Member
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 16 |
I have incorporated the CVODE stiff ODE solver into the ODESolvers in OpenFOAM 1.7, and it is very similar to your code. (It is based on the sample provided with sundials).
I think you are trying to make the BDF a library separate from the ODE library. Why is this? Why don't you add the BDF stuff to the ODESolvers directory,(similar to say RK4, so that under ODESolvers we have ODESolvers, RK,KRR4,SIBS and BDF) as it is based on ODESolver? Then just edit the file named "files" and add the file $FOAM_SRC/ODE/ODESolvers/BDF/BDF.C" ? Last edited by adhiraj; February 11, 2012 at 16:54. Reason: explained more clearly |
|
February 11, 2012, 17:30 |
|
#3 |
Member
|
I tried to copy BDF to ODESolvers folder (which contains KRR4, SIBS, RK) and I've got the same result - the library libODE compiled successfully but when I tried to compile any solver I got an error on linking stage.
|
|
February 11, 2012, 19:48 |
|
#4 |
Senior Member
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 16 |
Try putting the BDF under the ODESolvers directory, and remove the Make directory under BDF.
Edit the Make directory of ODE to add entries for BDF. This means that there will only be one library built, and that will have SIBS+RK+BDF+KRR4, all selectable at runtime. |
|
February 12, 2012, 08:17 |
|
#5 |
Member
|
Thank you for advise. I did it. And the compilation of libODE was successful, but the compilation of solvers wasn't. The same error on linking stage - undefined reference to ODESolver constructor.
Anyway, I managed to use CVODE in OpenFoam without using ODESolver. Best regards, Aleksey. |
|
February 12, 2012, 10:50 |
|
#6 |
Senior Member
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 16 |
I am a bit confused now; what solver are you trying to build? Did you specify the libODE for each solver's Make directory?
|
|
February 14, 2012, 17:12 |
|
#7 |
New Member
Joseph Urich
Join Date: Mar 2009
Location: Pittsburgh, PA
Posts: 21
Rep Power: 17 |
Aleksey,
I've been looking into implementing CVODE or LSODE in OF 2.0.x, and came across your post. In yours, the line in BDF.C: f_data = new BDF(*this); tries to implement BDF using a copy constructor, which you didn't implement. That should be why the linker complains "undefined reference to ODESolver constructor" when you try to build an application. I think you should just be able to use: f_data = this; to get it working, but haven't tried it (I'm not running 1.6ext at the moment). Also, I hope you're aware of alternateChemistryModel, which implements Cantera and sundials/cvode? If not, it might be worth looking for. Regards. |
|
February 14, 2012, 17:43 |
|
#8 | |
Senior Member
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 16 |
Quote:
Also, the error is about the ODESolver constructor, not the BDF constructor. |
||
April 14, 2012, 04:59 |
|
#9 |
New Member
Luis Cardona
Join Date: Mar 2011
Location: Medellin, Colombia
Posts: 6
Rep Power: 15 |
Dear foamers,
After many failed attempts, I finally managed to implement BDF (CVODE solver) in OF-1.7.1 selectable at runTime like SIBS, RK and KRR4 based on the code posted before by Aleksey_R. In order to use it please take into account that in the chemistryProperties dictionary in constant folder, you must set the inverse of eps (for example 20 for a eps of 0.05) so in ODESolver.C file the whole time step can be sent to CVODE solver. This happens because CVODE has its own way to calculate internal time step, so OpenFOAM time stepping routine must be overridden somehow. It is probably not the best way to achieve it... but it works! In order to install this library just merge the content of the attached file the src/ODE folder and recompile using wmake libso. It is known to work with sundials 2.3.0 (the instructions about compiling sundials can be easily found in the forum)- In my case, I installed sundials on home folder- Please try the solver and make your own tests (for example running ODETest app). So far in my tests, SIBS seems to be faster for my problem (chemical kinetics). Also if you can make a better-cleaner version of this solver, you can upload it and share it back with the community. |
|
April 14, 2012, 10:37 |
|
#10 | ||
Senior Member
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 16 |
Quote:
Quote:
|
|||
February 27, 2014, 06:00 |
|
#11 |
New Member
James Behzadi
Join Date: Oct 2011
Location: Sydney, Australia
Posts: 27
Rep Power: 15 |
Dear all,
I implemented SUNDIALS CVODE 2.7 in OpenFOAM 2.0.x. I pretty much followed the instructions given at this thread. However, my implementation is very slow when I use the built-in numerical jacobian feature of CVODE. I have explained the details here. Any help is highly appreciated. Jalal |
|
March 6, 2014, 20:53 |
|
#12 |
New Member
James Behzadi
Join Date: Oct 2011
Location: Sydney, Australia
Posts: 27
Rep Power: 15 |
Any help is highly appreciated.
|
|
September 9, 2020, 00:32 |
|
#13 | |
Senior Member
Reviewer #2
Join Date: Jul 2015
Location: Knoxville, TN
Posts: 141
Rep Power: 11 |
Quote:
Luis, Can CVODE handle fractional exponent reaction? Thanks, Rdf |
||
Tags |
cvode, odesolver, sundials |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
OpenFOAM 1.7 and CVODE | adhiraj | OpenFOAM | 6 | May 22, 2011 01:01 |
Problem implementing CVODE ODE solver | markusrehm | OpenFOAM | 20 | October 13, 2010 18:02 |
CVODE Error message | Robert | FLUENT | 2 | February 12, 2003 19:28 |