Iterative flow-field setters¶
Iterative setter functions for Block objects.
This module provides iterative solvers for initialising
Block objects with flow fields from combined
thermodynamic and kinematic variable sets that do not have a closed-form
solution for the corresponding conserved variables. For example, stagnation
pressure depends on both velocity and static pressure. These functions run a
fixed-point iteration on density to solve the ensuing implicit equations, then
modify the block in place with the converged flow field. Like the non-iterative
setters such as set_P_T(), inputs must be
broadcastable to the block shape.
The prescribed stagnation enthalpy and flow angles are in the absolute (stationary) frame; the velocity magnitude is closed by a Mach number, a meridional mass flux, or a fixed swirl.
|
Set the flow field from stagnation enthalpy, entropy, absolute Mach number and flow angles. |
|
Set the flow field from stagnation enthalpy, entropy, meridional mass flux and flow angles. |
|
Set the flow field from stagnation enthalpy, entropy, meridional mass flux and fixed swirl. |
For rotating rows: rothalpy (or relative total conditions) and relative flow angles are prescribed, and the energy balance is closed with the absolute velocity through the local blade speed \(U = r\,\Omega\). The block must carry its radial coordinate before these are called (angular velocity defaults to zero if not set).
|
Set the flow field from rothalpy, entropy, relative Mach number and relative flow angles. |
|
Set the flow field from absolute total conditions, relative Mach number and relative flow angles. |
Example usage¶
Initialise a block from stagnation conditions, a relative Mach number that ramps along the block, and flow angles:
import numpy as np
import ember.block
import ember.fluid
import ember.set_iterative
fluid = ember.fluid.PerfectFluid(cp=1005.0, gamma=1.4, mu=1.8e-5, Pr=0.7)
block = ember.block.Block(shape=(4,))
block.set_fluid(fluid)
block.set_r(1.0) # blade speed is U = r * Omega, so the radius is required
block.set_Omega(100.0)
# Absolute Po [Pa] and To [K], relative Mach, yaw and pitch [deg]. Scalars
# broadcast across the block; Ma_rel here is a profile.
ember.set_iterative.set_Po_To_Ma_rel_Alpha_rel_Beta(
block, Po=1.0e5, To=300.0, Ma_rel=np.linspace(0.2, 0.6, 4),
Alpha_rel=0.0, Beta=0.0,
)
# block.Po ~ 1e5, block.To ~ 300, block.Ma_rel ~ [0.2 ... 0.6];
# block.Ma (absolute) differs from Ma_rel by the wheel speed
- set_iterative.set_ho_s_Ma_Alpha_Beta(block, ho, s, Ma, Alpha=0.0, Beta=0.0, max_iter=200, tol=1e-06)[source]¶
Set the flow field from stagnation enthalpy, entropy, absolute Mach number and flow angles.
Entropy is held constant while density is iterated until the static state and the velocity implied by the Mach number satisfy the stagnation enthalpy. Velocities are in the absolute (stationary) frame.
- Parameters:
block (Block) – Block to modify in place.
ho (array-like) – Stagnation enthalpy [J/kg]. Must broadcast to block shape.
s (array-like) – Specific entropy [J/kg/K]. Must broadcast to block shape.
Ma (array-like) – Absolute Mach number [-]. Must broadcast to block shape.
Alpha (array-like, default 0.0) – Absolute yaw angle [deg]. Must broadcast to block shape.
Beta (array-like, default 0.0) – Pitch angle [deg]. Must broadcast to block shape.
max_iter (int, default 200) – Maximum number of iterations before a
RuntimeErroris raised.tol (float, default 1e-6) – Relative convergence tolerance on density.
- set_iterative.set_ho_s_rhoVm_Alpha_Beta(block, ho, s, rhoVm, Alpha=0.0, Beta=0.0, max_iter=200, tol=1e-06)[source]¶
Set the flow field from stagnation enthalpy, entropy, meridional mass flux and flow angles.
Entropy is held constant while density is iterated until the static state and the velocity implied by the meridional mass flux satisfy the stagnation enthalpy. Velocities are in the absolute (stationary) frame.
- Parameters:
block (Block) – Block to modify in place.
ho (array-like) – Stagnation enthalpy [J/kg]. Must broadcast to block shape.
s (array-like) – Specific entropy [J/kg/K]. Must broadcast to block shape.
rhoVm (array-like) – Meridional mass flux (momentum density) [kg/m^2/s]. Must broadcast to block shape.
Alpha (array-like, default 0.0) – Absolute yaw angle [deg]. Must broadcast to block shape.
Beta (array-like, default 0.0) – Pitch angle [deg]. Must broadcast to block shape.
max_iter (int, default 200) – Maximum number of iterations before a
RuntimeErroris raised.tol (float, default 1e-6) – Relative convergence tolerance on density.
- set_iterative.set_ho_s_rhoVm_Vt_Beta(block, ho, s, rhoVm, Vt, Beta=0.0, max_iter=200, tol=1e-06)[source]¶
Set the flow field from stagnation enthalpy, entropy, meridional mass flux and fixed swirl.
The stagnation enthalpy, entropy and tangential velocity are held fixed while the meridional velocity and static state adjust to carry the prescribed meridional mass flux \(\rho V_m\). Holding \(V_\theta\) rather than the yaw angle conserves angular momentum at fixed radius, unlike
set_ho_s_rhoVm_Alpha_Beta().Only the subsonic meridional branch is solved. \(\rho V_m\) is maximised at meridional Mach number unity; a
RuntimeErroris raised if the requested value exceeds that sonic maximum.- Parameters:
block (Block) – Block to modify in place.
ho (array-like) – Stagnation enthalpy [J/kg]. Must broadcast to block shape.
s (array-like) – Specific entropy [J/kg/K]. Must broadcast to block shape.
rhoVm (array-like) – Meridional mass flux (momentum density) [kg/m^2/s]. Must broadcast to block shape.
Vt (array-like) – Tangential (swirl) velocity, held fixed [m/s]. Must broadcast to block shape.
Beta (array-like, default 0.0) – Pitch angle [deg]. Must broadcast to block shape.
max_iter (int, default 200) – Maximum number of iterations before a
RuntimeErroris raised.tol (float, default 1e-6) – Relative convergence tolerance on density.
- set_iterative.set_I_s_Ma_rel_Alpha_rel_Beta(block, I, s, Ma_rel, Alpha_rel, Beta, max_iter=200, tol=1e-06)[source]¶
Set the flow field from rothalpy, entropy, relative Mach number and relative flow angles.
Entropy is held constant while density is iterated until the static state and the relative velocity satisfy the rothalpy \(I = h + \tfrac12 V^2 - U V_\theta\), where \(V_\theta\) is the absolute tangential velocity and \(U = r\,\Omega\) the blade speed. Set the block radius (and rotation rate, if rotating) first.
- Parameters:
block (Block) – Block to modify in place.
I (array-like) – Rothalpy [J/kg]. Must broadcast to block shape.
s (array-like) – Specific entropy [J/kg/K]. Must broadcast to block shape.
Ma_rel (array-like) – Relative-frame Mach number [-]. Must broadcast to block shape.
Alpha_rel (array-like) – Relative yaw angle [deg]. Must broadcast to block shape.
Beta (array-like) – Pitch angle [deg]. Must broadcast to block shape.
max_iter (int, default 200) – Maximum number of iterations before a
RuntimeErroris raised.tol (float, default 1e-6) – Relative convergence tolerance on density.
- set_iterative.set_Po_To_Ma_rel_Alpha_rel_Beta(block, Po, To, Ma_rel, Alpha_rel, Beta, max_iter=200, tol=1e-06)[source]¶
Set the flow field from absolute total conditions, relative Mach number and relative flow angles.
The total pressure and temperature fix the absolute stagnation enthalpy and entropy. Entropy is held constant while density is iterated until the static state and the relative velocity satisfy \(h_0 = h + \tfrac12 V^2\), with \(V\) the absolute velocity and blade speed \(U = r\,\Omega\). Set the block radius (and rotation rate, if rotating) first.
- Parameters:
block (Block) – Block to modify in place.
Po (array-like) – Absolute total pressure [Pa]. Must be positive and broadcast to block shape.
To (array-like) – Absolute total temperature [K]. Must be positive and broadcast to block shape.
Ma_rel (array-like) – Relative-frame Mach number [-]. Must broadcast to block shape.
Alpha_rel (array-like) – Relative yaw angle [deg]. Must broadcast to block shape.
Beta (array-like) – Pitch angle [deg]. Must broadcast to block shape.
max_iter (int, default 200) – Maximum number of iterations before a
RuntimeErroris raised.tol (float, default 1e-6) – Relative convergence tolerance on density.
- Raises:
ValueError – If the block radius has not been set.