CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Main CFD Forum (http://www.cfd-online.com/Forums/main/)
-   -   Exact solution - Euler equations (http://www.cfd-online.com/Forums/main/117130-exact-solution-euler-equations.html)

 jakubstary May 2, 2013 14:07

Exact solution - Euler equations

I work on numerical solution of Euler equations in 1D. I implemented some numerical schemes and now I need compare their accuracy due to the exact solution. But I don't know how to compute it. For Burger's equation I compute exact solution with method of characteristics, but I don't know how to implement it for Euler equations or whether it is possible. Can anyone get me some tip how to compute exact solution of Euler equations? Many thanks. Jakub

 FMDenaro May 2, 2013 14:17

Quote:
 Originally Posted by jakubstary (Post 424775) I work on numerical solution of Euler equations in 1D. I implemented some numerical schemes and now I need compare their accuracy due to the exact solution. But I don't know how to compute it. For Burger's equation I compute exact solution with method of characteristics, but I don't know how to implement it for Euler equations or whether it is possible. Can anyone get me some tip how to compute exact solution of Euler equations? Many thanks. Jakub
you can find many references for the Sod problem ...

 Ravindra Shende May 3, 2013 00:29

Check out this paper: ANALYTICAL SOLUTIONS FOR THE UNSTEADY COMPRESSIBLE FLOW EQUATIONS SERVING AS TEST CASES FOR THE VERIFICATION OF NUMERICAL SCHEMES - Tsangaris and Pappou

Also look in the text 'Computational Gasdynamics' by Culbert Laney.

 Fabian82 May 3, 2013 02:55

Check the book on Riemann solvers by Toro, there you'll find many shock tube problems together with the behavior of many different discretizations.

A good starting point may also be:
http://www-troja.fjfi.cvut.cz/~liska...re8/index.html

Moreover, you could setup sound waves in the linear regime.

Going to two or three dimensions, simulating flow instabilities (e.g. shear, convection, rayleigh-taylor) and comparing the growth rates to the theoretical estimates can give much insight into a numerical discretization. Besides that, computing (stationary) vortices are also a good code validation.

 jakubstary May 3, 2013 10:00

Solved

Thanks all. It was very helpful for me. I have one more question about solving Euler equations. Please can you get me a good tip again?

I use Euler method, Runge-Kutta 2nd order method and RK 4th order method for time discretization. I think that RK4 method should be the best and RK2 method better than Euler, but in every cases I get the best accuracy with Euler and worst with RK4. Don't you have any idea where would be a mistake in my implementation?

Thanks.
Jakub

 cfdnewbie May 3, 2013 14:49

Did you test your implementation of RK2 and 4 for a system of ODEs? It sounds to me like there must be a bug in your implementation?

 jakubstary May 4, 2013 14:40

1 Attachment(s)
I implemented Euler and RK2 on ODEs, but I get same bad results. In first few times RK2 is better than Euler, but after some time not. I enclosed figure with my results. In figure is Euler, RK2, Matlab ode 23 and exact solution. I must have bug in implementation or bug is in book (Finite Volume Method for Hyperbolic Problems - LeVeque - equations (10.18)) which I use.

Here is my code of RK2:
Code:

```function dy = rigid(t,y)     dy = 3*exp(-4*t)-2*y; end for i=1:length(t)-1   k1=rigid(t(i),rk2(i)); %derivate   ystar1(i)=rk2(i)+h*k1; %y*   k2=rigid(t(i),ystar1(i)); %derivate   ystar2(i)=ystar1(i)+h*k2; %y**   rk2(i+1)=0.5*(rk2(i)+ystar2(i)); %result = 1/2*(y + y**) end```
Many thanks!
Jakub

 jakubstary May 6, 2013 06:47

Please, has anybody any idea for my problem with Runge Kutta? Thanks.

Jakub

 Fabian82 May 6, 2013 08:02

I guess the second evaluation of 'rigid' should not be at time t(i). The algorithm in LeVeque is defined for problems without an explicit time dependence. You should look up the butcher tableau for this time marching scheme to find out the correct time for the second evaluation. I guess, it's just t(i) + h but look it up in order to be certain!

 jakubstary May 6, 2013 18:14

Quote:
 Originally Posted by Fabian82 (Post 425552) I guess the second evaluation of 'rigid' should not be at time t(i). The algorithm in LeVeque is defined for problems without an explicit time dependence. You should look up the butcher tableau for this time marching scheme to find out the correct time for the second evaluation. I guess, it's just t(i) + h but look it up in order to be certain!
Yes, t(i) + h was the problem. Thanks Fabian82 :).

So if I apply now Runge Kutta 2nd order method on Euler equations or on other system of hyperbolic partial differential equations I get this:
U* = U(n) + dt*G(U(n)) - first step
U** = U* + dt*G(U*(n+1)) - second step
and result is:
U(n+1) = 1/2*(U(n) + U**).
But how can I compute U** when I don't know U*(n+1) in the second step?

Many thanks to all. Jakub.

 All times are GMT -4. The time now is 09:52.