API
Public Models
TransportModelMono(cap, ops, uω, uγ; kwargs...)
TransportModelMono(cap, uω, uγ; kwargs...)
Required inputs:
cap::AssembledCapacity- either prebuilt
ops::AdvectionOpsor velocities to build them uω,uγ: velocity containers withNcomponents (tuple/vector), where each component is constant, callback, or vector of lengthntotal
Key keywords:
source: constant or callback(x...)/(x..., t)bc_border::BorderConditionsbc_interface:nothing,Inflow(value),Dirichlet(value), scalar, or callbacklayout: default canonical mono layout (ω, thenγ)scheme: spatial advection discretization (Centered()orUpwind1())
Unknown layout:
x = [ φω ; φγ ]TransportModelTwoPhase(cap1, cap2, ops1, ops2, u1ω, u1γ, u2ω, u2γ; kwargs...)
TransportModelTwoPhase(cap1, cap2, u1ω, u1γ, u2ω, u2γ; kwargs...)
Required inputs:
cap1,cap2(samentotaland grid shape)- per-phase velocities
u1ω,u1γ,u2ω,u2γwith the same component conventions as mono
Key keywords:
source1,source2bc_border1,bc_border2layout: default canonical two-phase layoutscheme: spatial advection discretization (Centered()orUpwind1())
Unknown layout (fixed):
x = [ φω1 ; φγ1 ; φω2 ; φγ2 ]MovingTransportModelMono(grid, body, uω, uγ; kwargs...)
MovingTransportModelTwoPhase(grid, body1, u1ω, u1γ, u2ω, u2γ; kwargs...)
Moving-geometry transport models using reduced space-time slabs.
Key moving-only inputs:
- moving level-set callback(s) (
body, orbody1/body2) with signature(x..., t)(or(x...)if static) - interface geometry velocity
wγ - reduced slab caches and physical volumes are updated internally each step
Unknown layouts are identical to fixed models:
mono: x = [ φω ; φγ ]
two-phase: x = [ φω1 ; φγ1 ; φω2 ; φγ2 ]Assembly Functions
assemble_steady_mono!(sys, model, t)
Mutates sys.A, sys.b for mono steady transport at time t.
assemble_unsteady_mono!(sys, model, uⁿ, t, dt, scheme_or_theta)
Mutates sys.A, sys.b for one mono unsteady θ step.
uⁿcan beω-only (ntotal) or full state length.- Accepted time schemes:
:BE,:CN, numericθin[0,1].
assemble_steady_two_phase!(sys, model, t)
Mutates sys.A, sys.b for two-phase steady transport.
assemble_unsteady_two_phase!(sys, model, uⁿ, t, dt, scheme_or_theta)
Mutates sys.A, sys.b for one two-phase unsteady θ step.
uⁿcan be full state, concatenatedωblocks, or tuple(u01, u02).- Accepted time schemes:
:BE,:CN, numericθin[0,1].
assemble_unsteady_mono_moving!(sys, model, uⁿ, t, dt, scheme_or_theta)
assemble_unsteady_two_phase_moving!(sys, model, uⁿ, t, dt, scheme_or_theta)
Assemble one moving-geometry unsteady slab step.
- Uses reduced slab capacities/operators on
[t, t+dt] - Uses physical volumes
Vn/Vn1in time terms - Uses discrete relative interface coefficient for closure logic:
κrelextracted from slabops.Kassembled with(uγ - wγ)
Solver Wrappers
solve_steady!(model; t=0, method=:direct, kwargs...)
Assembles and solves one steady system. Returns LinearSystem with solution in sys.x.
solve_unsteady!(model, u0, tspan; dt, scheme=:BE, method=:direct, save_history=true, kwargs...)
Time-integrates mono or two-phase transport and returns:
(times, states, system, reused_constant_operator)Important behavior:
- Accepted time schemes are exactly
:BE,:CN, or numericθ ∈ [0,1]. - Invalid symbols or out-of-range
θraiseArgumentError. - Reuses constant operator/factorization when matrix/RHS are time-invariant.
solve_unsteady_moving!(model, u0, tspan; dt, scheme=:BE, method=:direct, save_history=true, kwargs...)
Time-integrates moving mono or moving two-phase transport with the same scheme contract (:BE, :CN, or numeric θ ∈ [0,1]).
Operator/Geometry Maintenance
update_advection_ops!(model; t=0)
Rebuilds and stores advection operators at time t.
rebuild!(model, moments; bc=0, t=0)
Rebuilds mono geometry from new moments and refreshes advection operators.
Two-Phase Block Views
These helpers read sub-blocks from full two-phase state vectors:
omega1_view(model, x)gamma1_view(model, x)omega2_view(model, x)gamma2_view(model, x)
All assume ordering (ω1, γ1, ω2, γ2).
Public Docstrings
PenguinTransport.TransportModelMono — Type
TransportModelMono(cap, ops, uω, uγ; kwargs...)
TransportModelMono(cap, uω, uγ; kwargs...)Monophasic advection transport model on cut cells.
Unknown ordering is (ω, γ) where ω are bulk cell values and γ are interface values.
PenguinTransport.TransportModelTwoPhase — Type
TransportModelTwoPhase(cap1, cap2, ops1, ops2, u1ω, u1γ, u2ω, u2γ; kwargs...)
TransportModelTwoPhase(cap1, cap2, u1ω, u1γ, u2ω, u2γ; kwargs...)Two-phase advection transport model with phase-wise cut-cell capacities and flux-coupled interface rows.
Unknown ordering is (ω1, γ1, ω2, γ2).
PenguinTransport.MovingTransportModelMono — Type
MovingTransportModelMono(grid, body, uω, uγ; kwargs...)Moving-geometry monophasic advection transport model assembled from space-time slabs.
Unknown ordering is (ω, γ) and interface inflow/outflow decisions use the same discrete interface coefficient as the ω-row embedded transport term, assembled from the relative interface velocity (uγ - wγ).
PenguinTransport.MovingTransportModelMono — Method
MovingTransportModelMono(grid, body, uω, uγ; source, bc_border, bc_interface, layout, periodic, scheme, wγ, geom_method)Build a moving monophasic transport model.
bodyis a level-set callback accepting(x...)or(x..., t).wγis the interface geometry velocity sampled onC_γ.- Per-step slab caches (
cap_slab,ops_slab,Vn,Vn1) are updated by moving assembly.
PenguinTransport.MovingTransportModelTwoPhase — Type
MovingTransportModelTwoPhase(grid, body1, u1ω, u1γ, u2ω, u2γ; kwargs...)Moving-geometry two-phase advection transport model assembled from space-time slabs.
Unknown ordering is (ω1, γ1, ω2, γ2) and local interface inflow/outflow decisions use the same discrete interface coefficients as the ω-row embedded transport terms, assembled from relative interface velocities.
PenguinTransport.MovingTransportModelTwoPhase — Method
MovingTransportModelTwoPhase(grid, body1, u1ω, u1γ, u2ω, u2γ; source1, source2, body2, bc_border1, bc_border2, layout, periodic1, periodic2, scheme, wγ, geom_method)Build a moving two-phase transport model.
- If
body2is omitted, phase 2 uses-body1. wγis the interface geometry velocity sampled onC_γ.- Per-step slab caches (
cap*_slab,ops*_slab,V*n,V*n1) are updated by moving assembly.
PenguinTransport.assemble_steady_mono! — Function
assemble_steady_mono!(sys, model, t)Assemble the steady monophasic linear system at time t.
PenguinTransport.assemble_unsteady_mono! — Function
assemble_unsteady_mono!(sys, model, uⁿ, t, dt, scheme_or_theta)Assemble the monophasic theta-method system for one unsteady step.
PenguinTransport.assemble_steady_two_phase! — Function
assemble_steady_two_phase!(sys, model, t)Assemble the steady two-phase linear system at time t with interface flux coupling.
PenguinTransport.assemble_unsteady_two_phase! — Function
assemble_unsteady_two_phase!(sys, model, uⁿ, t, dt, scheme_or_theta)Assemble the two-phase theta-method system for one unsteady step.
PenguinTransport.assemble_unsteady_mono_moving! — Function
assemble_unsteady_mono_moving!(sys, model, uⁿ, t, dt, scheme_or_theta)Assemble one moving-geometry monophasic theta-method step on slab [t, t+dt]. Embedded-interface inflow/outflow switching uses the discrete relative interface coefficient extracted from the assembled transport operator.
PenguinTransport.assemble_unsteady_two_phase_moving! — Function
assemble_unsteady_two_phase_moving!(sys, model, uⁿ, t, dt, scheme_or_theta)Assemble one moving-geometry two-phase theta-method step on slab [t, t+dt]. Embedded-interface inflow/outflow switching uses discrete relative interface coefficients extracted from the assembled transport operators.
PenguinTransport.solve_steady! — Function
solve_steady!(model; t=0, method=:direct, kwargs...)Assemble and solve the steady linear system for mono or two-phase transport models.
PenguinTransport.solve_unsteady! — Function
solve_unsteady!(model, u0, tspan; dt, scheme=:BE, method=:direct, save_history=true, kwargs...)Time-integrate mono or two-phase transport with a theta-method (:BE, :CN, or numeric theta in [0,1]). Returns (times, states, system, reused_constant_operator).
PenguinTransport.solve_unsteady_moving! — Function
solve_unsteady_moving!(model, u0, tspan; dt, scheme=:BE, method=:direct, save_history=true, kwargs...)Time-integrate moving mono or moving two-phase transport. Accepted scheme values are :BE, :CN, or numeric theta in [0,1]. Returns (times, states, system, reused_constant_operator=false).
PenguinTransport.update_advection_ops! — Function
update_advection_ops!(model; t=0)Rebuild and store advection operators at time t for a mono or two-phase model.
PenguinTransport.rebuild! — Function
rebuild!(model::TransportModelMono, moments; bc=0, t=0)Rebuild capacity geometry and refresh advection operators for a monophasic model.
PenguinTransport.omega1_view — Function
omega1_view(model, x)View the phase-1 bulk block (ω1) from a full two-phase state x. The expected unknown ordering is (ω1, γ1, ω2, γ2).
PenguinTransport.gamma1_view — Function
gamma1_view(model, x)View the phase-1 interface block (γ1) from a full two-phase state x. The expected unknown ordering is (ω1, γ1, ω2, γ2).
PenguinTransport.omega2_view — Function
omega2_view(model, x)View the phase-2 bulk block (ω2) from a full two-phase state x. The expected unknown ordering is (ω1, γ1, ω2, γ2).
PenguinTransport.gamma2_view — Function
gamma2_view(model, x)View the phase-2 interface block (γ2) from a full two-phase state x. The expected unknown ordering is (ω1, γ1, ω2, γ2).