SpectraSim Documentation
Parameter · 04 Material

Molar mass (custom gas)

custom_gas.molar_mass Unit: kg/kmol Step 04 · Material

The molar mass of the custom gas (kg/kmol, numerically equal to g/mol). It sets the specific gas constant, and with it the density in every run and the speed of sound in the acoustics.

Last updated

Theory

For an ideal gas, the specific gas constant is the universal gas constant divided by the molar mass, equation (1); the density follows from the ideal-gas law, equation (2). For a mixture of fixed composition, the molar mass is the mole-fraction-weighted sum of the species' molar masses, equation (3). The value is written as molWeight into the thermophysical properties of the compressible solver (OpenFOAM user guide, 2026).

The heat capacity must exceed the gas constant (otherwise cv=cp−Rc_v = c_p - R would not be positive); the material library rejects a material that violates this.

Equations

R=RMR = \frac{\mathcal{R}}{M}
(1)
ρ=pR T\rho = \frac{p}{R\,T}
(2)
M=∑ixi MiM = \sum_i x_i\,M_i
(3)
wheremeaningunit
RRSpecific gas constantJ/(kg K)
R\mathcal{R}Universal gas constant, 8314.47J/(kmol K)
MMMolar mass of the gaskg/kmol
ρ\rhoDensitykg/m³
ppAbsolute pressurePa
TTTemperatureK
xix_iMole fraction of species ii-
MiM_iMolar mass of species iikg/kmol

Default and rule

Default
28.9644 (dry air) in a new material
Rule

A new material starts at 28.9644 kg/kmol (dry air).

Source

Ideal-gas relations; the program uses a universal gas constant of 8314.47 J/(kmol K).

Valid range 0 < M <= 1000 kg/kmol

Values

Above 0 and up to 1000 kg/kmol. Helium 4.003, methane 16.04, air 28.96, CO₂ 44.01.

References 1

  1. OpenCFD Ltd. (2026). OpenFOAM user guide. openfoam.com. Web page