basis2D module#

Created on Sun Sep 3 12:40:44 2023

@author: Pavan Pranjivan Mehta

class basis2D.polynomials#

Bases: object

Returns 2D orthogonal polynomials of a degree “k x k”.

legendre(y, degree_i, degree_j)#

Legendre Polynomials in 2D

phi_{ij} = phi_i o phi_j , where “o” is a composition operator

Parameters#

xfloat

Spatial points in [-1,1] in “x” direction

yfloat

Spatial points in [-1,1] in “y” direction

degree_iint

degree_i of the polynomial for x direction

degree_jint

degree_j of the polynomial for y direction

Returns#

2D Legendre polynomials within the interval [-1,1] x [-1,1]

shift_legendre(y, degree_i, degree_j)#

Shifted Legendre Polynomials in 2D

phi_{ij} = phi_i o phi_j , where “o” is a composition operator

Parameters#

xfloat

Spatial points in [0,1] in “x” direction

yfloat

Spatial points in [0,1] in “y” direction

degree_iint

degree_i of the polynomial for x direction

degree_jint

degree_j of the polynomial for y direction

Returns#

2D Shifted Legendre polynomials within the interval [0,1] x [0,1]

phi_{ij} = phi_i o phi_j , where “o” is a composition operator

class basis2D.homogeneous_basis#

Bases: object

Construct basis functions (phi_{ij}), such that phi_{ij} = 0 at the boundaries

legendre(y, degree_i, degree_j)#

Construct 2D homogenous basis functions using Legendre Polynomials

phi_k = l_{k+2} - l_{k}, where l is legendre polynomial in [-1,1] of degree k

phi_{ij} = phi_i o phi_j , where “o” is a composition operator

Parameters#

xfloat

Spatial points in [-1,1] in “x” direction

yfloat

Spatial points in [-1,1] in “y” direction

degree_iint

degree_i of the polynomial for x direction

degree_jint

degree_j of the polynomial for y direction

Returns#

2D Homogenous Basis function using legendre polynomials within the interval [-1,1] x [-1,1]

phi_{ij} = phi_i o phi_j , where “o” is a composition operator

shift_legendre(y, degree_i, degree_j)#

Construct 2D homogenous basis functions using Shifted Legendre Polynomials

phi_k = l_{k+2} - l_{k}, where l is shifted legendre polynomial in [0,1] of degree k

phi_{ij} = phi_i o phi_j , where “o” is a composition operator

Parameters#

xfloat

Spatial points in [0,1] in “x” direction

yfloat

Spatial points in [0,1] in “y” direction

degree_iint

degree_i of the polynomial for x direction

degree_jint

degree_j of the polynomial for y direction

Returns#

2D Homogenous Basis function using shifted legendre polynomials within the interval [0,1] x [0,1]

phi_{ij} = phi_i o phi_j , where “o” is a composition operator

class basis2D.first_derivatives#

Bases: object

compututes 1st deriavties of Polynomials and Basis functions in 2D

legendre(y, degree_i, degree_j, h=0.0001)#

First derivative of 2D Legendre Polynomials computed using finite diff (order 1)

Parameters#

xfloat

Spatial points in [-1,1] in “x” direction

yfloat

Spatial points in [-1,1] in “y” direction

degree_iint

degree_i of the polynomial for x direction

degree_jint

degree_j of the polynomial for y direction

hfloat

finite difference step size, default h = 1e-4

Returns#

First derivative of 2D Legendre polynomials within the interval [-1,1] x [-1,1]

PnXfloat

first derivative along x direction for degree_i legendre polynomial

PnYfloat

first derivative along y direction for degree_j legendre polynomial

PnXY2D numpy array

PnXY = PnX o PnY , where “o” is composition operator

shift_legendre(y, degree_i, degree_j, h=0.0001)#

First derivative of 2D Shifted Legendre Polynomials computed using finite diff (order 1)

Parameters#

xfloat

Spatial points in [0,1] in “x” direction

yfloat

Spatial points in [0,1] in “y” direction

degree_iint

degree_i of the polynomial for x direction

degree_jint

degree_j of the polynomial for y direction

hfloat

finite difference step size, default h = 1e-4

Returns#

First derivative of Shifted Legendre polynomials within the interval [0,1] x [0,1]

PnXfloat

first derivative along x direction for degree_i shifted legendre polynomial

PnYfloat

first derivative along y direction for degree_j shifted legendre polynomial

PnXY2D numpy array

PnXY = PnX o PnY , where “o” is composition operator

homogenous_legendre_basis(y, degree_i, degree_j, h=0.0001)#

First derivative of 2D Homognoous basis using Legendre Polynomials computed using finite diff (order 1)

Homogenous basis functions using Legendre Polynomials comstrcted as,

phi_k = l_{k+2} - l_{k}, where l is legendre polynomial in [-1,1] of degree k

Parameters#

xfloat

Spatial points in [-1,1] in “x” direction

yfloat

Spatial points in [-1,1] in “y” direction

degree_iint

degree_i of the polynomial for x direction

degree_jint

degree_j of the polynomial for y direction

hfloat

finite difference step size, default h = 1e-4

Returns#

First derivative of 2D Homognoous basis using Legendre polynomials within the interval [-1,1] x [-1, 1]

PnXfloat

first derivative along x direction for degree_i homogenous basis using legendre polynomial

PnYfloat

first derivative along y direction for degree_j homogenous basis using legendre polynomial

PnXY2D numpy array

PnXY = PnX o PnY , where “o” is composition operator

homogenous_shift_legendre_basis(y, degree_i, degree_j, h=0.0001)#

First derivative of 2D Homognoous basis using Shifted Legendre Polynomials computed using finite diff (order 1)

Homogenous basis functions using Shifted Legendre Polynomials comstrcted as,

phi_k = l_{k+2} - l_{k}, where l is shifted legendre polynomial in [0,1] of degree k

Parameters#

xfloat

Spatial points in [0,1] in “x” direction

yfloat

Spatial points in [0,1] in “y” direction

degree_iint

degree_i of the polynomial for x direction

degree_jint

degree_j of the polynomial for y direction

hfloat

finite difference step size, default h = 1e-4

Returns#

First derivative of 2D Homognoous basis using Shifted Legendre polynomials within the interval [0,1] x [0,1]

PnXfloat

first derivative along x direction for degree_i homogenous basis using Shifted legendre polynomial

PnYfloat

first derivative along y direction for degree_j homogenous basis using Shifted legendre polynomial

PnXY2D numpy array

PnXY = PnX o PnY , where “o” is composition operator

class basis2D.test#

Bases: object

legendre()#
shifted_legendre()#
legendre_homogenous_basis()#
shift_legendre_homogenous_basis()#