thermalProperties
Assign thermal properties of a material for a thermal model
Domain-specific heat transfer workflow is not recommended. New features might not be compatible with this workflow. For help migrating your existing code to the unified finite element workflow, see Migration from Domain-Specific to Unified Workflow.
Syntax
Description
thermalProperties(
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.thermalmodel
,"ThermalConductivity",TCval
,"MassDensity",MDval
,"SpecificHeat",SHval
)
For a nonconstant or nonlinear material, specify TCval
,
MDval
, and SHval
as function
handles.
thermalProperties(___,
assigns material properties for a specified geometry region.RegionType
,RegionID
)
returns the material properties object.mtl
= thermalProperties(___)
Examples
Assign Thermal Conductivity
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 Thermal Conductivity, Mass Density, and Specific Heat
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
Assign Thermal Conductivities for Each Geometric Region
Create a steady-state thermal model.
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: []
Specify Nonconstant Thermal Properties
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, .
k = @(location,state)40 + 0.003*state.u;
Specify the specific heat as a linear function of the y-coordinate, .
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
thermalmodel
— Thermal model
ThermalModel
object
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")
RegionType
— Geometric region type
"Face"
for a 2-D model | "Cell"
for a 3-D model
Geometric region type, specified as "Face"
or
"Cell"
.
Example: thermalProperties(thermalmodel,"Cell",1,"ThermalConductivity",100)
Data Types: char
| string
RegionID
— Geometric region ID
vector of positive integers
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
TCval
— Thermal conductivity of the material
positive number | matrix | function handle
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
MDval
— Mass density of the material
positive number | 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
SHval
— Specific heat of the material
positive number | 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
mtl
— Handle to material properties
ThermalMaterialAssignment
object
Handle to material properties, returned as a
ThermalMaterialAssignment
object. See ThermalMaterialAssignment Properties.
mtl
associates material properties with the geometric
region.
More About
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 pointslocation.y
— The y-coordinate of the point or pointslocation.z
— For a 3-D or an axisymmetric geometry, the z-coordinate of the point or pointslocation.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 pointslocation.ny
— y-component of the normal vector at the evaluation point or pointslocation.nz
— For a 3-D or an axisymmetric geometry, z-component of the normal vector at the evaluation point or pointslocation.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 structurestate.ux
— Estimates of the x-component of temperature gradients at the corresponding points of the location structurestate.uy
— Estimates of the y-component of temperature gradients at the corresponding points of the location structurestate.uz
— For a 3-D or an axisymmetric geometry, estimates of the z-component of temperature gradients at the corresponding points of the location structurestate.ur
— For an axisymmetric geometry, estimates of the r-component of temperature gradients at the corresponding points of the location structurestate.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
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)