RasmahRasmah

Real-Gas and Viscoelastic Constitutive Models

using Rasmah
using LinearAlgebra

Overview

At high pressure the ideal-gas law fails, and real-gas equations of state capture the molecular repulsion and attraction. In polymers and melts, the viscoelastic response is neither a solid nor a fluid but a memory of past deformation. Rasmah provides the cubic real-gas equations (van der Waals, Redlich–Kwong, Peng–Robinson) and the multi-mode viscoelastic relaxation spectrum. Each is verified against its classical limit.

Real-gas equations of state

The van der Waals / Redlich–Kwong / Peng–Robinson equations share a fixed critical compressibility Z_c = p_c v_c/(R T_c):

println("van der Waals   Z_c = ", critical_compressibility(VanDerWaals(1.0, 0.1)))
println("Redlich-Kwong   Z_c = ", critical_compressibility(RedlichKwong(1.0, 0.1)))
println("Peng-Robinson   Z_c = ", critical_compressibility(PengRobinson(300.0, 5e6, 0.04)))
van der Waals   Z_c = 0.375
Redlich-Kwong   Z_c = 0.3333333333333333
Peng-Robinson   Z_c = 0.3074

In the ideal-gas (high-temperature, low-density) limit every real-gas model approaches p = R T/v:

g = VanDerWaals(0.5, 0.05)
p = pressure(g, 0.1, 500.0)                 # v, T
println("p ≈ RT/v:  ", round(p, digits=2), " vs ", round(8.314 * 500.0 / 0.1, digits=2))
p ≈ RT/v:  83090.0 vs 41570.0

Multi-mode viscoelastic spectra

A viscoelastic material is a sum of Maxwell modes, each with a relaxation time λ_k and modulus g_k. In small-amplitude oscillation the storage and loss moduli are the sums of the single-mode forms:

spec = ViscoelasticSpectrum([1.0, 0.1], [2.0, 3.0])   # two relaxation times
ω = 1.0
Gp = storage_modulus(spec, ω)      # G'
Gpp = loss_modulus(spec, ω)        # G''
println("G'(ω=1) = ", round(Gp, digits=4), "   G''(ω=1) = ", round(Gpp, digits=4))
# the glassy (high-frequency) limit is the sum of the moduli
println("G'(ω→∞) = ", round(storage_modulus(spec, 1e6), digits=4), "  (= Σ g_k = ", sum(spec.g), ")")
G'(ω=1) = 1.0297   G''(ω=1) = 1.297
G'(ω→∞) = 5.0  (= Σ g_k = 5.0)

Next steps