pysolver_view.roots.problems.heated_gas_duct module#

A coupled heated-gas duct with real CoolProp property evaluations.

Each cell has unknown outlet temperature and pressure. The model balances a prescribed heat input per unit mass and a lumped pressure loss proportional to mass flux squared / density. It is a low-speed engineering timing workload, not a full compressible-flow, choking, or two-phase model.

CoolProp is an optional dependency, installed with pysolver_view[thermodynamics]. The public low-level interface and single-phase property derivatives are used: https://coolprop.org/coolprop/LowLevelAPI.html#partial-derivatives https://coolprop.org/coolprop/HighLevelAPI.html#partial-derivatives

class pysolver_view.roots.problems.heated_gas_duct.HeatedGasDuctProblem(n_cells=10, *, total_heat_per_mass=None, total_loss_coefficient=None)[source]#

Bases: BenchmarkProblem

Solve 2*n_cells coupled energy and pressure-loss equations.

Unknowns are interleaved [T_1, p_1, ..., T_N, p_N] in K and Pa. With fixed inlet enthalpy h_0 and pressure p_0, cell i satisfies

h(T_i,p_i) - h(T_(i-1),p_(i-1)) - q_i = 0 and p_(i-1) - p_i - 0.5*K*G**2 / rho(T_i,p_i) = 0.

q_i is heat per mass [J/kg], K is a dimensionless lumped loss coefficient, and G is prescribed mass flux [kg/(m^2*s)]. Energy equations neglect changes in kinetic energy, appropriate to this low-speed benchmark. Wall heat and resistance are prescribed, not fitted to produce a chosen solution.

Every residual call performs exactly n_cells fresh CoolProp PT updates. Every analytic-Jacobian call also performs n_cells fresh PT updates and obtains four analytic derivatives per cell. There is no residual cache, artificial sleep, repeated dummy work, or reuse of a previous call’s state. One AbstractState is constructed outside solve timing and each subsequent property call fully supplies pressure and temperature. Instances are not thread safe; concurrent solves need separate instances. Sequential solves can reuse the instance because each call fully establishes its state.

gradient(x)[source]#

Return the dense analytic Jacobian of the normalized equations using fresh property derivatives.

physical_residuals(x)[source]#

Return unscaled conservation errors, in J/kg and Pa respectively.

residual(x)[source]#

Return the interleaved dimensionless energy and pressure-loss residual vector of length 2*n_cells.

solution_diagnostics(x)[source]#

Physical checks for post-timing verification, not part of solve time.

source = 'https://coolprop.org/coolprop/LowLevelAPI.html#partial-derivatives'#