PyFinitDiff 2.3.1__tar.gz → 2.3.3__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.
- pyfinitdiff-2.3.3/PKG-INFO +213 -0
- pyfinitdiff-2.3.3/PyFinitDiff/_version.py +5 -0
- {pyfinitdiff-2.3.1 → pyfinitdiff-2.3.3}/PyFinitDiff/coefficients/backward.py +12 -1
- {pyfinitdiff-2.3.1 → pyfinitdiff-2.3.3}/PyFinitDiff/coefficients/central.py +2 -2
- {pyfinitdiff-2.3.1 → pyfinitdiff-2.3.3}/PyFinitDiff/coefficients/forward.py +12 -1
- pyfinitdiff-2.3.3/PyFinitDiff.egg-info/PKG-INFO +213 -0
- pyfinitdiff-2.3.3/PyFinitDiff.egg-info/SOURCES.txt +35 -0
- pyfinitdiff-2.3.3/PyFinitDiff.egg-info/requires.txt +23 -0
- pyfinitdiff-2.3.3/README.rst +171 -0
- {pyfinitdiff-2.3.1 → pyfinitdiff-2.3.3}/pyproject.toml +27 -51
- pyfinitdiff-2.3.3/tests/test_eighth_order_first_derivative.py +27 -0
- pyfinitdiff-2.3.1/.flake8 +0 -11
- pyfinitdiff-2.3.1/.github/dependabot.yml +0 -11
- pyfinitdiff-2.3.1/.github/workflows/deploy_PyPi.yml +0 -20
- pyfinitdiff-2.3.1/.github/workflows/deploy_anaconda.yml +0 -21
- pyfinitdiff-2.3.1/.github/workflows/deploy_coverage.yml +0 -25
- pyfinitdiff-2.3.1/.github/workflows/deploy_documentation.yml +0 -24
- pyfinitdiff-2.3.1/.gitignore +0 -28
- pyfinitdiff-2.3.1/PKG-INFO +0 -208
- pyfinitdiff-2.3.1/PyFinitDiff/_version.py +0 -34
- pyfinitdiff-2.3.1/PyFinitDiff.egg-info/PKG-INFO +0 -208
- pyfinitdiff-2.3.1/PyFinitDiff.egg-info/SOURCES.txt +0 -79
- pyfinitdiff-2.3.1/PyFinitDiff.egg-info/requires.txt +0 -21
- pyfinitdiff-2.3.1/README.rst +0 -145
- pyfinitdiff-2.3.1/docs/Makefile +0 -19
- pyfinitdiff-2.3.1/docs/examples/README.rst +0 -6
- pyfinitdiff-2.3.1/docs/examples/eigenmodes_1d/README.rst +0 -2
- pyfinitdiff-2.3.1/docs/examples/eigenmodes_1d/example_0.py +0 -93
- pyfinitdiff-2.3.1/docs/examples/eigenmodes_1d/example_1.py +0 -92
- pyfinitdiff-2.3.1/docs/examples/eigenmodes_1d/example_2.py +0 -91
- pyfinitdiff-2.3.1/docs/examples/eigenmodes_1d/example_3.py +0 -91
- pyfinitdiff-2.3.1/docs/examples/eigenmodes_2d/README.rst +0 -2
- pyfinitdiff-2.3.1/docs/examples/eigenmodes_2d/example_0.py +0 -94
- pyfinitdiff-2.3.1/docs/examples/eigenmodes_2d/example_1.py +0 -94
- pyfinitdiff-2.3.1/docs/examples/eigenmodes_2d/example_2.py +0 -96
- pyfinitdiff-2.3.1/docs/examples/eigenmodes_2d/example_3.py +0 -94
- pyfinitdiff-2.3.1/docs/examples/eigenmodes_2d/example_4.py +0 -90
- pyfinitdiff-2.3.1/docs/examples/eigenmodes_2d/example_5.py +0 -94
- pyfinitdiff-2.3.1/docs/examples/eigenmodes_2d/example_6.py +0 -94
- pyfinitdiff-2.3.1/docs/examples/eigenmodes_2d/example_8.py +0 -95
- pyfinitdiff-2.3.1/docs/examples/eigenmodes_2d/examples_7.py +0 -94
- pyfinitdiff-2.3.1/docs/examples/extras/README.rst +0 -2
- pyfinitdiff-2.3.1/docs/examples/extras/gradient.py +0 -63
- pyfinitdiff-2.3.1/docs/examples/extras/plot_WM_field.py +0 -72
- pyfinitdiff-2.3.1/docs/examples/triplets/README.rst +0 -2
- pyfinitdiff-2.3.1/docs/examples/triplets/plot_triplets_0.py +0 -50
- pyfinitdiff-2.3.1/docs/examples/triplets/plot_triplets_1.py +0 -50
- pyfinitdiff-2.3.1/docs/examples/triplets/plot_triplets_2.py +0 -51
- pyfinitdiff-2.3.1/docs/examples/triplets/plot_triplets_3.py +0 -51
- pyfinitdiff-2.3.1/docs/images/logo.png +0 -0
- pyfinitdiff-2.3.1/docs/images/triplet_example_0.png +0 -0
- pyfinitdiff-2.3.1/docs/make.bat +0 -35
- pyfinitdiff-2.3.1/docs/source/_static/default.css +0 -19
- pyfinitdiff-2.3.1/docs/source/code.rst +0 -55
- pyfinitdiff-2.3.1/docs/source/conf.py +0 -169
- pyfinitdiff-2.3.1/docs/source/gallery/index.rst +0 -12
- pyfinitdiff-2.3.1/docs/source/index.rst +0 -14
- pyfinitdiff-2.3.1/docs/source/references.rst +0 -8
- pyfinitdiff-2.3.1/docs/source/sg_execution_times.rst +0 -91
- pyfinitdiff-2.3.1/docs/source/theory.rst +0 -7
- pyfinitdiff-2.3.1/meta.yaml +0 -62
- pyfinitdiff-2.3.1/tests/__init__.py +0 -0
- {pyfinitdiff-2.3.1 → pyfinitdiff-2.3.3}/LICENSE +0 -0
- {pyfinitdiff-2.3.1 → pyfinitdiff-2.3.3}/PyFinitDiff/__init__.py +0 -0
- {pyfinitdiff-2.3.1 → pyfinitdiff-2.3.3}/PyFinitDiff/boundary_values.py +0 -0
- {pyfinitdiff-2.3.1 → pyfinitdiff-2.3.3}/PyFinitDiff/coefficients/__init__.py +0 -0
- {pyfinitdiff-2.3.1 → pyfinitdiff-2.3.3}/PyFinitDiff/diagonal.py +0 -0
- {pyfinitdiff-2.3.1 → pyfinitdiff-2.3.3}/PyFinitDiff/directories.py +0 -0
- {pyfinitdiff-2.3.1 → pyfinitdiff-2.3.3}/PyFinitDiff/finite_difference_1D/__init__.py +0 -0
- {pyfinitdiff-2.3.1 → pyfinitdiff-2.3.3}/PyFinitDiff/finite_difference_1D/boundaries.py +0 -0
- {pyfinitdiff-2.3.1 → pyfinitdiff-2.3.3}/PyFinitDiff/finite_difference_1D/derivative.py +0 -0
- {pyfinitdiff-2.3.1 → pyfinitdiff-2.3.3}/PyFinitDiff/finite_difference_1D/finite_difference.py +0 -0
- {pyfinitdiff-2.3.1 → pyfinitdiff-2.3.3}/PyFinitDiff/finite_difference_1D/utils.py +0 -0
- {pyfinitdiff-2.3.1 → pyfinitdiff-2.3.3}/PyFinitDiff/finite_difference_2D/__init__.py +0 -0
- {pyfinitdiff-2.3.1 → pyfinitdiff-2.3.3}/PyFinitDiff/finite_difference_2D/boundaries.py +0 -0
- {pyfinitdiff-2.3.1 → pyfinitdiff-2.3.3}/PyFinitDiff/finite_difference_2D/derivative.py +0 -0
- {pyfinitdiff-2.3.1 → pyfinitdiff-2.3.3}/PyFinitDiff/finite_difference_2D/finite_difference.py +0 -0
- {pyfinitdiff-2.3.1 → pyfinitdiff-2.3.3}/PyFinitDiff/finite_difference_2D/utils.py +0 -0
- {pyfinitdiff-2.3.1 → pyfinitdiff-2.3.3}/PyFinitDiff/triplet.py +0 -0
- {pyfinitdiff-2.3.1 → pyfinitdiff-2.3.3}/PyFinitDiff.egg-info/dependency_links.txt +0 -0
- {pyfinitdiff-2.3.1 → pyfinitdiff-2.3.3}/PyFinitDiff.egg-info/top_level.txt +0 -0
- {pyfinitdiff-2.3.1 → pyfinitdiff-2.3.3}/setup.cfg +0 -0
- {pyfinitdiff-2.3.1 → pyfinitdiff-2.3.3}/tests/test_1D_api.py +0 -0
- {pyfinitdiff-2.3.1 → pyfinitdiff-2.3.3}/tests/test_1D_derivative.py +0 -0
- {pyfinitdiff-2.3.1 → pyfinitdiff-2.3.3}/tests/test_2D_api.py +0 -0
- {pyfinitdiff-2.3.1 → pyfinitdiff-2.3.3}/tests/test_2D_derivative.py +0 -0
- {pyfinitdiff-2.3.1 → pyfinitdiff-2.3.3}/tests/test_2D_eigen.py +0 -0
- {pyfinitdiff-2.3.1 → pyfinitdiff-2.3.3}/tests/test_triplet.py +0 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: PyFinitDiff
|
|
3
|
+
Version: 2.3.3
|
|
4
|
+
Summary: A package for generating finite-difference matrices, particularly suited for physics and engineering applications.
|
|
5
|
+
Author-email: Martin Poinsinet de Sivry-Houle <martin.poinsinet.de.sivry@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/MartinPdeS/PyFinitDiff
|
|
8
|
+
Project-URL: Documentation, https://martinpdes.github.io/PyFinitDiff/
|
|
9
|
+
Project-URL: Repository, https://github.com/MartinPdeS/PyFinitDiff.git
|
|
10
|
+
Keywords: finite-difference,solving,linear algebra,physics,matrix,engineering
|
|
11
|
+
Classifier: Programming Language :: Python
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
16
|
+
Classifier: Development Status :: 4 - Beta
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
18
|
+
Classifier: Intended Audience :: Science/Research
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/x-rst
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: scipy>=1.14
|
|
23
|
+
Requires-Dist: pydantic<3,>=2
|
|
24
|
+
Requires-Dist: numpy
|
|
25
|
+
Requires-Dist: MPSPlots
|
|
26
|
+
Requires-Dist: tabulate
|
|
27
|
+
Provides-Extra: release
|
|
28
|
+
Requires-Dist: martinpdes-maintenance==0.2.3; extra == "release"
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: martinpdes-maintenance[quality]==0.2.3; extra == "dev"
|
|
31
|
+
Requires-Dist: twine<7,>=6; extra == "dev"
|
|
32
|
+
Requires-Dist: flake8==7.3.0; extra == "dev"
|
|
33
|
+
Provides-Extra: testing
|
|
34
|
+
Requires-Dist: martinpdes-maintenance[testing]==0.2.3; extra == "testing"
|
|
35
|
+
Requires-Dist: pytest<9,>=7.4; extra == "testing"
|
|
36
|
+
Requires-Dist: pytest-cov<8; extra == "testing"
|
|
37
|
+
Requires-Dist: pytest-json-report~=1.5; extra == "testing"
|
|
38
|
+
Requires-Dist: coverage~=7.6; extra == "testing"
|
|
39
|
+
Provides-Extra: documentation
|
|
40
|
+
Requires-Dist: MartinPdeS-docs<0.5,>=0.4.0; extra == "documentation"
|
|
41
|
+
Dynamic: license-file
|
|
42
|
+
|
|
43
|
+
PyFinitDiff
|
|
44
|
+
===========
|
|
45
|
+
|
|
46
|
+
.. image:: https://raw.githubusercontent.com/MartinPdeS/PyFinitDiff/HEAD/docs/images/logo.png
|
|
47
|
+
:alt: PyFinitDiff logo
|
|
48
|
+
:width: 100%
|
|
49
|
+
|
|
50
|
+
.. list-table::
|
|
51
|
+
:width: 100%
|
|
52
|
+
:widths: 35 65
|
|
53
|
+
:header-rows: 1
|
|
54
|
+
|
|
55
|
+
* - Badge
|
|
56
|
+
- Status
|
|
57
|
+
* - Python versions
|
|
58
|
+
- |mps-python|
|
|
59
|
+
* - Documentation
|
|
60
|
+
- |mps-docs|
|
|
61
|
+
* - Tests
|
|
62
|
+
- |mps-ci| |mps-coverage|
|
|
63
|
+
* - PyPI
|
|
64
|
+
- |mps-pypi| |mps-downloads|
|
|
65
|
+
* - Conda
|
|
66
|
+
- |mps-conda| |mps-conda-downloads| |mps-conda-release|
|
|
67
|
+
|
|
68
|
+
A package for generating finite-difference matrices, particularly suited for physics and engineering applications.
|
|
69
|
+
|
|
70
|
+
Construct sparse derivative operators from the mesh spacing, derivative order,
|
|
71
|
+
accuracy, and boundary conditions. Inspect the matrix entries before combining the
|
|
72
|
+
operator with a potential or solving an eigenvalue problem.
|
|
73
|
+
|
|
74
|
+
Installation
|
|
75
|
+
------------
|
|
76
|
+
|
|
77
|
+
Requires Python ``>=3.10``.
|
|
78
|
+
|
|
79
|
+
.. code-block:: console
|
|
80
|
+
|
|
81
|
+
$ python -m pip install PyFinitDiff
|
|
82
|
+
|
|
83
|
+
Install from the ``martinpdes`` Conda channel:
|
|
84
|
+
|
|
85
|
+
.. code-block:: console
|
|
86
|
+
|
|
87
|
+
$ conda install -c martinpdes pyfinitdiff
|
|
88
|
+
|
|
89
|
+
For an editable source installation:
|
|
90
|
+
|
|
91
|
+
.. code-block:: console
|
|
92
|
+
|
|
93
|
+
$ git clone https://github.com/MartinPdeS/PyFinitDiff.git
|
|
94
|
+
$ cd PyFinitDiff
|
|
95
|
+
$ python -m pip install -e .
|
|
96
|
+
|
|
97
|
+
Inspect a two-dimensional finite-difference stencil
|
|
98
|
+
---------------------------------------------------
|
|
99
|
+
|
|
100
|
+
.. code-block:: python
|
|
101
|
+
|
|
102
|
+
"""
|
|
103
|
+
Example: triplets 0
|
|
104
|
+
===================
|
|
105
|
+
|
|
106
|
+
In this example, we generate a finite difference instance and visualize the resulting triplets.
|
|
107
|
+
The boundary conditions, derivative, and accuracy settings are specified for demonstration purposes.
|
|
108
|
+
"""
|
|
109
|
+
|
|
110
|
+
# %%
|
|
111
|
+
# .. list-table:: Finite-difference parameters
|
|
112
|
+
# :widths: 25
|
|
113
|
+
# :header-rows: 1
|
|
114
|
+
#
|
|
115
|
+
# * - boundaries: {left: 0, right: 0, top: 0, bottom: 0}
|
|
116
|
+
# * - derivative: 2
|
|
117
|
+
# * - accuracy: 4
|
|
118
|
+
|
|
119
|
+
# %%
|
|
120
|
+
# Importing required packages
|
|
121
|
+
# ---------------------------
|
|
122
|
+
# Here we import the necessary libraries for numerical computations and finite difference operations.
|
|
123
|
+
|
|
124
|
+
from PyFinitDiff.finite_difference_2D import FiniteDifference, Boundaries
|
|
125
|
+
import matplotlib.pyplot as plt
|
|
126
|
+
|
|
127
|
+
# %%
|
|
128
|
+
# Setting up the finite difference instance and boundaries
|
|
129
|
+
# ---------------------------------------------------------
|
|
130
|
+
# We define the grid size and set up the finite difference instance with specified boundary conditions.
|
|
131
|
+
|
|
132
|
+
sparse_instance = FiniteDifference(
|
|
133
|
+
n_x=20,
|
|
134
|
+
n_y=20,
|
|
135
|
+
dx=1,
|
|
136
|
+
dy=1,
|
|
137
|
+
derivative=2,
|
|
138
|
+
accuracy=2,
|
|
139
|
+
boundaries=Boundaries()
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
# %%
|
|
143
|
+
# Visualizing the triplets with matplotlib
|
|
144
|
+
# -----------------------------------------
|
|
145
|
+
# We plot the triplets using matplotlib to visualize the finite difference operator.
|
|
146
|
+
|
|
147
|
+
sparse_instance.triplet.plot()
|
|
148
|
+
|
|
149
|
+
plt.show()
|
|
150
|
+
|
|
151
|
+
# -
|
|
152
|
+
|
|
153
|
+
.. figure:: https://raw.githubusercontent.com/MartinPdeS/PyFinitDiff/HEAD/docs/images/triplet_example_0.png
|
|
154
|
+
|
|
155
|
+
Triplet representation of the finite-difference operator.
|
|
156
|
+
|
|
157
|
+
Documentation
|
|
158
|
+
-------------
|
|
159
|
+
|
|
160
|
+
Use the `PyFinitDiff documentation <https://martinpdes.github.io/PyFinitDiff/>`__ to work through
|
|
161
|
+
examples and look up the inputs and return values of individual functions.
|
|
162
|
+
|
|
163
|
+
Contributing
|
|
164
|
+
------------
|
|
165
|
+
|
|
166
|
+
Bug reports, worked examples, and documentation corrections are welcome.
|
|
167
|
+
To set up a development checkout and run the tests, follow the `contributing guide <https://github.com/MartinPdeS/PyFinitDiff/blob/HEAD/CONTRIBUTING.md>`__.
|
|
168
|
+
|
|
169
|
+
Contact
|
|
170
|
+
-------
|
|
171
|
+
|
|
172
|
+
For questions, contact `Martin Poinsinet de Sivry-Houle <mailto:martin.poinsinet.de.sivry@gmail.com?subject=PyFinitDiff>`__.
|
|
173
|
+
|
|
174
|
+
License
|
|
175
|
+
-------
|
|
176
|
+
|
|
177
|
+
PyFinitDiff is licensed under `MIT <https://github.com/MartinPdeS/PyFinitDiff/blob/HEAD/LICENSE>`__.
|
|
178
|
+
|
|
179
|
+
.. |mps-python| image:: https://img.shields.io/pypi/pyversions/pyfinitdiff.svg
|
|
180
|
+
:alt: Supported Python versions
|
|
181
|
+
:target: https://pypi.org/project/pyfinitdiff/
|
|
182
|
+
|
|
183
|
+
.. |mps-pypi| image:: https://img.shields.io/pypi/v/pyfinitdiff.svg
|
|
184
|
+
:alt: PyPI version
|
|
185
|
+
:target: https://pypi.org/project/pyfinitdiff/
|
|
186
|
+
|
|
187
|
+
.. |mps-downloads| image:: https://img.shields.io/pypi/dm/pyfinitdiff.svg
|
|
188
|
+
:alt: Monthly PyPI downloads
|
|
189
|
+
:target: https://pypistats.org/packages/pyfinitdiff
|
|
190
|
+
|
|
191
|
+
.. |mps-docs| image:: https://github.com/MartinPdeS/PyFinitDiff/actions/workflows/deploy_documentation.yml/badge.svg
|
|
192
|
+
:alt: Documentation
|
|
193
|
+
:target: https://martinpdes.github.io/PyFinitDiff/
|
|
194
|
+
|
|
195
|
+
.. |mps-ci| image:: https://github.com/MartinPdeS/PyFinitDiff/actions/workflows/tests.yml/badge.svg
|
|
196
|
+
:alt: Tests
|
|
197
|
+
:target: https://github.com/MartinPdeS/PyFinitDiff/actions/workflows/tests.yml
|
|
198
|
+
|
|
199
|
+
.. |mps-coverage| image:: https://raw.githubusercontent.com/MartinPdeS/PyFinitDiff/python-coverage-comment-action-data/badge.svg
|
|
200
|
+
:alt: Test coverage
|
|
201
|
+
:target: https://htmlpreview.github.io/?https://github.com/MartinPdeS/PyFinitDiff/blob/python-coverage-comment-action-data/htmlcov/index.html
|
|
202
|
+
|
|
203
|
+
.. |mps-conda| image:: https://anaconda.org/martinpdes/pyfinitdiff/badges/version.svg
|
|
204
|
+
:alt: Anaconda version
|
|
205
|
+
:target: https://anaconda.org/martinpdes/pyfinitdiff
|
|
206
|
+
|
|
207
|
+
.. |mps-conda-downloads| image:: https://anaconda.org/martinpdes/pyfinitdiff/badges/downloads.svg
|
|
208
|
+
:alt: Anaconda downloads
|
|
209
|
+
:target: https://anaconda.org/martinpdes/pyfinitdiff
|
|
210
|
+
|
|
211
|
+
.. |mps-conda-release| image:: https://anaconda.org/martinpdes/pyfinitdiff/badges/latest_release_relative_date.svg
|
|
212
|
+
:alt: Latest Anaconda release
|
|
213
|
+
:target: https://anaconda.org/martinpdes/pyfinitdiff
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
__accuracy_list__ = [2, 4, 6]
|
|
2
|
+
__accuracy_list__ = [2, 4, 6, 8]
|
|
3
3
|
__derivative_list__ = [1, 2, 3]
|
|
4
4
|
|
|
5
5
|
coefficients = {
|
|
@@ -24,6 +24,17 @@ coefficients = {
|
|
|
24
24
|
(-4, +15.0 / 4.0),
|
|
25
25
|
(-5, -6.0 / 5.0),
|
|
26
26
|
(-6, +1.0 / 6.0)
|
|
27
|
+
),
|
|
28
|
+
'a8': (
|
|
29
|
+
(+0, +761.0 / 280.0),
|
|
30
|
+
(-1, -8.0),
|
|
31
|
+
(-2, +14.0),
|
|
32
|
+
(-3, -56.0 / 3.0),
|
|
33
|
+
(-4, +35.0 / 2.0),
|
|
34
|
+
(-5, -56.0 / 5.0),
|
|
35
|
+
(-6, +14.0 / 3.0),
|
|
36
|
+
(-7, -8.0 / 7.0),
|
|
37
|
+
(-8, +1.0 / 8.0),
|
|
27
38
|
)
|
|
28
39
|
},
|
|
29
40
|
'd2': {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
__accuracy_list__ = [2, 4, 6]
|
|
1
|
+
__accuracy_list__ = [2, 4, 6, 8]
|
|
2
2
|
__derivative_list__ = [1, 2, 3]
|
|
3
3
|
|
|
4
4
|
|
|
@@ -25,6 +25,17 @@ coefficients = {
|
|
|
25
25
|
(+4, -15.0 / 4.0),
|
|
26
26
|
(+5, +6.0 / 5.0),
|
|
27
27
|
(+6, -1.0 / 6.0)
|
|
28
|
+
),
|
|
29
|
+
'a8': (
|
|
30
|
+
(+0, -761.0 / 280.0),
|
|
31
|
+
(+1, +8.0),
|
|
32
|
+
(+2, -14.0),
|
|
33
|
+
(+3, +56.0 / 3.0),
|
|
34
|
+
(+4, -35.0 / 2.0),
|
|
35
|
+
(+5, +56.0 / 5.0),
|
|
36
|
+
(+6, -14.0 / 3.0),
|
|
37
|
+
(+7, +8.0 / 7.0),
|
|
38
|
+
(+8, -1.0 / 8.0),
|
|
28
39
|
)
|
|
29
40
|
},
|
|
30
41
|
'd2': {
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: PyFinitDiff
|
|
3
|
+
Version: 2.3.3
|
|
4
|
+
Summary: A package for generating finite-difference matrices, particularly suited for physics and engineering applications.
|
|
5
|
+
Author-email: Martin Poinsinet de Sivry-Houle <martin.poinsinet.de.sivry@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/MartinPdeS/PyFinitDiff
|
|
8
|
+
Project-URL: Documentation, https://martinpdes.github.io/PyFinitDiff/
|
|
9
|
+
Project-URL: Repository, https://github.com/MartinPdeS/PyFinitDiff.git
|
|
10
|
+
Keywords: finite-difference,solving,linear algebra,physics,matrix,engineering
|
|
11
|
+
Classifier: Programming Language :: Python
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
16
|
+
Classifier: Development Status :: 4 - Beta
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
18
|
+
Classifier: Intended Audience :: Science/Research
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/x-rst
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: scipy>=1.14
|
|
23
|
+
Requires-Dist: pydantic<3,>=2
|
|
24
|
+
Requires-Dist: numpy
|
|
25
|
+
Requires-Dist: MPSPlots
|
|
26
|
+
Requires-Dist: tabulate
|
|
27
|
+
Provides-Extra: release
|
|
28
|
+
Requires-Dist: martinpdes-maintenance==0.2.3; extra == "release"
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: martinpdes-maintenance[quality]==0.2.3; extra == "dev"
|
|
31
|
+
Requires-Dist: twine<7,>=6; extra == "dev"
|
|
32
|
+
Requires-Dist: flake8==7.3.0; extra == "dev"
|
|
33
|
+
Provides-Extra: testing
|
|
34
|
+
Requires-Dist: martinpdes-maintenance[testing]==0.2.3; extra == "testing"
|
|
35
|
+
Requires-Dist: pytest<9,>=7.4; extra == "testing"
|
|
36
|
+
Requires-Dist: pytest-cov<8; extra == "testing"
|
|
37
|
+
Requires-Dist: pytest-json-report~=1.5; extra == "testing"
|
|
38
|
+
Requires-Dist: coverage~=7.6; extra == "testing"
|
|
39
|
+
Provides-Extra: documentation
|
|
40
|
+
Requires-Dist: MartinPdeS-docs<0.5,>=0.4.0; extra == "documentation"
|
|
41
|
+
Dynamic: license-file
|
|
42
|
+
|
|
43
|
+
PyFinitDiff
|
|
44
|
+
===========
|
|
45
|
+
|
|
46
|
+
.. image:: https://raw.githubusercontent.com/MartinPdeS/PyFinitDiff/HEAD/docs/images/logo.png
|
|
47
|
+
:alt: PyFinitDiff logo
|
|
48
|
+
:width: 100%
|
|
49
|
+
|
|
50
|
+
.. list-table::
|
|
51
|
+
:width: 100%
|
|
52
|
+
:widths: 35 65
|
|
53
|
+
:header-rows: 1
|
|
54
|
+
|
|
55
|
+
* - Badge
|
|
56
|
+
- Status
|
|
57
|
+
* - Python versions
|
|
58
|
+
- |mps-python|
|
|
59
|
+
* - Documentation
|
|
60
|
+
- |mps-docs|
|
|
61
|
+
* - Tests
|
|
62
|
+
- |mps-ci| |mps-coverage|
|
|
63
|
+
* - PyPI
|
|
64
|
+
- |mps-pypi| |mps-downloads|
|
|
65
|
+
* - Conda
|
|
66
|
+
- |mps-conda| |mps-conda-downloads| |mps-conda-release|
|
|
67
|
+
|
|
68
|
+
A package for generating finite-difference matrices, particularly suited for physics and engineering applications.
|
|
69
|
+
|
|
70
|
+
Construct sparse derivative operators from the mesh spacing, derivative order,
|
|
71
|
+
accuracy, and boundary conditions. Inspect the matrix entries before combining the
|
|
72
|
+
operator with a potential or solving an eigenvalue problem.
|
|
73
|
+
|
|
74
|
+
Installation
|
|
75
|
+
------------
|
|
76
|
+
|
|
77
|
+
Requires Python ``>=3.10``.
|
|
78
|
+
|
|
79
|
+
.. code-block:: console
|
|
80
|
+
|
|
81
|
+
$ python -m pip install PyFinitDiff
|
|
82
|
+
|
|
83
|
+
Install from the ``martinpdes`` Conda channel:
|
|
84
|
+
|
|
85
|
+
.. code-block:: console
|
|
86
|
+
|
|
87
|
+
$ conda install -c martinpdes pyfinitdiff
|
|
88
|
+
|
|
89
|
+
For an editable source installation:
|
|
90
|
+
|
|
91
|
+
.. code-block:: console
|
|
92
|
+
|
|
93
|
+
$ git clone https://github.com/MartinPdeS/PyFinitDiff.git
|
|
94
|
+
$ cd PyFinitDiff
|
|
95
|
+
$ python -m pip install -e .
|
|
96
|
+
|
|
97
|
+
Inspect a two-dimensional finite-difference stencil
|
|
98
|
+
---------------------------------------------------
|
|
99
|
+
|
|
100
|
+
.. code-block:: python
|
|
101
|
+
|
|
102
|
+
"""
|
|
103
|
+
Example: triplets 0
|
|
104
|
+
===================
|
|
105
|
+
|
|
106
|
+
In this example, we generate a finite difference instance and visualize the resulting triplets.
|
|
107
|
+
The boundary conditions, derivative, and accuracy settings are specified for demonstration purposes.
|
|
108
|
+
"""
|
|
109
|
+
|
|
110
|
+
# %%
|
|
111
|
+
# .. list-table:: Finite-difference parameters
|
|
112
|
+
# :widths: 25
|
|
113
|
+
# :header-rows: 1
|
|
114
|
+
#
|
|
115
|
+
# * - boundaries: {left: 0, right: 0, top: 0, bottom: 0}
|
|
116
|
+
# * - derivative: 2
|
|
117
|
+
# * - accuracy: 4
|
|
118
|
+
|
|
119
|
+
# %%
|
|
120
|
+
# Importing required packages
|
|
121
|
+
# ---------------------------
|
|
122
|
+
# Here we import the necessary libraries for numerical computations and finite difference operations.
|
|
123
|
+
|
|
124
|
+
from PyFinitDiff.finite_difference_2D import FiniteDifference, Boundaries
|
|
125
|
+
import matplotlib.pyplot as plt
|
|
126
|
+
|
|
127
|
+
# %%
|
|
128
|
+
# Setting up the finite difference instance and boundaries
|
|
129
|
+
# ---------------------------------------------------------
|
|
130
|
+
# We define the grid size and set up the finite difference instance with specified boundary conditions.
|
|
131
|
+
|
|
132
|
+
sparse_instance = FiniteDifference(
|
|
133
|
+
n_x=20,
|
|
134
|
+
n_y=20,
|
|
135
|
+
dx=1,
|
|
136
|
+
dy=1,
|
|
137
|
+
derivative=2,
|
|
138
|
+
accuracy=2,
|
|
139
|
+
boundaries=Boundaries()
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
# %%
|
|
143
|
+
# Visualizing the triplets with matplotlib
|
|
144
|
+
# -----------------------------------------
|
|
145
|
+
# We plot the triplets using matplotlib to visualize the finite difference operator.
|
|
146
|
+
|
|
147
|
+
sparse_instance.triplet.plot()
|
|
148
|
+
|
|
149
|
+
plt.show()
|
|
150
|
+
|
|
151
|
+
# -
|
|
152
|
+
|
|
153
|
+
.. figure:: https://raw.githubusercontent.com/MartinPdeS/PyFinitDiff/HEAD/docs/images/triplet_example_0.png
|
|
154
|
+
|
|
155
|
+
Triplet representation of the finite-difference operator.
|
|
156
|
+
|
|
157
|
+
Documentation
|
|
158
|
+
-------------
|
|
159
|
+
|
|
160
|
+
Use the `PyFinitDiff documentation <https://martinpdes.github.io/PyFinitDiff/>`__ to work through
|
|
161
|
+
examples and look up the inputs and return values of individual functions.
|
|
162
|
+
|
|
163
|
+
Contributing
|
|
164
|
+
------------
|
|
165
|
+
|
|
166
|
+
Bug reports, worked examples, and documentation corrections are welcome.
|
|
167
|
+
To set up a development checkout and run the tests, follow the `contributing guide <https://github.com/MartinPdeS/PyFinitDiff/blob/HEAD/CONTRIBUTING.md>`__.
|
|
168
|
+
|
|
169
|
+
Contact
|
|
170
|
+
-------
|
|
171
|
+
|
|
172
|
+
For questions, contact `Martin Poinsinet de Sivry-Houle <mailto:martin.poinsinet.de.sivry@gmail.com?subject=PyFinitDiff>`__.
|
|
173
|
+
|
|
174
|
+
License
|
|
175
|
+
-------
|
|
176
|
+
|
|
177
|
+
PyFinitDiff is licensed under `MIT <https://github.com/MartinPdeS/PyFinitDiff/blob/HEAD/LICENSE>`__.
|
|
178
|
+
|
|
179
|
+
.. |mps-python| image:: https://img.shields.io/pypi/pyversions/pyfinitdiff.svg
|
|
180
|
+
:alt: Supported Python versions
|
|
181
|
+
:target: https://pypi.org/project/pyfinitdiff/
|
|
182
|
+
|
|
183
|
+
.. |mps-pypi| image:: https://img.shields.io/pypi/v/pyfinitdiff.svg
|
|
184
|
+
:alt: PyPI version
|
|
185
|
+
:target: https://pypi.org/project/pyfinitdiff/
|
|
186
|
+
|
|
187
|
+
.. |mps-downloads| image:: https://img.shields.io/pypi/dm/pyfinitdiff.svg
|
|
188
|
+
:alt: Monthly PyPI downloads
|
|
189
|
+
:target: https://pypistats.org/packages/pyfinitdiff
|
|
190
|
+
|
|
191
|
+
.. |mps-docs| image:: https://github.com/MartinPdeS/PyFinitDiff/actions/workflows/deploy_documentation.yml/badge.svg
|
|
192
|
+
:alt: Documentation
|
|
193
|
+
:target: https://martinpdes.github.io/PyFinitDiff/
|
|
194
|
+
|
|
195
|
+
.. |mps-ci| image:: https://github.com/MartinPdeS/PyFinitDiff/actions/workflows/tests.yml/badge.svg
|
|
196
|
+
:alt: Tests
|
|
197
|
+
:target: https://github.com/MartinPdeS/PyFinitDiff/actions/workflows/tests.yml
|
|
198
|
+
|
|
199
|
+
.. |mps-coverage| image:: https://raw.githubusercontent.com/MartinPdeS/PyFinitDiff/python-coverage-comment-action-data/badge.svg
|
|
200
|
+
:alt: Test coverage
|
|
201
|
+
:target: https://htmlpreview.github.io/?https://github.com/MartinPdeS/PyFinitDiff/blob/python-coverage-comment-action-data/htmlcov/index.html
|
|
202
|
+
|
|
203
|
+
.. |mps-conda| image:: https://anaconda.org/martinpdes/pyfinitdiff/badges/version.svg
|
|
204
|
+
:alt: Anaconda version
|
|
205
|
+
:target: https://anaconda.org/martinpdes/pyfinitdiff
|
|
206
|
+
|
|
207
|
+
.. |mps-conda-downloads| image:: https://anaconda.org/martinpdes/pyfinitdiff/badges/downloads.svg
|
|
208
|
+
:alt: Anaconda downloads
|
|
209
|
+
:target: https://anaconda.org/martinpdes/pyfinitdiff
|
|
210
|
+
|
|
211
|
+
.. |mps-conda-release| image:: https://anaconda.org/martinpdes/pyfinitdiff/badges/latest_release_relative_date.svg
|
|
212
|
+
:alt: Latest Anaconda release
|
|
213
|
+
:target: https://anaconda.org/martinpdes/pyfinitdiff
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.rst
|
|
3
|
+
pyproject.toml
|
|
4
|
+
PyFinitDiff/__init__.py
|
|
5
|
+
PyFinitDiff/_version.py
|
|
6
|
+
PyFinitDiff/boundary_values.py
|
|
7
|
+
PyFinitDiff/diagonal.py
|
|
8
|
+
PyFinitDiff/directories.py
|
|
9
|
+
PyFinitDiff/triplet.py
|
|
10
|
+
PyFinitDiff.egg-info/PKG-INFO
|
|
11
|
+
PyFinitDiff.egg-info/SOURCES.txt
|
|
12
|
+
PyFinitDiff.egg-info/dependency_links.txt
|
|
13
|
+
PyFinitDiff.egg-info/requires.txt
|
|
14
|
+
PyFinitDiff.egg-info/top_level.txt
|
|
15
|
+
PyFinitDiff/coefficients/__init__.py
|
|
16
|
+
PyFinitDiff/coefficients/backward.py
|
|
17
|
+
PyFinitDiff/coefficients/central.py
|
|
18
|
+
PyFinitDiff/coefficients/forward.py
|
|
19
|
+
PyFinitDiff/finite_difference_1D/__init__.py
|
|
20
|
+
PyFinitDiff/finite_difference_1D/boundaries.py
|
|
21
|
+
PyFinitDiff/finite_difference_1D/derivative.py
|
|
22
|
+
PyFinitDiff/finite_difference_1D/finite_difference.py
|
|
23
|
+
PyFinitDiff/finite_difference_1D/utils.py
|
|
24
|
+
PyFinitDiff/finite_difference_2D/__init__.py
|
|
25
|
+
PyFinitDiff/finite_difference_2D/boundaries.py
|
|
26
|
+
PyFinitDiff/finite_difference_2D/derivative.py
|
|
27
|
+
PyFinitDiff/finite_difference_2D/finite_difference.py
|
|
28
|
+
PyFinitDiff/finite_difference_2D/utils.py
|
|
29
|
+
tests/test_1D_api.py
|
|
30
|
+
tests/test_1D_derivative.py
|
|
31
|
+
tests/test_2D_api.py
|
|
32
|
+
tests/test_2D_derivative.py
|
|
33
|
+
tests/test_2D_eigen.py
|
|
34
|
+
tests/test_eighth_order_first_derivative.py
|
|
35
|
+
tests/test_triplet.py
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
scipy>=1.14
|
|
2
|
+
pydantic<3,>=2
|
|
3
|
+
numpy
|
|
4
|
+
MPSPlots
|
|
5
|
+
tabulate
|
|
6
|
+
|
|
7
|
+
[dev]
|
|
8
|
+
martinpdes-maintenance[quality]==0.2.3
|
|
9
|
+
twine<7,>=6
|
|
10
|
+
flake8==7.3.0
|
|
11
|
+
|
|
12
|
+
[documentation]
|
|
13
|
+
MartinPdeS-docs<0.5,>=0.4.0
|
|
14
|
+
|
|
15
|
+
[release]
|
|
16
|
+
martinpdes-maintenance==0.2.3
|
|
17
|
+
|
|
18
|
+
[testing]
|
|
19
|
+
martinpdes-maintenance[testing]==0.2.3
|
|
20
|
+
pytest<9,>=7.4
|
|
21
|
+
pytest-cov<8
|
|
22
|
+
pytest-json-report~=1.5
|
|
23
|
+
coverage~=7.6
|