Abstract. Following the Test Set for Initial Value Problem Solvers available at http://www.dm.uniba.it/~testset a new Fortran Test Set for Boundary Value Problem ...
A Fortran Test Set for Boundary Value Problem Solvers Francesca Mazzia∗ and Jeff R. Cash† ∗
†
Dipartimento di Matematica, Università degli Studi di Bari, Via Orabona 4, 70125 Bari, Italy Department of Mathematics, South Kensington Campus, Imperial College London, London SW7 2AZ
Abstract. Following the Test Set for Initial Value Problem Solvers available at http://www.dm.uniba.it/~testset a new Fortran Test Set for Boundary Value Problem (BVP) Solvers has been developed and it is now available at http: //www.dm.uniba.it/~bvpsolve. The BVPTestSet includes documentation of the test problems, experimental results from a number of proven solvers, and Fortran subroutines providing a common interface to the defining problem functions. Keywords: ordinary differential equations, boundary value problems, singular perturbation problems, test problems, Fortran PACS: 02.60.Cb,02.60.Lj
INTRODUCTION In this paper we present the Test Set for BVP solvers developed in Fortran for the numerical solution of Boundary Value problems (BVPs). The package includes solvers for Boundary Value Problems (BVPs) of Ordinary Differential Equations. A generic two-point boundary value problem for ordinary differential equations is a system of ordinary differential equations whose solution is subject to conditions posed at two distinct points in the range of integration. Two point BVPs originate in a number of areas including fluid flow, shock waves, epidemiology and geophysical models, see [3] and [19] for more examples. The generic problems is: y (x) = f (x, y),
a ≤ x ≤ b,
(1)
where y ∈ Rm , f : R × Rm → Rm , with boundary conditions, g(y(a), y(b)) = 0. This general form for the boundary conditions allows both separated and non-separated conditions to be specified. One of the main objectives of the testset for BVP solvers is to allow non expert users to efficiently solve boundary value problems in Fortran. The testset includes many of the well known Fortran codes for the solution of BVPs. The use of a driver interface that connects the problem written using a specific standard with the Fortran codes allows us to run the same problem with one of the solvers included. The available Fortran codes are twpbvp.f [9], twpbvpl.f [5] and acdc.f [8], their variant based on conditioning called twpbvpc.f [7] and twpbvplc.f [10] and acdcc.f, and the collocation codes colsys.f[1],colnew.f [4], colmod.f [8]. We recall that there are other important Fortran codes such as mirkdc.f [11] and BVP_M-2.f90. These codes are based on MIRK methods which have been widely used for the numerical solution of two point boundary value problems.They are however not yet included in BVPTestSet package. We mention also the Matlab code TOM [17, 14, 15] and the Matlab code bvptwp [6], the last one is based on twpbvp.f,twpbvpc.f, twpbvpl.f,twpbvplc.f and acdc.f,acdcc.f. In [6] a standard representation of test problems has also been suggested. This is in order to have one simple driver that allows us to run the test problems choosing one of the available Matlab solvers. Following this standard and the Test Set for Initial Value Problem Solvers available at http://www.dm.uniba.it/~testset a new Test Set for Boundary Value Problem Solvers has been developed and it is now available at http://www.dm.uniba.it/ ~bvpsolve. The BVP Test Set includes documentation of the test problems, experimental results from a number of proven solvers, and Fortran subroutines providing a common interface to the defining problem functions. The aim of this project is to offer the same service as in the IVP case, to allow the user to pick an appropriate code for his problem. Many of these facilities are also available in R using the package bvpSolve [12] and deTestSet [16], the last package includes an R interface to the test problems available in [13] and to most of the Fortran solvers. The test set for BVP solvers is free software distributed under the GNU General Public License. Proceedings of the International Conference on Numerical Analysis and Applied Mathematics 2014 (ICNAAM-2014) AIP Conf. Proc. 1648, 020009-1–020009-4; doi: 10.1063/1.4912313 © 2015 AIP Publishing LLC 978-0-7354-1287-3/$30.00
020009-1
A Test Set for Boundary Value Problems, and in particular for singularly perturbed problems, was developed by the second author during the preparation of the first version of the code twpbvp.f. The 33 test problems inserted in this test set were all included in the BVPTestSet together with other tests described in [2] and tests that have been taken from real life applications. The paper is structured as follows. First we list the main characteristics of the test set for boundary value problems [18]; we define the classes of problems that we are dealing with and we discuss how to solve the problems in Fortran. The BVPTestSet is available at http://www.dm.uniba.it/~bvpsolvers/.
THE TEST SET FOR BOUNDARY VALUE PROBLEMS The main characteristics of the BVPTestSet are the same as for the IVPTestSet [13] that is: uniform presentation of the problems, description of the origin of the problems, robust interfaces between problem and drivers, portability among different platforms, contributions by people from several application fields, presence of real-life problems, tested and debugged by a large, international group of researchers, comparisons with the performance of well-known solvers, interpretation of the numerical solution in terms of the application field, ease of access and use. Naturally, since the BVPTestSet has just been released we hope that all the goals considered will eventually be reached. Our main aim is to guide a potential user of a boundary value code to that code which is the most suitable for his or her problem. We do this by taking the user through the codes that are available and hope he or she will see a problem that is, in some sense, similar to the one that he or she wishes to solve and we will then suggest an appropriate code. A section of documentation will tell the user clearly what output he or she can expect and how to change this if he or she so wishes. Finally we note that, as we had enormous public feedback and input for the IVPTestSet, we feel confident that this will happen for the BVP test set so allowing us to make important improvements to the test problems, but perhaps more crucially, to the codes. The test problems in BVPTestSet can be categorized into the following classes: systems of first order and higher order two point Boundary Value Problems (BVPs), systems of first order and higher order two point singularly perturbed Boundary Value Problems (SPBVPs). The boundary conditions are considered separated. For now multipoint boundary conditions are not included in the BVPTestSet. In this test set we call a problem a BVP if it has the form i = 1, d, a≤x≤b yri i = f (x, z(y)), r y, f ∈ Rd , z = (y1 , y1 , ..., yr11 , . . . , yd , yd , ..., ydd ) Ba y(a), Bb y(b)given,
(2)
where ri is the order of the ith differential equation. A problem is called a SPBVP if it is of the form: i = 1, d, a≤x≤b yri i = f (x, z(y), ε ), r y, f ∈ Rd , z = (y1 , y1 , ..., yr11 , . . . , yd , yd , ..., ydd ) Ba y(a), Bb y(b)given,
(3)
where ε is a small parameter ε > 0. Since only a few of the available codes can solve higher order BVPs directly, i.e. without reducing the problem to first order form, each problem is always included in its first order form. All the test problems have been implementend using the BVP test set standard which consists of nine FORTRAN subroutines which uniquelly define the problem. These are called: PROB, SETTOLERANCES, SETOUTPUT, INIT, FEVAL, JEVAL, BCEVAL, JBCEVAL, SOLUT. A complete description of these functions is available in [18]. In brief the function PROB gives as output general information about the problem, including the values of a and b, the order of the differential equations, the number of equations, the type of the problem. The function SETTOLERANCES specifies if some particular tolerance is needed for specific components of the problem. The subroutine SETOUTPUT specifies if the output is required for all the components or only for some specific ones. The function INIT is related to the initial approximation of the solution; this is very important for non linear problems. The subroutines FEVAL and BCEVAL are related to the function of the differential problem and to the boundary conditions; the subroutines JEVAL and JBCEVAL are related to the relative Jacobians, they can be given exactly or can be approximated by two available subroutines that compute the Jacobian numerically. Finally, the subroutine SOLUT provides the exact solution if available. Many of the subroutines correspond to the ones already used in the IVPTestSet standard.
020009-2
In what follows we give a list of the BVP test problems available. A complete description of the problems can be found in [18] • •
BVP Problems: Elastica, FlatMoon, FlatEarth, FlatEarthDrag, Measles SPBVP Problems: 33 problems called BVPT1, BVPT2, ..., bvpT32, bvpT33
The solvers actually available in the BVPTestSet are the codes twpbvpc, twpbvplc, acdcc, colmod, colnew, colsys. We are not using the original implementation of the codes but the version included in the R-package bvpSolve [12]. This allows us to have exactly the same results when working in Fortran or in R . For each solver we have written a Fortran driver that is an interface between the standard description of the test problem and the solver. The auxiliary file report.f defines the input and output standard. A simple makefile allows the compilation of the test problem to be solved with the chosen solver. To compile and solve problem bvpT1 using the solver twpbvpc it is sufficient to run at the prompt: >> make PROBLEM=bvpT1 SOLVER= twpbvpc >> d o t e s t The following is the result: T e s t S e t f o r BVP S o l v e r s ( r e l e a s e 0 . 5 ) S o l v i n g P r o b l e m bvpT1 u s i n g TWPBVPC User i n p u t : give r e l a t i v e e r r o r tolerance : 1 e−4 g i v e eps , p a r a m e t e r f o r t h e s i n g u l a r p e r t u r b a t i o n p r o b l e m : 1 e−4 Numerical s o l u t i o n :
s o l u t i o n component −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− x ( 1 ) = . 0 0 E+00 y ( 1 , 1 ) = 0 . 9 9 9 9 9 7 9 7 3 4 4 6 1 8 4 6 E+000 x ( 7 ) = . 6 4 E−01 y ( 1 , 7 ) = 0 . 1 6 1 4 8 1 5 4 3 0 0 9 9 9 2 0 E−002 x ( 1 3 ) = . 1 1 E+00 y ( 1 , 1 3 ) = 0 . 1 9 7 3 1 5 0 7 6 6 9 2 7 2 2 2 E−004 x ( 1 9 ) = . 1 6 E+00 y ( 1 , 1 9 ) = 0 . 1 1 2 5 4 0 5 6 9 8 7 1 4 7 0 6 E−006 x ( 2 5 ) = . 2 3 E+00 y ( 1 , 2 5 ) = 0 . 7 3 5 6 6 1 0 8 6 0 1 6 0 6 7 4 E−010 x ( 4 0 ) = . 1 0 E+01 y ( 1 , 4 0 ) = 0 . 8 5 2 9 5 0 8 6 9 1 5 9 8 9 2 7 E−036 x ( 1 ) = . 0 0 E+00 y ( 2 , 1 ) = −0.9999979734461846E+002 x ( 7 ) = . 6 4 E−01 y ( 2 , 7 ) = −0.1614815430099920E+000 x ( 1 3 ) = . 1 1 E+00 y ( 2 , 1 3 ) = −0.1973150766927222E−002 x ( 1 9 ) = . 1 6 E+00 y ( 2 , 1 9 ) = −0.1125405698714706E−004 x ( 2 5 ) = . 2 3 E+00 y ( 2 , 2 5 ) = −0.7356610860160673E−008 x ( 4 0 ) = . 1 0 E+01 y ( 2 , 4 0 ) = −0.1130253104597101E−017 1 1 used components f o r scd s c d o f Y ( maximum norm )
80 4.78
u s i n g mixed e r r o r y i e l d s mescd using r e l a t i v e e r r o r y i e l d s scd
4.78
80 3.69
scd −−−−−−−−−−−−−−−−−−−−−−−−−−− mixed abs rel −−−−− −−−−− −−−−− 5.99 5.69 5.69 7.23 7.23 4.43 9.11 9.11 4.40 11.27 11.27 4.32 13.44 13.44 36.07 36.07 5.70 3.69 5.69 5.29 5.23 4.43 7.11 7.11 4.40 9.27 9.27 4.32 11.44 11.44 3.30 17.95 17.95
ignore mix − abs , r e l −−−−−−−−−−−−−
49 3.07
3.07
Integration characteristics : number o f i n t e g r a t i o n s t e p s number o f f e v a l u a t i o n s number o f bc e v a l u a t i o n s number o f J a c o b i a n e v a l u a t i o n s Max mesh u s e d F i n a l mesh u s e d
15 975 6 141 40 40
Conditioning parameters : kappa kappa1 kappa2 gamma1 sigma CPU−t i m e u s e d :
0 . 1 0 1 0 E+03 0 . 1 0 0 0 E+03 0 . 1 0 1 0 E+01 0 . 7 6 2 7 E+01 0 . 5 7 0 5 E+02 0.0000 sec
The output automatically produced includes also a set of function that allows us to plot the numerical solution using the preferred problem solving environment, one can choose between MATLAB, PYTHON, R and SCILAB.
FINAL REMARKS A new test set for BVP solvers is now available for Fortran users. With this test set users can now be guided to the code which is most suitable for his or her problems.
020009-3
Potential users of the of the BVPTestSet are scientists and engineers who either need to solve differential equations or need to simulate, on a computer, scientific problems based on differential equations. Teachers may also find both the code and problem data bases useful when organizing courses concerning the numerical simulation on newly emerging fields of experimental mathematics.
REFERENCES 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19.
U. M. Ascher, J. Christiansen, and R. D. Russell. Collocation software for boundary-value ODEs. acm trans. math software, 7:209–222, 1981. U. M. Ascher, R. Mattheij, and R. Russell. Numerical Solution of Boundary Value Problems for Ordinary Differential Equations. SIAM, Philadelphia, PA, 1995. Uri M. Ascher, Robert M. M. Mattheij, and Robert D. Russell. Numerical solution of boundary value problems for ordinary differential equations, volume 13 of Classics in Applied Mathematics. Society for Industrial and Applied Mathematics (SIAM), Philadelphia, PA, 1995. Corrected reprint of the 1988 original. G. Bader and U. M. Ascher. A new basis implementation for a mixed order boundary value ODE solver. SIAM journal on scientific and statistical computing, 8:483–500, 1987. Z. Bashir-Ali, J. R. Cash, and H. H. M. Silva. Lobatto deferred correction for stiff two-point boundary value problems. Comput. Math. Appl., 36(10-12):59–69, 1998. Advances in difference equations, II. J. R. Cash, D. Hollevoet, F. Mazzia, and A. M. Nagy. Algorithm 927: the MATLAB code bvptwp.m for the numerical solution of two point boundary value problems. ACM Trans. Math. Software, 39(2):Art. 15, 12, 2013. J. R. Cash and F. Mazzia. A new mesh selection algorithm, based on conditioning, for two-point boundary value codes. J. Comput. Appl. Math., 184(2):362–381, 2005. J. R. Cash, G. Moore, and R. Wright. An automatic continuation strategy for the solution of singularly perturbed nonlinear boundary value problems. ACM Transaction of Mathematical Software, 27(2):245–266, 2001. J. R. Cash and M. H. Wright. A deferred correction method for nonlinear two-point boundary value problems: implementation and numerical evaluation. SIAM J. Sci. Statist. Comput., 12(4):971–989, 1991. Jeff R. Cash and Francesca Mazzia. Hybrid mesh selection algorithms based on conditioning for two-point boundary value problems. JNAIAM J. Numer. Anal. Ind. Appl. Math., 1(1):81–90, 2006. W. E. Enright and P. H. Muir. Runge-Kutta software with defect control for boundary value odes. SIAM J. Sci. Comput., 17:479–497, 1996. F. Mazzia, J.R. Cash, and K. Soetaert. Solving boundary value problems in the open source software R: package bvpSolve bvpSolve. Opuscula Math., 34(2):387–403, 2014. F. Mazzia and C. Magherini. Test Set for Initial Value Problem Solvers, release 2.4. Department of Mathematics, University of Bari, Italy, 2008. Report 4/2008. F. Mazzia, A. Sestini, and D. Trigiante. B-spline linear multistep methods and their continuous extensions. SIAM J. Numer. Anal., 44(5):1954–1973 (electronic), 2006. F. Mazzia, A. Sestini, and D. Trigiante. The continous extension of the B-spline linear multistep metods for BVPs on non-uniform meshes. Appl. Numer. Math., 59(3-4):723–738, 2009. Francesca Mazzia, Jeff R. Cash, and Karline Soetaert. A test set for stiff initial value problem solvers in the open source software R: Package deTestSet. J. Comput. Appl. Math., 236(16):4119–4131, 2012. Francesca Mazzia and Donato Trigiante. A hybrid mesh selection strategy based on conditioning for boundary value ODE problems. Numer. Algorithms, 36(2):169–187, 2004. F. Mazzia (coordinator). Test Set for Boundary Value Problem Solvers, release 0.5. Department of Mathematics, University of Bari and INdAM, Research Unit of Bari, July 2014. Available at http://www.dm.uniba.it/~bvpsolvers/ testsetbvpsolvers. K. Soetaert, J. R. Cash, and F. Mazzia. Solving Differential Equations in R. Springer, 2012.
020009-4