The Blasius equation in Python

  • Thread starter javiergra24
  • Start date
  • Tags
    Python
In summary, the conversation was about a person seeking help with a Python script they were writing to solve the Blasius equation. The script was generating a plot, but the numerical results did not match with the data from fluid mechanics books. The other person offered some suggestions for troubleshooting, such as checking input parameters, trying different values for deta and total, and examining for errors or warnings in the script. They also asked for more information, including the data being compared and specific differences observed.
  • #1
javiergra24
19
0
Hi everybody

I'm writing a script in Python to solve the Blasius equation but it does not work (well, script works and it generates the plot), numerical results does not match with data I've seen in fluid mechanics books.

Please anyone could help me? Thank you very much

Script is

Code:
import sys, pylab, numpy
from pylab import *
from numpy import *
import matplotlib.pyplot as plt


deta=0.0001
total=10


e = []
f = []
g = []
h = []


fvec=0; gvec=0; hvec=0.3219

etavec=0.0

while etavec <= 10:

fvec = fvec + gvec * deta
gvec = gvec + hvec * deta
hvec = hvec -(1/2) * fvec * hvec * deta
etavec = etavec + deta
e.append(etavec)
f.append(fvec)
g.append(gvec)
h.append(hvec)
print etavec,fvec,gvec

numpy.savetxt("blasius.dat", transpose((e,f,g,h)),delimiter=' ')

pylab.figure()
pylab.plot(e,g)
pylab.plot(e,h)
xticklines = getp(gca(), 'xticklines')
yticklines = getp(gca(), 'yticklines')
xgridlines = getp(gca(), 'xgridlines')
ygridlines = getp(gca(), 'ygridlines')
xticklabels = getp(gca(), 'xticklabels')
yticklabels = getp(gca(), 'yticklabels')
#lines1 = pylab.plot(e,f)
lines2 = pylab.plot(e,g)
lines3 = pylab.plot(e,h)
#pylab.setp(lines1, color='b', linewidth=3.0)
pylab.setp(lines2, color='r', linewidth=3.0)
pylab.setp(lines3, color='k', linewidth=3.0)
setp(xticklines, 'linewidth', 3)
setp(yticklines, 'linewidth', 3)
setp(xgridlines, 'linestyle', '--')
setp(ygridlines, 'linestyle', '--')
setp(yticklabels, fontsize='xx-large')
setp(xticklabels, fontsize='xx-large')
xlabel('$\eta$',fontsize=30)
ylabel('$f(\eta) \quad \partial_{\eta} f(\eta) \quad \partial_{\eta \eta}f(\eta)$',fontsize=30)
axis([0.0,10,-0.9,20.9])
#legend( (lines1, lines2, lines3), ('$\f(\eta)$', '$\partial_{\eta} f(\eta)$', '$\partial_{\eta \eta}f(\eta)$'))


grid(True)
pylab.show()
 
Technology news on Phys.org
  • #2




Hi there,

Thank you for sharing your script and the issue you are facing. It can be quite frustrating when the results don't match with the expected data. I would be happy to help you troubleshoot the issue and suggest some possible solutions.

Firstly, have you checked the input parameters and initial conditions in your script? It's important to make sure they are correct and match with the data you are comparing with.

Secondly, have you tried using different values for deta and total? Sometimes, changing these parameters can make a difference in the results.

Also, it would be helpful to see the data you are comparing with and the specific differences you are observing. This can give us a better idea of where the issue might be.

Lastly, have you tried checking for any errors or warnings in your script? Sometimes, these can point towards the source of the discrepancy.

I hope these suggestions help and I am looking forward to hearing back from you with more information. Good luck with your script!
 

1. What is the Blasius equation?

The Blasius equation is a non-linear differential equation that describes the boundary layer flow of incompressible fluids over a flat plate. It was first derived by German engineer and mathematician Heinrich Blasius in 1908.

2. What is the significance of the Blasius equation in fluid dynamics?

The Blasius equation is an important tool in fluid dynamics as it allows for the calculation of the boundary layer thickness and the velocity profile near the wall of a flat plate. This is useful in understanding the behavior of fluids in various applications such as aerodynamics, hydrodynamics, and heat transfer.

3. How is the Blasius equation solved in Python?

The Blasius equation can be solved numerically using a variety of methods in Python, such as the Runge-Kutta method or the shooting method. These methods involve breaking the equation into smaller steps and iteratively solving for the solution until a desired level of accuracy is reached.

4. What are some applications of the Blasius equation?

The Blasius equation has many practical applications, including predicting the drag on a flat plate in fluid flow, determining the thickness of the boundary layer in heat transfer problems, and analyzing the aerodynamic characteristics of airfoils.

5. Are there any limitations to the Blasius equation?

While the Blasius equation is a useful tool in fluid dynamics, it is limited to certain types of flows and assumptions, such as incompressible and laminar flow over a flat plate. It also does not account for factors such as turbulence or three-dimensional effects, which may be important in some applications.

Similar threads

  • Programming and Computer Science
Replies
3
Views
930
  • Programming and Computer Science
Replies
5
Views
2K
  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
Replies
7
Views
3K
  • Advanced Physics Homework Help
Replies
4
Views
1K
  • Programming and Computer Science
Replies
9
Views
4K
  • General Math
Replies
1
Views
2K
Back
Top