|
| 1 | +"""3-D Unsteady Pulsatile Flow through an Axisymmetric AAA with Carreau Blood. |
| 2 | +
|
| 3 | +Time-marching transfer learning combining the AAA bulge geometry with the |
| 4 | +Carreau (shear-thinning blood) constitutive law: |
| 5 | +
|
| 6 | + μ*(γ̇*) = 1 + (β − 1)[1 + (Cu γ̇*)²]^((n−1)/2) |
| 7 | + blood: β = 16, n = 0.3568. |
| 8 | +
|
| 9 | +Domain and Reynolds number are identical to the steady AAA-rheology case |
| 10 | +(``examples/AAA_rheology/config.yaml``). Inlet imposes the developed Carreau |
| 11 | +radial profile modulated in time: |
| 12 | +
|
| 13 | + u_inlet(r, t) = (V_max + V_amp · sin(2π t / T_period)) · u*_carr(r/R_vessel) |
| 14 | +
|
| 15 | +Network: (x, y, z, t) → (u, v, w, p) |
| 16 | +""" |
| 17 | +from __future__ import annotations |
| 18 | + |
| 19 | +import os |
| 20 | +os.environ.setdefault("XLA_PYTHON_CLIENT_PREALLOCATE", "false") |
| 21 | + |
| 22 | +from underPINN.config.loader import cfg_get |
| 23 | +from underPINN.pde.carreau_ns_3d import UnsteadyCarreauNS3DPDE |
| 24 | +from underPINN.geometry.aaa import BulgeGeometry |
| 25 | +from underPINN.utils.pulsatile_time_march import ( |
| 26 | + carreau_inlet_factory, |
| 27 | + carreau_steady_uvw_factory, |
| 28 | + make_model_from_cfg, |
| 29 | + run_pulsatile_time_march, |
| 30 | +) |
| 31 | + |
| 32 | + |
| 33 | +def run_AAA_rheology_pulsatile(cfg) -> dict: |
| 34 | + ph = cfg.physics |
| 35 | + Re = float(cfg_get(ph, "Re", default=40.0)) |
| 36 | + R_vessel = float(cfg_get(ph, "R_vessel", default=0.5)) |
| 37 | + R_AAA = float(cfg_get(ph, "R_AAA", default=1.0)) |
| 38 | + L = float(cfg_get(ph, "L", default=7.0)) |
| 39 | + x_lo = float(cfg_get(ph, "x_lo", default=-3.5)) |
| 40 | + x0 = float(cfg_get(ph, "x0", default=-2.0)) |
| 41 | + L_AAA = float(cfg_get(ph, "L_AAA", default=1.5)) |
| 42 | + V_max = float(cfg_get(ph, "V_max", default=2.0)) |
| 43 | + V_amp = float(cfg_get(ph, "V_amp", default=1.0)) |
| 44 | + T_period = float(cfg_get(ph, "T_period", default=1.0)) |
| 45 | + beta = float(cfg_get(ph, "beta", default=16.0)) |
| 46 | + Cu = float(cfg_get(ph, "Cu", default=10.0)) |
| 47 | + n = float(cfg_get(ph, "n", default=0.3568)) |
| 48 | + x_hi = x_lo + L |
| 49 | + x_mid = 0.5 * (x_lo + x_hi) |
| 50 | + |
| 51 | + print(f"Carreau pulsatile AAA (3-D unsteady): Re={Re}, R_vessel={R_vessel}, " |
| 52 | + f"R_AAA={R_AAA}, x∈[{x_lo}, {x_hi}], x0={x0}, L_AAA={L_AAA}") |
| 53 | + print(f" Carreau: β={beta}, Cu={Cu}, n={n}") |
| 54 | + print(f" Inlet peak(t) = {V_max} + {V_amp}·sin(2π t/{T_period}) " |
| 55 | + f"(Carreau-developed profile)") |
| 56 | + |
| 57 | + geom = BulgeGeometry(R_vessel=R_vessel, R_AAA=R_AAA, L=L, |
| 58 | + x_lo=x_lo, x0=x0, L_AAA=L_AAA) |
| 59 | + model, _ = make_model_from_cfg(cfg) |
| 60 | + pde = UnsteadyCarreauNS3DPDE(model, Re=Re, beta=beta, Cu=Cu, n=n) |
| 61 | + |
| 62 | + return run_pulsatile_time_march( |
| 63 | + cfg, |
| 64 | + problem_spec=dict( |
| 65 | + problem="AAA_rheology_pulsatile", |
| 66 | + label="Carreau pulsatile AAA", |
| 67 | + geom=geom, pde=pde, |
| 68 | + inlet_target_fn=carreau_inlet_factory( |
| 69 | + R_vessel, V_max, V_amp, T_period, beta, Cu, n), |
| 70 | + steady_uvw_fn=carreau_steady_uvw_factory( |
| 71 | + R_vessel, V_max, beta, Cu, n), |
| 72 | + physics_dict={"Re": Re, "R_vessel": R_vessel, "R_AAA": R_AAA, |
| 73 | + "L": L, "x_lo": x_lo, "x0": x0, "L_AAA": L_AAA, |
| 74 | + "V_max": V_max, "V_amp": V_amp, "T_period": T_period, |
| 75 | + "beta": beta, "Cu": Cu, "n": n}, |
| 76 | + plot_extent=(x_lo, x_hi, x_mid), |
| 77 | + ), |
| 78 | + out_dir_default="outputs/AAA_rheology_pulsatile", |
| 79 | + ) |
| 80 | + |
| 81 | + |
| 82 | +if __name__ == "__main__": |
| 83 | + import sys |
| 84 | + import pathlib |
| 85 | + _HERE = pathlib.Path(__file__).parent |
| 86 | + cfg_path = str( |
| 87 | + pathlib.Path(sys.argv[1]) if len(sys.argv) > 1 |
| 88 | + else _HERE / "AAA_rheology_pulsatile.yaml" |
| 89 | + ) |
| 90 | + from underPINN.config.loader import load_config |
| 91 | + run_AAA_rheology_pulsatile(load_config(cfg_path)) |
0 commit comments