Skip to content

Mass Density

MassDensity is a thin per-phase density storage. It records an initial mass-density value for each active phase and exposes a Set method that builds the spatial density field from the current phase fractions and the current composition/temperature, for any downstream module that needs ρ(x) (thermo-mechanical coupling, heat transport in compressible flow, reactive-flow mixture models).

Key Classes and Concepts

  • MassDensity : public OPObject: holds Initial[alpha] per phase and a Total spatial field populated by Set(PhaseField&, Composition&, Temperature&).

Usage

Input

Defined in the @MassDensity block. One value is required per active phase, keyed by zero-based phase index.

text
@MassDensity

$Rho0_0     Initial mass density, phase 0  [kg/m^3] : 7850
$Rho0_1     Initial mass density, phase 1  [kg/m^3] : 7000

Output

No dedicated output file. The spatial density is consumed by whichever module needs it.

Example

cpp
#include "MassDensity.h"

MassDensity Rho(OPSettings, InputFile);

for(RTC.tStep = RTC.tStart; RTC.tStep <= RTC.nSteps; RTC.IncrementTimeStep())
{
    // ... phase-field update, composition update, heat update ...

    Rho.Set(Phi, Cx, Tx);
    // Rho.Total is now the current ρ(x); downstream modules can read it.
}

Dependencies

Released under the GNU GPLv3 License.