solve-nivp 0.2.0.dev0__tar.gz → 0.2.0.dev2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- solve_nivp-0.2.0.dev2/MANIFEST.in +10 -0
- {solve_nivp-0.2.0.dev0/solve_nivp.egg-info → solve_nivp-0.2.0.dev2}/PKG-INFO +2 -3
- solve_nivp-0.2.0.dev2/docs/Makefile +20 -0
- solve_nivp-0.2.0.dev2/docs/make.bat +35 -0
- solve_nivp-0.2.0.dev2/docs/source/api/solve_nivp.ODESolver.rst +23 -0
- solve_nivp-0.2.0.dev2/docs/source/api/solve_nivp.ODESystem.rst +25 -0
- solve_nivp-0.2.0.dev2/docs/source/api/solve_nivp.adaptive_integrator.rst +12 -0
- solve_nivp-0.2.0.dev2/docs/source/api/solve_nivp.integrations.rst +18 -0
- solve_nivp-0.2.0.dev2/docs/source/api/solve_nivp.nonlinear_solvers.rst +12 -0
- solve_nivp-0.2.0.dev2/docs/source/api/solve_nivp.projections.rst +17 -0
- solve_nivp-0.2.0.dev2/docs/source/api/solve_nivp.rl.dependency.rst +12 -0
- solve_nivp-0.2.0.dev2/docs/source/api/solve_nivp.rl.rst +15 -0
- solve_nivp-0.2.0.dev2/docs/source/api/solve_nivp.rst +25 -0
- solve_nivp-0.2.0.dev2/docs/source/conf.py +58 -0
- solve_nivp-0.2.0.dev2/docs/source/development.rst +30 -0
- solve_nivp-0.2.0.dev2/docs/source/examples.rst +62 -0
- solve_nivp-0.2.0.dev2/docs/source/index.rst +19 -0
- solve_nivp-0.2.0.dev2/docs/source/modules.rst +17 -0
- solve_nivp-0.2.0.dev2/docs/source/quickstart.rst +42 -0
- solve_nivp-0.2.0.dev2/docs/source/solve_nivp.rst +58 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/pyproject.toml +9 -4
- solve_nivp-0.2.0.dev2/pytest.ini +10 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2/src}/solve_nivp/ODESolver.py +124 -53
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2/src}/solve_nivp/ODESystem.py +1 -1
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2/src}/solve_nivp/__init__.py +19 -5
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2/src}/solve_nivp/adaptive_integrator.py +29 -34
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2/src}/solve_nivp/alart_curnier_contact.py +6 -5
- solve_nivp-0.2.0.dev2/src/solve_nivp/block_system.py +9 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2/src}/solve_nivp/desaxce_contact.py +2 -2
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2/src}/solve_nivp/integrations.py +15 -17
- solve_nivp-0.2.0.dev2/src/solve_nivp/moreau_jean_fremond.py +699 -0
- solve_nivp-0.2.0.dev2/src/solve_nivp/nonlinear_solvers.py +9 -0
- solve_nivp-0.2.0.dev2/src/solve_nivp/pcr.py +9 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2/src}/solve_nivp/projected_radau_contact.py +697 -87
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2/src}/solve_nivp/projections.py +15 -10
- solve_nivp-0.2.0.dev2/src/solve_nivp/soccp_pgs.py +419 -0
- solve_nivp-0.2.0.dev2/src/solve_nivp/solvers/__init__.py +14 -0
- {solve_nivp-0.2.0.dev0/solve_nivp → solve_nivp-0.2.0.dev2/src/solve_nivp/solvers}/nonlinear_solvers.py +100 -41
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2/src/solve_nivp.egg-info}/PKG-INFO +2 -3
- solve_nivp-0.2.0.dev2/src/solve_nivp.egg-info/SOURCES.txt +104 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2/src}/solve_nivp.egg-info/top_level.txt +0 -1
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_import_and_api.py +23 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_large_scale_solver_fixes.py +39 -0
- solve_nivp-0.2.0.dev2/tests/test_moreau_jean_fremond.py +346 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_prestressed_fault_dynamic_helper.py +15 -11
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_projected_radau_contact.py +159 -1
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_rattle_local_slider.py +18 -12
- solve_nivp-0.2.0.dev2/tests/test_soccp_pgs.py +174 -0
- solve_nivp-0.2.0.dev2/tests/test_t_eval.py +95 -0
- solve_nivp-0.2.0.dev0/setup.py +0 -57
- solve_nivp-0.2.0.dev0/solve_nivp.egg-info/SOURCES.txt +0 -76
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/LICENSE +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/README.md +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/setup.cfg +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2/src}/solve_nivp/_numba_accel.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2/src}/solve_nivp/_selftest.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2/src}/solve_nivp/contact.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2/src}/solve_nivp/macklin_contact.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2/src}/solve_nivp/ncp_contact.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2/src}/solve_nivp/rattle_contact.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2/src}/solve_nivp/rl/__init__.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2/src}/solve_nivp/rl/callbacks.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2/src}/solve_nivp/rl/dependency.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2/src}/solve_nivp/rl/env.py +0 -0
- {solve_nivp-0.2.0.dev0/solve_nivp → solve_nivp-0.2.0.dev2/src/solve_nivp/solvers}/block_system.py +0 -0
- {solve_nivp-0.2.0.dev0/solve_nivp → solve_nivp-0.2.0.dev2/src/solve_nivp/solvers}/pcr.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2/src}/solve_nivp.egg-info/dependency_links.txt +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2/src}/solve_nivp.egg-info/entry_points.txt +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2/src}/solve_nivp.egg-info/requires.txt +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/__init__.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_3d_and_anisotropic_contact.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_active_set_filter.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_alart_curnier_contact.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_algebraic_constraint_projection.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_anisotropic_soc_projection.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_auto_h0_and_dae_weighting.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_block_system.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_bouncing_ball_schur_comparison.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_build_impulse_contact.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_c_extract_contact.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_composite_contact_projection.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_coulomb_projection.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_coulomb_projection_jacobian.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_desaxce_contact.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_dilatancy.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_error_predictive_rejection.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_general_moreau_projection.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_globalization.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_identity_newton_linear_solver.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_integrators_added.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_jacobian_scaling.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_macklin_contact.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_mu_scaled_soc_projection.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_ncp_contact.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_ncp_schur_integration.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_nl_recovery_cap.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_nonlinear_solvers_added.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_pcr.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_per_dof_tolerances.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_prestress_soc.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_projection_batch_equivalence.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_projections_added.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_radau_iia.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_rattle_integrator.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_sdirk2.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_sdirk2_soc_contact.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_sparse_semismooth_newton.py +0 -0
- {solve_nivp-0.2.0.dev0 → solve_nivp-0.2.0.dev2}/tests/test_threading_time_and_fk.py +0 -0
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: solve_nivp
|
|
3
|
-
Version: 0.2.0.
|
|
3
|
+
Version: 0.2.0.dev2
|
|
4
4
|
Summary: A Python toolkit for integrating nonsmooth dynamical systems
|
|
5
5
|
Author: David Riley, Ioannis Stefanou
|
|
6
|
-
License: MIT
|
|
6
|
+
License-Expression: MIT
|
|
7
7
|
Project-URL: Homepage, https://github.com/ERC-INJECT/solve_nivp
|
|
8
8
|
Project-URL: Documentation, https://github.com/ERC-INJECT/solve_nivp/tree/main/docs
|
|
9
9
|
Project-URL: Issues, https://github.com/ERC-INJECT/solve_nivp/issues
|
|
10
10
|
Keywords: nonsmooth dynamics,ODE,DAE,variational inequalities,semismooth Newton,projection methods
|
|
11
11
|
Classifier: Development Status :: 4 - Beta
|
|
12
12
|
Classifier: Intended Audience :: Science/Research
|
|
13
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
14
13
|
Classifier: Programming Language :: Python :: 3
|
|
15
14
|
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
16
15
|
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Minimal makefile for Sphinx documentation
|
|
2
|
+
#
|
|
3
|
+
|
|
4
|
+
# You can set these variables from the command line, and also
|
|
5
|
+
# from the environment for the first two.
|
|
6
|
+
SPHINXOPTS ?=
|
|
7
|
+
SPHINXBUILD ?= sphinx-build
|
|
8
|
+
SOURCEDIR = source
|
|
9
|
+
BUILDDIR = build
|
|
10
|
+
|
|
11
|
+
# Put it first so that "make" without argument is like "make help".
|
|
12
|
+
help:
|
|
13
|
+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
14
|
+
|
|
15
|
+
.PHONY: help Makefile
|
|
16
|
+
|
|
17
|
+
# Catch-all target: route all unknown targets to Sphinx using the new
|
|
18
|
+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
|
19
|
+
%: Makefile
|
|
20
|
+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
@ECHO OFF
|
|
2
|
+
|
|
3
|
+
pushd %~dp0
|
|
4
|
+
|
|
5
|
+
REM Command file for Sphinx documentation
|
|
6
|
+
|
|
7
|
+
if "%SPHINXBUILD%" == "" (
|
|
8
|
+
set SPHINXBUILD=sphinx-build
|
|
9
|
+
)
|
|
10
|
+
set SOURCEDIR=source
|
|
11
|
+
set BUILDDIR=build
|
|
12
|
+
|
|
13
|
+
%SPHINXBUILD% >NUL 2>NUL
|
|
14
|
+
if errorlevel 9009 (
|
|
15
|
+
echo.
|
|
16
|
+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
|
17
|
+
echo.installed, then set the SPHINXBUILD environment variable to point
|
|
18
|
+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
|
19
|
+
echo.may add the Sphinx directory to PATH.
|
|
20
|
+
echo.
|
|
21
|
+
echo.If you don't have Sphinx installed, grab it from
|
|
22
|
+
echo.https://www.sphinx-doc.org/
|
|
23
|
+
exit /b 1
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
if "%1" == "" goto help
|
|
27
|
+
|
|
28
|
+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
29
|
+
goto end
|
|
30
|
+
|
|
31
|
+
:help
|
|
32
|
+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
33
|
+
|
|
34
|
+
:end
|
|
35
|
+
popd
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
solve\_nivp.ODESolver
|
|
2
|
+
=====================
|
|
3
|
+
|
|
4
|
+
.. currentmodule:: solve_nivp
|
|
5
|
+
|
|
6
|
+
.. autoclass:: ODESolver
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
.. automethod:: __init__
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
.. rubric:: Methods
|
|
13
|
+
|
|
14
|
+
.. autosummary::
|
|
15
|
+
|
|
16
|
+
~ODESolver.__init__
|
|
17
|
+
~ODESolver.solve
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
solve\_nivp.ODESystem
|
|
2
|
+
=====================
|
|
3
|
+
|
|
4
|
+
.. currentmodule:: solve_nivp
|
|
5
|
+
|
|
6
|
+
.. autoclass:: ODESystem
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
.. automethod:: __init__
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
.. rubric:: Methods
|
|
13
|
+
|
|
14
|
+
.. autosummary::
|
|
15
|
+
|
|
16
|
+
~ODESystem.__init__
|
|
17
|
+
~ODESystem.step
|
|
18
|
+
~ODESystem.step_adaptive
|
|
19
|
+
~ODESystem.step_fixed
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
solve\_nivp.integrations
|
|
2
|
+
========================
|
|
3
|
+
|
|
4
|
+
.. automodule:: solve_nivp.integrations
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
.. rubric:: Classes
|
|
8
|
+
|
|
9
|
+
.. autosummary::
|
|
10
|
+
|
|
11
|
+
AlgebraicBackwardEuler
|
|
12
|
+
BackwardEuler
|
|
13
|
+
CompositeMethod
|
|
14
|
+
EmbeddedBETR
|
|
15
|
+
IntegrationMethod
|
|
16
|
+
ThetaMethod
|
|
17
|
+
Trapezoidal
|
|
18
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
solve\_nivp.projections
|
|
2
|
+
=======================
|
|
3
|
+
|
|
4
|
+
.. automodule:: solve_nivp.projections
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
.. rubric:: Classes
|
|
8
|
+
|
|
9
|
+
.. autosummary::
|
|
10
|
+
|
|
11
|
+
CoulombProjection
|
|
12
|
+
GeneralMoreauVIProjection
|
|
13
|
+
IdentityProjection
|
|
14
|
+
MuScaledSOCProjection
|
|
15
|
+
Projection
|
|
16
|
+
SignProjection
|
|
17
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
solve\_nivp
|
|
2
|
+
===========
|
|
3
|
+
|
|
4
|
+
.. automodule:: solve_nivp
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
.. rubric:: Functions
|
|
8
|
+
|
|
9
|
+
.. autosummary::
|
|
10
|
+
|
|
11
|
+
solve_nivp
|
|
12
|
+
|
|
13
|
+
.. rubric:: Modules
|
|
14
|
+
|
|
15
|
+
.. autosummary::
|
|
16
|
+
:toctree:
|
|
17
|
+
:recursive:
|
|
18
|
+
|
|
19
|
+
ODESolver
|
|
20
|
+
ODESystem
|
|
21
|
+
adaptive_integrator
|
|
22
|
+
integrations
|
|
23
|
+
nonlinear_solvers
|
|
24
|
+
projections
|
|
25
|
+
rl
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Configuration file for the Sphinx documentation builder.
|
|
2
|
+
#
|
|
3
|
+
# For the full list of built-in configuration values, see the documentation:
|
|
4
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
|
5
|
+
|
|
6
|
+
# -- Project information -----------------------------------------------------
|
|
7
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
|
8
|
+
|
|
9
|
+
project = 'solve_nivp'
|
|
10
|
+
copyright = '2025, David Riley'
|
|
11
|
+
author = 'David Riley'
|
|
12
|
+
release = 'March 26, 2025'
|
|
13
|
+
|
|
14
|
+
# -- General configuration ---------------------------------------------------
|
|
15
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
|
16
|
+
|
|
17
|
+
extensions = [
|
|
18
|
+
'sphinx.ext.autodoc',
|
|
19
|
+
'sphinx.ext.autosummary',
|
|
20
|
+
'sphinx.ext.napoleon', # NumPy/Google-style docstrings
|
|
21
|
+
'sphinx.ext.viewcode',
|
|
22
|
+
'sphinx.ext.mathjax',
|
|
23
|
+
'sphinx.ext.intersphinx',
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
# Generate autosummary pages automatically
|
|
27
|
+
autosummary_generate = True
|
|
28
|
+
|
|
29
|
+
# Type hints in description for cleaner signatures
|
|
30
|
+
autodoc_typehints = 'description'
|
|
31
|
+
|
|
32
|
+
# Napoleon options
|
|
33
|
+
napoleon_google_docstring = False
|
|
34
|
+
napoleon_numpy_docstring = True
|
|
35
|
+
|
|
36
|
+
# Intersphinx mappings for cross-references
|
|
37
|
+
intersphinx_mapping = {
|
|
38
|
+
'python': ('https://docs.python.org/3', None),
|
|
39
|
+
'numpy': ('https://numpy.org/doc/stable/', None),
|
|
40
|
+
'scipy': ('https://docs.scipy.org/doc/scipy/', None),
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
templates_path = ['_templates']
|
|
44
|
+
exclude_patterns = []
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
# -- Options for HTML output -------------------------------------------------
|
|
49
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
|
50
|
+
|
|
51
|
+
html_theme = 'alabaster'
|
|
52
|
+
html_static_path = ['_static']
|
|
53
|
+
|
|
54
|
+
latex_engine = 'xelatex'
|
|
55
|
+
# latex_elements = {
|
|
56
|
+
# 'preamble': r'\usepackage[utf8]{inputenc}\usepackage[T1]{fontenc}',
|
|
57
|
+
# }
|
|
58
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Development
|
|
2
|
+
===========
|
|
3
|
+
|
|
4
|
+
Testing
|
|
5
|
+
-------
|
|
6
|
+
Run the unit tests from the project root in a fresh virtual environment:
|
|
7
|
+
|
|
8
|
+
.. code-block:: bash
|
|
9
|
+
|
|
10
|
+
python3 -m venv .venv && source .venv/bin/activate
|
|
11
|
+
pip install -U pip
|
|
12
|
+
pip install -e .[test]
|
|
13
|
+
pytest -q
|
|
14
|
+
|
|
15
|
+
Documentation
|
|
16
|
+
-------------
|
|
17
|
+
Build the docs locally:
|
|
18
|
+
|
|
19
|
+
.. code-block:: bash
|
|
20
|
+
|
|
21
|
+
cd docs
|
|
22
|
+
make clean html
|
|
23
|
+
|
|
24
|
+
Then open ``_build/html/index.html`` in your browser.
|
|
25
|
+
|
|
26
|
+
Style and contributions
|
|
27
|
+
-----------------------
|
|
28
|
+
- Use NumPy-style docstrings (processed by ``napoleon``).
|
|
29
|
+
- Keep public APIs documented and covered by tests.
|
|
30
|
+
- Submit PRs with focused changes and include updates to docs/examples.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
Examples
|
|
2
|
+
========
|
|
3
|
+
|
|
4
|
+
Sign projection (scalar)
|
|
5
|
+
------------------------
|
|
6
|
+
|
|
7
|
+
.. code-block:: python
|
|
8
|
+
|
|
9
|
+
import numpy as np
|
|
10
|
+
from solve_nivp import solve_nivp, SignProjection
|
|
11
|
+
|
|
12
|
+
# trivial rhs, demonstrate projection behavior
|
|
13
|
+
rhs = lambda t, y: -y
|
|
14
|
+
t_span = (0.0, 0.2)
|
|
15
|
+
y0 = np.array([0.5, 0.0]) # y, w
|
|
16
|
+
|
|
17
|
+
proj = SignProjection(y_indices=0, w_indices=1)
|
|
18
|
+
|
|
19
|
+
t, y, h, fk, info = solve_nivp(
|
|
20
|
+
fun=lambda t, s: np.array([-s[0], 0.0]),
|
|
21
|
+
t_span=t_span,
|
|
22
|
+
y0=y0,
|
|
23
|
+
method='backward_euler',
|
|
24
|
+
projection='sign',
|
|
25
|
+
solver='semismooth_newton',
|
|
26
|
+
projection_opts={'y_indices': 0, 'w_indices': 1},
|
|
27
|
+
solver_opts={'globalization': 'linesearch'}
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
# y[:,0] is state y, y[:,1] is projected w in sign(y)
|
|
31
|
+
|
|
32
|
+
Coulomb projection (toy)
|
|
33
|
+
------------------------
|
|
34
|
+
|
|
35
|
+
.. code-block:: python
|
|
36
|
+
|
|
37
|
+
import numpy as np
|
|
38
|
+
from solve_nivp import solve_nivp, CoulombProjection
|
|
39
|
+
|
|
40
|
+
# toy constraint force: f_conf(y) = K y (diagonal)
|
|
41
|
+
K = np.array([2.0, 3.0, 0.0])
|
|
42
|
+
def con_force(y, t=None, Fk_val=None):
|
|
43
|
+
return K * y
|
|
44
|
+
|
|
45
|
+
y0 = np.zeros(6) # pairs (v_i, z_i)
|
|
46
|
+
t_span = (0.0, 0.1)
|
|
47
|
+
|
|
48
|
+
t, y, h, fk, info = solve_nivp(
|
|
49
|
+
fun=lambda t, s: -s,
|
|
50
|
+
t_span=t_span,
|
|
51
|
+
y0=y0,
|
|
52
|
+
method='composite',
|
|
53
|
+
projection='coulomb',
|
|
54
|
+
solver='VI',
|
|
55
|
+
projection_opts={
|
|
56
|
+
'con_force_func': con_force,
|
|
57
|
+
'rhok': np.ones_like(y0),
|
|
58
|
+
'constraint_indices': np.array([0, 2, 4]),
|
|
59
|
+
'conf_jacobian_mode': 'full',
|
|
60
|
+
},
|
|
61
|
+
)
|
|
62
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.. solve_nivp documentation master file, created by
|
|
2
|
+
sphinx-quickstart on Wed Mar 26 11:17:18 2025.
|
|
3
|
+
You can adapt this file completely to your liking, but it should at least
|
|
4
|
+
contain the root `toctree` directive.
|
|
5
|
+
|
|
6
|
+
solve_nivp documentation
|
|
7
|
+
========================
|
|
8
|
+
|
|
9
|
+
This site documents the public API and provides guidance for using the solvers and projections.
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
.. toctree::
|
|
13
|
+
:maxdepth: 2
|
|
14
|
+
:caption: Contents:
|
|
15
|
+
|
|
16
|
+
quickstart
|
|
17
|
+
examples
|
|
18
|
+
modules
|
|
19
|
+
development
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
solve_nivp API
|
|
3
|
+
==============
|
|
4
|
+
|
|
5
|
+
.. autosummary::
|
|
6
|
+
:toctree: api
|
|
7
|
+
:recursive:
|
|
8
|
+
:caption: Public modules
|
|
9
|
+
|
|
10
|
+
solve_nivp
|
|
11
|
+
solve_nivp.ODESystem
|
|
12
|
+
solve_nivp.ODESolver
|
|
13
|
+
solve_nivp.integrations
|
|
14
|
+
solve_nivp.adaptive_integrator
|
|
15
|
+
solve_nivp.nonlinear_solvers
|
|
16
|
+
solve_nivp.projections
|
|
17
|
+
solve_nivp.rl
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
Quickstart
|
|
2
|
+
==========
|
|
3
|
+
|
|
4
|
+
Install
|
|
5
|
+
-------
|
|
6
|
+
|
|
7
|
+
- Stable: ``pip install solve_nivp``
|
|
8
|
+
- From source (editable): ``pip install -e .[test]``
|
|
9
|
+
|
|
10
|
+
Minimal example
|
|
11
|
+
---------------
|
|
12
|
+
|
|
13
|
+
.. code-block:: python
|
|
14
|
+
|
|
15
|
+
import numpy as np
|
|
16
|
+
from solve_nivp import solve_nivp
|
|
17
|
+
|
|
18
|
+
# y' = -y with identity projection
|
|
19
|
+
rhs = lambda t, y: -y
|
|
20
|
+
t_span = (0.0, 1.0)
|
|
21
|
+
y0 = np.array([1.0])
|
|
22
|
+
|
|
23
|
+
t, y, h, fk, info = solve_nivp(
|
|
24
|
+
fun=rhs,
|
|
25
|
+
t_span=t_span,
|
|
26
|
+
y0=y0,
|
|
27
|
+
method='composite',
|
|
28
|
+
projection='identity',
|
|
29
|
+
solver='VI',
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
print(t[:5], y[:5])
|
|
33
|
+
|
|
34
|
+
Options
|
|
35
|
+
-------
|
|
36
|
+
- Projections: ``'identity'``, ``'sign'``, ``'coulomb'`` (see API docs for arguments like ``y_indices``, ``w_indices``, ``con_force_func``, ``conf_jacobian_mode``)
|
|
37
|
+
- Solvers: ``'VI'`` and ``'semismooth_newton'`` (globalization ``'none'`` or ``'linesearch'``)
|
|
38
|
+
- Integrators: BackwardEuler, Trapezoidal, ThetaMethod, CompositeMethod, EmbeddedBETR, SDIRK2
|
|
39
|
+
|
|
40
|
+
Numba acceleration
|
|
41
|
+
------------------
|
|
42
|
+
Some projector internals can use numba if available. To disable, pass ``use_numba=False`` to the relevant projection. To install: ``pip install numba``.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
solve\_nivp package
|
|
2
|
+
===================
|
|
3
|
+
|
|
4
|
+
.. automodule:: solve_nivp
|
|
5
|
+
:members:
|
|
6
|
+
:undoc-members:
|
|
7
|
+
:show-inheritance:
|
|
8
|
+
|
|
9
|
+
Submodules
|
|
10
|
+
----------
|
|
11
|
+
|
|
12
|
+
solve\_nivp.ODESolver module
|
|
13
|
+
----------------------------
|
|
14
|
+
|
|
15
|
+
.. automodule:: solve_nivp.ODESolver
|
|
16
|
+
:members:
|
|
17
|
+
:undoc-members:
|
|
18
|
+
:show-inheritance:
|
|
19
|
+
|
|
20
|
+
solve\_nivp.ODESystem module
|
|
21
|
+
----------------------------
|
|
22
|
+
|
|
23
|
+
.. automodule:: solve_nivp.ODESystem
|
|
24
|
+
:members:
|
|
25
|
+
:undoc-members:
|
|
26
|
+
:show-inheritance:
|
|
27
|
+
|
|
28
|
+
solve\_nivp.adaptive\_integrator module
|
|
29
|
+
---------------------------------------
|
|
30
|
+
|
|
31
|
+
.. automodule:: solve_nivp.adaptive_integrator
|
|
32
|
+
:members:
|
|
33
|
+
:undoc-members:
|
|
34
|
+
:show-inheritance:
|
|
35
|
+
|
|
36
|
+
solve\_nivp.integrations module
|
|
37
|
+
--------------------------------
|
|
38
|
+
|
|
39
|
+
.. automodule:: solve_nivp.integrations
|
|
40
|
+
:members:
|
|
41
|
+
:undoc-members:
|
|
42
|
+
:show-inheritance:
|
|
43
|
+
|
|
44
|
+
solve\_nivp.nonlinear\_solvers module
|
|
45
|
+
-------------------------------------
|
|
46
|
+
|
|
47
|
+
.. automodule:: solve_nivp.nonlinear_solvers
|
|
48
|
+
:members:
|
|
49
|
+
:undoc-members:
|
|
50
|
+
:show-inheritance:
|
|
51
|
+
|
|
52
|
+
solve\_nivp.projections module
|
|
53
|
+
------------------------------
|
|
54
|
+
|
|
55
|
+
.. automodule:: solve_nivp.projections
|
|
56
|
+
:members:
|
|
57
|
+
:undoc-members:
|
|
58
|
+
:show-inheritance:
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["setuptools", "wheel"]
|
|
2
|
+
requires = ["setuptools>=77", "wheel"]
|
|
3
3
|
build-backend = "setuptools.build_meta"
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "solve_nivp"
|
|
7
|
-
version = "0.2.0.
|
|
7
|
+
version = "0.2.0.dev2"
|
|
8
8
|
description = "A Python toolkit for integrating nonsmooth dynamical systems"
|
|
9
9
|
readme = "README.md"
|
|
10
|
-
license =
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
11
12
|
requires-python = ">=3.9"
|
|
12
13
|
authors = [
|
|
13
14
|
{ name = "David Riley" },
|
|
@@ -24,7 +25,6 @@ keywords = [
|
|
|
24
25
|
classifiers = [
|
|
25
26
|
"Development Status :: 4 - Beta",
|
|
26
27
|
"Intended Audience :: Science/Research",
|
|
27
|
-
"License :: OSI Approved :: MIT License",
|
|
28
28
|
"Programming Language :: Python :: 3",
|
|
29
29
|
"Topic :: Scientific/Engineering :: Mathematics",
|
|
30
30
|
"Topic :: Scientific/Engineering :: Physics",
|
|
@@ -66,3 +66,8 @@ solve_nivp-selftest = "solve_nivp._selftest:main"
|
|
|
66
66
|
Homepage = "https://github.com/ERC-INJECT/solve_nivp"
|
|
67
67
|
Documentation = "https://github.com/ERC-INJECT/solve_nivp/tree/main/docs"
|
|
68
68
|
Issues = "https://github.com/ERC-INJECT/solve_nivp/issues"
|
|
69
|
+
|
|
70
|
+
[tool.setuptools.packages.find]
|
|
71
|
+
where = ["src"]
|
|
72
|
+
include = ["solve_nivp*"]
|
|
73
|
+
exclude = ["tests*"]
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
[pytest]
|
|
2
|
+
addopts = -q -m "not slow and not external and not examples"
|
|
3
|
+
testpaths = tests
|
|
4
|
+
markers =
|
|
5
|
+
unit: fast package-level unit tests.
|
|
6
|
+
slow: long-running numerical or benchmark-style tests.
|
|
7
|
+
examples: tests that depend on example notebooks/scripts or generated example helpers.
|
|
8
|
+
external: tests that require optional external projects or data outside the core package.
|
|
9
|
+
petsc: tests that require petsc4py/PETSc.
|
|
10
|
+
rl: tests that require reinforcement-learning optional dependencies.
|