Solving Heat Transfer Problem In Matlab with Finite Difference Mesh

  • MATLAB
  • Thread starter MattT1991
  • Start date
  • Tags
    Matlab
In summary, the conversation revolved around a problem with using a finite difference mesh in MATLAB to solve the heat equation across one spatial dimension. The issue was with adding an array with air properties on top of an existing water array and trying to run the model upwards. A possible solution was suggested, but it did not work. The conversation ended with the mention of a workaround using a for loop.
  • #1
MattT1991
8
0
Hi everyone,

I am having a bit of a problem with Matlab. I am currently using a finite difference mesh to solve the heat equation across one spatial dimension - x and time. I had an water array with depth and time and a boundary condition given by heat transfer equations which set the top line. This ran perfectly fine downwards from 2 : end-1

I then added an array above it that was the same but had air properties. From this I set the bottom row to a boundary condition using the heat transfer equations and tried to run it the same way but upwards from end-1 : 2.

It will not work and just alters the bottom row. The second differentials from the finite difference model come up as 0 despite their consituent parts clearly not adding to 0 uppon logging.

(the model is trying to show heat interaction between an air layer sat on a water layer and heat transfer within the 2 layers in assumed to be conduction only)

Can anyone suggest a solution to this or a problem it may be?

Can MATLAB handle running upwards through a mesh?

Thanks for any help, ( I am happy to give you more information)

Matt
 
Physics news on Phys.org
  • #2


If you want to step in the negative direction you need to tell MATLAB so.

Use: end-1 : -1: 2

That should work
 
  • #3


Thanks, I will try it now

It didn't work. The only way I have been able to do it is by putting a new for loop in that runs a variable up the array and use that to work up the array but it looks a lot messier than it should be...
 
Last edited:

Related to Solving Heat Transfer Problem In Matlab with Finite Difference Mesh

1. How do I set up a finite difference mesh for heat transfer analysis in Matlab?

To set up a finite difference mesh for heat transfer analysis in Matlab, you will first need to define the dimensions and properties of your system. This includes the size and material properties of the object, as well as the initial and boundary conditions. Once these parameters are defined, you can use the built-in functions in Matlab to generate a finite difference mesh for your system.

2. How do I define the initial and boundary conditions for my heat transfer problem in Matlab?

You can define the initial and boundary conditions for your heat transfer problem in Matlab by using the "boundary" and "initial" functions. These functions allow you to specify the temperature values at the boundaries and initial conditions, respectively. You can also define more complex boundary conditions by using the "boundaryFunction" function.

3. What are the advantages of using a finite difference mesh for heat transfer analysis in Matlab?

One of the main advantages of using a finite difference mesh for heat transfer analysis in Matlab is that it allows for a more accurate and efficient solution compared to other methods, such as finite element analysis. Additionally, Matlab has built-in functions and tools specifically designed for solving heat transfer problems using finite difference methods, making it a convenient and powerful tool for scientists and engineers.

4. How can I visualize the results of my heat transfer analysis using a finite difference mesh in Matlab?

Matlab has built-in functions for visualizing the results of heat transfer analysis using a finite difference mesh. You can use the "contourf" function to create a filled contour plot of the temperature distribution, or the "quiver" function to plot the heat flow vectors. You can also create animations of the temperature distribution over time using the "movie" function.

5. Can I use a finite difference mesh for more complex heat transfer problems in Matlab?

Yes, a finite difference mesh can be used for a wide range of heat transfer problems in Matlab, including more complex scenarios such as transient heat transfer, convection, and radiation. However, for highly complex problems, other methods such as finite element analysis may be more suitable. It is important to carefully consider the limitations and assumptions of the finite difference method before applying it to your specific problem.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
3K
Replies
2
Views
1K
Replies
10
Views
2K
  • Advanced Physics Homework Help
Replies
1
Views
738
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
Replies
14
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • Mechanical Engineering
Replies
34
Views
4K
Back
Top