fastvpinns.FE.basis_2d_QN_Jacobi module

The file basis_2d_QN_Jacobi.py contains the class Basis2DQNJacobi which is used to define the basis functions for a Jacobi Polynomial. Test functions and derivatives are inferred from the work by Ehsan Kharazmi et.al (hp-VPINNs: Variational Physics-Informed Neural Networks With Domain Decomposition) available at https://github.com/ehsankharazmi/hp-VPINNs/

Author: Thivin Anandh D

Changelog: 30/Aug/2023 - Initial version

Known issues: None

Dependencies: scipy, numpy

class fastvpinns.FE.basis_2d_QN_Jacobi.Basis2DQNJacobi(num_shape_functions: int)[source]

Bases: BasisFunction2D

This class defines the basis functions for a 2D QN element.

ddtest_fcn(n_test, x)[source]

Compute the x-derivatives of the test functions for a given number of test functions and x-coordinates.

Parameters:
  • n_test (int) – Number of test functions.

  • x (array_like) – x-coordinates at which to evaluate the test functions.

Returns:

Values of the x-derivatives of the test functions.

Return type:

array_like

djacobi(n, a, b, x, k: int)[source]

Evaluate the k-th derivative of the Jacobi polynomial of degree n with parameters a and b at the given points x.

Parameters:
  • n (int) – Degree of the Jacobi polynomial.

  • a (float) – First parameter of the Jacobi polynomial.

  • b (float) – Second parameter of the Jacobi polynomial.

  • x (array_like) – Points at which to evaluate the Jacobi polynomial.

  • k (int) – Order of the derivative.

Returns:

Values of the k-th derivative of the Jacobi polynomial at the given points x.

Return type:

array_like

Raises:
  • ValueError – If the derivative order is not 1 or 2.

  • ImportError – If the required module ‘jacobi’ is not found.

  • Exception – If an unknown error occurs during the computation.

dtest_fcn(n_test, x)[source]

Compute the x-derivatives of the test functions for a given number of test functions and x-coordinates.

Parameters:
  • n_test (int) – Number of test functions.

  • x (array_like) – x-coordinates at which to evaluate the test functions.

Returns:

Values of the x-derivatives of the test functions.

Return type:

array_like

gradx(xi, eta)[source]

This method returns the x-derivatives of the basis functions at the given (xi, eta) coordinates.

Parameters:
  • xi (array_like) – x-coordinates at which to evaluate the basis functions.

  • eta (array_like) – y-coordinates at which to evaluate the basis functions.

Returns:

Values of the x-derivatives of the basis functions.

Return type:

array_like

gradxx(xi, eta)[source]

This method returns the xx-derivatives of the basis functions at the given (xi, eta) coordinates.

Parameters:
  • xi (array_like) – x-coordinates at which to evaluate the basis functions.

  • eta (array_like) – y-coordinates at which to evaluate the basis functions.

Returns:

Values of the xx-derivatives of the basis functions.

Return type:

array_like

gradxy(xi, eta)[source]

This method returns the xy-derivatives of the basis functions at the given (xi, eta) coordinates.

Parameters:
  • xi (array_like) – x-coordinates at which to evaluate the basis functions.

  • eta (array_like) – y-coordinates at which to evaluate the basis functions.

Returns:

Values of the xy-derivatives of the basis functions.

Return type:

array_like

grady(xi, eta)[source]

This method returns the y-derivatives of the basis functions at the given (xi, eta) coordinates.

Parameters:
  • xi (array_like) – x-coordinates at which to evaluate the basis functions.

  • eta (array_like) – y-coordinates at which to evaluate the basis functions.

Returns:

Values of the y-derivatives of the basis functions.

Return type:

array_like

gradyy(xi, eta)[source]

This method returns the yy-derivatives of the basis functions at the given (xi, eta) coordinates.

Parameters:
  • xi (array_like) – x-coordinates at which to evaluate the basis functions.

  • eta (array_like) – y-coordinates at which to evaluate the basis functions.

Returns:

Values of the yy-derivatives of the basis functions.

Return type:

array_like

jacobi_wrapper(n, a, b, x)[source]

Evaluate the Jacobi polynomial of degree n with parameters a and b at the given points x.

Parameters:
  • n (int) – Degree of the Jacobi polynomial.

  • a (float) – First parameter of the Jacobi polynomial.

  • b (float) – Second parameter of the Jacobi polynomial.

  • x (array_like) – Points at which to evaluate the Jacobi polynomial.

Returns:

Values of the Jacobi polynomial at the given points x.

Return type:

array_like

test_fcnx(n_test, x)[source]

Compute the x-component of the test functions for a given number of test functions and x-coordinates.

Parameters:
  • n_test (int) – Number of test functions.

  • x (array_like) – x-coordinates at which to evaluate the test functions.

Returns:

Values of the x-component of the test functions.

Return type:

array_like

test_fcny(n_test, y)[source]

Compute the y-component of the test functions for a given number of test functions and y-coordinates.

Parameters:
  • n_test (int) – Number of test functions.

  • y (array_like) – y-coordinates at which to evaluate the test functions.

Returns:

Values of the y-component of the test functions.

Return type:

array_like

value(xi, eta)[source]

This method returns the values of the basis functions at the given (xi, eta) coordinates.

Parameters:
  • xi (array_like) – x-coordinates at which to evaluate the basis functions.

  • eta (array_like) – y-coordinates at which to evaluate the basis functions.

Returns:

Values of the basis functions.

Return type:

array_like