|
MFC
Exascale flow solver
|
Utility routines for bubble model setup, coordinate transforms, array sampling, and special functions. More...
Functions/Subroutines | |
| subroutine, public | s_comp_n_from_prim (vftmp, rtmp, ntmp, weights) |
| Computes the bubble number density n from the primitive variables. | |
| subroutine, public | s_comp_n_from_cons (vftmp, nrtmp, ntmp, weights) |
| Compute the bubble number density from the conservative void fraction and weighted bubble radii. | |
| impure subroutine, public | s_print_2d_array (a, div) |
| Print a 2D real array to standard output, optionally dividing each element by a given scalar. | |
| impure subroutine, public | s_initialize_bubbles_model () |
| Initialize bubble model arrays for Euler or Lagrangian bubbles with polytropic or non-polytropic gas. | |
| impure subroutine | s_initialize_bubble_vars () |
| Set bubble physical parameters and nondimensional numbers from the input configuration. | |
| impure subroutine, public | s_initialize_nonpoly () |
| Initializes non-polydisperse bubble modeling. | |
| elemental subroutine, public | s_transcoeff (omega, peclet, re_trans, im_trans) |
| Computes the transfer coefficient for the non-polytropic bubble compression process. | |
| elemental subroutine, public | s_int_to_str (i, res) |
| Convert an integer to its trimmed string representation. | |
| subroutine, public | s_simpson (local_weight, local_r0) |
| Compute the Simpson weights for quadrature. | |
| pure real(wp) function, dimension(3), public | f_cross (a, b) |
| Compute the cross product of two vectors. | |
| real(wp) function, dimension(3), public | f_unit_vector (theta, eta) |
| Generate a unit vector uniformly distributed on the sphere from two random parameters. | |
| logical function, public | f_finite_vec (v) |
| True when the first num_dims components of v are finite. | |
| subroutine, public | s_prng (var, seed) |
| Generate a pseudo-random number between 0 and 1 using a linear congruential generator. | |
| integer function, public | modmul (a) |
| Compute a modular multiplication step for the linear congruential pseudo-random number generator. | |
| subroutine, public | s_prng_splitmix32 (var, state) |
| Uniform draw in [0, 1) (1 only via single-precision rounding) from a 32-bit SplitMix-style generator (Weyl sequence hashed by the MurmurHash3 finalizer). Exact integer arithmetic, so the stream is compiler-independent; period 2^32, and different seeds give unrelated streams. | |
| pure integer(kind=seed_kind) function | f_mulmod32 (a, b) |
| a*b mod 2^32 for a, b in [0, 2^32), split into 16-bit halves of b so no intermediate exceeds 2^49 | |
| subroutine, public | s_cross_product (a, b, c) |
| Compute the cross product c = a x b of two 3D vectors. | |
| elemental subroutine, public | s_swap (lhs, rhs) |
| Swap two real numbers. | |
| pure subroutine, public | s_sort_int_key_value (keys, vals, n) |
| Sort the key-value pair by the key. | |
| real(wp) function, dimension(1:4, 1:4), public | f_create_transform_matrix (param, center) |
| Create a transformation matrix. | |
| subroutine, public | s_transform_vec (vec, matrix) |
| Transform a vector by a matrix. | |
| subroutine, public | s_transform_triangle (triangle, matrix, matrix_n) |
| Transform a triangle by a matrix, one vertex at a time. | |
| subroutine, public | s_transform_model (model, matrix, matrix_n) |
| Transform a model by a matrix, one triangle at a time. | |
| type(t_bbox) function, public | f_create_bbox (model) |
| Create a bounding box for a model. | |
| elemental logical function, public | f_xor (lhs, rhs) |
| Perform XOR on lhs and rhs. | |
| elemental integer function, public | f_logical_to_int (predicate) |
| Convert a logical to 1 or 0. | |
| real(wp) function, public | real_ylm (theta, phi, l, m) |
| Real spherical harmonic Y_lm(theta, phi). theta = polar angle from +z (acos(z/r)), phi = atan2(y,x). Uses associated Legendre P_l^|m|(cos theta). Standard normalisation. | |
| recursive real(wp) function, public | associated_legendre (x, l, m_order) |
| Associated Legendre polynomial P_l^m(x) (Ferrers function, Condon-Shortley phase). Valid for integer l >= 0, 0 <= m <= l, and x in [-1,1]. Returns 0 for |m| > l or l < 0. Formulas: DLMF 14.10.3 (recurrence in degree), Wikipedia "Associated Legendre
polynomials" (P_l^l and P_l^{l-1} identities). Recurrence: (l-m)P_l^m = (2l-1)x P_{l-1}^m - (l+m-1)P_{l-2}^m. | |
| elemental integer(kind=int64_kind) function, public | double_factorial (n_in) |
| Calculate the double factorial of an integer. | |
| elemental integer(kind=int64_kind) function, public | factorial (n_in) |
| Calculate the factorial of an integer. | |
| real(wp) function, public | f_cut_on (x, eps) |
| Calculate a smooth cut-on function that is zero for x values smaller than zero and goes to one, for generating smooth initial conditions. | |
| real(wp) function, public | f_cut_off (x, eps) |
| Calculate a smooth cut-off function that is one for x values smaller than zero and goes to zero, for generating smooth initial conditions. | |
| real(wp) function | f_gx (x) |
| Helper function for f_cut_on and f_cut_off. | |
| subroutine, public | s_downsample_data (q_cons_vf, q_cons_temp, m_ds, n_ds, p_ds, m_glb_ds, n_glb_ds, p_glb_ds) |
| Downsample conservative variable fields by a factor of 3 in each direction using volume averaging. | |
| subroutine, public | s_upsample_data (q_cons_vf, q_cons_temp) |
| Upsample conservative variable fields from a coarsened grid back to the original resolution using interpolation. | |
| logical function, public | f_local_rank_owns_location (location, glb_bounds_in) |
| True if location falls within this rank's own subdomain (a strict partition - each location is owned by exactly one rank, unlike an overlapping multi-rank ghost-stencil neighborhood). Used by both pre_process (to decide which generated/namelist IBs a rank writes to its own restart_data/ib_state_0.dat chunk) and simulation (to decide which IBs a rank owns for its own periodic IB-state writes) so the two stay consistent. glb_bounds_in is the global domain extent, used only to project a location that falls just outside the domain (floating-point edge case) onto the domain so some rank still claims it. | |
| subroutine, public | s_locate_cell (pos, cell, scoord) |
| Locate the cell holding pos by bisection on the cell boundaries, and its computational coordinates scoord (cell index plus the fraction of the cell width). Positions beyond the buffer region clamp to its edge cell. | |
| pure subroutine, public | s_pack_ib_state (ib_patch, time, buf, mass_bank) |
| One IB's restart_data/ib_state record; see ib_state_nfields for the layout. | |
Utility routines for bubble model setup, coordinate transforms, array sampling, and special functions.
| recursive real(wp) function, public m_helper::associated_legendre | ( | real(wp), intent(in) | x, |
| integer, intent(in) | l, | ||
| integer, intent(in) | m_order ) |
Associated Legendre polynomial P_l^m(x) (Ferrers function, Condon-Shortley phase). Valid for integer l >= 0, 0 <= m <= l, and x in [-1,1]. Returns 0 for |m| > l or l < 0. Formulas: DLMF 14.10.3 (recurrence in degree), Wikipedia "Associated Legendre polynomials" (P_l^l and P_l^{l-1} identities). Recurrence: (l-m)P_l^m = (2l-1)x P_{l-1}^m - (l+m-1)P_{l-2}^m.
| x | argument (typically cos(theta)), should be in [-1,1] |
| l | degree (>= 0) |
| m_order | order (0 <= m_order <= l) |
Definition at line 1291 of file m_helper.fpp.f90.
| elemental integer(kind=int64_kind) function, public m_helper::double_factorial | ( | integer, intent(in) | n_in | ) |
Calculate the double factorial of an integer.
Definition at line 1326 of file m_helper.fpp.f90.
Create a bounding box for a model.
Definition at line 1211 of file m_helper.fpp.f90.
| real(wp) function, dimension(1:4,1:4), public m_helper::f_create_transform_matrix | ( | type(ic_model_parameters), intent(in) | param, |
| real(wp), dimension(1:3), intent(in), optional | center ) |
Create a transformation matrix.
Definition at line 1133 of file m_helper.fpp.f90.
| pure real(wp) function, dimension(3), public m_helper::f_cross | ( | real(wp), dimension(3), intent(in) | a, |
| real(wp), dimension(3), intent(in) | b ) |
Compute the cross product of two vectors.
Definition at line 842 of file m_helper.fpp.f90.
Calculate a smooth cut-off function that is one for x values smaller than zero and goes to zero, for generating smooth initial conditions.
Definition at line 1362 of file m_helper.fpp.f90.
Calculate a smooth cut-on function that is zero for x values smaller than zero and goes to one, for generating smooth initial conditions.
Definition at line 1351 of file m_helper.fpp.f90.
| logical function, public m_helper::f_finite_vec | ( | real(wp), dimension(3), intent(in) | v | ) |
True when the first num_dims components of v are finite.
Definition at line 902 of file m_helper.fpp.f90.
Helper function for f_cut_on and f_cut_off.
Definition at line 1372 of file m_helper.fpp.f90.
| logical function, public m_helper::f_local_rank_owns_location | ( | real(wp), dimension(3), intent(in) | location, |
| type(bounds_info), dimension(3), intent(in) | glb_bounds_in ) |
True if location falls within this rank's own subdomain (a strict partition - each location is owned by exactly one rank, unlike an overlapping multi-rank ghost-stencil neighborhood). Used by both pre_process (to decide which generated/namelist IBs a rank writes to its own restart_data/ib_state_0.dat chunk) and simulation (to decide which IBs a rank owns for its own periodic IB-state writes) so the two stay consistent. glb_bounds_in is the global domain extent, used only to project a location that falls just outside the domain (floating-point edge case) onto the domain so some rank still claims it.
Definition at line 1473 of file m_helper.fpp.f90.
| elemental integer function, public m_helper::f_logical_to_int | ( | logical, intent(in) | predicate | ) |
Convert a logical to 1 or 0.
Definition at line 1246 of file m_helper.fpp.f90.
|
private |
a*b mod 2^32 for a, b in [0, 2^32), split into 16-bit halves of b so no intermediate exceeds 2^49
Definition at line 1043 of file m_helper.fpp.f90.
| real(wp) function, dimension(3), public m_helper::f_unit_vector | ( | real(wp), intent(in) | theta, |
| real(wp), intent(in) | eta ) |
Generate a unit vector uniformly distributed on the sphere from two random parameters.
Definition at line 871 of file m_helper.fpp.f90.
| elemental logical function, public m_helper::f_xor | ( | logical, intent(in) | lhs, |
| logical, intent(in) | rhs ) |
Perform XOR on lhs and rhs.
Definition at line 1236 of file m_helper.fpp.f90.
| elemental integer(kind=int64_kind) function, public m_helper::factorial | ( | integer, intent(in) | n_in | ) |
Calculate the factorial of an integer.
Definition at line 1338 of file m_helper.fpp.f90.
| integer function, public m_helper::modmul | ( | integer, intent(in) | a | ) |
Compute a modular multiplication step for the linear congruential pseudo-random number generator.
Definition at line 960 of file m_helper.fpp.f90.
| real(wp) function, public m_helper::real_ylm | ( | real(wp), intent(in) | theta, |
| real(wp), intent(in) | phi, | ||
| integer, intent(in) | l, | ||
| integer, intent(in) | m ) |
Real spherical harmonic Y_lm(theta, phi). theta = polar angle from +z (acos(z/r)), phi = atan2(y,x). Uses associated Legendre P_l^|m|(cos theta). Standard normalisation.
Definition at line 1261 of file m_helper.fpp.f90.
| subroutine, public m_helper::s_comp_n_from_cons | ( | real(wp), intent(in) | vftmp, |
| real(wp), dimension(nb), intent(in) | nrtmp, | ||
| real(wp), intent(out) | ntmp, | ||
| real(wp), dimension(nb), intent(in) | weights ) |
Compute the bubble number density from the conservative void fraction and weighted bubble radii.
Definition at line 431 of file m_helper.fpp.f90.
| subroutine, public m_helper::s_comp_n_from_prim | ( | real(wp), intent(in) | vftmp, |
| real(wp), dimension(nb), intent(in) | rtmp, | ||
| real(wp), intent(out) | ntmp, | ||
| real(wp), dimension(nb), intent(in) | weights ) |
Computes the bubble number density n from the primitive variables.
Definition at line 401 of file m_helper.fpp.f90.
| subroutine, public m_helper::s_cross_product | ( | real(wp), dimension(3), intent(in) | a, |
| real(wp), dimension(3), intent(in) | b, | ||
| real(wp), dimension(3), intent(out) | c ) |
Compute the cross product c = a x b of two 3D vectors.
Definition at line 1070 of file m_helper.fpp.f90.
| subroutine, public m_helper::s_downsample_data | ( | type(scalar_field), dimension(sys_size), intent(inout) | q_cons_vf, |
| type(scalar_field), dimension(sys_size), intent(inout) | q_cons_temp, | ||
| integer, intent(inout) | m_ds, | ||
| integer, intent(inout) | n_ds, | ||
| integer, intent(inout) | p_ds, | ||
| integer, intent(inout) | m_glb_ds, | ||
| integer, intent(inout) | n_glb_ds, | ||
| integer, intent(inout) | p_glb_ds ) |
Downsample conservative variable fields by a factor of 3 in each direction using volume averaging.
Definition at line 1386 of file m_helper.fpp.f90.
|
private |
Set bubble physical parameters and nondimensional numbers from the input configuration.
Definition at line 671 of file m_helper.fpp.f90.
| impure subroutine, public m_helper::s_initialize_bubbles_model |
Initialize bubble model arrays for Euler or Lagrangian bubbles with polytropic or non-polytropic gas.
Definition at line 491 of file m_helper.fpp.f90.
| impure subroutine, public m_helper::s_initialize_nonpoly |
Initializes non-polydisperse bubble modeling.
Definition at line 724 of file m_helper.fpp.f90.
| elemental subroutine, public m_helper::s_int_to_str | ( | integer, intent(in) | i, |
| character(len=*), intent(inout) | res ) |
Convert an integer to its trimmed string representation.
Definition at line 791 of file m_helper.fpp.f90.
| subroutine, public m_helper::s_locate_cell | ( | real(wp), dimension(3), intent(in) | pos, |
| integer, dimension(3), intent(out) | cell, | ||
| real(wp), dimension(3), intent(out) | scoord ) |
Locate the cell holding pos by bisection on the cell boundaries, and its computational coordinates scoord (cell index plus the fraction of the cell width). Positions beyond the buffer region clamp to its edge cell.
Definition at line 1575 of file m_helper.fpp.f90.
| pure subroutine, public m_helper::s_pack_ib_state | ( | type(ib_patch_parameters), intent(in) | ib_patch, |
| real(wp), intent(in) | time, | ||
| real(wp), dimension(ib_state_nfields), intent(out) | buf, | ||
| real(wp), intent(in), optional | mass_bank ) |
One IB's restart_data/ib_state record; see ib_state_nfields for the layout.
| [in] | mass_bank | ib_mass_relax bank; 0 when absent |
Definition at line 1689 of file m_helper.fpp.f90.
| impure subroutine, public m_helper::s_print_2d_array | ( | real(wp), dimension(:,:), intent(in) | a, |
| real(wp), intent(in), optional | div ) |
Print a 2D real array to standard output, optionally dividing each element by a given scalar.
Definition at line 461 of file m_helper.fpp.f90.
| subroutine, public m_helper::s_prng | ( | real(wp), intent(out) | var, |
| integer, intent(inout) | seed ) |
Generate a pseudo-random number between 0 and 1 using a linear congruential generator.
Definition at line 933 of file m_helper.fpp.f90.
| subroutine, public m_helper::s_prng_splitmix32 | ( | real(wp), intent(out) | var, |
| integer(kind=seed_kind), intent(inout) | state ) |
Uniform draw in [0, 1) (1 only via single-precision rounding) from a 32-bit SplitMix-style generator (Weyl sequence hashed by the MurmurHash3 finalizer). Exact integer arithmetic, so the stream is compiler-independent; period 2^32, and different seeds give unrelated streams.
| [in,out] | state | reduced mod 2^32 on each draw |
Definition at line 991 of file m_helper.fpp.f90.
| subroutine, public m_helper::s_simpson | ( | real(wp), dimension(:), intent(inout) | local_weight, |
| real(wp), dimension(:), intent(inout) | local_r0 ) |
Compute the Simpson weights for quadrature.
Definition at line 802 of file m_helper.fpp.f90.
| pure subroutine, public m_helper::s_sort_int_key_value | ( | integer, dimension(:), intent(inout) | keys, |
| integer, dimension(:), intent(inout) | vals, | ||
| integer, intent(in) | n ) |
Sort the key-value pair by the key.
Definition at line 1110 of file m_helper.fpp.f90.
| elemental subroutine, public m_helper::s_swap | ( | real(wp), intent(inout) | lhs, |
| real(wp), intent(inout) | rhs ) |
Swap two real numbers.
Definition at line 1098 of file m_helper.fpp.f90.
| elemental subroutine, public m_helper::s_transcoeff | ( | real(wp), intent(in) | omega, |
| real(wp), intent(in) | peclet, | ||
| real(wp), intent(out) | re_trans, | ||
| real(wp), intent(out) | im_trans ) |
Computes the transfer coefficient for the non-polytropic bubble compression process.
Definition at line 772 of file m_helper.fpp.f90.
| subroutine, public m_helper::s_transform_model | ( | type(t_model), intent(inout) | model, |
| real(wp), dimension(1:4,1:4), intent(in) | matrix, | ||
| real(wp), dimension(1:4,1:4), intent(in) | matrix_n ) |
Transform a model by a matrix, one triangle at a time.
Definition at line 1198 of file m_helper.fpp.f90.
| subroutine, public m_helper::s_transform_triangle | ( | type(t_triangle), intent(inout) | triangle, |
| real(wp), dimension(1:4,1:4), intent(in) | matrix, | ||
| real(wp), dimension(1:4,1:4), intent(in) | matrix_n ) |
Transform a triangle by a matrix, one vertex at a time.
Definition at line 1183 of file m_helper.fpp.f90.
| subroutine, public m_helper::s_transform_vec | ( | real(wp), dimension(1:3), intent(inout) | vec, |
| real(wp), dimension(1:4,1:4), intent(in) | matrix ) |
Transform a vector by a matrix.
Definition at line 1171 of file m_helper.fpp.f90.
| subroutine, public m_helper::s_upsample_data | ( | type(scalar_field), dimension(sys_size), intent(inout) | q_cons_vf, |
| type(scalar_field), dimension(sys_size), intent(inout) | q_cons_temp ) |
Upsample conservative variable fields from a coarsened grid back to the original resolution using interpolation.
Definition at line 1428 of file m_helper.fpp.f90.