Heat Sources
HeatSources lets a simulation inject externally specified heat contributions into the heat equation solved by HeatDiffusion. Sources are enumerated (Source_0, Source_1, …); each source has a magnitude, a spatial type, an energy distribution, an ON trigger, an OFF trigger, and a repeat count. Multiple sources can be active at once.
Key Classes and Concepts
HeatSources : public OPObject: reads the source list from the input file, tracks per-source activation state, and adds the accumulated source term to the heat equation each step.HeatSourceTypes: enum of spatial types.HeatSourceEnergyDistributions: enum of intensity profiles for volumetric sources.EventTriggers: enum of event conditions used byTriggerONandTriggerOFF.
Source types ($Type_<n>)
| Value | Meaning |
|---|---|
BCX0, BCXN | Heat flux on the X = 0 / X = N face. |
BCY0, BCYN | Heat flux on the Y = 0 / Y = N face. |
BCZ0, BCZN | Heat flux on the Z = 0 / Z = N face. |
PHASE | Volumetric source tied to the phase selected by $PhaseIndex_<n>. |
ELLIPSOIDAL | Moving ellipsoidal volume source (weld / laser). |
Energy distribution ($EnergyDistribution_<n>, ellipsoidal only)
| Value | Profile |
|---|---|
UNIFORM (default) | Constant magnitude inside the ellipsoid. |
GAUSSIAN | Gaussian profile centred on the ellipsoid. |
Trigger events ($TriggerON_<n>, $TriggerOFF_<n>)
| Value | Meaning |
|---|---|
USER (default) | Controlled manually (no automatic transition). |
TMAX | Trigger when temperature exceeds $TriggerONvalue_<n>. |
TMIN | Trigger when temperature drops below the trigger value. |
TIME | Trigger when simulation time passes the trigger value. |
TIMESTEP | Trigger on a specific time-step number. |
PHASEFRACTIONMAX | Trigger when fraction of $PhaseIndexON_<n> exceeds the trigger value. |
PHASEFRACTIONMIN | Trigger when fraction of $PhaseIndexON_<n> falls below the value. |
$TriggerOFF_<n> defaults to the value of $TriggerON_<n>.
Usage
Input
Sources are numbered from 0 and grouped in the @HeatSources block. Below: one face-flux source on the left X face, one moving ellipsoidal laser pulse.
@HeatSources
$Source_0 Enable source 0 : Yes
$Value_0 Magnitude of source 0 : 5.0e6
$Type_0 Source type : BCX0
$TriggerON_0 ON trigger : USER
$TriggerOFF_0 OFF trigger : USER
$Repeat_0 Repeat count : 1
$Source_1 Enable source 1 : Yes
$Value_1 Magnitude of source 1 : 1.0e10
$Type_1 Source type : ELLIPSOIDAL
$Position_1 Position (x y z) : 0 0 0
$Radii_1 Radii (rx ry rz) : 5e-5 5e-5 2e-5
$Velocity_1 Velocity (vx vy vz) : 1e-2 0 0
$EnergyDistribution_1 Intensity profile : GAUSSIAN
$TriggerON_1 ON trigger : TIME
$TriggerONvalue_1 Activate at simulation time : 0.0
$TriggerOFF_1 OFF trigger : TIME
$TriggerOFFvalue_1 Deactivate at simulation time : 1.0
$Repeat_1 Repeat count : 1$Position_<n>, $Radii_<n>, and $Velocity_<n> are required when $Type_<n> = ELLIPSOIDAL. $PhaseIndex_<n> is required when $Type_<n> = PHASE. $TriggerONvalue_<n> is required unless the ON trigger is USER. $PhaseIndexON_<n> / $PhaseIndexOFF_<n> are required when the trigger is PHASEFRACTIONMAX or PHASEFRACTIONMIN.
Output
The contribution is summed into the field consumed by HeatDiffusion; there is no separate file.
Example
#include "HeatSources.h"
#include "HeatDiffusion.h"
HeatSources HS(OPSettings, InputFile);
HeatDiffusion HD(OPSettings, InputFile);
for(RTC.tStep = RTC.tStart; RTC.tStep <= RTC.nSteps; RTC.IncrementTimeStep())
{
HS.Apply(Phi, Tx, RTC); // activate/deactivate + accumulate
HD.Solve(Phi, Tx, BC); // includes source term
}