Skip to content
QFT.org

Search QFT.org

Enter a word or phrase.

    You can also browse the main navigation and chapter contents.

    Resolving Thin Boundary Layers with Learned Solvers

    A field can have an accurately predicted integral while its boundary layer is poorly resolved. A neural solver can also report a small residual loss because its quadrature misses structure between training points. These are different errors, and neither is diagnosed by the optimizer's success flag alone.

    We study a static scalar response with an exact solution, decrease its boundary-layer width, and compare a global network, residual-driven quadrature and overlapping local networks. The retained calculation includes an especially instructive failure: local input normalization produces a small training loss without a comparably small physical residual. Conventional sine-Galerkin solutions provide a separate resolution control.

    Preparation: Residual neural solvers introduce equation losses and boundary conditions. Elliptic field solvers explain coercivity and the distinction between algebraic and continuum error.

    A narrow layer in a well-posed field equation

    Consider the positive static equation

    −κd2ϕdX2+m2ϕ=J,ϕ(0)=ϕ(L)=0,κ,m2>0.(1)-\kappa\frac{d^2\phi}{dX^2}+m^2\phi=J, \qquad \phi(0)=\phi(L)=0, \qquad \kappa,m^2>0. \tag{1}

    Here JJ is a constant source. This is a static or Euclidean response problem, not a retarded Green-function prescription. For J≠0J\ne0, define x=X/Lx=X/L, u=m2ϕ/Ju=m^2\phi/J and ϵ=κ/(mL)\epsilon=\sqrt\kappa/(mL). Then

    Lϵu=−ϵ2u′′+u=1,u(0)=u(1)=0.(2)\mathcal L_\epsilon u=-\epsilon^2u''+u=1, \qquad u(0)=u(1)=0. \tag{2}

    The reaction term favors u=1u=1 in the interior; the boundary values force transitions of width O(ϵ)O(\epsilon). Solving the constant-coefficient equation gives

    u(x)=1−cosh⁡[(x−1/2)/ϵ]cosh⁡[1/(2ϵ)],R(ϵ)=∫01u(x) dx=1−2ϵtanh⁡12ϵ.(3)\begin{aligned} u(x)&=1-\frac{\cosh[(x-1/2)/\epsilon]}{\cosh[1/(2\epsilon)]},\\ R(\epsilon)&=\int_0^1u(x)\,dx =1-2\epsilon\tanh\frac1{2\epsilon}. \end{aligned} \tag{3}

    For small ϵ\epsilon, the equivalent expression

    u(x)=(1−e−x/ϵ)(1−e−(1−x)/ϵ)1+e−1/ϵ(4)u(x)=\frac{(1-e^{-x/\epsilon})(1-e^{-(1-x)/\epsilon})}{1+e^{-1/\epsilon}} \tag{4}

    avoids forming large hyperbolic functions; expm1 evaluates the small differences near the endpoints. The dimensional integrated response is ∫ϕ dX/J=LR/m2\int\phi\,dX/J=LR/m^2.

    The small parameter does not make this inverse singular in L2L^2. With zero Dirichlet values, its eigenvalues are 1+ϵ2n2π21+\epsilon^2n^2\pi^2, so

    ∥Lϵ−1∥L2→L2=11+ϵ2π2≤1.(5)\|\mathcal L_\epsilon^{-1}\|_{L^2\to L^2} =\frac1{1+\epsilon^2\pi^2}\le1. \tag{5}

    Nevertheless, u′(0)=ϵ−1tanh⁡[1/(2ϵ)]u'(0)=\epsilon^{-1}\tanh[1/(2\epsilon)] grows, the limiting differential equation loses its second derivative, and the outer solution cannot satisfy both boundary values. This is a singularly perturbed boundary problem. “Stiffness” here refers to its separated spatial scales and their numerical representation, not an unbounded L2L^2 response. At a finite spectral cutoff the ratio of the largest and smallest differential eigenvalues also depends on that cutoff; it should not be confused with conditioning of the neural parameter optimization.

    Coefficient-dependent optimization failures in PDE residual training are documented by Krishnapriyan et al., §§3.2, 4.1 and 5.1. Their examples motivate diagnostics; they do not prove which mechanism limits the particular fits below.

    What a residual can certify

    Let vv satisfy the same endpoint conditions and have square-integrable second derivative. Define the error e=v−ue=v-u and physical residual r=Lϵv−1r=\mathcal L_\epsilon v-1. Integration by parts has no boundary contribution and gives

    ∥e∥ϵ2:=ϵ2∥e′∥22+∥e∥22=⟨e,r⟩.(6)\|e\|_\epsilon^2 :=\epsilon^2\|e'\|_2^2+\|e\|_2^2 =\langle e,r\rangle. \tag{6}

    The Dirichlet Poincaré inequality implies ∥e∥ϵ2≥λ1∥e∥22\|e\|_\epsilon^2\ge\lambda_1\|e\|_2^2, where λ1=1+ϵ2π2\lambda_1=1+\epsilon^2\pi^2. Cauchy–Schwarz therefore yields

    ∥e∥2≤∥r∥2λ1,∥e∥ϵ≤∥r∥2λ1.(7)\|e\|_2\le\frac{\|r\|_2}{\lambda_1}, \qquad \|e\|_\epsilon\le\frac{\|r\|_2}{\sqrt{\lambda_1}}. \tag{7}

    These are statements about the continuous residual norm. Replacing its integral by training samples introduces another approximation. Even the signed response error ∫e\int e can be small through cancellation while ∥e∥2\|e\|_2 is appreciable. Nonzero endpoint errors require a boundary lifting before applying (7); they cannot be ignored because the interior residual happens to vanish.

    A useful diagnostic resolves the residual into

    r=d+a,d=−ϵ2v′′,a=v−1,∥r∥22=∥d∥22+∥a∥22+2⟨d,a⟩.(8)r=d+a, \qquad d=-\epsilon^2v'',\qquad a=v-1, \qquad \|r\|_2^2=\|d\|_2^2+\|a\|_2^2+2\langle d,a\rangle. \tag{8}

    The diffusion and reaction contributions cancel in the exact layer. A loss that drops either contribution or silently changes its weight solves a different problem. The companion records these norms and their cross term, as well as the total residual. It also projects ee onto the first 128 normalized sine modes and records the norm in modes 33–128. That finite band diagnoses some fine structure; it is not the entire omitted high-frequency tail.

    Global and overlapping trial functions

    Write a one-hidden-layer block as

    nθ(z)=c+∑j=1hajtanh⁡(wjz+bj).(9)n_\theta(z)=c+\sum_{j=1}^{h}a_j\tanh(w_jz+b_j). \tag{9}

    The global ansatz uses h=24h=24 and v=x(1−x)nθ(2x−1)v=x(1-x)n_\theta(2x-1), giving 73 parameters and exact endpoint values. The factor's derivatives must remain in v′′v''.

    To test local coordinates separately, define δ=min⁡(1/4,4ϵ)\delta=\min(1/4,4\epsilon) and the constant-extended smoothstep

    s(t)={0,t≤0,10t3−15t4+6t5,0<t<1,1,t≥1.(10)s(t)= \begin{cases} 0,&t\le0,\\ 10t^3-15t^4+6t^5,&0<t<1,\\ 1,&t\ge1. \end{cases} \tag{10}

    Its first two derivatives vanish at both joins. Let χL=1−s(x/δ)\chi_L=1-s(x/\delta), χR=1−s((1−x)/δ)\chi_R=1-s((1-x)/\delta) and χC=1−χL−χR\chi_C=1-\chi_L-\chi_R. Three width 8 blocks, totaling 75 parameters, give

    v=χLxδnL(zL)+χCnC(2x−1)+χR1−xδnR(zR).(11)v=\chi_L\frac{x}{\delta}n_L(z_L) +\chi_C n_C(2x-1) +\chi_R\frac{1-x}{\delta}n_R(z_R). \tag{11}

    The windows sum to one and the field is C2C^2. Its endpoints vanish exactly. These are overlapping contributions to one field; they are not disconnected problems with independently chosen interface values.

    Two coordinate choices distinguish the effect of local normalization:

    CoordinatesLeft input zLz_LRight input zRz_R
    Global2x−12x-12(1−x)−12(1-x)-1
    Local2x/δ−12x/\delta-12(1−x)/δ−12(1-x)/\delta-1

    For a generic contribution f(x)n(z(x))f(x)n(z(x)) with affine zz, the necessary second derivative is

    d2dx2[fn(z)]=f′′n+2f′z′nz+f(z′)2nzz.(12)\frac{d^2}{dx^2}[fn(z)] =f''n+2f'z'n_z+f(z')^2n_{zz}. \tag{12}

    Thus the local diffusion term includes the scale ϵ2/δ2\epsilon^2/\delta^2 and all window derivatives. Omitting those factors would artificially reduce the training loss. Smooth overlapping subnetworks and local input normalization are central ideas in Moseley, Markham and Nissen-Meyer, §§4.1–4.2, Eqs. (12)–(14). Equation (11) is our explicit quintic-window construction with simultaneous optimization, not a reproduction of their training schedule.

    Changing points without changing the measure

    All methods minimize the quadrature loss

    LQ(θ)=12∑i=164wirθ(xi)2,∑iwi=1.(13)\mathcal L_Q(\theta)=\frac12\sum_{i=1}^{64}w_i r_\theta(x_i)^2, \qquad \sum_iw_i=1. \tag{13}

    The fixed rule uses four Gauss–Legendre points in each of 16 equal panels. The adaptive global method begins with the same rule. Between stages it evaluates 1024 uniformly spaced candidate midpoints and computes each panel's RMS residual tjt_j. Its allocation score is tj+0.05tˉt_j+0.05\bar t. Two points per panel are guaranteed, and 32 additional points are allocated proportionally, rounding by largest remainder with panel-index tie breaking. If every residual vanishes, allocation is uniform.

    Each panel then receives its own Gauss rule, with weights scaled by the physical panel length. The rule still approximates ∫01r2dx\int_0^1r^2dx; moving more equally weighted points into a layer would instead alter the empirical measure. The allocation is fixed during each optimization stage. This procedure has two adaptations, not an unbounded refinement loop or a guarantee that every sharp feature is detected.

    Fixed-budget results and a failed loss diagnostic

    The study uses four values of ϵ\epsilon, two initializations and the four methods above: 32 fits. All receive three warm-started L-BFGS-B stages, each limited to 200 iterations and 1000 actual objective/gradient calls. Fixed-rule methods also restart between stages. The parameter-gradient tolerance is 10−910^{-9}, relative function tolerance 10−1310^{-13}; an independent final-gradient target of 10−710^{-7} is reported separately. Global fixed/adaptive initial parameters are paired, as are the two domain variants.

    Validation uses 32 panels with 16 Gauss points each, then 32 points per panel, independent of training. It also checks 4097 uniformly spaced field/residual values. The following are the finer-quadrature results at ϵ=0.025\epsilon=0.025; both starts are retained.

    MethodStartField L2L^2 errorSigned response errorPhysical residual norm
    Global, fixed03.81×10−43.81\times10^{-4}−2.11×10−6-2.11\times10^{-6}1.65×10−31.65\times10^{-3}
    Global, fixed12.76×10−42.76\times10^{-4}5.50×10−65.50\times10^{-6}1.95×10−31.95\times10^{-3}
    Global, adaptive03.46×10−43.46\times10^{-4}−2.64×10−8-2.64\times10^{-8}1.01×10−31.01\times10^{-3}
    Global, adaptive13.04×10−43.04\times10^{-4}−4.46×10−6-4.46\times10^{-6}1.23×10−31.23\times10^{-3}
    Domains, global01.30×10−31.30\times10^{-3}−5.04×10−5-5.04\times10^{-5}5.19×10−35.19\times10^{-3}
    Domains, global12.70×10−32.70\times10^{-3}−1.24×10−4-1.24\times10^{-4}7.27×10−37.27\times10^{-3}
    Domains, local04.99×10−34.99\times10^{-3}2.11×10−32.11\times10^{-3}2.40×10−22.40\times10^{-2}
    Domains, local15.82×10−35.82\times10^{-3}2.24×10−32.24\times10^{-3}2.83×10−22.83\times10^{-2}

    Local coordinates do not win this experiment. In particular, local/start 0 reaches training loss 2.46×10−102.46\times10^{-10} and gradient infinity norm 3.56×10−83.56\times10^{-8}, yet its independent residual norm is 0.02400.0240. The sampled training norm is only 2LQ=2.22×10−5\sqrt{2\mathcal L_Q}=2.22\times10^{-5}. This discrepancy establishes that training quadrature and independent physical validation measure very different residuals for that state.

    Both initializations of four neural methods across boundary-layer widths, and a comparison of training and independently integrated residual norms.

    Left: field errors as the layer narrows; solid and dashed curves denote the two fixed initializations. Right: all 32 training residual norms compared with independent 1024-point physical norms. Points above the equality line expose quadrature underestimation. The local-domain failures remain in the plot.

    Across all runs, 80 of 96 stages hit their iteration cap and only 6 of 32 final states meet the separate gradient target. There is no numerical retry. The largest 512-to-1024-point change in field L2L^2 error is 1.40×10−81.40\times10^{-8}; the largest change in residual norm is 3.49×10−53.49\times10^{-5}, in a narrow local-domain result. Those empirical changes are retained, not converted into rigorous quadrature error bars. No violation of (7) is observed with the evaluated finer norms, but floating-point quadrature is not an interval-certified evaluation of its hypotheses.

    A conventional calculation resolves the same problem in normalized odd sine modes. At ϵ=0.025\epsilon=0.025, its absolute response errors for 32, 128, 256 and 512 odd modes are, respectively, 8.16×10−58.16\times10^{-5}, 1.30×10−61.30\times10^{-6}, 1.63×10−71.63\times10^{-7} and 2.04×10−82.04\times10^{-8}. The reduced-basis article derives an independent positive tail bound. These modes solve a linear Galerkin system; their count is not an equal-cost substitute for network parameters or optimizer calls.

    The accompanying multiscale_study.py retains parameters, all stage stops, candidate-point work and validation. solver_surrogate_checks.py checks spatial and parameter derivatives against finite differences, window derivatives against an independently differentiated polynomial, and quadrature counts and weights. These checks establish that the intended trial functions were evaluated; the field and residual comparisons establish how well the fitted functions solve this example.

    A width ϵ\epsilon in this static boundary problem makes spatial resolution expensive. A time step never entered its equation. For a wave packet propagated on a grid, compare the phase of two time integrators while holding that grid fixed. Repeating the evolution on a finer grid then tests a separate spatial error.

    Summary

    Narrow features require a resolved representation, a correctly differentiated coordinate map and a sufficiently accurate residual measure. Hard boundary conditions make a coercive residual estimate available, but a training-point loss is not automatically that estimate. Local networks and adaptive quadrature are useful constructions whose benefit must be demonstrated under the actual budget. Compare field error, response error, independently integrated residual and conventional refinement before attributing success to a small optimization loss.

    Exercises

    1. An accurate outer response with incorrect boundary values

    Derive the scaling from (1) to (2), and compare the outer approximation v=1v=1 with the exact field as ϵ→0\epsilon\to0. Find its boundary error, response error and exact squared L2L^2 error. Why does its zero interior residual not imply (7) with zero error?

    Solution

    Since d/dX=L−1d/dxd/dX=L^{-1}d/dx and ϕ=Ju/m2\phi=Ju/m^2, division of (1) by JJ gives −κu′′/(m2L2)+u=1-\kappa u''/(m^2L^2)+u=1. Hence ϵ2=κ/(m2L2)\epsilon^2=\kappa/(m^2L^2). The dimensional integrated response is LR/m2LR/m^2.

    Let a=1/(2ϵ)a=1/(2\epsilon). The error is e=1−u=cosh⁡[(x−1/2)/ϵ]/cosh⁡ae=1-u=\cosh[(x-1/2)/\epsilon]/\cosh a. It equals one at both boundaries, while

    ∫01e dx=2ϵtanh⁡a.\int_0^1e\,dx=2\epsilon\tanh a.

    Using cosh⁡2t=(1+cosh⁡2t)/2\cosh^2t=(1+\cosh2t)/2 gives

    ∥e∥22=ϵtanh⁡a+12sech⁡2a.\|e\|_2^2 =\epsilon\tanh a+\frac12\operatorname{sech}^2a.

    Thus the response error is asymptotic to 2ϵ2\epsilon, the field norm to ϵ\sqrt\epsilon, and the boundary maximum remains one. The layer slope is u′(0)=tanh⁡a/ϵu'(0)=\tanh a/\epsilon. Although Lϵe=0\mathcal L_\epsilon e=0 in the interior, ee does not belong to the zero-boundary domain used in the integration-by-parts proof. The omitted boundary term supplies the nonzero energy. An interior residual alone has discarded the boundary data.

    2. A collocation loss and an integral that both miss an error

    On the midpoint grid xj=(j+1/2)/Nx_j=(j+1/2)/N, add e(x)=Asin⁡(2πNx)e(x)=A\sin(2\pi Nx) to the exact solution. Show that the sampled residual and signed response error vanish, although the field error does not. Evaluate the norms for N=64N=64, A=0.01A=0.01 and ϵ=0.025\epsilon=0.025.

    Solution

    The sine vanishes at both endpoints and every midpoint because 2πNxj=2πj+π2\pi Nx_j=2\pi j+\pi. Since it is an eigenfunction,

    Lϵe=[1+ϵ2(2πN)2]e.\mathcal L_\epsilon e =[1+\epsilon^2(2\pi N)^2]e.

    The sampled residual therefore vanishes too. Its integral is zero over an integer number of periods, so the response is unchanged. However,

    ∥e∥2=∣A∣2,∥Lϵe∥2=∣A∣2[1+ϵ2(2πN)2].\|e\|_2=\frac{|A|}{\sqrt2}, \qquad \|\mathcal L_\epsilon e\|_2 =\frac{|A|}{\sqrt2}[1+\epsilon^2(2\pi N)^2].

    The specified field norm is 0.007071070.00707107 and the residual norm is 0.7217070.721707. Direct floating-point sampling leaves a residual maximum about 4.1×10−144.1\times10^{-14} rather than mathematical zero. The continuous inequality (7) is intact; substituting an unresolved sampled norm would be the error. This negative control uses midpoint nodes and is separate from the production Gauss rules.

    References

    • A. S. Krishnapriyan, A. Gholami, S. Zhe, R. M. Kirby and M. W. Mahoney, “Characterizing possible failure modes in physics-informed neural networks,” Advances in Neural Information Processing Systems 34 (2021), arXiv:2109.01050v2, §§3.2, 4.1 and 5.1.
    • B. Moseley, A. Markham and T. Nissen-Meyer, “Finite Basis Physics-Informed Neural Networks (FBPINNs): a scalable domain decomposition approach for solving differential equations,” arXiv:2107.07871v1 (2021), §§4.1–4.2, Eqs. (12)–(14). The cited derivation uses this preprint version.

    Scrollable formula. Use Left and Right arrow keys to reveal hidden content.

    Scrollable table. Use Left and Right arrow keys to reveal hidden columns.

    Scrollable figure. Use Left and Right arrow keys to reveal hidden content.