Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions docs/documentation/case.md
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ The measured accuracy of the wall value and wall-normal gradient, and which opti
| `ib_mass_relax` | Integer | Immersed-boundary mass conservation: N > 0 returns each body's spurious gas mass over about N steps; 0 off; -1 (default) auto, see below. |
| `ib_uncover_fill` | Logical | A cell a moving body uncovers takes the mean density, species and pressure of its fluid neighbours instead of its stale ghost state (`model_eqns = 2`, HLLC, Cartesian, no `amr`). |
| `wall_column_dt_frac` | Real | Wall columns: largest fraction of a near-wall cell's heat span a step's column drain may take, a time-step limit (`WCOL`; default 0.1). |
| `ib_smooth_contact` | Logical | HLLC only: blend the tangential interface velocity of the viscous work across the contact wave (the sign of the contact speed is arbitrary where it is round-off). |
| `ib_smooth_contact` | Logical | No effect; kept so older case files run (HLLC now always uses the central tangential velocity in the viscous work). |
| `ib_visc_compact` | Logical | With `weno_Re_flux`, compact velocity gradients on the viscous faces within two cells of a body. |
| `geometry` | Integer | Geometry configuration of the patch.|
| `x[y,z]_centroid` | Real | Centroid of the applied geometry in the [x,y,z]-direction. |
Expand Down Expand Up @@ -515,7 +515,7 @@ Additional details on this specification can be found in [NACA airfoil](https://
Measured gain (non-reacting ideal gas, tip or peak Mach 0.05, 4 to 80 cells across the gap, NVHPC on an A100): between flat walls (plane Poiseuille) the velocity and flow-rate errors are 10 to 20 times smaller than with the default and converge at about order 1.5 to 1.9 until they reach the level of a domain no-slip boundary, whatever the wall position inside a cell; the default converges at order 1 with the no-slip acting about 0.75 cell outside the wall. In a Taylor-Couette annulus (curved walls, one rotating) the gain is 25 to 40 % of the velocity error and a factor 2 or more in the torque, and neither option converges monotonically: an error of about 0.5 % of the torque and 0.3 % of the wall speed remains at 80 cells per inner radius, and the rotating wall keeps a velocity deficit that this option halves but does not remove. With 4 to 6 cells across the gap 15 to 32 % of the ghost points use the linear mirror and the quadratic fill is not accurate (26 % velocity error at 4 cells across a flat channel). The wall shear read back from a fit to the near-wall cells does not converge for either option; use the flow rate or an integrated force instead.
- `ib_mass_relax = N` (N > 0) makes the gas gain exactly the mass each body gasifies (none for an inert body). The ghost-cell treatment does not conserve mass at a moving or slip wall: gas flows through the body's faces into ghost cells whose values are then overwritten, and cells change side as a body moves, so the gas total drifts with the distance travelled and converges slowly with the grid. Each step the gas mass a body exchanged (the face fluxes, as `ib_heat_wrt` reports them, and the cells it covered or uncovered) minus its gasification rate is added to that body's account, and 1/N of the account is taken out of (or put into) the fluid cells within two cells of the body, scaling their partial densities, momentum, energy and species by one factor, so velocity, temperature and composition are unchanged. `N = 1` returns the mass in the step it occurs (the choice for a fixed slip wall); a larger N smooths the correction over N steps. Only mass is booked for the swept cells; their energy is not. The account is saved in the IB state record (`restart_data/ib_state`), so a restart continues the relaxation exactly. Requires `model_eqns = 2`, Cartesian coordinates, and no `igr`, bubbles or `amr`. The default `-1` resolves at start-up to `N = 30` when any body moves, else to 0; a fixed slip wall keeps the leak unless `ib_mass_relax = 1` is set (it returns the mass in the step it occurs, at a few percent of a step on an A100 and more on an MI300A). It is also 0 whenever an explicit value would be refused (`amr`, cylindrical coordinates, `igr`, bubbles, `model_eqns /= 2`, a blowing body), when a body has a surface reaction (`ib_flux_wall` conserves the gas there), and with `hypoelasticity` or `mhd` (their extra variables are not scaled). `0` turns it off. Measured (inviscid ideal gas, A100 and MI300A agree to the printed digits): a circle translating at Mach 0.3 through gas at rest in a periodic box 8 diameters long changes the gas mass by +1.6e-3, +9e-4 and +6e-4 per passage through the box at 16, 24 and 32 cells per diameter, and by under 3e-5 with `N = 5` or `30`; a fixed slip circle at Mach 0.5 gains 0.27 to 0.36 % per flow-through at 16 to 32 cells per diameter and 2e-13 with `N = 1`. The correction takes under 1e-4 of the shell's gas per step, and changes the drag by 0.2 % (`N = 30`) to 1 % (`N = 1`); it hardly moves a body's Galilean twin (a translating body against the same body held in moving gas): at 40 cells per diameter the twin mismatch of the force changes by under 0.01, and the moving-to-held ratio of the conducted heat of a cold cylinder rises from 0.755 to 0.788 at 16 cells per diameter and from 0.879 to 0.915 at 32. For fixed no-slip bodies with chemistry `ib_flux_wall` already conserves the gas to round-off, and `N = 1` reaches the same total with it or without it.
- `ib_uncover_fill = T` gives a cell that a moving body uncovers (solid at the last Runge-Kutta placement, fluid now) the mean density, species and pressure of the neighbours in its 3x3(x3) that were fluid at both placements, instead of the cold ghost state it last held (its velocity is kept: averaging it too made the drag of a moving body agree worse with its Galilean twin). With the default, a cold moving wall leaves a trail of such cells, which creates gas mass and drains energy at a rate first order in the cell size. The filled state is also what `ib_heat_wrt` and `ib_mass_relax` book for the uncovered cell, so their accounts stay closed. Off by default.
- `ib_smooth_contact = T` (HLLC, `viscous`) blends the left and right states of the tangential interface velocity in the viscous work over `|s_S| < 0.01 c` instead of switching on the sign of the contact speed `s_S`. A face between a fluid cell and a ghost cell whose `s_S` is round-off would otherwise pick one side arbitrarily, although the two tangential velocities differ by order one across the ghost mirror, so builds and devices could disagree there. Faces away from `s_S = 0` are unchanged. The default `F` leaves every result unchanged.
- `ib_smooth_contact` has no effect and is kept only so older case files run. It blended the HLLC tangential interface velocity of the viscous work near the contact; HLLC now uses the central average of the two sides there everywhere (see `riemann_solver`).
- `ib_visc_compact = T` (requires `weno_Re_flux`) replaces the WENO velocity gradient on the viscous faces within two cells of a body cell by the compact one of `weno_Re_flux = F`: the normal difference across the face and the mean of the two cells' central tangential differences. The gradient of `weno_Re_flux` is built from reconstructed face values, a divergence-theorem cell gradient and a second reconstruction, a stencil about five cells wide, while the ghost values extend the flow only a layer or two into the body (the mirror leaves a kink at the wall), so the wide stencil carries the kink into the fluid faces next to the wall. Faces farther than two cells from a body are unchanged. The default `F` leaves every result unchanged.

- `ib_neighborhood_radius` controls the size of the neighborhood size. A value of $r$ indicates that any given rank is aware of IBs up to $r$ ranks away. This value defaults to 0, which leaves the radius unset so that it is selected automatically. This parameter is required to strong-scale a case when IBs eventually grow to be larger than one full processor domain wide.
Expand Down Expand Up @@ -652,7 +652,7 @@ See @ref equations "Equations" for the mathematical models these parameters cont
| `avg_state` | Integer | Averaged state evaluation method: [1] Roe average*; [2] Arithmetic mean |
| `wave_speeds` | Integer | Wave-speed estimation: [1] Direct (\cite Batten97); [2] Pressure-velocity* (\cite Toro09) |
| `weno_Re_flux` | Logical | Compute velocity gradient using scalar divergence theorem |
| `weno_Re_flux_compact` | Logical | With `weno_Re_flux`, take the face-normal velocity gradient as the difference across the face |
| `weno_Re_flux_compact` | Logical | With `weno_Re_flux`, take the face-normal velocity gradient as the difference across the face (default T in Cartesian coordinates) |
| `weno_avg` | Logical | Arithmetic mean of left and right, WENO-reconstructed, cell-boundary values |
| `dt` | Real | Time step size |
| `t_step_start` | Integer | Simulation starting time step |
Expand Down Expand Up @@ -762,6 +762,7 @@ Use it when a shock collapses onto a near-vacuum region (blast and implosion cen

- `riemann_solver` specifies the choice of the Riemann solver that is used in simulation by an integer from 1 through 4.
`riemann_solver = 1`, `2`, and `3` correspond to HLL, HLLC, and Exact Riemann solver, respectively (\cite Toro09).
With `viscous`, the HLLC viscous work \f$\mathbf{u}\cdot\boldsymbol\tau\f$ at a face takes the tangential velocity as the central average of the left and right states, not the contact-upwinded state. At a no-slip wall face (domain `bc = -16` or an immersed-boundary ghost) the contact speed is round-off while the two tangential velocities differ by order one across the mirror, so the upwinded choice depended on the compiler and device; away from walls the two differ by the reconstruction error.
`riemann_solver = 4` is the HLLD solver for MHD or hypoelasticity simulations. For MHD it resolves 5 of the full seven-wave structure of the MHD equations (\cite Miyoshi05).

- `hll_u_interface`: Selects between two HLL discretizations of volume fraction advection (`riemann_solver = 1`):
Expand All @@ -779,7 +780,7 @@ Use it when a shock collapses onto a near-vacuum region (blast and implosion cen
- `weno_Re_flux` activates the scalar divergence theorem in computing the velocity gradients using WENO-reconstructed cell boundary values.
If this option is false, velocity gradient is computed using finite difference scheme of order 2 which is independent of the WENO order.

- `weno_Re_flux_compact` (requires `weno_Re_flux`, Cartesian coordinates) replaces, on every face, the face-normal velocity gradient of the viscous flux by the difference across the face, `(u_{j+1} - u_j)/(x_{j+1} - x_j)`, the gradient that `weno_Re_flux = F` uses. The tangential and cross gradients keep the WENO chain, and the default `F` leaves every result unchanged.
- `weno_Re_flux_compact` (requires `weno_Re_flux`, Cartesian coordinates) replaces, on every face, the face-normal velocity gradient of the viscous flux by the difference across the face, `(u_{j+1} - u_j)/(x_{j+1} - x_j)`, the gradient that `weno_Re_flux = F` uses. The tangential and cross gradients keep the WENO chain. It is on by default wherever it applies (`weno_Re_flux = T` in Cartesian coordinates); `weno_Re_flux_compact = F` gives the earlier WENO-chain face gradient. With it on, the viscous time-step cap is the face-difference one (0.56/0.61/0.64 in 1D/2D/3D) instead of 1.
The WENO chain (face values, divergence-theorem cell gradient, reconstruction of that gradient, face mean) has a damping rate of exactly zero at the checkerboard wavenumber: a periodic box with a seeded u(y) = (-1)^j mode decays at rate 0.000 with `weno_Re_flux`, at 4 nu/dy^2 (20.5 at nu = 0.005, 32 cells) with `weno_Re_flux = F` or this option, and a smooth mode decays at the exact nu k^2 either way.
At a no-slip wall (`bc_y%%beg = -16`) the odd-mirror ghost forces that band, and the velocity next to the wall alternates about the exact profile (up to 6 % of the bulk velocity in the first four cells of a 32-cell channel with HLLC, 12 % in the hot-wall thermal channel); the option removes it.
The face difference has the explicit viscous time-step limit of `weno_Re_flux = F`, below that of the WENO chain, and the adaptive viscous step is capped to it (see `cfl_target`).
Expand Down
2 changes: 1 addition & 1 deletion docs/documentation/ib_accuracy_limits.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Reading the table:
| No-slip velocity at a flat or curved static wall | `ib_wall_order = 2` | measured gain and where it fails (4 to 6 cells across a gap): the `ib_wall_order` entry of @ref case "the case documentation" |
| Force and heat of a cylinder or sphere | face-flux force `ib_force_wrt`, heat `ib_heat_wrt` | agree with references and with a momentum balance: @ref validation_cyl_drag_nu |
| Gas mass of a closed box with a body | `ib_flux_wall = T` (reacting or inert fixed no-slip body); `ib_mass_relax` for slip or moving bodies | `examples/2D_ibm_wall_mass_budget` |
| A body in contact with a no-slip or moving wall differing between CPU and GPU builds (about 1e-5) | no setting closes it: `ib_smooth_contact = T` (HLLC) removes one cause but the measured A100-against-CPU difference stays ([#2419](https://github.com/MFlowCode/MFC/issues/2419)); budget the tolerance | the `ib_smooth_contact` entry of the case documentation |
| A body in contact with a no-slip or moving wall differing between CPU and GPU builds (about 1e-5) | no setting closes it: the central tangential velocity of the HLLC viscous work (always on) removed one cause, but the measured A100-against-CPU difference stays ([#2419](https://github.com/MFlowCode/MFC/issues/2419)); budget the tolerance | the `riemann_solver` entry of the case documentation |
| Wall shear or local heat flux | read an integrated force or total wall heat instead | a local fit through the near-wall cells does not converge for any option above |

The options are described in @ref ibm "the immersed-boundary overview". Resolution is the remaining lever: the gradient errors above fall by about a factor of 2 per grid doubling.
Expand Down
6 changes: 3 additions & 3 deletions docs/documentation/ibm.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ Moving-body kinematics and the restitution of a wall collision are checked in [V
| `ib_second_order_vel`, `ib_ip_min_dist` | linear ghost-velocity extrapolation; minimum image-point distance |
| `ib_ip_interp = 2` | triangular-shaped-cloud image-point interpolation instead of inverse-distance weights |
| `ib_wall_order = 2` | two-probe quadratic wall-normal ghost velocity at no-slip walls |
| `ib_slip_ccst`, `ib_smooth_contact`, `ib_uncover_fill` | slip-wall ghost state, HLLC contact blending in the viscous work, fill of cells a moving body uncovers |
| `weno_Re_flux`, `ib_visc_compact` | compact velocity gradient on the viscous faces within two cells of a body |
| `ib_slip_ccst`, `ib_uncover_fill` | slip-wall ghost state, fill of cells a moving body uncovers (`ib_smooth_contact` no longer has an effect) |
| `weno_Re_flux`, `weno_Re_flux_compact`, `ib_visc_compact` | the face-normal viscous gradient as a face difference (on by default) and the compact velocity gradient on the viscous faces within two cells of a body |
| `ib_mass_relax` | returns the spurious gas mass of a body over about N steps; the default resolves at start-up (see the parameter entry) |

Each option has a default that leaves existing results unchanged, except `ib_mass_relax`, whose default depends on whether a body moves.
Each option has a default that leaves existing results unchanged, except `ib_mass_relax`, whose default depends on whether a body moves, and `weno_Re_flux_compact`, which is on by default.
Drag and Nusselt number of a cylinder: @ref validation_cyl_drag_nu. Interpolation against an exact conduction solution: @ref validation_tsc_annulus. Slip walls (mass budget, exact vortex, known failures): @ref validation_slip_walls. Lumped cooling and the wall conduction column: @ref validation_wall_thermal.

## Heat transfer and chemistry
Expand Down
4 changes: 0 additions & 4 deletions src/common/m_constants.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ module m_constants
real(wp), parameter :: T_surface_max = 5000._wp
real(wp), parameter :: T_cond_unset = -huge(1._wp) !< ghost_point%T_cond of a ghost whose conduction uses its own T

!> Half-width of the contact-speed ramp, as a fraction of the sound speed, over which the HLLC tangential interface velocity
!! blends between the left and right states (ib_smooth_contact)
real(wp), parameter :: contact_ramp = 1.e-2_wp

!> Reals per IB in restart_data/ib_state: time, force(3), torque(3), vel(3), angular_vel(3), angles(3), centroid(3), radius,
!! Twall, ib_mass_relax bank. Twall carries a thermal_bc = 3 body's evolving temperature across a restart; the bank is the
!! body's unreturned gas mass (patch_ib%mass_bank, held by the owner).
Expand Down
4 changes: 3 additions & 1 deletion src/simulation/m_global_parameters.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ contains
mp_weno = .false.
weno_avg = .false.
weno_Re_flux = .false.
weno_Re_flux_compact = .false.
weno_Re_flux_compact = .true.
riemann_hypo_ADC = .false.
ADC_kappa = 1.0_wp
hll_u_interface = .false.
Expand Down Expand Up @@ -1085,6 +1085,8 @@ contains
end do
end if
end if
! weno_Re_flux_compact (default T) applies to Cartesian weno_Re_flux runs only
weno_Re_flux_compact = weno_Re_flux_compact .and. weno_Re_flux .and. .not. cyl_coord
call s_set_visc_dt_cap()

! Herschel-Bulkley non-Newtonian viscosity: gather per-fluid parameters into device arrays
Expand Down
3 changes: 1 addition & 2 deletions src/simulation/m_ibm.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,7 @@ contains
ib_ip_width = merge(3, 2, ib_ip_interp == 2)
ib_wall_quad = ib_wall_order == 2
ib_keep_ghost = ib_ip_interp == 2 .or. ib_wall_quad
$:GPU_UPDATE(device='[ib_second_order_vel, ib_ip_min_dist, ib_ip_interp, ib_ip_width, ib_keep_ghost, ib_wall_quad, &
& ib_smooth_contact, ib_slip_ccst]')
$:GPU_UPDATE(device='[ib_second_order_vel, ib_ip_min_dist, ib_ip_interp, ib_ip_width, ib_keep_ghost, ib_wall_quad, ib_slip_ccst]')

if (collision_model > 0) call s_initialize_collisions_module()

Expand Down
Loading
Loading