cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Matrix Manipulation

hw
1-Newbie
1-Newbie

Matrix Manipulation

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

6 REPLIES 6
MikeArmstrong
5-Regular Member
(To:hw)

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

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

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

AlanStevens
17-Peridot
(To:hw)

Here's a somewhat simpler Monte-Carlo approach that might be of interest (it's a modification of a program I produced some time ago).

Alan

hw
1-Newbie
1-Newbie
(To:AlanStevens)

Alan,

Thanks, this is nice to see. I will look at it closer but part of the reason I pieced out my program is I have a few more obstacles (directional dependence of surface 2, conduction, and a flux on surface 1) ie my temp distribution is is not uniform and I think need to look at each grid area separately.

Thanks again,

Hogan

AlanStevens
17-Peridot
(To:hw)

Hogan Winn wrote:

Alan,

Thanks, this is nice to see. I will look at it closer but part of the reason I pieced out my program is I have a few more obstacles (directional dependence of surface 2, conduction, and a flux on surface 1) ie my temp distribution is is not uniform and I think need to look at each grid area separately.

Thanks again,

Hogan

The directional dependence shouldn't be difficult to incorporate - this just complicates the calculation of cos(phi1) and cos(phi2), but it's just a matter of trigonometry. For the non-uniform temperature distributions I guess there is no alternative but to divide each surface into a number of effectively constant temperature regions.

Alan

Top Tags