Skip to content

Heat Diffusion

HeatDiffusion solves the transient heat equation on the simulation grid coupled to the phase-field. Each phase carries its own thermal conductivity and volumetric heat capacity, and the solver mixes those properties by phase fraction. The solve is iterative: convergence is controlled by a per-call tolerance and a maximum iteration count, and the solver is normally called every $SolverCallsInterval time steps rather than every step.

Key Classes and Concepts

  • HeatDiffusion : public OPObject: owns the per-phase conductivity and heat-capacity arrays, the iterative solver state, and the temperature field it updates on the shared Temperature storage.

Model

Heat transport in a multi-phase domain:

(1)ρcp(ϕ)Tt=(k(ϕ)T)+Qext,

with phase-weighted effective properties

(2)k(ϕ)=αϕαkα,cp(ϕ)=αϕαcp,α,

and an optional external source term Qext supplied by HeatSources.

Usage

Input

Defined in the @HeatDiffusion block. Per-phase $ThermalConductivity_<n> and $VolumetricHeatCapacity_<n> are required for each active phase; solver controls have defaults and only need to be overridden.

text
@HeatDiffusion

$ThermalConductivity_0     Thermal conductivity, phase 0             : 80.0
$ThermalConductivity_1     Thermal conductivity, phase 1             : 33.0

$VolumetricHeatCapacity_0  Volumetric heat capacity, phase 0         : 4.0e6
$VolumetricHeatCapacity_1  Volumetric heat capacity, phase 1         : 5.4e6

$Tolerance             Solver convergence tolerance                  : 1.0e-6
$MaxIterations         Max iterations per call                       : 50
$SolverCallsInterval   Call the solver every N time steps            : 1
$VerboseIterations     Echo iteration residuals                      : No

Output

The updated temperature field is written by the Temperature module's VTK output; HeatDiffusion itself does not write a separate file.

Example

cpp
#include "Settings.h"
#include "RunTimeControl.h"
#include "BoundaryConditions.h"
#include "PhaseField.h"
#include "Temperature.h"
#include "HeatDiffusion.h"

using namespace openphase;

int main(int argc, char *argv[])
{
    std::string InputFile = (argc > 1) ? argv[1] : "ProjectInput.opi";

    Settings           OPSettings;
    OPSettings.ReadInput(InputFile);

    RunTimeControl     RTC(OPSettings, InputFile);
    BoundaryConditions BC(OPSettings, InputFile);
    PhaseField         Phi(OPSettings, InputFile);
    Temperature        Tx(OPSettings, InputFile);
    HeatDiffusion      HD(OPSettings, InputFile);

    for(RTC.tStep = RTC.tStart; RTC.tStep <= RTC.nSteps; RTC.IncrementTimeStep())
    {
        // ... phase-field update ...

        if (RTC.tStep % HD.SolverCallsInterval == 0)
        {
            HD.Solve(Phi, Tx, BC);
        }
    }
}

See also: examples

In OpenPhase-main/examples/:

  • HeatDiffusion — the canonical example for this solver.
  • LatentHeat — heat diffusion with phase-change latent-heat release.
  • AdditiveNiAl — additive-manufacturing setup combining HeatDiffusion with moving heat sources.

Dependencies

Released under the GNU GPLv3 License.