Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English version of the page.

# internalHeatSource

Specify internal heat source for a thermal model

## Syntax

``internalHeatSource(thermalmodel,heatSourceValue)``
``internalHeatSource(thermalmodel,heatSourceValue,RegionType,RegionID)``
``heatSource = internalHeatSource(___)``

## Description

example

````internalHeatSource(thermalmodel,heatSourceValue)` specifies an internal heat source for the thermal model. This syntax declares that the entire geometry is a heat source. NoteUse `internalHeatSource` for specifying internal heat generators, that is, for specifying heat sources that belong to the geometry of the model. To specify a heat influx from an external source, use the `thermalBC` function with the `HeatFlux` parameter. ```

example

````internalHeatSource(thermalmodel,heatSourceValue,RegionType,RegionID)` specifies geometry regions of type `RegionType` with ID numbers in `RegionID` as heat sources. Always specify `heatSourceValue` first, then specify `RegionType` and `RegionID`.```
````heatSource = internalHeatSource(___)` returns the heat source object.```

## Examples

collapse all

Create a transient thermal model.

`thermalmodel = createpde('thermal','transient');`

Import the geometry.

`gm = importGeometry(thermalmodel,'SquareBeam.STL');`

Set thermal conductivity to `0.2`, mass density to `2700e-9`, and specific heat to `920`.

```thermalProperties(thermalmodel,'ThermalConductivity',0.2, ... 'MassDensity',2700e-9, ... 'SpecificHeat',920)```
```ans = ThermalMaterialAssignment with properties: RegionType: 'cell' RegionID: 1 ThermalConductivity: 0.2000 MassDensity: 2.7000e-06 SpecificHeat: 920 ```

Specify that the entire geometry generates heat at the rate `2e-4`.

`internalHeatSource(thermalmodel,2e-4)`
```ans = HeatSourceAssignment with properties: RegionType: 'cell' RegionID: 1 HeatSource: 2.0000e-04 ```

`thermalModel = createpde('thermal','transient');`

Create the geometry.

```SQ1 = [3; 4; 0; 3; 3; 0; 0; 0; 3; 3]; D1 = [2; 4; 0.5; 1.5; 2.5; 1.5; 1.5; 0.5; 1.5; 2.5]; gd = [SQ1 D1]; sf = 'SQ1+D1'; ns = char('SQ1','D1'); ns = ns'; dl = decsg(gd,sf,ns); geometryFromEdges(thermalModel,dl);```

Set thermal conductivity to 50, mass density to 2500, and specific heat to 600.

```thermalProperties(thermalModel,'ThermalConductivity',50, ... 'MassDensity',2500, ... 'SpecificHeat',600);```

Specify that face 1 generates heat at 25.

`internalHeatSource(thermalModel,25,'Face',1)`
```ans = HeatSourceAssignment with properties: RegionType: 'face' RegionID: 1 HeatSource: 25 ```

Use a function handle to specify an internal heat source that depends on coordinates.

Create a thermal model for transient analysis and include the geometry. The geometry is a rod with a circular cross section. The 2-D model is a rectangular strip whose y-dimension extends from the axis of symmetry to the outer surface, and whose x-dimension extends over the actual length of the rod.

```thermalmodel = createpde('thermal','transient'); g = decsg([3 4 -1.5 1.5 1.5 -1.5 0 0 .2 .2]'); geometryFromEdges(thermalmodel,g);```

The heat is generated within the rod due to the radioactive decay. Therefore, the entire geometry is an internal nonlinear heat source and can be represented by a function of the y-coordinate, for example, $\mathit{q}=2000\mathit{y}$.

`q = @(location,state)2000*location.y;`

Specify the internal heat source for the transient model.

`internalHeatSource(thermalmodel,q)`
```ans = HeatSourceAssignment with properties: RegionType: 'face' RegionID: 1 HeatSource: @(location,state)2000*location.y ```

## Input Arguments

collapse all

Thermal model, specified as a `ThermalModel` object. The model contains the geometry, mesh, thermal properties of the material, internal heat source, boundary conditions, and initial conditions.

Example: `thermalmodel = createpde('thermal','steadystate')`

Geometric region type, specified as `'Face'` for a 2-D model or `'Cell'` for a 3-D model.

Example: `internalHeatSource(thermalmodel,25,'Cell',1)`

Data Types: `char` | `string`

Geometric region ID, specified as a vector of positive integers. Find the region IDs using `pdegplot`, as shown in Create Geometry and Remove Face Boundaries or STL File Import.

Example: `internalHeatSource(thermalmodel,25,'Cell',1:3)`

Data Types: `double`

Heat source value, specified as a number or a function handle. Use a function handle to specify the internal heat source that depends on space, time, or temperature. The function must be of the form

`heatSourceValue = heatSourceFun(location,state)`

The solver passes `location` data as a structure array with the fields `location.x`, `location.y`, and, for 3-D problems, `location.z`. The `state` data is a structure array with the fields `state.u`, `state.ux`, `state.uy`, `state.uz` (for 3-D problems), and `state.time` (for transient problems). The `state.u` field contains the solution vector. The `state.ux`, `state.uy`, `state.uz` fields are estimates of the solution’s partial derivatives at the corresponding points of the location structure. The `state.time` field contains time at evaluation points.

`heatSourceFun` must return a row vector `heatSourceValue` with the number of columns equal to the number of evaluation points, ```M = length(location.x)```.

Example: `internalHeatSource(thermalmodel,25)`

Data Types: `double` | `function_handle`

### Output Arguments

collapse all

Handle to heat source, returned as an object. `heatSourceValue` associates the heat source value with the geometric region.