MOM6
|
Vertical interpolation for regridding.
Data Types | |
type | interp_cs_type |
Control structure for regrid_interp module. More... | |
Variables | |
integer, parameter | interpolation_p1m_h2 = 0 |
O(h^2) | |
integer, parameter | interpolation_p1m_h4 = 1 |
O(h^2) | |
integer, parameter | interpolation_p1m_ih4 = 2 |
O(h^2) | |
integer, parameter | interpolation_plm = 3 |
O(h^2) | |
integer, parameter | interpolation_ppm_h4 = 4 |
O(h^3) | |
integer, parameter | interpolation_ppm_ih4 = 5 |
O(h^3) | |
integer, parameter | interpolation_p3m_ih4ih3 = 6 |
O(h^4) | |
integer, parameter | interpolation_p3m_ih6ih5 = 7 |
O(h^4) | |
integer, parameter | interpolation_pqm_ih4ih3 = 8 |
O(h^4) | |
integer, parameter | interpolation_pqm_ih6ih5 = 9 |
O(h^5) | |
integer, parameter | degree_1 = 1 |
Interpolant degrees. | |
integer, parameter | degree_2 = 2 |
Interpolant degrees. | |
integer, parameter | degree_3 = 3 |
Interpolant degrees. | |
integer, parameter | degree_4 = 4 |
Interpolant degrees. | |
integer, parameter, public | degree_max = 5 |
Interpolant degrees. | |
real, parameter, public | nr_offset = 1e-6 |
When the N-R algorithm produces an estimate that lies outside [0,1], the estimate is set to be equal to the boundary location, 0 or 1, plus or minus an offset, respectively, when the derivative is zero at the boundary. | |
integer, parameter, public | nr_iterations = 8 |
Maximum number of Newton-Raphson iterations. Newton-Raphson iterations are used to build the new grid by finding the coordinates associated with target densities and interpolations of degree larger than 1. | |
real, parameter, public | nr_tolerance = 1e-12 |
Tolerance for Newton-Raphson iterations (stop when increment falls below this) | |
subroutine, public | regridding_set_ppolys (CS, densities, n0, h0, ppoly0_E, ppoly0_S, ppoly0_coefs, degree, h_neglect, h_neglect_edge) |
Builds an interpolated profile for the densities within each grid cell. More... | |
subroutine, public | interpolate_grid (n0, h0, x0, ppoly0_E, ppoly0_coefs, target_values, degree, n1, h1, x1) |
Given target values (e.g., density), build new grid based on polynomial. More... | |
subroutine, public | build_and_interpolate_grid (CS, densities, n0, h0, x0, target_values, n1, h1, x1, h_neglect, h_neglect_edge) |
Build a grid by interpolating for target values. More... | |
real function | get_polynomial_coordinate (N, h, x_g, ppoly_E, ppoly_coefs, target_value, degree) |
Given a target value, find corresponding coordinate for given polynomial. More... | |
integer function | interpolation_scheme (interp_scheme) |
Numeric value of interpolation_scheme corresponding to scheme name. More... | |
subroutine, public | set_interp_scheme (CS, interp_scheme) |
Store the interpolation_scheme value in the interp_CS based on the input string. More... | |
subroutine, public | set_interp_extrap (CS, extrap) |
Store the boundary_extrapolation value in the interp_CS. More... | |
subroutine, public regrid_interp::build_and_interpolate_grid | ( | type(interp_cs_type), intent(in) | CS, |
real, dimension(:), intent(in) | densities, | ||
integer, intent(in) | n0, | ||
real, dimension(:), intent(in) | h0, | ||
real, dimension(:), intent(in) | x0, | ||
real, dimension(:), intent(in) | target_values, | ||
integer, intent(in) | n1, | ||
real, dimension(:), intent(inout) | h1, | ||
real, dimension(:), intent(inout) | x1, | ||
real, intent(in), optional | h_neglect, | ||
real, intent(in), optional | h_neglect_edge | ||
) |
Build a grid by interpolating for target values.
[in] | cs | A control structure for regrid_interp |
[in] | densities | Input cell densities [kg m-3] |
[in] | target_values | Target values of interfaces |
[in] | n0 | The number of points on the input grid |
[in] | h0 | Initial cell widths |
[in] | x0 | Source interface positions |
[in] | n1 | The number of points on the output grid |
[in,out] | h1 | Output cell widths |
[in,out] | x1 | Target interface positions |
[in] | h_neglect | A negligibly small width for the purpose of cell reconstructions in the same units as h0. |
[in] | h_neglect_edge | A negligibly small width for the purpose of edge value calculations in the same units as h0. |
Definition at line 300 of file regrid_interp.F90.
|
private |
Given a target value, find corresponding coordinate for given polynomial.
Here, 'ppoly' is assumed to be a piecewise discontinuous polynomial of degree 'degree' throughout the domain defined by 'grid'. A target value is given and we need to determine the corresponding grid coordinate to define the new grid.
If the target value is out of range, the grid coordinate is simply set to be equal to one of the boundary coordinates, which results in vanished layers near the boundaries.
IT IS ASSUMED THAT THE PIECEWISE POLYNOMIAL IS MONOTONICALLY INCREASING. IF THIS IS NOT THE CASE, THE NEW GRID MAY BE ILL-DEFINED.
It is assumed that the number of cells defining 'grid' and 'ppoly' are the same.
[in] | n | Number of grid cells |
[in] | h | Grid cell thicknesses |
[in] | x_g | Grid interface locations |
[in] | ppoly_e | Edge values of interpolating polynomials |
[in] | ppoly_coefs | Coefficients of interpolating polynomials |
[in] | target_value | Target value to find position for |
[in] | degree | Degree of the interpolating polynomials |
Definition at line 344 of file regrid_interp.F90.
subroutine, public regrid_interp::interpolate_grid | ( | integer, intent(in) | n0, |
real, dimension(:), intent(in) | h0, | ||
real, dimension(:), intent(in) | x0, | ||
real, dimension(:,:), intent(in) | ppoly0_E, | ||
real, dimension(:,:), intent(in) | ppoly0_coefs, | ||
real, dimension(:), intent(in) | target_values, | ||
integer, intent(in) | degree, | ||
integer, intent(in) | n1, | ||
real, dimension(:), intent(inout) | h1, | ||
real, dimension(:), intent(inout) | x1 | ||
) |
Given target values (e.g., density), build new grid based on polynomial.
Given the grid 'grid0' and the piecewise polynomial interpolant 'ppoly0' (possibly discontinuous), the coordinates of the new grid 'grid1' are determined by finding the corresponding target interface densities.
[in] | n0 | Number of points on source grid |
[in] | h0 | Thicknesses of source grid cells |
[in] | x0 | Source interface positions |
[in] | ppoly0_e | Edge values of interpolating polynomials |
[in] | ppoly0_coefs | Coefficients of interpolating polynomials |
[in] | target_values | Target values of interfaces |
[in] | degree | Degree of interpolating polynomials |
[in] | n1 | Number of points on target grid |
[in,out] | h1 | Thicknesses of target grid cells |
[in,out] | x1 | Target interface positions |
Definition at line 268 of file regrid_interp.F90.
|
private |
Numeric value of interpolation_scheme corresponding to scheme name.
[in] | interp_scheme | Name of the interpolation scheme Valid values include "P1M_H2", "P1M_H4", "P1M_IH2", "PLM", "PPM_H4", "PPM_IH4", "P3M_IH4IH3", "P3M_IH6IH5", "PQM_IH4IH3", and "PQM_IH6IH5" |
Definition at line 478 of file regrid_interp.F90.
subroutine, public regrid_interp::regridding_set_ppolys | ( | type(interp_cs_type), intent(in) | CS, |
real, dimension(:), intent(in) | densities, | ||
integer, intent(in) | n0, | ||
real, dimension(:), intent(in) | h0, | ||
real, dimension(:,:), intent(inout) | ppoly0_E, | ||
real, dimension(:,:), intent(inout) | ppoly0_S, | ||
real, dimension(:,:), intent(inout) | ppoly0_coefs, | ||
integer, intent(inout) | degree, | ||
real, intent(in), optional | h_neglect, | ||
real, intent(in), optional | h_neglect_edge | ||
) |
Builds an interpolated profile for the densities within each grid cell.
It may happen that, given a high-order interpolator, the number of available layers is insufficient (e.g., there are two available layers for a third-order PPM ih4 scheme). In these cases, we resort to the simplest continuous linear scheme (P1M h2).
[in] | cs | Interpolation control structure |
[in] | densities | Actual cell densities |
[in] | n0 | Number of cells on source grid |
[in] | h0 | cell widths on source grid |
[in,out] | ppoly0_e | Edge value of polynomial |
[in,out] | ppoly0_s | Edge slope of polynomial |
[in,out] | ppoly0_coefs | Coefficients of polynomial |
[in,out] | degree | The degree of the polynomials |
[in] | h_neglect | A negligibly small width for the purpose of cell reconstructions in the same units as h0. |
[in] | h_neglect_edge | A negligibly small width for the purpose of edge value calculations in the same units as h0. |
Definition at line 77 of file regrid_interp.F90.
subroutine, public regrid_interp::set_interp_extrap | ( | type(interp_cs_type), intent(inout) | CS, |
logical, intent(in) | extrap | ||
) |
Store the boundary_extrapolation value in the interp_CS.
[in,out] | cs | A control structure for regrid_interp |
[in] | extrap | Indicate whether high-order boundary extrapolation should be used in boundary cells |
Definition at line 510 of file regrid_interp.F90.
subroutine, public regrid_interp::set_interp_scheme | ( | type(interp_cs_type), intent(inout) | CS, |
character(len=*), intent(in) | interp_scheme | ||
) |
Store the interpolation_scheme value in the interp_CS based on the input string.
[in,out] | cs | A control structure for regrid_interp |
[in] | interp_scheme | Name of the interpolation scheme Valid values include "P1M_H2", "P1M_H4", "P1M_IH2", "PLM", "PPM_H4", "PPM_IH4", "P3M_IH4IH3", "P3M_IH6IH5", "PQM_IH4IH3", and "PQM_IH6IH5" |
Definition at line 500 of file regrid_interp.F90.