CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   2nd order boundary conditions for 2nd order discretization? (https://www.cfd-online.com/Forums/main/95037-2nd-order-boundary-conditions-2nd-order-discretization.html)

quarkz December 3, 2011 11:38

2nd order boundary conditions for 2nd order discretization?
 
Hi,

I am now using 2nd order time and space discretization for my NS eqns, using fractional step.

For the boundary conditions, e.g. at the north side, I'm using:

du/dy = 0. v=0.

If I just use a 1st order discretization of the above for my problem, it will be:

u(i,j) = u(i,j-1)

will it affect the overall order of my problem? Will it become overall 1st order?

Thanks

Rami December 12, 2011 04:50

AFAIK, using a 1st order BC in an otherwise 2nd order scheme will pollute the solution and renders it 1st order accurate. Sorry... Try to implement a 2nd order BC as well.

cfdnewbie December 12, 2011 13:32

Yes, I agree with Rami. The overall solution will fall back to the lowest order in your domain, i.e. the boundary contribution. The becomes even more pronounced for high order schemes (>>2), where a low order boundary discretization can totally screw up your solution.

quarkz December 12, 2011 17:53

Ok thanks for the answers. I'll ensure my BC are 2nd order too.

arjun December 12, 2011 19:49

So if I understand this correctly, because BC is 1st order it does not make any difference if everywhere else is Second or higher order. The solution from first order scheme and second order schemes will be same??

I would say 1st order BC may affect that solution but it would NOT make the solution 1st order everywhere.

Ford Prefect December 15, 2011 04:37

I agree with previous poster. It is problem dependent as well. For steady, incompressible, pipe flow the order of the outlet boundary condition should play little role.

1st order: u_b = u_b-1
2nd order: u_b = (4*u_b-1 - u_b-2)/3

If steady and incompressible then u_b-1 = u_b-2 (otherwise continuity is violated), and hence we see that the 2nd order boundary approximation is the same as the 1st order approximation.

For other cases (e.g. lid-driven cavity flow) the order of the boundary conditions is very important.

cfdnewbie December 15, 2011 14:01

Quote:

Originally Posted by arjun (Post 335608)
So if I understand this correctly, because BC is 1st order it does not make any difference if everywhere else is Second or higher order. The solution from first order scheme and second order schemes will be same??

I would say 1st order BC may affect that solution but it would NOT make the solution 1st order everywhere.


The effect at the BC will perpetuate itself into the domain, so while not all cells will become first order accurate, the "bad cells" will drag your overall convergence down. This may or may not be a problem, depending on your requirements, but a single cell of lower order will destroy your theoretical order of convergence - if this matters in your case or not is something for you to decide.

If you are using codes with first or second order accuracy, the effects will not be as harmfull as if you are using high order schemes. Then, high order boundary approximation is crucial, for first and second oder you will get away with a lot more "approximation crimes"!

cfdnewbie December 15, 2011 14:08

Quote:

Originally Posted by Ford Prefect (Post 335902)
I agree with previous poster. It is problem dependent as well. For steady, incompressible, pipe flow the order of the outlet boundary condition should play little role.

1st order: u_b = u_b-1
2nd order: u_b = (4*u_b-1 - u_b-2)/3

If steady and incompressible then u_b-1 = u_b-2 (otherwise continuity is violated), and hence we see that the 2nd order boundary approximation is the same as the 1st order approximation.

I am a little bit confused about your notation here: If your flow goes from left to right (so it leaves the domain at the right face), and b=0 would be the outflow face, then b=-1 and b=-2 would be the interior points...so your bc would be a (supersonic) extrapolation of u, which then would not be a BC in the sense that you are not feeding outer information in the flow (like at a wall), but just letting the flow develop in a natural way. So the argument might not be valid....

Or am i misunderstanding your example?

Cheers,
cfd newbie

lalupp December 17, 2011 06:12

2nd order BC
 
In unstructured mesh How do we implement second order BC du/dn = 0

Ford Prefect December 20, 2011 09:07

Quote:

Originally Posted by cfdnewbie (Post 335988)
I am a little bit confused about your notation here: If your flow goes from left to right (so it leaves the domain at the right face), and b=0 would be the outflow face, then b=-1 and b=-2 would be the interior points...so your bc would be a (supersonic) extrapolation of u, which then would not be a BC in the sense that you are not feeding outer information in the flow (like at a wall), but just letting the flow develop in a natural way. So the argument might not be valid....

Or am i misunderstanding your example?

Cheers,
cfd newbie

I am just assuming zero gradient at the boundary for velocity and use one-sided differences for the derivative approximation.

cfdnewbie December 21, 2011 03:58

Quote:

Originally Posted by Ford Prefect (Post 336479)
I am just assuming zero gradient at the boundary for velocity and use one-sided differences for the derivative approximation.

Allright, so what you are basically doing is an extrapolation form the inside, sth like a supersonic outflow, correct?

in that case, I'm wondering if the discussion about the order of the outflow bc is valid, since outflow bcs (the supersonic type) have no effect on the solution inside the domain, so yes, for such bcd, I guess order is not important.

I was thinking more about wall / inflow bcs in a flux-based scheme, where it has been shown e.g. by Bassi and Rebay that the effect of a low order bc (with a high order scheme) can be devastating.

Thanks for the nice discussion! Are you from the FD community?

Ford Prefect December 21, 2011 05:18

Quote:

Originally Posted by cfdnewbie (Post 336581)
Allright, so what you are basically doing is an extrapolation form the inside, sth like a supersonic outflow, correct?

in that case, I'm wondering if the discussion about the order of the outflow bc is valid, since outflow bcs (the supersonic type) have no effect on the solution inside the domain, so yes, for such bcd, I guess order is not important.

I was thinking more about wall / inflow bcs in a flux-based scheme, where it has been shown e.g. by Bassi and Rebay that the effect of a low order bc (with a high order scheme) can be devastating.

Thanks for the nice discussion! Are you from the FD community?

Yes I agree, I just wanted to illustrate that order of the boundary condition approximation is not always important. However, I did not think of the boundary as a supersonic boundary. The pressure can be defined at the outlet boundary in a dirichlet way.

As for the original post I think it is best to try both 1st and 2nd order boundaries and then compare the results.

By FD, do you mean Fluid Dynamics? In that case, I would say not really. I do research in Metallurgy, using CFD (well these days it is mostly supervision) and I do some basic FD teaching to third year students. I do dabble in writing cfd codes in my spare time. ;)

morecfd December 23, 2011 12:37

Quote:

Originally Posted by lalupp (Post 336155)
In unstructured mesh How do we implement second order BC du/dn = 0

I have got the same question though I think we must delete the respective derivative terms
am i wrong?

arjun December 23, 2011 15:50

Guys nobody is doubting that the order of scheme on boundary can affect the solution or quality of it.

But my comment was related to these two comments before mine:

Quote:

Originally Posted by Rami (Post 335508)
AFAIK, using a 1st order BC in an otherwise 2nd order scheme will pollute the solution and renders it 1st order accurate. Sorry... Try to implement a 2nd order BC as well.

Quote:

Originally Posted by cfdnewbie (Post 335572)
Yes, I agree with Rami. The overall solution will fall back to the lowest order in your domain, i.e. the boundary contribution. The becomes even more pronounced for high order schemes (>>2), where a low order boundary discretization can totally screw up your solution.


You see, these two things are wrong. While order of BC might affect the solution or might not affect the solution, over all order of solution will NOT fall back to 1st order. Saying categorically that it will fall to 1st order is plainly wrong.


Quote:

Originally Posted by lalupp (Post 336155)
In unstructured mesh How do we implement second order BC du/dn = 0

Usually it is first order. That is phi_bnd = phi_live (cell center for control volume ).

cfdnewbie December 24, 2011 06:58

Quote:

Originally Posted by arjun (Post 336884)

You see, these two things are wrong. While order of BC might affect the solution or might not affect the solution, over all order of solution will NOT fall back to 1st order. Saying categorically that it will fall to 1st order is plainly wrong.

Hey Arjun,
let's debate this :)

The concept of an "order of a scheme" comes from the Taylor series expansion and is ONLY valid for h -> 0, i.e. in the limit of grid spacing going to zero. So even the most established scheme will only reach its design order of accuracy for "small" h, where h depends on the smoothness of the problem itself (and on the question whether the solution is indeed smooth or not!).

so let's agree that the term "order" only makes sense for h->0, right?

let's take a look at a flow field, where the solution is well-behaved and your second order scheme can treat it in a well-resolved manner, so let's assume the errors goes as h squared to zero. Let's further assume that you have ONE bad cell, where your order reduces to one, so your error goes as h (no squared here).
What's going to happen as h->0 ? Your one bad cell will dominate, and your order will gradually fall back to 1. ( This can be proven with mathematical consideration of convergence rates and series, but I think my example is sufficient. )

One great example of this is that at a shockwave (which can be interpreted as a first order phenomenon), all schemes either add an insane amount of viscosity or fall back to first order, no matter what.

Another example everbody who has ever done convergence testing can relate to is to prescribe an priori solution to the flow by the manufactured solution method (call it an elaborate convergence test if you will). One single "bad" cell in your domain will screw up your convergence rate, and you will NOT reach your design order of convergence.

And lastly, even if your "bad" cell might not drastically alter your computations visually, it might as well ruin things like cd / cl / cw, when you are not looking closely.

I encourage you to read Bassi and Rebays paper, which demonstrates the necessity of high order boundary discretizations quite dramatically!

http://web.mit.edu/ehliu/Public/Proj...M_2D_Euler.pdf

So, I'm looking forward to a lively discussion! Let's keep it coming!

Cheers! :o:o

duri December 24, 2011 14:20

Second order BC is required for better accuracy at boundaries with gradients (eg. wall). With zero gradient second order and first order works alike. Practically, first order BC is sufficient enough for Euler solver but not for NS.

Quote:

Originally Posted by cfdnewbie (Post 336911)

The concept of an "order of a scheme" comes from the Taylor series expansion and is ONLY valid for h -> 0, i.e. in the limit of grid spacing going to zero. So even the most established scheme will only reach its design order of accuracy for "small" h, where h depends on the smoothness of the problem itself (and on the question whether the solution is indeed smooth or not!).

so let's agree that the term "order" only makes sense for h->0, right?

This is conflicting with h-methods and p-methods of FEM. In Taylor series h->0 means series gives exactly same value as continuous function on LHS. I wonder how order of accuracy is related to h->0.

Accuracy of an solution can be improved by two ways one increase the mesh size (h-method) (there is a limitation due to round off error, resource...) and next is to increase the order of equation (p -method). This is well proven, you can experiment yourself.
Solve a problem with second order accuracy with a coarse mesh and then solve same problem with first order accuracy with (atleast) 3-4 times refined mesh you may end up with same solution.

Order of scheme is from the truncation of Taylor's series and not on the h->0 assumption. What ever may be the value of h, if you only take the constant term it became first order and by including linear term it becomes second order.

Quote:

Originally Posted by cfdnewbie (Post 336911)
let's take a look at a flow field, where the solution is well-behaved and your second order scheme can treat it in a well-resolved manner, so let's assume the errors goes as h squared to zero. Let's further assume that you have ONE bad cell, where your order reduces to one, so your error goes as h (no squared here).
What's going to happen as h->0 ? Your one bad cell will dominate, and your order will gradually fall back to 1. ( This can be proven with mathematical consideration of convergence rates and series, but I think my example is sufficient. )

When there is a bad cell (eg. highly skewed) it will screw up the solution and will not fall back to first order. Even first order may get screwed up.

Quote:

Originally Posted by cfdnewbie (Post 336911)
One great example of this is that at a shockwave (which can be interpreted as a first order phenomenon), all schemes either add an insane amount of viscosity or fall back to first order, no matter what.

To my knowledge shockwave is not handle by any of the schemes (even Roe scheme). Shocks are handled only at the interface and within a cell, shock cannot be captured. This is because of weak solution approximation.
Whatever you said is an excellent example to prove first order in few cells will not make the entire domain first order. TVD schemes works this way, whenever it encounters shocks it locally makes the scheme to be first order to avoid spurious oscillations around the shock. Any scheme as such will not fall back to first order at discontinuities but limiter makes it to behave that way.

cfdnewbie December 24, 2011 14:38

Quote:

Originally Posted by duri (Post 336933)

Order of scheme is from the truncation of Taylor's series and not on the h->0 assumption. .

The Taylor series expansion is only valid for h->0, that's in the definition of Taylor's expansion, is it not?

cfdnewbie December 24, 2011 14:56

Quote:

Originally Posted by duri (Post 336933)
Practically, first order BC is sufficient enough for Euler solver but not for NS.

.

I beg to differ. A first order cylinder BC will produce spurious entropy at each kink, thereby generating a entropy wake behind the object, and destroy e.g. symmetry. NS on the other hand usually dampens this effect, and is it less pronounced.


Quote:

This is conflicting with h-methods and p-methods of FEM. In Taylor series h->0 means series gives exactly same value as continuous function on LHS. I wonder how order of accuracy is related to h->0.
Order of accuracy is a mathematical concept, derived from a Taylor series, which is only valid for h->0. If you have a code at hand, try doing a convergence test, starting from a coarse grid. You will see that for a large h, you won't get any order of convergence at all.

Quote:

Accuracy of an solution can be improved by two ways one increase the mesh size (h-method) (there is a limitation due to round off error, resource...) and next is to increase the order of equation (p -method). This is well proven, you can experiment yourself.
I'm not doubting that, in fact I agree with you. But "order of convergence" is a different concept than accuracy.

Quote:

Solve a problem with second order accuracy with a coarse mesh and then solve same problem with first order accuracy with (atleast) 3-4 times refined mesh you may end up with same solution.
I agree. Try 16th order, and you will be done with one cell :)

Quote:

Order of scheme is from the truncation of Taylor's series and not on the h->0 assumption. What ever may be the value of h, if you only take the constant term it became first order and by including linear term it becomes second order.
I disagree, please see my post above, as Taylor series is only valid for h->0.


Quote:

When there is a bad cell (eg. highly skewed) it will screw up the solution and will not fall back to first order. Even first order may get screwed up.
Yes, it will fall back to a lower order, the question was not whether that was first order or order 1.5 or something, just a lower order.


Quote:

To my knowledge shockwave is not handle by any of the schemes (even Roe scheme). Shocks are handled only at the interface and within a cell, shock cannot be captured. This is because of weak solution approximation.
Shocks can indeed by captured in a cell, given that the subcell resolution is high enough. I can e.g. capture a shock in a Burger's equation in 1 pseudospectral cell!

Quote:

Whatever you said is an excellent example to prove first order in few cells will not make the entire domain first order.
Maybe I didn't make this point clear enough. Of course, the cells away from the shock will keep their second order quality, but the WHOLE solution will be less than second order. Do a convergence test with a shock in it, the shock itself is not sufficiently smooth, thus all codes will lose their order of convergence and fall back down to first order.

All I'm saying is that the overall behavior of your solution is governed by the lowest-order phenomenon - it doesn't matter if that comes from physics or numerics.

Quote:

TVD schemes works this way, whenever it encounters shocks it locally makes the scheme to be first order to avoid spurious oscillations around the shock. Any scheme as such will not fall back to first order at discontinuities but limiter makes it to behave that way.
Allright, so your overall order will suffer because at the shock you are introducing an error of size O(1). That's what I'm trying to say all the time :)

(BTW, the reason some schemes have to resort to first order is because they wouldn't be stable otherwise. They just dump viscosity on the shock, until it can be resolved by low order methods)

Thanks for your input!

Cheers!

arjun December 24, 2011 17:32

Quote:

Originally Posted by cfdnewbie (Post 336911)
Hey Arjun,
let's debate this :)

Whats there to debate. I already pointed out that saying that over all solution will fall back to lowest order is wrong. It should be obvious to anybody.


Quote:

Originally Posted by cfdnewbie (Post 336911)
let's take a look at a flow field, where the solution is well-behaved and your second order scheme can treat it in a well-resolved manner, so let's assume the errors goes as h squared to zero. Let's further assume that you have ONE bad cell, where your order reduces to one, so your error goes as h (no squared here).
What's going to happen as h->0 ? Your one bad cell will dominate, and your order will gradually fall back to 1. ( This can be proven with mathematical consideration of convergence rates and series, but I think my example is sufficient. )

Again the same thing. Now what happens that if this bad cell is the boundary cell and there is no change of flow. Further flow field does not mean that everything shall be happening only around that bad cell. In flow field flow has local nature which dominates. For example, if there are small eddies generated and if you are able to capture them correctly by *locally second order* schemes than it does not matter if your some cell in inlet boundary was bad and scheme there was first order.

To tell you the truth, in unstructured grid solvers like starccm+ and fluent schemes at BC are almost always first order. Now search for their presentations where they have investigated the flow comparison between first order and second order schemes. Why do you think their results differ?? May be the order BC did not play as important role as you making it to be.

I am not the only one to tell you this, there are others also who are saying the exact same thing to you in this thread.



Quote:

Originally Posted by cfdnewbie (Post 336911)
One great example of this is that at a shockwave (which can be interpreted as a first order phenomenon), all schemes either add an insane amount of viscosity or fall back to first order, no matter what.

Shockwave is poor example. Second viscosity is NOT added, but flow field due to error behaves as if the viscosity was little bit higher because of use of first order scheme there. Why not use second order scheme?? That is because in shockwave region gradients are very high and it would make solver unstable.

Further, the example with shockwave proves that just because locally first order scheme was used solution over all solution does not become first order. Rest of the place it would be second or higher order accurate.


Quote:

Originally Posted by cfdnewbie (Post 336911)
Another example everbody who has ever done convergence testing can relate to is to prescribe an priori solution to the flow by the manufactured solution method (call it an elaborate convergence test if you will). One single "bad" cell in your domain will screw up your convergence rate, and you will NOT reach your design order of convergence.

One poor cell can disturb the convergence but it is not due to the reason that that ONE CELL was first order accurate. In fact, first order scheme in full region will be 10 times more stable than 2nd order in full domain.

One poor cell can disturb convergence because it can screw up the condition number of matrix. In starCCM+ you can switch off such cell and still run simulation with 2nd order schemes in flow region.



Quote:

Originally Posted by cfdnewbie (Post 336911)
I encourage you to read Bassi and Rebays paper, which demonstrates the necessity of high order boundary discretizations quite dramatically!

http://web.mit.edu/ehliu/Public/Proj...M_2D_Euler.pdf

So, I'm looking forward to a lively discussion! Let's keep it coming!

Cheers! :o:o


We are not discussing whether second order schemes are needed or not. We are discussing this:

Quote:

Originally Posted by cfdnewbie (Post 335572)
Yes, I agree with Rami. The overall solution will fall back to the lowest order in your domain, i.e. the boundary contribution. The becomes even more pronounced for high order schemes (>>2), where a low order boundary discretization can totally screw up your solution.


cfdnewbie December 24, 2011 18:04

Quote:

Originally Posted by arjun (Post 336944)
Whats there to debate. I already pointed out that saying that over all solution will fall back to lowest order is wrong. It should be obvious to anybody.

Well, you might have pointed that out, but I differ in my opinion. Maybe you didn't read my post carefully, friend. I AM agreeing with you that one cell will not affect each other cell in your domain, but a single bad cell with dominate the error convergence measured as an integral over the whole domain. The way you determine convergence for a scheme is usually NOT done by looking at single cells, but by integrating a suitable error norm (L2 usually) over the whole domain. So again, if you have 100000 smooth cells and one cell with an error of order lower than the rest, it will drag you down. simple as that.


Quote:

Again the same thing. Now what happens that if this bad cell is the boundary cell and there is no change of flow.
again, this has been discussed in this thread already. Let's consider not the simplest of BCs (and by the way, if you have ever done direct acoustics, you will be aware that outflow bcs can be a great pain in the neck due to reflection), but the more instructive case of wall bcs!

Quote:

Further flow field does not mean that everything shall be happening only around that bad cell. In flow field flow has local nature which dominates. For example, if there are small eddies generated and if you are able to capture them correctly by *locally second order* schemes than it does not matter if your some cell in inlet boundary was bad and scheme there was first order.
When you bring turbulence into play, it gets very dangerous. You should know that eddy generation and transport is highly sensitive to dispersion and dissipation errors, and thus almost all the basic turbulence is research is done with spectral codes.... think about why that is, and you will see how important sufficient order is for turbulence simulations.
And regarding your example:
If you are introducing an error of O(1) at your inflow bc, you will be sure to see the result in your eddies, unless you are doing some purely supersonic simulations.

Quote:

To tell you the truth, in unstructured grid solvers like starccm+ and fluent schemes at BC are almost always first order. Now search for their presentations where they have investigated the flow comparison between first order and second order schemes. Why do you think their results differ?? May be the order BC did not play as important role as you making it to be.
Well, I would be happy if you could point me to these presentations, because I find those companies always very reluctant to show these types of comparisons.
Why don't you send me the presentations, I will take a look and you will read up the paper I proposed, and we talk some more? I must admit I tend to trust papers in peer-reviewed journal a tiny bit more than colorful marketing brochures...don't you as well :)

Quote:

I am not the only one to tell you this, there are others also who are saying the exact same thing to you in this thread.
so we have a lively discussion going, from which we can all learn. That's great, that's what is missing in this forum way too often! Let's start educating each other...btw, you haven't replied to my remark about h->0!




Quote:

Shockwave is poor example. Second viscosity is NOT added, but flow field due to error behaves as if the viscosity was little bit higher because of use of first order scheme there. Why not use second order scheme?? That is because in shockwave region gradients are very high and it would make solver unstable.
Viscosity is added for any type of shock capturing like TVD. And btw, you have two ways of doing SC: Add manually enough viscosity to keep your scheme (2nd, 4th, 16th) order stable by smoothing the gradient or use the most dissipative scheme (FOU) to do that for you. Amounts to the same thing.

But you didn't understand my example. A shock wave is a natural "first order BC", because the solution loses its smoothness there, and you will see the same behavior in the convergence as for a faulty first order bc. Sorry to confuse you, I shouldn't have brought it up!

Quote:

Further, the example with shockwave proves that just because locally first order scheme was used solution over all solution does not become first order. Rest of the place it would be second or higher order accurate.
Yes, again, nobody is doubting that. But do the math, calculate the L2 norm, refine your mesh, compute your EOC, and you will come up with sth LESS THAN 2.


Quote:

One poor cell can disturb the convergence but it is not due to the reason that that ONE CELL was first order accurate.
Oh yes, it is. Please think carefully again about what I said!

Quote:

In fact, first order scheme in full region will be 10 times more stable than 2nd order in full domain.
Maybe true, but what does stability have to do with order of convergence?????


Quote:

One poor cell can disturb convergence because it can screw up the condition number of matrix. In starCCM+ you can switch off such cell and still run simulation with 2nd order schemes in flow region.


I'm very very very confused now. Are you talking about the convergence of your matrix inverter for implicit time stepping??

If that's the case, that would explain a lot of the confusion going on here, friend :)

Cheers a lot!

arjun December 24, 2011 18:23

We are not going anywhere. It seems that you have made up your mind and no amount of *discussion* is going to change it.

Time is important thing, so I have to limit it to some point. I can not spend more than what i have so far into this discussion.

So believe in whatever you believe in. Good luck.

cfdnewbie December 24, 2011 18:37

Too bad, I am sure we could have all benefitted from this, but the discussion speaks for itself, then. Just please do me one favor and answer my question in red: were you talkung about the convergence of your matrix invert all the time? That would explain all the trouble ....

Cheers friend!

arjun December 24, 2011 19:58

Quote:

Originally Posted by cfdnewbie (Post 336952)
were you talkung about the convergence of your matrix invert all the time? That would explain all the trouble ....


Nope.

I was talking about the fact that chosing a first order BC would not render the solution to 1st order everywhere. Saying it will is plain wrong.

So in the end, if you like to believe otherwise, then go ahead and do it. I certainly do not agree with it.

cfdnewbie December 24, 2011 20:06

Quote:

Originally Posted by arjun (Post 336953)
Nope.

I was talking about the fact that chosing a first order BC would not render the solution to 1st order everywhere. Saying it will is plain wrong.

So in the end, if you like to believe otherwise, then go ahead and do it. I certainly do not agree with it.

No, I don't believe that, but it seems you insist. I rest my case here, since the concept of an integral norm does not seem to resonate with you, friend.

Good luck in your further CFD career, all the best!

Cheers!

arjun December 24, 2011 20:09

Quote:

Originally Posted by cfdnewbie (Post 336955)
No, I don't believe that, but it seems you insist.

Here you go, good luck to you too.


Quote:

Originally Posted by cfdnewbie (Post 335572)
YThe overall solution will fall back to the lowest order in your domain, i.e. the boundary contribution.


cfdnewbie December 24, 2011 20:25

You just wont let it go, will you? The keyword here is overall, not local. As I have written above, integral. But I can tell that your background is more on the practical than on the theoretical side, so I will not bother you further with mathematical concepts.

duri December 25, 2011 03:31

2 Attachment(s)
Quote:

Originally Posted by cfdnewbie (Post 336935)
.

I beg to differ. A first order cylinder BC will produce spurious entropy at each kink, thereby generating a entropy wake behind the object, and destroy e.g. symmetry. NS on the other hand usually dampens this effect, and is it less pronounced.

Cheers!

Here i not taking about internal boundaries like symmetry, periodic, sliding etc. Because you have sufficient data for higher order reconstruction. First order is sufficient enough at boundaries where user provides input eg., inlet, outlet etc.

Quote:

Originally Posted by cfdnewbie (Post 336935)
.

Order of accuracy is a mathematical concept, derived from a Taylor series, which is only valid for h->0. If you have a code at hand, try doing a convergence test, starting from a coarse grid. You will see that for a large h, you won't get any order of convergence at all.

I disagree, please see my post above, as Taylor series is only valid for h->0.
Cheers!

I don't understand why you worry so much about h->0, this concept is from calculus to handle derivatives at a point. (remember point is hypothetical concept).

Quote:

Originally Posted by cfdnewbie (Post 336935)
.
I agree. Try 16th order, and you will be done with one cell
Cheers!

You could laugh at it but i don't bother. When you are solving with some function that could capture the flow physics then you need only one cell (which means your function is analytical solution). In higher order scheme we use to reconstruct based on polynomial or exponential assumptions which may not agree with flow physics. So as approximation, assume that reconstruction is valid in neighborhood and try to fit it locally. Grossly one can say CFD is a kind of highly sophisticated piecewise curve fit in 3D domain.

To demonstrate the concept of h-method and p-method i am attaching two results. Both case ran in fluent, first with 4800 cells and second order Roe scheme (ramp_2nd.jpg) and other case with first order on same mesh but adapted whole region twice so that grid spacing is 4times smaller (ramp_1st.jpg). Check the results, it demonstrates the relation between accuracy, order and mesh size. Beware that even though accuracy of the results are almost same the order is different. Any interesting observations are welcomed.


Quote:

Originally Posted by cfdnewbie (Post 336935)
.
Shocks can indeed by captured in a cell, given that the subcell resolution is high enough. I can e.g. capture a shock in a Burger's equation in 1 pseudospectral cell!
Cheers!

This is very interesting. Can you give some reference on " capture a shock in a Burger's equation in 1 pseudospectral cell! "

Quote:

Originally Posted by cfdnewbie (Post 336935)
.
Maybe I didn't make this point clear enough. Of course, the cells away from the shock will keep their second order quality, but the WHOLE solution will be less than second order. Do a convergence test with a shock in it, the shock itself is not sufficiently smooth, thus all codes will lose their order of convergence and fall back down to first order.

All I'm saying is that the overall behavior of your solution is governed by the lowest-order phenomenon - it doesn't matter if that comes from physics or numerics.

Cheers!

I agree with this point, by introducing some lower order will pull the order of solution to some extent. Second order TVD schemes usually have order less than 2 and at worst case it could be close to 1. But accuracy of TVD is better than the pure second order solution. I emphasize on the solution accuracy than the theoretical order of accuracy.

cfdnewbie December 25, 2011 07:12

Hi duri,
thanks for your great reply!

Quote:

Originally Posted by duri (Post 336965)
Here i not taking about internal boundaries like symmetry, periodic, sliding etc. Because you have sufficient data for higher order reconstruction. First order is sufficient enough at boundaries where user provides input eg., inlet, outlet etc.

I tend to agree for simple flows, where the inlet and outlet are far away from the zone of action, so to speak. But let's take for example a shock - turbulence interaction, where a fully turbulent field is used as an inflow (this field is usually generated from previous turbulence simulations). In that case, the inflow order is highly important.


But in general, it fully depends on the flow physics and the size of your domain whether low order inflow is acceptable or not. It's the engineer's or scientist's job to make sure that your bcs do not (greatly) affect the outcome of your solution.



I don't understand why you worry so much about h->0, this concept is from calculus to handle derivatives at a point. (remember point is hypothetical concept).


Quote:

You could laugh at it but i don't bother. When you are solving with some function that could capture the flow physics then you need only one cell (which means your function is analytical solution). In higher order scheme we use to reconstruct based on polynomial or exponential assumptions which may not agree with flow physics. So as approximation, assume that reconstruction is valid in neighborhood and try to fit it locally. Grossly one can say CFD is a kind of highly sophisticated piecewise curve fit in 3D domain.
Why should I laugh at it? I fully agree with you. Just a note: the reconstruction you are talking about is only valid for Finite Volume formulations, I assume? Other approaches with subcell resolution don't require any reconstruction technique, they just approximate the solution inside each cell as a polynomial of arbitrary order.

Quote:

To demonstrate the concept of h-method and p-method i am attaching two results. Both case ran in fluent, first with 4800 cells and second order Roe scheme (ramp_2nd.jpg) and other case with first order on same mesh but adapted whole region twice so that grid spacing is 4times smaller (ramp_1st.jpg). Check the results, it demonstrates the relation between accuracy, order and mesh size. Beware that even though accuracy of the results are almost same the order is different. Any interesting observations are welcomed.
Thank you for the illustration, I agree with you.


Quote:

This is very interesting. Can you give some reference on " capture a shock in a Burger's equation in 1 pseudospectral cell! "
Please PM me about that, I'm on Christmas holidays, so I don't have access to all my codes and data. I'll be happy to send you references and the code after the break!
Here are two I can remember of the top of my head:
http://www.sciencedirect.com/science...21999182900699
http://www.sciencedirect.com/science...96300305003620


Quote:

I agree with this point, by introducing some lower order will pull the order of solution to some extent. Second order TVD schemes usually have order less than 2 and at worst case it could be close to 1. But accuracy of TVD is better than the pure second order solution. I emphasize on the solution accuracy than the theoretical order of accuracy.

Thank you so much, I was almost giving up on this forum :) :rolleyes::rolleyes::rolleyes:

Have a nice time!
Cheers

arjun December 25, 2011 19:36

Quote:

Originally Posted by cfdnewbie (Post 336957)
You just wont let it go, will you?

That is because that is what I was responding to, when i first commented. There is no doubt in anyone's mind that order of BC could affect the solution.

Quote:

Originally Posted by cfdnewbie (Post 336957)
The keyword here is overall, not local. As I have written above, integral. But I can tell that your background is more on the practical than on the theoretical side, so I will not bother you further with mathematical concepts.


I ran a LES simulation with say 10 million points. So how are you calculating the Taylor series expansion using 10 million points and get order of polynomial overall.

Are you doing a curve fitting for a polynomial using 10 million points and then saying that since I used 1st order BC this polynomial is first order because of BC.


Quote:

Originally Posted by duri (Post 336965)
Grossly one can say CFD is a kind of highly sophisticated piecewise curve fit in 3D domain.

Exactly. This sums up very well.

cfdnewbie December 26, 2011 07:08

1 Attachment(s)
Quote:

Originally Posted by arjun (Post 337001)

I ran a LES simulation with say 10 million points. So how are you calculating the Taylor series expansion using 10 million points and get order of polynomial overall.


We are talking about the order of the scheme, not of the solution here, that's two very different things. I will walk you through how the process is done in code verification, see e.g. the report by the Sandia labs:
http://prod.sandia.gov/techlib/acces...000/001444.pdf

1) Generate an analytical solution to the NS-equations
2) Create a source term as a right hand side

(steps 1 and 2 are just to make sure that you have an exact solution for sth as complex as the NS equations).

3) Add the source term into your code, and doing your calculations
4) Let's say your exact solution is steady, but works with unsteady as well
5) For your steady state, compute the error of your numerical solution against the exact solution, in any suitable norm, let's say L2 for the WHOLE domain.
6) Decrease mesh spacing and repeat
7) compute order from E=Ch**p

Let's go back to step 5: Let's say your code is of order 2, so all your errors will go as h**2, so integrating over the whole domain will still give you an "squared" behavior.

Let's now assume that a single cell goes with h**1, because of whatever error is there. Then, the whole process with not give you p=2, but will go to p=1, as the linear error dominates.


I have attached a zip file with an excel sheet for you to test, I have set up a case with 100 O(2) cells and just a sinle O(1) cell, the overall error is O(1), as you can see.


This whole process is of course harder to do if you are doing an LES, but the concept is still valid.

Hope this clarifies things!
Cheers

cfdnewbie December 26, 2011 07:12

Quote:

Originally Posted by duri (Post 336965)
Grossly one can say CFD is a kind of highly sophisticated piecewise curve fit in 3D domain.

I do not mean to nitpick here, but it does not necessarily have to be piecewise, think of global methods. Also, curve fit sounds like "interpolation" to me, which is also not the only way to do it, but maybe I'm just misinterpreting your use of the word "curve fit" :)


All times are GMT -4. The time now is 14:48.