MOM6
|
A column-wise toolbox for implementing neutral diffusion.
Data Types | |
type | neutral_diffusion_cs |
The control structure for the MOM_neutral_diffusion module. More... | |
Functions/Subroutines | |
logical function, public | neutral_diffusion_init (Time, G, param_file, diag, EOS, diabatic_CSp, CS) |
Read parameters and allocate control structure for neutral_diffusion module. More... | |
subroutine, public | neutral_diffusion_calc_coeffs (G, GV, US, h, T, S, CS) |
Calculate remapping factors for u/v columns used to map adjoining columns to a shared coordinate space. More... | |
subroutine, public | neutral_diffusion (G, GV, h, Coef_x, Coef_y, dt, Reg, US, CS) |
Update tracer concentration due to neutral diffusion; layer thickness unchanged by this update. More... | |
subroutine | interface_scalar (nk, h, S, Si, i_method, h_neglect) |
Returns interface scalar, Si, for a column of layer values, S. More... | |
real function | ppm_edge (hkm1, hk, hkp1, hkp2, Ak, Akp1, Pk, Pkp1, h_neglect) |
Returns the PPM quasi-fourth order edge value at k+1/2 following equation 1.6 in Colella & Woodward, 1984: JCP 54, 174-201. More... | |
real function | ppm_ave (xL, xR, aL, aR, aMean) |
Returns the average of a PPM reconstruction between two fractional positions. More... | |
real function | signum (a, x) |
A true signum function that returns either -abs(a), when x<0; or abs(a) when x>0; or 0 when x=0. More... | |
subroutine | plm_diff (nk, h, S, c_method, b_method, diff) |
Returns PLM slopes for a column where the slopes are the difference in value across each cell. The limiting follows equation 1.8 in Colella & Woodward, 1984: JCP 54, 174-201. More... | |
real function | fv_diff (hkm1, hk, hkp1, Skm1, Sk, Skp1) |
Returns the cell-centered second-order finite volume (unlimited PLM) slope using three consecutive cell widths and average values. Slope is returned as a difference across the central cell (i.e. units of scalar S). Discretization follows equation 1.7 in Colella & Woodward, 1984: JCP 54, 174-201. More... | |
real function | fvlsq_slope (hkm1, hk, hkp1, Skm1, Sk, Skp1) |
Returns the cell-centered second-order weighted least squares slope using three consecutive cell widths and average values. Slope is returned as a gradient (i.e. units of scalar S over width units). More... | |
subroutine | find_neutral_surface_positions_continuous (nk, Pl, Tl, Sl, dRdTl, dRdSl, Pr, Tr, Sr, dRdTr, dRdSr, PoL, PoR, KoL, KoR, hEff, bl_kl, bl_kr, bl_zl, bl_zr) |
Returns positions within left/right columns of combined interfaces using continuous reconstructions of T/S. More... | |
real function | interpolate_for_nondim_position (dRhoNeg, Pneg, dRhoPos, Ppos) |
Returns the non-dimensional position between Pneg and Ppos where the interpolated density difference equals zero. The result is always bounded to be between 0 and 1. More... | |
subroutine | find_neutral_surface_positions_discontinuous (CS, nk, Pres_l, hcol_l, Tl, Sl, ppoly_T_l, ppoly_S_l, stable_l, Pres_r, hcol_r, Tr, Sr, ppoly_T_r, ppoly_S_r, stable_r, PoL, PoR, KoL, KoR, hEff, zeta_bot_L, zeta_bot_R, k_bot_L, k_bot_R, hard_fail_heff) |
Higher order version of find_neutral_surface_positions. Returns positions within left/right columns of combined interfaces using intracell reconstructions of T/S. Note that the polynomial reconstrcutions of T and S are optional to aid with unit testing, but will always be passed otherwise. More... | |
subroutine | mark_unstable_cells (CS, nk, T, S, P, stable_cell) |
Sweep down through the column and mark as stable if the bottom interface of a cell is denser than the top. More... | |
real function | search_other_column (CS, ksurf, pos_last, T_from, S_from, P_from, T_top, S_top, P_top, T_bot, S_bot, P_bot, T_poly, S_poly) |
Searches the "other" (searched) column for the position of the neutral surface. More... | |
subroutine | increment_interface (nk, kl, ki, reached_bottom, searching_this_column, searching_other_column) |
Increments the interface which was just connected and also set flags if the bottom is reached. More... | |
real function | find_neutral_pos_linear (CS, z0, T_ref, S_ref, P_ref, dRdT_ref, dRdS_ref, P_top, dRdT_top, dRdS_top, P_bot, dRdT_bot, dRdS_bot, ppoly_T, ppoly_S) |
Search a layer to find where delta_rho = 0 based on a linear interpolation of alpha and beta of the top and bottom being searched and polynomial reconstructions of T and S. Compressibility is not needed because either, we are assuming incompressibility in the equation of state for this module or alpha and beta are calculated having been displaced to the average pressures of the two pressures We need Newton's method because the T and S reconstructions make delta_rho a polynomial function of z if using PPM or higher. If Newton's method would search fall out of the interval [0,1], a bisection step would be taken instead. Also this linearization of alpha, beta means that second derivatives of the EOS are not needed. Note that delta in variable names below refers to horizontal differences and 'd' refers to vertical differences. More... | |
real function | find_neutral_pos_full (CS, z0, T_ref, S_ref, P_ref, P_top, P_bot, ppoly_T, ppoly_S) |
Use the full equation of state to calculate the difference in locally referenced potential density. The derivatives in this case are not trivial to calculate, so instead we use a regula falsi method. More... | |
subroutine | calc_delta_rho_and_derivs (CS, T1, S1, p1_in, T2, S2, p2_in, drho, drdt1_out, drds1_out, drdt2_out, drds2_out) |
Calculate the difference in density between two points in a variety of ways. More... | |
real function | delta_rho_from_derivs (T1, S1, P1, dRdT1, dRdS1, T2, S2, P2, dRdT2, dRdS2) |
Calculate delta rho from derivatives and gradients of properties \( \Delta \rho$ = \frac{1}{2}\left[ (\alpha_1 + \alpha_2)*(T_1-T_2) + (\beta_1 + \beta_2)*(S_1-S_2) + (\gamma^{-1}_1 + \gamma%{-1}_2)*(P_1-P_2) \right] \). More... | |
real function | absolute_position (n, ns, Pint, Karr, NParr, k_surface) |
Converts non-dimensional position within a layer to absolute position (for debugging) More... | |
real function, dimension(ns) | absolute_positions (n, ns, Pint, Karr, NParr) |
Converts non-dimensional positions within layers to absolute positions (for debugging) More... | |
subroutine | neutral_surface_flux (nk, nsurf, deg, hl, hr, Tl, Tr, PiL, PiR, KoL, KoR, hEff, Flx, continuous, h_neglect, remap_CS, h_neglect_edge) |
Returns a single column of neutral diffusion fluxes of a tracer. More... | |
subroutine | neutral_surface_t_eval (nk, ns, k_sub, Ks, Ps, T_mean, T_int, deg, iMethod, T_poly, T_top, T_bot, T_sub, T_top_int, T_bot_int, T_layer) |
Evaluate various parts of the reconstructions to calculate gradient-based flux limter. More... | |
subroutine | ppm_left_right_edge_values (nk, Tl, Ti, aL, aR) |
Discontinuous PPM reconstructions of the left/right edge values within a cell. More... | |
logical function, public | neutral_diffusion_unit_tests (verbose) |
Returns true if unit tests of neutral_diffusion functions fail. Otherwise returns false. More... | |
logical function | ndiff_unit_tests_continuous (verbose) |
Returns true if unit tests of neutral_diffusion functions fail. Otherwise returns false. More... | |
logical function | ndiff_unit_tests_discontinuous (verbose) |
logical function | test_fv_diff (verbose, hkm1, hk, hkp1, Skm1, Sk, Skp1, Ptrue, title) |
Returns true if a test of fv_diff() fails, and conditionally writes results to stream. More... | |
logical function | test_fvlsq_slope (verbose, hkm1, hk, hkp1, Skm1, Sk, Skp1, Ptrue, title) |
Returns true if a test of fvlsq_slope() fails, and conditionally writes results to stream. More... | |
logical function | test_ifndp (verbose, rhoNeg, Pneg, rhoPos, Ppos, Ptrue, title) |
Returns true if a test of interpolate_for_nondim_position() fails, and conditionally writes results to stream. More... | |
logical function | test_data1d (verbose, nk, Po, Ptrue, title) |
Returns true if comparison of Po and Ptrue fails, and conditionally writes results to stream. More... | |
logical function | test_data1di (verbose, nk, Po, Ptrue, title) |
Returns true if comparison of Po and Ptrue fails, and conditionally writes results to stream. More... | |
logical function | test_nsp (verbose, ns, KoL, KoR, pL, pR, hEff, KoL0, KoR0, pL0, pR0, hEff0, title) |
Returns true if output of find_neutral_surface_positions() does not match correct values, and conditionally writes results to stream. More... | |
logical function | compare_nsp_row (KoL, KoR, pL, pR, KoL0, KoR0, pL0, pR0) |
Compares a single row, k, of output from find_neutral_surface_positions() More... | |
logical function | test_rnp (expected_pos, test_pos, title) |
Compares output position from refine_nondim_position with an expected value. More... | |
subroutine, public | neutral_diffusion_end (CS) |
Deallocates neutral_diffusion control structure. More... | |
Variables | |
character(len=40) | mdl = "MOM_neutral_diffusion" |
module name More... | |
|
private |
Converts non-dimensional position within a layer to absolute position (for debugging)
[in] | n | Number of levels |
[in] | ns | Number of neutral surfaces |
[in] | pint | Position of interfaces [Pa] |
[in] | karr | Index of interface above position |
[in] | nparr | Non-dimensional position within layer Karr(:) |
[in] | k_surface | k-interface to query |
Definition at line 1783 of file MOM_neutral_diffusion.F90.
Referenced by absolute_positions(), and find_neutral_surface_positions_continuous().
|
private |
Converts non-dimensional positions within layers to absolute positions (for debugging)
[in] | n | Number of levels |
[in] | ns | Number of neutral surfaces |
[in] | pint | Position of interface [Pa] |
[in] | karr | Indexes of interfaces about positions |
[in] | nparr | Non-dimensional positions within layers Karr(:) |
Definition at line 1800 of file MOM_neutral_diffusion.F90.
References absolute_position().
Referenced by ndiff_unit_tests_continuous().
|
private |
Calculate the difference in density between two points in a variety of ways.
cs | Neutral diffusion control structure | |
[in] | t1 | Temperature at point 1 |
[in] | s1 | Salinity at point 1 |
[in] | p1_in | Pressure at point 1 |
[in] | t2 | Temperature at point 2 |
[in] | s2 | Salinity at point 2 |
[in] | p2_in | Pressure at point 2 |
[out] | drho | Difference in density between the two points |
[out] | drdt1_out | drho_dt at point 1 |
[out] | drds1_out | drho_ds at point 1 |
[out] | drdt2_out | drho_dt at point 2 |
[out] | drds2_out | drho_ds at point 2 |
Definition at line 1706 of file MOM_neutral_diffusion.F90.
References delta_rho_from_derivs(), and mom_error_handler::mom_error().
Referenced by find_neutral_pos_full(), find_neutral_surface_positions_discontinuous(), mark_unstable_cells(), and search_other_column().
|
private |
Compares a single row, k, of output from find_neutral_surface_positions()
[in] | kol | Index of first left interface above neutral surface |
[in] | kor | Index of first right interface above neutral surface |
[in] | pl | Fractional position of neutral surface within layer KoL of left column |
[in] | pr | Fractional position of neutral surface within layer KoR of right column |
[in] | kol0 | Correct value for KoL |
[in] | kor0 | Correct value for KoR |
[in] | pl0 | Correct value for pL |
[in] | pr0 | Correct value for pR |
Definition at line 2775 of file MOM_neutral_diffusion.F90.
Referenced by test_nsp().
|
private |
Calculate delta rho from derivatives and gradients of properties \( \Delta \rho$ = \frac{1}{2}\left[ (\alpha_1 + \alpha_2)*(T_1-T_2) + (\beta_1 + \beta_2)*(S_1-S_2) + (\gamma^{-1}_1 + \gamma%{-1}_2)*(P_1-P_2) \right] \).
t1 | Temperature at point 1 |
s1 | Salinity at point 1 |
p1 | Pressure at point 1 |
drdt1 | Pressure at point 1 |
drds1 | Pressure at point 1 |
t2 | Temperature at point 2 |
s2 | Salinity at point 2 |
p2 | Pressure at point 2 |
drdt2 | Pressure at point 2 |
drds2 | Pressure at point 2 |
Definition at line 1765 of file MOM_neutral_diffusion.F90.
Referenced by calc_delta_rho_and_derivs(), and find_neutral_pos_linear().
|
private |
Use the full equation of state to calculate the difference in locally referenced potential density. The derivatives in this case are not trivial to calculate, so instead we use a regula falsi method.
[in] | cs | Control structure with parameters for this module |
[in] | z0 | Lower bound of position, also serves as the initial guess |
[in] | t_ref | Temperature at the searched from interface |
[in] | s_ref | Salinity at the searched from interface |
[in] | p_ref | Pressure at the searched from interface |
[in] | p_top | Pressure at top of layer being searched |
[in] | p_bot | Pressure at bottom of layer being searched |
[in] | ppoly_t | Coefficients of the polynomial reconstruction of T within the layer to be searched. |
[in] | ppoly_s | Coefficients of the polynomial reconstruction of T within the layer to be searched. |
Definition at line 1616 of file MOM_neutral_diffusion.F90.
References calc_delta_rho_and_derivs(), and polynomial_functions::evaluation_polynomial().
Referenced by search_other_column().
|
private |
Search a layer to find where delta_rho = 0 based on a linear interpolation of alpha and beta of the top and bottom being searched and polynomial reconstructions of T and S. Compressibility is not needed because either, we are assuming incompressibility in the equation of state for this module or alpha and beta are calculated having been displaced to the average pressures of the two pressures We need Newton's method because the T and S reconstructions make delta_rho a polynomial function of z if using PPM or higher. If Newton's method would search fall out of the interval [0,1], a bisection step would be taken instead. Also this linearization of alpha, beta means that second derivatives of the EOS are not needed. Note that delta in variable names below refers to horizontal differences and 'd' refers to vertical differences.
[in] | cs | Control structure with parameters for this module |
[in] | z0 | Lower bound of position, also serves as the initial guess |
[in] | t_ref | Temperature at the searched from interface |
[in] | s_ref | Salinity at the searched from interface |
[in] | p_ref | Pressure at the searched from interface |
[in] | drdt_ref | dRho/dT at the searched from interface |
[in] | drds_ref | dRho/dS at the searched from interface |
[in] | p_top | Pressure at top of layer being searched |
[in] | drdt_top | dRho/dT at top of layer being searched |
[in] | drds_top | dRho/dS at top of layer being searched |
[in] | p_bot | Pressure at bottom of layer being searched |
[in] | drdt_bot | dRho/dT at bottom of layer being searched |
[in] | drds_bot | dRho/dS at bottom of layer being searched |
[in] | ppoly_t | Coefficients of the polynomial reconstruction of T within the layer to be searched. |
[in] | ppoly_s | Coefficients of the polynomial reconstruction of T within the layer to be searched. |
Definition at line 1497 of file MOM_neutral_diffusion.F90.
References delta_rho_from_derivs(), polynomial_functions::evaluation_polynomial(), polynomial_functions::first_derivative_polynomial(), and mom_error_handler::mom_error().
Referenced by ndiff_unit_tests_discontinuous(), and search_other_column().
|
private |
Returns positions within left/right columns of combined interfaces using continuous reconstructions of T/S.
[in] | nk | Number of levels |
[in] | pl | Left-column interface pressure [Pa] |
[in] | tl | Left-column interface potential temperature [degC] |
[in] | sl | Left-column interface salinity [ppt] |
[in] | drdtl | Left-column dRho/dT [kg m-3 degC-1] |
[in] | drdsl | Left-column dRho/dS [kg m-3 ppt-1] |
[in] | pr | Right-column interface pressure [Pa] |
[in] | tr | Right-column interface potential temperature [degC] |
[in] | sr | Right-column interface salinity [ppt] |
[in] | drdtr | Left-column dRho/dT [kg m-3 degC-1] |
[in] | drdsr | Left-column dRho/dS [kg m-3 ppt-1] |
[in,out] | pol | Fractional position of neutral surface within layer KoL of left column |
[in,out] | por | Fractional position of neutral surface within layer KoR of right column |
[in,out] | kol | Index of first left interface above neutral surface |
[in,out] | kor | Index of first right interface above neutral surface |
[in,out] | heff | Effective thickness between two neutral surfaces [Pa] |
[in] | bl_kl | Layer index of the boundary layer (left) |
[in] | bl_kr | Layer index of the boundary layer (right) |
[in] | bl_zl | Nondimensional position of the boundary layer (left) |
[in] | bl_zr | Nondimensional position of the boundary layer (right) |
Definition at line 894 of file MOM_neutral_diffusion.F90.
References absolute_position(), and interpolate_for_nondim_position().
Referenced by ndiff_unit_tests_continuous(), and neutral_diffusion_calc_coeffs().
|
private |
Higher order version of find_neutral_surface_positions. Returns positions within left/right columns of combined interfaces using intracell reconstructions of T/S. Note that the polynomial reconstrcutions of T and S are optional to aid with unit testing, but will always be passed otherwise.
[in,out] | cs | Neutral diffusion control structure |
[in] | nk | Number of levels |
[in] | pres_l | Left-column interface pressure (Pa) |
[in] | hcol_l | Left-column layer thicknesses |
[in] | tl | Left-column top interface potential temperature (degC) |
[in] | sl | Left-column top interface salinity (ppt) |
[in] | ppoly_t_l | Left-column coefficients of T reconstruction |
[in] | ppoly_s_l | Left-column coefficients of S reconstruction |
[in] | stable_l | Left-column, top interface dRho/dS (kg/m3/ppt) |
[in] | pres_r | Right-column interface pressure (Pa) |
[in] | hcol_r | Left-column layer thicknesses |
[in] | tr | Right-column top interface potential temperature (degC) |
[in] | sr | Right-column top interface salinity (ppt) |
[in] | ppoly_t_r | Right-column coefficients of T reconstruction |
[in] | ppoly_s_r | Right-column coefficients of S reconstruction |
[in] | stable_r | Left-column, top interface dRho/dS (kg/m3/ppt) |
[in,out] | pol | Fractional position of neutral surface within layer KoL of left column |
[in,out] | por | Fractional position of neutral surface within layer KoR of right column |
[in,out] | kol | Index of first left interface above neutral surface |
[in,out] | kor | Index of first right interface above neutral surface |
[in,out] | heff | Effective thickness between two neutral surfaces (Pa) |
[in] | zeta_bot_l | Non-dimensional distance to where the boundary layer intersetcs the cell (left) [nondim] |
[in] | zeta_bot_r | Non-dimensional distance to where the boundary layer intersetcs the cell (right) [nondim] |
[in] | k_bot_l | k-index for the boundary layer (left) [nondim] |
[in] | k_bot_r | k-index for the boundary layer (right) [nondim] |
[in] | hard_fail_heff | If true (default) bring down the model if the neutral surfaces ever cross [logical] |
Definition at line 1141 of file MOM_neutral_diffusion.F90.
References calc_delta_rho_and_derivs(), increment_interface(), mom_error_handler::mom_error(), and search_other_column().
Referenced by ndiff_unit_tests_discontinuous(), and neutral_diffusion_calc_coeffs().
|
private |
Returns the cell-centered second-order finite volume (unlimited PLM) slope using three consecutive cell widths and average values. Slope is returned as a difference across the central cell (i.e. units of scalar S). Discretization follows equation 1.7 in Colella & Woodward, 1984: JCP 54, 174-201.
[in] | hkm1 | Left cell width |
[in] | hk | Center cell width |
[in] | hkp1 | Right cell width |
[in] | skm1 | Left cell average value |
[in] | sk | Center cell average value |
[in] | skp1 | Right cell average value |
Definition at line 837 of file MOM_neutral_diffusion.F90.
Referenced by plm_diff(), and test_fv_diff().
|
private |
Returns the cell-centered second-order weighted least squares slope using three consecutive cell widths and average values. Slope is returned as a gradient (i.e. units of scalar S over width units).
[in] | hkm1 | Left cell width |
[in] | hk | Center cell width |
[in] | hkp1 | Right cell width |
[in] | skm1 | Left cell average value |
[in] | sk | Center cell average value |
[in] | skp1 | Right cell average value |
Definition at line 863 of file MOM_neutral_diffusion.F90.
Referenced by plm_diff(), and test_fvlsq_slope().
|
private |
Increments the interface which was just connected and also set flags if the bottom is reached.
[in] | nk | Number of vertical levels |
[in,out] | kl | Current layer (potentially updated) |
[in,out] | ki | Current interface |
[in,out] | reached_bottom | Updated when kl == nk and ki == 2 |
[in,out] | searching_this_column | Updated when kl == nk and ki == 2 |
[in,out] | searching_other_column | Updated when kl == nk and ki == 2 |
Definition at line 1461 of file MOM_neutral_diffusion.F90.
References mom_error_handler::mom_error().
Referenced by find_neutral_surface_positions_discontinuous().
|
private |
Returns interface scalar, Si, for a column of layer values, S.
[in] | nk | Number of levels |
[in] | h | Layer thickness [H ~> m or kg m-2] |
[in] | s | Layer scalar (conc, e.g. ppt) |
[in,out] | si | Interface scalar (conc, e.g. ppt) |
[in] | i_method | =1 use average of PLM edges =2 use continuous PPM edge interpolation |
[in] | h_neglect | A negligibly small thickness [H ~> m or kg m-2] |
Definition at line 654 of file MOM_neutral_diffusion.F90.
References plm_diff(), and ppm_edge().
Referenced by ndiff_unit_tests_continuous(), neutral_diffusion_calc_coeffs(), and neutral_surface_flux().
|
private |
Returns the non-dimensional position between Pneg and Ppos where the interpolated density difference equals zero. The result is always bounded to be between 0 and 1.
[in] | drhoneg | Negative density difference |
[in] | pneg | Position of negative density difference |
[in] | drhopos | Positive density difference |
[in] | ppos | Position of positive density difference |
Definition at line 1101 of file MOM_neutral_diffusion.F90.
Referenced by find_neutral_surface_positions_continuous(), search_other_column(), and test_ifndp().
|
private |
Sweep down through the column and mark as stable if the bottom interface of a cell is denser than the top.
[in,out] | cs | Neutral diffusion control structure |
[in] | nk | Number of levels in a column |
[in] | t | Temperature at interfaces |
[in] | s | Salinity at interfaces |
[in] | p | Pressure at interfaces |
[out] | stable_cell | True if this cell is unstably stratified |
Definition at line 1373 of file MOM_neutral_diffusion.F90.
References calc_delta_rho_and_derivs().
Referenced by ndiff_unit_tests_discontinuous(), and neutral_diffusion_calc_coeffs().
|
private |
Returns true if unit tests of neutral_diffusion functions fail. Otherwise returns false.
[in] | verbose | If true, write results to stdout |
Definition at line 2034 of file MOM_neutral_diffusion.F90.
References absolute_positions(), find_neutral_surface_positions_continuous(), interface_scalar(), neutral_surface_flux(), test_data1d(), test_fv_diff(), test_fvlsq_slope(), test_ifndp(), and test_nsp().
Referenced by neutral_diffusion_unit_tests().
|
private |
[in] | verbose | It true, write results to stdout |
Definition at line 2301 of file MOM_neutral_diffusion.F90.
References mom_eos::eos_linear, find_neutral_pos_linear(), find_neutral_surface_positions_discontinuous(), mark_unstable_cells(), test_nsp(), and test_rnp().
Referenced by neutral_diffusion_unit_tests().
subroutine, public mom_neutral_diffusion::neutral_diffusion | ( | type(ocean_grid_type), intent(in) | G, |
type(verticalgrid_type), intent(in) | GV, | ||
real, dimension( g %isd: g %ied, g %jsd: g %jed, g %ke), intent(in) | h, | ||
real, dimension( g %isdb: g %iedb, g %jsd: g %jed), intent(in) | Coef_x, | ||
real, dimension( g %isd: g %ied, g %jsdb: g %jedb), intent(in) | Coef_y, | ||
real, intent(in) | dt, | ||
type(tracer_registry_type), pointer | Reg, | ||
type(unit_scale_type), intent(in) | US, | ||
type(neutral_diffusion_cs), pointer | CS | ||
) |
Update tracer concentration due to neutral diffusion; layer thickness unchanged by this update.
[in] | g | Ocean grid structure |
[in] | gv | ocean vertical grid structure |
[in] | h | Layer thickness [H ~> m or kg m-2] |
[in] | coef_x | dt * Kh * dy / dx at u-points [L2 ~> m2] |
[in] | coef_y | dt * Kh * dx / dy at v-points [L2 ~> m2] |
[in] | dt | Tracer time step * I_numitts [T ~> s] (I_numitts in tracer_hordiff) |
reg | Tracer registry | |
[in] | us | A dimensional unit scaling type |
cs | Neutral diffusion control structure |
Definition at line 493 of file MOM_neutral_diffusion.F90.
References neutral_surface_flux().
Referenced by mom_tracer_hor_diff::tracer_hordiff().
subroutine, public mom_neutral_diffusion::neutral_diffusion_calc_coeffs | ( | type(ocean_grid_type), intent(in) | G, |
type(verticalgrid_type), intent(in) | GV, | ||
type(unit_scale_type), intent(in) | US, | ||
real, dimension( g %isd: g %ied, g %jsd: g %jed, g %ke), intent(in) | h, | ||
real, dimension( g %isd: g %ied, g %jsd: g %jed, g %ke), intent(in) | T, | ||
real, dimension( g %isd: g %ied, g %jsd: g %jed, g %ke), intent(in) | S, | ||
type(neutral_diffusion_cs), pointer | CS | ||
) |
Calculate remapping factors for u/v columns used to map adjoining columns to a shared coordinate space.
[in] | g | Ocean grid structure |
[in] | gv | ocean vertical grid structure |
[in] | us | A dimensional unit scaling type |
[in] | h | Layer thickness [H ~> m or kg m-2] |
[in] | t | Potential temperature [degC] |
[in] | s | Salinity [ppt] |
cs | Neutral diffusion control structure |
Definition at line 264 of file MOM_neutral_diffusion.F90.
References mom_lateral_boundary_diffusion::boundary_k_range(), mom_energetic_pbl::energetic_pbl_get_mld(), polynomial_functions::evaluation_polynomial(), find_neutral_surface_positions_continuous(), find_neutral_surface_positions_discontinuous(), interface_scalar(), mom_cvmix_kpp::kpp_get_bld(), mark_unstable_cells(), and mom_lateral_boundary_diffusion::surface.
Referenced by mom_tracer_hor_diff::tracer_hordiff().
subroutine, public mom_neutral_diffusion::neutral_diffusion_end | ( | type(neutral_diffusion_cs), pointer | CS | ) |
Deallocates neutral_diffusion control structure.
cs | Neutral diffusion control structure |
Definition at line 2807 of file MOM_neutral_diffusion.F90.
logical function, public mom_neutral_diffusion::neutral_diffusion_init | ( | type(time_type), intent(in), target | Time, |
type(ocean_grid_type), intent(in) | G, | ||
type(param_file_type), intent(in) | param_file, | ||
type(diag_ctrl), intent(inout), target | diag, | ||
type(eos_type), intent(in), target | EOS, | ||
type(diabatic_cs), pointer | diabatic_CSp, | ||
type(neutral_diffusion_cs), pointer | CS | ||
) |
Read parameters and allocate control structure for neutral_diffusion module.
[in] | time | Time structure |
[in] | g | Grid structure |
[in,out] | diag | Diagnostics control structure |
[in] | param_file | Parameter file structure |
[in] | eos | Equation of state |
diabatic_csp | KPP control structure needed to get BLD | |
cs | Neutral diffusion control structure |
Definition at line 109 of file MOM_neutral_diffusion.F90.
References mom_diabatic_driver::extract_diabatic_member(), mdl, mom_error_handler::mom_error(), mom_remapping::remappingdefaultscheme, and mom_remapping::remappingschemesdoc.
logical function, public mom_neutral_diffusion::neutral_diffusion_unit_tests | ( | logical, intent(in) | verbose | ) |
Returns true if unit tests of neutral_diffusion functions fail. Otherwise returns false.
[in] | verbose | If true, write results to stdout |
Definition at line 2024 of file MOM_neutral_diffusion.F90.
References ndiff_unit_tests_continuous(), and ndiff_unit_tests_discontinuous().
Referenced by mom_unit_tests::unit_tests().
|
private |
Returns a single column of neutral diffusion fluxes of a tracer.
[in] | nk | Number of levels |
[in] | nsurf | Number of neutral surfaces |
[in] | deg | Degree of polynomial reconstructions |
[in] | hl | Left-column layer thickness [Pa] |
[in] | hr | Right-column layer thickness [Pa] |
[in] | tl | Left-column layer tracer (conc, e.g. degC) |
[in] | tr | Right-column layer tracer (conc, e.g. degC) |
[in] | pil | Fractional position of neutral surface within layer KoL of left column |
[in] | pir | Fractional position of neutral surface within layer KoR of right column |
[in] | kol | Index of first left interface above neutral surface |
[in] | kor | Index of first right interface above neutral surface |
[in] | heff | Effective thickness between two neutral surfaces [Pa] |
[in,out] | flx | Flux of tracer between pairs of neutral layers (conc H) |
[in] | continuous | True if using continuous reconstruction |
[in] | h_neglect | A negligibly small width for the purpose of cell reconstructions in the same units as h0. |
[in] | remap_cs | Remapping control structure used to create sublayers |
[in] | h_neglect_edge | A negligibly small width for the purpose of edge value calculations in the same units as h0. |
Definition at line 1820 of file MOM_neutral_diffusion.F90.
References interface_scalar(), neutral_surface_t_eval(), ppm_ave(), ppm_left_right_edge_values(), and signum().
Referenced by ndiff_unit_tests_continuous(), and neutral_diffusion().
|
private |
Evaluate various parts of the reconstructions to calculate gradient-based flux limter.
[in] | nk | Number of cell everages |
[in] | ns | Number of neutral surfaces |
[in] | k_sub | Index of current neutral layer |
[in] | ks | List of the layers associated with each neutral surface |
[in] | ps | List of the positions within a layer of each surface |
[in] | t_mean | Cell average of tracer |
[in] | t_int | Cell interface values of tracer from reconstruction |
[in] | deg | Degree of reconstruction polynomial (e.g. 1 is linear) |
[in] | imethod | Method of integration to use |
[in] | t_poly | Coefficients of polynomial reconstructions |
[out] | t_top | Tracer value at top (across discontinuity if necessary) |
[out] | t_bot | Tracer value at bottom (across discontinuity if necessary) |
[out] | t_sub | Average of the tracer value over the sublayer |
[out] | t_top_int | Tracer value at top interface of neutral layer |
[out] | t_bot_int | Tracer value at bottom interface of neutral layer |
[out] | t_layer | Cell-average that the the reconstruction belongs to |
Definition at line 1948 of file MOM_neutral_diffusion.F90.
References mom_remapping::average_value_ppoly(), polynomial_functions::evaluation_polynomial(), and mom_error_handler::mom_error().
Referenced by neutral_surface_flux().
|
private |
Returns PLM slopes for a column where the slopes are the difference in value across each cell. The limiting follows equation 1.8 in Colella & Woodward, 1984: JCP 54, 174-201.
[in] | nk | Number of levels |
[in] | h | Layer thickness [H ~> m or kg m-2] |
[in] | s | Layer salinity (conc, e.g. ppt) |
[in] | c_method | Method to use for the centered difference |
[in] | b_method | =1, use PCM in first/last cell, =2 uses linear extrapolation |
[in,out] | diff | Scalar difference across layer (conc, e.g. ppt) determined by the following values for c_method:
|
Definition at line 770 of file MOM_neutral_diffusion.F90.
References fv_diff(), fvlsq_slope(), and signum().
Referenced by interface_scalar().
|
private |
Returns the average of a PPM reconstruction between two fractional positions.
[in] | xl | Fraction position of left bound (0,1) |
[in] | xr | Fraction position of right bound (0,1) |
[in] | al | Left edge scalar value, at x=0 |
[in] | ar | Right edge scalar value, at x=1 |
[in] | amean | Average scalar value of cell |
Definition at line 732 of file MOM_neutral_diffusion.F90.
Referenced by neutral_surface_flux().
|
private |
Returns the PPM quasi-fourth order edge value at k+1/2 following equation 1.6 in Colella & Woodward, 1984: JCP 54, 174-201.
[in] | hkm1 | Width of cell k-1 |
[in] | hk | Width of cell k |
[in] | hkp1 | Width of cell k+1 |
[in] | hkp2 | Width of cell k+2 |
[in] | ak | Average scalar value of cell k |
[in] | akp1 | Average scalar value of cell k+1 |
[in] | pk | PLM slope for cell k |
[in] | pkp1 | PLM slope for cell k+1 |
[in] | h_neglect | A negligibly small thickness [H ~> m or kg m-2] |
Definition at line 692 of file MOM_neutral_diffusion.F90.
Referenced by interface_scalar().
|
private |
Discontinuous PPM reconstructions of the left/right edge values within a cell.
[in] | nk | Number of levels |
[in] | tl | Layer tracer (conc, e.g. degC) |
[in] | ti | Interface tracer (conc, e.g. degC) |
[in,out] | al | Left edge value of tracer (conc, e.g. degC) |
[in,out] | ar | Right edge value of tracer (conc, e.g. degC) |
Definition at line 2000 of file MOM_neutral_diffusion.F90.
References signum().
Referenced by neutral_surface_flux().
|
private |
Searches the "other" (searched) column for the position of the neutral surface.
[in] | cs | Neutral diffusion control structure |
[in] | ksurf | Current index of neutral surface |
[in] | pos_last | Last position within the current layer, used as the lower bound in the rootfinding algorithm |
[in] | t_from | Temperature at the searched from interface |
[in] | s_from | Salinity at the searched from interface |
[in] | p_from | Pressure at the searched from interface |
[in] | t_top | Temperature at the searched to top interface |
[in] | s_top | Salinity at the searched to top interface |
[in] | p_top | Pressure at the searched to top interface |
[in] | t_bot | Temperature at the searched to bottom interface |
[in] | s_bot | Salinity at the searched to bottom interface |
[in] | p_bot | Pressure at the searched to bottom interface |
[in] | t_poly | Temperature polynomial reconstruction coefficients |
[in] | s_poly | Salinity polynomial reconstruction coefficients |
Definition at line 1393 of file MOM_neutral_diffusion.F90.
References calc_delta_rho_and_derivs(), find_neutral_pos_full(), find_neutral_pos_linear(), and interpolate_for_nondim_position().
Referenced by find_neutral_surface_positions_discontinuous().
|
private |
A true signum function that returns either -abs(a), when x<0; or abs(a) when x>0; or 0 when x=0.
[in] | a | The magnitude argument |
[in] | x | The sign (or zero) argument |
Definition at line 759 of file MOM_neutral_diffusion.F90.
Referenced by neutral_surface_flux(), plm_diff(), and ppm_left_right_edge_values().
|
private |
Returns true if comparison of Po and Ptrue fails, and conditionally writes results to stream.
[in] | verbose | If true, write results to stdout |
[in] | nk | Number of layers |
[in] | po | Calculated answer |
[in] | ptrue | True answer |
[in] | title | Title for messages |
Definition at line 2652 of file MOM_neutral_diffusion.F90.
Referenced by ndiff_unit_tests_continuous().
|
private |
Returns true if comparison of Po and Ptrue fails, and conditionally writes results to stream.
[in] | verbose | If true, write results to stdout |
[in] | nk | Number of layers |
[in] | po | Calculated answer |
[in] | ptrue | True answer |
[in] | title | Title for messages |
Definition at line 2687 of file MOM_neutral_diffusion.F90.
|
private |
Returns true if a test of fv_diff() fails, and conditionally writes results to stream.
[in] | verbose | If true, write results to stdout |
[in] | hkm1 | Left cell width |
[in] | hk | Center cell width |
[in] | hkp1 | Right cell width |
[in] | skm1 | Left cell average value |
[in] | sk | Center cell average value |
[in] | skp1 | Right cell average value |
[in] | ptrue | True answer [Pa] |
[in] | title | Title for messages |
Definition at line 2556 of file MOM_neutral_diffusion.F90.
References fv_diff().
Referenced by ndiff_unit_tests_continuous().
|
private |
Returns true if a test of fvlsq_slope() fails, and conditionally writes results to stream.
[in] | verbose | If true, write results to stdout |
[in] | hkm1 | Left cell width |
[in] | hk | Center cell width |
[in] | hkp1 | Right cell width |
[in] | skm1 | Left cell average value |
[in] | sk | Center cell average value |
[in] | skp1 | Right cell average value |
[in] | ptrue | True answer [Pa] |
[in] | title | Title for messages |
Definition at line 2588 of file MOM_neutral_diffusion.F90.
References fvlsq_slope().
Referenced by ndiff_unit_tests_continuous().
|
private |
Returns true if a test of interpolate_for_nondim_position() fails, and conditionally writes results to stream.
[in] | verbose | If true, write results to stdout |
[in] | rhoneg | Lighter density [kg m-3] |
[in] | pneg | Interface position of lighter density [Pa] |
[in] | rhopos | Heavier density [kg m-3] |
[in] | ppos | Interface position of heavier density [Pa] |
[in] | ptrue | True answer [Pa] |
[in] | title | Title for messages |
Definition at line 2620 of file MOM_neutral_diffusion.F90.
References interpolate_for_nondim_position().
Referenced by ndiff_unit_tests_continuous().
|
private |
Returns true if output of find_neutral_surface_positions() does not match correct values, and conditionally writes results to stream.
[in] | verbose | If true, write results to stdout |
[in] | ns | Number of surfaces |
[in] | kol | Index of first left interface above neutral surface |
[in] | kor | Index of first right interface above neutral surface |
[in] | pl | Fractional position of neutral surface within layer KoL of left column |
[in] | pr | Fractional position of neutral surface within layer KoR of right column |
[in] | heff | Effective thickness between two neutral surfaces [Pa] |
[in] | kol0 | Correct value for KoL |
[in] | kor0 | Correct value for KoR |
[in] | pl0 | Correct value for pL |
[in] | pr0 | Correct value for pR |
[in] | heff0 | Correct value for hEff |
[in] | title | Title for messages |
Definition at line 2721 of file MOM_neutral_diffusion.F90.
References compare_nsp_row(), and mom_error_handler::mom_error().
Referenced by ndiff_unit_tests_continuous(), and ndiff_unit_tests_discontinuous().
|
private |
Compares output position from refine_nondim_position with an expected value.
[in] | expected_pos | The expected position |
[in] | test_pos | The position returned by the code |
[in] | title | A label for this test |
Definition at line 2793 of file MOM_neutral_diffusion.F90.
Referenced by ndiff_unit_tests_discontinuous().
character(len=40) mom_neutral_diffusion::mdl = "MOM_neutral_diffusion" |
module name
Definition at line 103 of file MOM_neutral_diffusion.F90.
Referenced by neutral_diffusion_init().