# Exploratory Study of a Green Function Based Solver for Nonlinear Partial Differential Equations
## 3 Numerical Implementation
### The Numerical Transposition of the Integral Scheme
#### 3.2.4 Boundary Conditions
From this perspective, we can therefore define the length of the _physical_ 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., \(\sqrt{\tau a_{2}}\) we want to consider. Moreover, this distance will be dependent of the value of the diffusion at the boundary \(a_{2}(x_{b},t)\), 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, \(\Omega_{\text{M}}\), 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 \(x_{i}\) at which the weights are altered will be that defining the limit of the _numerical_ boundary region. Hence, we can select the last \(2q+1\) points as this limit. Figure 11: Evolution of the relative error of the conserved magnitudes, norm and energy, of the soliton solution of the nonlinear Schödinger equation. Only the solution with the RK scheme is presented as for this set of parameters, not using it imply errors of order one in the norm. 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 \(\Omega_{M}\):  
\[\Pi_{b,2}=\frac{a_{2}(x_{b})\tau}{\Omega_{M}}. \tag{63}\]  
As the standard CFL is defined over one single grid step, \(\Delta x\), 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, \(\Omega_{M}\), we obtain,  
\[u(x,t_{0}+\tau)=\] \[\sum_{j=-q}^{q}u(x_{M+k}t_{0})\int_{y_{M}}^{1}\mathcal{G}_{2,sOD} \big{(}x-x^{\prime},\tau\big{)}\big{[}l_{j}(x^{\prime}-x_{M})+R\big{(}x^{\prime },q,\Omega_{M}\big{)}\big{]}dx^{\prime}, \tag{64}\] \[\forall x\in[y_{M},1]\]  
where we have left explicit the error of the interpolation, \(R(x^{\prime},q,\Omega_{M})\), 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 \(\Pi_{b,2}\) is. The weights over the boundary points, \(2q+1\) 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 \(\delta(x-x^{\prime})\) in expression (62), we recover,  
\[u(x_{i},t+\tau)=u(x,t_{0})+ \begin{cases}\sum_{k=1}^{q}\frac{(2k)!}{k!}\Pi_{2}^ {2k}\delta_{2q+1}^{2k}[u](x=x_{i}),\ \ \forall x_{i}\ /\ i\in[M-q+1,M]\\ \sum_{k=1}^{q}\frac{(2k)!}{k!}\Pi_{2}^{2k}\delta_{2q+1,i-M}^{2k}[u](x=x_{i}), \ \ \forall x_{i}\ /\ i\in[M+1,N]\end{cases} , \tag{65}\]  
where the \(\delta_{2q+1}^{2k}[. ]\) operator is still the centered finite difference operator, yet defined over the last \(2q+1\) 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, \(\Delta x_{i}\) have been non-dimensionalized by the homogeneous \(\Delta x\) in order to recover the same CFL number than we have on the other terms. The \(\delta_{2q+1;i-M}^{2k}[.