embedded3: the cut mask's imposition and the device surface-velocity tables restricted to a 4-cell band (deeper prescribed faces are never read; the surface velocity was the moving step's cost); the operator rebuild counted in the rebuild share
CI / Clippy Check (push) Failing after 3s
CI / Format Check (push) Failing after 4s
CI / Build (ubuntu-latest) (push) Failing after 5s
Documentation / Build API Documentation (push) Failing after 1m0s
Performance Benchmarks / Run Benchmarks (push) Failing after 5s
Documentation / Build User Guide (push) Successful in 7s
CI / Build CPU-Only (Explicit) (push) Failing after 58s
CI / Build (macos-latest) (push) Canceled after 0s
CI / Test (macos-latest) (push) Canceled after 0s
CI / Test (ubuntu-latest) (push) Canceled after 0s
CI / Python Bindings (maturin) (macos-latest) (push) Canceled after 0s
CI / Python Bindings (maturin) (ubuntu-latest) (push) Canceled after 0s
CI / WASM Build + Size Check (push) Canceled after 0s
CI / Distributed Training Tests (push) Canceled after 0s
CI / CI Success (push) Canceled after 0s
CI / Clippy Check (push) Failing after 3s
CI / Format Check (push) Failing after 4s
CI / Build (ubuntu-latest) (push) Failing after 5s
Documentation / Build API Documentation (push) Failing after 1m0s
Performance Benchmarks / Run Benchmarks (push) Failing after 5s
Documentation / Build User Guide (push) Successful in 7s
CI / Build CPU-Only (Explicit) (push) Failing after 58s
CI / Build (macos-latest) (push) Canceled after 0s
CI / Test (macos-latest) (push) Canceled after 0s
CI / Test (ubuntu-latest) (push) Canceled after 0s
CI / Python Bindings (maturin) (macos-latest) (push) Canceled after 0s
CI / Python Bindings (maturin) (ubuntu-latest) (push) Canceled after 0s
CI / WASM Build + Size Check (push) Canceled after 0s
CI / Distributed Training Tests (push) Canceled after 0s
CI / CI Success (push) Canceled after 0s
Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
c30e3dba34
commit
aca77fe1ac
@@ -6,7 +6,19 @@
|
||||
use super::body::Body;
|
||||
use super::wall::{FaceKind, Mask};
|
||||
|
||||
/// The imposition band of a cut mask, in cells.
|
||||
pub(crate) const IMPOSE_BAND_CELLS: f64 = 4.0;
|
||||
|
||||
impl Mask {
|
||||
/// The band (in length units) within which a cut mask's prescribed
|
||||
/// faces are imposed; `None` on the binary wall (every solid face).
|
||||
#[must_use]
|
||||
pub fn impose_band(&self) -> Option<f64> {
|
||||
self.cut
|
||||
.as_ref()
|
||||
.map(|_| IMPOSE_BAND_CELLS * self.grid.dx.min(self.grid.dy).min(self.grid.dz))
|
||||
}
|
||||
|
||||
/// Impose the wall on `(u, v, w)` from the same field.
|
||||
pub fn impose(&self, body: &Body, u: &mut [f64], v: &mut [f64], w: &mut [f64], t: f64) -> f64 {
|
||||
let (us, vs, ws) = (u.to_vec(), v.to_vec(), w.to_vec());
|
||||
@@ -30,11 +42,21 @@ impl Mask {
|
||||
) -> f64 {
|
||||
let g = self.grid;
|
||||
let (nx, ny, nz, dx, dy, dz) = (g.nx, g.ny, g.nz, g.dx, g.dy, g.dz);
|
||||
// On a cut mask only the prescribed faces within the band are
|
||||
// imposed: deeper ones are never read (the predictor reaches two
|
||||
// faces past an open one) and the surface velocity is the costly
|
||||
// part of a moving body's step.
|
||||
let band = self.impose_band();
|
||||
let near = |d: &[f64], idx: usize| band.is_none_or(|b| d[idx].abs() <= b);
|
||||
let (d_u, d_v, d_w): (&[f64], &[f64], &[f64]) = match &self.cut {
|
||||
Some(c) => (&c.d_u, &c.d_v, &c.d_w),
|
||||
None => (&[], &[], &[]),
|
||||
};
|
||||
for k in 0..nz {
|
||||
for j in 0..ny {
|
||||
for i in 1..nx {
|
||||
let idx = g.uface(k, j, i);
|
||||
if self.u_kind[idx] == FaceKind::Solid {
|
||||
if self.u_kind[idx] == FaceKind::Solid && near(d_u, idx) {
|
||||
u[idx] = body
|
||||
.surface_velocity(
|
||||
i as f64 * dx,
|
||||
@@ -49,7 +71,7 @@ impl Mask {
|
||||
for j in 1..ny {
|
||||
for i in 0..nx {
|
||||
let idx = g.vface(k, j, i);
|
||||
if self.v_kind[idx] == FaceKind::Solid {
|
||||
if self.v_kind[idx] == FaceKind::Solid && near(d_v, idx) {
|
||||
v[idx] = body
|
||||
.surface_velocity(
|
||||
(i as f64 + 0.5) * dx,
|
||||
@@ -66,7 +88,7 @@ impl Mask {
|
||||
for j in 0..ny {
|
||||
for i in 0..nx {
|
||||
let idx = g.wface(k, j, i);
|
||||
if self.w_kind[idx] == FaceKind::Solid {
|
||||
if self.w_kind[idx] == FaceKind::Solid && near(d_w, idx) {
|
||||
w[idx] = body
|
||||
.surface_velocity(
|
||||
(i as f64 + 0.5) * dx,
|
||||
|
||||
Reference in New Issue
Block a user