-
Notifications
You must be signed in to change notification settings - Fork 8
feat: add transplanted 1D quadrature maps, docs, tests, and QBX example #159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
9e132f4
f9884a8
5f2d7a9
3efe064
0b90d2f
dc4f215
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -25,6 +25,125 @@ Clenshaw-Curtis and Fejér quadrature in one dimension | |||||
| :members: | ||||||
| :show-inheritance: | ||||||
|
|
||||||
| Transplanted quadrature in one dimension | ||||||
| ---------------------------------------- | ||||||
|
|
||||||
| The transplanted maps implemented here include the Hale-Trefethen | ||||||
| conformal-map family and the Kosloff-Tal-Ezer map. | ||||||
|
|
||||||
| Given a base rule :math:`(s_i, w_i)` on :math:`[-1,1]`, transplanted quadrature | ||||||
| uses a map :math:`x=g(s)` to build | ||||||
|
|
||||||
| .. math:: | ||||||
| x_i = g(s_i), \qquad \tilde w_i = w_i g'(s_i), | ||||||
| so that | ||||||
|
|
||||||
| .. math:: | ||||||
| \int_{-1}^1 f(x)\,dx = \int_{-1}^1 f(g(s))g'(s)\,ds | ||||||
| \approx \sum_i \tilde w_i f(x_i). | ||||||
| Map functions | ||||||
| ~~~~~~~~~~~~~ | ||||||
|
|
||||||
| .. currentmodule:: modepy.quadrature.transplanted | ||||||
|
|
||||||
| Identity map | ||||||
| ^^^^^^^^^^^^ | ||||||
|
|
||||||
| Use ``map_name="identity"`` for the unmodified base rule. | ||||||
|
|
||||||
| .. autofunction:: map_identity | ||||||
|
|
||||||
| Sausage polynomial maps | ||||||
| ^^^^^^^^^^^^^^^^^^^^^^^ | ||||||
|
|
||||||
| Use ``map_name="sausage_d{odd}"`` (for example ``"sausage_d5"``, | ||||||
| ``"sausage_d9"``, ``"sausage_d17"``) for odd-degree normalized polynomial | ||||||
| truncations of :math:`\arcsin`. | ||||||
|
|
||||||
| .. autofunction:: map_sausage | ||||||
|
|
||||||
| Kosloff-Tal-Ezer map | ||||||
| ^^^^^^^^^^^^^^^^^^^^ | ||||||
|
|
||||||
| Use ``map_name="kte"`` (or ``"kosloff_tal_ezer"``). | ||||||
|
|
||||||
| * ``kte_rho`` (``>1``) sets the default parameterization | ||||||
| :math:`\alpha = 2/(\rho + \rho^{-1})`. | ||||||
| * ``kte_alpha`` explicitly sets :math:`\alpha` (must satisfy ``0<alpha<1``) | ||||||
| and overrides ``kte_rho``. | ||||||
|
|
||||||
| .. autofunction:: map_kosloff_tal_ezer | ||||||
|
|
||||||
| Strip conformal map | ||||||
| ^^^^^^^^^^^^^^^^^^^ | ||||||
|
|
||||||
| Use ``map_name="strip"`` with ``strip_rho > 1``. | ||||||
|
|
||||||
| .. note:: | ||||||
|
|
||||||
| The strip map requires interior nodes (``abs(s)<1``), so endpoint rules | ||||||
| (for example Gauss-Lobatto or Clenshaw-Curtis) are not valid with | ||||||
| ``map_name="strip"``. | ||||||
|
|
||||||
| .. autofunction:: map_strip | ||||||
|
|
||||||
| Map dispatcher | ||||||
| ^^^^^^^^^^^^^^ | ||||||
|
|
||||||
| .. autofunction:: map_trefethen_transplant | ||||||
|
|
||||||
| Quadrature classes | ||||||
| ~~~~~~~~~~~~~~~~~~ | ||||||
|
|
||||||
| .. currentmodule:: modepy | ||||||
|
|
||||||
| Transplanted1DQuadrature | ||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ||||||
|
|
||||||
| .. autoclass:: Transplanted1DQuadrature | ||||||
| :show-inheritance: | ||||||
|
|
||||||
| TransplantedLegendreGaussQuadrature | ||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||||||
|
|
||||||
| .. autoclass:: TransplantedLegendreGaussQuadrature | ||||||
| :show-inheritance: | ||||||
|
|
||||||
| Example | ||||||
| ~~~~~~~ | ||||||
|
|
||||||
| .. code-block:: python | ||||||
| import modepy as mp | ||||||
| q_kte = mp.TransplantedLegendreGaussQuadrature( | ||||||
| 20, | ||||||
| map_name="kte", | ||||||
| kte_rho=1.4, | ||||||
| force_dim_axis=True, | ||||||
| ) | ||||||
| q_sausage = mp.TransplantedLegendreGaussQuadrature( | ||||||
| 20, | ||||||
| map_name="sausage_d9", | ||||||
| force_dim_axis=True, | ||||||
| ) | ||||||
| References | ||||||
| ~~~~~~~~~~ | ||||||
|
|
||||||
| * N. Hale and L. N. Trefethen, *New Quadrature Formulas from Conformal | ||||||
| Maps*, ``SIAM Journal on Numerical Analysis`` 46(2), 930-948 (2008), | ||||||
| doi:10.1137/07068607X. | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
? Same in other places. Also as far as formatting goes, it looks a bit weird to put the journal in code mode (?). |
||||||
| * D. Kosloff and H. Tal-Ezer, *A Modified Chebyshev Pseudospectral Method | ||||||
| with an O(N^{-1}) Time Step Restriction*, | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
? I haven't actually checked how this renders. |
||||||
| ``Journal of Computational Physics`` 104(2), 457-469 (1993), | ||||||
| doi:10.1006/jcph.1993.1044. | ||||||
|
|
||||||
| Quadratures on the simplex | ||||||
| -------------------------- | ||||||
|
|
||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't feel particularly strongly about this, but I haven't heard the term "transplanted" used very often, so it sounds a bit unintuitive to me. Maybe call this
mappedorconformal mapped? Maybe justtransformed? Although we already have aTransformed1DQuadraturethat just does linear transformations.For context, I'm mostly familiar with stuff like this from Kress' Numerical Analysis, e.g. Chapter 9.6 and some of the cited references, so it might just be a different tradition.
(Same for other places where the term is used, depending on what's decided.)