regrid_edge_values module reference

Edge value estimation for high-order reconstruction

Functions/Subroutines

bound_edge_values

Bound edge values by neighboring cell averages

average_discontinuous_edge_values

Replace discontinuous collocated edge values with their average

check_discontinuous_edge_values

Check discontinuous edge values and replace them with their average if not monotonic

edge_values_explicit_h2

Compute h2 edge values (explicit second order accurate) in the same units as u.

edge_values_explicit_h4

Compute h4 edge values (explicit fourth order accurate) in the same units as u.

edge_values_explicit_h4cw

Compute h4 edge values (explicit fourth order accurate) in the same units as u.

edge_values_implicit_h4

Compute ih4 edge values (implicit fourth order accurate) in the same units as u.

end_value_h4

Determine a one-sided 4th order polynomial fit of u to the data points for the purposes of specifying edge values, as described in the appendix of White and Adcroft JCP 2008.

edge_slopes_implicit_h3

Compute ih3 edge slopes (implicit third order accurate) in the same units as h.

edge_slopes_implicit_h5

Compute ih5 edge slopes (implicit fifth order accurate)

edge_values_implicit_h6

Compute ih6 edge values (implicit sixth order accurate) in the same units as u.

test_line

Test that A*C = R to within a tolerance, issuing a fatal error with an explanatory message if they do not.

Functions/Subroutine Documentation

subroutine bound_edge_values(N, h, u, edge_val, h_neglect, answer_date)

Bound edge values by neighboring cell averages

In this routine, we loop on all cells to bound their left and right edge values by the cell averages. That is, the left edge value must lie between the left cell average and the central cell average. A similar reasoning applies to the right edge values.

Both boundary edge values are set equal to the boundary cell averages. Any extrapolation scheme is applied after this routine has been called. Therefore, boundary cells are treated as if they were local extrema.

Parameters
  • N [in]

    Number of cells

  • h [in]

    cell widths [H]

  • u [in]

    cell average properties in arbitrary units [A]

  • edge_val [inout]

    Potentially modified edge values [A]; the second index is for the two edges of each cell.

  • h_neglect [in]

    A negligibly small width [H]

  • answer_date [in]

    The vintage of the expressions to use

Callers call graph
Callers of regrid_edge_values::bound_edge_values calls cluster_p1m_functions P1M_functions cluster_p3m_functions P3M_functions cluster_ppm_functions PPM_functions cluster_pqm_functions PQM_functions cluster_recon1d_ppm_h4_2018 Recon1d_PPM_H4_2018 cluster_regrid_edge_values regrid_edge_values p1m_functions::p1m_interpolation P1M_interpolation regrid_edge_values::bound_edge_values bound_edge_values p1m_functions::p1m_interpolation->regrid_edge_values::bound_edge_values p3m_functions::p3m_limiter P3M_limiter [private/internal] p3m_functions::p3m_limiter->regrid_edge_values::bound_edge_values ppm_functions::ppm_limiter_standard PPM_limiter_standard [private/internal] ppm_functions::ppm_limiter_standard->regrid_edge_values::bound_edge_values pqm_functions::pqm_limiter PQM_limiter [private/internal] pqm_functions::pqm_limiter->regrid_edge_values::bound_edge_values recon1d_ppm_h4_2018::reconstruct reconstruct [private/internal] recon1d_ppm_h4_2018::reconstruct->regrid_edge_values::bound_edge_values
Text view
subroutine average_discontinuous_edge_values(N, edge_val)

Replace discontinuous collocated edge values with their average

For each interior edge, check whether the edge values are discontinuous. If so, compute the average and replace the edge values by the average.

Parameters
  • N [in]

    Number of cells

  • edge_val [inout]

    Edge values that may be modified [A]; the second index is for the two edges of each cell.

Callers call graph
Callers of regrid_edge_values::average_discontinuous_edge_values calls cluster_p1m_functions P1M_functions cluster_p3m_functions P3M_functions cluster_regrid_edge_values regrid_edge_values p1m_functions::p1m_interpolation P1M_interpolation regrid_edge_values::average_discontinuous_edge_values average_discontinuous_edge_values p1m_functions::p1m_interpolation->regrid_edge_values::average_discontinuous_edge_values p3m_functions::p3m_limiter P3M_limiter [private/internal] p3m_functions::p3m_limiter->regrid_edge_values::average_discontinuous_edge_values
Text view
subroutine check_discontinuous_edge_values(N, u, edge_val)

Check discontinuous edge values and replace them with their average if not monotonic

For each interior edge, check whether the edge values are discontinuous. If so and if they are not monotonic, replace each edge value by their average.

Parameters
  • N [in]

    Number of cells

  • u [in]

    cell averages in arbitrary units [A]

  • edge_val [inout]

    Cell edge values [A]; the second index is for the two edges of each cell.

Callers call graph
Callers of regrid_edge_values::check_discontinuous_edge_values calls cluster_ppm_functions PPM_functions cluster_pqm_functions PQM_functions cluster_recon1d_ppm_h4_2018 Recon1d_PPM_H4_2018 cluster_regrid_edge_values regrid_edge_values ppm_functions::ppm_limiter_standard PPM_limiter_standard [private/internal] regrid_edge_values::check_discontinuous_edge_values check_discontinuous_edge_values ppm_functions::ppm_limiter_standard->regrid_edge_values::check_discontinuous_edge_values pqm_functions::pqm_limiter PQM_limiter [private/internal] pqm_functions::pqm_limiter->regrid_edge_values::check_discontinuous_edge_values recon1d_ppm_h4_2018::reconstruct reconstruct [private/internal] recon1d_ppm_h4_2018::reconstruct->regrid_edge_values::check_discontinuous_edge_values
Text view
subroutine edge_values_explicit_h2(N, h, u, edge_val)

Compute h2 edge values (explicit second order accurate) in the same units as u.

Compute edge values based on second-order explicit estimates. These estimates are based on a straight line spanning two cells and evaluated at the location of the middle edge. An interpolant spanning cells k-1 and k is evaluated at edge k-1/2. The estimate for each edge is unique.

      k-1     k
..--o------o------o--..
         k-1/2

Boundary edge values are set to be equal to the boundary cell averages.

Parameters
  • N [in]

    Number of cells

  • h [in]

    cell widths [H]

  • u [in]

    cell average properties in arbitrary units [A]

  • edge_val [inout]

    Returned edge values [A]; the second index is for the two edges of each cell.

Callers call graph
Callers of regrid_edge_values::edge_values_explicit_h2 calls cluster_regrid_edge_values regrid_edge_values cluster_regrid_interp regrid_interp regrid_edge_values::edge_values_explicit_h2 edge_values_explicit_h2 regrid_interp::regridding_set_ppolys regridding_set_ppolys regrid_interp::regridding_set_ppolys->regrid_edge_values::edge_values_explicit_h2
Text view
subroutine edge_values_explicit_h4(N, h, u, edge_val, h_neglect, answer_date)

Compute h4 edge values (explicit fourth order accurate) in the same units as u.

Compute edge values based on fourth-order explicit estimates. These estimates are based on a cubic interpolant spanning four cells and evaluated at the location of the middle edge. An interpolant spanning cells i-2, i-1, i and i+1 is evaluated at edge i-1/2. The estimate for each edge is unique.

      i-2    i-1     i     i+1
..--o------o------o------o------o--..
                i-1/2

The first two edge values are estimated by evaluating the first available cubic interpolant, i.e., the interpolant spanning cells 1, 2, 3 and 4. Similarly, the last two edge values are estimated by evaluating the last available interpolant.

For this fourth-order scheme, at least four cells must exist.

Parameters
  • N [in]

    Number of cells

  • h [in]

    cell widths [H]

  • u [in]

    cell average properties in arbitrary units [A]

  • edge_val [inout]

    Returned edge values [A]; the second index is for the two edges of each cell.

  • h_neglect [in]

    A negligibly small width [H]

  • answer_date [in]

    The vintage of the expressions to use

Callees call graph
Callees of regrid_edge_values::edge_values_explicit_h4 calls cluster_polynomial_functions polynomial_functions cluster_regrid_edge_values regrid_edge_values cluster_regrid_solvers regrid_solvers polynomial_functions::evaluation_polynomial evaluation_polynomial regrid_edge_values::edge_values_explicit_h4 edge_values_explicit_h4 regrid_edge_values::edge_values_explicit_h4->polynomial_functions::evaluation_polynomial regrid_edge_values::end_value_h4 end_value_h4 [private/internal] regrid_edge_values::edge_values_explicit_h4->regrid_edge_values::end_value_h4 regrid_solvers::solve_linear_system solve_linear_system regrid_edge_values::edge_values_explicit_h4->regrid_solvers::solve_linear_system
Text view
Callers call graph
Callers of regrid_edge_values::edge_values_explicit_h4 calls cluster_mom_remapping MOM_remapping cluster_regrid_edge_values regrid_edge_values cluster_regrid_interp regrid_interp mom_remapping::build_reconstructions_1d build_reconstructions_1d regrid_edge_values::edge_values_explicit_h4 edge_values_explicit_h4 mom_remapping::build_reconstructions_1d->regrid_edge_values::edge_values_explicit_h4 mom_remapping::remapping_unit_tests remapping_unit_tests mom_remapping::remapping_unit_tests->regrid_edge_values::edge_values_explicit_h4 regrid_interp::regridding_set_ppolys regridding_set_ppolys regrid_interp::regridding_set_ppolys->regrid_edge_values::edge_values_explicit_h4
Text view
subroutine edge_values_explicit_h4cw(N, h, u, edge_val, h_neglect)

Compute h4 edge values (explicit fourth order accurate) in the same units as u.

From (Colella & Woodward, JCP, 1984) and based on hybgen_ppm_coefs.

Compute edge values based on fourth-order explicit estimates. These estimates are based on a cubic interpolant spanning four cells and evaluated at the location of the middle edge. An interpolant spanning cells i-2, i-1, i and i+1 is evaluated at edge i-1/2. The estimate for each edge is unique.

      i-2    i-1     i     i+1
..--o------o------o------o------o--..
                i-1/2

For this fourth-order scheme, at least four cells must exist.

Parameters
  • N [in]

    Number of cells

  • h [in]

    cell widths [H]

  • u [in]

    cell average properties in arbitrary units [A]

  • edge_val [inout]

    Returned edge values [A]; the second index is for the two edges of each cell.

  • h_neglect [in]

    A negligibly small width [H]

Callers call graph
Callers of regrid_edge_values::edge_values_explicit_h4cw calls cluster_mom_remapping MOM_remapping cluster_regrid_edge_values regrid_edge_values cluster_regrid_interp regrid_interp mom_remapping::build_reconstructions_1d build_reconstructions_1d regrid_edge_values::edge_values_explicit_h4cw edge_values_explicit_h4cw mom_remapping::build_reconstructions_1d->regrid_edge_values::edge_values_explicit_h4cw regrid_interp::regridding_set_ppolys regridding_set_ppolys regrid_interp::regridding_set_ppolys->regrid_edge_values::edge_values_explicit_h4cw
Text view
subroutine edge_values_implicit_h4(N, h, u, edge_val, h_neglect, answer_date)

Compute ih4 edge values (implicit fourth order accurate) in the same units as u.

Compute edge values based on fourth-order implicit estimates.

Fourth-order implicit estimates of edge values are based on a two-cell stencil. A tridiagonal system is set up and is based on expressing the edge values in terms of neighboring cell averages. The generic relationship is

\begin{equation*} \alpha u_{i-1/2} + u_{i+1/2} + \beta u_{i+3/2} = a \bar{u}_i + b \bar{u}_{i+1} \end{equation*}

and the stencil looks like this

       i     i+1
..--o------o------o--..
  i-1/2  i+1/2  i+3/2

In this routine, the coefficients \(\alpha\), \(\beta\), \(a\) and \(b\) are computed, the tridiagonal system is built, boundary conditions are prescribed and the system is solved to yield edge-value estimates.

There are N+1 unknowns and we are able to write N-1 equations. The boundary conditions close the system.

Parameters
  • N [in]

    Number of cells

  • h [in]

    cell widths [H]

  • u [in]

    cell average properties in arbitrary units [A]

  • edge_val [inout]

    Returned edge values [A]; the second index is for the two edges of each cell.

  • h_neglect [in]

    A negligibly small width [H]

  • answer_date [in]

    The vintage of the expressions to use

Callees call graph
Callees of regrid_edge_values::edge_values_implicit_h4 calls cluster_polynomial_functions polynomial_functions cluster_regrid_edge_values regrid_edge_values cluster_regrid_solvers regrid_solvers polynomial_functions::evaluation_polynomial evaluation_polynomial regrid_edge_values::edge_values_implicit_h4 edge_values_implicit_h4 regrid_edge_values::edge_values_implicit_h4->polynomial_functions::evaluation_polynomial regrid_edge_values::end_value_h4 end_value_h4 [private/internal] regrid_edge_values::edge_values_implicit_h4->regrid_edge_values::end_value_h4 regrid_solvers::solve_diag_dominant_tridiag solve_diag_dominant_tridiag regrid_edge_values::edge_values_implicit_h4->regrid_solvers::solve_diag_dominant_tridiag regrid_solvers::solve_linear_system solve_linear_system regrid_edge_values::edge_values_implicit_h4->regrid_solvers::solve_linear_system regrid_solvers::solve_tridiagonal_system solve_tridiagonal_system regrid_edge_values::edge_values_implicit_h4->regrid_solvers::solve_tridiagonal_system
Text view
Callers call graph
Callers of regrid_edge_values::edge_values_implicit_h4 calls cluster_mom_ale MOM_ALE cluster_mom_remapping MOM_remapping cluster_regrid_edge_values regrid_edge_values cluster_regrid_interp regrid_interp mom_ale::ts_ppm_edge_values TS_PPM_edge_values regrid_edge_values::edge_values_implicit_h4 edge_values_implicit_h4 mom_ale::ts_ppm_edge_values->regrid_edge_values::edge_values_implicit_h4 mom_remapping::build_reconstructions_1d build_reconstructions_1d mom_remapping::build_reconstructions_1d->regrid_edge_values::edge_values_implicit_h4 regrid_interp::regridding_set_ppolys regridding_set_ppolys regrid_interp::regridding_set_ppolys->regrid_edge_values::edge_values_implicit_h4
Text view
subroutine end_value_h4(dz, u, Csys)

Determine a one-sided 4th order polynomial fit of u to the data points for the purposes of specifying edge values, as described in the appendix of White and Adcroft JCP 2008.

Parameters
  • dz [in]

    The thicknesses of 4 layers, starting at the edge [H]. The values of dz must be positive.

  • u [in]

    The average properties of 4 layers, starting at the edge [A]

  • Csys [out]

    The four coefficients of a 4th order polynomial fit of u as a function of z [A H-(n-1)]

Callers call graph
Callers of regrid_edge_values::end_value_h4 calls cluster_regrid_edge_values regrid_edge_values regrid_edge_values::edge_slopes_implicit_h3 edge_slopes_implicit_h3 regrid_edge_values::end_value_h4 end_value_h4 [private/internal] regrid_edge_values::edge_slopes_implicit_h3->regrid_edge_values::end_value_h4 regrid_edge_values::edge_values_explicit_h4 edge_values_explicit_h4 regrid_edge_values::edge_values_explicit_h4->regrid_edge_values::end_value_h4 regrid_edge_values::edge_values_implicit_h4 edge_values_implicit_h4 regrid_edge_values::edge_values_implicit_h4->regrid_edge_values::end_value_h4
Text view
subroutine edge_slopes_implicit_h3(N, h, u, edge_slopes, h_neglect, answer_date)

Compute ih3 edge slopes (implicit third order accurate) in the same units as h.

Compute edge slopes based on third-order implicit estimates. Note that the estimates are fourth-order accurate on uniform grids

Third-order implicit estimates of edge slopes are based on a two-cell stencil. A tridiagonal system is set up and is based on expressing the edge slopes in terms of neighboring cell averages. The generic relationship is

\begin{equation*} \alpha u'_{i-1/2} + u'_{i+1/2} + \beta u'_{i+3/2} = a \bar{u}_i + b \bar{u}_{i+1} \end{equation*}

and the stencil looks like this

       i     i+1
..--o------o------o--..
  i-1/2  i+1/2  i+3/2

In this routine, the coefficients \(\alpha\), \(\beta\), a and b are computed, the tridiagonal system is built, boundary conditions are prescribed and the system is solved to yield edge-slope estimates.

There are N+1 unknowns and we are able to write N-1 equations. The boundary conditions close the system.

Parameters
  • N [in]

    Number of cells

  • h [in]

    cell widths [H]

  • u [in]

    cell average properties in arbitrary units [A]

  • edge_slopes [inout]

    Returned edge slopes [A H-1]; the second index is for the two edges of each cell.

  • h_neglect [in]

    A negligibly small width [H]

  • answer_date [in]

    The vintage of the expressions to use

Callees call graph
Callees of regrid_edge_values::edge_slopes_implicit_h3 calls cluster_polynomial_functions polynomial_functions cluster_regrid_edge_values regrid_edge_values cluster_regrid_solvers regrid_solvers polynomial_functions::evaluation_polynomial evaluation_polynomial regrid_edge_values::edge_slopes_implicit_h3 edge_slopes_implicit_h3 regrid_edge_values::edge_slopes_implicit_h3->polynomial_functions::evaluation_polynomial regrid_edge_values::end_value_h4 end_value_h4 [private/internal] regrid_edge_values::edge_slopes_implicit_h3->regrid_edge_values::end_value_h4 regrid_solvers::solve_diag_dominant_tridiag solve_diag_dominant_tridiag regrid_edge_values::edge_slopes_implicit_h3->regrid_solvers::solve_diag_dominant_tridiag regrid_solvers::solve_linear_system solve_linear_system regrid_edge_values::edge_slopes_implicit_h3->regrid_solvers::solve_linear_system regrid_solvers::solve_tridiagonal_system solve_tridiagonal_system regrid_edge_values::edge_slopes_implicit_h3->regrid_solvers::solve_tridiagonal_system
Text view
Callers call graph
Callers of regrid_edge_values::edge_slopes_implicit_h3 calls cluster_mom_remapping MOM_remapping cluster_regrid_edge_values regrid_edge_values cluster_regrid_interp regrid_interp mom_remapping::build_reconstructions_1d build_reconstructions_1d regrid_edge_values::edge_slopes_implicit_h3 edge_slopes_implicit_h3 mom_remapping::build_reconstructions_1d->regrid_edge_values::edge_slopes_implicit_h3 regrid_interp::regridding_set_ppolys regridding_set_ppolys regrid_interp::regridding_set_ppolys->regrid_edge_values::edge_slopes_implicit_h3
Text view
subroutine edge_slopes_implicit_h5(N, h, u, edge_slopes, h_neglect, answer_date)

Compute ih5 edge slopes (implicit fifth order accurate)

Parameters
  • N [in]

    Number of cells

  • h [in]

    cell widths [H]

  • u [in]

    cell average properties in arbitrary units [A]

  • edge_slopes [inout]

    Returned edge slopes [A H-1]; the second index is for the two edges of each cell.

  • h_neglect [in]

    A negligibly small width [H]

  • answer_date [in]

    The vintage of the expressions to use

Callees call graph
Callees of regrid_edge_values::edge_slopes_implicit_h5 calls cluster_regrid_edge_values regrid_edge_values cluster_regrid_solvers regrid_solvers regrid_edge_values::edge_slopes_implicit_h5 edge_slopes_implicit_h5 regrid_solvers::linear_solver linear_solver regrid_edge_values::edge_slopes_implicit_h5->regrid_solvers::linear_solver regrid_solvers::solve_tridiagonal_system solve_tridiagonal_system regrid_edge_values::edge_slopes_implicit_h5->regrid_solvers::solve_tridiagonal_system
Text view
Callers call graph
Callers of regrid_edge_values::edge_slopes_implicit_h5 calls cluster_mom_remapping MOM_remapping cluster_regrid_edge_values regrid_edge_values cluster_regrid_interp regrid_interp mom_remapping::build_reconstructions_1d build_reconstructions_1d regrid_edge_values::edge_slopes_implicit_h5 edge_slopes_implicit_h5 mom_remapping::build_reconstructions_1d->regrid_edge_values::edge_slopes_implicit_h5 regrid_interp::regridding_set_ppolys regridding_set_ppolys regrid_interp::regridding_set_ppolys->regrid_edge_values::edge_slopes_implicit_h5
Text view
subroutine edge_values_implicit_h6(N, h, u, edge_val, h_neglect, answer_date)

Compute ih6 edge values (implicit sixth order accurate) in the same units as u.

Sixth-order implicit estimates of edge values are based on a four-cell, three-edge stencil. A tridiagonal system is set up and is based on expressing the edge values in terms of neighboring cell averages.

The generic relationship is

\begin{equation*} \alpha u_{i-1/2} + u_{i+1/2} + \beta u_{i+3/2} = a \bar{u}_{i-1} + b \bar{u}_i + c \bar{u}_{i+1} + d \bar{u}_{i+2} \end{equation*}

and the stencil looks like this

      i-1     i     i+1    i+2
..--o------o------o------o------o--..
         i-1/2  i+1/2  i+3/2

In this routine, the coefficients \(\alpha\), \(\beta\), a, b, c and d are computed, the tridiagonal system is built, boundary conditions are prescribed and the system is solved to yield edge-value estimates. This scheme is described in detail by White and Adcroft, 2009, J. Comp. Phys, https://doi.org/10.1016/j.jcp.2008.04.026

Note that the centered stencil only applies to edges 3 to N-1 (edges are numbered 1 to n+1), which yields N-3 equations for N+1 unknowns. Two other equations are written by using a right-biased stencil for edge 2 and a left-biased stencil for edge N. The prescription of boundary conditions (using sixth-order polynomials) closes the system.

CAUTION: For each edge, in order to determine the coefficients of the implicit expression, a 6x6 linear system is solved. This may become computationally expensive if regridding is carried out often. Figuring out closed-form expressions for these coefficients on nonuniform meshes turned out to be intractable.

Parameters
  • N [in]

    Number of cells

  • h [in]

    cell widths [H]

  • u [in]

    cell average properties (size N) in arbitrary units [A]

  • edge_val [inout]

    Returned edge values [A]; the second index is for the two edges of each cell.

  • h_neglect [in]

    A negligibly small width [H]

  • answer_date [in]

    The vintage of the expressions to use

Callees call graph
Callees of regrid_edge_values::edge_values_implicit_h6 calls cluster_polynomial_functions polynomial_functions cluster_regrid_edge_values regrid_edge_values cluster_regrid_solvers regrid_solvers polynomial_functions::evaluation_polynomial evaluation_polynomial regrid_edge_values::edge_values_implicit_h6 edge_values_implicit_h6 regrid_edge_values::edge_values_implicit_h6->polynomial_functions::evaluation_polynomial regrid_solvers::linear_solver linear_solver regrid_edge_values::edge_values_implicit_h6->regrid_solvers::linear_solver regrid_solvers::solve_tridiagonal_system solve_tridiagonal_system regrid_edge_values::edge_values_implicit_h6->regrid_solvers::solve_tridiagonal_system
Text view
Callers call graph
Callers of regrid_edge_values::edge_values_implicit_h6 calls cluster_mom_remapping MOM_remapping cluster_regrid_edge_values regrid_edge_values cluster_regrid_interp regrid_interp mom_remapping::build_reconstructions_1d build_reconstructions_1d regrid_edge_values::edge_values_implicit_h6 edge_values_implicit_h6 mom_remapping::build_reconstructions_1d->regrid_edge_values::edge_values_implicit_h6 regrid_interp::regridding_set_ppolys regridding_set_ppolys regrid_interp::regridding_set_ppolys->regrid_edge_values::edge_values_implicit_h6
Text view
subroutine test_line(msg, N, A, C, R, mag, tol)

Test that A*C = R to within a tolerance, issuing a fatal error with an explanatory message if they do not.

Parameters
  • msg [in]

    An identifying message for this test

  • N [in]

    The number of points in the system

  • A [in]

    One of the two vectors being multiplied in arbitrary units [A]

  • C [in]

    One of the two vectors being multiplied in arbitrary units [B]

  • R [in]

    The expected solution of the equation [A B]

  • mag [in]

    The magnitude of leading order terms in this line [A B]

  • tol [in]

    The fractional tolerance for the sums [nondim]

Callees call graph
Callees of regrid_edge_values::test_line calls cluster_mom_error_handler MOM_error_handler cluster_regrid_edge_values regrid_edge_values mom_error_handler::mom_error MOM_error regrid_edge_values::test_line test_line [private/internal] regrid_edge_values::test_line->mom_error_handler::mom_error
Text view
API generated with Flint · Rendered from reStructuredText