MOM6
|
A column-wise toolbox for implementing neutral diffusion.
Data Types | |
type | ndiff_aux_cs_type |
The control structure for this module. More... | |
Functions/Subroutines | |
subroutine, public | set_ndiff_aux_params (CS, deg, max_iter, drho_tol, xtol, ref_pres, force_brent, EOS, debug) |
Initialize the parameters used to iteratively find the neutral direction. More... | |
subroutine, public | mark_unstable_cells (nk, dRdT, dRdS, T, S, stable_cell, ns) |
Given the reconsturcitons of dRdT, dRdS, T, S mark the cells which are stably stratified parts of the water column For an layer to be unstable the top interface must be denser than the bottom or the bottom interface of the layer. More... | |
subroutine, public | increment_interface (nk, kl, ki, stable, 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, public | calc_drho (T1, S1, dRdT1, dRdS1, T2, S2, dRdT2, dRdS2) |
Calculates difference in density at two points (rho1-rho2) with known density derivatives, T, and S. More... | |
subroutine, public | drho_at_pos (CS, T_ref, S_ref, alpha_ref, beta_ref, P_top, P_bot, ppoly_T, ppoly_S, x0, delta_rho, P_out, T_out, S_out, alpha_avg_out, beta_avg_out, delta_T_out, delta_S_out) |
Calculate the difference in neutral density between a reference T, S, alpha, and beta at a point on the polynomial reconstructions of T, S. More... | |
subroutine, public | search_other_column (dRhoTop, dRhoBot, Ptop, Pbot, lastP, lastK, kl, kl_0, ki, top_connected, bot_connected, out_P, out_K, search_layer) |
Searches the "other" (searched) column for the position of the neutral surface. More... | |
real function, public | 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... | |
real function, public | refine_nondim_position (CS, T_ref, S_ref, alpha_ref, beta_ref, P_top, P_bot, ppoly_T, ppoly_S, drho_top, drho_bot, min_bound) |
Use root-finding methods to find where dRho = 0, based on the equation of state and the polynomial reconstructions of temperature, salinity. Initial guess is based on the zero crossing of based on linear profiles of dRho, T, and S, between the top and bottom interface. If second derivatives of the EOS are available, it starts with a Newton's method. However, Newton's method is not guaranteed to be bracketed, a check is performed to see if it it diverges outside the interval. In that case (or in the case that second derivatives are not available), Brent's method is used following the implementation found at https://people.sc.fsu.edu/~jburkardt/f_src/brent/brent.f90. More... | |
subroutine, public | check_neutral_positions (CS, Ptop_l, Pbot_l, Ptop_r, Pbot_r, PoL, PoR, Tl_coeffs, Tr_coeffs, Sl_coeffs, Sr_coeffs) |
subroutine, public | kahan_sum (sum, summand, c) |
Do a compensated sum to account for roundoff level. More... | |
real function, public mom_neutral_diffusion_aux::calc_drho | ( | real, intent(in) | T1, |
real, intent(in) | S1, | ||
real, intent(in) | dRdT1, | ||
real, intent(in) | dRdS1, | ||
real, intent(in) | T2, | ||
real, intent(in) | S2, | ||
real, intent(in) | dRdT2, | ||
real, intent(in) | dRdS2 | ||
) |
Calculates difference in density at two points (rho1-rho2) with known density derivatives, T, and S.
[in] | t1 | Temperature at point 1 |
[in] | s1 | Salinity at point 1 |
[in] | drdt1 | dRhodT at point 1 |
[in] | drds1 | dRhodS at point 1 |
[in] | t2 | Temperature at point 2 |
[in] | s2 | Salinity at point 2 |
[in] | drdt2 | dRhodT at point 2 |
[in] | drds2 | dRhodS at point |
Definition at line 151 of file MOM_neutral_diffusion_aux.F90.
subroutine, public mom_neutral_diffusion_aux::check_neutral_positions | ( | type(ndiff_aux_cs_type), intent(in) | CS, |
real, intent(in) | Ptop_l, | ||
real, intent(in) | Pbot_l, | ||
real, intent(in) | Ptop_r, | ||
real, intent(in) | Pbot_r, | ||
real, intent(in) | PoL, | ||
real, intent(in) | PoR, | ||
real, dimension(cs%nterm), intent(in) | Tl_coeffs, | ||
real, dimension(cs%nterm), intent(in) | Tr_coeffs, | ||
real, dimension(cs%nterm), intent(in) | Sl_coeffs, | ||
real, dimension(cs%nterm), intent(in) | Sr_coeffs | ||
) |
[in] | cs | Control structure with parameters for this module |
[in] | ptop_l | Pressure at top interface of left cell |
[in] | pbot_l | Pressure at bottom interface of left cell |
[in] | ptop_r | Pressure at top interface of right cell |
[in] | pbot_r | Pressure at bottom interface of right cell |
[in] | pol | Nondim position in left cell |
[in] | por | Nondim position in right cell |
[in] | tl_coeffs | T polynomial coefficients of left cell |
[in] | tr_coeffs | T polynomial coefficients of right cell |
[in] | sl_coeffs | S polynomial coefficients of left cell |
[in] | sr_coeffs | S polynomial coefficients of right cell |
Definition at line 620 of file MOM_neutral_diffusion_aux.F90.
subroutine, public mom_neutral_diffusion_aux::drho_at_pos | ( | type(ndiff_aux_cs_type), intent(in) | CS, |
real, intent(in) | T_ref, | ||
real, intent(in) | S_ref, | ||
real, intent(in) | alpha_ref, | ||
real, intent(in) | beta_ref, | ||
real, intent(in) | P_top, | ||
real, intent(in) | P_bot, | ||
real, dimension(cs%nterm), intent(in) | ppoly_T, | ||
real, dimension(cs%nterm), intent(in) | ppoly_S, | ||
real, intent(in) | x0, | ||
real, intent(out) | delta_rho, | ||
real, intent(out), optional | P_out, | ||
real, intent(out), optional | T_out, | ||
real, intent(out), optional | S_out, | ||
real, intent(out), optional | alpha_avg_out, | ||
real, intent(out), optional | beta_avg_out, | ||
real, intent(out), optional | delta_T_out, | ||
real, intent(out), optional | delta_S_out | ||
) |
Calculate the difference in neutral density between a reference T, S, alpha, and beta at a point on the polynomial reconstructions of T, S.
[in] | cs | Control structure with parameters for this module |
[in] | t_ref | Temperature at reference surface |
[in] | s_ref | Salinity at reference surface |
[in] | alpha_ref | dRho/dT at reference surface |
[in] | beta_ref | dRho/dS at reference surface |
[in] | p_top | Pressure (Pa) at top interface of layer to be searched |
[in] | p_bot | Pressure (Pa) at bottom interface |
[in] | ppoly_t | Coefficients of T reconstruction |
[in] | ppoly_s | Coefficients of S reconstruciton |
[in] | x0 | Nondimensional position to evaluate |
[out] | delta_rho | The density difference from a reference value |
[out] | p_out | Pressure at point x0 |
[out] | t_out | Temperature at point x0 |
[out] | s_out | Salinity at point x0 |
[out] | alpha_avg_out | Average of alpha between reference and x0 |
[out] | beta_avg_out | Average of beta between reference and x0 |
[out] | delta_t_out | Difference in temperature between reference and x0 |
[out] | delta_s_out | Difference in salinity between reference and x0 |
Definition at line 167 of file MOM_neutral_diffusion_aux.F90.
subroutine, public mom_neutral_diffusion_aux::increment_interface | ( | integer, intent(in) | nk, |
integer, intent(inout) | kl, | ||
integer, intent(inout) | ki, | ||
logical, dimension(nk), intent(in) | stable, | ||
logical, intent(inout) | reached_bottom, | ||
logical, intent(inout) | searching_this_column, | ||
logical, intent(inout) | searching_other_column | ||
) |
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] | stable | True if the cell is stably stratified |
[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 116 of file MOM_neutral_diffusion_aux.F90.
real function, public mom_neutral_diffusion_aux::interpolate_for_nondim_position | ( | real, intent(in) | dRhoNeg, |
real, intent(in) | Pneg, | ||
real, intent(in) | dRhoPos, | ||
real, intent(in) | 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.
[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 304 of file MOM_neutral_diffusion_aux.F90.
subroutine, public mom_neutral_diffusion_aux::kahan_sum | ( | real, intent(inout) | sum, |
real, intent(in) | summand, | ||
real, intent(inout) | c | ||
) |
Do a compensated sum to account for roundoff level.
[in,out] | sum | Running sum |
[in] | summand | Term to be added |
[in,out] | c | Keep track of roundoff |
Definition at line 658 of file MOM_neutral_diffusion_aux.F90.
subroutine, public mom_neutral_diffusion_aux::mark_unstable_cells | ( | integer, intent(in) | nk, |
real, dimension(nk,2), intent(in) | dRdT, | ||
real, dimension(nk,2), intent(in) | dRdS, | ||
real, dimension(nk,2), intent(in) | T, | ||
real, dimension(nk,2), intent(in) | S, | ||
logical, dimension(nk), intent(out) | stable_cell, | ||
integer, intent(out) | ns | ||
) |
Given the reconsturcitons of dRdT, dRdS, T, S mark the cells which are stably stratified parts of the water column For an layer to be unstable the top interface must be denser than the bottom or the bottom interface of the layer.
[in] | nk | Number of levels in a column |
[in] | drdt | drho/dT [kg m-3 degC-1] at interfaces |
[in] | drds | drho/dS [kg m-3 ppt-1] at interfaces |
[in] | t | Temperature [degC] at interfaces |
[in] | s | Salinity [ppt] at interfaces |
[out] | stable_cell | True if this cell is unstably stratified |
[out] | ns | Number of neutral surfaces in unmasked part of the column |
Definition at line 64 of file MOM_neutral_diffusion_aux.F90.
real function, public mom_neutral_diffusion_aux::refine_nondim_position | ( | type(ndiff_aux_cs_type), intent(in) | CS, |
real, intent(in) | T_ref, | ||
real, intent(in) | S_ref, | ||
real, intent(in) | alpha_ref, | ||
real, intent(in) | beta_ref, | ||
real, intent(in) | P_top, | ||
real, intent(in) | P_bot, | ||
real, dimension(:), intent(in) | ppoly_T, | ||
real, dimension(:), intent(in) | ppoly_S, | ||
real, intent(in) | drho_top, | ||
real, intent(in) | drho_bot, | ||
real, intent(in) | min_bound | ||
) |
Use root-finding methods to find where dRho = 0, based on the equation of state and the polynomial reconstructions of temperature, salinity. Initial guess is based on the zero crossing of based on linear profiles of dRho, T, and S, between the top and bottom interface. If second derivatives of the EOS are available, it starts with a Newton's method. However, Newton's method is not guaranteed to be bracketed, a check is performed to see if it it diverges outside the interval. In that case (or in the case that second derivatives are not available), Brent's method is used following the implementation found at https://people.sc.fsu.edu/~jburkardt/f_src/brent/brent.f90.
[in] | cs | Control structure with parameters for this module |
[in] | t_ref | Temperature of the neutral surface at the searched from interface |
[in] | s_ref | Salinity of the neutral surface at the searched from interface |
[in] | alpha_ref | dRho/dT of the neutral surface at the searched from interface |
[in] | beta_ref | dRho/dS of the neutral surface at the searched from interface |
[in] | p_top | Pressure at the top interface in the layer to be searched |
[in] | p_bot | Pressure at the bottom interface in the layer to be searched |
[in] | ppoly_t | Coefficients of the order N polynomial reconstruction of T within the layer to be searched. |
[in] | ppoly_s | Coefficients of the order N polynomial reconstruction of T within the layer to be searched. |
[in] | drho_top | Delta rho at top interface (or previous position in cell |
[in] | drho_bot | Delta rho at bottom interface |
[in] | min_bound | Lower bound of position, also serves as the initial guess |
Definition at line 346 of file MOM_neutral_diffusion_aux.F90.
subroutine, public mom_neutral_diffusion_aux::search_other_column | ( | real, intent(in) | dRhoTop, |
real, intent(in) | dRhoBot, | ||
real, intent(in) | Ptop, | ||
real, intent(in) | Pbot, | ||
real, intent(in) | lastP, | ||
integer, intent(in) | lastK, | ||
integer, intent(in) | kl, | ||
integer, intent(in) | kl_0, | ||
integer, intent(in) | ki, | ||
logical, dimension(:), intent(inout) | top_connected, | ||
logical, dimension(:), intent(inout) | bot_connected, | ||
real, intent(out) | out_P, | ||
integer, intent(out) | out_K, | ||
logical, intent(out) | search_layer | ||
) |
Searches the "other" (searched) column for the position of the neutral surface.
[in] | drhotop | Density difference across top interface |
[in] | drhobot | Density difference across top interface |
[in] | ptop | Pressure at top interface |
[in] | pbot | Pressure at bottom interface |
[in] | lastp | Last position connected in the searched column |
[in] | lastk | Last layer connected in the searched column |
[in] | kl | Layer in the searched column |
[in] | kl_0 | Layer in the searched column |
[in] | ki | Interface of the searched column |
[in,out] | top_connected | True if the top interface was pointed to |
[in,out] | bot_connected | True if the top interface was pointed to |
[out] | out_p | Position within searched column |
[out] | out_k | Layer within searched column |
[out] | search_layer | Neutral surface within cell |
Definition at line 220 of file MOM_neutral_diffusion_aux.F90.
subroutine, public mom_neutral_diffusion_aux::set_ndiff_aux_params | ( | type(ndiff_aux_cs_type), intent(inout) | CS, |
integer, intent(in), optional | deg, | ||
integer, intent(in), optional | max_iter, | ||
real, intent(in), optional | drho_tol, | ||
real, intent(in), optional | xtol, | ||
real, intent(in), optional | ref_pres, | ||
logical, intent(in), optional | force_brent, | ||
type(eos_type), intent(in), optional, target | EOS, | ||
logical, intent(in), optional | debug | ||
) |
Initialize the parameters used to iteratively find the neutral direction.
[in,out] | cs | Control structure for refine_pos |
[in] | deg | Degree of polynommial used in reconstruction |
[in] | max_iter | Maximum number of iterations |
[in] | drho_tol | Tolerance for function convergence |
[in] | xtol | Tolerance for change in position |
[in] | ref_pres | Reference pressure to use |
[in] | force_brent | Force Brent method for linear, TEOS-10, and WRIGHT |
[in] | debug | If true, print output use to help debug neutral diffusion |
[in] | eos | Equation of state |
Definition at line 40 of file MOM_neutral_diffusion_aux.F90.