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.
For all parameters, except the initial temperature, the function must be of the form:
For the initial temperature the function must be of the form:
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:
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.