MFC
Exascale flow solver
Loading...
Searching...
No Matches
m_ibm Module Reference

Ghost-node immersed boundary method: locates ghost/image points, computes interpolation coefficients, and corrects the flow state. More...

Data Types

type  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...

Functions/Subroutines

impure subroutine, public s_initialize_ibm_module ()
 Allocates memory for the variables in the IBM module.
impure subroutine, public s_ibm_setup ()
 Initializes the values of various IBM variables, such as ghost points and image points.
real(wp) function, dimension(3) 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 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 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 s_compute_ghost_point_velocity (gp, gp_patch_id, radial_vector, vel_ip, pres_ip, dh, vel_gp, q_prim_vf, wf)
subroutine, public 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 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 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 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 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) f_wc_body_centre (gp)
 Centre of the periodic image of a ghost point's circle or sphere.
real(wp) function 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) f_cell_centre (c)
 Centre of cell c (z = 0 in 2D).
subroutine 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 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 f_cell_scale (gp)
 Smallest cell width at a ghost point's cell.
subroutine, public 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 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 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 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 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 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 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 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 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 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 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 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 f_ib_volume (ib_patch)
 Solid volume of a circle (per unit depth), sphere or cylinder IB.
impure subroutine, public 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 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 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 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 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 s_advance_markers_prev ()
 ib_markers_prev = ib_markers over the whole halo
impure subroutine, public 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 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 s_sift_gp (order, key, root, last)
 Restore the max-heap rooted at root over order(1:last), comparing by key.
impure subroutine, private s_compute_image_points ()
 Compute the image points for each ghost point.
subroutine, private s_find_num_ghost_points (num_gps_out)
 Count the number of ghost points for memory allocation.
subroutine, private s_find_ghost_points ()
 Locate all ghost points in the domain.
subroutine 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 s_compute_interpolation_coeffs ()
 Compute the interpolation coefficients for image points.
subroutine 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 f_tsc_apply (sf, ic, wd)
 Apply TSC weights from s_tsc_weights to one field.
real(wp) function f_tsc_fluid_mean (sf, markers, ic, wd)
 TSC weights from s_tsc_weights applied to the gas cells only, renormalized.
subroutine 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 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 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) f_tsc_stencil (wd)
 Tensor product of the 1D TSC weights: the coefficient on each cell of the 3x3x3 stencil.
subroutine, private 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 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 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 s_update_mib (num_ibs)
pure real(wp) function f_log_cosh (x)
 log(cosh(x)) without overflow for large |x|
subroutine 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 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 f_ib_face_mass (hatr, j, k, l)
 Mass flux through face (j, k, l).
real(wp) function 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 f_ib_face_area (idir, j, k, l)
 Area of the face (j, k, l) normal to direction idir.
pure real(wp) function 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 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 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 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 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 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 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 s_compute_moment_of_inertia (patch, axis, moment)
 Computes the moment of inertia for an immersed boundary.
subroutine s_wrap_periodic_ibs ()
 Wrap immersed boundary positions across periodic domain boundaries.
impure subroutine 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 f_ib_nbr_slot (rank)
 Position of rank in ib_nbrs.
impure subroutine 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 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 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 s_handoff_ib_ownership ()
 Swaps ownership of IBs and passes ownership of IBs to neighbor processors.
impure subroutine 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 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 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 s_ibm_note_fine_memory ()
 Note the fine IB state's memory for the end-of-run AMR table.
impure subroutine, public 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 f_ibm_fine_gps (islot)
 Ghost points stored for fine slot islot: zero for a block that holds no immersed body.
impure subroutine, public 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 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 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 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 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 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 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 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 s_finalize_ibm_module ()
 Finalize the IBM module.
impure subroutine 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 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 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 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 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 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 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 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 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 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 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 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 s_pick_bath_species (ys_s, k_bath)
 Index of the most abundant species, i.e. the balance the sum constraint displaces.
subroutine 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 s_solve_surface_linear_system (a, b, x, nsolve, success)
 Small dense linear solve with partial pivoting for the local surface Newton system.

Variables

integer 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 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 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 ib_markers
type(integer_field), public 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) 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 ghost_points
real(wp), dimension(:,:), allocatable 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 tcond_magic = 7164990_8
 first header word of restart_data/ib_tcond files
integer(kind=8), parameter tcond_version = 1_8
 format version of the ib_tcond header
integer, parameter tcond_chunk = 65536
 records per block read or written of an ib_tcond file
real(wp), dimension(:,:), allocatable 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 gp_slab
 per-i-slab ghost-point counts/offsets for the ordered gather (AMR)
integer, parameter 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 gp_surf
integer, parameter, public 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 ibw_u = num_species + 2
integer, parameter, public ibw_a = num_species + 5
type(scalar_field), dimension(ibw_a), public ib_wall_src
type(scalar_field), public ib_wall_theta
logical record_surface
 gp_surf is filled when it is written (ib_surface_wrt) or integrated (ib_exchange).
logical, public ib_exchange = .false.
 ib_heat is accumulated: some IB has thermal_bc = 3, ib_heat_wrt or ib_mass_relax
logical ib_mass_only = .false.
 only the mass is accumulated, from fixed bodies without AMR (s_accumulate_ib_mass)
logical, public ib_wall_col = .false.
 Some IB has wall_column (m_ib_wall_column).
logical wc_ready = .false.
 Columns initialized (from the gas, at the first step of a run or restart).
integer, parameter 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 ib_heat
real(wp), dimension(:,:,:), allocatable 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 ib_nshard = 32
 a power of two (f_ib_shard)
type(integer_field) 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) ib_markers_prev
integer, parameter ib_shell_width = 2
integer ib_slot_cap = 0
 slots of ib_heat and ib_part: a bound on the bodies one rank holds
integer, public num_gps
 Number of ghost points.
logical moving_immersed_boundary_flag
integer ib_ip_width
 Cells per direction in the image-point interpolation stencil: 2 (inverse distance, bilinear) or 3 (TSC).
logical ib_keep_ghost
 The interpolation or the wall probes read solid cells, so ghost cells keep the last correction.
logical ib_wall_quad
 ib_wall_order = 2: quadratic wall-normal ghost velocity at no-slip walls
logical centroid_offsets_active = .false.
 some patch is a moving airfoil or STL, which carries a centroid_offset
integer, parameter, private ib_rec_len = 7
 gbl_patch_id, force(1:3), torque(1:3)
integer, private n_ib_nbrs = 0
integer, dimension(:), allocatable, private ib_nbrs
integer, dimension(:), allocatable, private ib_send_counts
integer, dimension(:), allocatable, private ib_reqs
integer, dimension(:,:), allocatable, private ib_stats
integer, dimension(:,:), allocatable, private ib_reply_slots
integer, dimension(:), allocatable, private ib_reply_counts
 s_ib_exchange_heat: bodies each neighbor sent partials of
real(wp), dimension(:,:), allocatable, private ib_send_bufs
real(wp), dimension(:,:), allocatable, private ib_recv_bufs
real(wp), dimension(:,:), allocatable 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.

Detailed Description

Ghost-node immersed boundary method: locates ghost/image points, computes interpolation coefficients, and corrects the flow state.

Function/Subroutine Documentation

◆ f_cell_centre()

real(wp) function, dimension(3) m_ibm::f_cell_centre ( integer, dimension(3), intent(in) c)

Centre of cell c (z = 0 in 2D).

Definition at line 3877 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ f_cell_scale()

real(wp) function m_ibm::f_cell_scale ( type(ghost_point), intent(in) gp)

Smallest cell width at a ghost point's cell.

Definition at line 4065 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ f_curvature_u2()

real(wp) function m_ibm::f_curvature_u2 ( integer, intent(in) gp_patch_id,
real(wp), dimension(3), intent(in) n,
real(wp), dimension(3), intent(in) 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.

Definition at line 2046 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ f_face_theta()

real(wp) function m_ibm::f_face_theta ( type(scalar_field), dimension(sys_size), intent(in) q_prim_vf,
type(integer_field), intent(in) markers,
type(ghost_point), intent(in) gp,
real(wp), intent(in) t_ip,
real(wp), intent(in) 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.

Parameters
[in]markersib_markers, passed so the device routine reads the present copy

Definition at line 11381 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ f_flux_wall_record_area()

real(wp) function m_ibm::f_flux_wall_record_area ( type(scalar_field), dimension(ibw_a), intent(in) src,
type(scalar_field), intent(in) theta,
type(integer_field), intent(in) marks,
integer, dimension(3), intent(in) 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

Parameters
[in]marksib_markers, passed like src

Definition at line 11099 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ f_holds_twall()

pure logical function m_ibm::f_holds_twall ( integer, intent(in) thermal_bc)

The surface temperature is held at Twall: prescribed (thermal_bc = 1) or evolved by the heat balance (thermal_bc = 3).

Definition at line 4683 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ f_ib_cell_momentum()

real(wp) function m_ibm::f_ib_cell_momentum ( type(scalar_field), dimension(sys_size), intent(in) q_cons_vf,
type(scalar_field), dimension(sys_size), intent(in) q_prim_vf,
integer, intent(in) i,
integer, intent(in) j,
integer, intent(in) k,
integer, intent(in) 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.

Definition at line 7632 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ f_ib_face_area()

pure real(wp) function m_ibm::f_ib_face_area ( integer, intent(in) idir,
integer, intent(in) j,
integer, intent(in) k,
integer, intent(in) l )

Area of the face (j, k, l) normal to direction idir.

Definition at line 7686 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ f_ib_face_flux()

real(wp) function m_ibm::f_ib_face_flux ( logical, intent(in) hatr,
integer, intent(in) j,
integer, intent(in) k,
integer, intent(in) l,
integer, intent(in) 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.

Definition at line 7529 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ f_ib_face_mass()

real(wp) function m_ibm::f_ib_face_mass ( logical, intent(in) hatr,
integer, intent(in) j,
integer, intent(in) k,
integer, intent(in) l )

Mass flux through face (j, k, l).

Definition at line 7580 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ f_ib_nbr_slot()

integer function m_ibm::f_ib_nbr_slot ( integer, intent(in) rank)

Position of rank in ib_nbrs.

Definition at line 8672 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ f_ib_shard()

pure integer function m_ibm::f_ib_shard ( integer, intent(in) j,
integer, intent(in) k,
integer, intent(in) l )

The ib_part shard of cell or face (j, k, l); neighbouring cells, which a body's surface visits together, get different ones.

Definition at line 4709 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ f_ib_stage_weight()

pure real(wp) function m_ibm::f_ib_stage_weight ( integer, intent(in) stage)

Weight of RK stage stage in the step (SSP-RK: 1; 1/2, 1/2; 1/6, 1/6, 2/3).

Definition at line 7714 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ f_ib_volume()

pure real(wp) function m_ibm::f_ib_volume ( type(ib_patch_parameters), intent(in) ib_patch)

Solid volume of a circle (per unit depth), sphere or cylinder IB.

Definition at line 4735 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ f_ibm_fine_gps()

impure integer function, public m_ibm::f_ibm_fine_gps ( integer, intent(in) islot)

Ghost points stored for fine slot islot: zero for a block that holds no immersed body.

Definition at line 9330 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ f_log_cosh()

pure real(wp) function m_ibm::f_log_cosh ( real(wp), intent(in) x)

log(cosh(x)) without overflow for large |x|

Definition at line 7415 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ f_needs_centroid_offset()

pure logical function m_ibm::f_needs_centroid_offset ( type(ib_patch_parameters), intent(in) patch)

A moving airfoil or STL (geometries 4, 5, 11, 12) moves its centroid to the centre of mass and keeps a centroid_offset.

Definition at line 8381 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ f_quad_fill()

real(wp) function, private m_ibm::f_quad_fill ( real(wp), intent(in) phi_w,
real(wp), intent(in) phi_1,
real(wp), intent(in) phi_2,
real(wp), dimension(3), intent(in) lw,
real(wp), dimension(2), intent(in) llin )
private

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.

Definition at line 6821 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ f_tcond_file()

impure character(len=path_len + 2*name_len) function m_ibm::f_tcond_file ( integer, intent(in) 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).

Definition at line 4338 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ f_tsc_apply()

real(wp) function, private m_ibm::f_tsc_apply ( type(scalar_field), intent(in) sf,
integer, dimension(3), intent(in) ic,
real(wp), dimension(3, 3), intent(in) wd )
private

Apply TSC weights from s_tsc_weights to one field.

Definition at line 6654 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ f_tsc_fluid_mean()

real(wp) function m_ibm::f_tsc_fluid_mean ( type(scalar_field), intent(in) sf,
type(integer_field), intent(in) markers,
integer, dimension(3), intent(in) ic,
real(wp), dimension(3, 3), intent(in) wd )

TSC weights from s_tsc_weights applied to the gas cells only, renormalized.

Definition at line 6710 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ f_tsc_stencil()

real(wp) function, dimension(3, 3, 3) m_ibm::f_tsc_stencil ( real(wp), dimension(3, 3), intent(in) wd)

Tensor product of the 1D TSC weights: the coefficient on each cell of the 3x3x3 stencil.

Definition at line 6941 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ f_wall_column_dt()

impure real(wp) function, public m_ibm::f_wall_column_dt ( type(scalar_field), dimension(sys_size), intent(in) q_prim_vf,
type(scalar_field), intent(in) 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.

Definition at line 3968 of file m_ibm.fpp.f90.

◆ f_wall_face_sum()

real(wp) function m_ibm::f_wall_face_sum ( type(scalar_field), dimension(ibw_a), intent(in) src,
integer, intent(in) j,
integer, intent(in) k,
integer, intent(in) l,
integer, intent(in) 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)

Parameters
[in]srcib_wall_src, passed so the device routine reads the present copy

Definition at line 11039 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ f_wall_face_term()

real(wp) function m_ibm::f_wall_face_term ( type(scalar_field), dimension(ibw_a), intent(in) src,
integer, intent(in) j,
integer, intent(in) k,
integer, intent(in) l,
integer, intent(in) 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)

Definition at line 11069 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ f_wall_velocity()

real(wp) function, dimension(3) m_ibm::f_wall_velocity ( integer, intent(in) gp_patch_id,
real(wp), dimension(3), intent(in) r )

Velocity of the body's material point at r from its centroid: translation plus rotation about the centroid. Zero for a fixed body.

Definition at line 1992 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ f_wc_body_centre()

real(wp) function, dimension(3) m_ibm::f_wc_body_centre ( type(ghost_point), intent(in) gp)

Centre of the periodic image of a ghost point's circle or sphere.

Definition at line 3781 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ f_wc_dist()

real(wp) function m_ibm::f_wc_dist ( type(ghost_point), intent(in) gp,
real(wp), dimension(3), intent(in) cb,
real(wp), dimension(3), intent(in) x )

Signed wall distance of point x from a ghost point's circle or sphere (centre cb).

Definition at line 3830 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ s_accumulate_ib_face_fluxes()

subroutine m_ibm::s_accumulate_ib_face_fluxes ( integer, intent(in) idir,
integer, intent(in) stage,
type(scalar_field), dimension(sys_size), intent(in) q_cons_vf,
type(scalar_field), dimension(sys_size), intent(in) q_prim_vf,
type(integer_field), intent(in) 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).

Parameters
[in]markersib_markers, or ib_markers_fine on an AMR fine frame

Definition at line 7835 of file m_ibm.fpp.f90.

Here is the call graph for this function:

◆ s_accumulate_ib_mass()

subroutine m_ibm::s_accumulate_ib_mass ( integer, intent(in) idir,
integer, intent(in) 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.

Definition at line 7727 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_add_swept_cells()

impure subroutine, public m_ibm::s_add_swept_cells ( type(scalar_field), dimension(sys_size), intent(in) q_cons_vf,
type(scalar_field), dimension(sys_size), intent(in) q_start_vf,
real(wp), intent(in) a_w,
real(wp), intent(in) 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.

Definition at line 5349 of file m_ibm.fpp.f90.

Here is the call graph for this function:

◆ s_advance_markers_prev()

impure subroutine m_ibm::s_advance_markers_prev

ib_markers_prev = ib_markers over the whole halo

Definition at line 5466 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ s_blend_ghost_species()

subroutine m_ibm::s_blend_ghost_species ( real(wp), dimension(num_species), intent(in) ys_ip,
real(wp), dimension(num_species), intent(in) ys_s,
real(wp), dimension(num_species), intent(out) ys_g )

Species half of the ghost-state blend: one theta shared by every species (see s_blend_ghost_temperature).

Definition at line 11514 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ s_blend_ghost_temperature()

subroutine m_ibm::s_blend_ghost_temperature ( real(wp), intent(in) t_ip,
real(wp), intent(in) t_s,
real(wp), intent(in) t_lo,
real(wp), intent(in) t_hi,
real(wp), intent(in) theta_max,
real(wp), intent(out) t_g )

Ghost state for an immersed surface, from the image-point state and the surface state.

The natural closure is the linear mirror phi_g = 2*phi_s - phi_IP, which is what makes the midpoint of the ghost/image pair reproduce the surface value. Its -1 coefficient on phi_IP is unconditional, though, so it drives strictly positive quantities negative whenever the surface value sits far below the image-point value: a cold wall in hot gas gives a negative ghost temperature and hence a negative ghost density, and a species the surface consumes faster than half the free-stream value gives a negative mass fraction. Rather than clamp the result – which would break sum(Y) = 1 and hide the excursion – the ghost state is the largest convex blend of the mirror back toward the surface value that stays physical:

phi_g(theta) = phi_s + theta*(phi_s - phi_IP),   theta in [0, 1]

theta = 1 is the full second-order mirror; theta = 0 is the first-order Dirichlet ghost phi_g = phi_s, which is Gibou et al. (JCP 176:205, 2002) Eq. 17 and is what they likewise fall back to where the linear form is ill-behaved. One theta is shared by every species, so since both endpoints satisfy sum(Y) = 1, so does every blend between them – exactly, with no renormalization. Temperature gets its own theta: nothing couples it to the composition, and sharing would let a trace radical the surface consumes to ~1e-9 (O and OH at a burning carbon wall) drag the thermal mirror down with it, turning a 2100 K ghost into 1205 K over a species whose own excursion was 1e-9. The cost of limiting is small: the mirror already delivers only first-order wall flux (Ezra et al., Int. J. Heat Mass Transfer, 2025), and a boundary closure one order below the interior scheme retains the interior convergence rate (Gustafsson, Math. Comp. 29:396, 1975).

This bounds the ghost state; it does not make the boundary strictly conservative. Baskaya et al. (Computers & Fluids 270:106134, 2024) trace the same cold-wall, large-gradient regime in ablation to ghost-cell mass conservation error that surfaces as spurious blowing, and resolve it only by moving to a flux-based cut-cell boundary – a different discretization from this one, not a tuning of it.

Parameters
[in]theta_maxLargest mirror weight the caller allows (f_face_theta), at most 1

Definition at line 11473 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ s_check_every_patch_marked()

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.

Definition at line 9221 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ s_communicate_ib_forces()

subroutine m_ibm::s_communicate_ib_forces ( real(wp), dimension(num_ibs, 3), intent(inout) forces,
real(wp), dimension(num_ibs, 3), intent(inout) 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.

Definition at line 8857 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_compute_centroid_offset()

subroutine m_ibm::s_compute_centroid_offset ( integer, intent(in) gid,
integer, intent(in) 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.

Parameters
[in]gidglobal patch id
[in]ib_markerlocal index on this rank; <= 0 if not held

Definition at line 8316 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_compute_ghost_point_pressure()

subroutine, private m_ibm::s_compute_ghost_point_pressure ( type(ghost_point), intent(in) gp,
integer, intent(in) gp_patch_id,
real(wp), dimension(3), intent(in) radial_vector,
real(wp), dimension(3), intent(in) vel_ip,
real(wp), intent(in) rho,
real(wp), intent(in) pres_ip,
real(wp), intent(out) pres_gp )
private

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.

Parameters
[in]radial_vectorCentroid to ghost point

Definition at line 2108 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_compute_ghost_point_velocity()

subroutine, private m_ibm::s_compute_ghost_point_velocity ( type(ghost_point), intent(in) gp,
integer, intent(in) gp_patch_id,
real(wp), dimension(3), intent(in) radial_vector,
real(wp), dimension(3), intent(in) vel_ip,
real(wp), intent(in) pres_ip,
real(wp), intent(in) dh,
real(wp), dimension(3), intent(out) vel_gp,
type(scalar_field), dimension(sys_size), intent(in) q_prim_vf,
type(wall_fill), intent(in) wf )
private
Parameters
[in]dhh_IP - h_GP of a slip ghost (ib_slip_ccst); 0 where it does not apply
[in]q_prim_vfProbed by the quadratic fill

Definition at line 2155 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_compute_ib_forces()

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.

Definition at line 8187 of file m_ibm.fpp.f90.

Here is the call graph for this function:

◆ s_compute_image_points()

impure subroutine, private m_ibm::s_compute_image_points
private

Compute the image points for each ghost point.

Definition at line 5711 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ s_compute_interpolation_coeffs()

subroutine, private m_ibm::s_compute_interpolation_coeffs
private

Compute the interpolation coefficients for image points.

Definition at line 6384 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_compute_moment_of_inertia()

subroutine m_ibm::s_compute_moment_of_inertia ( type(ib_patch_parameters), intent(in) patch,
real(wp), dimension(3), intent(in) axis,
real(wp), intent(out) moment )

Computes the moment of inertia for an immersed boundary.

Definition at line 8421 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ s_conserve_ib_mass()

impure subroutine, public m_ibm::s_conserve_ib_mass ( type(scalar_field), dimension(sys_size), intent(inout) 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.

Definition at line 5277 of file m_ibm.fpp.f90.

◆ s_fill_uncovered_cells()

impure subroutine, public m_ibm::s_fill_uncovered_cells ( type(scalar_field), dimension(sys_size), intent(inout) q_cons_vf,
type(scalar_field), dimension(sys_size), intent(inout) q_start_vf,
type(scalar_field), dimension(sys_size), intent(inout) 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.

Definition at line 5526 of file m_ibm.fpp.f90.

Here is the call graph for this function:

◆ s_finalize_ibm_module()

impure subroutine, public m_ibm::s_finalize_ibm_module

Finalize the IBM module.

Definition at line 9939 of file m_ibm.fpp.f90.

◆ s_find_ghost_points()

subroutine, private m_ibm::s_find_ghost_points
private

Locate all ghost points in the domain.

Definition at line 5947 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_find_ghost_points_ordered()

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.

Definition at line 6133 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ s_find_num_ghost_points()

subroutine, private m_ibm::s_find_num_ghost_points ( integer, intent(out) num_gps_out)
private

Count the number of ghost points for memory allocation.

Definition at line 5859 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ s_handoff_ib_ownership()

subroutine m_ibm::s_handoff_ib_ownership

Swaps ownership of IBs and passes ownership of IBs to neighbor processors.

Definition at line 8960 of file m_ibm.fpp.f90.

Here is the call graph for this function:

◆ s_ib_bank_step()

pure subroutine m_ibm::s_ib_bank_step ( real(wp), intent(inout) bank,
real(wp), intent(out) rel,
real(wp), intent(in) dm,
integer, intent(in) 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.

Parameters
[in]n_relaxib_mass_relax, passed because a device routine does not see the global

Definition at line 5147 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ s_ib_exchange_heat()

impure subroutine m_ibm::s_ib_exchange_heat ( real(wp), intent(in) 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.

Definition at line 8690 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_ib_flux_wall_prepare()

impure subroutine, public m_ibm::s_ib_flux_wall_prepare ( type(scalar_field), dimension(sys_size), intent(in) 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.

Definition at line 10928 of file m_ibm.fpp.f90.

Here is the call graph for this function:

◆ s_ib_flux_wall_setup()

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.

Definition at line 10570 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_ib_migrate_banks()

impure subroutine m_ibm::s_ib_migrate_banks ( integer, intent(in) n_gain,
integer, dimension(:), intent(in) gain_gid,
integer, dimension(:), intent(in) gain_from,
integer, intent(in) 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.

Definition at line 8800 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_ib_shell_mass()

impure subroutine m_ibm::s_ib_shell_mass ( type(scalar_field), dimension(sys_size), intent(in) 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.

Definition at line 5179 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_ib_wall_src_buffers()

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

Definition at line 11143 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ s_ibm_advance_wall_columns()

impure subroutine, public m_ibm::s_ibm_advance_wall_columns ( type(scalar_field), dimension(sys_size), intent(in) q_cons_vf,
type(scalar_field), dimension(sys_size), intent(in) q_prim_vf,
type(scalar_field), intent(in) q_t_sf,
real(wp), intent(in) 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.

Definition at line 3511 of file m_ibm.fpp.f90.

Here is the call graph for this function:

◆ s_ibm_alloc_fine()

impure subroutine, public m_ibm::s_ibm_alloc_fine ( integer, intent(in) nslots,
integer, intent(in) f1_lo,
integer, intent(in) f1_hi,
integer, intent(in) f2_lo,
integer, intent(in) f2_hi,
integer, intent(in) f3_lo,
integer, intent(in) 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.

Definition at line 9275 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_ibm_check_bodies_on_one_rank()

impure subroutine, public m_ibm::s_ibm_check_bodies_on_one_rank ( integer(kind=8), dimension(:), intent(in) 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.

Definition at line 9407 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ s_ibm_correct_state()

subroutine, public m_ibm::s_ibm_correct_state ( type(scalar_field), dimension(sys_size), intent(inout) q_cons_vf,
type(scalar_field), dimension(sys_size), intent(inout) q_prim_vf,
real(stp), dimension(idwbuff(1)%beg:,idwbuff(2)%beg:,idwbuff(3)%beg:,1:,1:), intent(inout) pb_in,
real(stp), dimension(idwbuff(1)%beg:,idwbuff(2)%beg:,idwbuff(3)%beg:,1:,1:), intent(inout) mv_in,
integer, intent(in) lvl )

Update the conservative variables at the ghost points.

Parameters
[in,out]q_cons_vfPrimitive Variables
[in,out]q_prim_vfPrimitive Variables
[in]lvlAMR level of the frame (0 = the coarse grid), for the fill-tier tally

Host copies; amdflang reads Re_size stale cross-TU

Definition at line 2240 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_ibm_load_fine_markers()

impure subroutine, public m_ibm::s_ibm_load_fine_markers ( integer, intent(in) nb,
integer, dimension(nb), intent(in) slots,
integer, dimension(3, nb), intent(in) mext,
integer, intent(in) sd,
integer, intent(in) 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.

Definition at line 9433 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ s_ibm_marker_bounds()

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.

Definition at line 9254 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ s_ibm_note_fine_memory()

impure subroutine, public m_ibm::s_ibm_note_fine_memory

Note the fine IB state's memory for the end-of-run AMR table.

Definition at line 9306 of file m_ibm.fpp.f90.

◆ s_ibm_rebuild_corrected_gps()

impure subroutine m_ibm::s_ibm_rebuild_corrected_gps ( integer, intent(in) 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).

Definition at line 9781 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ s_ibm_reserve_park()

impure subroutine m_ibm::s_ibm_reserve_park ( integer, intent(in) islot,
integer, intent(in) 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).

Definition at line 9752 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ s_ibm_reset_fine_park()

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).

Definition at line 9319 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ s_ibm_restore_conduction_temperature()

subroutine, public m_ibm::s_ibm_restore_conduction_temperature ( type(scalar_field), intent(inout) 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.

Definition at line 4166 of file m_ibm.fpp.f90.

◆ s_ibm_restore_from_fine()

impure subroutine, public m_ibm::s_ibm_restore_from_fine ( integer, intent(in) islot)

Restore the coarse IB globals saved by s_ibm_swap_to_fine, parking the (possibly updated) fine state back in slot islot.

Definition at line 9617 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_ibm_set_conduction_temperature()

subroutine, public m_ibm::s_ibm_set_conduction_temperature ( type(scalar_field), intent(inout) 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.

Definition at line 4115 of file m_ibm.fpp.f90.

◆ s_ibm_setup()

impure subroutine, public m_ibm::s_ibm_setup

Initializes the values of various IBM variables, such as ghost points and image points.

Definition at line 1218 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_ibm_setup_fine()

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.

Definition at line 9874 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_ibm_swap_to_fine()

impure subroutine, public m_ibm::s_ibm_swap_to_fine ( integer, intent(in) islot,
logical, intent(in) 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.

Parameters
[in]gps_on_devicefine ghost points already present on device (per-stage correct path)

Definition at line 9462 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_ibm_tally_gps_by_body()

impure subroutine, public m_ibm::s_ibm_tally_gps_by_body ( integer(kind=8), dimension(:), intent(inout) 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.

Definition at line 9340 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ s_initialize_ibm_module()

impure subroutine, public m_ibm::s_initialize_ibm_module

Allocates memory for the variables in the IBM module.

Definition at line 753 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_interpolate_image_point()

subroutine, private m_ibm::s_interpolate_image_point ( type(scalar_field), dimension(sys_size), intent(in) q_prim_vf,
type(ghost_point), intent(in) gp,
real(wp), dimension(num_fluids), intent(inout) alpha_rho_ip,
real(wp), dimension(num_fluids), intent(inout) alpha_ip,
real(wp), intent(inout) pres_ip,
real(wp), dimension(3), intent(inout) vel_ip,
real(wp), intent(inout) c_ip,
real(wp), dimension(:), intent(inout), optional r_ip,
real(wp), dimension(:), intent(inout), optional v_ip,
real(wp), dimension(:), intent(inout), optional pb_ip,
real(wp), dimension(:), intent(inout), optional mv_ip,
real(wp), dimension(:), intent(inout), optional nmom_ip,
real(stp), dimension(idwbuff(1)%beg:,idwbuff(2)%beg:,idwbuff(3)%beg:,1:,1:), intent(in), optional pb_in,
real(stp), dimension(idwbuff(1)%beg:,idwbuff(2)%beg:,idwbuff(3)%beg:,1:,1:), intent(in), optional mv_in,
real(wp), dimension(:), intent(inout), optional presb_ip,
real(wp), dimension(:), intent(inout), optional massv_ip,
real(wp), dimension(:), intent(inout), optional ys_ip )
private

Interpolate primitive variables to a ghost point's image point using bilinear or trilinear interpolation.

Parameters
[in]q_prim_vfPrimitive Variables
[in,out]ys_ipInterpolated species mass fractions (chemistry)

Definition at line 7056 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ s_interpolation_weights()

subroutine, private m_ibm::s_interpolation_weights ( type(ghost_point), intent(in) gp,
integer, intent(in) i,
integer, intent(in) j,
integer, intent(in) k,
real(wp), dimension(2, 2, 2), intent(in) dist,
real(wp), dimension(2, 2, 2), intent(in) fluid_mask,
real(wp), dimension(2, 2, 2), intent(out) interp_coeffs )
private

Fluid-masked image-point weights: bilinear for second-order IBM, else inverse distance squared.

Parameters
[in]klower corner of the stencil

Definition at line 6994 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ s_lag3_weights()

subroutine m_ibm::s_lag3_weights ( type(integer_field), intent(in) markers,
real(wp), dimension(3), intent(in) loc,
integer, dimension(3), intent(out) ic,
real(wp), dimension(3, 3), intent(out) wd,
real(wp), intent(out) 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.

Definition at line 6775 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_pack_ghost_tcond()

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).

Definition at line 4216 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ s_pick_bath_species()

subroutine m_ibm::s_pick_bath_species ( real(wp), dimension(num_species), intent(in) ys_s,
integer, intent(out) k_bath )

Index of the most abundant species, i.e. the balance the sum constraint displaces.

Closing sum(Y) = 1 by dropping one species' flux balance is standard (Surface CHEMKIN), but the dropped species absorbs the roundoff of every other balance, so it must be the bath gas. Dropping a fixed index instead – the last species in the mechanism – lands that error on whatever the mechanism happens to list last, which for the reduced GRI mechanism shipped with the reacting-surface example is H2O2, a trace radical whose own surface balance then goes unenforced. Cantera's solveSP re-scans for the largest species each iteration (evalSurfLarge) for this reason.

Definition at line 11557 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ s_prescribed_kinematics()

subroutine m_ibm::s_prescribed_kinematics ( integer, intent(in) i,
real(wp), intent(in) 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.

Definition at line 7443 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_read_ib_conduction_temperature()

impure subroutine, public m_ibm::s_read_ib_conduction_temperature ( integer, intent(in) 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.

Definition at line 4452 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_record_gp_surface()

subroutine m_ibm::s_record_gp_surface ( integer, intent(in) i,
type(ghost_point), intent(in) gp,
real(wp), intent(in) t_s,
real(wp), intent(in) mdot_s,
logical, intent(in) 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.

Definition at line 4579 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_report_ibm_surface()

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.

Definition at line 4535 of file m_ibm.fpp.f90.

◆ s_restore_centroid_offsets()

impure subroutine m_ibm::s_restore_centroid_offsets ( real(wp), intent(in) 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.

Definition at line 8391 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_setup_ib_force_comm()

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.

Definition at line 8629 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ s_sift_gp()

pure subroutine m_ibm::s_sift_gp ( integer, dimension(:), intent(inout) order,
integer(8), dimension(:), intent(in) key,
integer, intent(in) root,
integer, intent(in) last )

Restore the max-heap rooted at root over order(1:last), comparing by key.

Definition at line 5689 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ s_solve_surface()

subroutine m_ibm::s_solve_surface ( real(wp), intent(in) pres,
real(wp), intent(in) t_ip,
real(wp), intent(in) t_wall,
real(wp), intent(in) d,
real(wp), dimension(num_species), intent(in) ys_ip,
real(wp), dimension(num_species), intent(in) w_species,
integer, intent(in) thermal_bc,
real(wp), dimension(num_species), intent(out) ys_s,
real(wp), intent(out) t_s,
real(wp), intent(out) mdot_s,
logical, intent(out) converged )

Newton solve for a reacting surface. thermal_bc=0: zero-normal-gradient T; 1: prescribed T; 2: energy balance.

Definition at line 11588 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_solve_surface_linear_system()

subroutine m_ibm::s_solve_surface_linear_system ( real(wp), dimension(num_species + 1, num_species + 1), intent(inout) a,
real(wp), dimension(num_species + 1), intent(inout) b,
real(wp), dimension(num_species + 1), intent(out) x,
integer, intent(in) nsolve,
logical, intent(out) success )

Small dense linear solve with partial pivoting for the local surface Newton system.

Definition at line 11756 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ s_sort_gps_by_location()

pure subroutine m_ibm::s_sort_gps_by_location ( integer, dimension(:), intent(out), allocatable 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.

Definition at line 5662 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_surface_energy_residual()

subroutine m_ibm::s_surface_energy_residual ( real(wp), intent(in) pres,
real(wp), intent(in) t_ip,
real(wp), intent(in) t_s,
real(wp), intent(in) d,
real(wp), dimension(num_species), intent(in) ys_s,
real(wp), intent(out) r_energy )

Surface energy residual: gas-side conduction balances heterogeneous reaction heat. Radiation and solid-side conduction are omitted.

Definition at line 11294 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ s_surface_residual()

subroutine m_ibm::s_surface_residual ( real(wp), intent(in) pres,
real(wp), intent(in) t_ip,
real(wp), intent(in) t_s,
real(wp), intent(in) d,
real(wp), dimension(num_species), intent(in) ys_ip,
real(wp), dimension(num_species), intent(in) ys_s,
real(wp), dimension(num_species), intent(in) w_species,
integer, intent(in) k_bath,
logical, intent(in) solve_temperature,
real(wp), intent(in) flux_scale,
real(wp), intent(in) energy_scale,
real(wp), dimension(num_species + 1), intent(out) r,
real(wp), dimension(num_species), intent(out) r_species,
real(wp), dimension(num_species), intent(out) omega_s,
real(wp), intent(out) 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.

Definition at line 11330 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_surface_species_residual()

subroutine m_ibm::s_surface_species_residual ( real(wp), intent(in) pres,
real(wp), intent(in) t_s,
real(wp), intent(in) d,
real(wp), dimension(num_species), intent(in) ys_ip,
real(wp), dimension(num_species), intent(in) ys_s,
real(wp), dimension(num_species), intent(in) w_species,
real(wp), dimension(num_species), intent(out) r_species,
real(wp), dimension(num_species), intent(out) omega_s,
real(wp), intent(out) mdot_s )

Species flux residual at a heterogeneous reacting surface.

Definition at line 11235 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ s_tsc_weights()

subroutine m_ibm::s_tsc_weights ( type(integer_field), intent(in) markers,
real(wp), dimension(3), intent(in) loc,
integer, dimension(3), intent(out) stencil_center,
real(wp), dimension(3, 3), intent(out) axis_weights,
real(wp), intent(out) 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.

Parameters
[in]markersib_markers, passed so the device routine reads the caller's present copy
[out]stencil_centerCell nearest to loc, centring the stencil
[out]axis_weights1D weights on stencil_center - 1, +0, +1, per direction
[out]fluid_fracFraction of the stencil weight on fluid cells

Definition at line 6521 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ s_unpack_ghost_tcond()

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.

Definition at line 4280 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ s_update_ib_rotation_matrices()

subroutine m_ibm::s_update_ib_rotation_matrices ( integer, intent(in) 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).

Definition at line 7275 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ s_update_ib_temperatures()

impure subroutine, public m_ibm::s_update_ib_temperatures ( real(wp), intent(in) dt_step,
type(scalar_field), dimension(sys_size), intent(in) 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.

Definition at line 4774 of file m_ibm.fpp.f90.

Here is the call graph for this function:

◆ s_update_mib()

impure subroutine m_ibm::s_update_mib ( integer, intent(in) num_ibs)

Definition at line 7322 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_wall_column_setup()

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).

Definition at line 3147 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_wall_column_tcond()

impure subroutine, public m_ibm::s_wall_column_tcond ( type(scalar_field), dimension(sys_size), intent(in) q_cons_vf,
type(scalar_field), dimension(sys_size), intent(in) q_prim_vf,
type(scalar_field), intent(in) 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.

Definition at line 3660 of file m_ibm.fpp.f90.

◆ s_wall_fill()

subroutine, private m_ibm::s_wall_fill ( type(ghost_point), intent(in) gp,
type(wall_fill), intent(out) wf )
private

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|):

phi_g = L0 phi_w + L1 phi_1 + L2 phi_2
L0 = (d + s1)(d + s2)/(s1 s2),  L1 = -d (d + s2)/(s1 (s2 - s1)),  L2 = d (d + s1)/(s2 (s2 - s1))

(d = ghost_depth, s1 = probe1_dist, s2 = probe2_dist below.) L0 + L1 + L2 = 1 and at d = 0 they reduce to (1, 0, 0), so the wall value is exact on the wall. s1 = max(h, d) bounds the weights by (3, -3, 1) at any ghost depth. Tier 1 uses both probes; tier 2 is the linear mirror where the outer probe has too little fluid around it (a narrow gap, a rim, a neighbouring body); tier 3 leaves the default treatment.

Definition at line 6886 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_wc_axis()

subroutine m_ibm::s_wc_axis ( type(ghost_point), intent(in) gp,
real(wp), intent(out) sm,
real(wp), dimension(3), intent(out) nrm,
real(wp), dimension(3), intent(out) foot )

A wall column's length s_m = max(3h, L) (L = wall_column_len, default 0.15 R), unit normal and wall foot.

Definition at line 3749 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_wc_face_metric()

subroutine m_ibm::s_wc_face_metric ( integer, dimension(3), intent(in) c,
integer, intent(in) dir,
integer, dimension(3), intent(in) nb,
real(wp), intent(out) area,
real(wp), intent(out) h )

Area of the face between cells c and nb (neighbours along dir) and the distance between their centres.

Definition at line 3926 of file m_ibm.fpp.f90.

Here is the caller graph for this function:

◆ s_wrap_periodic_ibs()

subroutine m_ibm::s_wrap_periodic_ibs

Wrap immersed boundary positions across periodic domain boundaries.

Definition at line 8510 of file m_ibm.fpp.f90.

◆ s_write_ib_conduction_temperature()

impure subroutine, public m_ibm::s_write_ib_conduction_temperature ( integer, intent(in) 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.

Definition at line 4359 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_write_ib_surface()

impure subroutine, public m_ibm::s_write_ib_surface ( integer, intent(in) save_count)

Write this rank's surface records to D/ib_surface_<rank>_<save>.dat, one line per weighted ghost point.

Definition at line 4639 of file m_ibm.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ centroid_offsets_active

logical m_ibm::centroid_offsets_active = .false.

some patch is a moving airfoil or STL, which carries a centroid_offset

Definition at line 724 of file m_ibm.fpp.f90.

◆ corrected_gps

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.

Definition at line 508 of file m_ibm.fpp.f90.

◆ ghost_points

type(ghost_point), dimension(:), allocatable m_ibm::ghost_points

Definition at line 522 of file m_ibm.fpp.f90.

◆ gp_prim_new

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.

Definition at line 528 of file m_ibm.fpp.f90.

◆ gp_slab

integer, dimension(:), allocatable m_ibm::gp_slab

per-i-slab ghost-point counts/offsets for the ordered gather (AMR)

Definition at line 548 of file m_ibm.fpp.f90.

◆ gp_surf

real(wp), dimension(:,:), allocatable m_ibm::gp_surf

Definition at line 566 of file m_ibm.fpp.f90.

◆ gp_tc_rec

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.

Definition at line 546 of file m_ibm.fpp.f90.

◆ 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

Definition at line 605 of file m_ibm.fpp.f90.

◆ ib_face_ft

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.

Definition at line 736 of file m_ibm.fpp.f90.

◆ ib_heat

real(wp), dimension(:,:), allocatable m_ibm::ib_heat

Definition at line 629 of file m_ibm.fpp.f90.

◆ ib_ip_width

integer m_ibm::ib_ip_width

Cells per direction in the image-point interpolation stencil: 2 (inverse distance, bilinear) or 3 (TSC).

Definition at line 709 of file m_ibm.fpp.f90.

◆ ib_keep_ghost

logical m_ibm::ib_keep_ghost

The interpolation or the wall probes read solid cells, so ghost cells keep the last correction.

Definition at line 710 of file m_ibm.fpp.f90.

◆ ib_markers

type(integer_field), public m_ibm::ib_markers

Definition at line 475 of file m_ibm.fpp.f90.

◆ ib_markers_fine

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.

Definition at line 492 of file m_ibm.fpp.f90.

◆ ib_markers_prev

type(integer_field) m_ibm::ib_markers_prev

Definition at line 664 of file m_ibm.fpp.f90.

◆ ib_mass_only

logical m_ibm::ib_mass_only = .false.

only the mass is accumulated, from fixed bodies without AMR (s_accumulate_ib_mass)

Definition at line 606 of file m_ibm.fpp.f90.

◆ ib_nbrs

integer, dimension(:), allocatable, private m_ibm::ib_nbrs
private

Definition at line 729 of file m_ibm.fpp.f90.

◆ ib_nheat

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.

Definition at line 628 of file m_ibm.fpp.f90.

◆ ib_nshard

integer, parameter m_ibm::ib_nshard = 32

a power of two (f_ib_shard)

Definition at line 647 of file m_ibm.fpp.f90.

◆ ib_part

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.

Definition at line 646 of file m_ibm.fpp.f90.

◆ ib_rec_len

integer, parameter, private m_ibm::ib_rec_len = 7
private

gbl_patch_id, force(1:3), torque(1:3)

Definition at line 727 of file m_ibm.fpp.f90.

◆ ib_recv_bufs

real(wp), dimension(:,:), allocatable, private m_ibm::ib_recv_bufs
private

Definition at line 731 of file m_ibm.fpp.f90.

◆ ib_reply_counts

integer, dimension(:), allocatable, private m_ibm::ib_reply_counts
private

s_ib_exchange_heat: bodies each neighbor sent partials of

Definition at line 730 of file m_ibm.fpp.f90.

◆ ib_reply_slots

integer, dimension(:,:), allocatable, private m_ibm::ib_reply_slots
private

Definition at line 730 of file m_ibm.fpp.f90.

◆ ib_reqs

integer, dimension(:), allocatable, private m_ibm::ib_reqs
private

Definition at line 729 of file m_ibm.fpp.f90.

◆ ib_send_bufs

real(wp), dimension(:,:), allocatable, private m_ibm::ib_send_bufs
private

Definition at line 731 of file m_ibm.fpp.f90.

◆ ib_send_counts

integer, dimension(:), allocatable, private m_ibm::ib_send_counts
private

Definition at line 729 of file m_ibm.fpp.f90.

◆ ib_shell

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).

Definition at line 664 of file m_ibm.fpp.f90.

◆ ib_shell_width

integer, parameter m_ibm::ib_shell_width = 2

Definition at line 665 of file m_ibm.fpp.f90.

◆ ib_slot_cap

integer m_ibm::ib_slot_cap = 0

slots of ib_heat and ib_part: a bound on the bodies one rank holds

Definition at line 678 of file m_ibm.fpp.f90.

◆ ib_stats

integer, dimension(:,:), allocatable, private m_ibm::ib_stats
private

Definition at line 729 of file m_ibm.fpp.f90.

◆ ib_surf_nvars

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.

Definition at line 565 of file m_ibm.fpp.f90.

◆ ib_wall_col

logical, public m_ibm::ib_wall_col = .false.

Some IB has wall_column (m_ib_wall_column).

Definition at line 607 of file m_ibm.fpp.f90.

◆ ib_wall_quad

logical m_ibm::ib_wall_quad

ib_wall_order = 2: quadratic wall-normal ghost velocity at no-slip walls

Definition at line 711 of file m_ibm.fpp.f90.

◆ ib_wall_src

type(scalar_field), dimension(ibw_a), public m_ibm::ib_wall_src

Definition at line 588 of file m_ibm.fpp.f90.

◆ ib_wall_theta

type(scalar_field), public m_ibm::ib_wall_theta

Definition at line 589 of file m_ibm.fpp.f90.

◆ ibw_a

integer, parameter, public m_ibm::ibw_a = num_species + 5

Definition at line 585 of file m_ibm.fpp.f90.

◆ ibw_e

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

Definition at line 584 of file m_ibm.fpp.f90.

◆ ibw_u

integer, parameter, public m_ibm::ibw_u = num_species + 2

Definition at line 584 of file m_ibm.fpp.f90.

◆ moving_immersed_boundary_flag

logical m_ibm::moving_immersed_boundary_flag

Definition at line 707 of file m_ibm.fpp.f90.

◆ n_fill_tier

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.

Definition at line 474 of file m_ibm.fpp.f90.

◆ n_ib_nbrs

integer, private m_ibm::n_ib_nbrs = 0
private

Definition at line 728 of file m_ibm.fpp.f90.

◆ n_surface_ill_posed

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.

Definition at line 460 of file m_ibm.fpp.f90.

◆ n_surface_not_converged

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.

Definition at line 456 of file m_ibm.fpp.f90.

◆ num_gps

integer, public m_ibm::num_gps

Number of ghost points.

Definition at line 679 of file m_ibm.fpp.f90.

◆ record_surface

logical m_ibm::record_surface

gp_surf is filled when it is written (ib_surface_wrt) or integrated (ib_exchange).

Definition at line 604 of file m_ibm.fpp.f90.

◆ tcond_chunk

integer, parameter m_ibm::tcond_chunk = 65536

records per block read or written of an ib_tcond file

Definition at line 543 of file m_ibm.fpp.f90.

◆ tcond_magic

integer(kind=8), parameter m_ibm::tcond_magic = 7164990_8

first header word of restart_data/ib_tcond files

Definition at line 541 of file m_ibm.fpp.f90.

◆ tcond_version

integer(kind=8), parameter m_ibm::tcond_version = 1_8

format version of the ib_tcond header

Definition at line 542 of file m_ibm.fpp.f90.

◆ wc_ready

logical m_ibm::wc_ready = .false.

Columns initialized (from the gas, at the first step of a run or restart).

Definition at line 608 of file m_ibm.fpp.f90.