embedded3 S2-5: the cut wall sat ½(1−α)h inside the body — cross diffusion over the open-part centroid spacing (RTX_E3_DIFFUSION_CENTROID; host + e3_cut.cu, shift tables, point-implicit excess); flat-wall effective-position instrument; DFG 2D-1 ladder tests (device + host); knobs tried and refuted along the way (oblique distance, axis exchange, centroid pressure gradient)
Documentation / Build API Documentation (push) Failing after 4s
Documentation / Build User Guide (push) Successful in 4s
CI / Clippy Check (push) Failing after 2m24s
CI / Build CPU-Only (Explicit) (push) Failing after 3s
CI / Format Check (push) Failing after 11s
CI / Build (ubuntu-latest) (push) Failing after 1m58s
Performance Benchmarks / Run Benchmarks (push) Successful in 2m44s
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
Documentation / Build API Documentation (push) Failing after 4s
Documentation / Build User Guide (push) Successful in 4s
CI / Clippy Check (push) Failing after 2m24s
CI / Build CPU-Only (Explicit) (push) Failing after 3s
CI / Format Check (push) Failing after 11s
CI / Build (ubuntu-latest) (push) Failing after 1m58s
Performance Benchmarks / Run Benchmarks (push) Successful in 2m44s
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
4c3e58fa27
commit
fdfb6da769
@@ -112,7 +112,8 @@ impl Mask {
|
||||
};
|
||||
let u_face = upwind(m_plus, u0, un) + delta;
|
||||
let on_fluid = -rho * m_plus * (u_face - u0)
|
||||
+ mu * cv.ap[d][1] * a_d * (un - u0) / h[d];
|
||||
+ mu * cv.ap[d][1] * a_d * (un - u0)
|
||||
/ self.exchange_delta(&cv, d);
|
||||
force[c] -= on_fluid;
|
||||
}
|
||||
}
|
||||
@@ -129,7 +130,8 @@ impl Mask {
|
||||
};
|
||||
let u_face = upwind(m_minus, ud, u0) + delta;
|
||||
let on_fluid = rho * m_minus * (u_face - u0)
|
||||
+ mu * cv.ap[d][0] * a_d * (ud - u0) / h[d];
|
||||
+ mu * cv.ap[d][0] * a_d * (ud - u0)
|
||||
/ self.exchange_delta(&cv, d);
|
||||
force[c] -= on_fluid;
|
||||
}
|
||||
}
|
||||
@@ -210,4 +212,102 @@ impl Mask {
|
||||
let x = self.cut_wall_exchange_force(body, &old, mu, rho, t, None)?;
|
||||
Some([p[0] + s[0] + x[0], p[1] + s[1] + x[1], p[2] + s[2] + x[2]])
|
||||
}
|
||||
|
||||
/// S2-5 host prototype: per-face pressure-gradient weights `ω = h/δ`,
|
||||
/// `δ` the axis distance between the two cells' fluid centroids. A cut
|
||||
/// cell of fluid fraction `v` with unit wall normal `n` (into the body)
|
||||
/// has its centroid shifted by `−½(1 − v) h n` from the cell centre
|
||||
/// (exact for an axis-aligned cut); `δ` is clamped to `[¼h, 2h]`.
|
||||
pub fn compute_gradient_weights(&mut self) {
|
||||
let Some(cut) = self.cut.as_ref() else {
|
||||
return;
|
||||
};
|
||||
let g = self.grid;
|
||||
let h = [g.dx, g.dy, g.dz];
|
||||
let cells = g.cells();
|
||||
let mut shift = vec![[0.0f64; 3]; cells];
|
||||
for idx in 0..cells {
|
||||
if !self.cell_fluid[idx] {
|
||||
continue;
|
||||
}
|
||||
let w = cut.wall[idx];
|
||||
let a = (w[0] * w[0] + w[1] * w[1] + w[2] * w[2]).sqrt();
|
||||
if a == 0.0 {
|
||||
continue;
|
||||
}
|
||||
let v = self.vol(idx);
|
||||
for d in 0..3 {
|
||||
shift[idx][d] = -0.5 * (1.0 - v) * h[d] * w[d] / a;
|
||||
}
|
||||
}
|
||||
let weight = |d: usize, minus: usize, plus: usize| -> f64 {
|
||||
if !(self.cell_fluid[minus] && self.cell_fluid[plus]) {
|
||||
return 1.0;
|
||||
}
|
||||
let delta = h[d] + shift[plus][d] - shift[minus][d];
|
||||
h[d] / delta.clamp(0.25 * h[d], 2.0 * h[d])
|
||||
};
|
||||
let mut wu = vec![1.0; g.n_ufaces()];
|
||||
let mut wv = vec![1.0; g.n_vfaces()];
|
||||
let mut ww = vec![1.0; g.n_wfaces()];
|
||||
for k in 0..g.nz {
|
||||
for j in 0..g.ny {
|
||||
for i in 0..g.nx {
|
||||
let c = g.cell(k, j, i);
|
||||
if i > 0 {
|
||||
wu[g.uface(k, j, i)] = weight(0, g.cell(k, j, i - 1), c);
|
||||
}
|
||||
if j > 0 {
|
||||
wv[g.vface(k, j, i)] = weight(1, g.cell(k, j - 1, i), c);
|
||||
}
|
||||
if k > 0 {
|
||||
ww[g.wface(k, j, i)] = weight(2, g.cell(k - 1, j, i), c);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self.grad_weights = Some((wu, wv, ww));
|
||||
}
|
||||
|
||||
/// The pressure force the gradient weights add to the closure sum
|
||||
/// `Σ p_c W_c` (a force on the body): `Σ_f α_f A (ω_f − 1)(p_+ − p_−)`.
|
||||
#[must_use]
|
||||
pub fn gradient_weight_force(&self, p: &[f64], planes: Option<(usize, usize)>) -> [f64; 3] {
|
||||
let mut force = [0.0; 3];
|
||||
if self.grad_weights.is_none() {
|
||||
return force;
|
||||
}
|
||||
let g = self.grid;
|
||||
let area = [g.dy * g.dz, g.dx * g.dz, g.dx * g.dy];
|
||||
let (k0, k1) = planes.unwrap_or((0, g.nz));
|
||||
for k in k0..k1 {
|
||||
for j in 0..g.ny {
|
||||
for i in 0..g.nx {
|
||||
let c = g.cell(k, j, i);
|
||||
if i > 0 {
|
||||
let f = g.uface(k, j, i);
|
||||
force[0] += self.a_u(f)
|
||||
* area[0]
|
||||
* (self.grad_weight(0, f) - 1.0)
|
||||
* (p[c] - p[g.cell(k, j, i - 1)]);
|
||||
}
|
||||
if j > 0 {
|
||||
let f = g.vface(k, j, i);
|
||||
force[1] += self.a_v(f)
|
||||
* area[1]
|
||||
* (self.grad_weight(1, f) - 1.0)
|
||||
* (p[c] - p[g.cell(k, j - 1, i)]);
|
||||
}
|
||||
if k > 0 {
|
||||
let f = g.wface(k, j, i);
|
||||
force[2] += self.a_w(f)
|
||||
* area[2]
|
||||
* (self.grad_weight(2, f) - 1.0)
|
||||
* (p[c] - p[g.cell(k - 1, j, i)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
force
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user