Evaluates a Chebyshev polynomial of degree n at x (-1 <= x <= 1).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | n | |||
| real(kind=rp), | intent(in) | :: | x |
f(x), x E [-1,1] is given by the following appproximation formula in terms of Chebyshev polynomials:
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | n |
Highest degree of T_n (x). |
||
| real(kind=rp), | intent(in), | dimension(0:n) | :: | c |
Chebyshev coefficients |
|
| real(kind=rp), | intent(in) | :: | x |
x E [-1,1] the point where the sum is to be evaluated. |
f(x,y), (x,y) E [-1,1]x[-1,1] is given by the following appproximation formula in terms of Chebyshev polynomials:
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | nx |
Highest degree of polynomial along x and y. |
||
| integer, | intent(in) | :: | ny |
Highest degree of polynomial along x and y. |
||
| real(kind=rp), | intent(in), | dimension(:) | :: | c |
Chebyshev coefficients |
|
| real(kind=rp), | intent(in) | :: | x |
(x,y) E [-1,1]x[-1,1] the point where the series is to be evaluated. |
||
| real(kind=rp), | intent(in) | :: | y |
(x,y) E [-1,1]x[-1,1] the point where the series is to be evaluated. |
||
| real(kind=rp), | intent(inout), | dimension(:) | :: | rwrk |
Work array of size at least ny+1 |
f(x,y), (x,y) E [-1,1]x[-1,1] is given by the following appproximation formula in terms of Chebyshev polynomials:
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | nx |
Highest degree of polynomial along x and y. |
||
| integer, | intent(in) | :: | ny |
Highest degree of polynomial along x and y. |
||
| integer, | intent(in) | :: | nz |
Highest degree of polynomial along x and y. |
||
| real(kind=rp), | intent(in), | dimension(:) | :: | c |
Chebyshev coefficients |
|
| real(kind=rp), | intent(in) | :: | x |
(x,y) E [-1,1]x[-1,1]x[-1,1] the point where the series is to be evaluated. |
||
| real(kind=rp), | intent(in) | :: | y |
(x,y) E [-1,1]x[-1,1]x[-1,1] the point where the series is to be evaluated. |
||
| real(kind=rp), | intent(in) | :: | z |
(x,y) E [-1,1]x[-1,1]x[-1,1] the point where the series is to be evaluated. |
||
| real(kind=rp), | intent(inout), | dimension(:) | :: | rwrk |
Work array of size at least nz + 1 + (max(ny,nz)+1) |
This subroutine evaluates an integral using Gauss-Chebyshev (CGL/CGR/CG) quadrature for a single variable.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | tag |
{ |
||
| real(kind=rp), | intent(in) | :: | a |
Domain bounds [a, b] |
||
| real(kind=rp), | intent(in) | :: | b |
Domain bounds [a, b] |
||
| integer, | intent(in) | :: | n |
Number of nodes is n+1 |
||
| real(kind=rp), | intent(in), | dimension(0:n) | :: | x |
Nodal coordinates in [-1, 1] |
|
| real(kind=rp), | intent(in), | dimension(0:n) | :: | f |
Value of the function at the nodes |
This subroutine evaluates an integral using Gauss-Chebyshev (CGL/CGR/CG) quadrature for two variables.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | tag |
{ |
||
| real(kind=rp), | intent(in) | :: | x0 |
Domain bounds [x0, x1]x[y0, y1] along x and y directions. |
||
| real(kind=rp), | intent(in) | :: | x1 |
Domain bounds [x0, x1]x[y0, y1] along x and y directions. |
||
| real(kind=rp), | intent(in) | :: | y0 |
Domain bounds [x0, x1]x[y0, y1] along x and y directions. |
||
| real(kind=rp), | intent(in) | :: | y1 |
Domain bounds [x0, x1]x[y0, y1] along x and y directions. |
||
| integer, | intent(in) | :: | nx |
Number of nodes along x and y directions are (nx+1) and (ny+1) |
||
| integer, | intent(in) | :: | ny |
Number of nodes along x and y directions are (nx+1) and (ny+1) |
||
| real(kind=rp), | intent(in), | dimension(:) | :: | x |
(nx+1,). Nodal coordinates along x direction in [-1, 1] |
|
| real(kind=rp), | intent(in), | dimension(:) | :: | y |
(ny+1,). Nodal coordinates along y direction in [-1, 1] |
|
| real(kind=rp), | intent(in), | dimension(:) | :: | f |
((nx+1)*(ny+1),). Value of the function at the nodes |
|
| real(kind=rp), | intent(inout), | dimension(:) | :: | rwrk |
Workspace array of size at least (ny+1) |
This subroutine evaluates an integral using Gauss-Chebyshev (CGL/CGR/CG) quadrature for three variables.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | tag |
{ |
||
| real(kind=rp), | intent(in) | :: | x0 |
Domain bounds [x0, x1]x[y0, y1]x[z0, z1] along x, y, and z directions. |
||
| real(kind=rp), | intent(in) | :: | x1 |
Domain bounds [x0, x1]x[y0, y1]x[z0, z1] along x, y, and z directions. |
||
| real(kind=rp), | intent(in) | :: | y0 |
Domain bounds [x0, x1]x[y0, y1]x[z0, z1] along x, y, and z directions. |
||
| real(kind=rp), | intent(in) | :: | y1 |
Domain bounds [x0, x1]x[y0, y1]x[z0, z1] along x, y, and z directions. |
||
| real(kind=rp), | intent(in) | :: | z0 |
Domain bounds [x0, x1]x[y0, y1]x[z0, z1] along x, y, and z directions. |
||
| real(kind=rp), | intent(in) | :: | z1 |
Domain bounds [x0, x1]x[y0, y1]x[z0, z1] along x, y, and z directions. |
||
| integer, | intent(in) | :: | nx |
Number of nodes along x, y, and z directions are (nx+1), (ny+1), and (nz+1). |
||
| integer, | intent(in) | :: | ny |
Number of nodes along x, y, and z directions are (nx+1), (ny+1), and (nz+1). |
||
| integer, | intent(in) | :: | nz |
Number of nodes along x, y, and z directions are (nx+1), (ny+1), and (nz+1). |
||
| real(kind=rp), | intent(in), | dimension(:) | :: | x |
(nx+1,). Nodal coordinates along x direction in [-1,1] |
|
| real(kind=rp), | intent(in), | dimension(:) | :: | y |
(ny+1,). Nodal coordinates along y direction in [-1,1] |
|
| real(kind=rp), | intent(in), | dimension(:) | :: | z |
(nz+1,). Nodal coordinates along z direction in [-1,1] |
|
| real(kind=rp), | intent(in), | dimension(:) | :: | f |
((nx+1)(ny+1)(nz+1),). Value of the function at the nodes |
|
| real(kind=rp), | intent(inout), | dimension(:) | :: | rwrk |
Workspace array of size at least nz + 1 + (max(ny,nz)+1) |
Evaluates the Lagrange interpolant (barycentric) at a given point p from nodal coordinates and nodal function values in 1D.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | n |
Number of interpolant nodes = n+1. |
||
| real(kind=rp), | intent(in), | dimension(:) | :: | x |
(n,). Nodal coordinates in strictly ascending order |
|
| real(kind=rp), | intent(in), | dimension(:) | :: | w |
(n,). Barycentric weights |
|
| real(kind=rp), | intent(in), | dimension(:) | :: | f |
(n,). Value of the function at the nodes |
|
| real(kind=rp), | intent(in) | :: | p |
Coordinate of the interpolation point. |
This subroutine returns coordinates of the Chebyshev nodes in [a,b].
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | tag |
{ |
||
| real(kind=rp), | intent(in) | :: | a |
Domain bounds [a, b] |
||
| real(kind=rp), | intent(in) | :: | b |
Domain bounds [a, b] |
||
| integer, | intent(in) | :: | n |
Degree of polynomial. |
||
| real(kind=rp), | intent(out), | dimension(0:n) | :: | xcol |
(n+1,). Vector of nodal coordinates. |
|
| logical, | intent(in), | optional | :: | is_descending |
{T,F} Coordinates in ascending (default) or descending order. |
Calculates the nodal first derivative matrix for CGL nodes in [x0,x1] Assumes the nodal coordinates to be in ascending order in the domain [-1,1].
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=rp), | intent(in) | :: | x0 |
Domain bounds [x0, x1] |
||
| real(kind=rp), | intent(in) | :: | x1 |
Domain bounds [x0, x1] |
||
| integer, | intent(in) | :: | n |
Degree of the polynomial |
||
| real(kind=rp), | intent(inout), | dimension(:), target | :: | rwrk |
Workspace array of minimum size 2*(n+1) |
|
| real(kind=rp), | intent(out), | dimension(:,:) | :: | dm |
(n+1,n+1). Nodal first derivative matrix |
Calculates the nodal second derivative matrix for CGL/CG/CGR nodes.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | n |
Degree of the polynomial |
||
| real(kind=rp), | intent(in), | dimension(:,:) | :: | dm1 |
(n+1,n+1). Nodal first derivative matrix |
|
| real(kind=rp), | intent(out), | dimension(:,:) | :: | dm2 |
(n+1,n+1). Nodal second derivative matrix |
Tensorize the nodal derivative matrix for two variables in the domain [-1,1]x[-1,1].
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=1), | intent(in) | :: | var |
Independent variable {'x', 'y'} |
||
| integer, | intent(in) | :: | nx |
Degree of the polynomial along x and y directions |
||
| integer, | intent(in) | :: | ny |
Degree of the polynomial along x and y directions |
||
| real(kind=rp), | intent(in), | dimension(:,:) | :: | dmat |
(nx+1, nx+1) or (ny+1, ny+1) Nodal derivative matrix in the domain [-1,1]. |
|
| real(kind=rp), | intent(out), | dimension(:,:) | :: | tdm |
Tensorized derivative matrix with nrows = ncols = (nx+1)*(ny+1) |
Tensorize the nodal derivative matrix for three variables in the domain [-1,1]x[-1,1]X[-1,1].
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=1), | intent(in) | :: | var |
Independent variable {'x', 'y', 'z'} |
||
| integer, | intent(in) | :: | nx |
Degree of the polynomial along x, y, and z directions |
||
| integer, | intent(in) | :: | ny |
Degree of the polynomial along x, y, and z directions |
||
| integer, | intent(in) | :: | nz |
Degree of the polynomial along x, y, and z directions |
||
| real(kind=rp), | intent(in), | dimension(:,:) | :: | dmat |
(nx+1, nx+1) or (ny+1, ny+1) or (nz+1, nz+1). Nodal derivative matrix in the domain [-1,1]. |
|
| real(kind=rp), | intent(out), | dimension(:,:) | :: | tdm |
Tensorized derivative matrix with nrows = ncols = (nx+1)(ny+1)(nz+1) |
Calculates the derivative of a 1D function at the nodes.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=rp), | intent(in), | dimension(:,:) | :: | dm |
((n+1),(n+1)) Differentiation matrix, where the number of nodes = n+1 |
|
| real(kind=rp), | intent(in), | dimension(:) | :: | f |
(n+1,). Value of the function at the nodes. |
|
| real(kind=rp), | intent(out), | dimension(:) | :: | fp |
(n+1,). Value of the derivative at the nodes. |
Calculates the derivative of a 2D function at the nodes.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | nx |
Number of nodes along x = nx+1 and along y = ny+1 |
||
| integer, | intent(in) | :: | ny |
Number of nodes along x = nx+1 and along y = ny+1 |
||
| real(kind=rp), | intent(in), | dimension(:,:) | :: | dmx |
((nx+1),(nx+1)) Differentiation matrix along x |
|
| real(kind=rp), | intent(in), | dimension(:,:) | :: | dmy |
((ny+1),(ny+1)) Differentiation matrix along y |
|
| real(kind=rp), | intent(in), | dimension(:) | :: | f |
(m,), where m = (nx+1)*(ny+1). Value of the function at the nodes. |
|
| real(kind=rp), | intent(out), | dimension(:) | :: | fpx |
(m,), where m = (nx+1)*(ny+1). Value of the derivatives at the nodes. |
|
| real(kind=rp), | intent(out), | dimension(:) | :: | fpy |
(m,), where m = (nx+1)*(ny+1). Value of the derivatives at the nodes. |
Calculates the derivative of a 3D function at the nodes.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | nx |
Number of nodes along x = nx+1, along y = ny+1, and along z = nz+1 |
||
| integer, | intent(in) | :: | ny |
Number of nodes along x = nx+1, along y = ny+1, and along z = nz+1 |
||
| integer, | intent(in) | :: | nz |
Number of nodes along x = nx+1, along y = ny+1, and along z = nz+1 |
||
| real(kind=rp), | intent(in), | dimension(:,:) | :: | dmx |
((nx+1),(nx+1)) Differentiation matrix along x |
|
| real(kind=rp), | intent(in), | dimension(:,:) | :: | dmy |
((ny+1),(ny+1)) Differentiation matrix along y |
|
| real(kind=rp), | intent(in), | dimension(:,:) | :: | dmz |
((nz+1),(nz+1)) Differentiation matrix along z |
|
| real(kind=rp), | intent(in), | dimension(:) | :: | f |
(m,), where m = (nx+1)(ny+1)(nz+1). Value of the function at the nodes. |
|
| real(kind=rp), | intent(out), | dimension(:) | :: | fpx |
(m,), where m = (nx+1)(ny+1)(nz+1). Value of the derivatives at the nodes. |
|
| real(kind=rp), | intent(out), | dimension(:) | :: | fpy |
(m,), where m = (nx+1)(ny+1)(nz+1). Value of the derivatives at the nodes. |
|
| real(kind=rp), | intent(out), | dimension(:) | :: | fpz |
(m,), where m = (nx+1)(ny+1)(nz+1). Value of the derivatives at the nodes. |
Calculates the discrete Chebyshev transform matrix for a single variable. The matrix is not symmetric and assumes the nodal coordinates to be in ascending order.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | n |
Degree of polynomial |
||
| real(kind=rp), | intent(out), | dimension(:,:) | :: | mat |
((n+1),(n+1)) Transform matrix. |
|
| real(kind=rp), | intent(inout), | dimension(:) | :: | rwrk |
Workspace array of minimum size (n+1) |
This subroutine transforms the function values at the CGL points to the coefficients of the Chebyshev series for two variables. The matrix is not symmetric and assumes the nodal coordinates to be in ascending order.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | nx |
Degree of polynomial along x direction |
||
| integer, | intent(in) | :: | ny |
Degree of polynomial along y direction |
||
| real(kind=rp), | intent(out), | dimension(:,:) | :: | mat |
((nx+1)(ny+1),(nx+1)(ny+1)) matrix. Transform matrix. |
|
| real(kind=rp), | intent(inout), | dimension(:), target | :: | rwrk |
Workspace array of minimum size (nx+1) + (ny+1) |
Calculates the discrete inverse Chebyshev transform matrix. The matrix is not symmetric and yields the nodal function values assuming the nodal coordinates are in ascending order.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | n |
Degree of polynomial |
||
| real(kind=rp), | intent(out), | dimension(:,:) | :: | mat |
(n+1,n+1). Inverse transform matrix. |
Calculates the barycentric weights for a given set of nodes. As of now, assumues CGL nodes. TODO: extend stably for the general case (CGL, CGR, CG)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | n |
Number of interpolation nodes = n+1. |
||
| real(kind=rp), | intent(out), | dimension(:) | :: | w |
(n+1,). Barycentric weights |
Computes the Lagrange interpolation (barycentric) matrix.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | n |
Number of nodes = n+1 |
||
| integer, | intent(in) | :: | m |
Number of interpolation points = m+1 |
||
| real(kind=rp), | intent(in), | dimension(:) | :: | x |
(n+1,). Nodal coordinates in strictly ascending order |
|
| real(kind=rp), | intent(in), | dimension(:) | :: | w |
(n+1,). Barycentric weights |
|
| real(kind=rp), | intent(in), | dimension(:) | :: | z |
(m+1,). Coordinates at which the function is to be interpolated |
|
| real(kind=rp), | intent(out), | dimension(:,:) | :: | mat |
(m+1,n+1). Interpolation matrix |
Interpolates nodal function values to a grid using barycentric lagrange interpolation.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=rp), | intent(in), | dimension(:,:) | :: | mat |
(np,n). Interpolation matrix |
|
| real(kind=rp), | intent(in), | dimension(:) | :: | f |
(n,). Value of the function at the nodes |
|
| real(kind=rp), | intent(out), | dimension(:) | :: | fintrp |
(np,). Value of the function at the nodes |
Interpolates nodal function values to a grid using barycentric lagrange interpolation in two variables.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | nx |
Number of nodes along x = nx+1 and along y = ny+1 |
||
| integer, | intent(in) | :: | ny |
Number of nodes along x = nx+1 and along y = ny+1 |
||
| integer, | intent(in) | :: | npx |
Number of interpolating points along x = npx+1 and along y = npy+1 |
||
| integer, | intent(in) | :: | npy |
Number of interpolating points along x = npx+1 and along y = npy+1 |
||
| real(kind=rp), | intent(in), | dimension(:,:) | :: | matx |
(npx+1,nx+1). Interpolation matrix along x |
|
| real(kind=rp), | intent(in), | dimension(:,:) | :: | maty |
(npy+1,npy+1). Interpolation matrix along y |
|
| real(kind=rp), | intent(in), | dimension(:) | :: | f |
((nx+1)*(ny+1),). Value of the function at the nodes |
|
| real(kind=rp), | intent(out), | dimension(:) | :: | fintrp |
((npx+1)*(npy+1),). Value of the function at the nodes |
|
| real(kind=rp), | intent(inout), | dimension(:) | :: | rwrk |
Workspace array of minimum size (npx+1)*(ny+1). |
Interpolates nodal function values to a grid using barycentric lagrange interpolation in three variables.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | nx |
Number of nodes along x = nx+1, along y = ny+1, and along z = nz+1 |
||
| integer, | intent(in) | :: | ny |
Number of nodes along x = nx+1, along y = ny+1, and along z = nz+1 |
||
| integer, | intent(in) | :: | nz |
Number of nodes along x = nx+1, along y = ny+1, and along z = nz+1 |
||
| integer, | intent(in) | :: | npx |
Number of interpolating points along x = npx+1, along y = npy+1, and along z = npz+1 |
||
| integer, | intent(in) | :: | npy |
Number of interpolating points along x = npx+1, along y = npy+1, and along z = npz+1 |
||
| integer, | intent(in) | :: | npz |
Number of interpolating points along x = npx+1, along y = npy+1, and along z = npz+1 |
||
| real(kind=rp), | intent(in), | dimension(:,:) | :: | matx |
(npx+1,nx+1). Interpolation matrix along x |
|
| real(kind=rp), | intent(in), | dimension(:,:) | :: | maty |
(npy+1,ny+1). Interpolation matrix along y |
|
| real(kind=rp), | intent(in), | dimension(:,:) | :: | matz |
(npz+1,nz+1). Interpolation matrix along z |
|
| real(kind=rp), | intent(in), | dimension(:) | :: | f |
(nx+1)(ny+1)(nz+1), ). Value of the function at the nodes |
|
| real(kind=rp), | intent(out), | dimension(:) | :: | fintrp |
(npx+1)(npy+1)(npz+1), ). Value of the function at the interpolation points. |
|
| real(kind=rp), | intent(inout), | dimension(:) | :: | rwrk |
Workspace array, minimum size (npx+1)(npy+1)(nz+1)+(npx+1)*(ny+1) |