extremely simple problem... can you solve it properly?
Hey there.
While doing CFD, we mostly trying to solve (or even solve!) an extremely complex set of equations, e.g. NS equations. "Fortunately", there are no analytical solutions to them, and for that reason who cares how good numerical solutions are... But there are still the simplest problems that possess exact solutions. Consider the easiest transient problem that I could think of. Here we go... Given is the 1d problem of transient heat diffusion, say, with the following boundary conditions: BC: x=0, T(0,t)=1; x=1, T(1,t)=0; and initial temperature is as follows: T(x,0)=0 An analytical solution to the problem is provided by Carslaw and Jaeger, "Conduction of Heat in Solids", chapter 3.4. I'm sure every numerical approach will provide us with approximately 10% of error w.r.t. to temperature field for the very first time step, no matter how small time steps are used (I tried FDM, FEM, BEM...). So, I'm challenging everybody in this NG to numerically solve this simplest heat diffusion problem. You may use any commercial, or your own codes  please provide here a feedback of your experience. The bottom line here is: if we fail to get any better accuracy than 10% for the initial time step even for LINEAR problem, what kind of numerical results are we getting for more complex NONlinear problems governed by NS equations? So what if the whole problem is very sensitive to small perturbances, but we introduce error that is no longer "small"? PS of course, not for every fluid flow problem do we get such a tough boundary condition, but let's see what happens... Thank you for your response. Mikhail 
Re: extremely simple problem... can you solve it properly?
Dear Mikhail:
I do not dare to run my code to bit 10% error on your problem . And I, also, do not think any commertial code can satisfy you and your problem. However, I do not think this problem is a good example to validate codes. "Analytical solution" means, at least to me, an exact solution of GIVEN EQUATIONS AND BC, and sometimes cases are made independently of availablity in the nature (possibly education purpose). Your problem has an inconsistancy between initial temperature (T=0) and one of boundary conditions (T=1). This kind of jump will definitely give trouble comparing numerical results with analytical one during initial short period of time. This is due the fact that numerical approach need time to resolve this suddern changes, and fortunately in nature we do not have to worry about this. With this problem, I would prefer to compare results after some time (or steady state results). Or, if we really like to compare results just after the first time step is completed, we can either (1) change initial temperature to the space dependent curve which satisfies T(0,0) = 1 and T(1,0) = 0, or (2) change T(0,t) to a function of time so that it increases slowly to 1, if analytical solution is available. Good to talk with you. Kim. 
Re: extremely simple problem... can you solve it properly?
(1). This is a good problem, I think. (2). I used to have the book over 30 years ago when I was taking the heat conduction course. It was used as a textbook then. I don't have it with me now. (3). The problem is a good problem because there are similar problems around, such as shock wave (a discontinuity), leading edge flow of sharp flat plate, stiff equations, etc.. (4). There is a question about the existence of such problem in real life. But that is something else. Because the question was not aimed at the solution of a real problem. It is a challenge to the FDM, FVM, and FEM solution (5). I think, in this case, one has to use a more realistic principle, that is " if you can not beat him, you might as well join him" philosophy. (6). This was the philosophy I took many years ago, when I was developing numerical solution to NavierStokes equations. The principle can be stated as: Min{ L[ f(i), f_exact(i) ]=epsilon }. (7). Where Min is a process to develop the FDM which will minimize the error term, epsilon. (8). Where L[]=0 is the operator of the governing equation. (9). Where f(i) is the FDM solution at the mesh point i in general. (10). Where f_exact(i) is the local exact analytical solution at the mesh point i in general. (11). Where epsilon is the error term in the final FDM solution. (12). So, if one assume that the solution is linear between grid points, then f_exact(i) will be replaced by piecewise linear solutions. And you will get the 3point central difference scheme. The error, as stated , was 10~15%. Regardless of the definition of the error used, I think, the error is always there. ( I don't know how this error was defined.) (13). To find a better answer, one can try to create a better f_exact(i), in a simplified form so that it can be efficiently incorporated into the FDM . That is my approach. (14). One can always argue that the conductivity must be defined first. If it is zero, the solution will remain unchanged from the initial condition. On the other hand, if the conductivity is reaching infinity, the solution is always steadstate. In between, it is always take time for the temperature at a point to change. Since the surface point is part of the body, it should also follow the same governing equation. So, this initial jump in temperature ( or shock) has to be handled separately. But this was not the problem. The problem was the analytical solution vs FDM, FVM, and FEM solutions. I don't have an answer yet.

Re: extremely simple problem... can you solve it properly?
Dr. Kim mentioned the inconsistency in nature (real life) between the BCs and ICs, but as an intellectual exercise it is interesting to consider how well a numerical method can answer the heat conduction "math problem" that has been posed. As you mention, the first time step will have a considerable amount of error (~10%). But that's missing the point a bit. Say I am interested in what the temperature field is at t = 1 second. Then I can use a time step of 1/100th of a second and get pretty darned close to the right answer. Or I can use a time step of a millisecond and get even closer. Interested in the temperature field after one millisecond? Use a time step of a microsecond. Want to know what happens after a nanosecond? ... You get the idea.
The solution depends on the spatial resolution of the numerical scheme in exactly the same way, of course. So what the numerical methods can provide are a way to get _arbitrarily close_ to the analytical solution at any given time, t, and location, x. And that's a pretty good tool, I think. Nonlinear problems are, admittedly, a considerably more complicated story. Regards, Keith 
Re: extremely simple problem... can you solve it properly?
Now, that's just rubbish: I did a PhD on the error estimation for the Finite Volume Method and as a part of that I did a number of cases with analytical solutions, including steady and transient, linear and nonlinear (fluid flow) problems. In every single case I showed that the error can be reduced not below 10 %, but below 0.01 %! The fact you've got such a big error means that you're doing something severely wrong!

Re: extremely simple problem... can you solve it properly?
Sure, that's completely fine for the linear problems  it's easy to get any desired level of accuracy  simply keep on decreasing time step so that time level for which you are looking for a numerical solution is far away from the initial level, i.e. you've done hundreds or even thousands of time steps. Your error definitely will be low...
However this doesn't work towards nonlinear problems. Guess why? Simply your numerical solution crucially depends upon what happened before  this is a nature of all nonlinear problems. But since you introduced ~10% of error right at the first time step, it's easy to imagine that the solution may be a way off a real solution. Especially if the solution is close to the critical point  the solution is completely controlled by the position on the phase plane. That's why I was eager to know if any of you could resolve right the fisrt time step error, not dozens later ... Anyway, thank you for your contribution 
Re: extremely simple problem... can you solve it properly?
Sorry to say this but it looks like that you did solve everything except for the problem under a discussion. As for me, I also did a whole bunch of problems, with a variety of combinations for boundary and initial conditions  and, sure, everyhting is beautiful  I'm getting even below 0.01%  I'd say ten significant digits is not the highest level of accuracy using BEM.
So, if you still have your favorite codes for your PhD work, please take your time and run this particular problem. I'm not here to discuss whether I did something incorrectly or not in my codes  I've got enough experience to figure it out by myself  I'm only to see if any CFD brain can solve this "mathematical" problem without the 1st time step error.  For anyone who wonders: I did solve this problem, and I'm getting any desired level of accuracy right for the first time step  think of 10^10 error for the temperature at any point within x{[0,1].  thanks 
Re: extremely simple problem... can you solve it properly?
Your original post asked about a specific linear problem. As for linear vs. nonlinear problems, I invite you to reread my earlier response (don't skip that last line).
Regards, Keith P.S. For those nonlinear problems, you of course realize that eventually any error, be it 10% or 0.1%, will eventually cause your numerical solution to deviate from the "analytical" solution. For that matter, the assumptions present in the equations (NS for example) will cause the "analytical" solution to deviate from nature. Not to mention we'll never really know those ICs and BCs exactly anyway... 
How about an even simpler problem?
Interesting coincidence!
I'm currently working on the implementation (not development) of a gridfree diffusion scheme and in the last few days I've been trying to simulate the diffusion of a point vortex in free space. So, this is a very similar problem: T(x=0,t=0)=Infinite such that its integral over an infinitesimally small area is constant. T can be the temperature at a point, or it can be the vorticity there and the integral term for the latter will be the circulation. The solution is simply the Green function for the transient heat conduction problem (which is problemsome at (x=0,t=0) This is a "simpler" problem (or is it?) Anyway, the point is that one gets garbage at the first few timesteps even when using an infinite order (yes, infinite) core function (core function is equivalent to the discretization scheme in FDM). However, I should point out that the scheme I'm using preserves up to the second (integral) moments even at the very first timestep. That is it preserves circulation, the mean position of the (expanded) vorticity field and its rate of growth. I am interested in the evolution of circulation and am not as concerned about the error in vorticity (or temperature), because these are postprocessed variables in my case and do not contaminate the solution. I would be extremely interested to learn what you have come up with. I can only imagine that it must be some sort of an analytical singularity removal scheme (in an integral sense?). If you could share the info at this time, please do so Adrin Gharakhani 
Re: extremely simple problem... can you solve it properly?
(1). I think, a proper coordinate transformation in space, and in time , before the use of FDM would reduce the computational error. (2). This is only my guess, because I am not trying to solve this problem right now. So, give us enough time to think about. A few months maybe.

Re: extremely simple problem... can you solve it properly?
This is really rubbish!
You can not get the solution just because the spatial size which you are using are too large. Assuming 2nd order discrete scheme in your code, the error is proportional to (dt)(dx)**2, the numerical solution is not only related to dt but also with dx. So if you reduced the spatial step half, you would be SURPRISED to find that the error were also reduce below 2.5%, if your time integral is accurate or time step is small enough. The solution has a boundarylayerlike property. The spatial size near the boundary x=0 should be very small. Z. Lei 
Re: extremely simple problem..NOT REALY!. can you solve it properly?
First look at your boundary condition (BC) at x=0: T(0,t)=1. and your Initial condition (IC) at t=0, T(x,0)=0.
Then I ask T(0,0)=? Analytically, your BC is valid only if t>0 and is undefined at t=0. When doing numerical calculation, your solution must start from t=0, at which the temperture field is not well defined! How can you get an errorfree answer? You can get perfect answer if you change your I.C. to t(x,0) = 1, x<x0 t(x,0) = 0, x>=x0 HL 
Re: How about an even simpler problem?
Hi, there
Definitely, this is one of the toughest problems (though it looks very simple at first glance) that BEM community has not been able to solve for almost 30 years! Notice that the problems of this kind arise not only in heat transfer and CFD, but almost everywhere, especially in stress analysis. So, many commercial code developers would love to have a numerical technique to handle problems with infinite fluxes and/or stresses. I appreciate your interest in getting more information about the technique, but I regret to write here that we need to write a paper first due to an obvious reason. Thank you for your contribution, Mikhail 
Re: extremely simple problem... can you solve it properly?
Sure, go ahead. I know some people have spent a couple of decades solving it...

Re: extremely simple problem... can you solve it properly?
It has nothing to do with a spatial step. When you do a BEM formulation, recall (maybe, get a hint) NO spatial discretization is involved for the 1st time step when you do 1d formulation. As for 2d, it's a little bit more involved, but definitely, space error is not present there as intial condition says T=0 everywhere except for x=0.
So, in order to reduce a spatial discretization error for advanced methods like FDM, FVM, FEM ( did I mention all advanced numerical techniques?), you'd need to half a spatial step, but it works for smooth problems only. As for this problem, you'd better give a try. You'd be surprised that real problem solving is more diverse than that you may found in textbooks. 
Re: extremely simple problem..NOT REALY!. can you solve it properly?
bubba, there is no conflict in boundary and initial conditions. You've got an initial condition as T(x,0)=0, and boundary consditions T(0,t)=1 and T(1,t)=0, for t>0. Look for the message that initiated this thread.

Re: extremely simple problem..NOT REALY!. can you solve it properly?
then your T(0,0) is 1 or 0 ?

Re: extremely simple problem..NOT REALY!. can you solve it properly?
Supposedly, it's 0 at t=0, but unity for any t>0. These conditions are used to get an analytical solution.

Re: extremely simple problem..NOT REALY!. can you solve it properly?
then it is conflict with your first B.C. x=0, T(0,t)=1. B.C. should be applied to the point of t=0, the initial point also.

Re: extremely simple problem..NOT REALY!. can you solve it properly?
Nope, no conflict at all. This is a "mathematical" problem, and I'd refer you to a whole bunch of books (even texts), when such a jump is applied to a particular problem. Sure, it leads to a singularity, but IC and BCs are consistent.

All times are GMT 4. The time now is 19:42. 