thermalBC

Specify boundary conditions for a thermal model

Description

example

thermalBC(thermalmodel,RegionType,RegionID,'Temperature',Tval) adds a temperature boundary condition to thermalmodel. The boundary condition applies to regions of type RegionType with ID numbers in RegionID.

example

thermalBC(thermalmodel,RegionType,RegionID,'HeatFlux,HFval) adds a heat flux boundary condition to thermalmodel. The boundary condition applies to regions of type RegionType with ID numbers in RegionID.

Note

Use thermalBC with the HeatFlux parameter to specify a heat flux to or from an external source. To specify internal heat generation, that is, heat sources that belong to the geometry of the model, use internalHeatSource.

example

thermalBC(thermalmodel,RegionType,RegionID,'ConvectionCoefficient',CCval,'AmbientTemperature',ATval) adds a convection boundary condition to thermalmodel. The boundary condition applies to regions of type RegionType with ID numbers in RegionID.

example

thermalBC(thermalmodel,RegionType,RegionID,'Emissivity',REval,'AmbientTemperature',ATval) adds a radiation boundary condition to thermalmodel. The boundary condition applies to regions of type RegionType with ID numbers in RegionID.

thermalBC = thermalBC(___) returns the thermal boundary condition object.

Examples

collapse all

Apply temperature boundary condition on two edges of a square.

thermalmodel = createpde('thermal');
geometryFromEdges(thermalmodel,@squareg);
thermalBC(thermalmodel,'Edge',[1,3],'Temperature',100)
ans = 
  ThermalBC with properties:

               RegionType: 'Edge'
                 RegionID: [1 3]
              Temperature: 100
                 HeatFlux: []
    ConvectionCoefficient: []
               Emissivity: []
       AmbientTemperature: []
               Vectorized: 'off'

Apply heat flux boundary condition on two faces of a block.

thermalmodel = createpde('thermal','transient');
gm = importGeometry(thermalmodel,'Block.stl');
thermalBC(thermalmodel,'Face',[1,3],'HeatFlux',20)
ans = 
  ThermalBC with properties:

               RegionType: 'Face'
                 RegionID: [1 3]
              Temperature: []
                 HeatFlux: 20
    ConvectionCoefficient: []
               Emissivity: []
       AmbientTemperature: []
               Vectorized: 'off'

Apply convection boundary condition on four faces of a block.

thermalModel = createpde('thermal','transient');
gm = importGeometry(thermalModel,'Block.stl');
thermalBC(thermalModel,'Face',[2 4 5 6], ...
                       'ConvectionCoefficient',5, ...
                       'AmbientTemperature',27)
ans = 
  ThermalBC with properties:

               RegionType: 'Face'
                 RegionID: [2 4 5 6]
              Temperature: []
                 HeatFlux: []
    ConvectionCoefficient: 5
               Emissivity: []
       AmbientTemperature: 27
               Vectorized: 'off'

Apply radiation boundary condition on four faces of a block.

thermalmodel = createpde('thermal','transient');
gm = importGeometry(thermalmodel,'Block.stl');
thermalmodel.StefanBoltzmannConstant = 5.670373E-8;
thermalBC(thermalmodel,'Face',[2,4,5,6],...
                       'Emissivity',0.1,...
                       'AmbientTemperature',300)
ans = 
  ThermalBC with properties:

               RegionType: 'Face'
                 RegionID: [2 4 5 6]
              Temperature: []
                 HeatFlux: []
    ConvectionCoefficient: []
               Emissivity: 0.1000
       AmbientTemperature: 300
               Vectorized: 'off'

Use function handles to specify thermal boundary conditions that depend 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);

Plot the geometry.

figure
pdegplot(thermalmodel,'EdgeLabels','on');
xlim([-2 2]);
ylim([-2 2]);
title 'Rod Section Geometry with Edge Labels';

Assume that there is a heat source at the left end of the rod and a fixed temperature at the right end. The outer surface of the rod exchanges heat with the environment due to convection.

Define the boundary conditions for the model. The edge at y = 0 (edge 1) is along the axis of symmetry. No heat is transferred in the direction normal to this edge. This boundary is modeled as an insulated boundary, by default.

The temperature at the right end of the rod (edge 2) is a fixed temperature, T = 100 C. Specify the boundary condition for edge 2 as follows.

thermalBC(thermalmodel,'Edge',2,'Temperature',100)
ans = 
  ThermalBC with properties:

               RegionType: 'Edge'
                 RegionID: 2
              Temperature: 100
                 HeatFlux: []
    ConvectionCoefficient: []
               Emissivity: []
       AmbientTemperature: []
               Vectorized: 'off'

The convection coefficient for the outer surface of the rod (edge 3) depends on the y-coordinate, 50y. Specify the boundary condition for this edge as follows.

outerCC = @(location,~) 50*location.y;
thermalBC(thermalmodel,'Edge',3,...
                       'ConvectionCoefficient',outerCC,...
                       'AmbientTemperature',100)
ans = 
  ThermalBC with properties:

               RegionType: 'Edge'
                 RegionID: 3
              Temperature: []
                 HeatFlux: []
    ConvectionCoefficient: @(location,~)50*location.y
               Emissivity: []
       AmbientTemperature: 100
               Vectorized: 'off'

The heat flux at the left end of the rod (edge 4) is also a function of the y-coordinate, 5000y. Specify the boundary condition for this edge as follows.

leftHF = @(location,~) 5000*location.y;
thermalBC(thermalmodel,'Edge',4,'HeatFlux',leftHF)
ans = 
  ThermalBC with properties:

               RegionType: 'Edge'
                 RegionID: 4
              Temperature: []
                 HeatFlux: @(location,~)5000*location.y
    ConvectionCoefficient: []
               Emissivity: []
       AmbientTemperature: []
               Vectorized: 'off'

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 'Edge' or 'Face'.

Example: thermalBC(thermalmodel,'Face',1,'Temperature',72)

Data Types: char

Geometric region ID, specified as a vector of positive integers. Find the region IDs by using pdegplot with the 'FaceLabels' (3-D) or 'EdgeLabels' (2-D) value set to 'on'.

Example: thermalBC(thermalmodel,'Edge',2:5,'Temperature',72)

Data Types: double

Temperature boundary condition, specified as a number or a function handle. Use a function handle to specify the temperature that depends on space, time, or temperature. The function must be of the form

Tval = Tfun(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.

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

Example: thermalBC(thermalmodel,'Face',1,'Temperature',72)

Data Types: double | function_handle

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

HFval = HFfun(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.

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

Example: thermalBC(thermalmodel,'Face',[1,3],'HeatFlux',20)

Data Types: double | function_handle

Convection to ambient boundary condition, specified as a number or a function handle. Use a function handle to specify the convection coefficient that depends on space, time, or temperature. The function must be of the form

CCval = CCfun(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.

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

Specify ambient temperature using the AmbientTemperature argument. The value of ConvectionCoefficient is positive for heat convection into the ambient environment.

Example: thermalBC(thermalmodel,'Edge',[2,4],'ConvectionCoefficient',5,'AmbientTemperature',60)

Data Types: double | function_handle

Radiation emissivity coefficient, specified as a number in the range (0,1). Use a function handle to specify the radiation emissivity that depends on space, time, or temperature. The function must be of the form

REval = REfun(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.

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

Specify ambient temperature using the AmbientTemperature argument and the Stefan-Boltzmann constant using the thermal model properties. The value of Emissivity is positive for heat radiation into the ambient environment.

Example: thermalmodel.StefanBoltzmannConstant = 5.670373E-8; thermalBC(thermalmodel,'Edge',[2,4,5,6],'Emissivity',0.1,'AmbientTemperature',300)

Data Types: double | function_handle

Ambient temperature, specified as a number. The ambient temperature value is required for specifying convection and radiation boundary conditions.

Example: thermalBC(thermalmodel,'Edge',[2,4],'ConvectionCoefficient',5,'AmbientTemperature',60)

Data Types: double

Output Arguments

collapse all

Handle to thermal boundary condition, returned as an object. thermalBC associates the thermal boundary condition with the geometric region.

Introduced in R2017a