# Boundary Conditions For Modelling of a Fluid Using Euler's Equations

• I
• person123
In summary, the conversation discusses using Euler's equations to model a 2-dimensional, incompressible, non-viscous fluid under steady flow using the finite difference method and converting differential equations into matrices to be solved using MATLAB. The issue of over-constraining the problem with boundary conditions for pressure, velocity in x, and velocity in y is brought up, and the suggestion of using the stream function to simplify things is made. The conversation then delves into the specifics of how to convert boundary conditions for velocity into boundary conditions for the stream function and the potential for flow in a region with no inflow or outflow. Finally, it is
person123
TL;DR Summary
Modelling a 2 dimensional, incompressible, non-viscous fluid under steady flow using Euler's equations and the finite difference method seems to lead to over-constrained boundary conditions.
Hi! I want to use Euler's equations to model a 2 dimensional, incompressible, non-viscous fluid under steady flow (essentially the simplest case I can think of). I'm trying to use the finite difference method and convert the differential equations into matrices to be solved using MATLAB. I set each pressure and velocity term into a vector (with three vectors representing u, v, and p) and the differential operators representing matrices. It seems the RHS needs all the boundary conditions for pressure, velocity in x, and velocity in y which I think over constrains the problem and could lead to impossible situations (e.g. the velocity points inward in all directions). Does anyone know how to correct this? Thanks!

Why don’t you solve this using the stream function, which satisfies Laplace’s equation?

person123
Thank you! I forgot about stream functions, and I imagine they could simplify things considerably. I'm still a bit unsure how you could convert boundary conditions regarding velocity into boundary conditions for the stream function. I would imagine you would start at some point, say the lower left hand corner, and make the stream function some arbitrary value, say 0. Then you would essentially integrate along the boundary. Say you're determining the stream function along the bottom horizontal boundary (with the entire boundary being a rectangle). If it was a wall, I imagine the stream function would be constant. If the v was positive, the function would decrease, and if v was negative, the function would increase. However, u along the horizontal boundary (or v along the vertical boundary) doesn't seem to affect the function, even though I assume it would affect the flow. I'm not sure how you would be able to include that.

What is the specific geometry and flow you’re looking at?

I was considering a square boundary. I hadn't thought of the specific boundary conditions yet (I was actually imagining adding objects inside the flow as another boundary and making the flow just horizontal). This is a bit of a contrived example, but it shows the issue I'm having. On each side, the flow varies parabolically, being 0 at the vertices and a maximum at the middle. It seems to me the stream function would be a constant all along the boundary and so a constant all across the region, indicating no flow whatsoever. This seems to lead to a discontinuity from a nonzero velocity at the boundary to 0 velocity immediately adjacent to it.

person123 said:
I was considering a square boundary. I hadn't thought of the specific boundary conditions yet (I was actually imagining adding objects inside the flow as another boundary and making the flow just horizontal). This is a bit of a contrived example, but it shows the issue I'm having. On each side, the flow varies parabolically, being 0 at the vertices and a maximum at the middle. It seems to me the stream function would be a constant all along the boundary and so a constant all across the region, indicating no flow whatsoever. This seems to lead to a discontinuity from a nonzero velocity at the boundary to 0 velocity immediately adjacent to it.View attachment 263407
I'm not sure I understand what you are saying. The flow is into the region across the left boundary and out of the region across the right boundary? There is no flow across the upper and lower boundaries? Across the left and right boundaries the velocity in the x-direction is a quadratic function of y?

What are your equations for the velocities in the x- and y directions as functions of the stream function?

I'm imagining no flow in our out of the region. Say the coordinates are of the vertices are (-1,-1), (-1,1), (1,-1), and (1,1). The equations for velocity would be:

Left and right boundary: ##\mathbf v=-v_0(1-y^2)\hat j##
Bottom and top boundary: ##\mathbf v=v_0(1-x^2)\hat i##

I believe this would mean ##\psi = c## as the velocity vector is always parallel to the direction you're integrating.

I'm guessing that in this case, it would be predicted that there's no flow in the entire region. I'm not sure if this would mean that in general that only the flow normal to the boundary affects the flow in the region using the stream function.

I also notice that the potential function along the boundary would not be constant. If you were to use the potential function instead, it seems to me you would predict there to be flow in the region, which seems to me to be a contradiction.

person123 said:
I'm imagining no flow in our out of the region. Say the coordinates are of the vertices are (-1,-1), (-1,1), (1,-1), and (1,1). The equations for velocity would be:

Left and right boundary: ##\mathbf v=-v_0(1-y^2)\hat j##
Bottom and top boundary: ##\mathbf v=v_0(1-x^2)\hat i##

I believe this would mean ##\psi = c## as the velocity vector is always parallel to the direction you're integrating.

I'm guessing that in this case, it would be predicted that there's no flow in the entire region. I'm not sure if this would mean that in general that only the flow normal to the boundary affects the flow in the region using the stream function.

I also notice that the potential function along the boundary would not be constant. If you were to use the potential function instead, it seems to me you would predict there to be flow in the region, which seems to me to be a contradiction.
You can set those boundaries in motion tangentially in any way you want, and it still is not going to cause any fluid flow within the region. Discontinuities in tangential velocity are perfectly comparable with inviscid flow.

person123
Chestermiller said:
You can set those boundaries in motion tangentially in any way you want, and it still is not going to cause any fluid flow within the region. Discontinuities in tangential velocity are perfectly comparable with inviscid flow.
Yes, that makes sense, as I imagine if the flow is inviscid, fluid could slide past each other without any shearing stress or any transition between the two velocities. Would this also mean that in general, only the flow normal to the boundary affects the flow in the region?

Also, I imagine that the potential function would predict flow in the region from the top left corner to the bottom right because the potential function does change along the boundary. Are they both acceptable solutions to the problem?

person123 said:
Yes, that makes sense, as I imagine if the flow is inviscid, fluid could slide past each other without any shearing stress or any transition between the two velocities. Would this also mean that in general, only the flow normal to the boundary affects the flow in the region?
Yes.
Also, I imagine that the potential function would predict flow in the region from the top left corner to the bottom right because the potential function does change along the boundary. Are they both acceptable solutions to the problem?
Sure. It is just that the potential function is discontinuous at the boundaries.

Try specifying a better example to study.

I think a good example would be flow around a bend. The left and bottom sides are walls (##\psi=c##), there's uniform flow inward on the top (##\psi## increases linearly moving to the right), and uniform flow outward on the right (##\psi## increases linearly moving up). My only concern is that the flow is discontinuous at the top right corner; would this be an issue?

I also would be interested in modelling horizontal flow around an object. I assume ##\psi## around the boundary of the object would be a constant, but I'm not sure how I would know what to set it equal to. I imagine there would be a solution to the Laplace equation regardless of the value, but I think it would also indicate a different flow.

person123 said:
I think a good example would be flow around a bend. The left and bottom sides are walls (##\psi=c##), there's uniform flow inward on the top (##\psi## increases linearly moving to the right), and uniform flow outward on the right (##\psi## increases linearly moving up). My only concern is that the flow is discontinuous at the top right corner; would this be an issue?
View attachment 263420
No problem. Just make sure that the values match at the upper right corner.
I also would be interested in modelling horizontal flow around an object. I assume ##\psi## around the boundary of the object would be a constant, but I'm not sure how I would know what to set it equal to. I imagine there would be a solution to the Laplace equation regardless of the value, but I think it would also indicate a different flow.
View attachment 263423
No problem. The boundary condition is just that the tangential component of stream function is constant. You don't need to set the value there. The differential equation becomes $$\frac{\partial^2 \psi}{\partial n^2}=0$$I think what you could do is choose a value of psi on the body and then iterate on it until the sum of the squares of the deviations from this differential expression are minimized.[/QUOTE]

person123
I modeled the flow around a corner. It seems to work!

I'm still a bit confused about the boundary conditions for an immersed object. Wouldn't the stated relation always be true if ##\psi## was a constant based on the Laplace equation, regardless of the value of ##\psi##? Therefore, the sum of the square of the deviations would always be 0.

person123 said:
I modeled the flow around a corner. It seems to work!
View attachment 263499
I'm still a bit confused about the boundary conditions for an immersed object. Wouldn't the stated relation always be true if ##\psi## was a constant based on the Laplace equation, regardless of the value of ##\psi##? Therefore, the sum of the square of the deviations would always be 0.
Nice job.

Yes, it would be true based on Laplace's equation, but, at the boundary, you need to use a 1-sided approximation to the 2nd normal derivative, and you need to guarantee that it is satisfied at all points along the boundary for the boundary value of psi you have specified.

Try it both ways and see what happens.

1. Satisfying the 1 sided 2nd normal derivative equal to zero at all points along the boundary, and including the boundary points in the solution vector. Then checking to see whether psi comes out to a constant for the boundary points.

2. Not including the boundary points in the solution vector and, instead setting them equal to a constant value and iterating on the constant value until the sum of squares of the 1 sided 2nd normal derivatives is minimized with respect to the chosen boundary value.

person123
I'm a bit stuck for either approach. For the first, ##\frac{\partial^2 \psi}{\partial n^2}=0## implies that ##\frac{\partial^2 \psi}{\partial t^2}=0## but not ##\frac{\partial \psi}{\partial t}=0##. This boundary condition seems to be satisfied by flows which would not be the flow around an object, like uniform horizontal flow. Isn't the boundary condition I need ##\frac{\partial \psi}{\partial t}=0##? I'm not sure how I would solve the system of equations with that constraint though.

For the second approach, would I just be setting the values of the stream function at the boundary equal to some constant after solving for the function? That doesn't make sense to me, because I would imagine the object would change the stream function away from the boundary as well.

I think there's something which I'm just not quite getting with this.

person123 said:
I'm a bit stuck for either approach. For the first, ##\frac{\partial^2 \psi}{\partial n^2}=0## implies that ##\frac{\partial^2 \psi}{\partial t^2}=0## but not ##\frac{\partial \psi}{\partial t}=0##. This boundary condition seems to be satisfied by flows which would not be the flow around an object, like uniform horizontal flow. Isn't the boundary condition I need ##\frac{\partial \psi}{\partial t}=0##? I'm not sure how I would solve the system of equations with that constraint though.
If ##\frac{\partial \psi}{\partial t}=0## at all point along the boundary, then ##\frac{\partial^2 \psi}{\partial t^2}=0##.
For the second approach, would I just be setting the values of the stream function at the boundary equal to some constant after solving for the function? That doesn't make sense to me, because I would imagine the object would change the stream function away from the boundary as well.
Your numerical scheme will take care of that automatically, because the first grid point out from the boundary will be affected by the value you impose at the boundary.

I'm having some trouble with the actual coding of this, but you have been enormously helpful and my original question has long since been answered, so thank you!

## 1. What are boundary conditions for modelling a fluid using Euler's equations?

Boundary conditions are specific constraints or requirements that must be applied at the edges or boundaries of a fluid domain in order to accurately model the behavior of the fluid using Euler's equations. These conditions can include specifications for the fluid's velocity, pressure, temperature, and any other relevant properties at the boundaries.

## 2. Why are boundary conditions important in fluid modelling?

Boundary conditions are important because they help to define the behavior of the fluid at the edges of the domain, which can significantly impact the overall accuracy of the model. Without proper boundary conditions, the fluid's behavior at the boundaries may not be accurately represented, leading to incorrect results and predictions.

## 3. How do boundary conditions affect the accuracy of a fluid model?

Boundary conditions have a direct impact on the accuracy of a fluid model because they determine the behavior of the fluid at the edges of the domain. If the boundary conditions are not properly defined, the model may not accurately reflect the real-world behavior of the fluid, leading to incorrect predictions and results.

## 4. What types of boundary conditions are commonly used in Euler's equations for fluid modelling?

Some common types of boundary conditions used in Euler's equations for fluid modelling include Dirichlet boundary conditions, which specify the value of a fluid property at the boundary, and Neumann boundary conditions, which specify the gradient of a fluid property at the boundary. Other types of boundary conditions may also be used, depending on the specific model and application.

## 5. How do you choose the appropriate boundary conditions for a fluid model using Euler's equations?

The appropriate boundary conditions for a fluid model using Euler's equations will depend on the specific application and the behavior of the fluid being modelled. It is important to carefully consider the physical properties and behavior of the fluid at the boundaries in order to choose the most appropriate boundary conditions for the model.

• Differential Equations
Replies
4
Views
866
• Differential Equations
Replies
3
Views
4K
• Differential Equations
Replies
5
Views
2K
• Differential Equations
Replies
1
Views
2K
• Programming and Computer Science
Replies
1
Views
1K
• Classical Physics
Replies
1
Views
891
• Classical Physics
Replies
6
Views
462
• Classical Physics
Replies
18
Views
1K
• Differential Equations
Replies
1
Views
3K
• Differential Equations
Replies
1
Views
863