MOM6
|
A column-wise toolbox for implementing neutral diffusion.
Data Types | |
type | neutral_diffusion_cs |
Functions/Subroutines | |
logical function, public | neutral_diffusion_init (Time, G, param_file, diag, CS) |
Read parameters and allocate control structure for neutral_diffusion module. More... | |
subroutine, public | neutral_diffusion_diag_init (Time, G, diag, C_p, Reg, CS) |
Diagnostic handles for neutral diffusion tendencies. More... | |
subroutine, public | neutral_diffusion_calc_coeffs (G, GV, h, T, S, EOS, 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, Tracer, m, dt, name, CS) |
Update tracer concentration due to neutral diffusion; layer thickness unchanged by this update. More... | |
subroutine | interface_scalar (nk, h, S, Si, i_method) |
Returns interface scalar, Si, for a column of layer values, S. More... | |
real function | ppm_edge (hkm1, hk, hkp1, hkp2, Ak, Akp1, Pk, Pkp1) |
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 (nk, Pl, Tl, Sl, dRdTl, dRdSl, Pr, Tr, Sr, dRdTr, dRdSr, PoL, PoR, KoL, KoR, hEff) |
Returns positions within left/right columns of combined interfaces. More... | |
real function | absolute_position (n, Pint, Karr, NParr, k_surface) |
Converts non-dimensional position within a layer to absolute position (for debugging) More... | |
real function, dimension(2 *n+2) | absolute_positions (n, Pint, Karr, NParr) |
Converts non-dimensional positions within layers to absolute positions (for debugging) 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 | neutral_surface_flux (nk, hl, hr, Tl, Tr, PiL, PiR, KoL, KoR, hEff, Flx) |
Returns a single column of neutral diffusion fluxes of a tracer. 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 | 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, nk, 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... | |
subroutine, public | neutral_diffusion_end (CS) |
Deallocates neutral_diffusion control structure. More... | |
Variables | |
character(len=40) | mdl = "MOM_neutral_diffusion" |
logical, parameter | debug_this_module = .false. |
|
private |
Converts non-dimensional position within a layer to absolute position (for debugging)
[in] | n | Number of levels |
[in] | pint | Position of interfaces (Pa) |
[in] | karr | Index of interface above position |
[in] | nparr | Non-dimensional position within layer Karr(:) |
Definition at line 892 of file MOM_neutral_diffusion.F90.
Referenced by absolute_positions(), and find_neutral_surface_positions().
|
private |
Converts non-dimensional positions within layers to absolute positions (for debugging)
[in] | n | Number of levels |
[in] | pint | Position of interface (Pa) |
[in] | karr | Indexes of interfaces about positions |
[in] | nparr | Non-dimensional positions within layers Karr(:) |
Definition at line 908 of file MOM_neutral_diffusion.F90.
References absolute_position().
Referenced by neutral_diffusion_unit_tests().
|
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 1495 of file MOM_neutral_diffusion.F90.
Referenced by test_nsp().
|
private |
Returns positions within left/right columns of combined interfaces.
[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/m3/degC) |
[in] | drdsl | Left-column dRho/dS (kg/m3/ppt) |
[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/m3/degC) |
[in] | drdsr | Left-column 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) |
Definition at line 716 of file MOM_neutral_diffusion.F90.
References absolute_position(), and interpolate_for_nondim_position().
Referenced by neutral_diffusion_calc_coeffs(), and neutral_diffusion_unit_tests().
|
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 660 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 686 of file MOM_neutral_diffusion.F90.
Referenced by plm_diff(), and test_fvlsq_slope().
|
private |
Returns interface scalar, Si, for a column of layer values, S.
[in] | nk | Number of levels |
[in] | h | Layer thickness (H units) |
[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 |
Definition at line 477 of file MOM_neutral_diffusion.F90.
References plm_diff(), and ppm_edge().
Referenced by neutral_diffusion_calc_coeffs(), neutral_diffusion_unit_tests(), 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 928 of file MOM_neutral_diffusion.F90.
Referenced by find_neutral_surface_positions(), and test_ifndp().
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, dimension( g %isd: g %ied, g %jsd: g %jed, g %ke), intent(inout) | Tracer, | ||
integer, intent(in) | m, | ||
real, intent(in) | dt, | ||
character(len=32), intent(in) | name, | ||
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 units) |
[in] | coef_x | dt * Kh * dy / dx at u-points (m^2) |
[in] | coef_y | dt * Kh * dx / dy at u-points (m^2) |
[in,out] | tracer | Tracer concentration |
[in] | m | Tracer number |
[in] | dt | Tracer time step * I_numitts (I_numitts in tracer_hordiff) |
[in] | name | Tracer name |
cs | Neutral diffusion control structure |
Definition at line 316 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, | ||
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(eos_type), pointer | EOS, | ||
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] | h | Layer thickness (H units) |
[in] | t | Potential temperature (degC) |
[in] | s | Salinity (ppt) |
eos | Equation of state structure | |
cs | Neutral diffusion control structure |
Definition at line 256 of file MOM_neutral_diffusion.F90.
References mom_eos::calculate_density_derivs(), find_neutral_surface_positions(), and interface_scalar().
Referenced by mom_tracer_hor_diff::tracer_hordiff().
subroutine, public mom_neutral_diffusion::neutral_diffusion_diag_init | ( | type(time_type), intent(in), target | Time, |
type(ocean_grid_type), intent(in) | G, | ||
type(diag_ctrl), intent(in) | diag, | ||
real, intent(in) | C_p, | ||
type(tracer_registry_type), intent(in) | Reg, | ||
type(neutral_diffusion_cs), pointer | CS | ||
) |
Diagnostic handles for neutral diffusion tendencies.
[in] | time | Time structure |
[in] | g | Grid structure |
[in] | diag | Diagnostics control structure |
[in] | reg | Tracer structure |
[in] | c_p | Seawater heat capacity |
cs | Neutral diffusion control structure |
Definition at line 119 of file MOM_neutral_diffusion.F90.
References mom_diag_mediator::register_diag_field().
Referenced by mom::initialize_mom().
subroutine, public mom_neutral_diffusion::neutral_diffusion_end | ( | type(neutral_diffusion_cs), pointer | CS | ) |
Deallocates neutral_diffusion control structure.
Definition at line 1513 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(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 |
cs | Neutral diffusion control structure |
Definition at line 65 of file MOM_neutral_diffusion.F90.
References mdl, and mom_error_handler::mom_error().
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 | It true, write results to stdout |
Definition at line 1049 of file MOM_neutral_diffusion.F90.
References absolute_positions(), find_neutral_surface_positions(), interface_scalar(), neutral_surface_flux(), test_data1d(), test_fv_diff(), test_fvlsq_slope(), test_ifndp(), and test_nsp().
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] | 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) |
Definition at line 958 of file MOM_neutral_diffusion.F90.
References interface_scalar(), ppm_ave(), and signum().
Referenced by neutral_diffusion(), and neutral_diffusion_unit_tests().
|
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 units) |
[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 593 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 554 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 |
Definition at line 514 of file MOM_neutral_diffusion.F90.
Referenced by interface_scalar().
|
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 582 of file MOM_neutral_diffusion.F90.
Referenced by neutral_surface_flux(), and plm_diff().
|
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 1376 of file MOM_neutral_diffusion.F90.
Referenced by neutral_diffusion_unit_tests().
|
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 1409 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 1282 of file MOM_neutral_diffusion.F90.
References fv_diff().
Referenced by neutral_diffusion_unit_tests().
|
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 1314 of file MOM_neutral_diffusion.F90.
References fvlsq_slope().
Referenced by neutral_diffusion_unit_tests().
|
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/m3) |
[in] | pneg | Interface position of lighter density (Pa) |
[in] | rhopos | Heavier density (kg/m3) |
[in] | ppos | Interface position of heavier density (Pa) |
[in] | ptrue | True answer (Pa) |
[in] | title | Title for messages |
Definition at line 1346 of file MOM_neutral_diffusion.F90.
References interpolate_for_nondim_position().
Referenced by neutral_diffusion_unit_tests().
|
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] | nk | Number of layers |
[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 1442 of file MOM_neutral_diffusion.F90.
References compare_nsp_row().
Referenced by neutral_diffusion_unit_tests().
|
private |
Definition at line 59 of file MOM_neutral_diffusion.F90.
character(len=40) mom_neutral_diffusion::mdl = "MOM_neutral_diffusion" |
Definition at line 57 of file MOM_neutral_diffusion.F90.
Referenced by neutral_diffusion_init().