How to impose a variable temperature distribution for one edge of a rectangular plate while keeping the temperatures of other three edges same and constant?

2 views (last 30 days)
Hi all,
I was trying to plot heat flux lines for a heat transfer problem. The problem specifies a 0.3m by 0.1m rectangular plate. Its right, left and bottom edges are kept at 273.15K and the top edge has a temperature distribution:
with thermal conductivity, k=2.5 W/mK. I've tried the following to solve this problem:
load('gd');
load('ns');
load('sf');
g=decsg(gd,sf,ns);
thermalmodel = createpde('thermal');
geometryFromEdges(thermalmodel,g);
pdegplot(thermalmodel,'EdgeLabels','on')
xlim([0 .3])
ylim([0 .15])
axis equal
dx=.0001;
x=0:dx:.3;
thermalProperties(thermalmodel,'ThermalConductivity',2.5,'Face',1);
thermalBC(thermalmodel,'Edge',1,'Temperature',273.15);
thermalBC(thermalmodel,'Edge',2,'Temperature',273.15);
thermalBC(thermalmodel,'Edge',4,'Temperature',273.15);
thermalBC(thermalmodel,'Edge',3,'Temperature',30.*sin(pi.*x/.3));
generateMesh(thermalmodel);
results = solve(thermalmodel)
I'm getting the following error: Error using pde.ThermalBC/set.Temperature (line 136)
Temperature for all specified edges or faces must be a scalar value or a single function handle. Could someone suggest how I can impose the variable temperature distribution?

Accepted Answer

Ravi Kumar
Ravi Kumar on 6 Feb 2019
Hi Anik,
Define a function to model variation of temperature and use it in BC specification:
tFunc = @(region,state) 30.*sin(pi.*region.x/3)
thermalBC(thermalmodel,'Edge',3,'Temperature',@tFunc);
Regards,
Ravi
  6 Comments

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!