STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
feedtwin.comps.gas.GasOrifice Class Reference
Inheritance diagram for feedtwin.comps.gas.GasOrifice:
[legend]
Collaboration diagram for feedtwin.comps.gas.GasOrifice:
[legend]

Public Member Functions

float choked_flow (self, FlowConditions flow)
float|None flow_ceiling (self, FlowConditions flow)
bool is_choked (self, float dp_available, FlowConditions flow)
float choking_pressure_drop (self, FlowConditions flow)
float pressure_drop (self, float mdot, FlowConditions flow)
dict[str, float] diagnostics (self, float mdot, FlowConditions flow)
Public Member Functions inherited from feedtwin.comps.base.HydraulicComponent
None __init__ (self, ComponentInstance instance)
str id (self)
str type (self)
float static_head (self, FlowConditions flow)
float total_dp (self, float mdot, FlowConditions flow)
float signal (self, FlowConditions flow, str name, float default=1.0)
bool isolates (self, Mapping[str, float]|None signals=None)
float|None pinned_flow (self, float dp_available, FlowConditions flow)
list[Violation] check (self)
int n_residuals (self)
Sequence[float] residuals (self, EvalContext ctx)
Mapping[str, float] outputs (self, EvalContext ctx)
FlowConditions conditions (self, PortState port, Mapping[str, float] signals)
str __repr__ (self)

Protected Member Functions

tuple[float, float] _geometry (self)
tuple[float, float, float] _gas (self, FlowConditions flow)

Additional Inherited Members

Public Attributes inherited from feedtwin.comps.base.HydraulicComponent
 instance = instance
 p = instance.si_params()
 opt = dict(instance.options)
Static Public Attributes inherited from feedtwin.comps.base.HydraulicComponent
str inlet_port = "inlet"
str outlet_port = "outlet"
bool symmetric = False
 conditions_provider = None

Detailed Description

A restriction in compressible flow: choked above a pressure ratio.

Inverted from the usual direction. The textbook relation gives mass flow
from a pressure ratio; a network solve carries flows and wants pressures, so
this brackets the pressure ratio between choking and unity and solves for
the one that passes the requested flow.

The bracket is what makes it robust: the relation is monotonic over that
interval, so a root always exists unless the flow exceeds the choked
ceiling -- and that case is reported as infeasible rather than iterated on.

Definition at line 95 of file gas.py.

Member Function Documentation

◆ _gas()

tuple[float, float, float] feedtwin.comps.gas.GasOrifice._gas ( self,
FlowConditions flow )
protected
gamma, specific gas constant, temperature -- from the conditions.

``FlowConditions`` carries what a liquid needs; a gas also needs the
heat capacity ratio and a gas constant. Both are derived from what is
already there rather than added to the struct, so the liquid components
are untouched.

Definition at line 112 of file gas.py.

Referenced by choked_flow(), choking_pressure_drop(), diagnostics(), is_choked(), and pressure_drop().

◆ _geometry()

tuple[float, float] feedtwin.comps.gas.GasOrifice._geometry ( self)
protected

◆ choked_flow()

float feedtwin.comps.gas.GasOrifice.choked_flow ( self,
FlowConditions flow )

◆ choking_pressure_drop()

float feedtwin.comps.gas.GasOrifice.choking_pressure_drop ( self,
FlowConditions flow )
The drop at which the throat goes sonic [Pa]. About 47% of p_up.

Definition at line 144 of file gas.py.

References feedtwin.comps.elements.Valve._gas(), _gas(), and feedtwin.comps.gas.critical_pressure_ratio().

◆ diagnostics()

dict[str, float] feedtwin.comps.gas.GasOrifice.diagnostics ( self,
float mdot,
FlowConditions flow )
Derived quantities worth reporting: velocity, Reynolds number, K.

Never consumed by a solver. This is what a frame and a report show, and
what makes a result inspectable rather than just a number.

Reimplemented from feedtwin.comps.base.HydraulicComponent.

Definition at line 176 of file gas.py.

References feedtwin.comps.elements.Valve._gas(), _gas(), choked_flow(), feedtwin.comps.gas.critical_pressure_ratio(), p, feedtwin.comps.base.HydraulicComponent.p, and feedtwin.comps.base.HydraulicComponent.pressure_drop().

◆ flow_ceiling()

float | None feedtwin.comps.gas.GasOrifice.flow_ceiling ( self,
FlowConditions flow )
Largest mass flow this component can pass [kg/s], or ``None``.

``None`` means "no ceiling", which is true of every liquid component
here and of any gas element below its critical pressure ratio.

A ceiling changes what equation the network solver writes for this
branch, which is why it lives on the base class rather than inside the
one component that has one. See :meth:`is_choked`.

Reimplemented from feedtwin.comps.base.HydraulicComponent.

Definition at line 136 of file gas.py.

References choked_flow().

◆ is_choked()

bool feedtwin.comps.gas.GasOrifice.is_choked ( self,
float dp_available,
FlowConditions flow )
Whether ``dp_available`` puts this component past its choking point.

Load-bearing for the solver, not just a report. A branch's usual
equation is ``(p_up - p_dn) - dp(mdot) = 0``, which presumes the drop
is a function of the flow. Past choking it is not: mass flow stops
depending on downstream pressure entirely, and the drop can be anything
at or above the critical value. The relation is no longer invertible
and Newton, asked to invert it anyway, runs away -- which is exactly
what a relief valve venting to atmosphere does to a naive solver.

When this returns true the solver writes ``mdot = flow_ceiling``
instead, and reports the branch as choked.

Reimplemented from feedtwin.comps.base.HydraulicComponent.

Definition at line 139 of file gas.py.

References feedtwin.comps.elements.Valve._gas(), _gas(), and feedtwin.comps.gas.critical_pressure_ratio().

◆ pressure_drop()

float feedtwin.comps.gas.GasOrifice.pressure_drop ( self,
float mdot,
FlowConditions flow )
Flow-dependent pressure loss [Pa]. Always non-negative.

A *loss*: it opposes the flow, so it lowers the downstream pressure
whichever way the fluid is going. Reverse flow is each component's own
business -- symmetric for a pipe, very much not for a check valve.

Anything that does **not** depend on the direction of flow belongs in
:meth:`static_head`, not here. See that method for why the distinction
is load-bearing rather than tidy.

Reimplemented from feedtwin.comps.base.HydraulicComponent.

Definition at line 149 of file gas.py.

References feedtwin.comps.elements.Valve._gas(), _gas(), _geometry(), and feedtwin.comps.gas.choked_mass_flow().


The documentation for this class was generated from the following file:
  • lib/feedtwin/feedtwin/comps/gas.py