Skip to content

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 by TriggerON and TriggerOFF.

Source types ($Type_<n>)

ValueMeaning
BCX0, BCXNHeat flux on the X = 0 / X = N face.
BCY0, BCYNHeat flux on the Y = 0 / Y = N face.
BCZ0, BCZNHeat flux on the Z = 0 / Z = N face.
PHASEVolumetric source tied to the phase selected by $PhaseIndex_<n>.
ELLIPSOIDALMoving ellipsoidal volume source (weld / laser).

Energy distribution ($EnergyDistribution_<n>, ellipsoidal only)

ValueProfile
UNIFORM (default)Constant magnitude inside the ellipsoid.
GAUSSIANGaussian profile centred on the ellipsoid.

Trigger events ($TriggerON_<n>, $TriggerOFF_<n>)

ValueMeaning
USER (default)Controlled manually (no automatic transition).
TMAXTrigger when temperature exceeds $TriggerONvalue_<n>.
TMINTrigger when temperature drops below the trigger value.
TIMETrigger when simulation time passes the trigger value.
TIMESTEPTrigger on a specific time-step number.
PHASEFRACTIONMAXTrigger when fraction of $PhaseIndexON_<n> exceeds the trigger value.
PHASEFRACTIONMINTrigger 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.

text
@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

cpp
#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
}

Dependencies

Released under the GNU GPLv3 License.