models.feed_systems.tank¶
Stateless two-phase propellant tank model backed by CoolProp. The Tank carries no propellant-mass state: pressure and density are pure functions of a fluid mass supplied by the caller, so the integrator owns the mass and the model stays re-runnable. get_pressure(fluid_mass) returns the tank pressure from two-phase equilibrium (saturation pressure while liquid is present, single-phase vapour from the real-gas equation of state otherwise), and get_density(fluid_mass) the density at current conditions.
Tanks are identified by CoolProp fluid name (e.g., "N2O", "Oxygen", "Hydrogen").
machwave.models.feed_systems.tank
¶
Tank
¶
A generic two-phase tank model for any single fluid recognized by CoolProp.
This is a static description of the tank: it carries no propellant-mass state. Pressure and density are pure functions of a fluid mass passed in by the caller, which lets the integrator own the mass and keeps the model re-runnable.
Assumptions
- Constant temperature (isothermal).
- Two-phase equilibrium if there's enough mass to form liquid + vapor.
- If insufficient mass for liquid, treat it as single-phase vapor via the real-gas equation of state.
- Ignores temperature changes upon phase change (no thermal balance).
Source code in machwave/models/feed_systems/tank.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | |
__init__(fluid_name, volume, temperature, initial_fluid_mass, overfill_tolerance=0.01)
¶
Initialize a two-phase tank model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fluid_name
|
str
|
Name of the fluid in the CoolProp database. |
required |
volume
|
float
|
Internal volume of the tank [m^3] (>0). |
required |
temperature
|
float
|
Absolute temperature [K], assumed constant (>0). |
required |
initial_fluid_mass
|
float
|
Initial total mass of fluid [kg] (>=0). This is the tank's loading; the integrator owns the mass thereafter. |
required |
overfill_tolerance
|
float
|
Allowed fraction over the saturated liquid density, e.g. 0.01 = 1% (>=0). |
0.01
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If any argument is outside its valid physical range, or if the initial fill is denser than the saturated liquid. |
Source code in machwave/models/feed_systems/tank.py
get_density(fluid_mass, pressure=None)
¶
Return fluid density [kg/m^3] for a given fluid mass.
1) An empty tank has zero density. 2) With a pressure override the single-phase density follows directly from temperature and pressure. 3) Otherwise the fill state fixes the density: a partially liquid tank returns the saturated liquid density (the feed system pulls liquid from the bottom), and an all-vapor tank returns the bulk density.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fluid_mass
|
float
|
Current total mass of fluid in the tank [kg]. |
required |
pressure
|
float | None
|
Tank pressure override [Pa], e.g. for a piston-pressurized stacked-tank system. Defaults to the tank's own pressure. |
None
|
Returns:
| Type | Description |
|---|---|
float
|
Fluid density [kg/m^3]. |
Source code in machwave/models/feed_systems/tank.py
get_pressure(fluid_mass)
¶
Return the tank pressure [Pa] for a given fluid mass.
1) An empty tank has zero pressure. 2) If the fluid mass exceeds the mass of saturated vapor that fills the tank, the tank is partially liquid and the pressure is the saturation pressure. 3) Otherwise, the tank is all sub-saturated vapor and the pressure follows the real-gas equation of state at the bulk density. This matches the saturation pressure at the phase boundary, so pressure stays continuous as the tank crosses out of the two-phase regime.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fluid_mass
|
float
|
Current total mass of fluid in the tank [kg]. |
required |
Returns:
| Type | Description |
|---|---|
float
|
Tank pressure [Pa]. |