CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   Ruge Kutta programming question for unsteady flow (https://www.cfd-online.com/Forums/main/91275-ruge-kutta-programming-question-unsteady-flow.html)

Hooman August 5, 2011 07:19

Ruge Kutta programming question for unsteady flow
 
I am trying to code a 1D unsteady flow problem using Runge Kutta for time stepping. I am using ODE functions in Maltab. 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 22:04.