Hello.
I would like to learn more about the convect function.
Am I right to say this uses an explicit Euler method, together with a FEM interpolation?
Where can I find, on the code, how it was implemented?
Thank you!
Hello.
I would like to learn more about the convect function.
Am I right to say this uses an explicit Euler method, together with a FEM interpolation?
Where can I find, on the code, how it was implemented?
Thank you!
The 2d command wn=convect([ux,uy],dt,w0) where w0 is a finite element function (thus a scalar function of position), dt is a real number (positive or negative), [ux,uy] a vector finite element function (thus a vector function of position, let us denote it by \mathbf{u}(x)), and wn (the result) is a finite element function (thus a scalar function of position).
Computes the solution (for each fixed position x) to
\frac{dX}{dt}(t)=\mathbf{u}(X(t)) with initial condition X(t=0)=x.
The solution to the ODE is exact up to a certain point (?).
It sets wn=w0(X(t=dt)).
The dependency in x is through the initial condition on X. The result is interpolated so that wn belongs to the finite element space it has been declared.
A main property is that for dt small, wn(x)\simeq w0(x)+dt\,\mathbf{u}(x)\cdot\nabla w0(x)
Hi François,
Sorry to unearth this discussion again, but how is it possible the solution to X’(t)=u(X(t)) be “exact up to a certain point”? What do you mean by that? In my understanding, only an approximation can be done here, something like X(dt) ~ X(0) + dt.u(X(0)) (explicit Euler). Is this the case?
Lucas
Tue solution is exact is the field [U1,U2] is constant by triangle so the approximate characteristics
scheme is:
compute the characteristics in on triangle by setting U when we enter in the triangle then find the characteristic exit edge with constant velocity , change of triangle and restart.
The only difficulty is when the characteristics arrive on a vertex.
Dear Hecht
Thank you for your clarification on this function. It is true that, if the velocity is defined as a P0 function, then the computation of the characteristics becomes trivial. With a student of mine, we are really trying to understand the method, and also the sources of error of this scheme and we came up with the following numerical test setup: we have a domain composed by 3 boxes (each build as a “square”), each having a different but constant velocity field, only pointing in the “x” direction. Their intensity are U1=1, U2=2 and U3=1 (say m/s). So, the barycenter of the first box should arrive at the barycenter of the final one in time 0.5L U1 + L U2 + 0.5L U3. In our understanding of the method, the only source of error here are the “N” interpolations, one for each time step, which should result in an error of the form O(N.h^k). However, this is not exactly what we observe. Here is a picture containing the “h” convergence:
Also, attached, we send the code itself. Is there something we are missing?
Thank you and best regards
Lucas
convect.edp (2.6 KB)
Here you are investigating the scheme at dt=cst. You have to remind that in general you have an error due to space discretisation, and an error due to time discretisation. Thus when dt=cst, when reducing h you reduce the space discretisation, but not the time discretisation. As long as the time error is smaller than the space error (the dominant term is the space error), the global error decreases. But at some point the space error is of the same order of (or smaller than) the time error. Then reducing h has no effect because the time error is dominant. At this point the effective order with respect to h becomes zero.
Your proposed estimate O(N.h^k) is not real because indeed each interpolation error does not tend to zero with h. To see this you have to see that as h<v_m*dt (v_m the Linfty norm of velocity), the characteristics travel through several cells.
The correct way to evaluate the error is to let both h and dt tend to zero together.
Yes, I agree with all you said, in general. However, in this particular case, I have an exact solution for an advective field that is exactly represented by a constant-by-triangles function. In my understanding, the computation of the characteristics here should be exact, and only the interpolation error prevails.
I agree that it is not so clear. I think that either the interpolation error does not tend to zero, or there is some hidden error in the algorithm for a characteristics traveling through several cells. Following such characteristics is geometrically complicate, and there is probably an approximation that is done, and that becomes dominant as the number of crossed cells becomes large (which is the case as h tends to zero at fixed dt).