Skip to content

Commit 970c384

Browse files
committed
working 3D-0D with Pact=400mmHg
1 parent cf8a60d commit 970c384

2 files changed

Lines changed: 40 additions & 6 deletions

File tree

minilimo/README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
## miniLIMO setups
22

3-
### Closed-loop WK3
3+
1. `limo_dynamic_coupled.jl`: works, dynamic morphing (damped) and then static Lie-Trotter coupling (weak) with the WK3 model.Pact max reaches 400 mmHg.
4+
2. `limo_dynamic_kostas_single.jl`: static inflation for Kostas' project. Runs well via command line Pact arguments
5+
3. `limo_dynamic_coupled_transient.jl`: dynamic morphing (damped) and then dynamic Lie-Trotter coupling (weak) with the WK3 model.
6+
4. `limo_dynamic_coupled_strong.jl`: dynamic morphing (damped) and then dynamic, stronlgy coupled Lie-Trotter coupling with the WK3 model.
7+
5. `limo_dynamic_full.jl` same as the `1`, but with the full geometry, no symmetry plane.
8+
6. `utils`: store some repeated functions that are used across these files
49

5-
1.
10+
## old files
11+
12+
```julia
13+
limo_dynamic_actuation.jl
14+
limo_inflation.jl
15+
limo_morph_bypass.jl
16+
limo_ptc_inflation.jl
17+
limo_dynamic_full.jl
18+
limo_dynamic.jl
19+
```

minilimo/limo_dynamic_coupled.jl

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ integrator = ODE.init(prob, ODE.Tsit5(), reltol=1e-6, abstol=1e-9, save_everyste
308308
# coupling controls
309309
tol_cpl = 1e-4
310310
max_iter = 50
311-
dt_cpl = 0.0001
311+
dt_cpl = 0.01
312312

313313
# storages
314314
vols = Float64[]; pres = Float64[]; pact = Float64[]
@@ -374,7 +374,7 @@ println(" t [s] | p [mmHg] | Vlv_full [ml] | Pact [mmHg] | iters")
374374
push!(vtarget, integrator.u[1])
375375

376376
# actuator pressure at this time [mmHg] → Pa
377-
Pact_mmHg = 200 * ϕᵢ(integrator.t; tC=0.1, tR=0.4, TC=0.3, TR=0.3)
377+
Pact_mmHg = 400 * ϕᵢ(integrator.t; tC=0.1, tR=0.4, TC=0.3, TR=0.3)
378378
Pact = Pact_mmHg / Pa2mmHg
379379

380380
p, n_iter, converged, V₃D = solve_coupled_step!(u, p, Pact, V_target, dh, scv, mat, ch,
@@ -418,10 +418,30 @@ end
418418
close(pvd)
419419

420420
using Plots
421+
# Read the (Vlv_ml, Plv_mmHg) columns of one pressurization CSV; skips the header.
422+
function read_pv(path)
423+
Vlv = Float64[]; Plv = Float64[]
424+
for line in Iterators.drop(eachline(path), 1)
425+
cols = split(line, ',')
426+
push!(Vlv, parse(Float64, cols[2]))
427+
push!(Plv, parse(Float64, cols[3]))
428+
end
429+
return Vlv, Plv
430+
end
431+
432+
421433
times = collect(0:dt_cpl:integrator.t)[1:length(pres)]
422434
p1 = plot(times, [vols, pres, pact, paos, pvns], xlabel="Time [s]",
423435
label=["Vlv" "Plv" "Pact" "Pao" "Pv"], lw=2, legend=:right)
424-
p2 = plot(vols, pres, label=:none, xlim=extrema(vols).+(-10,10), ylims=(0, 100),
436+
p2 = plot()
437+
for Pact_mmHg in (0,50.0,100.0,150.0,200.0,400)
438+
fname = "minilimo_results_Pact_$(Pact_mmHg).csv"
439+
Pact_mmHg in [0,400] && (fname = "minilimo_pressurization_pact_$(Pact_mmHg).csv")
440+
isfile(fname) || (@warn "missing $fname, skipping"; continue)
441+
Vlv, Plv = read_pv(fname)
442+
plot!(p2, Vlv, Plv, label="Pact = $(Pact_mmHg) mmHg", lw=2, marker=:circle, ms=3)
443+
end
444+
plot!(p2, vols, pres, label=:none, xlim=extrema(vols).+(-10,10), ylims=(0, 100),
425445
xlabel="Volume [ml]", ylabel="Pressure [mmHg]", lw=2, linez=times./maximum(times))
426446
plot(p1, p2)
427-
# # savefig("minilimo-dynamic-coupled-N$Np.png")
447+
# savefig("minilimo-dynamic-coupled-Pact-400.png")

0 commit comments

Comments
 (0)