Skip to content

Composition

Composition is the shared storage for component concentration fields used by every diffusion solver and by the thermodynamic coupling. It holds the per-phase initial concentrations, the per-phase reference component, stoichiometric-phase flags, fast-diffusor flags, and optional domain extensions — padded layers of a uniform phase appended outside the simulation box on any of the six faces.

Components and phases are identified by name in the .opi input because the phase-field core indexes them numerically. The initial concentration key, for example, is $C0_<alpha>_<ComponentName>, where <alpha> is the phase index (zero-based) and <ComponentName> is the string declared in the @Settings block.

Key Classes and Concepts

  • Composition : public OPObject: storage + input-file reader for all composition-related state.
  • The component list and the number of phases come from Settings; Composition registers a field per (phase, component) pair.

Usage

Input

Defined in the @Composition block. Assume two phases (0, 1) and two components named Fe, C declared in @Settings.

text
@Composition

$RefElement_0            Reference component in phase 0              : Fe
$RefElement_1            Reference component in phase 1              : Fe

$C0_0_Fe                 Initial concentration of Fe in phase 0      : 0.95
$C0_0_C                  Initial concentration of C  in phase 0      : 0.05
$C0_1_Fe                 Initial concentration of Fe in phase 1      : 0.98
$C0_1_C                  Initial concentration of C  in phase 1      : 0.02

$Stoichiometric_0_Fe     Stoichiometric? (phase 0, Fe)               : No
$Stoichiometric_0_C      Stoichiometric? (phase 0, C)                : No
$Stoichiometric_1_Fe     Stoichiometric? (phase 1, Fe)               : No
$Stoichiometric_1_C      Stoichiometric? (phase 1, C)                : No

$FastDiffusor_0_C        Fast-diffusor flag (phase 0, C)             : Yes

# Optional face extensions — pad the domain with a layer of a chosen phase {#optional-face-extensions-pad-the-domain-with-a-layer-of-a-chosen-phase}
$Extension_X0            Layer size on X = 0 face                    : 0
$Extension_X0_Phase      Phase index used for the X = 0 layer        : 0
$Extension_XN            Layer size on X = N face                    : 0
$Extension_XN_Phase      Phase index used for the X = N layer        : 0
$Extension_Y0            Layer size on Y = 0 face                    : 0
$Extension_Y0_Phase      Phase index used for the Y = 0 layer        : 0
$Extension_YN            Layer size on Y = N face                    : 0
$Extension_YN_Phase      Phase index used for the Y = N layer        : 0
$Extension_Z0            Layer size on Z = 0 face                    : 0
$Extension_Z0_Phase      Phase index used for the Z = 0 layer        : 0
$Extension_ZN            Layer size on Z = N face                    : 0
$Extension_ZN_Phase      Phase index used for the Z = N layer        : 0

Notes from the source:

  • $RefElement_<alpha> defaults to the first component declared.
  • $FastDiffusor_<alpha>_<ComponentName> defaults to false.
  • $Stoichiometric_<alpha>_<ComponentName> defaults to false.
  • An $Extension_* axis is only read if the corresponding GridParameters dimension is active (dNx, dNy, dNz).

Output

Composition writes VTK per-component concentration fields through its WriteVTK method — one scalar field per component, prefixed by its name.

Example

cpp
#include "Composition.h"
#include "EquilibriumPartitionDiffusionBinary.h"

Composition                          Cx(OPSettings, InputFile);
EquilibriumPartitionDiffusionBinary  DF(OPSettings, InputFile);

for(RTC.tStep = RTC.tStart; RTC.tStep <= RTC.nSteps; RTC.IncrementTimeStep())
{
    DF.Solve(Phi, Cx, Tx, BC, RTC.dt);

    if (RTC.WriteVTK())
    {
        Cx.WriteVTK(OPSettings, RTC.tStep);
    }
}

Dependencies

Released under the GNU GPLv3 License.