fastvpinns.utils.compute_utils module

This file compute_utils.py contains the utility functions for computing the errors between the exact and predicted solutions.

Author: Thivin Anandh D

Date: 02/Nov/2023

Changelog: 02/Nov/2023 - file created; and added functions to compute L1, L2, L_inf errors

Known issues: None

fastvpinns.utils.compute_utils.compute_errors_combined(u_exact, u_approx)[source]

This function will compute the L1, L2 and L_inf absolute and relative errors.

Parameters:
  • u_exact (numpy.ndarray) – numpy array containing the exact solution

  • u_approx (numpy.ndarray) – numpy array containing the approximate solution

Returns:

L1, L2 and L_inf absolute and relative errors

Return type:

tuple

fastvpinns.utils.compute_utils.compute_l1_error(u_exact, u_approx)[source]

This function will compute the L1 error between the exact solution and the approximate solution.

Parameters:
  • u_exact (numpy.ndarray) – numpy array containing the exact solution

  • u_approx (numpy.ndarray) – numpy array containing the approximate solution

Returns:

L1 error between the exact and approximate solutions

Return type:

float

fastvpinns.utils.compute_utils.compute_l1_error_relative(u_exact, u_approx)[source]

This function will compute the relative L1 error between the exact solution and the approximate solution.

Parameters:
  • u_exact (numpy.ndarray) – numpy array containing the exact solution

  • u_approx (numpy.ndarray) – numpy array containing the approximate solution

Returns:

relative L1 error between the exact and approximate solutions

Return type:

float

fastvpinns.utils.compute_utils.compute_l2_error(u_exact, u_approx)[source]

This function will compute the L2 error between the exact solution and the approximate solution.

Parameters:
  • u_exact (numpy.ndarray) – numpy array containing the exact solution

  • u_approx (numpy.ndarray) – numpy array containing the approximate solution

Returns:

L2 error between the exact and approximate solutions

Return type:

float

fastvpinns.utils.compute_utils.compute_l2_error_relative(u_exact, u_approx)[source]

This function will compute the relative L2 error between the exact solution and the approximate solution.

Parameters:
  • u_exact (numpy.ndarray) – numpy array containing the exact solution

  • u_approx (numpy.ndarray) – numpy array containing the approximate solution

Returns:

relative L2 error between the exact and approximate solutions

Return type:

float

fastvpinns.utils.compute_utils.compute_linf_error(u_exact, u_approx)[source]

This function will compute the L_inf error between the exact solution and the approximate solution.

Parameters:
  • u_exact (numpy.ndarray) – numpy array containing the exact solution

  • u_approx (numpy.ndarray) – numpy array containing the approximate solution

Returns:

L_inf error between the exact and approximate solutions

Return type:

float

fastvpinns.utils.compute_utils.compute_linf_error_relative(u_exact, u_approx)[source]

This function will compute the relative L_inf error between the exact solution and the approximate solution.

Parameters:
  • u_exact (numpy.ndarray) – numpy array containing the exact solution

  • u_approx (numpy.ndarray) – numpy array containing the approximate solution

Returns:

relative L_inf error between the exact and approximate solutions

Return type:

float