|
MFC
Exascale flow solver
|
Contains module m_ibm_fine. More...
Go to the source code of this file.
Data Types | |
| type | m_ibm_fine::ib_fine_state |
| Per-block fine IB state: each AMR slot keeps a host-side copy of its markers, computed at fine resolution and copied into m_ibm's declare-target ib_markers for the fine advance (that array is never reallocated or pointer-swapped, since that corrupts the Cray present table; the swap syncs via GPU_UPDATE). Ghost-point lists park on-device in gp_park; num_gps is the slot's ghost-point count across a swap, off its gp_park offset and cap the entries reserved there (0 = none). More... | |
| type | m_ibm::wall_fill |
| Quadratic wall-normal fill of one ghost point (ib_wall_order = 2): TSC stencils of two probes along the surface normal and the Lagrange weights that carry the profile through them back to the ghost (see s_wall_fill). More... | |
Modules | |
| module | m_ibm_fine |
| Per-block fine-grid immersed-boundary state for AMR. A separate module from m_ibm: declaring these derived-type allocatables inside m_ibm corrupts CCE's OpenMP declare-target descriptor table for m_ibm's ghost_points (lib-4425 on its @:ALLOCATE, even for non-AMR runs). Do not fold them back into m_ibm. | |
| module | m_ibm |
| Ghost-node immersed boundary method: locates ghost/image points, computes interpolation coefficients, and corrects the flow state. | |
Functions/Subroutines | |
| impure subroutine, public | m_ibm::s_initialize_ibm_module () |
| Allocates memory for the variables in the IBM module. | |
| impure subroutine, public | m_ibm::s_ibm_setup () |
| Initializes the values of various IBM variables, such as ghost points and image points. | |
| real(wp) function, dimension(3) | m_ibm::f_wall_velocity (gp_patch_id, r) |
| Velocity of the body's material point at r from its centroid: translation plus rotation about the centroid. Zero for a fixed body. | |
| real(wp) function | m_ibm::f_curvature_u2 (gp_patch_id, n, u_t) |
| sum_i kappa_i u_i^2 over the principal directions of the wall, for a velocity u_t tangent to it: the centripetal acceleration of fluid sliding along a curved wall with outward normal n. Known for a circle and a sphere (1/R in every direction) and the curved side of a cylinder (none along its axis, the first column of its rotation matrix); zero for any other shape, which keeps the zero-curvature condition there. | |
| subroutine, private | m_ibm::s_compute_ghost_point_pressure (gp, gp_patch_id, radial_vector, vel_ip, rho, pres_ip, pres_gp) |
| Ghost pressure from the wall-normal momentum balance, dp/dn = -rho (a_w . n) + rho sum_i kappa_i u_i^2 with n out of the body. a_w is the acceleration of the wall point: the body's translation (force/mass for a two-way coupled body, else the stage-differenced one), alpha x r_w from its angular acceleration, and the centripetal acceleration omega x (omega x r_w) of its rotation about its centroid. A fluid held at an accelerating wall's velocity needs this pressure gradient to stay with it; mirroring the image-point pressure instead leaves the wall layer unbalanced. The second term is the centripetal acceleration of fluid sliding along a curved slip wall, from the image point's velocity relative to the wall; a no-slip wall holds its fluid at the wall velocity, so it has none. Clamped both ways: the linearization holds only while the correction is order one, and an unbounded one drives the ghost state to vacuum. | |
| subroutine, private | m_ibm::s_compute_ghost_point_velocity (gp, gp_patch_id, radial_vector, vel_ip, pres_ip, dh, vel_gp, q_prim_vf, wf) |
| subroutine, public | m_ibm::s_ibm_correct_state (q_cons_vf, q_prim_vf, pb_in, mv_in, lvl) |
| Update the conservative variables at the ghost points. | |
| impure subroutine | m_ibm::s_wall_column_setup () |
| Wall columns (patch_ibwall_column): give each first-layer ghost of such a body its gas faces' weights, area times (l(s_f) - l(s_g))/h with l the steady radial conduction coordinate (f_wc_ell) and s the signed wall distance of the face's gas cell and of the ghost. Over a circle these sum to its length to 1e-5 at 5-160 cells/R, where the face normals err by 0.3-5 %. The ghost list of fixed bodies is built once, so the columns stay with their ghosts (and ranks). | |
| impure subroutine, public | m_ibm::s_ibm_advance_wall_columns (q_cons_vf, q_prim_vf, q_t_sf, dt_step) |
| Advance every wall column over dt from the state of the step's first RHS, and set the columns' guard targets. T and p at the top s_m come through the Lagrange probe (s_lag3_weights); where its stencil has less than half its weight in the gas (a narrow gap) the ghost keeps the mirror this step. lambda and c_p are tabulated per column, at the ghost's (image-point) composition, between the extremes of the column. On the first step of a run, restart included, the columns start from the gas field sampled along their normals. | |
| impure subroutine, public | m_ibm::s_wall_column_tcond (q_cons_vf, q_prim_vf, q_t_sf) |
| Conduction temperature of each active column ghost that makes its gas faces carry the column's wall flux, less a one-sided guard: sum_f G_f (T_f - T_cond) = sum_f (q w_f - cut_f), G_f = lambda_f area/h with the face conductivity the diffusion flux forms (each side at its own state, the ghost at T_w), and cut_f = g lambda (T_ext - T_f)^+ area/h. The guard stops the drain of a gas cell colder than the column over its own area: heat of gas the staircase has no room for, zero in steady state. The body still books q w_f (s_accumulate_ib_face_fluxes adds the cut back). Called after each ghost correction, so the gas values lag one stage as the image point's do. | |
| subroutine | m_ibm::s_wc_axis (gp, sm, nrm, foot) |
| A wall column's length s_m = max(3h, L) (L = wall_column_len, default 0.15 R), unit normal and wall foot. | |
| real(wp) function, dimension(3) | m_ibm::f_wc_body_centre (gp) |
| Centre of the periodic image of a ghost point's circle or sphere. | |
| real(wp) function | m_ibm::f_wc_dist (gp, cb, x) |
| Signed wall distance of point x from a ghost point's circle or sphere (centre cb). | |
| real(wp) function, dimension(3) | m_ibm::f_cell_centre (c) |
| Centre of cell c (z = 0 in 2D). | |
| subroutine | m_ibm::s_wc_face_metric (c, dir, nb, area, h) |
| Area of the face between cells c and nb (neighbours along dir) and the distance between their centres. | |
| impure real(wp) function, public | m_ibm::f_wall_column_dt (q_prim_vf, q_t_sf) |
| Wall-column time-step limit: a step's column drain takes at most wall_column_dt_frac of a near-wall gas cell's heat span, rho c_v V |T_top - T_w| (rho, c_v at the cell's state). At a step start the column's flux is the true singular one, about 10x the mirror's, and at the acoustic step it removed 40 % of a cell's heat per wall face in one stage: the collapsing pressure sent an impulsively started flow non-finite. From the last step's flux; before the first, from the semi-infinite start, q dt = 2 lambda dT sqrt(dt/(pi alpha_w)). Idle in steady state, where the drain per step is a small part of the span. | |
| real(wp) function | m_ibm::f_cell_scale (gp) |
| Smallest cell width at a ghost point's cell. | |
| subroutine, public | m_ibm::s_ibm_set_conduction_temperature (q_t_sf) |
| Put the mirrored ghost temperature T_cond from s_ibm_correct_state in q_T_sf, where the wall conduction takes its face difference. Only that difference may read it: the mirror of a cold wall in hot gas lies below 0 K, so the diffusion properties use each ghost's own state, and s_ibm_restore_conduction_temperature undoes this once the fluxes are formed. Call after the conservative-to-primitive conversion, before the halo exchange. | |
| subroutine, public | m_ibm::s_ibm_restore_conduction_temperature (q_t_sf) |
| Undo s_ibm_set_conduction_temperature on this rank's ghosts, so the reaction source and the split chemistry substep see each ghost's own temperature. | |
| impure subroutine | m_ibm::s_pack_ghost_tcond () |
| Pack every ghost's global cell index (i, j, k) and T_cond into gp_tc_rec(1:4, 1:num_gps) on the device and bring only those four reals per ghost to the host, instead of the whole ghost_point (about 380 B). | |
| impure subroutine | m_ibm::s_unpack_ghost_tcond () |
| Send gp_tc_rec(4, :) to the T_cond of each ghost: a component copy, never the whole ghost_point. | |
| impure character(len=path_len+2 *name_len) function | m_ibm::f_tcond_file (t_step) |
| Path of the T_cond file of a save: one shared file, or one file per rank with file_per_process (as ib_state). | |
| impure subroutine, public | m_ibm::s_write_ib_conduction_temperature (t_step) |
| Write every ghost's T_cond to restart_data/ib_tcond_<t_step>.dat (lustre_<t_step>/ib_tcond_<t_step>_<rank>.dat with file_per_process). The file is a header of 64-bit integers (magic, format version, bytes per real, number of slabs n_w, then per slab its record count and the bounding box of its global cell indices) followed by one slab per writing rank, each record four reals: the global cell index (i, j, k) and T_cond of a ghost that has one. Keyed by cell, so the file does not depend on the order the ghosts were found in or on the rank count. Each rank writes its own slab at an offset from an exclusive scan of the counts: no rank holds the global records, and only 7 integers per rank reach rank 0 for the header. T_cond is formed from the primitive state at the start of the last stage, so it cannot be rebuilt from the saved conservative state. Collective. | |
| impure subroutine, public | m_ibm::s_read_ib_conduction_temperature (t_step) |
| Restore T_cond of this rank's ghosts from the file of s_write_ib_conduction_temperature, after s_ibm_setup has found them. Rank 0 reads the header and broadcasts it (with file_per_process each rank reads its own); a rank then reads only the slabs whose bounding box meets its cells, in blocks of tcond_chunk records, keeping the records it owns. On the rank count that wrote the file that is its own slab: O(local ghosts) reads plus O(n_w) header entries; on another rank count a few neighbouring slabs. Nothing is proportional to the global ghost count. A file from before T_cond was saved is absent: the first stage then conducts through each ghost's own temperature, as it always did. | |
| impure subroutine, public | m_ibm::s_report_ibm_surface |
| One line at the end of a run if the reacting surface ever failed to solve. Silence means every ghost point on every step reached the surface-balance tolerance, i.e. the surface chemistry was actually applied everywhere it was asked for. | |
| subroutine | m_ibm::s_record_gp_surface (i, gp, t_s, mdot_s, reacting) |
| Store ghost point i's surface record in gp_surf. The weight is the surface area the point stands for. Ghost points within two cell sizes h = dV^(1/d) of the surface fill a band of volume ~2hA, so dV/(2h) each sums to the area A (a length in 2D) whatever the surface's orientation to the grid. The band lies inside the solid, where a layer at depth s has area A (1 - s/R)^(d-1) on a curved surface; for circles, spheres and cylinders the weight is scaled back by (R/(R - s))^(d-1), which removes that bias (sampled on random lattice offsets: < 0.1% mean, 0.3% spread for a sphere at R = 12h). The factor is limited to R/(R - s) <= 2, so a body of only a few cells cannot give an infinite or negative weight. | |
| impure subroutine, public | m_ibm::s_write_ib_surface (save_count) |
| Write this rank's surface records to D/ib_surface_<rank>_<save>.dat, one line per weighted ghost point. | |
| pure logical function | m_ibm::f_holds_twall (thermal_bc) |
| The surface temperature is held at Twall: prescribed (thermal_bc = 1) or evolved by the heat balance (thermal_bc = 3). | |
| pure integer function | m_ibm::f_ib_shard (j, k, l) |
| The ib_part shard of cell or face (j, k, l); neighbouring cells, which a body's surface visits together, get different ones. | |
| pure real(wp) function | m_ibm::f_ib_volume (ib_patch) |
| Solid volume of a circle (per unit depth), sphere or cylinder IB. | |
| impure subroutine, public | m_ibm::s_update_ib_temperatures (dt_step, q_cons_vf) |
| Advance the temperature of each thermal_bc = 3 IB over one step, treating it as one lumped body (small Biot number). With E_solid = m c_s (T - T_ref), the step's face energy in from s_accumulate_ib_face_fluxes and the gasification rate from the surface solve, m c_s dT/dt = Q_in + c_s (T - T_ref) Mdot_out + heat_power - emissivity sigma A (T^4 - T_rad^4). Mdot_out is the solid's mass loss: the face mass sum also carries the ghost cells' non-conservation (a net inflow on a reacting cylinder). T_ref = 298.15 K is the reference of the formation enthalpies, so the gas energy the solid's lost carbon carries is consistent. The step is explicit: the body's thermal time m c_s/(h A) is many orders of magnitude longer than a flow step. For D/ib_heat.dat every body also keeps its gasification rate, face mass out and fluid heat in, Q_in (+ the c_s term for thermal_bc = 3), in patch_ibmdot, mdot_face and qdot. | |
| pure subroutine | m_ibm::s_ib_bank_step (bank, rel, dm, n_relax) |
| One step of an ib_mass_relax bank: add the mass gained beyond gasification, dm, and release 1/ib_mass_relax of the sum. | |
| impure subroutine | m_ibm::s_ib_shell_mass (q_cons_vf) |
| ib_mass_relax: tag the fluid cells within ib_shell_width cells of each body (ib_shell) and add their gas mass to ib_part(3) (summed into ib_heat(5) by s_update_ib_temperatures). A cell within reach of two bodies is assigned to the first one found. | |
| impure subroutine, public | m_ibm::s_conserve_ib_mass (q_cons_vf) |
| ib_mass_relax: take this step's release of each body's bank (s_update_ib_temperatures) out of the gas within ib_shell_width cells of the body, scaling the partial densities, momentum, energy and species of those cells by one factor (velocity, temperature and composition kept). The ghost-cell treatment does not conserve mass at a moving or gasifying wall (face fluxes into overwritten ghost cells against cells changing side); this returns the gas to exactly the gasified mass, lagged by about ib_mass_relax steps. | |
| impure subroutine, public | m_ibm::s_add_swept_cells (q_cons_vf, q_start_vf, a_w, dt_step) |
| Moving bodies: book the mass and the body-frame energy E' = E - rho u.V_b + rho |V_b|^2/2 of each cell a body covered (+) or uncovered (-) at this stage's placement, into ib_heat(3) (mass out of the body, as a rate) and ib_heat(2) (energy in). The grid faces do not move with the wall, so the face fluxes alone miss the gas swept between face and wall. Called at every placement, after the stage update and before the ghost correction overwrites the covered cells: a cell's content enters the step's result with weight a_w (the product of the later stages' rk_coef(:,1)/rk_coef(:,4)) and the step-start state with 1 - a_w, so it is booked as a_w q + (1 - a_w) q_start. V_b = V + omega x r at the cell, r the minimum-image lever arm to the centroid. A cell passing directly from one body to another is not counted. | |
| impure subroutine | m_ibm::s_advance_markers_prev () |
| ib_markers_prev = ib_markers over the whole halo | |
| impure subroutine, public | m_ibm::s_fill_uncovered_cells (q_cons_vf, q_start_vf, q_prim_vf) |
| ib_uncover_fill: a cell the body left at this placement (solid at the last one, fluid now) holds the cold ghost state it last had, which the stage update then carries as gas. Give it the mean density, species and pressure of the neighbours in its 3x3(x3) that were fluid at both placements, the state of the flow it moved into; with chemistry the energy is rebuilt from the mean state's temperature. The velocity stays the ghost's: the mean of the neighbours' makes the drag of a moving body disagree more with its Galilean twin. A cell with no such neighbour is left as it is. The step-start state q_start, which the later stages blend in, gets the same state; q_prim_vf (the stage-start primitives) is updated for the image-point interpolation. The halo is filled as well (see the loop bounds). Call before s_add_swept_cells so the booking sees the filled state. | |
| pure subroutine | m_ibm::s_sort_gps_by_location (order) |
| Ghost-point indices ordered by grid location, so per-point output does not inherit the discovery order. s_find_ghost_points assigns slots from a GPU atomic, so that order is the thread schedule's and differs between CPU and GPU builds (MFlowCode/MFC#2039). Heapsort, since a GPU run's input is unordered and a particle array carries O(10^5) ghost points. | |
| pure subroutine | m_ibm::s_sift_gp (order, key, root, last) |
| Restore the max-heap rooted at root over order(1:last), comparing by key. | |
| impure subroutine, private | m_ibm::s_compute_image_points () |
| Compute the image points for each ghost point. | |
| subroutine, private | m_ibm::s_find_num_ghost_points (num_gps_out) |
| Count the number of ghost points for memory allocation. | |
| subroutine, private | m_ibm::s_find_ghost_points () |
| Locate all ghost points in the domain. | |
| subroutine | m_ibm::s_find_ghost_points_ordered () |
| Gather the ghost points in lexicographic (i,j,k) order: count them per i-slab, scan the counts into slab offsets, then fill each slab serially in (j,k) order. The serial-sweep order, reached in parallel over slabs and linear in the cell count. | |
| subroutine, private | m_ibm::s_compute_interpolation_coeffs () |
| Compute the interpolation coefficients for image points. | |
| subroutine | m_ibm::s_tsc_weights (markers, loc, stencil_center, axis_weights, fluid_frac) |
| Triangular-shaped-cloud (quadratic B-spline) weights of a point on the 3x3(x3) stencil centred on the cell nearest to it (Ezra, Peles & Kozak 2025, Int. J. Heat Mass Transf. 252:127314), and the fraction of that weight carried by fluid cells. The kernel is a partition of unity and smooth across cell boundaries, so an interpolated wall quantity converges one order faster than from inverse-distance or bilinear weights, which are only continuous. The weights use the fractional position in the bracketing cell at integer offsets, which keeps the partition of unity exactly on a stretched grid. The stencil is kept inside the halo. Solid cells in it carry the ghost values of the last correction (see ib_keep_ghost); a point buried in a body has no fluid weight. | |
| real(wp) function, private | m_ibm::f_tsc_apply (sf, ic, wd) |
| Apply TSC weights from s_tsc_weights to one field. | |
| real(wp) function | m_ibm::f_tsc_fluid_mean (sf, markers, ic, wd) |
| TSC weights from s_tsc_weights applied to the gas cells only, renormalized. | |
| subroutine | m_ibm::s_lag3_weights (markers, loc, ic, wd, fluid_frac) |
| Lagrange (biquadratic, triquadratic in 3D) weights of point loc on the stencil s_tsc_weights centres there, from the cells' own centres: an interpolant, where TSC smooths a sample by about (h^2/4) lap phi. Where a stencil cell is solid the TSC weights are kept. | |
| real(wp) function, private | m_ibm::f_quad_fill (phi_w, phi_1, phi_2, lw, llin) |
| Ghost value from the quadratic wall-normal profile, bounded by the linear mirror (minmod). The two extrapolations agree exactly for a linear profile, so this limits only the curvature correction, and to the size the linear mirror already produces. Unlimited, the quadratic amplifies that correction with ghost depth and can leave unphysical near-wall states. | |
| subroutine, private | m_ibm::s_wall_fill (gp, wf) |
| Probes and Lagrange weights of the quadratic wall-normal fill of a ghost point. The wall is at s = 0, the probes at s1 and s2 = 2 s1 along the surface normal from the wall foot, the ghost at s = -d (d = |levelset|): | |
| real(wp) function, dimension(3, 3, 3) | m_ibm::f_tsc_stencil (wd) |
| Tensor product of the 1D TSC weights: the coefficient on each cell of the 3x3x3 stencil. | |
| subroutine, private | m_ibm::s_interpolation_weights (gp, i, j, k, dist, fluid_mask, interp_coeffs) |
| Fluid-masked image-point weights: bilinear for second-order IBM, else inverse distance squared. | |
| subroutine, private | m_ibm::s_interpolate_image_point (q_prim_vf, gp, alpha_rho_ip, alpha_ip, pres_ip, vel_ip, c_ip, r_ip, v_ip, pb_ip, mv_ip, nmom_ip, pb_in, mv_in, presb_ip, massv_ip, ys_ip) |
| Interpolate primitive variables to a ghost point's image point using bilinear or trilinear interpolation. | |
| subroutine | m_ibm::s_update_ib_rotation_matrices (num_ibs) |
| Resets the current indexes of immersed boundaries and replaces them after updating the position of each moving immersed boundary Recalculate the moving bodies' rotation matrices from their current angles (device). | |
| impure subroutine | m_ibm::s_update_mib (num_ibs) |
| pure real(wp) function | m_ibm::f_log_cosh (x) |
| log(cosh(x)) without overflow for large |x| | |
| subroutine | m_ibm::s_prescribed_kinematics (i, t) |
| Prescribed kinematics for patch i at time t: hinged flapping (kin_model = 1) or the Eldredge pitch ramp (kin_model = 2). Flapping rolls phi about the lab x axis through the hinge and pitches theta about the body spanwise (y) axis through it; the ramp holds phi at zero and drives theta alone. Both compose as R = Rx(phi) Ry(theta) (MFC's angle convention) and set the angles, centroid, velocity and lab-frame angular velocity; nothing is integrated, so restarts are exact. | |
| real(wp) function | m_ibm::f_ib_face_flux (hatr, j, k, l, c) |
| Face flux of component c. The dual-pass HLLD RHS takes the hat_R set at the left face of a cell (hatR) and hat_L at its right. | |
| real(wp) function | m_ibm::f_ib_face_mass (hatr, j, k, l) |
| Mass flux through face (j, k, l). | |
| real(wp) function | m_ibm::f_ib_cell_momentum (q_cons_vf, q_prim_vf, i, j, k, l) |
| Momentum density of component i in cell (j, k, l). The momentum halos of q_cons_vf are not exchanged between ranks, so a halo cell (rank seam, periodic edge) takes rho*u from q_prim_vf, whose halos are. | |
| pure real(wp) function | m_ibm::f_ib_face_area (idir, j, k, l) |
| Area of the face (j, k, l) normal to direction idir. | |
| pure real(wp) function | m_ibm::f_ib_stage_weight (stage) |
| Weight of RK stage stage in the step (SSP-RK: 1; 1/2, 1/2; 1/6, 1/6, 2/3). | |
| subroutine | m_ibm::s_accumulate_ib_mass (idir, stage) |
| The mass part of s_accumulate_ib_face_fluxes alone: ib_mass_relax on fixed bodies with no forces, heat output, lumped body or AMR. A kernel's launch cost grows with the arrays it names (about 0.5 ms on an MI300A for the general one), so this one names only what the mass sum needs. | |
| subroutine | m_ibm::s_accumulate_ib_face_fluxes (idir, stage, q_cons_vf, q_prim_vf, markers) |
| Add direction idir's fluid-body face fluxes to each IB. These are the fluxes the RHS differences, Riemann (flux_rsx_vf) plus viscous, capillary, conductive and diffusive (flux_src_rsx_vf), so each body receives exactly what the fluid loses. A face counts on the rank owning its fluid cell. With IB forces: force (1:3) and torque about the centroid (4:6) of each local IB into ib_face_ft, from the last RHS evaluation (idir = 1 starts afresh); a moving body's momentum flux is taken through a face moving with its wall (face momentum times the wall's normal velocity is removed). With ib_exchange: energy in and mass out of each lumped body (every body with ib_heat_wrt) into ib_heat(2:3), weighted so a step's stages sum to its exchange (SSP-RK: 1; 1/2, 1/2; 1/6, 1/6, 2/3). | |
| subroutine | m_ibm::s_compute_ib_forces () |
| Set each IB's force and torque: the fluid's share from the face fluxes of the last RHS evaluation (s_accumulate_ib_face_fluxes), plus collisions and body forces. | |
| subroutine | m_ibm::s_compute_centroid_offset (gid, ib_marker) |
| Computes the center of mass for IB patch types where we are unable to determine their center of mass analytically. These patches include things like NACA airfoils and STL models Move a moving airfoil/STL patch's centroid to its centre of mass, keeping the difference in centroid_offset. Collective: every rank calls it for every global id, contributing zeros for patches it does not hold. | |
| pure logical function | m_ibm::f_needs_centroid_offset (patch) |
| A moving airfoil or STL (geometries 4, 5, 11, 12) moves its centroid to the centre of mass and keeps a centroid_offset. | |
| impure subroutine | m_ibm::s_restore_centroid_offsets (t_init) |
| On restart, replace the re-measured centroid offsets with the ones the run was using (restart_data/ib_offset_<step>.dat, written with each checkpoint), and re-place kinematics-driven bodies about them. No file: the measured offsets stand. | |
| subroutine | m_ibm::s_compute_moment_of_inertia (patch, axis, moment) |
| Computes the moment of inertia for an immersed boundary. | |
| subroutine | m_ibm::s_wrap_periodic_ibs () |
| Wrap immersed boundary positions across periodic domain boundaries. | |
| impure subroutine | m_ibm::s_setup_ib_force_comm () |
| Builds the ascending list of distinct neighborhood ranks used by s_communicate_ib_forces and allocates its buffers once. The ascending order is the fixed order in which an owner adds its neighbors' contributions. | |
| integer function | m_ibm::f_ib_nbr_slot (rank) |
| Position of rank in ib_nbrs. | |
| impure subroutine | m_ibm::s_ib_exchange_heat (dt_step) |
| Adds ib_heat(1:5) (the host copy: this rank's partial sums per slot) over the ranks that hold each body, through its owner (patch_ibowner_rank), and, with ib_mass_relax, steps the owners' banks. Phase 1: each rank sends its nonzero partials of bodies it does not own to the owner, which adds them in ascending source-rank order. Phase 2: each owner returns the totals and the bank's release (row 7) to the ranks that sent, the only ranks with cells of the body. Both are point-to-point with neighborhood ranks and carry only bodies a rank shares, so the volume follows the bodies on rank boundaries, not the body count. | |
| impure subroutine | m_ibm::s_ib_migrate_banks (n_gain, gain_gid, gain_from, num_entries) |
| At a handoff, move the ib_mass_relax banks of the bodies that changed owner from the old owner to the new one. The new owner knows which neighbors to expect from (gain_from); the old owner queued its records in s_handoff_ib_ownership. | |
| subroutine | m_ibm::s_communicate_ib_forces (forces, torques) |
| Reduces forces and torques so every rank holding an IB ends with bit-identical values. Each IB has one owner, the rank whose subdomain holds its centroid (patch_ibowner_rank, stamped at handoff). Phase 1: each rank sends its nonzero partials to the owner, which adds them to its own partial in ascending source-rank order once all have arrived. Phase 2: each owner sends its totals to every neighborhood rank, which overwrite their partials. One nonblocking message per neighbor per phase. | |
| subroutine | m_ibm::s_handoff_ib_ownership () |
| Swaps ownership of IBs and passes ownership of IBs to neighbor processors. | |
| impure subroutine | m_ibm::s_check_every_patch_marked () |
| Abort if any namelist immersed boundary marks no cell anywhere. The owning rank is chosen by the patch centroid, so an STL placed with model_translate while its centroid is left elsewhere is handed to ranks that do not hold it, and it vanishes silently. Cloud particles are skipped: a particle's centroid is its body, so it cannot vanish this way. | |
| impure subroutine | m_ibm::s_ibm_marker_bounds () |
| Compute the deepest-level marker-field bounds into mkr_lo/mkr_hi: the coarse block (m/n/p with ghosts) or the deepest fine block a rank can own, whichever is larger (a level-l block has amr_ref_ratio**l * base_ext - 1 interior cells per active dim, base_ext = the user footprint in coarse cells). Called from s_initialize_ibm_module and s_ibm_alloc_fine. | |
| impure subroutine, public | m_ibm::s_ibm_alloc_fine (nslots, f1_lo, f1_hi, f2_lo, f2_hi, f3_lo, f3_hi) |
| Allocate the per-slot fine-IB marker fields, sized to the max buffered fine extents; ghost-point lists start empty. No-op unless amr .and. ib. | |
| impure subroutine, public | m_ibm::s_ibm_note_fine_memory () |
| Note the fine IB state's memory for the end-of-run AMR table. | |
| impure subroutine, public | m_ibm::s_ibm_reset_fine_park () |
| Forget every slot's parked fine list (before the fine lists are rebuilt for the current block set). | |
| impure integer function, public | m_ibm::f_ibm_fine_gps (islot) |
| Ghost points stored for fine slot islot: zero for a block that holds no immersed body. | |
| impure subroutine, public | m_ibm::s_ibm_tally_gps_by_body (cnt) |
| Add to cnt(1:num_gbl_ibs) the ghost points each body has in the active list (the fine slot's when swapped in); counted on the device, since ghost_points never crosses to the host. | |
| impure subroutine, public | m_ibm::s_ibm_check_bodies_on_one_rank (cnt) |
| Abort if any one body has ghost points on more than one rank: the fine image-point stencil is exact only when a body's whole fine state lives on one rank. Counts are per global body, so bodies on different ranks are fine. | |
| impure subroutine, public | m_ibm::s_ibm_load_fine_markers (nb, slots, mext, sd, w) |
| Load ib_markers_fine for the next fine RHS pass: member ibm's fine markers (interior 0:mext(:, ibm)) land at offset (ibm - 1)*w along dimension sd; the rest of the installed frame reads 0, so padding and gaps zero nothing. Per-block callers pass nb = 1, w = 0. Grid globals must already be swapped. | |
| impure subroutine, public | m_ibm::s_ibm_swap_to_fine (islot, gps_on_device) |
| Swap the module IB globals (ib_markers/ghost_points/num_gps) to fine slot islot's state; the coarse state parks in the save slot. Pair with s_ibm_restore_from_fine; grid globals must already be swapped to the fine block. | |
| impure subroutine, public | m_ibm::s_ibm_restore_from_fine (islot) |
| Restore the coarse IB globals saved by s_ibm_swap_to_fine, parking the (possibly updated) fine state back in slot islot. | |
| impure subroutine | m_ibm::s_ibm_reserve_park (islot, n_f) |
| Give slot islot a gp_park segment for n_f ghost points at the pool top: exact for fixed bodies (the list keeps its length until s_ibm_reset_fine_park), full-length for moving bodies (so a slot never needs a second one, and a vacated one is reused). | |
| impure subroutine | m_ibm::s_ibm_rebuild_corrected_gps (n_g) |
| Rebuild corrected_gps from the ghost-point list now in ghost_points: s_compute_interpolation_coeffs only sets entries, so clear the whole field and re-mark the valid ghost points on-device (same defaultmap treatment as the swap kernels). | |
| impure subroutine, public | m_ibm::s_ibm_setup_fine () |
| Compute the fine-grid IB state (markers, ghost points, levelset, image points, interpolation coeffs) for the current block, mirroring the static-body portion of s_ibm_setup. Grid globals must be swapped to the fine block and IB globals to this slot (s_ibm_swap_to_fine) first. | |
| impure subroutine, public | m_ibm::s_finalize_ibm_module () |
| Finalize the IBM module. | |
| impure subroutine | m_ibm::s_ib_flux_wall_setup () |
| ib_flux_wall: allocate the wall fields, give each body's ghost points with a fluid face neighbor their wall area per face area, and report the wall area the faces carry. A planar wall of area A has sum|n_i| A of staircase faces, so each face carries 1/sum|n_i| of its own area. | |
| impure subroutine, public | m_ibm::s_ib_flux_wall_prepare (q_prim_vf) |
| ib_flux_wall, before each Riemann solve (primitive buffers filled): fill ib_wall_src's buffer cells and set the positivity factor of every fluid cell in the domain and its first buffer layer (a wall face on a rank seam is solved on both sides), the largest theta <= 1 for which its wall faces take at most ib_wall_safety of any species in one forward-Euler step of size dt (each SSP-RK stage is a convex combination of such steps). Conservative: the body books the scaled flux. | |
| real(wp) function | m_ibm::f_wall_face_sum (src, j, k, l, q) |
| ib_flux_wall: sum over the wall faces of fluid cell (j, k, l) of the wall area per cell volume, times species q's consumption rate max(-mdot_q, 0) (q > 0) or 1 (q = 0) | |
| real(wp) function | m_ibm::f_wall_face_term (src, j, k, l, q) |
| ib_flux_wall: wall area per face area times species q's consumption rate (q > 0) or 1 (q = 0) of the body cell (j, k, l) | |
| real(wp) function | m_ibm::f_flux_wall_record_area (src, theta, marks, loc) |
| ib_flux_wall: the surface area a reacting body's ghost point (j, k, l) stands for in its surface record, the wall area its fluid faces carry (a theta times their area, as the Riemann solver takes them); 0 off the faces | |
| impure subroutine | m_ibm::s_ib_wall_src_buffers () |
| ib_flux_wall: fill ib_wall_src's buffer cells from the neighbouring ranks or the periodic image; they stay zero (no wall) at other domain boundaries | |
| subroutine | m_ibm::s_surface_species_residual (pres, t_s, d, ys_ip, ys_s, w_species, r_species, omega_s, mdot_s) |
| Species flux residual at a heterogeneous reacting surface. | |
| subroutine | m_ibm::s_surface_energy_residual (pres, t_ip, t_s, d, ys_s, r_energy) |
| Surface energy residual: gas-side conduction balances heterogeneous reaction heat. Radiation and solid-side conduction are omitted. | |
| subroutine | m_ibm::s_surface_residual (pres, t_ip, t_s, d, ys_ip, ys_s, w_species, k_bath, solve_temperature, flux_scale, energy_scale, r, r_species, omega_s, mdot_s) |
| Assemble the Newton residual for Ns species, with temperature appended only when it is solved. k_bath selects which species balance the sum constraint displaces; see s_solve_surface for why it must be the most abundant one. | |
| real(wp) function | m_ibm::f_face_theta (q_prim_vf, markers, gp, t_ip, t_s) |
| Largest temperature mirror weight, at most 1, that keeps the ghost consistent with every fluid cell it shares a face with. Conduction across that face is the two-point difference (T_n - T_g)/h, so the line through the ghost (a behind the wall) and the cell (b in front) must not reach the wall beyond T_s: T_g - T_s <= (a/b)(T_s - T_n) on the mirror's side, and T_g = T_s once the cell is past T_s. The image point sits about a cell out, so without this an under-resolved layer leaves the mirror set by the second gas cell and drives the first past the wall temperature. A resolved, convex profile puts the mirror inside the bound, so it leaves the mirror untouched there. A cell closer than a quarter of its spacing to the wall plane is left out: its temperature is within noise of T_s, and the bound, whose slope there is a/b, then switched theta between 0 and 1 from step to step and kept a steady conduction annulus from converging. | |
| subroutine | m_ibm::s_blend_ghost_temperature (t_ip, t_s, t_lo, t_hi, theta_max, t_g) |
| Ghost state for an immersed surface, from the image-point state and the surface state. | |
| subroutine | m_ibm::s_blend_ghost_species (ys_ip, ys_s, ys_g) |
| Species half of the ghost-state blend: one theta shared by every species (see s_blend_ghost_temperature). | |
| subroutine | m_ibm::s_pick_bath_species (ys_s, k_bath) |
| Index of the most abundant species, i.e. the balance the sum constraint displaces. | |
| subroutine | m_ibm::s_solve_surface (pres, t_ip, t_wall, d, ys_ip, w_species, thermal_bc, ys_s, t_s, mdot_s, converged) |
| Newton solve for a reacting surface. thermal_bc=0: zero-normal-gradient T; 1: prescribed T; 2: energy balance. | |
| subroutine | m_ibm::s_solve_surface_linear_system (a, b, x, nsolve, success) |
| Small dense linear solve with partial pivoting for the local surface Newton system. | |
Variables | |
| type(ib_fine_state), dimension(:), allocatable | m_ibm_fine::ib_fine |
| integer | m_ibm_fine::num_gps_save |
| type(ghost_point), dimension(:), allocatable | m_ibm_fine::gp_park |
| Device-resident park for the coarse and fine ghost-point lists across a fine swap, copied to/from ghost_points by on-device kernels. One packed pool: entries 1..park_coarse hold the coarse list; each slot holding ghost points (a block containing a body) gets a segment after it, so the pool scales with the ghost points parked, not blocks x the longest list. Mapped via move_alloc + GPU_ENTER_DATA (the amr_cg idiom; a direct @:ALLOCATE aborts with lib-4425 on CCE OpenMP). | |
| integer | m_ibm_fine::ib_coarse_slot = 0 |
| The coarse ghost points and markers park (host copies) in an extra ib_fine slot, ib_coarse_slot (= nslots+1): a new module-level derived-type allocatable here would corrupt a sibling's descriptor on CCE OpenMP (lib-4425). | |
| integer(kind=8) | m_ibm_fine::park_coarse = 0_8 |
| gp_park entries reserved for the coarse list | |
| integer(kind=8) | m_ibm_fine::park_top = 0_8 |
| gp_park entries in use (coarse segment + fine segments) | |
| integer(kind=8) | m_ibm_fine::fine_gps_cap = 0_8 |
| Fine-block ghost-point capacity (= buffered fine-block cell count), set by s_ibm_alloc_fine; 0 when AMR-IB is inactive. | |
| integer, dimension(3) | m_ibm_fine::mkr_lo = 0 |
| Bounds of ib_markers, enclosing both coarse and fine blocks so it never needs reallocating. Set by s_ibm_alloc_fine. | |
| integer, dimension(3) | m_ibm_fine::mkr_hi = 0 |
| integer | m_ibm::n_surface_not_converged = 0 |
| Ghost points at which the reacting-surface Newton solve did not reach its tolerance, so the point fell back to a chemically inert wall (keeping a prescribed Twall). Counted because that fallback is otherwise indistinguishable from a surface mechanism that simply does nothing, and a run can look converged while the surface chemistry never engaged. | |
| integer | m_ibm::n_surface_ill_posed = 0 |
| Ghost points whose levelset distance was not positive, leaving the surface gradient (X_IP - X_s)/d undefined. Separate from the counter above because this is a grid/geometry degeneracy, not a kinetics failure. | |
| integer, dimension(:,:), allocatable | m_ibm::n_fill_tier |
| Ghost-point updates per fill tier and AMR level (0 = the coarse grid), summed over the run and reported at its end, because a tight packing can sit mostly in tier 2 and a second-order claim is then not true of that surface. | |
| type(integer_field), public | m_ibm::ib_markers |
| type(integer_field), public | m_ibm::ib_markers_fine |
| Body markers in the fine-advance frame, read by s_compute_rhs's body-cell RHS zeroing while amr_in_fine_advance: the advanced block's fine markers (for a batch, every member's at its slab offset), loaded by s_ibm_load_fine_markers before each fine RHS pass. ib_markers holds the coarse markers during a fine RHS. Interior-only, sized to the allocation extents. | |
| type(integer_field) | m_ibm::corrected_gps |
| 1 at ghost points whose image point reaches the fluid, 0 elsewhere. Ghost points with a buried image point average over these neighbors, and never over each other. | |
| type(ghost_point), dimension(:), allocatable | m_ibm::ghost_points |
| real(wp), dimension(:,:), allocatable | m_ibm::gp_prim_new |
| New primitive state per ghost point, staged so it is published only after every image-point stencil has been read (MFlowCode/MFC#1901). Writing q_prim inside the same loop that reads it at neighboring image-point stencils makes a ghost's result depend on whether its neighbors were updated first. Inverse-distance weights mask solid cells, so the race is latent there; a stencil that reads ghost cells (ib_ip_interp = 2) needs it. | |
| integer(kind=8), parameter | m_ibm::tcond_magic = 7164990_8 |
| first header word of restart_data/ib_tcond files | |
| integer(kind=8), parameter | m_ibm::tcond_version = 1_8 |
| format version of the ib_tcond header | |
| integer, parameter | m_ibm::tcond_chunk = 65536 |
| records per block read or written of an ib_tcond file | |
| real(wp), dimension(:,:), allocatable | m_ibm::gp_tc_rec |
| Packed (i, j, k, T_cond) per ghost for the T_cond restart file, so only these four reals per ghost cross to the host. | |
| integer, dimension(:), allocatable | m_ibm::gp_slab |
| per-i-slab ghost-point counts/offsets for the ordered gather (AMR) | |
| integer, parameter | m_ibm::ib_surf_nvars = 3 |
| Surface record per ghost point from the latest s_ibm_correct_state, kept when ib_surface_wrt: (1) area weight, (2) wall temperature, (3) gasified mass flux. Only ghost points within two cells of the surface carry a weight, so summing weight*flux over them integrates over the surface; see s_record_gp_surface. | |
| real(wp), dimension(:,:), allocatable | m_ibm::gp_surf |
| integer, parameter, public | m_ibm::ibw_e = num_species + 1 |
| ib_flux_wall: per ghost point with a fluid face neighbor of a body, from its surface solve (zero for an inert body), the species mass fluxes into the gas (1:num_species), the energy flux (ibw_e), the blowing velocity (ibw_u:ibw_u + 2) and the wall area per face area, 1/sum|n_i| (ibw_a, 0 off a wall); ib_wall_theta: each fluid cell's positivity factor on its wall faces' rates | |
| integer, parameter, public | m_ibm::ibw_u = num_species + 2 |
| integer, parameter, public | m_ibm::ibw_a = num_species + 5 |
| type(scalar_field), dimension(ibw_a), public | m_ibm::ib_wall_src |
| type(scalar_field), public | m_ibm::ib_wall_theta |
| logical | m_ibm::record_surface |
| gp_surf is filled when it is written (ib_surface_wrt) or integrated (ib_exchange). | |
| logical, public | m_ibm::ib_exchange = .false. |
| ib_heat is accumulated: some IB has thermal_bc = 3, ib_heat_wrt or ib_mass_relax | |
| logical | m_ibm::ib_mass_only = .false. |
| only the mass is accumulated, from fixed bodies without AMR (s_accumulate_ib_mass) | |
| logical, public | m_ibm::ib_wall_col = .false. |
| Some IB has wall_column (m_ib_wall_column). | |
| logical | m_ibm::wc_ready = .false. |
| Columns initialized (from the gas, at the first step of a run or restart). | |
| integer, parameter | m_ibm::ib_nheat = 7 |
| Per patch_ib slot (the bodies this rank holds, not global ids), for the thermal_bc = 3 update, ib_heat_wrt and ib_mass_relax: (1) surface area and (4) gasification rate, from gp_surf; (2) energy into the solid and (3) mass out of it, both summed over the faces between the body's cells and fluid cells with the RK stage weights, so over a step they are exactly the energy and mass the fluid exchanged with the body; (5) the gas mass of the body's ib_mass_relax shell; (6) a copy of the body's bank (patch_ibmass_bank) and (7) the share of it released this step, for the multi-rank exchange. Rows 1:5 are this rank's partial sums until s_ib_exchange_heat adds them over the ranks that hold the body, through its owner. | |
| real(wp), dimension(:,:), allocatable | m_ibm::ib_heat |
| real(wp), dimension(:,:,:), allocatable | m_ibm::ib_part |
| Per patch_ib slot and shard: (1) energy and (2) mass from the face fluxes and (3) shell mass of ib_mass_relax, before they are summed into ib_heat(2:3) and ib_heat(5). Every cell of a body's surface adds to the same few sums, and on AMD a device atomic on a double is a compare-and-swap loop that serializes by address, so the adds are spread over ib_nshard sums. | |
| integer, parameter | m_ibm::ib_nshard = 32 |
| a power of two (f_ib_shard) | |
| type(integer_field) | m_ibm::ib_shell |
| ib_mass_relax: the bank of a body (the gas mass it gained beyond its gasification and not yet returned) is patch_ibmass_bank, held by the owner. ib_shell: patch_ib slot of each fluid cell within ib_shell_width cells of a body, else 0 (valid until the step's handoff). ib_markers_prev: markers at the last placement of a moving body (s_add_swept_cells). | |
| type(integer_field) | m_ibm::ib_markers_prev |
| integer, parameter | m_ibm::ib_shell_width = 2 |
| integer | m_ibm::ib_slot_cap = 0 |
| slots of ib_heat and ib_part: a bound on the bodies one rank holds | |
| integer, public | m_ibm::num_gps |
| Number of ghost points. | |
| logical | m_ibm::moving_immersed_boundary_flag |
| integer | m_ibm::ib_ip_width |
| Cells per direction in the image-point interpolation stencil: 2 (inverse distance, bilinear) or 3 (TSC). | |
| logical | m_ibm::ib_keep_ghost |
| The interpolation or the wall probes read solid cells, so ghost cells keep the last correction. | |
| logical | m_ibm::ib_wall_quad |
| ib_wall_order = 2: quadratic wall-normal ghost velocity at no-slip walls | |
| logical | m_ibm::centroid_offsets_active = .false. |
| some patch is a moving airfoil or STL, which carries a centroid_offset | |
| integer, parameter, private | m_ibm::ib_rec_len = 7 |
| gbl_patch_id, force(1:3), torque(1:3) | |
| integer, private | m_ibm::n_ib_nbrs = 0 |
| integer, dimension(:), allocatable, private | m_ibm::ib_nbrs |
| integer, dimension(:), allocatable, private | m_ibm::ib_send_counts |
| integer, dimension(:), allocatable, private | m_ibm::ib_reqs |
| integer, dimension(:,:), allocatable, private | m_ibm::ib_stats |
| integer, dimension(:,:), allocatable, private | m_ibm::ib_reply_slots |
| integer, dimension(:), allocatable, private | m_ibm::ib_reply_counts |
| s_ib_exchange_heat: bodies each neighbor sent partials of | |
| real(wp), dimension(:,:), allocatable, private | m_ibm::ib_send_bufs |
| real(wp), dimension(:,:), allocatable, private | m_ibm::ib_recv_bufs |
| real(wp), dimension(:,:), allocatable | m_ibm::ib_face_ft |
| Force (1:3) and torque (4:6) on each local IB from the fluid-body face fluxes of the last RHS evaluation. | |
Contains module m_ibm_fine.
Definition in file m_ibm.fpp.f90.