Routines to compute errors ( \(L^p\) norms). More...
Functions | |
subroutine | mod_compute_error::compute_error_cell (field, reference_field, grid_volume, is_relative_error, mask, error_l1, error_l2, error_linf) |
Compute relative or absolute error of a field defined on cells with respect to a reference field. | |
subroutine | mod_compute_error::compute_error_face (field, reference_field, grid_volume, is_relative_error, mask, error_l1, error_l1_u, error_l1_v, error_l1_w, error_l2, error_l2_u, error_l2_v, error_l2_w, error_linf, error_linf_u, error_linf_v, error_linf_w) |
Compute error of a field defined on faces with respect to a reference field. | |
subroutine | mod_compute_error::compute_and_print_error_cell (label, field, reference_field, grid_volume, is_relative_error, mask) |
Compute and print the error of a field defined on cells with respect to a reference field. | |
subroutine | mod_compute_error::compute_and_print_error_face (label, field, reference_field, grid_volume, is_relative_error, mask) |
Compute and print the error of a field defined on faces with respect to a reference field. | |
subroutine | mod_compute_error::compute_and_print_l1_error_face (label, field, reference_field, grid_volume, is_relative_error, mask) |
Compute and print the L1 error of a field defined on faces with respect to a reference field. | |
subroutine | mod_compute_error::compute_and_print_l2_error_face (label, field, reference_field, grid_volume, is_relative_error, mask) |
Compute and print the L2 error of a field defined on faces with respect to a reference field. | |
subroutine | mod_compute_error::compute_and_print_linf_error_face (label, field, reference_field, grid_volume, is_relative_error, mask) |
Compute and print the Linf error of a field defined on faces with respect to a reference field. | |
subroutine | mod_compute_error::print_error (label, error_l1, error_l2, error_linf) |
Print the errors with a specific format. | |
subroutine | mod_compute_error_symmetric_difference::compute_error_symmetric_difference (reference_solution, solution, error, error_symmetric_difference, mask) |
Compute the symmetric difference error of a given phase. | |
subroutine | mod_compute_l1_norm::compute_l1_norm (l1_norm, field, grid_volume, mask) |
Compute L1 norm of an field defined on cells The field can be defined on cells or one of the faces of the associated volume control. Dimensions of the field is checked to compute the norm on the associated grid. | |
subroutine | mod_compute_l2_norm::compute_l2_norm (l2_norm, field, grid_volume, mask) |
Compute L2 norm of an field defined on cells The field can be defined on cells or one of the faces of the associated volume control. Dimensions of the field is checked to compute the norm on the associated grid. | |
subroutine | mod_compute_linf_norm::compute_linf_norm (linf_norm, field, grid_volume, mask) |
Compute Linf norm of an field defined on cells The field can be defined on cells or one of the faces of the associated volume control. Dimensions of the field is checked to compute the norm on the associated grid. | |
subroutine | mod_compute_reference_solution_error::compute_reference_solution_error () |
Compute errors according to variables_test_case parameters. | |
This module provides low-level routines to compute \(L^1\), \(L^2\), and \(L^\infty\) norms of a field. It also provides higher-level routines to compute the error, i. e. the difference between computed and reference solutions, using the aforementioned norms and printing the result to the log.
subroutine mod_compute_error::compute_and_print_error_cell | ( | character(len=*), intent(in) | label, |
double precision, dimension(:,:,:), intent(in) | field, | ||
double precision, dimension(:,:,:), intent(in) | reference_field, | ||
double precision, dimension(:,:,:), intent(in) | grid_volume, | ||
logical, intent(in) | is_relative_error, | ||
logical, dimension(:,:,:), intent(in), optional | mask ) |
See compute_error_cell.
[in] | label | label of the field |
[in] | field | cell-centered field |
[in] | reference_field | cell-centered field |
[in] | grid_volume | volume of the grid where field is defined |
[in] | is_relative_error | boolean to compute relative or absolute error |
[in] | mask | restrict the sum where mask is .true. |
subroutine mod_compute_error::compute_and_print_error_face | ( | character(len=*), intent(in) | label, |
type(t_face_field), intent(in) | field, | ||
type(t_face_field), intent(in) | reference_field, | ||
type(t_face_field), intent(in) | grid_volume, | ||
logical, intent(in) | is_relative_error, | ||
type(t_logical_face_field), intent(in), optional | mask ) |
See compute_error_face.
[in] | label | label of the field |
[in] | field | face-centered field |
[in] | reference_field | face-centered field |
[in] | grid_volume | volume of the grid where field is defined |
[in] | is_relative_error | boolean to compute relative or absolute error |
[in] | mask | restrict the sum where mask is .true. |
subroutine mod_compute_error::compute_and_print_l1_error_face | ( | character(len=*), intent(in) | label, |
type(t_face_field), intent(in) | field, | ||
type(t_face_field), intent(in) | reference_field, | ||
type(t_face_field), intent(in) | grid_volume, | ||
logical, intent(in) | is_relative_error, | ||
type(t_logical_face_field), intent(in), optional | mask ) |
See compute_error_face.
[in] | label | label of the field |
[in] | field | face-centered field |
[in] | reference_field | face-centered field |
[in] | grid_volume | volume of the grid where field is defined |
[in] | is_relative_error | boolean to compute relative or absolute error |
[in] | mask | restrict the sum where mask is .true. |
subroutine mod_compute_error::compute_and_print_l2_error_face | ( | character(len=*), intent(in) | label, |
type(t_face_field), intent(in) | field, | ||
type(t_face_field), intent(in) | reference_field, | ||
type(t_face_field), intent(in) | grid_volume, | ||
logical, intent(in) | is_relative_error, | ||
type(t_logical_face_field), intent(in), optional | mask ) |
See compute_error_face.
[in] | label | label of the field |
[in] | field | face-centered field |
[in] | reference_field | face-centered field |
[in] | grid_volume | volume of the grid where field is defined |
[in] | is_relative_error | boolean to compute relative or absolute error |
[in] | mask | restrict the sum where mask is .true. |
subroutine mod_compute_error::compute_and_print_linf_error_face | ( | character(len=*), intent(in) | label, |
type(t_face_field), intent(in) | field, | ||
type(t_face_field), intent(in) | reference_field, | ||
type(t_face_field), intent(in) | grid_volume, | ||
logical, intent(in) | is_relative_error, | ||
type(t_logical_face_field), intent(in), optional | mask ) |
See compute_error_face.
[in] | label | label of the field |
[in] | field | face-centered field |
[in] | reference_field | face-centered field |
[in] | grid_volume | volume of the grid where field is defined |
[in] | is_relative_error | boolean to compute relative or absolute error |
[in] | mask | restrict the sum where mask is .true. |
subroutine mod_compute_error::compute_error_cell | ( | double precision, dimension(:,:,:), intent(in) | field, |
double precision, dimension(:,:,:), intent(in) | reference_field, | ||
double precision, dimension(:,:,:), intent(in) | grid_volume, | ||
logical, intent(in) | is_relative_error, | ||
logical, dimension(:,:,:), intent(in), optional | mask, | ||
double precision, intent(out), optional | error_l1, | ||
double precision, intent(out), optional | error_l2, | ||
double precision, intent(out), optional | error_linf ) |
The error is computed against the argument reference_field
, which must be a cell-centered field.
[in] | field | cell-centered field |
[in] | reference_field | cell-centered field |
[in] | grid_volume | volume of the grid where field is defined |
[in] | is_relative_error | boolean to compute relative or absolute error |
[in] | mask | restrict the sum where mask is .true. |
[out] | error_l1 | L1 norm of the error |
[out] | error_l2 | L2 norm of the error |
[out] | error_linf | Linf norm of the error |
subroutine mod_compute_error::compute_error_face | ( | type(t_face_field), intent(in) | field, |
type(t_face_field), intent(in) | reference_field, | ||
type(t_face_field), intent(in) | grid_volume, | ||
logical, intent(in) | is_relative_error, | ||
type(t_logical_face_field), intent(in), optional | mask, | ||
double precision, intent(out), optional | error_l1, | ||
double precision, intent(out), optional | error_l1_u, | ||
double precision, intent(out), optional | error_l1_v, | ||
double precision, intent(out), optional | error_l1_w, | ||
double precision, intent(out), optional | error_l2, | ||
double precision, intent(out), optional | error_l2_u, | ||
double precision, intent(out), optional | error_l2_v, | ||
double precision, intent(out), optional | error_l2_w, | ||
double precision, intent(out), optional | error_linf, | ||
double precision, intent(out), optional | error_linf_u, | ||
double precision, intent(out), optional | error_linf_v, | ||
double precision, intent(out), optional | error_linf_w ) |
The error is computed against the argument reference_field
, which must be a face-centered field.
[in] | field | face-centered field |
[in] | reference_field | face-centered field |
[in] | grid_volume | volume of the grid where field is defined |
[in] | is_relative_error | boolean to compute relative or absolute error |
[in] | mask | restrict the sum where mask is .true. |
[out] | error_l1 | L1 norm of the error on all vector components |
[out] | error_l1_u | L1 norm of the error in direction _u |
[out] | error_l1_v | L1 norm of the error in direction _v |
[out] | error_l1_w | L1 norm of the error in direction _w |
[out] | error_l2 | L2 norm of the error on all vector components |
[out] | error_l2_u | L2 norm of the error in direction _u |
[out] | error_l2_v | L2 norm of the error in direction _v |
[out] | error_l2_w | L2 norm of the error in direction _w |
[out] | error_linf | Linf norm of the error on all vector components |
[out] | error_linf_u | Linf norm of the error in direction _u |
[out] | error_linf_v | Linf norm of the error in direction _v |
[out] | error_linf_w | Linf norm of the error in direction _w |
subroutine mod_compute_error_symmetric_difference::compute_error_symmetric_difference | ( | type(t_phase_geometry), intent(in) | reference_solution, |
type(t_phase_geometry), intent(in) | solution, | ||
double precision, dimension(:,:,:), intent(out) | error, | ||
double precision, intent(out) | error_symmetric_difference, | ||
logical, dimension(:,:,:), intent(in), optional | mask ) |
The symmetric difference error is defined as the area of the symmetric difference between the reconstructed phase \(\omega^\ell\) and a reference phase \(\omega^\star\) divided by the area of the reference phase boundary:
\[ \Delta\Gamma_{avg} = \dfrac{1}{|\partial\omega^\star|}\sum_{i=1}^{n} |\omega^\star_i\triangle\omega^\ell_i| \]
Where \(n\) is the number of cell, \(\omega^\star_i\) and \(\omega^\ell_i\) are the restriction of the phases to the cell \(i\)
This error is also referred as the average deviation.
Here, we do not consider the area of the reference phase boundary. We use the following formula:
\[ \Delta\Gamma_{err} = \sum_{i=1}^{n} (|\omega^\star_i| + |\omega^\ell_i| - 2|\omega^\star_i\cap\omega^\ell_i|) \]
[in] | reference_solution | reference phase \(\omega^\star\) |
[in] | solution | reconstructed phase \(\omega^\ell\) |
[out] | error | cell-wise symmetric difference error |
[out] | error_symmetric_difference | symmetric difference error |
[in] | mask | mask to compute the error on a portion of the domain |
subroutine mod_compute_l1_norm::compute_l1_norm | ( | double precision, intent(out) | l1_norm, |
double precision, dimension(:,:,:), intent(in) | field, | ||
double precision, dimension(:,:,:), intent(in) | grid_volume, | ||
logical, dimension(:,:,:), intent(in), optional | mask ) |
A mask can be apply to compute the error on a part of the domain only.
[out] | l1_norm | L1 norm of field |
[in] | field | Any field defined on cell or face |
[in] | grid_volume | Volume of the grid where field is defined |
[in] | mask | Restrict the sum where mask is .true. |
subroutine mod_compute_l2_norm::compute_l2_norm | ( | double precision, intent(out) | l2_norm, |
double precision, dimension(:,:,:), intent(in) | field, | ||
double precision, dimension(:,:,:), intent(in) | grid_volume, | ||
logical, dimension(:,:,:), intent(in), optional | mask ) |
A mask can be apply to compute the error on a part of the domain only.
[out] | l2_norm | L2 norm of field |
[in] | field | Any field defined on cell or face |
[in] | grid_volume | Volume of the grid where field is defined |
[in] | mask | Restrict the sum where mask is .true. |
subroutine mod_compute_linf_norm::compute_linf_norm | ( | double precision, intent(out) | linf_norm, |
double precision, dimension(:,:,:), intent(in) | field, | ||
double precision, dimension(:,:,:), intent(in) | grid_volume, | ||
logical, dimension(:,:,:), intent(in), optional | mask ) |
A mask can be apply to compute the error on a part of the domain only.
The norm is computed where grid_volume
> 0
[out] | linf_norm | Linf norm of field |
[in] | field | Any field defined on cell or face |
[in] | grid_volume | Volume of the grid where field is defined |
[in] | mask | Restrict the sum where mask is .true. |
subroutine mod_compute_error::print_error | ( | character(len=*), intent(in) | label, |
double precision, intent(in), optional | error_l1, | ||
double precision, intent(in), optional | error_l2, | ||
double precision, intent(in), optional | error_linf ) |
See compute_error_cell and compute_error_face to compute the errors.
[in] | label | label of the field |
[in] | error_l1 | L1 norm of the error |
[in] | error_l2 | L2 norm of the error |
[in] | error_linf | Linf norm of the error |