CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   verifying second order (https://www.cfd-online.com/Forums/main/70336-verifying-second-order.html)

vahidmech November 20, 2009 14:56

verifying second order
 
hi
I have written a code for wave equation with RK2.
now I want to know how I can be sure that my code is second order?
the error must be smaller than what?

jed November 20, 2009 16:34

Which wave equation? In any case, you choose a smooth solution (\cos is good) and compare your code's results at successively finer resolution (refine in both space and time). Now plot \log(\text{error}) versus \log(\Delta x), the resulting slope is the order of accuracy of your method. If you don't have an exact solution available, you can manufacture one by introducing a distributed source term that makes something simple a solution, or (generally a worse option) compute a reference solution at very high resolution (preferably with a proven code).

CFDtoy November 23, 2009 16:51

code order
 
Hi there,
Do richardson extrapolation test for grid convergence! 3 sets of results at time steps or spatial step h, h/2 ,h 4 is needed (basically 3 grids). works for structured mesh straight up ! Unstructured meshes are tricky. Since yours is a simple RK based integration procedure method..this works very well.

/CFDtoy

Quote:

Originally Posted by vahidmech (Post 237100)
hi
I have written a code for wave equation with RK2.
now I want to know how I can be sure that my code is second order?
the error must be smaller than what?



All times are GMT -4. The time now is 21:45.