Skip to main content
1-Visitor
October 21, 2010
Question

Matrix Manipulation

  • October 21, 2010
  • 1 reply
  • 4222 views

Greetings,

I am trying to write a program that should simulate radiation heat transfer using the Monte Carlo technique. I am confident in the concepts however the programming to interpret the concepts I think offers some challenges involving matrix manipulation.

Problem 1: Trying to Unstack nested arrays that are generated separately by the random number generator function/three nested for loops. Currently I am only able to get one random generation of the nested array and then it repeats itself in the unstack routine. Seems like there is an error in the placement or deinfition of the random numbers.

Problem 2: Via conditional statement I would like to select only Matrix colums to from an ond Matrix of size N to input into a new matrix of a size determined by conditional statement.

I attached the MCDv11 sheet to help explain. I have the "debugging" routine which specifcally aims to address the problems I stated above, and the original routine to show where the routine should end up.

Any suggestions would be most helpful.

Best,

Hogan

1 reply

1-Visitor
October 21, 2010

As I have no experience in this field, would you be able to post a sheet which shows the results / problems.

Have no idea where the variables should be assigned.

Mike

hw_011-VisitorAuthor
1-Visitor
October 21, 2010

Well I can't post anything that I have that is specific to this problem since haven't see it done in Mathcad yet, but I think I can describe the procedure.

For the first problem I am trying to get X number of iterations for the EndPoint function per i,j location of an initial matrix. So if I have a 3 x 3 matrix each i,j location of that matrix should have an unique nested array from the X iterations of the EndPoint function. In this case if I have X = 10 and a 3 x 3 initial matrix and the output of the EndPoint function is a 5 x 1 matrix column. Then I get a Final 1 x 9 matrix with a 5 x 10 nested array at each location of teh final matrix. I am having problems making the nested arrays unique, that is, making sure for each Endpoint iteration the random number generator resets each time the X number of iterations is finished

Problem 2: I am just trying to filter out the data that I want from a matrix, ie in this case the conditional statement sets limits on what data should be selected

Overall Summary: Radiation HT using Mote Carlo

-Two perpendicular surfaces with a connecting edge.

-Each surface represents a matrix/grid surface with a temperature distribution, similar to a conduction problem. Example: a 5 x 5 matrix and the center is hotter therefor the numbers in the center of the matrix are higher.

-These temperatures represent an amount of thermal radiation energy that can be emitted.

-To mimic the behavior of the radiation HT, which can be particles being shot from one surface to another: use Monte Carlo method: invoking random numbers (Problem 1) many times (more, the better the accuracy) gives a cumulative distribution. Each grid of surface 1 needs to fire a particle at a random location in that grid and at random angles

-So record the outcome of each particle fired, then sort out data to determine which particles actually hit surface 2.

-The energy of the particles that hit the second surface can be added in each gird location on surface 2 to represent a temperature distribution on surface 2.

Hope this little narrative helps. Seems like a simple enough idea to program, I think just need some help manipulating matrices so go from different sizes and sorting through them.

Best,

Hogan

October 22, 2010

Hope this willl help you to start the debugging process.

Its difficult understanding exactly what the output should be for each stage of the program, but if you build it up line by line you should be able to get it to do whatever you want (more or less).

Andy