# Boundary conditions for 2D navier stokes equation (incompressible, stationary)

I am asked to give the boundary conditions for the following duct flow

We are using a cartesian coordinate system. And $u$ and $v$ are the $x$ and $y$ velocities of the flow. $n_i=(n_{ix},n_{iy})$ is the unit normal vector of the inlet area, $n_0=(n_{ox},n_{oy})$ is the unit normal vector for the outlet area and $n_w$ is the unit normal for the walls.

I would guess that the following boundary conditions are necessary:

• Boundary conditions on wall: $(u,v)=(0,0)$ at the wall (no-slip + no-through)
• Inlet condition:$(u,v) \cdot (n_{ix},n_{iy})$ is given.
• Outlet condition: $(u,v) \cdot (n_{ox},n_{oy})$ is given.

Are my boundary conditions right? I am a little bit confused because our solution says $u\cdot n_{ix} +u\cdot n_{iy}$ (inlet), $v\cdot n_{ix} +v\cdot n_{iy}$ (inlet), $u\cdot n_{ox} + u\cdot n_{oy}$ (outlet) and $v\cdot n_{ox} + v\cdot n_{oy}$ (outlet) need to be specified.

• Please unaccept my answer, because I think it's wrong and want to delete or change it. – Han de Bruijn Apr 3 '17 at 8:44
• After some good night sleep, I've rewritten the answer. And I promise not to withdraw it again. (But it would really bother me to leave a bad answer as it is only because of having earned some miserable rep points) Apologies for any confusion. – Han de Bruijn Apr 4 '17 at 18:20

One thing we can say for sure is that the boundary conditions as proposed in the question as "our solution" are wrong; I've never seen such a strange application of the inner product anyway.
Another thing that can be said is that the boundary conditions as proposed by the OP are somehow better - that is: inlet and outlet conditions would rather be applicable for irrotational flow, which is a special case of Navier-Stokes - but in general they cannot be deemed correct as well.

With the 2-D Navier-Stokes equations for incompressible & stationary flow, there is an abundance of more or less proper boundary conditions in literature. Some of these are incredibly complicated, so I'd suggest to hunt for the simple ones. More or less by coincidence, I've stumbled upon a decent example for duct flow:

The acccompanying picture illustrating the boundary conditions is resemblant to the OP's:

Then the article says: The fluid velocity is specified at the inlet and pressure prescribed at the outlet. A no-slip boundary condition (i.e., the velocity is set to zero) is specified at the walls.

This means that, at the inlet area, the full velocity vector field must be specified: $(u_i,v_i) = (U,V)$. If there is no reason to assume otherwise, then an uniform velocity field may be imposed.

The pressure condition at the outlet area comes as a slight surprise for me, but I think it's more reasonable than trying to impose a velocity field. The reason is that you will get in trouble while trying to fulfull the global conservation laws for mass and momentum. An extreme example is the outlet velocity field $(u_o,v_o) = (0,0)$ that will suck all mass into nothingness; I can only hope that the CFD code will protest against this, but have the sad experience that too often it will not.
If there is no reason to assume otherwise, then an uniform pressure field may be imposed.

Last but not least, the no-slip boundary conditions are commonly assumed to be correct.

If is is assumed in addition that the flow is irrotational, then the no-slip boundary conditions must be replaced by impermeability conditions, of the form $\;(u,v) \cdot (n_{wx},n_{wy}) = 0$ .
The boundary conditions as proposed by the OP for the inlet area are entirely correct for such ideal / potential flow, as it is called : $(u,v) \cdot (n_{ix},n_{iy}) =$ given.
Boundary conditions for the outlet area are: velocities parallel to the normal $\,(u,v)\, //\, (n_{ox},n_{oy})$ . Then let the CFD code be good enough to assure that e.g. global mass conservation is guaranteed.

• Thank you for this very detailed answer! At least I know that this problem is not as trivial as I thought. – MrYouMath Apr 4 '17 at 20:09
• @MrYouMath: Real stationary duct flow is always 3-D. Your model is 2-D. This means that flow is assumed frictionless in the 3rd dimension, right? Why then not be consequent and model it as ideal / potential flow in 2-D as well? This is much simpler than trying to solve for Navier-Stokes (last part of the answer). Please get rid of the idea that a mathematical model is "reality". Be glad if it approximates reality in some sense. – Han de Bruijn Apr 6 '17 at 19:04

Real stationary duct flow is always 3-D. The OP's model is 2-D. This means that the flow is assumed to be frictionless in the 3rd dimension, right ? Why then not be consequent and model it as ideal / potential flow in 2-D as well ? This is much simpler than trying to solve for Navier-Stokes.
Please get rid of the idea that a mathematical model is "reality". Be glad if it approximates reality in some sense. Meanwhile, there is a key reference @ MSE:

### Any employment for the Varignon parallelogram?

This is what I have done for the OP's problem. First clean up the original picture a bit and make a sketch of the computational grid to be employed:

Then find the coordinates of the vertices of the quadrilaterals in the picture, with a little help from a computer program (see bottom of this post):

This is pattern recognition ? Yes it is ! Now we can generate the final (neat) finite element mesh for the purpose of making calculations:

This is very much resemblant to the Finite Difference / Finite Volume / Finite Element mesh in the abovementioned key reference, which is no coincidence of course.
See the last part of my previous answer for (a possible choice of) the boundary conditions.
Here comes an impression of the velocity field as calculated with Ideal Internal Flow and our (Least Squares) Unified Numerical Analysis:

Last but not least, the software (Delphi Pascal source code) @ MSE publications / references 2017 .

There are no correct boundary conditions. This flow is incompressible and therefore subsonic and therefore can be influenced by events outside the domain. Boundary conditions are a mathematical model for the rest of the universe, as I once heard from the late Gino Moretti of Brooklyn Poly. We are not given any information about what happens outside the domain, so the problem is indeterminate and no boundary conditions at inflow/outflow are better than any others.

Although the software may demand boundary conditions, it has no right to do so. We should only try to compute problems that are known to be well-posed (solution exists, is unique and stable). The given setup does not have a unique solution because we could impose an infinite variety of conditions outside of the domain shown. If this was an external flow problem, a good approach would be to specify no disturbances at infinity, but even this has to be done with care, because your outer boundary is not really at infinity.

Numerical boundary conditions are extremely tricky, both with regard to what to impose and how to impose it. What you need at inflow and outflow is some sort of boundary condition that is kind of plausible, and to which the solution will not be very sensitive. Since you are using a commercial code whose inner workings are not accessible you have to consult the software suppliers help desk, if it really isn't in the manual.

• Could you please elaborate your answer? In CFD software we need to specify some boundary conditions. – MrYouMath Apr 3 '17 at 8:49
• So we could generate waves outside the computational domain and they would influence the flow field in the domain? But doesn't the boundary conditions at inlet and outlet prevent that? Or do you mean special disturbances that fulfill the boundary conditions outside the computational domain? – MrYouMath Apr 4 '17 at 7:20
• Your statement that no boundary conditions at inflow/outflow are better than any others is false. Imposing proper boundary conditions for a given set of differential equations is a pure mathematical problem in the first place and as such it has little to do with the rest of the universe or even with physics. To be precise: the mathematics is an idealization of the physics, it is an approximation of the physics. Some approximations are better than others. One thing for sure: any proposal for a mathematical modelling of physical reality should not be discouraging in the first place. – Han de Bruijn Apr 4 '17 at 18:36
• Should I further comment on the absurd idea that proper boundary conditions be dependent upon an arbitrary software implementation of a system of differential equations and that one should consult the vendor of the CFD package for it? I think not. – Han de Bruijn Apr 4 '17 at 18:43

Mr YouMath. You have understood me. Han de Bruin, you have not.

Boundary conditions are side conditions that have to be added to the governing equations in order to achieve a well-posed problem.For simple examples like Laplaces equation you can make a list of suitable boundary conditions, Dirichlet, Neumann, Robin. Such a list will appear in a basic textbook, but it will not be comprehensive. I can propose the problem of finding the shape, subject to some constraints, that gives a desired pressure distribution. This is a very interesting and valid problem (quite possibly well-posed) that a basic math book will ignore.

Before asking a computer to solve my problem, I SHOULD ensure that the problem is well-posed. in SOME sense. What is the poor brute supposed to do if no solution exists, or if more that one solution exists? If the problem is not well-posed you cannot hope for any solution, but unless it is well-posed in the sense that you intend, any answer that is returned will not be to your question.

In practice, naive users do not realise this and, most commonly, those that do may not have access to all of the information that they need. Han, you acknowledge this by saying that "If there is no reason to assume otherwise, then a uniform velocity field may be imposed." This is prescisely what I meant, although I plead guilty to hyperbole when I said that no boundary condition would be preferable to any other. In principle I stand by that, but in practice of course some conditions will give solutions that are kind of plausible, and others will not. Perhaps these calculations are being done by a design engineer who hopes that the inflow WILL be uniform. But if it isn't, is that due to events before or after the entry?

Numerically, we should distinguish boundary conditions and boundary procedures. Boundary conditions are what you want to impose. They do not always exist (radiation conditions to be imposed at finite distance in more than one dimension) and if they do exist you may not have excess to everything you need. Boundary procedures are the numerical things you have to do to impose the boundary conditions. These almost always DO depend on the algorithm being employed away from the boundary, and you have seen that these are some sometimes quite complicated. This is what the code designers know and you don't.

Han, give the code designers credit for knowing some elementary facts. For example, they know that it makes no sense to give the computer an ill-posed problem. It is the responsibility of the user never to create such a situation, but as we see from this question, users are not always so sophisticated. Almost inevitably, bad questions will be posed. For the wave equation, there is a theorem that there is no boundary condition that can be applied at a finite distance to enforce a radiation condition at infinity. But that is exactly what anyone interested in external flows would want, even though they know it is impossible. (Infinity is a tricky concept in numerical work.) The code designer knows that this question will be asked, and will try their best to ensure that the code nevertheless returns a fairly decent answer. They will then make certain recommendations, for example, the distance that inlet/outlet ports should be from the main action, whether the code can actually accept a specified flow direction or a zero vorticity condition. I dont know these things and neither do you.

Mr YouMath. You suggest that a correct boundary condition would prevent any external sources from having any effect. To some extent this is true, and it is called a radiation condition. It ammounts to an assertion that nothing of interest is happening in the rest of the universe (sometimes true). It is easily imposed in one-dimensional flow for hyperbolic problems (which is what I know about). If $\ell_k, k=1..K$ are the left eigenvectors of the incoming waves then $\partial_t\mathbf u\cdot\ell_k\equiv0,\forall k$. This is commonly used as an approximation in higher dimensions, and success usually depends on being far enough away from where the waves originate (see remark above). I realise that the question is actually about the Navier-Stokes equations, and so the relevance of my observations depends on the Reynolds number. So the complexities continue!

I fact numerical boundary condition are a very delicate aspect of CFD, and the question cited by the the OP seems not to recognise this. We are never told what question we want the answer to. He has every right to be confused, and in his position I WOULD call the help desk. They will do their best to be reassuring and they will probably be very helpful. But CORRECT boundary conditions do not exist, because we are not told what would make them correct.

• So what you are pointing at is, that we cannot specify the boundary conditions, because we could only do this if we knew the flow already? – MrYouMath Apr 5 '17 at 7:22
• @MrYouMath: Being impressed by the overwhelming eloquence of Philip Roe means that we can all sit back and do nothing at all. After all, a 2-D flow doesn't really exist in the first place, because space is three-dimensional or even four-dimensional. Oh my, and did we quantum effects take into account? People who do not understand how the scientific method works and think that approaching reality has to be "exact" cannot be helped any further. As desperate last attempt, please read this: alternatievewiskunde.nl/bellen/index.htm – Han de Bruijn Apr 6 '17 at 9:33
• @Han: Is there possibly some way in which we can engage in a private debate about the philosophy of science? This stuff really does matter. – Philip Roe Apr 6 '17 at 14:41
• @PhilipRoe: Yes, this stuff is extremely important. It's simple. You can contact me by digging into my profile and find the email address at the main web site. My eyes are not good, so don't expect quick responses and longish debates from my side. – Han de Bruijn Apr 6 '17 at 19:11

Mr. YouMath That isnt QUITE what I am saying, but I am grateful that you pushing me to refine my answer. I realize now that the question as posed admits at least three interpretations, as I shall now list, but no interpretation is very satisfying. That is the reason why I claimed that there was no good answer to the question, but to be convincing it needs some elaboration.

INTERPRETATION ONE The question is put to a Mathematician (M); Is the problem defined by these equations (E) and these boundary conditions (B) well-posed? It is not, as Han seems to think, to give all B leading to well-posed problems for E, because there could be an unlimited number of them, but it is usual to give a list of common well-posed B (Dirichlet, Neumann, Robin) that we might describe as pre-approved. I doubt that the question was meant to be so profound.

INTERPRETATION TWO The question is put to a designer (D). Among the set of pre-approved B, or perhaps the set of not-yet-approved B, what specific B gives the best representation of the particular question that D wishes to ask, assuming that D knows what that is? (By specific B I mean that, although M may have said "prescribe the normal velocity", there might be some doubt about the actual value to be prescribed. Where do we get it from?) This is subjective, and will almost always involve physical intuition. Best here to take a specific example, one that I know a little about. Suppose that the domain represents the inlet region of a jet engine. The inflow represents external air drawn in from the outside air. Probably that flow is uniform "at infinity", and its passage into the inlet is essentially inviscid, so D will know its Bernouilli constant and that it is irrotational. That does not determine it completely, although almost surely the inflow will not be uniform. D could guess the velocity components consistent with the information they have, or D could couple their calculations with an external calculation (say of potential flow, as opposed to NS internally)

At outlet, the rest of the universe consists of a jet engine. Obviously D has already decided not to include the details of this. Experience has shown that the most important aspect of the engine is to impose the static pressure at outlet, although M would surely approve of other choices. But then, what should the imposed static pressure be? The question does not allow for any discussion of these issues, so this cannot be the intended interpretation.

The specfic question here is likely to be what shape of the duct leading from inlet to engine provides the engine with the most uniform inflow? Because that was the condition assumed by the engine designer. There are bonus points for a short duct that will weigh less. Because the flow is subsonic, altering the duct shape will alter the flow at inlet although not at infinity. This is the sense in which you need to know the solution before you know the boundary conditions. You may know the SORT OF B that can be used, but not the actual values. Ways out; do a bigger calculation, iterate, divide the universe into different bits.

INTERPRETATION THREE. The question is put to the code-writer (W). At a boundary of any kind, the numerical procedure used to predict the flow elsewhere will fail, because information about the flow variables is not now available from all directions. We then speak of a boundary procedure. Just as not every method for the interior flow is accurate or stable, so not every boundary procedure is accurate or stable. It will depend on the boundary condition that we wish to impose, and on the interior method. It is the task of the algorithm designer (A) to investigate this, perhaps to publish the results. The code writer (W) must understand the conclusions and make choices that are consistent with them. This should be discussed in the users manual, perhaps to describe limitations or perhaps to point out various options. If it isn't, or if you don't understand the discussion, consult the help desk (H), but of course you do not ask them about interpretation one. A reputable software company will work with you to resolve any difficulties if your particular case is not already covered.

• I'm not sure whether this is a comment to the OP or possibly seeking to clarify the question or something else? Do you think this is an answer? I'm not sure, some flaggers are sure that it is not an answer. If it is not intended as an answer, then you should not post it as one. If you want to clarify a point raised in another answer of yours, you could incorporate to be a part of it. I am leaning towards deleting this as "not an answer", but I want to hear from you. As a new user you may not be aware of the norms of the site. – Jyrki Lahtonen Apr 6 '17 at 11:53
• I may not be dealing with this in the best way, and I would certainly value advice. But to begin with, what is the accepted behavior if I wish, not to answer the question, but to describe alternative contexts in which it could be answered? No, that would not be an answer, but comments are limited to 450 words. In fact, how should I be responding to you if I need more than 450 words? – Philip Roe Apr 6 '17 at 14:27
• Ok, thanks for elaboration. I lack the expertise to judge the math here. We normally don't want debates here (the site software doesn't bend well to support them), but this is an unusual situation. The users who reviewed the post were split in their vote. I need to consult more experienced mods. – Jyrki Lahtonen Apr 6 '17 at 17:45
• You can start a chatroom for discussing the topic, and invite anyone you want there. But no one is obliged to join in. – Jyrki Lahtonen Apr 6 '17 at 17:47
• @Jyrki. I certainly had no intention of offending anyone, so I will pipe down until I receive more guidance, but perhaps I may remark that Han de Bruijn was quite personally offensive in his comments and that may have influenced my response. – Philip Roe Apr 6 '17 at 19:09