CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   Help linking icoFoam and ODE solvers (

skabilan October 18, 2007 06:13

Hi, What would be the best

What would be the best way to link icoFoam and a ODE solver? Basically what i want is: the ODE solver solves a set of equations and supplies the pressure at the outlets to icoFoam. Which then computes on the mesh. This should repeat after every time step (transient simulation).

Thanks in advance for all your help!

Warm Regards,

david_flo1 February 19, 2008 17:48

Hi, did you manage to do that?
Hi, did you manage to do that?

I am looking the same problem here. Got any suggestions?


skabilan February 23, 2008 01:24

Hi, I was able to integrate

I was able to integrate the ODE solver in OF with icoFoam. Take a look at the /OpenFOAM-1.4.1/applications/test/ODETest. You can use the same driver with your ODE set to solve the equations.


david_flo1 February 25, 2008 13:15

Forgive my persistence but alt
Forgive my persistence but although after checking the ODE I kinda understand how it works, how to use available specific ODE solvers, yet it is not clear to me how to use its results for input on each time step on a FOAM fv solver.

I am a FOAM newbbie here, any more specific details, please, or an example if you don't mind.


skabilan February 25, 2008 14:02

Hi Bernardo, Take a look at
Hi Bernardo,

Take a look at the timeVaryingUniformFixedValue patch in the directory /OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/fields/fvPatchFields/derived/
This patch is used for transient simulation.The patch reads the pressure value from a file (user specified) after every time step. You can insert the ODE solver in the patch and can supply the outlet condition to OF after every time step.


david_flo1 February 26, 2008 11:18

Ok, I'll try it then. Maybe bo
Ok, I'll try it then. Maybe bother you later along the way with some other question :D

thanks Senthil


markc January 6, 2009 06:33

Hello All, A new question,
Hello All,

A new question, basically a C++ question, with respect to implementing a ode solver. Starting from ODETest.C the following question:
the derivatives are given in the member function derivatives, which is inherited from ODE.H.
In ODETest the DE's are like:
dydx[0] = -y[1];
dydx[1] = y[0] - (1.0/x)*y[1];
dydx[2] = y[1] - (2.0/x)*y[2];
dydx[3] = y[2] - (3.0/x)*y[3];

But now I want to add some extra parameters which are constants in the DE's. E.g. the above may look like:
dydx[1] = y[0] - (constant_1 / x)*y[1];
(just an example).
However I am not able to bring in constants like this because the ODETest class is inherited from ODE.H and there those variables are not declared.
A possible workaround is to put the constants in the y vector and threat some components of the y vector as constants. However I do not think this is a nice way.

Any hints how to perform this task? I am currently studying C++ but any help about this question would be appreciated.

Thanks in advance,


All times are GMT -4. The time now is 04:53.