Skip to content

Commit

Permalink
Merge pull request #64 from mikelehu/master
Browse files Browse the repository at this point in the history
issue 61
  • Loading branch information
ChrisRackauckas authored Mar 31, 2024
2 parents b19edaa + bf98fef commit 45c7716
Show file tree
Hide file tree
Showing 11 changed files with 527 additions and 51 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "2fb54ab2",
"metadata": {},
"outputs": [],
"source": [
"using IRKGaussLegendre\n",
"using OrdinaryDiffEq"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ce474231",
"metadata": {},
"outputs": [],
"source": [
"function x(t)\n",
" u0 = [1.]\n",
" tspan = (1.,t)\n",
" prob = ODEProblem(Ric1ODE!, u0, tspan)\n",
" sol = solve(prob, Tsit5(); reltol = 1.e-10, abstol = 1.e-10, save_everystep = false)\n",
" return sol(t)\n",
"end\n",
"\n",
"function Ric1ODE!(du, u, pars, t) \n",
" du[1] = -2u[1]-1+u[1]^2\n",
"end"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4c16810d",
"metadata": {},
"outputs": [],
"source": [
"f(u, p, t) = x(t)[1]^2\n",
"\n",
"function f1!(du, u, pars, t)\n",
" du[1] = pars(t)\n",
"end\n",
"\n",
"u0 = [0.]; u00 = 0.;\n",
"tspan = (0.0, 1.0)\n",
"pars = t->x(t)[1]^2\n",
"prob = ODEProblem(f, u00, tspan)\n",
"prob1 = ODEProblem(f1!, u0, tspan, pars)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "edd522be",
"metadata": {},
"outputs": [],
"source": [
"sol1 = solve(prob1, Tsit5(), reltol = 1e-8, abstol = 1e-8); sol1(1)[1]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "899dbbb7",
"metadata": {},
"outputs": [],
"source": [
"eltype(prob1.tspan)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "dc97f9b9",
"metadata": {},
"outputs": [],
"source": [
"sol2 = solve(prob1, IRKGaussLegendre.IRKGL16(maxtrials=4), dt=1., reltol = 1e-8, abstol = 1e-8); sol2(1)[1]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5ce7b8ef",
"metadata": {},
"outputs": [],
"source": [
"# v 1.10.0 : 3.3006156872882713"
]
},
{
"cell_type": "markdown",
"id": "3c71fc4e",
"metadata": {},
"source": [
"## Andreas examples"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b8ccc3cc",
"metadata": {},
"outputs": [],
"source": [
"sol2 = solve(prob1, IRKGaussLegendre.IRKGL16(), reltol = 1e-8, abstol = 1e-8); sol2(1)[1]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ab14de53",
"metadata": {},
"outputs": [],
"source": [
"sol2 = solve(prob1, IRKGaussLegendre.IRKGL16(), dt = 1e-7,reltol = 1e-8, abstol = 1e-8); sol2(1)[1]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "50dce94e",
"metadata": {},
"outputs": [],
"source": [
"sol2 = solve(prob1, IRKGaussLegendre.IRKGL16(), dt =1e-6,reltol = 1e-8, abstol = 1e-8); sol2(1)[1]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fef268bc",
"metadata": {},
"outputs": [],
"source": [
"sol2 = solve(prob1, IRKGaussLegendre.IRKGL16(), dt = 1e-5,reltol = 1e-8, abstol = 1e-8); sol2(1)[1]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "86e473b0",
"metadata": {},
"outputs": [],
"source": [
"sol2 = solve(prob1, IRKGaussLegendre.IRKGL16(), dt = 1e-4,reltol = 1e-8, abstol = 1e-8); sol2(1)[1]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e15976ba",
"metadata": {},
"outputs": [],
"source": [
"sol2 = solve(prob1, IRKGaussLegendre.IRKGL16(), dt = 1e-3,reltol = 1e-8, abstol = 1e-8); sol2(1)[1]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fe98afa7",
"metadata": {},
"outputs": [],
"source": [
"sol2 = solve(prob1, IRKGaussLegendre.IRKGL16(), dt = 1e-2,reltol = 1e-8, abstol = 1e-8); sol2(1)[1]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3f241056",
"metadata": {},
"outputs": [],
"source": [
"sol2 = solve(prob1, IRKGaussLegendre.IRKGL16(), dt = 1e-1,reltol = 1e-8, abstol = 1e-8); sol2(1)[1]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0d05cf95",
"metadata": {},
"outputs": [],
"source": [
"sol2 = solve(prob1, IRKGaussLegendre.IRKGL16(), dt = 1,reltol = 1e-8, abstol = 1e-8); sol2(1)[1]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b4a7cf4a",
"metadata": {},
"outputs": [],
"source": [
"sol2 = solve(prob1, IRKGaussLegendre.IRKGL16(), dt = 10,reltol = 1e-8, abstol = 1e-8); sol2(1)[1]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "cd3ee271",
"metadata": {},
"outputs": [],
"source": [
"sol2 = solve(prob1, IRKGaussLegendre.IRKGL16(), dt = 100,reltol = 1e-8, abstol = 1e-8); sol2(1)[1]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d18c366f",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Julia 1.9.1",
"language": "julia",
"name": "julia-1.9"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.9.1"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading

0 comments on commit 45c7716

Please sign in to comment.