mom_remapping module reference¶
Provides column-wise vertical remapping functions.
Data Types¶
Container for remapping parameters. |
Functions/Subroutines¶
Set parameters within remapping object. |
|
Calculate edge coordinate x from cell width h. |
|
Compare two summation estimates of positive data and judge if due to more than round-off. |
|
Remaps column of values u0 on grid h0 to grid h1 assuming the top edge is aligned. |
|
Remaps column of values u0 on grid h0 to implied grid h1 where the interfaces of h1 differ from those of h0 by dx. |
|
Creates polynomial reconstructions of u0 on the source grid h0. |
|
Checks that edge values and reconstructions satisfy bounds. |
|
Remaps column of n0 values u0 on grid h0 to grid h1 with n1 cells by calculating the n0+n1+1 sub-integrals of the intersection of h0 and h1, and the summing the appropriate integrals into the h1*u1 values. |
|
Returns the average value of a reconstruction within a single source cell, i0, between the non-dimensional positions xa and xb (xa<=xb) with dimensional separation dh. |
|
Measure totals and bounds on source grid. |
|
Measure totals and bounds on destination grid. |
|
Remaps column of values u0 on grid h0 to grid h1 by integrating over the projection of each h1 cell onto the h0 grid. |
|
Remaps column of values u0 on grid h0 to implied grid h1 where the interfaces of h1 differ from those of h0 by dx. |
|
Integrate the reconstructed column profile over a single cell. |
|
Calculates the change in interface positions based on h1 and h2. |
|
Constructor for remapping control structure. |
|
Changes the method of reconstruction Use this routine to parse a string parameter specifying the reconstruction and re-allocates work arrays appropriately. |
|
Destrcutor for remapping control structure. |
|
Runs unit tests on remapping functions. |
|
Returns true if any cell of u and u_true are not identical. |
|
Convenience function for printing grid to screen. |
Detailed Description¶
Provides column-wise vertical remapping functions.
Type Documentation¶
-
type
mom_remapping/
remapping_cs
¶ Container for remapping parameters.
- Type fields
%
remapping_scheme
[integer] :: Determines which reconstruction to use.%
degree
[integer] :: Degree of polynomial reconstruction.%
boundary_extrapolation
[logical] :: If true, extrapolate boundaries.%
check_reconstruction
[logical] :: If true, reconstructions are checked for consistency.%
check_remapping
[logical] :: If true, the result of remapping are checked for conservation and bounds.%
force_bounds_in_subcell
[logical] :: If true, the intermediate values used in remapping are forced to be bounded.%
answers_2018
[logical] :: If true use older, less acccurate expressions.
Function/Subroutine Documentation¶
-
subroutine
mom_remapping/
remapping_set_param
(CS, remapping_scheme, boundary_extrapolation, check_reconstruction, check_remapping, force_bounds_in_subcell, answers_2018)¶ Set parameters within remapping object.
- Parameters
cs :: [inout] Remapping control structure
remapping_scheme :: [in] Remapping scheme to use
boundary_extrapolation :: [in] Indicate to extrapolate in boundary cells
check_reconstruction :: [in] Indicate to check reconstructions
check_remapping :: [in] Indicate to check results of remapping
force_bounds_in_subcell :: [in] Force subcells values to be bounded
answers_2018 :: [in] If true use older, less acccurate expressions.
- Call to
- Called from
-
subroutine
mom_remapping/
extract_member_remapping_cs
(CS, remapping_scheme, degree, boundary_extrapolation, check_reconstruction, check_remapping, force_bounds_in_subcell)¶ - Parameters
cs :: [in] Control structure for remapping module
remapping_scheme :: [out] Determines which reconstruction scheme to use
degree :: [out] Degree of polynomial reconstruction
boundary_extrapolation :: [out] If true, extrapolate boundaries
check_reconstruction :: [out] If true, reconstructions are checked for consistency.
check_remapping :: [out] If true, the result of remapping are checked for conservation and bounds.
force_bounds_in_subcell :: [out] If true, the intermediate values used in remapping are forced to be bounded.
-
subroutine
mom_remapping/
buildgridfromh
(nz, h, x)¶ Calculate edge coordinate x from cell width h.
- Parameters
nz :: [in] Number of cells
h :: [in] Cell widths
x :: [inout] Edge coordiantes starting at x(1)=0
- Called from
-
function
mom_remapping/
ispossumerrsignificant
(n1, sum1, n2, sum2) [logical]¶ Compare two summation estimates of positive data and judge if due to more than round-off. When two sums are calculated from different vectors that should add up to the same value, the results can differ by round off. The round off error can be bounded to be proportional to the number of operations. This function returns true if the difference between sum1 and sum2 is larger than than the estimated round off bound.
- Parameters
n1 :: [in] Number of values in sum1
n2 :: [in] Number of values in sum2
sum1 :: [in] Sum of n1 values
sum2 :: [in] Sum of n2 values
- Return
undefined :: True if difference in sums is large
- Call to
-
subroutine
mom_remapping/
remapping_core_h
(CS, n0, h0, u0, n1, h1, u1, h_neglect, h_neglect_edge)¶ Remaps column of values u0 on grid h0 to grid h1 assuming the top edge is aligned.
- Parameters
cs :: [in] Remapping control structure
n0 :: [in] Number of cells on source grid
h0 :: [in] Cell widths on source grid
u0 :: [in] Cell averages on source grid
n1 :: [in] Number of cells on target grid
h1 :: [in] Cell widths on target grid
u1 :: [out] Cell averages on target grid
h_neglect :: [in] A negligibly small width for the purpose of cell reconstructions in the same units as h0.
h_neglect_edge :: [in] A negligibly small width for the purpose of edge value calculations in the same units as h0.
- Call to
build_reconstructions_1d
check_reconstructions_1d
measure_input_bounds
measure_output_bounds
mom_error_handler::mom_error
remap_via_sub_cells
- Called from
mom_ale_sponge::apply_ale_sponge
coord_rho::build_rho_column_iteratively
mom_tidal_mixing::calculate_cvmix_tidal
mom_state_initialization::cut_off_column_top
mom_diag_remap::diag_remap_do_remap
mom_oda_driver_mod::set_prior_tracer
mom_open_boundary::update_obc_segment_data
mom_wave_speed::wave_speed
-
subroutine
mom_remapping/
remapping_core_w
(CS, n0, h0, u0, n1, dx, u1, h_neglect, h_neglect_edge)¶ Remaps column of values u0 on grid h0 to implied grid h1 where the interfaces of h1 differ from those of h0 by dx.
- Parameters
cs :: [in] Remapping control structure
n0 :: [in] Number of cells on source grid
h0 :: [in] Cell widths on source grid
u0 :: [in] Cell averages on source grid
n1 :: [in] Number of cells on target grid
dx :: [in] Cell widths on target grid
u1 :: [out] Cell averages on target grid
h_neglect :: [in] A negligibly small width for the purpose of cell reconstructions in the same units as h0.
h_neglect_edge :: [in] A negligibly small width for the purpose of edge value calculations in the same units as h0.
- Call to
build_reconstructions_1d
check_reconstructions_1d
measure_input_bounds
measure_output_bounds
mom_error_handler::mom_error
remap_via_sub_cells
- Called from
-
subroutine
mom_remapping/
build_reconstructions_1d
(CS, n0, h0, u0, ppoly_r_coefs, ppoly_r_E, ppoly_r_S, iMethod, h_neglect, h_neglect_edge)¶ Creates polynomial reconstructions of u0 on the source grid h0.
- Parameters
cs :: [in] Remapping control structure
n0 :: [in] Number of cells on source grid
h0 :: [in] Cell widths on source grid
u0 :: [in] Cell averages on source grid
ppoly_r_coefs :: [out] Coefficients of polynomial
ppoly_r_e :: [out] Edge value of polynomial
ppoly_r_s :: [out] Edge slope of polynomial
imethod :: [out] Integration method
h_neglect :: [in] A negligibly small width for the purpose of cell reconstructions in the same units as h0.
h_neglect_edge :: [in] A negligibly small width for the purpose of edge value calculations in the same units as h0.
- Call to
regrid_edge_values::edge_slopes_implicit_h3
regrid_edge_values::edge_slopes_implicit_h5
integration_pcm
integration_plm
integration_ppm
integration_pqm
mom_error_handler::mom_error
pcm_functions::pcm_reconstruction
plm_functions::plm_boundary_extrapolation
plm_functions::plm_reconstruction
ppm_functions::ppm_boundary_extrapolation
ppm_functions::ppm_reconstruction
pqm_functions::pqm_boundary_extrapolation_v1
pqm_functions::pqm_reconstruction
remapping_pcm
remapping_plm
remapping_ppm_h4
remapping_ppm_ih4
remapping_pqm_ih4ih3
remapping_pqm_ih6ih5
- Called from
-
subroutine
mom_remapping/
check_reconstructions_1d
(n0, h0, u0, deg, boundary_extrapolation, ppoly_r_coefs, ppoly_r_E, ppoly_r_S)¶ Checks that edge values and reconstructions satisfy bounds.
- Parameters
n0 :: [in] Number of cells on source grid
h0 :: [in] Cell widths on source grid
u0 :: [in] Cell averages on source grid
deg :: [in] Degree of polynomial reconstruction
boundary_extrapolation :: [in] Extrapolate at boundaries if true
ppoly_r_coefs :: [out] Coefficients of polynomial
ppoly_r_e :: [out] Edge value of polynomial
ppoly_r_s :: [out] Edge slope of polynomial
- Call to
- Called from
-
subroutine
mom_remapping/
remap_via_sub_cells
(n0, h0, u0, ppoly0_E, ppoly0_coefs, n1, h1, method, force_bounds_in_subcell, u1, uh_err, ah_sub, aisub_src, aiss, aise)¶ Remaps column of n0 values u0 on grid h0 to grid h1 with n1 cells by calculating the n0+n1+1 sub-integrals of the intersection of h0 and h1, and the summing the appropriate integrals into the h1*u1 values. h0 and h1 must have the same units.
- Parameters
n0 :: [in] Number of cells in source grid
h0 :: [in] Source grid widths (size n0)
u0 :: [in] Source cell averages (size n0)
ppoly0_e :: [in] Edge value of polynomial
ppoly0_coefs :: [in] Coefficients of polynomial
n1 :: [in] Number of cells in target grid
h1 :: [in] Target grid widths (size n1)
method :: [in] Remapping scheme to use
force_bounds_in_subcell :: [in] Force sub-cell values to be bounded
u1 :: [out] Target cell averages (size n1)
uh_err :: [out] Estimate of bound on error in sum of u*h
ah_sub :: [out] h_sub
aisub_src :: [out] i_sub_src
aiss :: [out] isrc_start
aise :: [out] isrc_ens
- Call to
average_value_ppoly
measure_input_bounds
measure_output_bounds
mom_error_handler::mom_error
old_algorithm
- Called from
-
function
mom_remapping/
average_value_ppoly
(n0, u0, ppoly0_E, ppoly0_coefs, method, i0, xa, xb) [real]¶ Returns the average value of a reconstruction within a single source cell, i0, between the non-dimensional positions xa and xb (xa<=xb) with dimensional separation dh.
- Parameters
n0 :: [in] Number of cells in source grid
u0 :: [in] Cell means
ppoly0_e :: [in] Edge value of polynomial
ppoly0_coefs :: [in] Coefficients of polynomial
method :: [in] Remapping scheme to use
i0 :: [in] Source cell index
xa :: [in] Non-dimensional start position within source cell
xb :: [in] Non-dimensional end position within source cell
- Call to
integration_pcm
integration_plm
integration_ppm
integration_pqm
mom_error_handler::mom_error
- Called from
mom_lateral_boundary_diffusion::bulk_average
mom_lateral_boundary_diffusion::fluxes_layer_method
remap_via_sub_cells
-
subroutine
mom_remapping/
measure_input_bounds
(n0, h0, u0, edge_values, h0tot, h0err, u0tot, u0err, u0min, u0max)¶ Measure totals and bounds on source grid.
- Parameters
n0 :: [in] Number of cells on source grid
h0 :: [in] Cell widths on source grid
u0 :: [in] Cell averages on source grid
edge_values :: [in] Cell edge values on source grid
h0tot :: [out] Sum of cell widths
h0err :: [out] Magnitude of round-off error in h0tot
u0tot :: [out] Sum of cell widths times values
u0err :: [out] Magnitude of round-off error in u0tot
u0min :: [out] Minimum value in reconstructions of u0
u0max :: [out] Maximum value in reconstructions of u0
- Called from
-
subroutine
mom_remapping/
measure_output_bounds
(n1, h1, u1, h1tot, h1err, u1tot, u1err, u1min, u1max)¶ Measure totals and bounds on destination grid.
- Parameters
n1 :: [in] Number of cells on destination grid
h1 :: [in] Cell widths on destination grid
u1 :: [in] Cell averages on destination grid
h1tot :: [out] Sum of cell widths
h1err :: [out] Magnitude of round-off error in h1tot
u1tot :: [out] Sum of cell widths times values
u1err :: [out] Magnitude of round-off error in u1tot
u1min :: [out] Minimum value in reconstructions of u1
u1max :: [out] Maximum value in reconstructions of u1
- Called from
-
subroutine
mom_remapping/
remapbyprojection
(n0, h0, u0, ppoly0_E, ppoly0_coefs, n1, h1, method, u1, h_neglect)¶ Remaps column of values u0 on grid h0 to grid h1 by integrating over the projection of each h1 cell onto the h0 grid.
- Parameters
n0 :: [in] Number of cells in source grid
h0 :: [in] Source grid widths (size n0)
u0 :: [in] Source cell averages (size n0)
ppoly0_e :: [in] Edge value of polynomial
ppoly0_coefs :: [in] Coefficients of polynomial
n1 :: [in] Number of cells in target grid
h1 :: [in] Target grid widths (size n1)
method :: [in] Remapping scheme to use
u1 :: [out] Target cell averages (size n1)
h_neglect :: [in] A negligibly small width for the purpose of cell reconstructions in the same units as h.
- Call to
- Called from
-
subroutine
mom_remapping/
remapbydeltaz
(n0, h0, u0, ppoly0_E, ppoly0_coefs, n1, dx1, method, u1, h1, h_neglect)¶ Remaps column of values u0 on grid h0 to implied grid h1 where the interfaces of h1 differ from those of h0 by dx. The new grid is defined relative to the original grid by change dx1(:) = xNew(:) - xOld(:) and the remapping calculated so that hNew(k) qNew(k) = hOld(k) qOld(k) + F(k+1) - F(k) where F(k) = dx1(k) qAverage and where qAverage is the average qOld in the region zOld(k) to zNew(k).
- Parameters
n0 :: [in] Number of cells in source grid
h0 :: [in] Source grid sizes (size n0)
u0 :: [in] Source cell averages (size n0)
ppoly0_e :: [in] Edge value of polynomial
ppoly0_coefs :: [in] Coefficients of polynomial
n1 :: [in] Number of cells in target grid
dx1 :: [in] Target grid edge positions (size n1+1)
method :: [in] Remapping scheme to use
u1 :: [out] Target cell averages (size n1)
h1 :: [out] Target grid widths (size n1)
h_neglect :: [in] A negligibly small width for the purpose of cell reconstructions in the same units as h.
- Call to
- Called from
-
subroutine
mom_remapping/
integraterecononinterval
(n0, h0, u0, ppoly0_E, ppoly0_coefs, method, xL, xR, hC, uAve, jStart, xStart, h_neglect)¶ Integrate the reconstructed column profile over a single cell.
- Parameters
n0 :: [in] Number of cells in source grid
h0 :: [in] Source grid sizes (size n0)
u0 :: [in] Source cell averages
ppoly0_e :: [in] Edge value of polynomial
ppoly0_coefs :: [in] Coefficients of polynomial
method :: [in] Remapping scheme to use
xl :: [in] Left edges of target cell
xr :: [in] Right edges of target cell
hc :: [in] Cell width hC = xR - xL
uave :: [out] Average value on target cell
jstart :: [inout] The index of the cell to start searching from On exit, contains index of last cell used
xstart :: [inout] The left edge position of cell jStart On first entry should be 0.
h_neglect :: [in] A negligibly small width for the purpose of cell reconstructions in the same units as h.
- Call to
hneglect_dflt
integration_pcm
integration_plm
integration_ppm
integration_pqm
mom_error_handler::mom_error
- Called from
-
subroutine
mom_remapping/
dzfromh1h2
(n1, h1, n2, h2, dx)¶ Calculates the change in interface positions based on h1 and h2.
- Parameters
n1 :: [in] Number of cells on source grid
h1 :: [in] Cell widths of source grid (size n1)
n2 :: [in] Number of cells on target grid
h2 :: [in] Cell widths of target grid (size n2)
dx :: [out] Change in interface position (size n2+1)
- Called from
-
subroutine
mom_remapping/
initialize_remapping
(CS, remapping_scheme, boundary_extrapolation, check_reconstruction, check_remapping, force_bounds_in_subcell, answers_2018)¶ Constructor for remapping control structure.
- Parameters
cs :: [inout] Remapping control structure
remapping_scheme :: [in] Remapping scheme to use
boundary_extrapolation :: [in] Indicate to extrapolate in boundary cells
check_reconstruction :: [in] Indicate to check reconstructions
check_remapping :: [in] Indicate to check results of remapping
force_bounds_in_subcell :: [in] Force subcells values to be bounded
answers_2018 :: [in] If true use older, less acccurate expressions.
- Call to
- Called from
mom_oda_driver_mod::init_oda
mom_ale_sponge::initialize_ale_sponge_fixed
mom_ale_sponge::initialize_ale_sponge_varying
mom_open_boundary::open_boundary_config
mom_tidal_mixing::read_tidal_constituents
remapping_unit_tests
mom_wave_speed::wave_speed_init
-
subroutine
mom_remapping/
setreconstructiontype
(string, CS)¶ Changes the method of reconstruction Use this routine to parse a string parameter specifying the reconstruction and re-allocates work arrays appropriately. It is called from initialize_remapping but can be called from an external module too.
- Parameters
string :: [in] String to parse for method
cs :: [inout] Remapping control structure
- Call to
mom_error_handler::mom_error
remapping_pcm
remapping_plm
remapping_ppm_h4
remapping_ppm_ih4
remapping_pqm_ih4ih3
remapping_pqm_ih6ih5
mom_string_functions::uppercase
- Called from
-
subroutine
mom_remapping/
end_remapping
(CS)¶ Destrcutor for remapping control structure.
- Parameters
cs :: [inout] Remapping control structure
-
function
mom_remapping/
remapping_unit_tests
(verbose) [logical]¶ Runs unit tests on remapping functions. Should only be called from a single/root thread Returns True if a test fails, otherwise False.
- Parameters
verbose :: [in] If true, write results to stdout
- Call to
buildgridfromh
dumpgrid
dzfromh1h2
hneglect_dflt
initialize_remapping
integration_plm
integration_ppm
pcm_functions::pcm_reconstruction
plm_functions::plm_reconstruction
ppm_functions::ppm_boundary_extrapolation
ppm_functions::ppm_reconstruction
remap_via_sub_cells
remapbydeltaz
remapbyprojection
remapping_core_w
test_answer
- Called from
-
function
mom_remapping/
test_answer
(verbose, n, u, u_true, label, tol) [logical]¶ Returns true if any cell of u and u_true are not identical. Returns false otherwise.
- Parameters
verbose :: [in] If true, write results to stdout
n :: [in] Number of cells in u
u :: [in] Values to test
u_true :: [in] Values to test against (correct answer)
label :: [in] Message
tol :: [in] The tolerance for differences between u and u_true
- Called from
-
subroutine
mom_remapping/
dumpgrid
(n, h, x, u)¶ Convenience function for printing grid to screen.
- Parameters
n :: [in] Number of cells
h :: [in] Cell thickness
x :: [in] Interface delta
u :: [in] Cell average values
- Called from