r/CFD 4d ago

Suitable numerical methods for 1D Euler flow with friction source term.

I need to solve a simple steady 1D compressible pipe flow using Eulers equation with friction source term. I also need to solve energy equation (total enthalpy form). Could you recommend a suitable numerical method I can use for this problem. Thanks!

6 Upvotes

4 comments sorted by

3

u/eigentau 4d ago edited 4d ago

Do you need a numerical approach? This is just Fanno flow. If it's more complicated than canonical Fanno flow (e.g., variable friction) then you can write the steady Euler equations as a system of 1st order ODEs:

d/dx(ρu, ρu2 + p, ρuH) = (0, S, 0)

where H is the total enthalpy and S is the friction source term. Then you can solve that numerically with your ODE integrator of choice for a given initial condition at x=0.

2

u/Brownie_Bytes 4d ago

I like this way of representing a matrix while typing. It's much cleaner than what I've done in the past. Thanks for the tip

3

u/No_Coffee3139 4d ago

ODE45 in python or matlab is ideal for this. For learning forward euler can be good to use first then move to using an RK45 scheme.

2

u/Rique3012 3d ago

ode45 does wonders