# thermalProperties

Assign thermal properties of a material for a thermal model

## Syntax

``thermalProperties(thermalmodel,'ThermalConductivity',TCval,'MassDensity',MDval,'SpecificHeat',SHval)``
``thermalProperties(___,RegionType,RegionID)``
``mtl = thermalProperties(___)``

## Description

example

````thermalProperties(thermalmodel,'ThermalConductivity',TCval,'MassDensity',MDval,'SpecificHeat',SHval)` assigns material properties, such as thermal conductivity, mass density, and specific heat. For transient analysis, specify all three properties. For steady-state analysis, specifying thermal conductivity is enough. This syntax sets material properties for the entire geometry.For a nonconstant or nonlinear material, specify `TCval`, `MDval`, and `SHval` as function handles.```

example

````thermalProperties(___,RegionType,RegionID)` assigns material properties for a specified geometry region.```
````mtl = thermalProperties(___)` returns the material properties object.```

## Examples

collapse all

Assign material properties for a steady-state thermal model.

```model = createpde('thermal','steadystate'); gm = importGeometry(model,'SquareBeam.stl'); thermalProperties(model,'ThermalConductivity',0.08)```
```ans = ThermalMaterialAssignment with properties: RegionType: 'cell' RegionID: 1 ThermalConductivity: 0.0800 MassDensity: [] SpecificHeat: [] ```

Assign material properties for transient analysis.

```thermalmodel = createpde('thermal','transient'); gm = importGeometry(thermalmodel,'SquareBeam.stl'); thermalProperties(thermalmodel,'ThermalConductivity',0.2,... 'MassDensity',2.7*10^(-6),... 'SpecificHeat',920)```
```ans = ThermalMaterialAssignment with properties: RegionType: 'cell' RegionID: 1 ThermalConductivity: 0.2000 MassDensity: 2.7000e-06 SpecificHeat: 920 ```

`thermalModel = createpde('thermal');`

Create nested cylinders to model a two-layered insulated pipe section, consisting of inner metal pipe surrounded by insulated material.

`gm = multicylinder([20,25,35],20,'Void',[1,0,0]);`

Assign geometry to the thermal model and plot the geometry.

```thermalModel.Geometry = gm; pdegplot(thermalModel,'CellLabels','on','FaceAlpha',0.5)```

Specify thermal conductivities for metal and insulation.

`thermalProperties(thermalModel,'Cell',1,'ThermalConductivity',0.4)`
```ans = ThermalMaterialAssignment with properties: RegionType: 'cell' RegionID: 1 ThermalConductivity: 0.4000 MassDensity: [] SpecificHeat: [] ```
`thermalProperties(thermalModel,'Cell',2,'ThermalConductivity',0.0015)`
```ans = ThermalMaterialAssignment with properties: RegionType: 'cell' RegionID: 2 ThermalConductivity: 0.0015 MassDensity: [] SpecificHeat: [] ```

Use function handles to specify a thermal conductivity that depends on temperature and specific heat 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);```

Specify the thermal conductivity as a linear function of temperature, $\mathit{k}=40+0.003\mathit{T}$.

`k = @(location,state)40 + 0.003*state.u;`

Specify the specific heat as a linear function of the y-coordinate, $\mathit{cp}=500\mathit{y}$.

`cp = @(location,state)500*location.y;`

Specify the thermal conductivity, mass density, and specific heat of the material.

```thermalProperties(thermalmodel,'ThermalConductivity',k,... 'MassDensity',2.7*10^(-6),... 'SpecificHeat',cp)```
```ans = ThermalMaterialAssignment with properties: RegionType: 'face' RegionID: 1 ThermalConductivity: @(location,state)40+0.003*state.u MassDensity: 2.7000e-06 SpecificHeat: @(location,state)500*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'` or `'Cell'`.

Example: `thermalProperties(thermalmodel,'Cell',1,'ThermalConductivity',100)`

Data Types: `char` | `string`

Geometric region ID, specified as a vector of positive integers. Find the region IDs by using `pdegplot`.

Example: `thermalProperties(thermalmodel,'Cell',1:3,'ThermalConductivity',100)`

Data Types: `double`

Thermal conductivity of the material, specified as a positive number, a matrix, or a function handle. You can specify thermal conductivity for a steady-state or transient model. In case of orthotropic thermal conductivity, use a thermal conductivity matrix.

Use a function handle to specify the thermal conductivity that depends on space, time, or temperature. For details, see More About.

Example: `thermalProperties(thermalmodel,'Cell',1,'ThermalConductivity',100)` or `thermalProperties(thermalmodel,'ThermalConductivity',[80;10;80])` for orthotropic thermal conductivity

Data Types: `double` | `function_handle`

Mass density of the material, specified as a positive number or a function handle. Specify this property for a transient thermal conduction analysis model.

Use a function handle to specify the mass density that depends on space, time, or temperature. For details, see More About.

Example: `thermalProperties(thermalmodel,'Cell',1,'ThermalConductivity',100,'MassDensity',2730e-9,'SpecificHeat',910)`

Data Types: `double` | `function_handle`

Specific heat of the material, specified as a positive number or a function handle. Specify this property for a transient thermal conduction analysis model.

Use a function handle to specify the specific heat that depends on space, time, or temperature. For details, see More About.

Example: `thermalProperties(thermalmodel,'Cell',1,'ThermalConductivity',100,'MassDensity',2730e-9,'SpecificHeat',910)`

Data Types: `double` | `function_handle`

## Output Arguments

collapse all

Handle to material properties, returned as a `ThermalMaterialAssignment` object. See ThermalMaterialAssignment Properties.

`mtl` associates material properties with the geometric region.

collapse all

### Specifying Nonconstant Parameters of a Thermal Model

Use a function handle to specify these thermal parameters when they depend on space, temperature, and time:

• Thermal conductivity of the material

• Mass density of the material

• Specific heat of the material

• Internal heat source

• Temperature on the boundary

• Heat flux through the boundary

• Convection coefficient on the boundary

• Radiation emissivity coefficient on the boundary

• Initial temperature (can depend on space only)

For example, use function handles to specify the thermal conductivity, internal heat source, convection coefficient, and initial temperature for this model.

```thermalProperties(model,'ThermalConductivity', ... @myfunConductivity) internalHeatSource(model,'Face',2,@myfunHeatSource) thermalBC(model,'Edge',[3,4], ... 'ConvectionCoefficient',@myfunBC, ... 'AmbientTemperature',27) thermalIC(model,@myfunIC)```

For all parameters, except the initial temperature, the function must be of the form:

`function thermalVal = myfun(location,state)`

For the initial temperature the function must be of the form:

`function thermalVal = myfun(location)`

The solver computes and populates the data in the `location` and `state` structure arrays and passes this data to your function. You can define your function so that its output depends on this data. You can use any names instead of `location` and `state`, but the function must have exactly two arguments (or one argument if the function specifies the initial temperature).

• `location` — A structure containing these fields:

• `location.x` — The x-coordinate of the point or points

• `location.y` — The y-coordinate of the point or points

• `location.z` — For a 3-D or an axisymmetric geometry, the z-coordinate of the point or points

• `location.r` — For an axisymmetric geometry, the r-coordinate of the point or points

Furthermore, for boundary conditions, the solver passes these data in the `location` structure:

• `location.nx`x-component of the normal vector at the evaluation point or points

• `location.ny`y-component of the normal vector at the evaluation point or points

• `location.nz` — For a 3-D or an axisymmetric geometry, z-component of the normal vector at the evaluation point or points

• `location.nr` — For an axisymmetric geometry, r-component of the normal vector at the evaluation point or points

• `state` — A structure containing these fields for transient or nonlinear problems:

• `state.u` — Temperatures at the corresponding points of the location structure

• `state.ux` — Estimates of the x-component of temperature gradients at the corresponding points of the location structure

• `state.uy` — Estimates of the y-component of temperature gradients at the corresponding points of the location structure

• `state.uz` — For a 3-D or an axisymmetric geometry, estimates of the z-component of temperature gradients at the corresponding points of the location structure

• `state.ur` — For an axisymmetric geometry, estimates of the r-component of temperature gradients at the corresponding points of the location structure

• `state.time` — Time at evaluation points

Thermal material properties (thermal conductivity, mass density, and specific heat) and internal heat source get these data from the solver:

• `location.x`, `location.y`, `location.z`, `location.r`

• Subdomain ID

• `state.u`, `state.ux`, `state.uy`, `state.uz`, `state.r`, `state.time`

Boundary conditions (temperature on the boundary, heat flux, convection coefficient, and radiation emissivity coefficient) get these data from the solver:

• `location.x`, `location.y`, `location.z`, `location.r`

• `location.nx`, `location.ny`, `location.nz`, `location.nr`

• `state.u`, `state.time`

Initial temperature gets the following data from the solver:

• `location.x`, `location.y`, `location.z`, `location.r`

• Subdomain ID

For all thermal parameters, except for thermal conductivity, your function must return a row vector `thermalVal` with the number of columns equal to the number of evaluation points, for example, ```M = length(location.y)```.

For thermal conductivity, your function must return a matrix `thermalVal` with number of rows equal to 1, `Ndim`, `Ndim*(Ndim+1)/2`, or `Ndim*Ndim`, where `Ndim` is 2 for 2-D problems and 3 for 3-D problems. The number of columns must equal the number of evaluation points, for example, ```M = length(location.y)```. For details about dimensions of the matrix, see c Coefficient for specifyCoefficients.

If properties depend on the time or temperature, ensure that your function returns a matrix of `NaN` of the correct size when `state.u` or `state.time` are `NaN`. Solvers check whether a problem is time dependent by passing `NaN` state values and looking for returned `NaN` values.

### Additional Arguments in Functions for Nonconstant Thermal Parameters

To use additional arguments in your function, wrap your function (that takes additional arguments) with an anonymous function that takes only the `location` and `state` arguments. For example:

```thermalVal = ... @(location,state) myfunWithAdditionalArgs(location,state,arg1,arg2...) thermalBC(model,'Edge',3,'Temperature',thermalVal) thermalVal = @(location) myfunWithAdditionalArgs(location,arg1,arg2...) thermalIC(model,thermalVal) ```

## Version History

Introduced in R2017a