Solving 2d heat problem using meshgrid

13 次查看(过去 30 天)

I need guidance to solve a two-dimensional heat transfer problem, as it is clear in the figure, it is necessary to solve the temperature between the outer circle and the inner square using the meshgrid method in both steady state and transients. The desired number of mesh points is 10 points in both x and y directions. The side of the square is 8 cm long and the diameter of the circle is 10 cm. And I also want to use the meshgrid as a square and that the result will be a 3D plot. Can anyone guide me in this matter?

  8 个评论
Torsten
Torsten 2024-2-4
Sorry, but I've always solved such problems in a way that the grid matched with the domain boundaries. Maybe you were taught such an approximate method, but I don't know of such.
Ali
Ali 2024-2-4
No problem at all, thank you very much for your time.

请先登录,再进行评论。

采纳的回答

William Rose
William Rose 2024-2-4
编辑:William Rose 2024-2-4
[edit: fix spelling erors]
A 10x10 mesh for this problem is so few points that it makes it hard to set up the problem and get reasonable results. I am going to make it with more points. You can adjust if you like.
One simple-minded way to do this is to create a 3D rectangular array. The third dimension is for time. You can adjust the time duration if you don't like the results.
x=-10.5:1:10.5; % x-coordinates of the grid points
y=x; % y-coordinates of the grid points
dt=0.5; % time step size
t=0:dt:100; % time values
Tout=130; % external temperature
T=Tout*ones(length(x),length(y),length(t)); % array for temperature
You will want to use a simple first-order difference equation to update the temperature at each time step.
You will need to initialize the temperature at t=0 so that it is 40 inside the square and 10 in the green area.
You will use a set of nested for loops to do this. The outer loop is time, the inner loops are x and y (order of the inner loops not important, as long as you check all the grid points).
At each time step, you will update the temperature at all the grid points, using the tepratures at the previous time step. Points inside the inner square, and points outside the circle, will not change with time. Points in the green area will change with each new time step, accortding to the difference equation which you will develop.
The difference equation will look somethink like this:
T(i,j,k)=T(i,j,k-1)+...
where k is the time index, and you should figure out what the "..." is.
  3 个评论
William Rose
William Rose 2024-2-5
@Ali, You are weelcome.
Here is a discussion of a similar problem. I am not endorsing the code by the original poster. That problem has 3 spatial dimensions. Array T in that problem is T(m,i,j,k), where index m is for time. That problem does not have an inner cut-out. The graphical display of results for that problem may be useful for you.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Geometry and Mesh 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by