Solving 2d heat problem using meshgrid

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 Commenti

An 8x8 square will not fit inside a diam=10 circle.
Please explain what have you tried so far. I assume you have received some guidance on what appears to be a homework problem.
One thing you will want to do is write a difference equation for how the temperature at each point evolves over time. Another thing you need to think about (which must have been speciffied in the homework) is boundary conditions in space and time (time meaning initial conditions).
I'm sorry, it was a mistake on my part, the sizes of the two parts of the circle and the square can be considered as desired, and also the initial temperature of the square is 40 degrees and the initial temperature of the outer environment of the circle is 130 degrees, and the initial temperature between the two parts is 10 degrees. thanks for your response . I would be grateful if you could guide me in this matter. Regarding finding the temperature of each point, I was told that the temperature of each point of the mesh is the result of the average temperature of four points around it.
Regarding finding the temperature of each point, I was told that the temperature of each point of the mesh is the result of the average temperature of four points around it.
This is only true for a steady state calculation.
I know but i have to find a code for this problem even if it is only for the steady state part of it . Can u help me with it ?
Torsten
Torsten il 4 Feb 2024
Modificato: Torsten il 4 Feb 2024
Do you have an idea how you are supposed to mesh this mixture of square and circular region ? Are you allowed to use the PDE Toolbox for solving ?

According to the figure below, as you can see, in short, I was told that for this exercise I should mesh in this way and that I should get the points on the border of the circle to some extent and solve the problem. And that I am not allowed to use any tools like pde tools and I must be able to solve the problem in matrix form and plot the answer. Thanks

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.
No problem at all, thank you very much for your time.

Accedi per commentare.

 Risposta accettata

William Rose
William Rose il 4 Feb 2024
Modificato: William Rose il 4 Feb 2024
[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 Commenti

Thank you. This is very helpful.
@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.

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by