version 0.6.0
Loading...
Searching...
No Matches
Error tools

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.
 

Detailed Description

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.

Function Documentation

◆ compute_and_print_error_cell()

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.

Parameters
[in]labellabel of the field
[in]fieldcell-centered field
[in]reference_fieldcell-centered field
[in]grid_volumevolume of the grid where field is defined
[in]is_relative_errorboolean to compute relative or absolute error
[in]maskrestrict the sum where mask is .true.

◆ compute_and_print_error_face()

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.

Parameters
[in]labellabel of the field
[in]fieldface-centered field
[in]reference_fieldface-centered field
[in]grid_volumevolume of the grid where field is defined
[in]is_relative_errorboolean to compute relative or absolute error
[in]maskrestrict the sum where mask is .true.

◆ compute_and_print_l1_error_face()

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.

Parameters
[in]labellabel of the field
[in]fieldface-centered field
[in]reference_fieldface-centered field
[in]grid_volumevolume of the grid where field is defined
[in]is_relative_errorboolean to compute relative or absolute error
[in]maskrestrict the sum where mask is .true.

◆ compute_and_print_l2_error_face()

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.

Parameters
[in]labellabel of the field
[in]fieldface-centered field
[in]reference_fieldface-centered field
[in]grid_volumevolume of the grid where field is defined
[in]is_relative_errorboolean to compute relative or absolute error
[in]maskrestrict the sum where mask is .true.

◆ compute_and_print_linf_error_face()

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.

Parameters
[in]labellabel of the field
[in]fieldface-centered field
[in]reference_fieldface-centered field
[in]grid_volumevolume of the grid where field is defined
[in]is_relative_errorboolean to compute relative or absolute error
[in]maskrestrict the sum where mask is .true.

◆ compute_error_cell()

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.

Parameters
[in]fieldcell-centered field
[in]reference_fieldcell-centered field
[in]grid_volumevolume of the grid where field is defined
[in]is_relative_errorboolean to compute relative or absolute error
[in]maskrestrict the sum where mask is .true.
[out]error_l1L1 norm of the error
[out]error_l2L2 norm of the error
[out]error_linfLinf norm of the error

◆ compute_error_face()

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.

Parameters
[in]fieldface-centered field
[in]reference_fieldface-centered field
[in]grid_volumevolume of the grid where field is defined
[in]is_relative_errorboolean to compute relative or absolute error
[in]maskrestrict the sum where mask is .true.
[out]error_l1L1 norm of the error on all vector components
[out]error_l1_uL1 norm of the error in direction _u
[out]error_l1_vL1 norm of the error in direction _v
[out]error_l1_wL1 norm of the error in direction _w
[out]error_l2L2 norm of the error on all vector components
[out]error_l2_uL2 norm of the error in direction _u
[out]error_l2_vL2 norm of the error in direction _v
[out]error_l2_wL2 norm of the error in direction _w
[out]error_linfLinf norm of the error on all vector components
[out]error_linf_uLinf norm of the error in direction _u
[out]error_linf_vLinf norm of the error in direction _v
[out]error_linf_wLinf norm of the error in direction _w

◆ compute_error_symmetric_difference()

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|) \]

Parameters
[in]reference_solutionreference phase \(\omega^\star\)
[in]solutionreconstructed phase \(\omega^\ell\)
[out]errorcell-wise symmetric difference error
[out]error_symmetric_differencesymmetric difference error
[in]maskmask to compute the error on a portion of the domain

◆ compute_l1_norm()

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.

Parameters
[out]l1_normL1 norm of field
[in]fieldAny field defined on cell or face
[in]grid_volumeVolume of the grid where field is defined
[in]maskRestrict the sum where mask is .true.

◆ compute_l2_norm()

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.

Parameters
[out]l2_normL2 norm of field
[in]fieldAny field defined on cell or face
[in]grid_volumeVolume of the grid where field is defined
[in]maskRestrict the sum where mask is .true.

◆ compute_linf_norm()

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

Parameters
[out]linf_normLinf norm of field
[in]fieldAny field defined on cell or face
[in]grid_volumeVolume of the grid where field is defined
[in]maskRestrict the sum where mask is .true.

◆ print_error()

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.

Parameters
[in]labellabel of the field
[in]error_l1L1 norm of the error
[in]error_l2L2 norm of the error
[in]error_linfLinf norm of the error