All the forthcoming numerical examples on the performance of the algorithm have been implemented in FORTRAN language and computed under double precision, over 6 cores in parallel, each of them corresponding to a processor unit: Intel Core i7-87000K, 3.70 GHz.
3.2.1. Basic Time Evolving Scheme
The most straightforward problem we can define, containing the
core parts of the methodology, is one where we do not have the non-homogeneous contribution, we are under a ring domain where the boundaries are connected, hence they do not contribute to the problem, and the transport coefficient is constant. We will start by the second-order operator, showing how the Courant–Friedrichs–Lewy number appears even for this simple problem. Introducing the numerical discretization,
Now, there are two possibilities to derive the weights of the time-marching solution, each of them determined by which of the mathematical definition of the Green function we select: the Taylor series expansion or the closed expression. Starting from this last one, with the appropriate changes of variable we can recover,
where
is the Courant–Friedrichs–Lewy (CFL) number for the diffusive problem, also known as the diffusion number. As it can be expected, with the appropriate change of variables, i.e., centering the interpolation over the discretization point
, these weights are the same for the whole set of points and independent of
i. Hence, they can be pre-computed without affecting the iterative process. Yet, the higher this value is, the more important the boundary terms of the defining integral will be. Now, with the definition of these weights we see how the value of this number defines the width of the Green function as it appears as its standard deviation, hence a CFL lower than
will imply that the Gaussian is contained without being affected by the piecewise subdomains of validity.
If the time-evolved solution is also studied over the same grid points, i.e., we are interested only over the points
, therefore, we can simplify the integral as
, obtaining,
where
is the lower incomplete gamma function [
62],
is the usual Error function and
is the centered finite differences operator of order
, defined over a stencil of
at point
[
63]. Now this definition is exact and takes into account all the possible interactions with the boundaries of the piecewise domain of validity as the integral is performed over the analytical expression of the Green function. If, on the contrary, we use the Taylor series expansion of the Green function, we recover a similar expression,
With the resulting final expression of the time evolving solution defined as,
Comparing the results obtained from the two expressions of the Green function, we appreciate the effect the
number has on the computation of the solution and a perspective about the limit of the CFL different from its usual stability definition [
64]. We can see this comparison in
Figure 4, where the Logarithmic difference between the two possible weights is presented. Equation (
45) does not take into account the interaction between the boundaries of the domain of validity
and the Green function, resulting into a persistent error that will accumulate through time iterations. Furthermore, depending on the numerical scheme used, making the global error of the computed function divergent. Unfortunately, we cannot obtain a closed expression in general of the open domain Green function when we have a spatial dependent transport coefficient, therefore we will need to consider this limitation of the CFL in order not to introduce extra error into the time-evolving solution.
First-order operator follows the same logic we have introduced: the two possible expressions for the Green function are valid as long as the CFL number is bounded correctly. Yet, the fact that the first-order Green function behaves as a Dirac delta modifies the problem, breaking the integral (
40) in the following manner,
Which is the same expression we recover using the Taylor series expansion, being the usual CFL number. There are two details to point out, regarding this last expression:
The CFL number for a constant advection simply marks the frontier after which the integral term (
46) is zero, i.e., the information is propagated outside of the domain of validity, i.e., outside of the corresponding
.
In the case of non-constant advection the situation is more complicated, while the Green function is still a Dirac delta, its dependencies affects the integral, making it become a
simple layer integral [
65]. Therefore, using the exact, open domain Green function will produce a different result from the one obtained by the Taylor series, and their difference will be defined by the value of the CFL in a similar manner as in the second-order.
Having a non-constant transport coefficient will affect also to the Taylor series expansion, yet in a simpler manner: the values of
will be time and spatial dependent in general, yet evaluated at time frame
and at
,
On the other hand, using the exact Green function will have the transport coefficient evaluated at the advected point,
, therefore defining a new grid position that requires evaluation. Using this new grid position as the starting point for the propagation of the next time frame simplifies the
simple layer integral to the very same (
46) solution with the CFL number evaluated at those points, with the corresponding local grid step in its definition. This is the starting point for the well-known Roe-like or Gudonov-like numerical schemes for solving advective equations, often applied to the Euler equations and perturbations over them towards the Navier–Stokes system [
66]. Furthermore, in a similar manner, Lagrangian particle methods use this perspective of the information propagation to define the trajectories of their particles or grid points at which the rest of the solution is solved, see for example SPH methods [
16].
We present an example of this simple test case for the diffusive and advective problems, for which it is possible to obtain an analytic solution—as a matter of fact, from the integral scheme—defined over a ring for different stencils and CFLs.
In this basic form, the algorithm is equivalent to a piecewise homogeneously interpolated partial differential equation, i.e., a finite difference scheme. Moreover, combining this homogeneous discretization with the Taylor series definition of the Green function we recover a numerical scheme that is equivalent explicit Euler scheme, where the time derivative has been expanded up to the order marked by the stencil.
The initial condition chosen for this problem is a sine that will advect and diffuse at a
speed according to its frequency,
We will have then for the first-order equation a sine that travels through the ring periodically for the advection equation, and, for the diffusion equation a vanishing sine whose steady state is equal to 1/2.
The relative integrated error,
, between the exact solution, Equation (
48) and the one produced by the algorithm are presented for the advective and diffusive test cases on
Figure 5 and
Figure 6, respectively. This relative error is computed by numerically integrate the differences between the analytic and numerical solutions and refering it to the maximum value of the analytic solution at the corresponding time frame,
t.
We compare the performance of the algorithm for several stencil sizes, defined by the parameter q and different CFL numbers, that are selected by means of the total number of points of the grid, N in order to perform an equivalent time-evolving comparison. From these results we can extract the behavior of the linear propagation of the algorithm, showing a fast convergence for the stencil size and a well behaved time evolving error, where, once the numerical precision is reached for a certain stencil. Due to the pseudospectra of the exponential matrix, which will be an approximation of that of the linear operators, the error accumulates with each time iteration, yet it does at a logarithm rate, hence it can be assumed to be controlled and so, the algorithm will produce a solution consistent with the exact one.
As the advective problem is a displacing sine, the established solution will be periodic, hence the propagation of the error will keep going, as it can be seen in
Figure 5, even when it is the truncation error the one being propagated.
In the same perspective we can see that the influence of the CFL, as it is always kept low enough not to affect the stability of the solution, can only be appreciated for the diffusive problem, where the highest CFL (dashed lines) produce a significantly higher error than the rest while still remaining bounded. Moreover, the obtained solution improves due to the increase on number of points in the stencil, hence, the quality of each centered finite difference will increase as well, improving the final solution.
Although the computational performance of the algorithm and its optimization it is out of the scope of this work, the simulations performed to solve the diffusive and advective test cases took an order of magnitude of s per iteration for the highest order stencil, and of for .
3.2.2. Non-Constant Transport Coefficients
In the situation where the transport coefficient, , depends either on time or space we are forced to use the Taylor Series expansion of the Green function in order to introduce the correction terms, . We use as the correction term that include the initial condition of the Green function, i.e., the Dirac delta, while in the previous section we use capital to refer to the correction terms without being applied to the initial condition. While it might be possible to obtain a closed Green function expression for certain Transport Coefficients, and it might be useful to understand the behavior of the PDE under study, the general situation will require for the Taylor series expression.
Starting from the second-order operator, we can introduce into the time marching scheme the correction terms from the expansion, c.f. Equation (
30), in the following manner,
where we have introduced a
non-dimensional set of variables to recover the CFL number evaluated at point
, taking profit that in general, both physically and mathematically, the transport coefficient for a purely diffusive equation is different from zero (see some examples of exceptions for this rule in [
42]),
Recall that the while the correction terms are evaluated in the initial time frame as they are part of the Taylor series expansion of the Green function, they include also the temporal variation of the transport coefficient, that will be, in general, as small as the time step, making this term almost negligible under the short-time approximation.
As a result, the propagation of the unknown function due to the correction terms will be,
and, consequently, they can be introduced at the general scheme, c.f., Equation (
45), as additional terms at the propagation. Therefore, each time step the three derivatives
must be computed before the time propagation occurs. While originally these corrections were of order
, once the discretization appears this order of magnitude is piloted by both the CFL and the
operator. For a sufficiently small grid and a sufficiently well behaved unknown, as the
operator does not include the grid step in the definition we are using, the values produced by this operator will be of the order of its modulus of continuity [
67] or any other measure of its regularity. Even in a situation where it produces a jump of order of the unity, these corrections will be still dominated by the order of magnitude of the CFL and, more important, the variation of the transport coefficient, that again, if it is smooth enough will produce bounded and correspondingly small corrections. Moreover, in a situation where we had a study a discontinuous transport coefficient that produce at any
a jump on its derivatives, we could introduce analytically its variation at the moment we compute the integral, obtaining numerically controllable extra terms for each of the discontinuities introduced. We also point out that, if the transport coefficient
satisfies a diffusion equation being its own diffusion coefficient, the even correction term will be zero.
The final propagation of the unknown function, including the corrections, for a second-order operator with non-constant transport coefficients can be written as,
where the terms
will be, respectively, the odd and even correction terms, that will be composed of the derivatives of the transport coefficient evaluated at the point where we are computing the solution.
The correction terms for the first-order operator behave similarly, being piloted by the derivatives of the advection coefficient and the CFL number. Yet, as the transport coefficient of the first-order operator might be zero in some regions, we cannot choose
as the characteristic advection to make the expression
non-dimensional. We therefore select a value,
, that will be considered as representative of the order of magnitude of the advection coefficient, resulting in the following correction expression,
where we see again that the corrections will be zero if the advection coefficient satisfied the original PDE with a transport coefficient equal to itself, i.e., an inviscid Burgers equation. Under this non-dimensional grouping, the CFL is no longer a representation of
how far the information is advected locally at every
, nonetheless, it still preserves the measure of how much the Taylor series expansion differs from the exact solution and, therefore, the stability of the global numerical method as in its classical definition. The propagation of the unknown function due to the correction terms will be,
To which all the considerations regarding of their order of magnitude being related to the regularity of the function we introduced for the second-order operator are applicable. Despite being in general of low order of magnitude, as the presence of advective fronts that present steep slopes are common in mathematical modeling these corrections will be of higher importance than the diffusive ones. Moreover, being the first-order operator simpler to operate with, higher order corrections are easier to derive and implement too in case of such requirement.
We present an example of application for both an advective and a diffusive problem, with transport coefficients presenting steep variations so to highlight the correction terms. In particular, we choose the following transport coefficients,
and the following initial conditions:
so that the time evolving solutions are affected by transport effects of different orders of magnitude,
trapping the solution at the regions where the coefficients are close to zero.
We present in
Figure 7 and
Figure 8 the numerical solution of the test case together with the value of the propagated correction, that will follow the shape of the temporal evolution of the equation modulated by the correction terms.
We can confirm that, as we shown in
Section 2.3, the corrections hold the order
even at their most active region of space, allowing to neglect them depending the levels of accuracy desired for the solution and the particular problem. As a matter of fact, if the values of the transport coefficients are available in advanced, these corrections can be pre-calculated and incorporated into the Kernels without a penalization in the number of operations per iteration.
The computation of the corrections require for an additional (or several in the case of the diffusive ones) of the domain, hence increasing the number of memory accesses and operations of the algorithm, that will go in detriment of computational time. Nonetheless, thanks to parallelization it is possible to hold the order of magnitude, for the system of 6 cores we introduced at the beginning of the subsection, of s for iteration for a number of total grid points of the order of .
3.2.3. Non-Homogeneous Terms
Once we have defined and characterized the evolution of the initial condition of the problem through the numerical Green function, the next step is to add the propagation of the non-homogeneous terms,
into the time-evolving solution. To do so, we need to compute the double integral, see Equation (
13), that takes into account the propagation and variation of these terms through the time step
. While the spatial integral can be obtained in the same manner as we have already introduced, the temporal integral requires a numerical quadrature:
where we have used the same notation as we introduced for the Green functions to make explicit the time propagation between the time frame
and the final one
.
For first-order,
, we recover the equivalent Euler method presented in
Section 2.2: the weights will coincide with those of the initial condition causing both propagations—the initial condition and the non-homogeneous terms—be equivalent. Hence, we can group both terms, having an
extended initial condition for the problem that evolves in time.
Increasing the order of the quadrature will imply propagations towards and from time frames between
and
. Thus, requiring Runge–Kutta (RK) or
-like schemes [
63] that allow to decrease the error combining them. In particular, the definition of such such schemes over an operator previously split into two parts, a linear and a nonlinear one, is the starting point for the exponential integrators, a family of numerical methods we introduced in
Section 1, see for example [
20,
68] and the references within.
Their difficulty lies precisely in the split of the operator: while only the integral requires to be approximated, in order to obtain the value of the nonlinear term at each of the intermediate s steps of the method we will need to propagate the whole solution towards them first. Moreover, once the non-homogeneous function is computed at those intermediate steps, the propagation towards must be done using a Green function that starts at these points, i.e., its transport coefficients and CFLs must be evaluated at these intermediate time frames and the two states for the Green function (the initial and final ones) must be defined accordingly. The control and reduction of the quadrature errors under these operators will require for adapted versions of Butcher tableau and the coefficients for high-order methods might not coincide with the classical ones.
For the explorative phase presented on this work we will limit ourselves to the midpoint method for the quadrature, that will serve also as an example of the implementation of these methods over the integral scheme, leaving the fourth-order equivalent Runge–Kutta and its adaptive versions for future works. Following the usual steps for the RK methods.
where we see that, while the number of operations is doubled as two time propagations are required for each time step, the methodology will be highly simplified for a constant transport coefficient (or one that produce negligible corrective terms). Indeed, in this situation the Green function will only depend on the time frame explicitly, allowing for the weights to be precomputed, leaving only the value of the local transport coefficient
to be updated.
Recall that the RK methodology is only applied to solve the integral for the nonlinear terms, leaving the Taylor series expansion of the Green function as the usual extrapolation in time from the initial value. Yet, any multi-step technique can be applied too at the level of the general expression of the Green function, allowing to combine its error and step definition with the nonlinear integrals with a non-negligible level of complexity. This study ties again with the advances on exponential integrators and time-propagating solutions, and its in-depth analysis is left as a future line of research.
To show the performance of the midpoint adapted scheme and the wide range of possibilities for nonlinear terms, we present two test-cases: a nonlinear advection-diffusion equation where the norm must be conserved, and an equation with a soliton-like solution.
The first test case is the diffusive or viscid Burgers Equation [
49], defined under a ring domain so there is no injection or destruction of information from the boundaries. Defining the PDE by means of its information current [
69],
, we can show that its norm,
is conserved,
Therefore, we impose as an initial condition a normalized Gaussian that will evolve under the usual Burgers shock-like tendency: the higher values of the unknown function will advect as much as the value of the unknown function while the almost zero regions will remain still, grouping them into a front. This case is specially delicate as we are using a purely diffusive Green function, implementing the nonlinear advection through the term. There are two main advantages of using such Green function: there is no correction terms as the viscosity, i.e., the diffusive transport coefficient, is constant, and we can introduce any extra forcing terms into the problem without modifying the weights of the numerical scheme.
The typical
shock-like evolution of the Burgers equation is shown clearly in
Figure 9, where we also compare whether the numerical the numerical norm is conserved or not. To contrast the order of magnitude of the approximation we obtain the error between norms: the analytical (that for this example is equal to one) and the numerical one. Additionally, we take profit to compare how this error is altered by the inclusion of the RK scheme, showing a clear improvement of the order of magnitude when activating the scheme. Yet, as the error of the norm was already low enough, the duplication of the computational cost to reach these levels of accuracy must be a compromise when applying the methodology. Regarding the aforementioned computational cost of implementing the RK scheme, it will always be a compromise between how much the time grid can be increased, hence, saving a substantial number of iterations, versus the time spent in evaluating twice the domain for the half step and the final propagation. In the example of the Burgers equation, the order of magnitude for one iteration doubles or, depending whether we need to compute the corrections for a variable transport coefficient or not, it might quadruply.
For the soliton-like solution we select the nonlinear Schrödinger equation, that for an elastic potential presents a traveling wave solution, see [
70]. To solve the wave function using the Green function scheme we have two possible paths: or we separate the nonlinear equation in its real and imaginary contributions, deriving two coupled diffusive equations to be solved or we use the closed definition of the Green function and introduce the imaginary diffusion before the discretization. As we want to show the capability of the scheme to hold the soliton solution, we select the first option, considering the numerical solution of the two equations—the real and the imaginary parts of the wave function—more challenging: two independent contributions of error will arise from their solution, affecting the required balance between functions to form the soliton. Operating with the nonlinear Schrödinger Equation [
71] we recover,
where we have introduced already the initial condition that produces the traveling wave solution,
. Furthermore, the parameters
are the standard parameters for soliton solutions as described in [
70].
Hence, we have a crossed diffusion problem, where real part diffuses towards the imaginary one and vice versa, producing the pulsating behavior of the equation. Moreover, we have a production term due to the potential
that will inject or destroy information into the time evolution of the problem depending on the modulus of the wave function, controlling the growth and the norm of its evolution. These production terms are also found on chemical advection-diffusion-reaction equations and, due to their high variability in time and their control over some of the conserved quantities of the problem tend to be cumbersome to deal with, see [
72].
Additionally, for the nonlinear Schrödinger equation, the energy of the system must be also a conserved quantity according to Noether’s theorems [
70], as a result we will have, apart from the general shape of the function, two numerical magnitudes that will serve as indicators of the quality of the time propagation scheme,
where the primes over the grid step indicate that the first and last points are multiplied only by half
.
We present in
Figure 10 the temporal evolution of the wave function, the real and imaginary parts of which oscillate measured with each other in order to produce the same soliton envelope as its modulus. It is important to recall that, for imaginary diffusion the standard choices for to the numerical parameters are no longer applicable as the Green function is no longer a Gaussian. Nonetheless, we can still take profit of the Taylor series expansion to
avoid this problematic and hold the same methodology we have introduced up to now. The only affectation will be at the CFL and the stability, indeed, if we look back at Equation (
60) the diffusion is now imaginary, and one component diffuses into the other and viceversa. This is why we need to go to time steps as low as
to achieve a reasonable order of magnitude over the error of the conserved magnitudes, therefore increasing the computational cost of the whole simulation. While the order of magnitude of one time step is still the same as the one of the previous subsections, i.e.,
for high order stencils and
, to reach a dimensional time where we can appreciate the evolution of the initial condition we require several order of magnitude of iterations.
This is why the RK scheme for this application is critical as it allow to reduce significantly the number of iterations, up to two orders of magnitude according to the numerical experiments performed. In fact, for the parameters presented in
Figure 11 the norm of the soliton was not conserved after a hundred iterations, producing an error of the order of the unknown function and losing the properties of the soliton as the traveling wave solution of the problem.
With these two test cases we have shown the performance of the RK scheme and how the nonlinear terms contribute to the solution, and more importantly, can be used effectively as a general term where to introduce the parts of the equation that are not the quasilinear operator that defines the Green function.
3.2.4. Boundary Conditions
The last contribution to the integral scheme is due to the boundary conditions, presenting a structure similar to the nonlinear terms: an integral through the time step of a propagated quantity. Yet, the quantity being propagated is of a discrete, source-like nature, breaking, so to speak, the usual integral form of the convolution.
For this exploratory study, we focus mainly on the second-order equation, utilizing the method of images [
53], which serves as a foundational approach for further development. Consistent with this work, we operate under the short-time approximation, allowing us to separate the domain of study into two distinct regions, each with different Green functions: the inner domain, where both the theoretical and numerical frameworks we have presented hold, and the boundary region, where boundary effects influence both the theoretical (modifying the Green function expression) and numerical levels (requiring an optimized point distribution to mitigate interpolation errors). Thus, modifications are required at three levels within the algorithm: the expression of
across all three propagation terms, adjustments to the Lagrange-like interpolation weights due to the altered discrete points, and the contribution of the boundary integral term.
The first modification is rather straightforward since, for the second-order operator, the boundary
reflects the Green function accordingly in order to satisfy the equivalent homogeneous boundary condition, see
Figure 2. Furthermore, this reflection applies to both the closed expression of the Gaussian, c.f. expression (
31), and the Taylor series expansion, with some precautions regarding the value of the diffusion coefficient. In general, if the transport coefficient is not constant, it will affect the expression of the Green function and the way the reflection occurs over the boundary as this coefficient will define the Eigenfunctions for the semi-open space of the approximated Green function, therefore, the affectation over the whole problem will be not negligible. Nonetheless, once again we take profit of both the short-time approximation and the perspective on how the Green function works as a transition probability to overcome this difficulty. In an abstract manner, we can think that the solution at future state
as the sum of independent contributions from the past states,
being each of them defined by the Green function, that must be, at first-order, a Gaussian. Moreover, for each of the points
in the future state, its solution will be propagated by a Gaussian-like Green function with its diffusion coefficient evaluated at this very same point
. Hence, from this perspective we can assume that each of the points
will have their own Gaussian-like Green function and, accordingly, their reflection to satisfy the homogeneous boundary condition that is required. Writing the reflected Green function in terms of the Taylor series expansion we recover,
where
is the position of the boundary and the ± signs correspond, respectively, to the Dirichlet and Neumann homogeneous boundary conditions at the points.
From this perspective, we can therefore define the length of the boundary region by means of the support of the reflected Green function, that, being a Gaussian-like function, will depend on the number of standard deviations, i.e., we want to consider. Moreover, this distance will be dependent of the value of the diffusion at the boundary , that might vary with time.
Following the same methodology as before, the next step is to integrate the Green function times the Lagrange polynomial over the domain of validity. In particular, for the numerical boundary region the integration is performed through the last stencils of the domain that include modified points to attenuate the error by means of the scheme presented in
Section 3.1. As a result, the last stencil has a wider domain of validity,
, therefore, the integral will produce all the weights for the last stencil. Changing the points of the stencil will produce a different integral, and therefore, different weights than those computed in Equation (
45). Consequently, the last point
at which the weights are altered will be that defining the limit of the
numerical boundary region. Hence, we can select the last
points as this limit.
Matching both numerical and analytical regions, we find a specific CFL number for the boundaries, or
outer CFL, that will indicate how much of the reflected Gaussian interact with the inner boundary of
:
As the standard CFL is defined over one single grid step, , the outer CFL will in general be smaller than the inner one. Nevertheless, as there is no analytical solution for the grid distribution, this condition must be verified, specially for lower stencils.
One interesting consequence of using a piecewise interpolation together with the Green function is that, developing the integral as in Equation (
42) for the last domain of validity,
, we obtain,
where we have left explicit the error of the interpolation,
, as defined in (
37). As we can see, the error at the boundary will be mitigated by the Green function, the more, the lower the value
is.
The weights over the boundary points,
will be therefore case-dependent for each stencil and their closed expression must be pre-computed for every pair of values of
N and
q before the simulation is performed. Yet, they can still be defined in terms of Finite Difference operators. Indeed, for the non-reflected term, i.e., the one that contains the
in expression (
62), we recover,
where the
operator is still the centered finite difference operator, yet defined over the last
points of the domain with the last half
q points non-homogeneously distributed. Thus, it will produce different coefficients for different values of
q. Furthermore, the hat indicates that each of the local grid steps,
have been non-dimensionalized by the homogeneous
in order to recover the same CFL number than we have on the other terms. The
operator corresponds to the de-centered finite difference operator, defined over
points and de-centered a number of points equal to
. These coefficients can be computed using the well-known Fornberg algorithm for the computation of finite differences [
73], recalling that their grid step must be divided by the homogeneous
before implementing them into the numerical scheme.
The reflection, on the other hand, only affects the boundary point,
, as the rest of the discrete reflections will remain outside of the domain of integration, i.e.,
. This effect can be understood looking back at
Figure 2, where we can identify the colored Gaussian as the explicit expression of the Green function and the Delta in its center can be seen as the Taylor series expansion of the Green function. Hence, while the reflection activates since the beginning of the boundary domain, the delta term only appears at the final value of the boundary point, imposing or codifying the Green function homogeneous condition over it. As a result, for the Dirichlet boundary condition, all the weights will be canceled at
and in the Neumann boundary the weights will be doubled. Furthermore, this effect will be also transmitted at the non-homogeneous terms through the Green function, causing their propagation to also satisfy the homogeneous boundary condition.
We present two homogeneous examples in
Figure 12 and
Figure 13, with constant and variable diffusive coefficients, respectively. To recover these solutions, it is enough to follow the standard methodology we have introduced through this work, adding at the initial and last points the contribution of the reflection over the Green function, i.e., using the weights from (
65) doubled at the Neumann Boundary point and of a null value for the Dirichlet one. Even in the situation of the time evolving and spatially variable diffusion coefficient, the scheme will include the weights for each of the propagation towards the boundary. While we will require to introduce the correction terms for the weights, specially to take into account for the temporal variation correction, the algorithm will still hold its simple shape: propagating the information from the stencil points towards the future value, regardless of whether we reach the end of the domain or not.
Finally, the last contribution of the boundary at the numerical scheme is its boundary term, that can be extracted from Equation (
9). For the Dirichlet problem, its expression is rather straightforward as it is the only term that can affect the value of the unknown function at the boundary,
as the rest are null at
. Therefore, it must be equal to
, which is what we also recover analytically by developing the integral, i.e., deriving the Dirichlet Green function and applying it to the discretization of the unknown function at that point. This is why most of the numerical algorithms impose directly the Dirichlet boundary condition successfully without any extra regard on the affectation of the boundary over the rest of the domain. The Neumann boundary condition is also straightforward: all the terms of the integral disappear, leaving only the following,
where
is the usual flux or derivative imposed at the boundary for the unknown function. Hence, this term can be seen as the propagation of the flux that is injected to or extracted from the domain, which can be abstractly thought also as a discrete nonlinear term production/destruction term of the problem.
Finally, in
Figure 14 we present an example where we use all three boundary contributions and required modifications to implement them into the scheme. In other words, we solve a Heat transfer equation with a space-dependent diffusion coefficient in the shape of a well in order to define clearly different regions of characteristic diffusion, and so, different heat propagation speeds. Furthermore, we set two boundary conditions: one time-evolving that increases the temperature of the left region of the domain up to a certain value progressively and another one at the left that serves as heat sink, i.e., a Dirichlet homogeneous condition. In particular, we select the following temperature law to heat the non-homogeneous boundary:
Therefore, heat will take more time to evolve away from the domain, increasing the value of the temperature at the left-hand side more together with its slope or heat flux until it reaches the maximum possible. Regardless of the physical interpretation of this simple example, we have shown how to impose boundary conditions in an efficient manner and consistent with the chosen optimized discretization. Therefore, the explorative analysis of the method successfully achieves its first milestone: the definition of a consistent numerical algorithm that can be derived from the Green function of the problem.
This scheme sets the path for a wide range of possible boundaries to be imposed regardless of the problem we are dealing with as long as the boundary conditions are consistent with the order the Green function. In addition, as the contribution of the non-homogeneous terms and the boundaries are independent from the main propagation, we have shown that only the last point (or the last line or surface, deepening on which kind of boundary is under study) will be enough to deploy any kind of boundary law.
Finally, we point out that our results align, from a humble numerical perspective, with the efforts being performed to obtain a precise definition of boundaries from the perspective of Quantum Field Theory [
74,
75]. The most straightforward relation is the definition of boundary conditions as a discrete Dirac delta set at the boundary, from which they recover the Neumann term (two times the diffusion coefficient) in a more theoretically profound manner. Indeed, we can think of the boundary term that we have obtained as a non-homogeneous term, which by means of a Dirac delta,
, breaks the volumetric integral and transforms it into a surface, line, or point.
With this idea in mind, we could explore the possibility of defining internal boundary conditions, with the problem being that the stencils pointing towards them will be de-centered automatically. Moreover, if this internal boundary evolves in time, we will need to update all polynomial coefficients and stencils at every iteration. This may result in an arduous mathematical and numerical task, yet in line with applications intended for the particle or Lagrangian methodologies to solve PDEs [
24].