October 25, 2018, 21:01
|
Difficulty with basic boundary value problem with RK4 time march
|
#1
|
New Member
Join Date: Oct 2018
Posts: 1
Rep Power: 0
|
Hello everyone,
I am currently studying in a class for CFD and am having a lot of difficulty with getting the code (written in Matlab) for a problem to give answers that make sense. The problem is as follows:
"Write a computer program to solve the one-dimensional linear convection equation with inflow-outflow boundary conditions and a=1 on the domain 0<=x<=1. Let u(0,t) = sin(wt) with w=10pi. Run until a periodic steady state is reached which is independent of the initial condition and plot your solution compared with the exact solution. Use 2nd-order centered differences in space with a 1st-order backward difference at the outflow boundary together with 4th-order Runge-Kutta time marching."
I have written, and attached, a code that should be able to plot the solution. However, I am getting a diverging mess of curves in the shape of a sinusoidal wave.
Is there something about the RK4 method that I am interpreting incorrectly or is there some sort of anomaly in my code?
Thanks for your help in advance.
|
|
|