{"id":18847787,"url":"https://github.com/jacobwilliams/ddeabm","last_synced_at":"2026-02-14T23:31:57.270Z","repository":{"id":18200549,"uuid":"21329942","full_name":"jacobwilliams/ddeabm","owner":"jacobwilliams","description":"Modern Fortran implementation of the DDEABM Adams-Bashforth algorithm","archived":false,"fork":false,"pushed_at":"2025-01-19T05:11:18.000Z","size":3706,"stargazers_count":40,"open_issues_count":2,"forks_count":7,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-10-06T13:36:49.555Z","etag":null,"topics":["adams-bashforth","fortran","fortran-package-manager","ode","root-finding","slatec"],"latest_commit_sha":null,"homepage":"","language":"Fortran","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jacobwilliams.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2014-06-29T18:56:07.000Z","updated_at":"2025-08-05T15:56:37.000Z","dependencies_parsed_at":"2025-02-20T05:39:49.608Z","dependency_job_id":null,"html_url":"https://github.com/jacobwilliams/ddeabm","commit_stats":{"total_commits":85,"total_committers":1,"mean_commits":85.0,"dds":0.0,"last_synced_commit":"263dbbd3a3cf9737e21da5c02f86845329e61830"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/jacobwilliams/ddeabm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobwilliams%2Fddeabm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobwilliams%2Fddeabm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobwilliams%2Fddeabm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobwilliams%2Fddeabm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jacobwilliams","download_url":"https://codeload.github.com/jacobwilliams/ddeabm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobwilliams%2Fddeabm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29460696,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T22:42:09.113Z","status":"ssl_error","status_checked_at":"2026-02-14T22:42:05.053Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adams-bashforth","fortran","fortran-package-manager","ode","root-finding","slatec"],"created_at":"2024-11-08T03:09:40.522Z","updated_at":"2026-02-14T23:31:57.253Z","avatar_url":"https://github.com/jacobwilliams.png","language":"Fortran","funding_links":[],"categories":[],"sub_categories":[],"readme":"![ddeabm](media/logo.png)\n============\n\n# Status\n\n[![Language](https://img.shields.io/badge/-Fortran-734f96?logo=fortran\u0026logoColor=white)](https://github.com/topics/fortran)\n[![GitHub release](https://img.shields.io/github/release/jacobwilliams/ddeabm.svg)](https://github.com/jacobwilliams/ddeabm/releases/latest)\n[![Build Status](https://github.com/jacobwilliams/ddeabm/actions/workflows/CI.yml/badge.svg)](https://github.com/jacobwilliams/ddeabm/actions)\n[![codecov](https://codecov.io/gh/jacobwilliams/ddeabm/branch/master/graph/badge.svg)](https://codecov.io/gh/jacobwilliams/ddeabm)\n[![last-commit](https://img.shields.io/github/last-commit/jacobwilliams/ddeabm)](https://github.com/jacobwilliams/ddeabm/commits/master)\n\n## Description\n\nThis is a modern object-oriented Fortran implementation of the DDEABM Adams-Bashforth-Moulton ODE solver. The original Fortran 77 code was obtained from the [SLATEC library](http://www.netlib.org/slatec/src/). It has been extensively refactored.\n\nDDEABM uses the Adams-Bashforth-Moulton predictor-corrector formulas of orders 1 through 12 to integrate a system of first order ordinary differential equations of the form `dx/dt = f(t,x)`. Also included is an event-location capability, where the equations can be integrated until a specified function `g(t,x) = 0`. Dense output is also supported.\n\nThis project is hosted on [GitHub](https://github.com/jacobwilliams/ddeabm).\n\n## Examples\n\nThe `ddeabm_module` provides a thread-safe and object-oriented interface to the DDEABM method. Some example use cases are presented below:\n\n### Basic integration\n\nThis example shows how to integrate a conic orbit (6 state equations) around the Earth from an initial time `t0` to a final time `tf`:\n\n```Fortran\nprogram ddeabm_example\n\nuse ddeabm_module, wp =\u003e ddeabm_rk\n\nimplicit none\n\nreal(wp),parameter :: mu = 398600.436233_wp !! Earth gravitational parameter (km^3/s^2)\ninteger,parameter  :: n = 6                 !! number of state variables\n\ntype(ddeabm_class) :: s\nreal(wp),dimension(n) :: x0,x\nreal(wp) :: t0,tf,t\ninteger :: idid\n\ncall s%initialize(n,maxnum=10000,df=twobody,rtol=[1.0e-12_wp],atol=[1.0e-12_wp])\n\n!initial conditions:\nx0 = [10000.0_wp,10000.0_wp,10000.0_wp,\u0026   !initial state [r,v] (km,km/s)\n        1.0_wp,2.0_wp,3.0_wp]\nt0 = 0.0_wp       !initial time (sec)\ntf = 1000.0_wp    !final time (sec)\n\nwrite(*,'(A/,*(F15.6/))') 'Initial time: ',t0\nwrite(*,'(A/,*(F15.6/))') 'Initial state:',x0\nt = t0\nx = x0\ncall s%integrate(t,x,tf,idid=idid)\nwrite(*,'(A/,*(F15.6/))') 'Final time: ',t\nwrite(*,'(A/,*(F15.6/))') 'Final state:',x\n\ncontains\n\n    subroutine twobody(me,t,x,xdot)\n\n        !! derivative routine for two-body orbit propagation\n\n        implicit none\n\n        class(ddeabm_class),intent(inout) :: me\n        real(wp),intent(in)               :: t\n        real(wp),dimension(:),intent(in)  :: x\n        real(wp),dimension(:),intent(out) :: xdot\n\n        real(wp),dimension(3) :: r,v,a_grav\n        real(wp) :: rmag\n\n        r = x(1:3)\n        v = x(4:6)\n        rmag = norm2(r)\n        a_grav = -mu/rmag**3 * r ! acceleration due to gravity\n\n        xdot(1:3) = v\n        xdot(4:6) = a_grav\n\n    end subroutine twobody\n\nend program ddeabm_example\n\n```\nIt produces the following output:\n\n```\nInitial time:\n       0.000000\n\nInitial state:\n   10000.000000\n   10000.000000\n   10000.000000\n       1.000000\n       2.000000\n       3.000000\n\nFinal time:\n    1000.000000\n\nInitial time:\n   10667.963305\n   11658.055962\n   12648.148619\n       0.377639\n       1.350074\n       2.322509\n```\n\n### Reporting of intermediate points\n\nThe intermediate integration points can also be reported to a user-defined procedure.  For the above example, the following subroutine could be defined:\n\n```Fortran\nsubroutine twobody_report(me,t,x)\n\n    !! report function - write time,state to console\n\n    implicit none\n\n    class(ddeabm_class),intent(inout)    :: me\n    real(wp),intent(in)                  :: t\n    real(wp),dimension(:),intent(in)     :: x\n\n    write(*,'(*(F15.6,1X))') t,x\n\nend subroutine twobody_report\n```\nWhich can be added to the class on initialization:\n\n```Fortran\ncall s%initialize(n,maxnum=10000,df=twobody,\u0026\n                  rtol=[1.0e-12_wp],atol=[1.0e-12_wp],\u0026\n                  report=twobody_report)\n\n```\nThis function is then called at each time step\nif the equations are integrated using the `integration_mode=2` option like so:\n```Fortran\ncall s%integrate(t,x,tf,idid=idid,integration_mode=2)\n```\n\n### Event location\n\nA user-defined event function `g(t,x)` can also be defined in order to stop the integration at a specified event (i.e., when `g(t,x)=0`). In the above example, say it is desired that the integration stop when `z = x(3) = 12,000 km`.  The event function for this would be:\n\n```Fortran\nsubroutine twobody_event(me,t,x,g)\n\n    !! event function for z = 12,000 km\n\n    implicit none\n\n    class(ddeabm_with_event_class),intent(inout) :: me\n    real(wp),intent(in)                          :: t\n    real(wp),dimension(:),intent(in)             :: x\n    real(wp),intent(out)                         :: g\n\n    g = 12000.0_wp - x(3)\n\nend subroutine twobody_event\n```\nFor event finding, the `ddeabm_with_event_class` type is used (which is an extension of the main `ddeabm_class`).  For example:\n\n```Fortran\ntype(ddeabm_with_event_class) :: s\n...\ncall s%initialize_event(n,maxnum=10000,df=twobody,\u0026\n                        rtol=[1.0e-12_wp],atol=[1.0e-12_wp],\u0026\n                        g=twobody_event,root_tol=1.0e-12_wp)\n...\ncall s%integrate_to_event(t,x,tf,idid=idid,gval=gval)\n```\nIn this case, `root_tol` is the tolerance for the event location, and `gval` is the value of the event function at the final time (note that the integration will stop when `g(t,x)=0` or at `t=tf`, whichever occurs first).\n\nA vector event function is also supported (in which case, the integration stops if *any* of the roots are found). This is done using the `ddeabm_with_event_class_vec` type.\n\n### Fixed time step\n\nAll of the integration methods have an optional argument (`tstep`) to enable a fixed time step, which can be used for dense output, or to specify a fixed step used for event finding (since the default step may be too large). For example, for performing a root-finding integration with the event function evaluated every 100 seconds:\n\n```Fortran\ncall s%integrate_to_event(t,x,tf,idid=idid,gval=gval,tstep=100.0_wp)\n```\n\n## Building DDEABM\n\nDDEABM and the test programs will build with any modern Fortran compiler. A [Fortran Package Manager](https://github.com/fortran-lang/fpm) (FPM) manifest file (`fpm.toml`) is included, so that the library and tests cases can be compiled with FPM. For example:\n\n```\nfpm build --profile release\nfpm test --profile release\n```\n\nTo generate the documentation using [ford](https://github.com/Fortran-FOSS-Programmers/ford), run:\n\n```\nford ford.md\n```\n\nTo use `ddeabm` within your fpm project, add the following to your `fpm.toml` file:\n```toml\n[dependencies]\nddeabm = { git=\"https://github.com/jacobwilliams/ddeabm.git\" }\n```\n\nA specific version can also be specified:\n\n```toml\n[dependencies]\nddeabm = { git=\"https://github.com/jacobwilliams/ddeabm.git\", rev = \"2.1.0\" }\n```\n\nBy default, the library is built with double precision (`real64`) real values. Explicitly specifying the real kind can be done using the following processor flags:\n\nPreprocessor flag | Kind  | Number of bytes\n----------------- | ----- | ---------------\n`REAL32`  | `real(kind=real32)`  | 4\n`REAL64`  | `real(kind=real64)`  | 8\n`REAL128` | `real(kind=real128)` | 16\n\nFor example, to build a single precision version of the library, use:\n\n```\nfpm build --profile release --flag \"-DREAL32\"\n```\n\n### Dependencies\n\nBuilding the library requires the [roots-fortran](https://github.com/jacobwilliams/roots-fortran) module. Building the tests requires the [pyplot-fortran](https://github.com/jacobwilliams/pyplot-fortran) module. FPM will automatically download the correct versions of both (see `fpm.toml`).\n\n## Documentation\n\nThe latest API documentation can be found [here](http://jacobwilliams.github.io/ddeabm/). This was generated from the source code using [FORD](https://github.com/Fortran-FOSS-Programmers/ford).\n\n## License\n\nThe DDEABM source code and related files and documentation are distributed under a permissive free software [license](https://github.com/jacobwilliams/ddeabm/blob/master/LICENSE) (BSD-style).  The original DDEABM Fortran 77 code is [public domain](http://www.netlib.org/slatec/guide).\n\n## Keywords\n\nAdams-Bashforth-Moulton Method, DEPAC, Initial Value Problems, ODE, Ordinary Differential Equations, Predictor-Corrector, SLATEC, Modern Fortran\n\n## References\n\n1. L. F. Shampine, M. K. Gordon, \"Solving ordinary differential equations with ODE, STEP, and INTRP\",  Report SLA-73-1060, Sandia Laboratories, 1973.\n2. L. F. Shampine, M. K. Gordon, \"Computer solution of ordinary differential equations, the initial value problem\", W. H. Freeman and Company, 1975.\n3. L. F. Shampine, H. A. Watts, \"DEPAC - Design of a user oriented package of ode solvers\", Report SAND79-2374, Sandia Laboratories, 1979.\n4. H. A. Watts, \"A smoother interpolant for DE/STEP, INTRP and DEABM: II\", Report SAND84-0293, Sandia Laboratories, 1984.\n5. R. P. Brent, \"[An algorithm with guaranteed convergence for finding a zero of a function](http://maths-people.anu.edu.au/~brent/pd/rpb005.pdf)\", The Computer Journal, Vol 14, No. 4., 1971.\n6. R. P. Brent, \"[Algorithms for minimization without derivatives](http://maths-people.anu.edu.au/~brent/pub/pub011.html)\", Prentice-Hall, Inc., 1973.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacobwilliams%2Fddeabm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjacobwilliams%2Fddeabm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacobwilliams%2Fddeabm/lists"}