Keywords

1 Introduction

Mathematical modeling of quantum-mechanical collisions of molecules, atoms and atomic nuclei, guided propagation of waves (oceanic, optical, electromagnetic), as well as transitions between metastable and bound quantum states using the methods of coupled channels or normal modes reduces to boundary-value problems (BVPs) for systems of N coupled second order ordinary differential equations (ODEs)  [1,2,3].

Mathematical models of the above phenomena, initially formulated as a multidimensional (quantum mechanical) or three-dimensional elliptic BVP [4], reduce to a system of ODEs with variable coefficients (real or complex, tabular or piecewise continuous, or not only continuous, but also having continuous derivatives up to a given order) on a finite interval. The appropriate boundary conditions (BCs) are of the mixed type: Robin (third-type or radiation condition), Neumann and Dirichlet. The procedure implies constructing asymptotes of the desired solution and its expansion in terms of a suitable basis functions, including the calculation of the variable coefficients of the ODE as integrals in the reduction of the original problem in terms of basis functions to be solved by the Kantorovich method or by the incomplete Galerkin method  [5, 6].

For example, in molecular and nuclear physics, optical waveguides, for the spectrum of beryllium dimer [7], sub-barrier fusion of heavy ions [8] or transverse modes in smoothly irregular optical fibers [9], the proposed approach and the program of its finite element method (FEM) implementation allow the determination of scattering or metastable states in the case of different numbers of asymptotically coupled or entangled open channels [10, 11]. The eigenfunctions and the symmetric (or unitary) scattering matrix composed of square matrices of transmission amplitudes and rectangular matrices of reflection amplitudes are found, as well as complex energy eigenvalues and eigenfunctions of metastable states calculated by means of the Newton method [12].

Standard FEM programs with interpolation Lagrange polynomials (ILPs), implemented in FORTRAN and in public domain computer algebra systems like MAPLE and MATHEMATICA solve 3D, 2D and 1D elliptic BVPs  [4]. However, they are not applicable to systems of N ODEs of the above general type.

Indeed, in standard public domain FEM programs the desired solution is approximated by ILPs, which do not preserve the continuity of the derivatives of solutions up to a given order, depending on the smoothness of the variable coefficients of the ODE at the boundary points of the finite element mesh subintervals. This can violate the conservation laws inherent in the original problem.

In the present paper we propose new algorithms and software implementation of the FEM for solving BVPs for systems of N ODEs. To approximate the desired solution, the interpolation Hermite polynomials (IHPs) with arbitrary multiplicity of the nodes [6] are used, which preserve the continuity of the derivatives of the desired solution up to a given order, depending on the smoothness of the ODE variable coefficients at the boundary points of the finite element mesh subintervals [13]. The paper continues our previous work presented in the libraries of computer programs of the Computer Physics Communication journal [14,15,16] implemented in FORTRAN and JINRLIB [17] implemented and executed in MAPLE [18]. In the case of smooth coefficients of the ODE, the approximation by IHPs saves computer resources and provides not only high accuracy, but also the continuity of the solution gradient.

We apply MAPLE to construct and analyze the appropriate FEM schemes, to calculate the IHPs, to approximate the sought solution, to approximate the tabulated ODE coefficients, to implement smooth matching of the FEM solution with its analytical asymptotic extension, to construct the asymptotes of the sought ODE solution necessary for formulating the Robin BCs for the expansion of the desired solution of the original multidimensional BVP in appropriate basis functions. Moreover, using MAPLE we calculate the first derivatives of the basis functions with respect to the parameter – the independent variable of the ODE. The variable coefficients of the ODE – integrals in the reduction of the original multidimensional BVP in terms of basic functions and their first derivatives by the Kantorovich or incomplete Galerkin method are also obtained using MAPLE, as well as a convenient graphical representation of all the items that make up the solution of the BVP.

The structure of the paper is as follows. In Sect. 2, we formulate the BVPs and briefly describe the FEM scheme. Section 3 presents the benchmark examples of using the code to solve bound state problems and scattering problems of quantum mechanics and waveguide physics. In Appendices we present the algorithms of IHPs generation on the standard interval, calculation of the FEM scheme characteristics and FEM generation of an algebraic eigenvalue problem. In Conclusion we summarize the results and prospects of application.

All calculations in this paper were performed by KANTBP 5M code using MAPLE 2019 on PC Intel Pentium 987 2 \(\times \) 1.5 GHz, 4 Gb, 64bit Windows 8.

2 The Problem Statement

2.1 The Boundary-Value Problems

The proposed approach implemented as program KANTBP 5M is intended for solving BVPs for systems of the ODEs with respect to unknown functions \(\boldsymbol{\varPhi }( z){=}(\varPhi _1( z), {\ldots }, \varPhi _{{N}}( z))^T\) of independent variable \(z{\in }\varOmega (z^{\min },z^{\max })\) numerically using the FEM [10]:

$$\begin{aligned}&\left( \mathbf {D}-E\,\mathbf {I}\right) \boldsymbol{\varPhi }(z) \equiv \left( {-} \frac{1}{f_B(z)}\mathbf {I}\frac{d}{dz}f_A(z) \frac{d }{dz} {+} \mathbf {V}(z) \right. \nonumber \\&\qquad \qquad \left. {+}\frac{f_A(z)}{f_B(z)}\mathbf {Q}(z)\frac{d}{dz} {+}\frac{1}{f_B(z)}\frac{df_A(z)\mathbf {Q}(z)}{dz} {-}E\,\mathbf {I}\right) \boldsymbol{\varPhi }(z){=}0. \end{aligned}$$
(1)

Here \(f_B(z)>0\) and \(f_A(z)>0\) are continuous or piece-wise continuous positive functions, \(\mathbf {I}\) is the unit matrix, \(\mathbf {V}(z)\) is a symmetric matrix, \(V_{ij}(z)=V_{ji}(z)\), and \(\mathbf {Q}(z)\) is an antisymmetric \(N\times N\) matrix, \(Q_{ij}(z)=-Q_{ji}(z)\), of effective potentials. The elements of these matrices are continuous or piecewise continuous real or complex-valued coefficients from the Sobolev space \(\mathcal{H}_2^{s\ge 1}(\varOmega )\), providing the existence of nontrivial solutions \(\boldsymbol{\varPhi }(z)\) subjected to homogeneous Dirichlet, Neumann or Robin BCs at the boundary points of the interval \(z\in \{z^{\min },z^{\max }\}\) at given symmetric real or complex-valued \(N\times N\) matrix \(\mathbf {G}(z)=\mathbf {\mathcal {R}}(z)- \mathbf {Q}(z)\)

$$\begin{aligned} \boldsymbol{\varPhi }(z^t)=&0, \qquad \lim _{z\rightarrow z^t} f_A(z)\left( \mathbf{I}\frac{d}{dz}-\mathbf{Q}(z)\right) \boldsymbol{\varPhi }(z)=0, \\&\left( \mathbf{I}\frac{d}{dz}-\mathbf{Q}(z)\right) \boldsymbol{\varPhi }(z)\biggl |_{z=z^t}= \mathbf {G}(z^t)\boldsymbol{\varPhi }(z^t), \nonumber \end{aligned}$$
(2)

where the superscript \(t=\min ,\max \) labels the boundary points of the interval.

The Scattering Problem at a fixed energy E in the asymptotic form “incident wave + outgoing waves” can be written as:

$$\begin{aligned} \boldsymbol{\varPhi }_\rightarrow (z\rightarrow \pm \infty )= \left\{ \begin{array}{rr} \mathbf {X}^{(\rightarrow )}_{\min }(z)+\mathbf {X}^{(\leftarrow )}_{\min }(z)\mathbf {R}_\rightarrow +\mathbf {X}^{(c)}_{\min }(z)\mathbf {R}_\rightarrow ^c,&{}z\rightarrow -\infty ,\\ \mathbf {X}^{(\rightarrow )}_{\max }(z)\mathbf {T}_\rightarrow +\mathbf {X}^{(c)}_{\max }(z)\mathbf {T}_\rightarrow ^c,&{}z\rightarrow +\infty , \end{array} \right.&\\ \boldsymbol{\varPhi }_\leftarrow (z\rightarrow \pm \infty )= \left\{ \begin{array}{rr} \mathbf {X}^{(\leftarrow )}_{\min }(z)\mathbf {T}_\leftarrow + \mathbf {X}^{(c)}_{\min }(z)\mathbf {T}_\leftarrow ^c,&{}z\rightarrow -\infty , \\ \mathbf {X}^{(\leftarrow )}_{\max }(z)+\mathbf {X}^{(\rightarrow )}_{\max }(z)\mathbf {R}_\leftarrow +\mathbf {X}^{(c)}_{\max }(z)\mathbf {R}_\leftarrow ^c,&{}z\rightarrow +\infty . \end{array} \right.&\end{aligned}$$

Here \(\boldsymbol{\varPhi }_\rightarrow (z)\), \(\boldsymbol{\varPhi }_\leftarrow (z)\) are matrix solutions with dimensions \(N\times N_o^L\), \(N\times N_o^R\), where \(N_o^L\), \(N_o^R\) are the numbers of open channels, \(\mathbf {X}^{(\rightarrow )}_{\min }(z)\), \(\mathbf {X}^{(\leftarrow )}_{\min }(z)\) are open channel asymptotic solutions at \(z\rightarrow -\infty \), dimension \(N\times N_o^L\), \(\mathbf {X}^{(\rightarrow )}_{\max }(z)\), \(\mathbf {X}^{(\leftarrow )}_{\max }(z)\) are open channel asymptotic solutions at \(z\rightarrow +\infty \), dimension \(N\times N_o^R\), \(\mathbf {X}^{(c)}_{\min }(z)\), \(\mathbf {X}^{(c)}_{\max }(z)\) are closed channel solutions, dimension \(N\times (N-N_o^L)\), \(N\times (N-N_o^R)\), \(\mathbf {R}_\rightarrow \), \(\mathbf {R}_\leftarrow \) are the reflection amplitude square matrices of dimension \(N_o^L\times N_o^L\), \(N_o^R\times N_o^R\), \(\mathbf {T}_\rightarrow \), \(\mathbf {T}_\leftarrow \) are the transmission amplitude rectangular matrices of dimension \(N_o^R\times N_o^L\), \(N_o^L\times N_o^R\), \(\mathbf {R}_\rightarrow ^c\), \(\mathbf {T}_\rightarrow ^c\), \(\mathbf {T}_\leftarrow ^c\), \(\mathbf {R}_\leftarrow ^c\) are auxiliary matrices. For real-valued potentials \(\mathbf {V}(z)\) and \(\mathbf {Q}(z)\) the transmission \(\mathbf {T}\) and reflection \(\mathbf {R}\) amplitudes satisfy the relations

$$\begin{aligned}&\mathbf { T}_\rightarrow ^{\dag }\mathbf { T}_\rightarrow +\mathbf { R}_\rightarrow ^{\dag }\mathbf {R}_\rightarrow =\mathbf {I}_{oo},\quad \mathbf { T}_\leftarrow ^{\dag }\mathbf { T}_\leftarrow +\mathbf { R}_\leftarrow ^{\dag }\mathbf {R}_\leftarrow =\mathbf {I}_{oo},\nonumber \\&\mathbf { T}_\rightarrow ^{\dag }\mathbf { R}_\leftarrow +\mathbf { R}_\rightarrow ^{\dag }\mathbf { T}_\leftarrow =\mathbf {0},\quad \mathbf { R}_\leftarrow ^{\dag }\mathbf { T}_\rightarrow +\mathbf { T}_\leftarrow ^{\dag }\mathbf { R}_\rightarrow =\mathbf {0}, \\&\mathbf { T}_\rightarrow ^T=\mathbf { T}_\leftarrow ,\quad \mathbf { R}_\rightarrow ^T=\mathbf { R}_\rightarrow ,\quad \mathbf { R}_\leftarrow ^T=\mathbf { R}_\leftarrow \nonumber \end{aligned}$$
(3)

ensuring unitarity and symmetry of S-matrix

$$\begin{aligned} \mathbf {S}=\left( \begin{array}{ll} \mathbf {R}_\rightarrow &{} \mathbf {T}_\leftarrow \\ \mathbf {T}_\rightarrow &{} \mathbf {R}_\leftarrow \end{array} \right) , \qquad \mathbf {S}^\dag \mathbf {S}=\mathbf {S}\mathbf {S}^\dag = \mathbf {I}. \end{aligned}$$

Here \(^\dag \) and \(^T\) denote conjugate transpose and transpose of a matrix, respectively. So, for complex potentials \(\mathbf {V}(z)\) and \(\mathbf {Q}(z)\) the S-matrix is only symmetric \(\mathbf {S}=\mathbf {S}^T\) and only the last three conditions of (3) hold.

For set of ODEs (1) with \(f_B(z){=}f_A(z){=}1\), \(Q_{ij}(z){=}0\) and constant effective potentials \(V_{ij}(z){=}V_{ij}^{L,R}\) in the asymptotic region, asymptotic solutions \(\mathbf {X}_{i}^{(*)}(z\rightarrow \pm \infty )\) are as follows. The open channel asymptotic solutions \( {i=}i_o=1,...,N_{o}^{L,R}\):

$$\begin{aligned}&\mathbf {X}_{i_o}^{({\mathop {\scriptstyle \leftarrow }\limits ^{{\scriptstyle \rightarrow }}})}(z\rightarrow \pm \infty )\rightarrow \frac{\exp \left( \pm \imath \sqrt{E-\lambda _{i_o}^{L,R}}z\right) }{\root 4 \of {E-\lambda _{i_o}^{L,R}}}\boldsymbol{\varPsi }_{i_o}^{L,R}, \quad \lambda _{i_o}^{L,R}< E. \end{aligned}$$

The closed channels asymptotic solutions \(i=i_c=N_o^{L,R}+1,\ldots ,N\):

$$\begin{aligned}&{\mathbf {X}_{i_c}^{(c)}(z\rightarrow \pm \infty )\rightarrow \exp \left( -\sqrt{\lambda _{i_c}^{L,R}-E}|z|\right) \boldsymbol{\varPsi }_{i_c}^{L,R}, \quad \lambda _{i_c}^{L,R}\ge E.} \end{aligned}$$

Here \(\lambda _{i}^{L,R}\) and \(\boldsymbol{\varPsi }_{i}^{L,R}=\{\varPsi _{1i}^{L,R},...,\varPsi _{Ni}^{L,R}\}^{T}\) are solutions of the algebraic eigenvalue problems with matrix \(\mathbf {V}^{L,R}\) of dimension \(N\times N\) for the entangled channels [11]

$$\begin{aligned}&\mathbf {V}^{L,R}\boldsymbol{\varPsi }^{L,R}_i=\lambda _i^{L,R}\boldsymbol{\varPsi }^{L,R}_i,\quad (\boldsymbol{\varPsi }^{L,R}_i)^T\boldsymbol{\varPsi }^{L,R}_j=\delta _{ij}. \end{aligned}$$
(4)

Note that \(\lambda _i^{L,R}=V^{L,R}_{ii}\) and \(\boldsymbol{\varPsi }^{L,R}_i=\delta _{ji}\), if \(V^{L,R}_{i\ne j}=0\), i.e. in the conventional case of orthogonal channels.

Bound or Metastable States. Eigenfunctions \(\boldsymbol{\varPhi }_m(z)\) obey the normalization and orthogonality conditions

$$\begin{aligned} ( \boldsymbol{\varPhi }_m | \boldsymbol{\varPhi }_{m'} ) =\int _{z^{\min }}^{z^{\max }}f_B(z)(\boldsymbol{\varPhi }^{(m)}(z))^T\boldsymbol{\varPhi }^{(m')}(z)dz=\delta _{mm'}. \end{aligned}$$

For bound states with real eigenvalues E: \(E_{1}\le E_{2}\le ... \) the Dirichlet or Neumann BC (2) follow from asymptotic expansions. For metastable states with complex eigenvalues \(E=\mathfrak {R}E+\imath \mathfrak {I}E\), \(\mathfrak {I}E<0\): \(\mathfrak {R}E_{1}\le \mathfrak {R}E_{2}\le ...\) the Robin BC follow from outgoing wave fundamental asymptotic solutions that correspond to the Siegert outgoing wave BCs [12].

For the set of ODEs (1) with \(f_B(z){=}f_A(z){=}1\), \(Q_{ij}(z){=}0\) and constant effective potentials \(V_{ij}(z){=}V_{ij}^{L,R}\) in the asymptotic region, asymptotic solutions \(\mathbf {X}_{i}^{(*)}(z\rightarrow \pm \infty )\) are as follows. For bound states:

$$\begin{aligned}&\mathbf {X}_{i_c}^{(c)}(z\rightarrow \pm \infty )\rightarrow \exp \left( -\sqrt{\lambda _{i_c}^{L,R}-E_i}|z|\right) \boldsymbol{\varPsi }_{i_c}^{L,R}, \quad {\lambda _{i_c}^{L,R}{\ge } E,} \quad i_c=1,\ldots ,N, \end{aligned}$$

and for metastable states:

$$\begin{aligned} \mathbf {X}_{i_o}^{({\mathop {\scriptstyle \leftarrow }\limits ^{{\scriptstyle \rightarrow }}})}(z{\rightarrow }\infty ){\rightarrow } {\exp \left( {+}\imath \sqrt{E{-}\lambda _{i_o}^{L,R}}|z|\right) }\boldsymbol{\varPsi }_{i_o}^{L,R}, \quad \lambda _{i_o}^{L,R}{<} \mathfrak {R}E,\quad i_o{=}1,...,N_{o}^{L,R}, \\ \mathbf {X}_{i_c}^{(c)}(z{\rightarrow }\infty ){\rightarrow } \exp \left( {-}\sqrt{\lambda _{i_c}^{L,R}{-}E}|z|\right) \boldsymbol{\varPsi }_{i_c}^{L,R}, \quad \lambda _{i_c}^{L,R}{\ge } \mathfrak {R}E,\quad i_c{=}N_o^{L,R}{+}1,\ldots ,N. \end{aligned}$$

In the considered case matrix \(\mathcal {R}(z^t)\) of logarithmic derivatives for the corresponding Robin BC takes the form

$$\mathcal {R}(z^t)=\boldsymbol{\varPsi }^{L,R}{} \mathbf{F}^{L,R}\left( \boldsymbol{\varPsi }^{L,R}\right) ^{-1}, $$

where \(\mathbf{F}^{L,R}=\mathrm{diag}(...,\pm \sqrt{\lambda _{i_c}^{L,R}-E},...,\mp \imath \sqrt{E-\lambda _{i_o}^{L,R}},...)\) and \(\boldsymbol{\varPsi }^{L,R}\) is the matrix, composed from solutions \(\boldsymbol{\varPsi }_j^{L,R}\) of algebraic eigenvalue problem (4).

2.2 Finite Element Scheme

Finding solution \({\boldsymbol{\varPhi }}(z){\in } \mathcal{H}_2^{s\ge 1}(\bar{\varOmega })\) of BPVs (1)–(2) reduces to the FEM calculation of stationary points of symmetric quadratic functional

$$\begin{aligned}&\boldsymbol{\varXi }(\boldsymbol{\varPhi },E,z^{\min },z^{\max }) \equiv \int _{z^{\min }}^{z^{\max }} f_B(z)\boldsymbol{\varPhi }^{\bullet }(z) \left( \mathbf {D}-E\,\mathbf {I}\right) \boldsymbol{\varPhi }(z)dz=\boldsymbol{\varPi }(\boldsymbol{\varPhi },E,z^{\min },z^{\max })\nonumber \\&\nonumber -f_A(z^{\max })\boldsymbol{\varPhi }^{\bullet }(z^{\max })\mathbf {G}(z^{\max })\boldsymbol{\varPhi }(z^{\max }) +f_A(z^{\min })\boldsymbol{\varPhi }^{\bullet }(z^{\min })\mathbf {G}(z^{\min })\boldsymbol{\varPhi }(z^{\min }),\\&\boldsymbol{\varPi }(\boldsymbol{\varPhi },E,z^{\min },z^{\max })= \int ^{z^{\max }}_{z^{\min }}\left[ f_A(z)\frac{d \boldsymbol{\varPhi }^{\bullet }(z)}{d z} \frac{d \boldsymbol{\varPhi } (z)}{d z}+ f_B(z)\boldsymbol{\varPhi }^{\bullet }(z)\mathbf {V}(z) \boldsymbol{\varPhi }(z)\right. \nonumber \\&\left. +f_A(z)\boldsymbol{\varPhi }^{\bullet }(z)\mathbf {Q}(z) \frac{d \boldsymbol{\varPhi } (z)}{d z}- f_A(z)\frac{d \boldsymbol{\varPhi }(z)^{\bullet }}{d z}\mathbf {Q}(z) \boldsymbol{\varPhi }(z)-f_B(z)E \boldsymbol{\varPhi }^{\bullet }(z) \boldsymbol{\varPhi } (z) \right] dz, \end{aligned}$$
(5)

where \(\mathbf {G}(z)=\mathbf {\mathcal {R}}(z)- \mathbf {Q}(z)\) is a symmetric \(N\times N\) matrix and \(^\bullet \) stands for \(^T\) or \(^\dag \) depending on the problem considered.

High-accuracy computational schemes for solving BVP (1)–(2) are derived from variational functional (5) basing on the FEM. The general idea of FEM in a one-dimensional space is to divide the interval \([z^{\min },z^{\max }]\) into many small subintervals referred to as elements. The choice of subintervals size (length) is free enough to account for physical properties or qualitative behavior of the sought solutions, such as smoothness.

The interval \(\varDelta =[z^{\min },z^{\max }]\) is covered by a set of n subintervals \(\varDelta _j=[z_{(j-1)},z_{(j)}]\), \(z_{(0)}=z^{\min }\), \(z_{(n)}=z^{\max }\) in such a way that \(\varDelta =\bigcup _{j=1}^n\varDelta _j\). On each subinterval \(\varDelta _j=[z_{(j-1)},z_{(j)}]\) of a length \(h_j=z_{(j)}-z_{(j-1)}\) we introduce a set of local functions given by the IHPs [6]: \(\varphi ^{\kappa }_{r}(z)\), \(r=0,...,p\), \(\kappa =0,\ldots ,\kappa _r^ {\max }-1\), where \(\kappa _r^ {\max }\) is referred to as the multiplicity of the nodes \(z_{r}^{}\in \varDelta _j\), \(z_0=z_{(j-1)}\), \(z_p=z_{(j)}\). The values of functions \(\varphi ^{\kappa }_{r}(z)\) of the order \(p'=\sum _{r=0}^p\kappa ^{\max }_r-1\) with their derivatives up to the order \((\kappa _r^ {\max }-1)\) are determined by expressions

$$\begin{aligned} {\varphi ^{\kappa }_{r}(z_{r'})=\delta _{rr'}\delta _{\kappa 0}, \quad \frac{d^{\kappa '}\varphi ^{\kappa }_{r}(z)}{dz^{\kappa '}}\biggr |_{z=z_{r'}^{}}=\delta _{rr'}\delta _{\kappa \kappa '}. }\end{aligned}$$
(6)

IHPs are calculated using analytical formulas [13] implemented in the algorithm of Appendix A. The numerical solution \( \boldsymbol{\varPhi }^h( z)\approx \boldsymbol{\varPhi }( z)\) is sought in the form of a finite sum over the basis of local functions \(N_s(z)\) at each nodal point \(z=z_\rho \) of the grid \(\varOmega ^{p}_{h_{j}(z)}[z^{\min },z^{\max }] \) on interval \(z\in \varDelta =[z^{\min },z^{\max }]\):

$$\begin{aligned} \boldsymbol{\varPhi }^h(z){=}\sum _{s=0}^{L-1} \boldsymbol{\varPhi }_{s}^h N_{s}(z), \quad \boldsymbol{\varPhi }_{s}^h{=}(\varPhi _{s1}^h,...,\varPhi _{sN}^h)^T, \quad \left. \frac{d^\kappa N_{s}(z)}{dz^\kappa }\right| _{z=z_\rho }{=}\delta _{ss'(\kappa ,\rho )}. \end{aligned}$$
(7)

Basis functions \(N_s(z)\) are piecewise polynomials calculated by IHP matching (see for the details [13, 17]). The substitution of expansion (7) into variational functional (5) reduces problem (1)–(2) to an algebraic problem for the unknown eigenvalues E or S-matrix and vector \(\boldsymbol{\varPhi }^h=\{\varPhi _{\mu }^h\}_{\mu =1}^{LN}=\{\{\varPhi _{si}^h\}_{i=1}^{N}\}_{s=0}^{L-1}\):

$$\begin{aligned}&(\mathbf {A} - E\, \mathbf {B})\boldsymbol{\varPhi }^h =0. \end{aligned}$$
(8)

Here \( \mathbf {A}=\mathbf {A}^{(2)}+\mathbf {A}^{(1)}+\mathbf {V}+\mathbf {M}^{\min }-\mathbf {M}^{\max }\) and positive definite \(\mathbf {B}\) are symmetric \(NL\times NL\) matrices of stiffness and mass, respectively:

$$\begin{aligned}&A_{\mu _1,\mu _2}^{(2)}=\int _\varDelta \frac{dN_{s_1}(z)}{dz}\delta _{i_1i_2}\frac{dN_{s_2}(z)}{dz}f_A(z)dz ,\nonumber \\&A_{\mu _1,\mu _2}^{(1)}=\int _\varDelta \left( N_{s_1}(z)Q_{i_1i_2}(z)\frac{dN_{s_2}(z)}{dz} -\frac{dN_{s_1}(z)}{dz}Q_{i_1i_2}(z)N_{s_2}(z)\right) f_A(z)dz ,\nonumber \\&V_{\mu _1,\mu _2}=\int _\varDelta N_{s_1}(z)V_{i_1i_2}(z)N_{s_2}(z)f_B(z)dz, \nonumber \\&B_{\mu _1,\mu _2}=\int _\varDelta N_{s_1}(z)\delta _{i_1i_2}N_{s_2}(z) f_B(z)dz. \end{aligned}$$
(9)
Table 1. Interrelation of subscripts \(\mu \), \(\nu \), i, r, \(\rho \), j, S, s and \(\kappa \) by the example of BVP (1) with \(N=2\) solved by FEM with the IHPs of the order \(p'=4\) (\(p'=\sum _{r=0}^p\kappa ^{\max }_r-1\)) with multiplicities \((\kappa _1^{\max },\kappa _2^{\max },\kappa _3^{\max })=(2, 1, 2)\) on \(n=4\) finite elements. Here (D) means using the Dirichlet conditions at \(z=z^{\min }\) and \(z=z^{\max }\).

According to the definition of local function \(N_{s}(z)\), the integrals in (9) are calculated only on subinterval \(\varDelta _j\) in which both \(N_{s_1}(z)\) and \(N_{s_2}(z)\) are localized. \(NL\times NL\) matrices \(\mathbf {M}^{\max }\) and \(\mathbf {M}^{\min }\) have only one nonzero \(N\times N\) submatrix:

$$\begin{aligned} {M_{\nu _1,\nu _2}^{\min }=f_A(z^{\min }) {R}_{\nu _1,\nu _2}(z^{\min }),\,\, M^{\max }_{\nu _0+\nu _1,\nu _0+\nu _2}= f_A(z^{\max }) {R}_{\nu _1,\nu _2}(z^{\max }), } \end{aligned}$$
(10)

where \(\nu _0=N(L-\kappa _r^{\max })\), respectively. Each element of the eigenvector \(\boldsymbol{\varPhi }^h\) is marked by the multi-index notation \(\mu \). The dependence of multi-index \( \mu \) on indices \( \nu \), i, r, \( \rho \), j, s, \( \kappa \) defined above and index S used for global enumeration of local functions \( \varphi _r ^ \kappa \) on each of finite elements \( \varDelta _j \) (see Appendix B) is illustrated in Table 1 by an example of BVP (1) with \( N = 2 \), solved using FEM with fourth-order IHPs \( (\kappa _1 ^ {\max }, \kappa _2 ^ {\max }, \kappa _3 ^ {\max }) = (2, 1, 2) \) on \( n = 4 \) finite elements.

The algorithms for calculating characteristics of FEM scheme and generating an algebraic eigenvalue problem are given in Appendixes B and C. The algebraic eigenvalue problem is solved using either built-in linear algebra procedures, or the continuous analog of Newton method [12].

Fig. 1.
figure 1

Phase shift \(\delta \) vs scattering energy E at \(L=18\). Here \(\delta E(res)=E-E(res)\).

3 Benchmark Calculations

3.1 ODE with Potential Calculated by Quantum Chemistry

In quantum chemical calculations, effective potentials of interatomic interaction are presented in the form of numerical tables calculated with a limited accuracy and defined on a nonuniform mesh of nodes in a finite range of interatomic distances. It is important that the proposed FEM scheme with IHPs ensures smooth matching of the tabulated potential with its analytical asymptotic expression, as well as high-quality smooth approximation of eigenfuntions [7]. Consider, e.g., the Schrödinger equation for a diatomic beryllium molecule in the adiabatic approximation, commonly referred to as Born–Oppenheimer approximation

$$\begin{aligned}&\left( {-}\frac{1}{r^2}\frac{d}{dr}{s_2r^2}\frac{d}{dr} {+} {V}(r) + \frac{L(L{+}1)}{r^2}s_2{-} E_{vL}\right) \varPhi _{vL}(r) {=} 0, \end{aligned}$$

where \(s_2=1/0.2672973729\), r is the distance between the atoms in angstroms, \(E_{vL}\) is the energy in cm\(^{-1}\) and L is the total angular momentum quantum number. The potential V(r) is defined by its values on a grid and an asymptotic expansion beyond it (see for details [7]). For \(L=18\) there are 7 bound states \(E_{vL}\,=\,\)(\(-600.3\), \(-392.4\), \(-240.7\), \(-150.4\), \(-96.6\), \(-54.4\), \(-20.3\)) cm\(^{-1}\) and 1 metastable state \(E_{1L}^M=(4.788- 4\cdot 10^{-10}\imath )\) cm\(^{-1}\). The computation time does not exceed 20 s. Figure 1 shows phase shifts \(\delta \) as functions of scattering energy E; as expected, the phase shifts equal \( \delta =\pi /2\) at resonant energies and rapidly change near them. Figure 2 show real and imaginary parts of wave functions of metastable and scattering states for energies close to a very narrow resonance at \(L=18\). For the resonance energy, the scattering wave function in Fig. 2 (b) is seen to be localized within the potential well, while in the non-resonance case it becomes no longer observed under a minor change in the incident wave energy. Our large-scale calculations [7] showed efficiency and robustness of the program that provides an exhaustive analysis of the spectrum of 252 bound states and 58 metastable states of beryllium dimer in ground \(X ^1\varSigma ^{+}_{g}\) state.

Fig. 2.
figure 2

Plots of the real (solid curves) and imaginary (dashed curves) parts of metastable state wave function \(\varPhi _{vL}(r)\) (a) and scattering functions \(\varPhi _{L}(r)\) in the vicinity of resonance energy \(E(res)\approx 4.788\) cm\(^{-1}\) (b). Here \(L=18\) and \(v=7\).

Fig. 3.
figure 3

Real (solid curves) and imaginary (dashed curves) parts of elements \((R_\rightarrow )_{ij}\), \((R_\leftarrow )_{ij}\), \((T_\rightarrow )_{ij}=(T_\leftarrow )_{ji}\) of reflection \(\mathbf{R}_\rightarrow \), \(\mathbf{R}_\leftarrow \) and transmission \(\mathbf{T}_\rightarrow \), \(\mathbf{T}_\leftarrow \) amplitudes, and reflection coefficients \(R_i^*=(\mathbf { R}_*^{\dag }\mathbf {R}_*)_{ii}\) at \(*= \rightarrow \) (solid curves) and \(*= \leftarrow \) (dashed curves) as functions of scattering energy E.

3.2 ODE System with Piecewise Constant Potentials

Consider, e.g., a BVP similar to that of Ref. [11] for the Schrödinger equation in 2D domain \(\varOmega _{yz}{=}\{y{\in }(0,\pi ), z{\in }(-\infty ,+\infty )\},\) with potential

$$V(y,z){=}\left\{ 0,z<2;-2y,|z|\le 2;2y,z>2\right\} .$$

We seek the solution in the form of expansion \(\varPsi (y,z)\,{=}\,\sum _{i=1}^N B_i(y)\varPhi _i(z)\) in a set of basis functions \(B_i(y)\,{=}\,\frac{\sqrt{2}}{\sqrt{\pi }}\sin (iy)\), which leads to Eqs. (1) with \(f_B(z)\,{=}\,f_A(z)\,{=}\,1\), \(Q_{ij}(z)\,{=}\,0\) and effective potentials

$$\begin{aligned}V_{ij}(z)\,{=}\,&i^2\delta _{ij}{+}\bigg \{0,z<{-}2;{-}2,|z|{\le }2;2,z{>}2\bigg \}\\&{\times }\bigg \{\pi /2,i{=}j;0, \text{ even } i{-}j;\frac{-8ij}{\pi (i^2{-}j^2)^2}, \text{ odd } i{-}j\bigg \}. \end{aligned}$$

For example, let us choose \(N=6\). The considered system has sets of threshold energies that differ in the left and right asymptotic regions of the z-axis: \(\lambda ^{(L)}_i=\{1,4,9,16,25,36\}\) and \(\lambda ^{(R)}_i=\{\)3.742260, 7.242058, 12.216485, 19.188688, 28.173689,39.286376\(\}\), respectively. So, we have different numbers of open channels and entangled channels (4) in the right-hand asymptotic region.

Table 2. Eigenvalues \(E_i\), \(i=1,2,3\) of bound states and \(E_i^M\), \(i=1,...,4\) of metastable states obtained by solving the eigenvalue problem with Neumann BC (E) by Newton method (N) and method of matching fundamental solutions (M).

The bound states were calculated on a grid [−25.78125, −18.1875, −13.125, −9.75, −7.5, −6(1)6] built up a geometric progression of steps in accordance with a slow exponential decay of solutions at \(z<-6\) subject to the Neumann BC. The metastable states were found by Newton method on a grid [−4(1)4] with the Robin BC dependent on the eigenvalue. As initial data, the solution obtained on a grid [−2(1)2] with the Neumann BC was taken. The same grid [−4(1)4] was used to solve the scattering problem. In both cases, IHPs of the sixth order \((\kappa _1^{\max },...,\kappa _5^{\max })=(2, 1, 1, 1, 2)\) were used. The computation time was 62 s for the eigenvalue and scattering problem and 70 s per iteration when using the Newton method.

Table 2 presents the calculated energies of bound and metastable states. The results obtained by method of matching fundamental solutions [11] and FEM are seen to coincide with an accuracy of \(10^{-9}\div 10^{-7}\). The third eigenvalue obtained by solving the BVP with the Neumann BC differs from the results of two other methods by \(5\cdot 10^{-7}\), which is due to a slow decrease of the solution.

Figure 3 shows real and imaginary parts of elements \((R_\rightarrow )_{ij}\), \((R_\leftarrow )_{ij}\), \((T_\rightarrow )_{ij}=(T_\leftarrow )_{ji}\) of reflection \(\mathbf{R}_\rightarrow \), \(\mathbf{R}_\leftarrow \) and transmission \(\mathbf{T}_\rightarrow \), \(\mathbf{T}_\leftarrow \) amplitudes satisfying conditions (3). At \(E\le \lambda ^{(R)}_1\approx 3.742260\) we have a single-channel scattering problem on a semiaxis. As follows from scattering theory, in the case of resonance, the argument of one element \(S_{11}=(R_\rightarrow )_{11}\) of the S-matrix equals \(\pi /2\), i.e., the imaginary part is equal to one and the real part is equal to zero. These values of real and imaginary parts of \((R_\rightarrow )_{11}\) are observed at \(E\approx 1.1\) and \(E\approx 2.4\) corresponding to the first two resonances in Table 2. So, near \(E\approx 6.3\) and \(E\approx 7.5\) corresponding to the next two resonances, a sharp change of reflection and transmission amplitudes is seen. Thus, the program provides an exhaustive analysis of the scattering problem with a different number of open entangled channels similar to the one present in sub-barrier fusion reactions [8].

4 Conclusion

We presented the FEM scheme and showed its efficiency by benchmark examples of using the KANTBP 5M program (an upgrade of KANTBP 4M [17] containing 1484 lines) implemented and executed in MAPLE. We showed that the program provides a suitable tool for solving multichannel scattering and eigenvalue problems for systems of second-order ODEs with continuous or piecewise continuous real or complex-valued coefficients with a given accuracy. The new type of FEM discretization is implemented using IHPs with an arbitrary multiplicity of IHPs nodes, determined by Eqs. (6) and (7) given in Appendices A and B and Gauss quadratures given in Appendix C, whereas only a fixed multiplicity of the nodes and analytical integration of polynomial approximants were available in KANTBP 4M, which preserves the continuity of derivatives of the sought solutions. To reduce the new type of a scattering problem with a different number of open entangled channels (whereas in KANTBP 4M only non-entangled open channels could be considered) in the left and right asymptotic regions to a BVP on a finite interval, the new type of entangled asymptotic BCs determined by Eq. (4) are approximated by the homogeneous third-type (Robin) conditions. To calculate metastable states with complex eigenvalues, or to solve a bound state problem with Robin BC depending on the spectral parameter, the Newtonian iteration scheme is implemented. The open code of the KANTBP 5M and test examples including INPUT and OUTPUT both implemented and executed in MAPLE of solving eigenvalue problems and scattering problems of quantum mechanics [7, 8, 10,11,12] and adiabatic waveguide modes [9] will be presented in JINRLIB program library.

The authors thank Prof. E. Zima for useful discussions. The work was partially supported by the RFBR and MECSS, project number 20-51-44001, the Ministry of Science and Higher Education of the Russian Federation, grant number 075-10-2020-117, the Bogoliubov-Infeld program, the Hulubei-Meshcheryakov program, the RUDN University Strategic Academic Leadership Program, grant of Plenipotentiary of the Republic of Kazakhstan in JINR, the Foundation of Science and Technology of Mongolia, grant number SST\(\_\)18/2018 and the Ho Chi Minh City University of Education (Grant CS.2020.19.47).