models.propulsion.feed_systems.tanks¶
machwave.models.propulsion.feed_systems.tanks
¶
Tank
¶
A generic two-phase tank model for any fluid recognized by CoolProp.
Assumptions
- Constant temperature (isothermal).
- Two-phase equilibrium if there's enough mass to form liquid + vapor.
- If insufficient mass for liquid, treat it as an ideal gas.
- Ignores temperature changes upon phase change (no thermal balance).
Source code in machwave/models/propulsion/feed_systems/tanks/base.py
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 | |
__init__(fluid_name, volume, temperature, initial_fluid_mass)
¶
Initialize a two-phase tank model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fluid_name
|
Name of the fluid in the CoolProp database (e.g. 'N2O', 'Oxygen', 'Hydrogen', 'Ethanol', etc.). |
required | |
volume
|
Internal volume of the tank [m^3]. |
required | |
temperature
|
Absolute temperature [K], assumed constant. |
required | |
initial_fluid_mass
|
Initial total mass of fluid [kg]. |
required |
Source code in machwave/models/propulsion/feed_systems/tanks/base.py
get_density(pressure=None)
¶
Return fluid density [kg/m^3] at tank pressure and temperature.
Uses CoolProp. If pressure is provided, it is used as the tank pressure override (e.g., a piston-pressurized stacked-tank system).
Returns:
| Type | Description |
|---|---|
float
|
Fluid density [kg/m^3]. |
Source code in machwave/models/propulsion/feed_systems/tanks/base.py
get_pressure()
¶
Return the current tank pressure [Pa] using two-phase logic.
1) Compute the saturation pressure at the given temperature. 2) If fluid_mass > mass_if_all_vapor(p_sat), the tank is partially liquid and the pressure is pinned at saturation. 3) Otherwise, the tank is all vapor (ideal gas), and we use P = (m / M) * R * T / V.
Returns:
| Type | Description |
|---|---|
float
|
Tank pressure [Pa]. |
Source code in machwave/models/propulsion/feed_systems/tanks/base.py
remove_propellant(mass)
¶
Removes the specified mass of fluid [kg] from the tank.
If the requested mass exceeds what's in the tank, sets total mass to 0.