CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Main CFD Forum (
-   -   Runge Kutta for unsteady flow (

Hooman August 2, 2011 06:28

Runge Kutta for unsteady flow

I am writing a code to solve an unsteady flow problem and I need to use the Runge Kutta methods for my time stepping scheme. I am having problems understanding what the code should do. The variables vary with time (t) and space (x). Am I right in saying that for each t the variables are evaluated at all x's? So I need a loop for the space variation inside a time loop?

I hope my question is clear. Any hints would be appreciated.

Thank you in advance.

panou August 2, 2011 07:29

Yes , you need a spatial loop inside time. The Runge-Kutta scheme as other which exist (simple euler..) march the each DOF(variable) at time. Therefore each variable (at nodes for the case of finite dif or element or volume at finite element or volume respectively) you must apply the time runge kutta scheme so that you find the all variables at next time.

In the case of explicit Runge-kutta scheme this is obvious. In implicit used with same manner.

Hooman August 3, 2011 08:58

Thanks. I had another question regarding Runge Kutta, I was looking at the Matlab help and the ODE solver in there. Looking at the first example:

function dy = rigid(t,y)
dy = zeros(3,1); % a column vector
dy(1) = y(2) * y(3);
dy(2) = -y(1) * y(3);
dy(3) = -0.51 * y(1) * y(2);
options = odeset('RelTol',1e-4,'AbsTol',[1e-4 1e-4 1e-5]);
[T,Y] = ode45(@rigid,[0 12],[0 1 1],options);

I have my equations almost in this form now, apart from the fact that y (or my variables) also vary with x. So I was wondering if each y i.e. y(1) , y(2) ... could be column vectors themselves containing the variations of y for each element or cell centre?

Thanks very much.

All times are GMT -4. The time now is 07:27.