Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pyradau13
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pberndt
pyradau13
Commits
510e54f6
Commit
510e54f6
authored
10 years ago
by
Phillip Berndt
Browse files
Options
Downloads
Patches
Plain Diff
Better documentation / renamed order to initial_order
parent
f5000759
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pyradau13.c
+20
-7
20 additions, 7 deletions
pyradau13.c
with
20 additions
and
7 deletions
pyradau13.c
+
20
−
7
View file @
510e54f6
...
...
@@ -163,7 +163,7 @@ static void radau_dense_feedback(int *nr, double *xold, double *x, double *y, do
static
PyObject
*
radau13
(
PyObject
*
self
,
PyObject
*
args
,
PyObject
*
kwargs
)
{
// Parse arguments
static
char
*
kwlist
[]
=
{
"rhs_fn"
,
"y0"
,
"t"
,
"order"
,
"max_steps"
,
"dense_callback"
,
"t0"
,
"h0"
,
"abstol"
,
"reltol"
,
"max_stepsize"
,
NULL
};
static
char
*
kwlist
[]
=
{
"rhs_fn"
,
"y0"
,
"t"
,
"
initial_
order"
,
"max_steps"
,
"dense_callback"
,
"t0"
,
"h0"
,
"abstol"
,
"reltol"
,
"max_stepsize"
,
NULL
};
PyObject
*
rhs_fn
,
*
y0
,
*
times
,
*
dense_callback
=
NULL
;
double
t_final
,
t_0
=
0
.,
h_0
=
1e-6
,
abstol
=
1e-13
,
reltol
=
1e-9
,
max_stepsize
=
0
.;
int
order
=
13
.;
...
...
@@ -217,6 +217,11 @@ static PyObject *radau13(PyObject *self, PyObject *args, PyObject *kwargs) {
for
(
current_level
=
0
;
current_level
<
time_levels
;
current_level
++
)
{
t_final
=
((
double
*
)
PyArray_DATA
(
times_array
))[
current_level
];
if
(
t_final
<
t_0
)
{
PyErr_SetString
(
PyExc_ValueError
,
"Integration times must be increasing"
);
break
;
}
memset
(
iwork
,
0
,
sizeof
(
int
)
*
liwork
);
memset
(
work
,
0
,
sizeof
(
double
)
*
lwork
);
iwork
[
0
]
=
1
;
// Use Hessenberg matrix form
...
...
@@ -288,6 +293,12 @@ static PyObject *radau13(PyObject *self, PyObject *args, PyObject *kwargs) {
return
NULL
;
}
if
(
PyErr_Occurred
()
!=
NULL
)
{
Py_DECREF
(
list_retval
);
Py_DECREF
(
y_out
);
return
NULL
;
}
if
(
time_levels
>
1
)
{
PyObject
*
np_retval
=
PyArray_FromAny
(
list_retval
,
NULL
,
0
,
0
,
0
,
NULL
);
Py_DECREF
(
list_retval
);
...
...
@@ -302,19 +313,20 @@ static PyObject *radau13(PyObject *self, PyObject *args, PyObject *kwargs) {
static
PyMethodDef
methods
[]
=
{
{
"radau13"
,
(
PyCFunction
)
radau13
,
METH_VARARGS
|
METH_KEYWORDS
,
"
radau13 -
Solve ODE system using the
radau
13 integrator
\n\n
"
"Syntax: radau13(rhs_fn, y0, t, order=13, max_steps=10000,
\n
"
"Solve
an
ODE system using the
RADAU
13 integrator
\n\n
"
"Syntax: radau13(rhs_fn, y0, t,
initial_
order=13, max_steps=10000,
\n
"
" dense_callback=None, t0=0, h0=1e-6, abstol=1e-13,
\n
"
" reltol=1e-9, max_stepsize=0)
\n\n
"
"
Parameter
s:
\n
"
"
Argument
s:
\n
"
" - rhs_fn must be a callable of the type rhs_fn(t, y), where
\n
"
" t is the current integration time, and
\n
"
" y is the current state vector.
\n
"
"
i
t should return a vector df/dt.
\n
\n
"
"
I
t should return a vector df/dt.
\n
"
" - y0 must be the initial state vector.
\n
"
" - t must be the desired new time level, or an increasing list
\n
"
" of time levels.
\n
"
" - order must be one of 13, 9 or 5.
\n
"
" of time levels.
\n\n
"
"Optional arguments:
\n
"
" - initial_order must be one of 13, 9 or 5.
\n
"
" - max_steps denotes the maximal step count to take.
\n
"
" - dense_callback must be either not set, or a callable of the
\n
"
" type dense_callback(told, t, y, cont). It is called after each
\n
"
...
...
@@ -328,6 +340,7 @@ static PyMethodDef methods[] = {
" - max_stepsize denotes the maximal step size. It is only required
\n
"
" if you need fixed times in dense_callback; for normal operation
\n
"
" abstol/reltol are fine.
\n\n
"
"Return value:
\n
"
" The function returns the state at time t_final, or throws a
\n
"
" RuntimeError if it vails. The runtime error contains the error message
\n
"
" from RADAU13, which can be
\n
"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment