Materials and fluids#
Materials#
Storage materials: the enthalpy-temperature relation, the conductivity and the liquid fraction of the material a storage submodel holds.
A material maps its enthalpy per unit volume H and its internal states to a temperature.
The materials here have no internal states (internal_states is empty), so the
temperature is a function of H alone. Materials with kinetics or hysteresis will add
internal states without changing the storage submodels (DESIGN D7).
Enthalpies are per unit volume and relative to 0 K. Energy variables subtract the enthalpy at the reference temperature, so this reference never shows in the outputs.
- pytes.materials.smooth_min(a, b, width)[source]#
Smooth approximation of min(a, b),
(a + b - sqrt((a - b)**2 + width**2)) / 2.It rounds the corner at
a = bover a distance of orderwidth, is never larger than min(a, b), differs from it by at mostwidth / 2(at the corner), and is exactly min(a, b) whenwidthis 0.- Parameters:
a (
pybamm.Symbolorfloat) – The values to compare.b (
pybamm.Symbolorfloat) – The values to compare.width (
pybamm.Symbolorfloat) – Smoothing width, in the units ofaandb.
- Returns:
pybamm.Symbol– The smoothed minimum.
- pytes.materials.smooth_max(a, b, width)[source]#
Smooth approximation of max(a, b),
(a + b + sqrt((a - b)**2 + width**2)) / 2. Never smaller than max(a, b); seesmooth_min().
- class pytes.materials.SensibleMaterial(prefix='Metal')[source]#
Bases:
objectA material that does not change phase, such as the metal of the fins.
- Parameters:
prefix (
str, optional) – Prefix of the parameter names (default “Metal”): “<prefix> conductivity [W.m-1.K-1]”, “<prefix> density [kg.m-3]” and “<prefix> specific heat capacity [J.kg-1.K-1]”.- Variables:
c_p (k_param, rho,) – Conductivity [W.m-1.K-1], density [kg.m-3] and specific heat capacity [J.kg-1.K-1].
rho_c_p (
pybamm.Symbol) – Volumetric heat capacity [J.m-3.K-1].internal_states (
tuple) – Empty: the temperature is a function of the enthalpy alone.changes_phase (
bool) – False: the material has no liquid fraction.H_reference (H_scale,) – Typical enthalpy scale and reference [J.m-3], those of 100 K and 300 K. A storage submodel may override them (e.g. to scale like the model’s temperatures).
- class pytes.materials.PhaseChangeMaterial[source]#
Bases:
objectThermal properties of a material that melts, and the enthalpy-temperature relations derived from them. The enthalpy is per unit volume and relative to 0 K.
Subclasses set the solid and liquid volumetric heat capacities
rho_c_p_sandrho_c_p_l[J.m-3.K-1], the volumetric latent heatrho_L[J.m-3], the solid and liquid conductivitiesk_sandk_l[W.m-1.K-1], the melting temperatureT_m[K], the melting rangemelting_range[K] and the smoothing widthsmoothing_width[K], then call_set_derived().The material melts between the solidus
T_m - melting_range / 2and the liquidusT_m + melting_range / 2(DESIGN D7). In between (the mushy zone) the enthalpy is linear in temperature: the latent heat spread evenly, plus the mean of the solid and liquid heat capacities. A melting range of 0 gives a sharp melting point, where the temperature stays atT_mwhile the material melts.Separately, the corners of the relations at the solidus and liquidus are smoothed over
smoothing_width, a numerical device that makes the models faster. A width of 0 gives exact corners. Both may be 0.- Variables:
internal_states (
tuple) – Empty: the temperature is a function of the enthalpy alone.changes_phase (
bool) – True: the material has a liquid fraction.T_liquidus (T_solidus,) – Solidus and liquidus temperatures [K].
rho_c_p_mushy (
pybamm.Symbol) – Sensible heat capacity in the mushy zone [J.m-3.K-1], the mean of the solid and liquid ones.H_liquidus (H_solidus,) – Enthalpy at the solidus (fully solid) and at the liquidus (fully liquid) [J.m-3].
dT_smooth (
pybamm.Symbol) – The smoothing width, floored at 1e-9 K so that derivatives stay defined where the arguments ofsmooth_min()andsmooth_max()are equal (its effect is at most 5e-10 K).H_reference (H_scale,) – Scale and reference for the enthalpy as a solver variable: the enthalpy of the mushy zone and its middle. The scaled enthalpy is then the liquid fraction minus 1/2 while melting, and of order one over the operating range, as the sensible heat is comparable to the latent heat.
- H2T(H, states=())[source]#
Temperature as a function of the enthalpy and the internal states (none here).
Below the solidus the temperature is
H / rho_c_p_s; in the mushy zone it rises linearly from the solidus to the liquidus temperature with the liquid fraction; above the liquidus it isT_liquidus + (H - H_liquidus) / rho_c_p_l. The corners are smoothed overdT_smooth.- Parameters:
H (
pybamm.Symbol) – Enthalpy per unit volume, relative to 0 K [J.m-3].states (
tuple, optional) – Internal states, in the order ofinternal_states(none for this material).
- Returns:
pybamm.Symbol– Temperature [K].
- T2H(T)[source]#
Enthalpy as a function of the temperature.
This is the exact (unsmoothed) relation. Away from the solidus and the liquidus it inverts
H2T()up to aboutdT_smooth**2 / (4 d), withdthe distance to the nearer of them. For a sharp melting point (melting range 0), the material at exactlyT = T_mis taken to be fully solid.- Parameters:
T (
pybamm.Symbol) – Temperature [K].- Returns:
pybamm.Symbol– Enthalpy per unit volume, relative to 0 K [J.m-3].
- k(H, states=())[source]#
Conductivity [W.m-1.K-1] as a function of the enthalpy [J.m-3], interpolated linearly in the liquid fraction between
k_sandk_l.
- liquid_fraction(H, states=())[source]#
Liquid fraction as a function of the enthalpy [J.m-3]: the fraction of the mushy zone’s enthalpy,
(H - H_solidus) / (H_liquidus - H_solidus), clipped to [0, 1] with the corners smoothed over the enthalpy widths matchingdT_smooth(rho_c_p_s * dT_smoothandrho_c_p_l * dT_smooth). In the mushy zone it is also(T - T_solidus) / melting_range. It is between 0 and 1 up to an overshoot of order(rho_c_p * dT_smooth / rho_L)**2when smoothed.
- class pytes.materials.PureMaterial(prefix='PCM')[source]#
Bases:
PhaseChangeMaterialA phase-change material on its own:
rho_c_p_s = rho_s c_p_s,rho_c_p_l = rho_l c_p_l,rho_L = rho_s L(the latent heat per unit volume uses the solid density, neglecting the volume change on melting).- Parameters:
prefix (
str, optional) – Prefix of the parameter names (default “PCM”), e.g. “<prefix> latent heat [J.kg-1]”, “<prefix> melting range [K]” and “<prefix> smoothing width [K]”.- Variables:
smoothing_width (k_s, k_l, rho_s, rho_l, c_p_s, c_p_l, L, T_m, melting_range,) – “<prefix> solid phase conductivity [W.m-1.K-1]”, “<prefix> liquid phase conductivity [W.m-1.K-1]”, “<prefix> solid phase density [kg.m-3]”, “<prefix> liquid phase density [kg.m-3]”, “<prefix> solid phase specific heat capacity [J.kg-1.K-1]”, “<prefix> liquid phase specific heat capacity [J.kg-1.K-1]”, “<prefix> latent heat [J.kg-1]”, “<prefix> melting temperature [K]” (the middle of the melting range), “<prefix> melting range [K]” (from solidus to liquidus; 0 for a sharp melting point) and “<prefix> smoothing width [K]” (numerical; 0 for exact corners).
- class pytes.materials.CompositeMaterial(pcm, filler, volume_fraction)[source]#
Bases:
PhaseChangeMaterialA phase-change material and a sensible filler (such as metal fins) homogenised into one material, with the filler taking up a volume fraction
delta:heat capacities: volume averages,
rho_c_p_s = delta rho_c_p_filler + (1 - delta) rho_c_p_s,PCM(and similarly for the liquid);latent heat:
rho_L = (1 - delta) rho_L,PCM, as only the PCM melts;conductivities: volume averages,
k_s = (1 - delta) k_s,PCM + delta k_filler(and similarly for the liquid), i.e. the parallel arrangement, for heat flowing along the filler.
- Parameters:
pcm (
PureMaterial) – The phase-change material.filler (
SensibleMaterial) – The filler.volume_fraction (
pybamm.Symbol) – Volume fraction of the filler,delta.
Fluids#
Heat transfer fluid (HTF) properties.
The fluid-property object is the only way a model obtains fluid properties (DESIGN D8). Its
properties are functions of the fluid state, the specific enthalpy h and the pressure
p, the natural inputs of property tables, so that they stay valid for a fluid whose
temperature is flat across a phase change (a refrigerant, later). h(T, p) gives the
enthalpy for the inlet and initial conditions. Power is defined from the specific enthalpy,
mdot (h_out - h_in).
The heat transfer coefficient is not a fluid property: it depends on the geometry and the
flow too, and belongs to the surface flux law of a coupling (DESIGN D6, D8, see
pytes.submodels.flux_laws).
- class pytes.fluids.ConstantPropertyLiquid(prefix='Heat transfer fluid', T_ref=0)[source]#
Bases:
objectA liquid with constant density and specific heat capacity, so that its specific enthalpy is linear in temperature:
h = c_p (T - T_ref). The pressure is ignored.The enthalpy reference
T_refonly shiftsh; energy variables and power use differences ofh, so it never shows in the outputs.- Parameters:
prefix (
str, optional) – Prefix of the parameter names (default “Heat transfer fluid”).T_ref (
pybamm.Symbolorfloat, optional) – Temperature at whichh = 0[K] (default 0 K).
- Variables:
mu_param (rho_param, c_p_param, k_param,) – “<prefix> density [kg.m-3]”, “<prefix> specific heat capacity [J.kg-1.K-1]”, “<prefix> conductivity [W.m-1.K-1]” and “<prefix> viscosity [Pa.s]”. The conductivity and the viscosity are used by the flow-dependent heat transfer coefficients (
pytes.submodels.NusseltCorrelation); the conductivity is also the hook for axial diffusion.