Biftheunderstudy
Senior member
I've been trying to solve a set of coupled differential equations for a while. The first 6 are 1st order ODE's in time, with no explicit time dependance. The last equation is a second order in space, and is a constraint equation.
I'm programming in Fortran 90 with a sideproject involving Matlab. My current strategy for solving the set of equations is to perform RK4 on the first 6 equations, break the last into 2 first orders ODE's and perform a separate RK4 on the now 2 equations.
I've run into a few problems. I've stored all of the independent variables in arrays with values defined at discrete grid points. Solving the constraint equation then has a bit of a problem since it relies on these variables.
Basically, in the RK4 scheme, the routine makes calls like:
K2 = h*func(x+dx/2,y+K1/2)
The problem is that my function 'func' is only defined on the grid with spacing dx, so a call to x with x+dx is asking for a value between the grid spacing.
I'm fishing for new ideas to get around this issue, any help is appreciated.
I'm programming in Fortran 90 with a sideproject involving Matlab. My current strategy for solving the set of equations is to perform RK4 on the first 6 equations, break the last into 2 first orders ODE's and perform a separate RK4 on the now 2 equations.
I've run into a few problems. I've stored all of the independent variables in arrays with values defined at discrete grid points. Solving the constraint equation then has a bit of a problem since it relies on these variables.
Basically, in the RK4 scheme, the routine makes calls like:
K2 = h*func(x+dx/2,y+K1/2)
The problem is that my function 'func' is only defined on the grid with spacing dx, so a call to x with x+dx is asking for a value between the grid spacing.
I'm fishing for new ideas to get around this issue, any help is appreciated.