Skip to content

User Driving Force

UserDrivingForce exposes a simple, per-phase-pair interface for injecting a user-specified driving force Δgαβ into the shared DrivingForce accumulator. It is the quickest way to run a controlled phase-transition study — solidification under a fixed undercooling, a grain-growth experiment with a prescribed curvature-free driving force, or an isothermal transformation — without coupling in a full thermodynamic database. Two modes are supported:

  • VALUE — a constant driving force per pair.
  • FORMULA — the classical linearised form Δgαβ=Lαβ(TTαβeq)/Tαβeq+mαβ(ckcαβeq) with latent heat, equilibrium temperature, liquidus slope, and reference component.

The mode and parameters are specified per unordered pair {α,β} with α<β; the library antisymmetrises the value automatically so that writing UDF_Value_0_1 : 1e6 also sets Δg10=106.

Key Classes and Concepts

  • UserDrivingForce : public OPObject: the per-pair schedule evaluator; registers its contribution into the shared DrivingForce object at the call site.
  • UserDrivingForceModes: enum with values None, Value, Formula.

Modes

NONE

No contribution for this pair. Default if the key is absent.

VALUE

Constant driving force:

(1)Δgαβ=UDF_Valueαβ.

FORMULA

Linearised form:

(2)Δgαβ=LαβTTαβeqTαβeq+mαβ(ckαβcαβeq),

with UDF_LatentHeat_<a>_<b> as Lαβ, UDF_Teq_<a>_<b> as Tαβeq, UDF_Slope_<a>_<b> as mαβ, and UDF_Component_<a>_<b> picking which component index k is monitored.

Usage

Input

Defined in the @UserDrivingForce block. Per phase-pair, the mode is required; the remaining keys depend on the chosen mode.

text
@UserDrivingForce

# Constant driving force, favouring phase 1 {#constant-driving-force-favouring-phase-1}
$UDF_Mode_0_1       Mode (NONE / VALUE / FORMULA)               : VALUE
$UDF_Value_0_1      Driving force (J/m^3)                       : 1.0e6

# Linearised solidification driving force between phase 1 and 2 {#linearised-solidification-driving-force-between-phase-1-and-2}
$UDF_Mode_1_2       Mode                                        : FORMULA
$UDF_LatentHeat_1_2 Latent heat of 1 → 2 (J/m^3)               : 2.0e9
$UDF_Teq_1_2        Equilibrium temperature (K)                 : 1810.0
$UDF_Slope_1_2      Liquidus slope (J/(m^3·mol-fraction))       : 5.0e7
$UDF_Component_1_2  Monitored component index                   : 0

$UDF_Value_*, $UDF_LatentHeat_*, and $UDF_Teq_* are required when the respective mode is active. $UDF_Slope_* and $UDF_Component_* default to 0.0 and 0 in FORMULA mode. Ordering: supply the pair with α<β; antisymmetric values for the reverse direction are set automatically.

Output

None. The contribution is accumulated into DrivingForce when Apply is called inside the time loop; downstream VTK output of the driving force comes from there.

Example

cpp
#include "UserDrivingForce.h"
#include "DrivingForce.h"

UserDrivingForce UDF(OPSettings, InputFile);
DrivingForce     dG(OPSettings, InputFile);

for(RTC.tStep = RTC.tStart; RTC.tStep <= RTC.nSteps; RTC.IncrementTimeStep())
{
    dG.Clear();
    UDF.Apply(Phi, Cx, Tx, dG);     // accumulate the user contribution

    DO.CalculatePhaseFieldIncrements(Phi, IP, dG);
    Phi.NormalizeIncrements(BC, RTC.dt);
    Phi.MergeIncrements(BC, RTC.dt);
}

Dependencies

Released under the GNU GPLv3 License.