How to calculate the stream function from the potential function?

In summary, the conversation discusses the use of MATLAB for calculating the streamfunction from the potentialfunction in a 2D region with holes. The suggested approach includes using the "gradient" and "meshgrid" functions in MATLAB, as well as considering alternative methods for solving the PDE in the presence of holes.
  • #1
Uwe
1
0
Hello,
I am struggling to work out a MATLAB program for the numerical calculation of the streamfunction directly from the potentialfunction. I have the latter as a solution of a 2D Laplace equation from the pdetool() and would like to generate contour plots of both the potentialfunction as well as the streamfunction to form finally a net of coordinates that are rectangular in every point.

So far I tested flowfun.m from Kirill K. Pankratov, but this has problems when the function is not continuous. The 2D region where my PDE is defined has however several holes and an integration of the Cauchy-Riemann equations is numerically difficult at these holes.

Streamlines (that are easily provided by matlab) are not helpful because I have to specify starting points. What I need however is the scalar value of the streamfunction at every point of the 2D region.

Possibly the streamfunction (as the harmonic dual of the potentialfunction) can be derived directly during the FEM calculation of the solution of the PDE.

My question is whether there is a possibility to output the streamfunction from the pdetool or to calculate it in another way from the potentialfunction.

Any suggestion is very welcome!
Uwe
 
Physics news on Phys.org
  • #2


Hello Uwe,

Thank you for reaching out with your question. It sounds like you are working on a challenging problem and I am happy to offer some guidance.

Firstly, I would recommend looking into the built-in function "gradient" in MATLAB. This function can be used to calculate the gradient of a scalar function, which in your case would be the potentialfunction. The output of this function is a vector, which can be used to calculate the streamfunction at each point in your 2D region.

Additionally, you may want to consider using the "meshgrid" function in MATLAB to create a grid of coordinates for your 2D region. This can then be used to calculate the streamfunction at each point on the grid using the gradient function.

If you are still having trouble with the holes in your region, you may want to look into using a different method for solving your PDE, such as the finite difference method, which may be better suited for regions with holes.

I hope this helps and good luck with your research! If you have any further questions, please don't hesitate to ask.
 

1. What is the difference between a stream function and a potential function?

A stream function is a mathematical concept used in fluid mechanics to describe the flow of a fluid. It is a scalar function that represents the velocity components of a fluid flow. A potential function, on the other hand, is a scalar function that describes the potential energy of a fluid. It is related to the stream function through the continuity equation.

2. How do you calculate the stream function from the velocity field?

The stream function can be calculated from the velocity field using the following equation:
ψ = ∫vdx - ∫udy
where ψ is the stream function, v is the velocity in the x direction, u is the velocity in the y direction, and the integrals are taken along a streamline.

3. Can the stream function be used to determine the velocity components of a fluid flow?

Yes, the stream function can be used to determine the velocity components of a fluid flow. The x and y components of the velocity can be calculated using the following equations:
v = ∂ψ/∂x
u = -∂ψ/∂y
where ψ is the stream function.

4. How is the potential function related to the stream function?

The potential function is related to the stream function through the continuity equation, which states that the divergence of the velocity field is equal to zero. This can be written as:
∂u/∂x + ∂v/∂y = 0
By taking the derivatives of the stream function, we can obtain the velocity components and use them to calculate the potential function.

5. What are some practical applications of calculating the stream function from the potential function?

Some practical applications include analyzing fluid flow in pipes, channels, and rivers, as well as in aerodynamics and weather forecasting. The stream function can also be used to determine the vorticity of a fluid flow, which is important in understanding turbulence and energy dissipation in fluids.

Similar threads

Replies
6
Views
10K
  • Differential Equations
Replies
4
Views
2K
  • Differential Equations
Replies
5
Views
2K
  • Mechanics
Replies
2
Views
1K
  • General Engineering
Replies
14
Views
2K
Replies
0
Views
284
Replies
1
Views
822
  • Advanced Physics Homework Help
Replies
7
Views
4K
  • Introductory Physics Homework Help
Replies
3
Views
186
  • Differential Equations
Replies
13
Views
2K
Back
Top