I try to solve the Klein-Gordon equation (already posted by Prof. François Bouchut), but using variational form. What surprises me is that the two methods give (slightly ) different results. I think that the reason is: the initialization, because when I start with a very close U1 (see line 59 kg-VF.edp) the two methods give exactly the same results. My question is: How can I enhance the initialization (compute U1 very accurately) (in variational form) when the exact solution is unknown? Attached here
In your file kg-FV.edp, line 55, the test “if (res > 1e-10)” should be “if (res < 1e-10)”
Also you should not modify U0 (line 56 has to be removed). Line 53 has also to be removed.
Hi,
I am currently solving a nonlinear time-dependent PDE (of Klein–Gordon type) using FreeFEM. The spatial discretization is performed with P2 finite elements, while the time integration is carried out using a second-order time-stepping scheme combined with Newton iterations for the nonlinear system. My objective is to estimate the convergence rate with respect to the time step.
In many realistic applications, however, the exact analytical solution is not available. At present, I estimate the temporal convergence by computing solutions with several time steps and comparing them to a reference solution obtained using a very small time step dtdtdt. While this approach is computationally expensive, especially for nonlinear problems that require multiple Newton iterations at each time step.
Therefore, I would like to ask whether there is a more efficient or commonly recommended strategy in FreeFEM to evaluate time convergence when the exact solution is unknown, while avoiding the high computational cost of computing a very fine reference solution.
Hi,
Indeed there is a common method to evaluate the accuracy of a numerical method when no realistic analytic solution is known. It is called the “manufactured solution” method. The principle is very simple. Consider a given PDE problem A(u)=0 where A is a possibly nonlinear operator, with partial derivatives in space and possibly in time. Then we just define the manufactured solution by defining u_{ex} by a particular explicit formula (which includes as much as possible the singularities that we expect). Then we define f=A(u_{ex}) that we compute analytically. Finally we solve the problem A(u)=f by the numerical method we would like to evaluate, knowing that the exact solution is u=u_{ex}.
The strong interest of this method is that it allows to check that the numerical method converges to the correct solution. Thus it enables to validate the numerical method. It has nevertheless a weakness: the source term f that we impose may not reflect the “physically relevant” right-hand sides, and as a consequence the behaviour of the numerical method for this f may be different for “physical” sources, and the shape and singularities of “physical” solutions may differ from that of the chosen u_{ex}.