-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Nonlinear index 1 DAE work precision and minor investigations with Ra…
…dau methods.
- Loading branch information
1 parent
66cd760
commit 2bcb613
Showing
17 changed files
with
310 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import numpy as np | ||
from scipy_dae.integrate._dae.benchmarks.common import benchmark | ||
|
||
|
||
"""Nonlinear index 1 DAE, see Kvaerno1990. | ||
References: | ||
----------- | ||
Kvaerno1990: https://doi.org/10.2307/2008502 | ||
""" | ||
def F(t, y, yp): | ||
y1, y2 = y | ||
yp1, yp2 = yp | ||
return np.array([ | ||
(np.sin(yp1)**2 + np.cos(y2)**2) * yp2**2 - (t - 6)**2 * (t - 2)**2 * y1 * np.exp(-t), | ||
(4 - t) * (y2 + y1)**3 - 64 * t**2 * np.exp(-t) * y1 * y2, | ||
]) | ||
|
||
|
||
def true_sol(t): | ||
return ( | ||
np.array([ | ||
t**4 * np.exp(-t), | ||
(4 - t) * t**3 * np.exp(-t), | ||
]), | ||
np.array([ | ||
(4 * t**3 - t**4) * np.exp(-t), | ||
(-t**3 + (4 - t) * 3 * t**2 - (4 - t) * t**3) * np.exp(-t) | ||
]) | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
# exponents | ||
m_max = 32 | ||
ms = np.arange(m_max + 1) | ||
|
||
# tolerances and initial step size | ||
rtols = 10**(-(4 + ms / 4)) | ||
atols = rtols | ||
h0s = 1e-3 * np.ones_like(rtols) | ||
|
||
# time span | ||
t0 = 0.5 | ||
t1 = 1 | ||
|
||
# initial conditions | ||
y0, yp0 = true_sol(t0) | ||
|
||
# reference solution | ||
y_ref = true_sol(t1)[0] | ||
|
||
benchmark(t0, t1, y0, yp0, F, rtols, atols, h0s, "Kvaerno", y_ref) |
Oops, something went wrong.