User Driving Force
UserDrivingForce exposes a simple, per-phase-pair interface for injecting a user-specified driving force 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 formwith latent heat, equilibrium temperature, liquidus slope, and reference component.
The mode and parameters are specified per unordered pair UDF_Value_0_1 : 1e6 also sets
Key Classes and Concepts
UserDrivingForce : public OPObject: the per-pair schedule evaluator; registers its contribution into the sharedDrivingForceobject at the call site.UserDrivingForceModes: enum with valuesNone,Value,Formula.
Modes
NONE
No contribution for this pair. Default if the key is absent.
VALUE
Constant driving force:
FORMULA
Linearised form:
with UDF_LatentHeat_<a>_<b> as UDF_Teq_<a>_<b> as UDF_Slope_<a>_<b> as UDF_Component_<a>_<b> picking which component index
Usage
Input
Defined in the @UserDrivingForce block. Per phase-pair, the mode is required; the remaining keys depend on the chosen mode.
@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
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
#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
- DrivingForce — the accumulator this writes into.
- PhaseField — source of
, . - Composition — supplies
in FORMULAmode. - Temperature — supplies
in FORMULAmode.