Home
A Multi-Adaptive ODE-Solver
Contents
1. S amp S Or Figure 4 9 The figure shows the stability function s s t for the y component of the Lorenz system The other two components are similar to this one 4 5 True Error vs the Error Estimate In this section we return to the first simple example the harmonic oscillator and compare the true error to the error estimate Ideally the true error is smaller than and close to the error estimate Is this the case for the multi adaptive cG q method proposed in this work To check the reliability of the solver the solution of eq 4 1 was com puted with T 100 at a large number of tolerances The results are given for cG q q 1 2 3 in figure 4 10 31 A Multi Adaptive ODE Solver True Error o o g 0 97 0 8 0 9 E Ez a 08 9 6009 ES 5 0 75P 2 5 o 0 7 Br PAS S S o e O O 0 6 0 7 9 o 3 S o 8 oo E o 0 560 0 95 0 65 0 4 0 0 5 1 0 0 5 1 0 0 5 1 Error Estimate 10 Error Estimate 10 Error Estimate 10 Figure 4 10 True error vs error estimate for multi adaptive cG 1 cG 2 and cG 3 respectively Solid lines indicate the ideal maximum size of the true error As can be seen the true error is smaller than and close to the error estimate for the three methods For this specific problem at these specific tolerance lev els the error for the cG
2. uius 4 4 Ua uius uzus Us Ust UgUz u 0 1 1 3 3 3 The solution is obviously u t et e t 1e t Lett 1650 33 A Multi Adaptive ODE Solver A comparison between true error and error estimate is given in figure 4 12 for the multi adaptive cG 1 method Also for this nonlinear problem the true error is smaller than and close to the error estimate as desired x10 1r 1 0 9 0 9 F 1 HSD oD 86 OS 998 0 8 0 8 94 0 7 20 7 4 a 0 6 d 0 6 E fag es 0 5 v 05 1 B 5 E H 0 4 7 0 4 B E 0 3 0 3 1 0 2 0 2 4 0 1 0 1 F 4 0 j 0 0 0 2 0 4 0 6 0 8 1 0 0 2 0 4 0 6 0 8 1 Error Estimate x 107 Error Estimate x 107 Figure 4 12 True error vs error estimate for the multi adaptive cG 1 method The solid lines indicate the ideal maximum size of the true error Finally notice that these results were all obtained automatically the only data specified being the equation including initial data and the tolerance The equations were then solved automatically including the solution of the dual problem which was automatically generated by numerical differentiation of the given equation and error estimation giving a resulting final error smaller than the given tolerance 34 CHAPTER 5 Conclusion As was shown in the previous section the correlation between error and error estimate is as desired for the three meth
3. 15 A Multi Adaptive ODE Solver Ry u t Gg Eijo I Mig FH LN 2 20 is we get for Y P 1 I and some nij I j em des Vi 221 aj aj Thus Ii Rip differs from zero and we get an additional term in our error estimate continuing from eq 2 11 Jo Rp Yi Jo Bes Y VE bs Ripi Films Ri Er Dy 8 Ble 9 Pils Fs XX Ej Ca kli supr Iul Sr let Ralsupz f l N Mi i i FP XX X Curt Ril Sr Fail sup l d gt 2 22 lle T IA Q if we choose Y close to y 2 3 3 Other Error Contributions Other error contributions that are not dealt with here are quadrature errors and numerical errors due the finite precision arithmetic 2 4 Adaptivity Introducing the stability function defined by si t Sij sup lo tE 1 i 1 N 2 23 lij and the stability factor defined by 16 A Multi Adaptive ODE Solver T S T of i 1 N 2 24 0 the error estimate 2 13 may be written in two alternative ways as N Mi 1 25173 Ca aight SUP r Ril N i ia Cy Si SUP 0 T ki R The stability properties are obtained by numerical approximation by the multi adaptive cG q method of the solution of the dual problem Notice that the error contribution from the non zero discrete residual is not included in these expressions since I have chosen to base the adaptivity on the Ga
4. 3 Compiling Compile the library and the X interface by typing gt gt make A Multi Adaptive ODE Solver in the Tanganyika 1 0 directory The library and the X interface will now compile If not something went wrong and hopefully you know how to deal with it This will also generate the file antananariverc in your home direc tory 4 Running the demo Check if you managed to compile the library cor rectly by typing gt gt demo in the Tanganyika 1 0 bin directory This should result in some text output ending with something like essage Computing error estimat essage done essage Error estimate 7 526e 04 lt TOL 1 000e 03 essage Error estimate small enough so I m done essage Saving essage done and data stored in the file tst data together with a MATLAB m file You may also want to run the X interface by typing gt gt antananarive in the same directory 5 Completing the Installation Complete the installation by putting the generated files wherever you want them You may want to do the fol lowing assuming the current directory is the Tanganyika 1 0 direc tory e Place the X interface Type e g gt gt cp bin antananarive usr local bin or gt gt cp bin antananarive usr bin A Multi Adaptive ODE Solver e Place the library header file Type e g gt gt cp include tanganyika h usr include e Place the library Type e g gt gt cp lib lib
5. Chalmers Finite Element Center Department of Mathematics Chalmers University of Technology G teborg Sweden 1998 Jag har en syster i Tanganyika A Multi Adaptive ODE Solver B 1 Introduction The Tanganyika library is a multi adaptive solver of initial value problems for ordinary differential equations The method used for solving the equations is a variant of the cG g q 1 2 3 finite element method The solver is adaptive in the sense that the size of the timesteps is chosen small enough to give an error smaller than the given tolerance equidistributing the error onto the different intervals The solver is multi adaptive in the sense that the timesteps are chosen individually for the different components For further details on the solver download the report A Multi Adaptive ODE Solver from http www dd chalmers se f95logg Tanganyika The Tanganyika X interface Antananarive is just that an X windows in terface for the Tanganyika Library B 2 Download To download the Tanganyika library and X interface goto http www dd chalmers se f951ogg Tanganyika click the link named Download and follow further instructions on this page You will then receive the whole package containing everything you need almost In addition you must also have GTK the Gimp ToolKit installed on your system GTK is used by the X interface for drawing the buttons If you just want to use the library and if you can do without th
6. ETE II mm TUBE T m a I A Multi Adaptive ODE Solver Anders Logg Master of Science Thesis in Engineering Physics med inriktning teknisk matematik Examensarbete f r civilingenj rsexamen i teknisk fysik Chalmers University of Technology G teborg Sweden Chalmers Finite Element Center 1998 Department of Mathematics Anders Logg 1998 The front page shows three different discretizations for a multidimensional system of equations The first one is a non adaptive discretization the second one is an adaptive discretization and the third one is a multi adaptive discretization This document was generated with ATEX on Solaris 2 6 at dd chalmers se The font is Palatino 10pt This report as well as the code implementing the method proposed in it are available for down load at http www dd chalmers se f9510gg Tanganyika Computations have been made with the Tanganyika multi adaptive ODE solver library available for download at http www dd chalmers se f9510gg Tanganyika on Linux 2 0 In tel Pentium 200MHz and on Solaris 2 6 Sun Ultra 1 Model 170 G teborg October 3 1998 Abstract In this work I present a multi adaptive finite element method for initial value problems for ordinary differential equations including an a posteriori estimate of the error The method is multi adaptive in the sense that the resolution of the time discretization is chosen individually for each component
7. A FN VASA TG NN m mm Figure3 1 This is how the individual stepping is done The different components tell send their respective positions and in turn they get their interactions with forces from the other components Thus just as in nature itself progress is made by the exchange of information small pieces of informa tion gravitons or perhaps femions 3 2 Quadrature The integrals of eq 2 7 are evaluated by Gaussian Gauss Legendre quadra ture Since the order of the weight functions for the integrals of a cG q method are q 1 we expect the total order of the integrands to be of order g q 1 20 A Multi Adaptive ODE Solver 2q 1 and even more if f is of quadratic or higher order It would thus be wise to use quadrature that is exact at least for polynomials of order 2q 1 which is exactly the case for Gaussian quadrature with g nodal points Thus midpoint quadrature for cG 1 two point Gaussian quadrature for cG 2 and so on 3 3 The Program The method has been implemented as a library called Tanganyika To use the library functions all one needs to do is to include lt tanganyika h gt in one s C C program For more details refer to the Tanganyika User Manual included in Appendix B For even more details all download the source code see chapter 6 3 3 1 Language The language of the Tanganyika library is C although its interface is pure C An object oriente
8. 0 B 5 1 Introduction What is this program anyway This program is an interface for the Tanganyika multi adaptive ODE solver li brary All it does is to call the library functions to generate a program from given user data This program is then compiled using g or whichever com piler you prefer This may be changed in the settings menu or in the antananariverc file in your home directory The compiled program will output data to files file path specified in the options menu in Matlab format Two files will be generated one data and one m Data from the solution is stored ASCII in the first of these files Typing the filename in Matlab will call the m file reading all data properly from the dat a file The compiled program may be run either from this program the Tanganyika X interface version 1 0 or manually from a shell If you run the compiled pro gram from this program you get the benefit of parsed output as messages and 12 A Multi Adaptive ODE Solver progress bars The Tanganyika X interface will read output from the gener ated program at standard output B 5 2 Using the program Step by Step All you have to do is to press open edit save make solve in that order Below follows a more detailed description 1 Open a xt file specifying the system of ordinary differential equations by pressing the Open button and then choosing a xt file The suffix is not
9. B 5 5 tele syntax i ie RoE od a ea ara e Anu B 5 6 Download Updates Further Information B 6 GNU General Public License 36 37 39 MS CHAPTER 1 Introduction Numerical methods for solving initial value problems for ordinary differential equations have been around for a long time and the number of methods is almost as large as the number of equations Common methods such as the ones supplied with Matlab ode45 ode23 ode113 ode whatever are often fast meaning that they terminate in a short time These methods often provide some sort of local error control where the error is controlled in some way in each integration step This however does not mean control of the global error Although a tolerance is specified it is not related otherwise than by some hopefully monotonically increasing and otherwise unknown function to the global error of the solution The program is thus not concerned with the actual value of the error leaving the user unaware of the quality of the computed solution In fact it was wrong Bill Clinton 1998 Using such a classical numerical solver usually means solving the problem at a number of different tolerance levels for the local error and comparisons between these solutions Error control is thus perhaps obtained manually A Multi Adaptive ODE Solver This manual effort should also be taken into account when comparing the effi cie
10. Lagrange basis functions R R are then defined on T for k 0 qi by t tijo t tig 1 t Gen tija Aijk u U 2 5 tije tijo gt tijk taki tage Gk tage On the interval U may then be written uniquely as Gi Ui Gaga 2 6 k 1 for some values amp jr Inserting this into eq 2 4 computing a few integrals simple but tedious and solving the resulting system of linear algebraic equations yields amp fij Waa Tis 2 AT bt gijo fij War Tis t t dt 2 7 Ea Jo Waid rij t t dt t ti j 1 where 7 t u and the tj are polynomial weight functions These are given in table 2 1 for q 1 2 3 w11 7 T wa r 4 5 1 37 37 96r 6072 26 247 607 1 Table 2 1 Weight functions for the cG q integrals q 1 2 3 12 A Multi Adaptive ODE Solver 2 2 2 Even more Flexibility Note that we could have allowed each component to be piecewise polynomial without beforehand fixing the degree of the polynomial on the whole of the discretization We could thus have allowed the polynomial degree to change from one interval to the next The method would then be even p adaptive choosing the in some sense best degree of the polynomials for every single interval For simplicity though the polynomial degrees
11. These actions are prohibited by law if you do not accept this License Therefore by modifying or distributing the Program or any work based on the Program you indicate your acceptance of this License to do so and all its terms and conditions for copying distributing or modifying the Program or works based on it 6 Each time you redistribute the Program or any work based on the Program the recipient automatically receives a license from the original licensor to copy distribute or modify the Program subject to these terms and conditions You may not impose any further restrictions on the recipients exercise of the rights granted herein You are not responsible for enforcing compliance by third parties to this License 7 If as a consequence of a court judgment or allegation of patent infringement or for any other reason not limited to patent issues conditions are imposed on you whether by court order agreement or otherwise that contradict the conditions of this License they do not excuse you from the conditions of this License If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations then as a consequence you may not distribute the Program at all For example if a patent license would not permit royalty free redistribution of the Program by all those who receive copies directly or indirectly through you then the only way you could satisfy both it and this Licens
12. have been chosen to be qi rather than q The difference would be an extra index j on q 2 3 Error Estimation The error estimate is obtained starting the same way as in references 1 4 and 10 To estimate the error at final time in the norm the dual problem of eq 2 1 is introduced The dual problem is F0 I u U t p t t 0 7 28 p T where e U is the error is the norm and J is defined as 1 of U a su 1 s U Jas 2 9 0 i e J is the transpose or more generally the adjoint of the Jacobian of f at mean value of u and U Note now that by the chain rule J uU U w 1 sJU ds u U k gf su 1 s U ds 2 10 f F U We may thus write 13 A Multi Adaptive ODE Solver lem 0 p 0 pe p J u U lelt eO 8 Jo fo le D U J E So p x Jo Flu U je p 2 11 Hog g IE EN gt gt 2 ges NONE SE SS e E 5 T o 9 where is the residual i e R f U 0 2 12 Using the finite element formulation for 7 we continue to get lle E lm Li DR A P Viol Ye i Ri pi Pi 2 13 N M Mia M supr Ri fr lei Pil Ya 355 sup Ful l where the are constants IA IA 2 3 1 The Consta
13. is where the C and bin files will be generated Compiler This is the name of the C compiler present in your system CFLAGS These flags are passed to the compiler specifying e g code optimiza tions INC_PATH This is where the compiler will look for include files LIB_PATH This is where the compiler will look for libraries 1 ib files B 5 4 Options Start Time Well this is the start time the value of at the beginning End Time And this would then be T the value of t at the end of the solution Tolerance This is the value of the tolerance for the I norm error of the solution at t T Output filename This is the file in the current working directory where the generated pro gram will store the solution B 5 5 xt file syntax e You have to specify four things The size of the system N Initial data UV Equations Fii Methods M i A Multi Adaptive ODE Solver e All data must end with a semicolon e at the beginning of a line means a comment i e this line will not be interpreted e Indices begin with 0 e Specification of equations must be C syntax You may thus not write 5 U 2 U 1 2 sqrt abs U 3 Instead you must write 5 U 2 pow U 1 2 sqrt fabs U 3 e Methods are specified as integers 1 2 or 3 for cG 1 continuous first order Galerkin cG 2 continuous second order Galerkin and cG 3 continuous third order Galerkin respec
14. of the system of ordi nary differential equations based on an estimation of the error The method has been successfully implemented in the Tanganyika library available for download Included are a few example computations made with this library as well as instructions for downloading and using the package Acknowledgements I wish to thank e Claes Johnson my advisor for his continuous encourage ment and support in the making of this project e Rickard Lind Mathias Brossard and Andreas Brinck for beta testing the programs e Jim Tilander for his expertise help with C e Greger Cronquist for some useful hints on the typesetting e Goran Christiansson for proof reading the manuscript e Anna for letting me do this all summer Contents 1 Introduction 7 11 Quantitative Error Control 8 1 2 M ltizAdaptvity vase l greed om era G eran 9 2 The Method Multi Adaptive Galerkin 10 2 1 Equation s sv ened seerne oed a PUE C ent 10 22 Finite Element Formulation 11 22 1 Details x see Ohne Bee edP ES 12 222 13 2 3 ErrorEstimation CC Coon 13 231 TheConstant Og llle 14 2 3 5 Correction of the Error Estimate 15 2 3 3 Other Error Contributions 16 240 Adaptivity Er lp e e DE RE KE ALS 16 24 1 Moderating the Choice of Timesteps 18 2 4 2 Choosi
15. really important so there may be xt files without the xt suffix Edit the equations by pressing the edit button The contents of the opened file will then be editable in the text window Of course you don t have to edit the file if you don t wanna change anything but remember to save the file before moving on to compiling the program as the pro gram will be generated from the file and not from the contents of the text window For information on the syntax see the section below xt file syntax Save the changes if you made any by pressing the save button and then typing choosing a file name Note that the xt suffix will not be added automatically Generate the program and compile it by pressing the make button A C file will then be generated in the working directory specified in the settings menu This file is then compiled and the output program will be filename bin also in the working directory Solve the equations by pressing the solve button This will run the generated program and parse its output to update the progress bars and typing status of the solution By the way the upper of the two progress bars is for the forward solution the solution of the equations you speci fied and the one below is for the solution of the dual backward problem that is solved to estimate the error of the solution 13 A Multi Adaptive ODE Solver B 5 3 Settings Working directory This
16. t 0 we expect a propagation of the timesteps At the beginning all but one mass are at rest so the timesteps for these masses may be large As the oscillations of a mass increase the corresponding timesteps should decrease and oscillate This is also the case according to figure 4 4 25 A Multi Adaptive ODE Solver 0 6 0 6 0 6 0 4 0 4 0 4 0 2 0 2 02 50 Eo E o 0 2 0 2 0 2 0 4 0 4 0 4 0 6 0 6 0 6 0 8 0 8 0 8 0 5 7 10 15 0 5 i 10 15 0 5 10 15 0 05 0 05 0 05 0 04 0 04 0 04 _0 03 20 03 9 03 SE E 0 02 0 02 0 02 ZI 0 01 0 01 0 0 0 0 5 7 10 15 0 5 10 15 0 5 10 15 Figure 4 4 Solutions for components 1 5 and 10 of a system consisting of 10 masses and 11 springs together with their respective timesteps solved at TOL 5 107 with the multi adaptive cG 1 method 4 3 Gravitation As a third example consider a system of three bodies planets in a somewhat complicated situation where one of the planets is in orbit around a larger one and a third even smaller planet comes in making sort of a weird sling shot around the smaller planet The forces involved are 1 r and for a certain choice of initial conditions the solution is as depicted in figure 4 5 below for TOL 001 solved with the multi adaptive cG 2 method 26 A Multi Adaptive ODE Solver 0 5F x Figure 4 5 Orbits for the three planets The circles drawn represent the planets at time
17. the Program is not restricted and the output from the Program is covered only if its contents constitute a work based on the Program independent of having been 17 A Multi Adaptive ODE Solver made by running the Program Whether that is true depends on what the Program does 1 You may copy and distribute verbatim copies of the Program s source code as you receive it in any medium provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty keep intact all the notices that refer to this License and to the absence of any warranty and give any other recipients of the Program a copy of this License along with the Program You may charge a fee for the physical act of transferring a copy and you may at your option offer warranty protection in exchange for a fee 2 You may modify your copy or copies of the Program or any portion of it thus forming a work based on the Program and copy and distribute such modifications or work under the terms of Section 1 above provided that you also meet all of these conditions a You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change b You must cause any work that you distribute or publish that in whole or in part contains or is derived from the Program or any part thereof to be licensed as a whole at no charge to all third parties under the terms of this Li
18. the resid uals and stability functions These are shown together with the resulting 22 A Multi Adaptive ODE Solver timesteps in figure 4 1 Note also the approximate equidistribution of the error Solution 0 03 0 02 0 01 0 L 1 L L 1 J 0 5 10 15 20 25 30 35 40 45 50 Figure 4 1 The solution of the simple harmonic oscillator problem the errors and the timesteps respectively 23 A Multi Adaptive ODE Solver i 1 1 2 0 015 0 015 0 01 0 01 0 005 0 005 0 0 0 10 15 20 0 5 10 15 20 1 1 gt 0 5 0 5 0 0 0 10 15 20 0 5 10 15 20 0 03 0 03 0 02 0 02 e 0 01 0 01 9 5 15 20 5 15 20 Figure 4 2 Residuals stability functions timesteps for the two components of the harmonic oscillator problem shown for the interval 0 20 4 2 Wave Propagation in an Elastic Medium As a second example consider wave propagation in an elastic medium rep resented by a number of masses connected with springs according to figure 4 3 Figure 4 3 A system of N masses and N 1 springs 24 A Multi Adaptive ODE Solver The proper equations are easily obtained from Newton s second law of mo tion d Az where 2 1 1 2 1 0 1 2 1 ya 4 2 B 1 2 0 1 This may also be thought of as a FEM space discretization of the wave equa tion With initial conditions corresponding to all but one masses being at rest at
19. 1 method is mostly discretizational error arising from the finite element discretization of the error whereas for the cG 3 method the error is mostly mostly computational arising from a non zero discrete resid ual For the cG 2 method the situation is somewhere in between This ex plains the different variances in error tolerance correlations for the three meth ods Notice also how sharp the error estimate is especially for the cG 1 method Again this is due to the fact that at this tolerance level most of the error is the usual finite element discretizational error for the cG 1 method For comparison the same computations were performed with the often used MATLAB ODE solver ode45 As can be expected with a solver lacking 32 A Multi Adaptive ODE Solver global error control the tolerance is only nominal in the sense that its correla tion to the true error is unknown 3000 2500 9 y 2000 H g 1500 2 E B E 1000 5 O o 90 500 9o Oo 00000 22000000000000000000000000 100 0 0 02 0 4 0 6 0 8 Tolerance x10 Figure 4 11 True error tolerance vs tolerance for MATLAB s ODE solver ode45 The above comparisons between true error and error estimate were made for a simple 2 component linear system We conclude this section by showing the results for a computation on the following nonlinear problem u Uu z F uu
20. WARRANTY OF ANY KIND EITHER EXPRESSED OR IMPLIED INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU SHOULD THE PROGRAM PROVE DEFECTIVE YOU ASSUME THE COST OF ALL NECESSARY SERVICING REPAIR OR CORRECTION 12 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER OR ANY OTHER PARTY WHO MAY MODIFY AND OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE BE LIABLE TO YOU FOR DAMAGES INCLUDING ANY GENERAL SPECIAL INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES END OF TERMS AND CONDITIONS fin
21. al value problems for ordinary differential equations see 8 and FEMLAB solver of partial differential equations The current approach to quantitative error control was originated with the article by Johnson 9 in 1988 discussing error estimation for the dG 0 and dG 1 methods Error estimation for these methods are further discussed by Estep in 5 The cG q method which is the basis for the multi adaptive method presented in this report is discussed at length in 7 A more classi cal approach to error analysis can be found in 11 A comprehensive and major article on adaptive methods for differential equations is 3 A general and non technical discussion on error control and adaptivity is 6 A Multi Adaptive ODE Solver 1 2 Multi Adaptivity It is desirable in short that in things which do not primarily concern others individuality should assert itself John Stuart Mill On Liberty 1909 If we view a system of ODE s as the representation of a mechanical system and notice that different parts components of such a system may behave very differently some parts oscillating very rapidly and others slowly perhaps undergoing even uniform motion we realize that different components of an ODE system may be differently sensitive to the resolution of the discretization There is obviously a need for multi adaptivity allowing individual components of an ODE system to use individual timesteps Normally the same t
22. be declared as void FunctionName double dProgress Code goes here bErrorEstimation should be true or false telling whether or not an error estimate should be computed If false no dual problem will be solved and the given tolerance will only be nominal in the sense that it won t necessarily be close to the true error However a smaller nominal tolerance will probably mean a smaller error InitializeSolution will return true upon successful initialization of the solution and false if something went wrong i e if e g the data passed was illegal A negative tolerance or whatever 11 A Multi Adaptive ODE Solver B 4 4 ClearSolution Call this function to free all memory used by the library B 4 5 Solve Call this function to solve the equations after having done InitializeSolution The return value will be true or false depend ing on whether or not the computation was successful 4 6 Save Call this function to save data from the computation MATLAB format This will generate two files One filename m file and one filename data file where filename is the filepath specified by cFileName The first of these is called from MATLAB by typing the name of the file excluding the m ex tension which will load the data stored in the second one into the proper variables B 5 The Tanganyika X interface Antananarive This is a tutorial for Antananarive the Tanganyika X interface version 1
23. cense c If the modified program normally reads commands interactively when run you must cause it when started running for such interactive use in the most ordinary way to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty or else saying that you provide a warranty and that users may redistribute the program under these conditions and telling the user how to view a copy of this License Exception if the Program itself is interactive but does not normally print such an announcement your work based on the Program is not required to print an announcement These requirements apply to the modified work as a whole If identifiable sections of that work are not derived from the Program and can be reasonably considered independent and separate works in themselves then this License and its terms do not apply to those sections when you distribute them as separate works But when you distribute the same sections as part of a whole which is a work based on the Program the distribution of the whole must be on the terms of this License whose permissions for other licensees extend to the entire whole and thus to each and every part regardless of who wrote it Thus it is not the intent of this section to claim rights or contest your rights to work written entirely by you rather the intent is to exercise the right to control the distribution of derivative or collective works based o
24. d programming language such as C is obviously well suited for such a program like the Tanganyika library viewing the different objects as classes Solution Component Element etc 3 3 2 Modularity A nice feature of the C programming language is the use of class derivation and inheritance enabling a modular implementation of the different methods Implemented in the current version 1 0 of the library are cG 1 cG 2 and cG 3 but the implementation of another method such as e g dG 0 would require only the implementation of a new subclass specifying only what differs from the already existing methods This would in reality mean perhaps 50 lines of code 21 CHAPTER 4 Results In this chapter I present the results from a few computations made with the Tanganyika library 4 1 A First Simple Example As a first simple example consider the following system of equations ul ug tig u in 0 T 4 1 u 0 0 1 The solution is of course u t sin t cos t The equations are solved by the multi adaptive cG 1 method with tolerance 8 1074 and T 50 The tolerance was actually chosen to be 001 The resulting error estimate was however 8 1074 The true error is according to figure 4 1 6 8 1074 and the component errors are 5 3 1074 and 4 2 107 respectively Note the behaviour of the multi adaptive method choosing different timesteps for the two methods The timesteps are chosen on basis of
25. different functions B 4 3 InitializeSolution Use this function to tell the library what to solve The data passed to this func tion are described below 1 dInitialData should be a valid pointer to a block of doubles specify ing the initial data for the problem i e e g double dInitialData dInitialData 0 dInitialData 1 new double 2 E c OO se se 2 dStartTime should be a double specifying the time t at the beginning of the solution You probably want to pass 0 for this argument 3 dEndTime should be a double specifying the time t at the end of the solution such as e g 10 4 dTolerance should be a double specifying the tolerance for the norm of the error at the end of the solution The library will try to solve the equations with an error that is smaller than this tolerance A Multi Adaptive ODE Solver 5 fFunction should be a pointer to a function specifying the equations being t f u t u t ER B 1 i e e g double f double U double int ilndex switch iIndex case 0 return U 1 case 1 return sqrt U 1 U 0 default return 0 0 In this example the name of the function that must be declared with the parameter list as above is so the reference that should be passed to InitializeSolution is simply the name of the function ie 6 iMethods should be a valid pointer to a block of ints specifying the m
26. e buttons you don t need GTK However if you do want the X interface and you don t have GTK download GTK from http www gtk org and install it according to the instructions B 3 Installation If you haven t realized that until now you should be on a Unix system Linux SunOS Solaris For the following instructions it is assumed that com mands are typed to a shell bin bash bin sh bin tcsh ie prob ably in an xterm Commands are written as A Multi Adaptive ODE Solver gt gt command Note that you shouldn t type the gt gt Oh well you probably know all this but just in case you re one of our sysadmins at dd chalmers se 1 Unpacking The first thing you need to do is to unpack the Tanganyika source code To do this type gt gt unzip tanganyika l 0 zip or the corresponding command for uncompression if you choose to down load another format This will create a directory with a couple of sub directories named Tanganyika 1 0 2 Configuring Edit the file defs in the Tanganyika 1 0 library for the variables to match your system It should probably look something like this CC LINK g g INCLUDE_PATH I usr include I usr include g LIBRARY_PATH L usr lib as it does on my Linux 2 0 or CC g LINK g INCLUDE PATH I opt gnu include LIBRARY PATH L opt gnu lib R opt gnu lib as it does on Sun Solaris 2 6 at dd chalmers se
27. e would be to refrain entirely from distribution of the Program If any portion of this section is held invalid or unenforceable under any particular circumstance the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system it is up to the author donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License 8 If the distribution and or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries so that distribution is permitted only in or among countries not thus excluded In such case this License incorporates the limitation as if written in the body of th
28. eans all the source code for all modules it contains plus any associated interface definition files plus the scripts used to control compilation and installation of the executable However as a special exception the source code distributed need not include anything that is normally distributed in either source or binary form with the major components compiler kernel and so on of the operating system on which the executable runs unless that component itself accompanies the executable 18 A Multi Adaptive ODE Solver If distribution of executable or object code is made by offering access to copy from a designated place then offering equivalent access to copy the source code from the same place counts as distribution of the source code even though third parties are not compelled to copy the source along with the object code 4 You may not copy modify sublicense or distribute the Program except as expressly provided under this License Any attempt otherwise to copy modify sublicense or distribute the Program is void and will automatically terminate your rights under this License However parties who have received copies or rights from you under this License will not have their licenses terminated so long as such parties remain in full compliance 5 You are not required to accept this License since you have not signed it However nothing else grants you permission to modify or distribute the Program or its derivative works
29. erval will be large A large timestep will often result in a large residual which in turn in the same way means the timestep of the next interval will be small There is thus a chance the timestep will oscillate if it is only based on the residual of the last interval What needs to be done is to make sure the timesteps and thus also the residuals don t differ too much between adjacent intervals This may be done in a lot of different ways e g by choosing the harmonic mean of the previous timestep and the value of the new timestep as based on the residual The Tanganyika library uses a somewhat more sophisticated moderation of the timesteps 2 4 2 Choosing Data for the Dual Problem According to eq 2 8 we need to know the true error in order to solve the dual problem If we indeed knew the true error we would not have to bother with any of this and since the true error is unknown we have to make a clever guess We now discover another benefit of multi adaptivity it makes it easier for us to estimate the data for the dual problem Since we equidistribute the error onto the different components an estimation of the proper data for the dual problem should be 1 VN N being the dimension for the different com ponents The signs for the different components may be obtained by solving at different tolerance levels Since however we don t know the stability properties of the problem until the computation is done we cannot expec
30. ethods to be used for the different components Valid values are TAN_METHOD_CG1 TAN_METHOD_CG2 and TAN_METHOD_CG3 7 iSizeOfSystem should be an integer specifying the size of the system i e the number of equations 8 iMessageOutput should be an integer specifying the desired type of output from the library during solution Valid values are TAN_OUTPUT_DEVNULL TAN OUTPUT COUT TAN OUTPUT CERR TAN OUTPUT COM 10 A Multi Adaptive ODE Solver 10 These will set the adress of output from the program AN OUTPUT DEVNULL means no output will be written AN OUTPUT COUT means output will be to standard output TAN_OUTPUT_CERR means output will be to standard error TAN OUTPUT COM means output will be to standard output in a special format that may be interpreted by e g the Tanganyika X interface With this output set the current status of the program will be written to stan dard output as STAT iStatus where iStatus is one of TAN FORWARD PROBLEM TAN DUAL PROBLEM or TAN_ERROR_ESTIMATE indicating what is going on Progress should be a pointer to a function that will be passed the progress of the computation the progress being a number between 0 and 1 This might be useful for updating e g progress bars The Tanganyika X interface does not use this for updating the progress bars Instead the progress is parsed from the output The function should
31. he software is modified by someone else and passed on we want its recipients to know that what they have is not the original so that any problems introduced by others will not reflect on the original authors reputations Finally any free program is threatened constantly by software patents We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses in effect making the program proprietary To prevent this we have made it clear that any patent must be licensed for everyone s free use or not licensed at all The precise terms and conditions for copying distribution and modification follow TERMS AND CONDITIONS FOR COPYING DISTRIBUTION AND MODIFICATION 0 This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License The Program below refers to any such program or work and a work based on the Program means either the Program or any derivative work under copyright law that is to say a work containing the Program or a portion of it either verbatim or with modifications and or translated into another language Hereinafter translation is included without limitation in the term modification Each licensee is addressed as you Activities other than copying distribution and modification are not covered by this License they are outside its scope The act of running
32. imestep is used for all components of an ODE system The novelty of multi adaptivity is thus allowing individual adaption of the timesteps for the different components Figure 1 1 These are the actual timesteps used for an example computation on a simple two dimensional system CHAPTER 2 The Method Multi Adaptive Galerkin This chapter describes the multi adaptive method complete with an a posteri ori error estimate The basis for the multi adaptive method is a generalization of the continu ous Galerkin method cG q described in e g 4 2 1 Equation The equation to be solved is S t fut te 0 T dt 3 975 OV em 2 1 where f f fw is some function depending on the solution u u1 un and t which may represent time Mn order to guarantee the existence of a unique solution it may be good to know that f is Lipschitz continuous 10 A Multi Adaptive ODE Solver 2 2 Finite Element Formulation The weak variational formulation of equation 2 1 reads Find u t such that u 0 uo and T T f u v f v for all test functions v 2 2 0 0 where denotes the usual inner product To define the multi adaptive cG q method we introduce the trial space Vj and the test space WW of functions on 0 T where VN v v PY ljj j 1 Mi vi is continuous i 1 N wy fv mePY UL j 1 M i i 1 N Thus v V means that a
33. is License 9 The Free Software Foundation may publish revised and or new versions of the General Public License from time to time Such new versions will be similar in spirit to the present version but may differ in detail to address new problems or concerns Each version is given a distinguishing version number If the Program specifies a version number of this License which applies to it and any later version you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation If the Program does not specify a version number of this License you may choose any version ever published by the Free Software Foundation 10 If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different write to the author to ask for permission For software which is copyrighted by the Free Software Foundation write to the Free Software Foundation we sometimes make exceptions for this Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally 19 NO WARRANTY 11 BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE THERE IS NO WARRANTY FOR THE PROGRAM TO THE EXTENT PERMITTED BY APPLICABLE LAW EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND OR OTHER PARTIES PROVIDE THE PROGRAM AS IS WITHOUT
34. lerkin discretizational error alone However the contribution from the non zero discrete residual is of course included in the computation of the error estimate and thus indirectly also in the adaptive procedure Adaptivity is then based on the expression le 2 25 Er lt lt l e T error estimate TOL 2 26 where TOL is a given tolerance for the error of the solution at time t The discretization is now chosen by equidistribution of the error both onto the different components and onto the different intervals i e TOL 1 En C sig kj sup Ril gg 2 27 Alternatively we may whish to do TOL JOR 2 28 Ca S sup 0 T Knowing thus the residuals and the stability functions or factors we may choose the proper timesteps This is done in a way that is iterative in two respects Firstly the timestep for an interval is chosen based on the residual in the previous interval Secondly the M are not known until the end of the computation The values M are then a more or less clever guess based on a previous computation Of course having computed the solution we don t have to guess these values to compute an error estimate 17 A Multi Adaptive ODE Solver 2 4 1 Moderating the Choice of Timesteps Choosing timesteps as described in the previous section without any extra moderation may cause problems If the residual in one interval is small the timestep of the next int
35. ll its components v are continuous and piecewise polynomial on the intervals Ho and v W means that all its compo nents v are in general discontinuous and piecewise polynomial of one degree less on the same intervals as the corresponding trial function The multi adaptive 9 method is then Find U V such that U 0 uo and T T J v x f v Vv e WR 2 3 0 0 The discontinuity of the test functions means we may rewrite this as Find such that U v fiv Vv 1 1 j 1l Mii 1l N 2 4 lij lij U 0 ug and U is continuous where the j are the parameters determining the piecewise polynomials Ui Note that there are 4 1 parameters determining a polynomial of degree q so the index k is from zero to q Finding the parameters amp in agreement with eq 2 4 yields the de sired solution What remains is to find the proper discretization J i e the timesteps k To choose the timesteps we need an error estimate which will be the basis for adaptivity By means of this error estimate the discretization will be chosen in a way to give a resulting final error smaller than the specified tolerance 11 A Multi Adaptive ODE Solver 2 2 1 Details The parameters j may e g be the nodal values for a subdivision of the intervals into q subintervals For an interval J let the nodal points of an equipartition of this interval be The corresponding nodal
36. n the Program In addition mere aggregation of another work not based on the Program with the Program or with a work based on the Program on a volume of a storage or distribution medium does not bring the other work under the scope of this License 3 You may copy and distribute the Program or a work based on it under Section 2 in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following a Accompany it with the complete corresponding machine readable source code which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange or b Accompany it with a written offer valid for at least three years to give any third party for a charge no more than your cost of physically performing source distribution a complete machine readable copy of the corresponding source code to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange or c Accompany it with the information you received as to the offer to distribute corresponding source code This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer in accord with Subsection b above The source code for a work means the preferred form of the work for making modifications to it For an executable work complete source code m
37. ncies of different solvers 1 1 Quantitative Error Control Using a posteriori estimates of the error i e error estimates based on the com puted solution it is possible to accurately control the size of the global error Finite elements present a general framework for solving differential equa tions such as e g initial value problems for ordinary differential equations considered in this report Depending on the choice of basis functions nor mally piecewise polynomials of different kinds the result is a new step method for solving the initial value problem These methods include cG 1 cG 2 dG 0 dG 1 Efficieny is obtained by adaptivity putting the computational effort where it is most needed For initial value problems this usually means adjusting the size of the timestep thus choosing the timestep to be small where the solution is especially sensitive to errors in the numerical method Proper a posteriori error control requires knowledge of the stability of the problem Stability properties are in general obtained by solving a so called dual problem Thus error control requires some extra effort from the solver which in some cases is comparable to the effort of solving the problem itself Work on quantitative error control during the last ten years see references 1 10 has resulted not only in extensive theoretical results but also in work ing implementations of the methods such as e g CARDS solver of initi
38. ng Data for the Dual Problem 18 3 The Implementation Tanganyika 19 3 1 Individual Stepping oo rer a 19 3 1 1 Organization Book Keeping 20 3 2 Quadrature od sans DTS VR n SEERE 20 A Multi Adaptive ODE Solver 3 3 The Program ne gd een mes hade ert ned SS 331 Language aaa een ht akt ie ene 3 32 Modularity ica ye eg Bae Reg om Ri 4 Results 41 First Simple Example 4 2 Wave Propagation in an Elastic Medium 43 Gravitatio quos sex svak A A 44 Lorenz System 4 5 True Error vs the Error Estimate 5 Conclusion 6 Download Bibliography Appendix A Notation B Tanganyika User Manual B I Introduction gu ms A Bean B2 Download iros ci wed oe dio ck eS B3 Installation 5 ana 2 ee a ed B The Tanganyika Library 41 lt 42 Howtouseit eee B 43 In itileliZ6Soklute bon O nissens XI BAA Cl rSolutifontiy 2 ceded di exem ns B 45 Solve Oi 5 G ae SE ards e us B46 Save die s ke h Ba BG bond ee B 5 The Tanganyika X interface Antananarive B 5 1 Introduction What is this program anyway B 5 2 Using the program Step B537 Settings ea ay ce bi5 4 Options voe Treten st Ve
39. nt C Choosing the test function 7 as the q 1 th order Taylor expansion of y around tij tij 1 2 on ij yields 1 Ge 2 14 The proof is simple Noting that with Fi f zo f zo x o fl D 00 2 z9 7 2 15 1 4 1 14 A Multi Adaptive ODE Solver we have 116 7 60 ly Lg 10 y zo Ddy 216 and thus with zo a 0 2 ee aig fa l So FO zo 7 dy dz 1 b 1 cain Jo le volt de Ja ois 1 la zol b zo Si 2 17 fa f fer FOL IA Another useful estimate see the section on adaptivity below is b FF a C b sup FO 2 18 where 2 1 m 2 1 a en which is obtained as above choosing f to be the q 1 th order Taylor expansion around the midpoint 2 3 2 A Correction of the Error Estimate The method to be used is not because of the difficulty involved with solving eq 2 7 the true multi adaptive cG q method as will be described further in chapter 3 Not solving the equations properly will introduce the discrete residual which should be zero if the discrete equations i e 2 7 were solved properly The fol lowing analysis will result in an extra term in the error estimate 2 13 includ ing the discrete residual together with its proper stability factor accounting for accumulation of errors due to a non zero discrete residual Defining the discrete residual to be
40. ods at least for simple model prob lems Multi adaptivity is thus a reality and the method is already implemented in the Tanganyika multi adaptive ODE solver library This library at least the current version 1 0 was written primarily with the intention to be a working implementation of the multi adaptive method secondarily with the intention to be a general fast and reliable ODE solver Although the current implemen tation is indeed general and reliable it is still not fast and effective enough mainly because of the large amount of work needed to solve the dual problem This has nothing to do with the multi adaptivity itself It is a consequence of the generation and full solution of the dual problem There are cures for this and in future versions more focus will be on speed and effectivity The main focus however will always be on proper error control The facts all contribute only to setting the problem not to its solution Ludwig Wittgentstein Tractatus Logico Philosophicus 1909 35 CHAPTER 6 Download The program is available for download as is this report at http www dd chalmers se 95logg Tanganyika Included in the package is the Tanganyika library containing the actual solver together with Antananarive an X interface for the library The program will run under any not too antique UNIX system such as Linux SunOS Solaris You will also need GTK the Gimp ToolKit for the X interface GTK i
41. ogram whose authors commit to using it Some other Free Software Foundation software is covered by the GNU Library General Public License instead You can apply it to your programs too When we speak of free software we are referring to freedom not price Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software and charge for this service if you wish that you receive source code or can get it if you want it that you can change the software or use pieces of it in new free programs and that you know you can do these things To protect your rights we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the software or if you modify it For example if you distribute copies of such a program whether gratis or for a fee you must give the recipients all the rights that you have You must make sure that they too receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two steps 1 copyright the software and 2 offer you this license which gives you legal permission to copy distribute and or modify the software Also for each author s protection and ours we want to make certain that everyone understands that there is no warranty for this free software If t
42. or Estimates and Adaptive Error Time Step Control for a Class of One Step Methods for Stiff Ordinary Differential Equations SIAM J Numer Anal vol 25 1988 no 4 908 926 10 R SANDBOGE Adaptive Finite Element Methods for Reactive Flow Problems Phd thesis Chalmers University of Technology 1996 11 G DAHLQUIST Error Analysis for a Class of Methods for Stiff Nonlinear Initial Value Problems Lecture Notes in Mathematics 506 Springer Verlag 1976 38 APPENDIX Notation In this chapter I explain the notation used in this report Unfamiliar expressions should in general be explained when first intro duced Since however it is not always clear which expressions are familiar and which are not I include the following list of notation FEM the finite element method which is the basis for the multi adaptive cG q method proposed in this report cG q a Galerkin method with continuous piecewise polynomials of order q multi adaptivity adaptive error control where the discretizations are chosen individually for the different components of and ODE system Tanganyika besides being a geographical location in the south of Africa Tanganyika is the name of the multi adaptive ODE solver library based on this report Antananarive this is the X Windows interface for the Tanganyika library 39 A Multi Adaptive ODE Solver dual problem an auxiliary problem that has to be solved in order to get an estimation of the e
43. rror the solution in this case of the initial value problem 2 1 the finite element approximation of the solution u independent variable often thought of as the time the end value of t the number of dimensions components of the ODE system the number of intervals for the subpartition of 0 T for component i the trial space for our finite element formulation the test space for our finite element formulation the solution of the dual problem the error of our approximate solution i e U u the Jacobian of f in eq 2 1 the residual i e f U U the size of the j th timestep for component i i e the length of the interval lij 40 A Multi Adaptive ODE Solver numerical constants appearing in the error estimates R the discrete residual i e the residual of the discrete equations obtained from the finite element formulation of the continuous problem the stability function for component i a function obtained from the so lution of the dual problem describing the local stability properties for component 3 the stability factor for component a number obtained from the solu tion of the dual problem describing the the global stability properties for component i TOL the tolerance i e a beforehand specified upper bound for the error of the solution 41 43 APPENDIX B Tanganyika User Manual USER MANUAL TANGANYIKA LIBRARY 1 0 TANGANYIKA X INTERFACE 1 0 ANTANANARIVE Anders Logg
44. s available for download at http www gtk org The program is distributed under the GNU General Public License GPL See Appendix A 36 A Multi Adaptive ODE Solver Bibliography 1 E BURMAN Adaptive Finite Element Methods for Compressible Two Phase Flow Phd thesis Chalmers University of Technology 1998 2 N ERICSSON A Study of Transition to Turbulence for Incompressible Flow using a Spectral Finite Element Method Lic thesis Chalmers University of Technology 1998 3 K ERIKSSON D ESTEP P HANSBO C JOHNSON Introduction to Adaptive Methods for Differential Equations Acta Numerica 1995 105 158 4 K ERIKSSON D ESTEP P HANSBO C JOHNSON Computational Differ ential Equations Studentlitteratur 1996 5 D Ester A Posteriori Error Bounds and Global Error Control for Approxima tions of Ordinary Differential Equations SLAM J Numer Anal vol 32 1995 1 48 6 D ESTEP S VERDUYN LUNEL R WILLIAMS Error Estimation for Numer ical Differential Equations 1995 http www cacr caltech edu publications techpubs 980930 7 D ESTEP D FRENCH Global Error Control for the Continuous Galerkin Finite Element Method for Ordinary Differential Equations M AN vol 28 1994 815 852 37 A Multi Adaptive ODE Solver 8 D ESTEP R WILLIAMS Accurate Parallel Integration of Large Sparse Systems of Differential Equations Math Models Meth Appl Sci to appear 9 C JOHNSON Err
45. t T 27 A Multi Adaptive ODE Solver 10000 uw 5000 4 0 1 1 L 1 0 0 5 1 1 5 2 2 5 3 3 5 8 x 10 10 I a Sr 0 1 1 1 1 1 1 0 0 5 1 1 5 2 2 5 3 3 5 x 10 10 I a 5r 7 0 1 1 1 1 L 1 0 0 5 1 1 5 2 2 5 3 3 5 t Figure 4 6 Stability functions for the x components of the three planets As one might expect the three bodies are differently sensitive to the resolu tion of the discretization This is also evident in figure 4 7 where are drawn the timesteps for the components corresponding to the x coordinates of the three planets The problem is in two dimensions so there is a total number of 12 components In this figure are also the number of timesteps used for the dif ferent components The larger planet corresponding to components 1 2 7 and 8 obviously doesn t require as many steps as the two smaller ones The largest number of steps is according to this figure needed to resolve the y velocities of the smallest planet which is not too strange considering the main acceleration is in the y direction at the critical point 28 A Multi Adaptive ODE Solver 9000 T T gt 8000 0 0255 7000 6000 5000 4000 0 01 3000 2000 1000 12345267 8 9 101112 Figure 4 7 Timesteps left and the number of timesteps right for the 12 different com ponents of the three body problem It is obviously crucial for the timesteps of the in
46. t the errors of an initial computation to be fully equidistributed onto the different components Hence we cannot expect 1 VN to always work as data for the components of the dual problem Again proper data is obtained by e g solving at different tolerance levels 18 CHAPTER 3 The Implementation Tanganyika This section describes the actual implementation of the method described in the previous section 3 1 Individual Stepping The individual stepping is done according to eq 2 7 This requires knowl edge about U including the values of all other components These values are evaluated by interpolation or extrapolation according to the order of the method of the nearest known values of the other components The solution of the integral equation is done iteratively for every component The order of the stepping follows one simple principle the last component steps first It is the fact that the equations are not solved simultaneously that results in non zero discrete residuals 19 A Multi Adaptive ODE Solver 3 1 1 Organization Book Keeping Doing the stepping individually rather than stepping all components together requires some book keeping keeping track of the positions of all components and which one is to step next The individual stepping is done according to figure 3 1 below The imple mentation pretty much follows this scetch gt positions inform ation interaction
47. tanganyika a usr lib Notice that you probably cannot do this otherwise than as superuser root B 4 The Tanganyika Library This is a tutorial for the Tanganyika library version 1 0 B 4 1 What it does This library provides functions for solving initial value problems for systems of ordinary differential equations The method used is a multi adaptive finite element method which is described in detail in the report A Multi Adaptive ODE solver B 4 2 How to use it In your C program include the library by doing include lt tanganyika h gt What will then be included is the following ifndef TANGANYIKA_H define TANGANYIKA_H define TAN_METHOD_CG1 1 define TAN_METHOD_CG2 2 define TAN_METHOD_CG3 3 define TAN_OUTPUT_DEVNULL 0 define TAN_OUTPUT_COUT 1 define TAN_OUTPUT_CERR 2 define TAN_OUTPUT_COM 3 define TAN_FORWARD_PROBLEM 1 define TAN_DUAL_PROBLEM 2 define TAN_ERROR_ESTIMATE 3 A Multi Adaptive ODE Solver bool InitializeSolution double double double double double dInitialData dStartTime dEndTime dTolerance fFunction double U double t int iIndex int int int void bool void ClearSolution bool Solve iMethods iSizeOfSystem iMessageOutput Progress double dProgress bErrorEstimation bool Save const char cFileName fendif What the different functions do should be quite clear from their names Below follows a description of the
48. tively Here follows a simple example for a simple harmonic oscillator oe This is an example oe oe oe size of system 2 2 oe initial data U 0 0 U 1 1 equations F 0 U 1 F 1 U 0 methods M 0 1 M 1 2 15 A Multi Adaptive ODE Solver B 5 6 Download Updates Further Information This program is available for download at http www dd chalmers se f95logg Tanganyika together with the Tanganyika library At this site is also available in postscript format the report A Multi Adaptive ODE Solver 16 A Multi Adaptive ODE Solver B 6 GNU General Public License These programs both the Tanganyika library 1 0 and the Tanganyika X interface are distributed under the GNU General Public license GPL included below GNU GENERAL PUBLIC LICENSE Version 2 June 1991 Copyright C 1989 1991 Free Software Foundation Inc 59 Temple Place Suite 330 Boston MA 02111 1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document but changing it is not allowed Preamble The licenses for most software are designed to take away your freedom to share and change it By contrast the GNU General Public License is intended to guarantee your freedom to share and change free software to make sure the software is free for all its users This General Public License applies to most of the Free Software Foundation s software and to any other pr
49. volved components to be small just when the smallest planet makes the sling shot This is realized in the adaptive algorithm by an extremely large value of the stability functions for the involved components as was shown in figure 4 6 4 4 The Lorenz System As a fourth and final example consider the Lorenz system given by the equa tions 29 A Multi Adaptive ODE Solver te 0 7 y re y z t 0 T 2 2y bz t 0 T Ge 2 0 Zo y 0 yo 2 0 zo where 10 b 8 3 and r 28 and xo yo 20 1 0 0 The solution at TOL 2 5 107 and T 10 is shown in figure 4 8 to gether with the timesteps used for the computation The chaotic flipping behaviour of the Lorenz system is not evident in this figure since T is too small The purpose of this example is however not to illustrate certain charac teristics of the Lorenz system but to illustrate the use of multi adaptivity for the three components 32 4 31 30 29 28 157 3 y 15 2 _10 8 6 4 5 5 5 6 t Figure 4 8 At the left is the solution of the Lorenz system solved with the mulitadap tive cG 1 method at TOL 2 5 1077 and with final time 10 At the right are the timesteps used for the computation 30 A Multi Adaptive ODE Solver Below in figure 4 9 is given the behaviour of one of the stability functions 60 T T T T 50r
Download Pdf Manuals
Related Search
Related Contents
IQ40 Reef Size: Mode d`emploi IMPRESSA F7 Newstar FPMA-W820 flat panel wall mount Tuff Truck Bag TTB-B Instructions / Assembly manual de instrucciones y especificaciones para Cooper Lighting GS User's Manual KOHLER K-9479-96 Installation Guide Copyright © All rights reserved.
Failed to retrieve file