# 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?

7 ビュー (過去 30 日間)
Anik Faisal 2019 年 2 月 6 日
コメント済み: Anik Faisal 2019 年 2 月 6 日
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:
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?

サインインしてコメントする。

### 採用された回答

Ravi Kumar 2019 年 2 月 6 日
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 件のコメント

Anik Faisal 2019 年 2 月 6 日
Any suggestions regarding plotting the isotherms for this problem?
Ravi Kumar 2019 年 2 月 6 日
You can try contour, countour3, contourf, etc using the results.Temperature data.
Also, refer to the plots at the end of thermal model example:
Anik Faisal 2019 年 2 月 6 日
Thanks again! Much obliged.

サインインしてコメントする。

### Community Treasure Hunt

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

Start Hunting!

Translated by