EOS dispatch
The main entry points for density evaluation. calculate_density and calculate_density_batch route a single (P, T) query (or a vectorised pair of arrays) to the right EOS family based on the EOS_REGISTRY entry: tabulated Seager2007, T-dependent (WolfBower2018, RTPress100TPa, PALEOS-2phase), unified PALEOS, the analytic polytrope, or the Vinet EOS. The dispatcher is what mixing.calculate_mixed_density calls per component before the harmonic mean is taken. PALEOS-API:* registry entries are detected here and lazily resolved through paleos_api_cache on first use.
dispatch
Main entry points for density calculation, dispatching to the right EOS.
calculate_density and calculate_density_batch are the primary
public API used by the solver and mixing modules.
calculate_density(pressure, material_dictionaries, layer_eos, temperature, solidus_func, liquidus_func, interpolation_functions=None, mushy_zone_factor=1.0)
Calculate density for a single layer given its EOS identifier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pressure
|
float
|
Pressure at which to evaluate the EOS, in Pa. |
required |
material_dictionaries
|
dict
|
EOS registry dict keyed by EOS identifier string
(from |
required |
layer_eos
|
str
|
Per-layer EOS identifier, for example |
required |
temperature
|
float
|
Temperature at which to evaluate the EOS, in K. |
required |
solidus_func
|
callable or None
|
Interpolation function for the solidus melting curve. |
required |
liquidus_func
|
callable or None
|
Interpolation function for the liquidus melting curve. |
required |
interpolation_functions
|
dict
|
Cache of interpolation functions used to avoid redundant loading. |
None
|
mushy_zone_factor
|
float
|
Cryoscopic depression factor for unified PALEOS tables. 1.0 = no mushy zone (sharp boundary from table). Default 1.0. |
1.0
|
Returns:
| Type | Description |
|---|---|
float or None
|
Density in kg/m^3, or |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in src/zalmoxis/eos/dispatch.py
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 | |
calculate_density_batch(pressures, temperatures, material_dictionaries, layer_eos, solidus_func, liquidus_func, interpolation_functions, mushy_zone_factor=1.0)
Vectorized density lookup for a batch of (P, T) points sharing one EOS.
For unified PALEOS tables, uses the vectorized interpolator path. For other EOS types, falls back to scalar calculate_density per point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pressures
|
ndarray
|
1D array of pressures in Pa. |
required |
temperatures
|
ndarray
|
1D array of temperatures in K. |
required |
material_dictionaries
|
dict
|
EOS registry. |
required |
layer_eos
|
str
|
EOS identifier string. |
required |
solidus_func
|
callable or None
|
Solidus melting curve function. |
required |
liquidus_func
|
callable or None
|
Liquidus melting curve function. |
required |
interpolation_functions
|
dict
|
Interpolation cache. |
required |
mushy_zone_factor
|
float
|
Cryoscopic depression factor. |
1.0
|
Returns:
| Type | Description |
|---|---|
ndarray
|
1D array of densities in kg/m^3. NaN where lookup fails. |
Source code in src/zalmoxis/eos/dispatch.py
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 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |