What is the Monte Carlo Method for Simulating Neutron Transport using MPI in C?

  • Thread starter Thread starter Milentije
  • Start date Start date
  • Tags Tags
    Neutron Transport
Click For Summary

Discussion Overview

The discussion revolves around the Monte Carlo method for simulating neutron transport, specifically focusing on resources for learning and implementation in C using MPI (Message Passing Interface). Participants seek guidance on foundational knowledge, coding practices, and the theoretical underpinnings of the method.

Discussion Character

  • Exploratory
  • Technical explanation
  • Homework-related
  • Mathematical reasoning

Main Points Raised

  • Some participants request resources to learn about the Monte Carlo method from scratch, indicating a need for foundational materials.
  • Several links to educational resources and papers on Monte Carlo simulations and neutron transport are provided, including historical perspectives and specific texts.
  • One participant shares a simple Monte Carlo simulation code in C and seeks clarification on the meaning of a random variable used in the simulation, as well as guidance on parallelizing the code with MPI.
  • The participant's code includes a formula for calculating the mean distance a neutron travels before interaction, which is based on a random number drawn from a uniform distribution.
  • There are questions about the implementation details, such as the significance of the random variable and its application within the simulation loop.

Areas of Agreement / Disagreement

Participants generally agree on the need for resources and clarification on the Monte Carlo method, but there is no consensus on the specific implementation details or the correctness of the provided code.

Contextual Notes

The discussion includes various assumptions about the Monte Carlo method and its application, but these assumptions are not universally agreed upon. The mathematical steps in the participant's code may also contain unresolved issues.

Who May Find This Useful

This discussion may be useful for individuals interested in computational physics, particularly those looking to understand Monte Carlo simulations and their implementation in programming environments like C with MPI.

Milentije
Messages
47
Reaction score
0
Can anyone hepl me with this?I need some web resource,to start learning from scratch.
 
Engineering news on Phys.org
Try these to get started.

Introduction to Numerical Simulations in Radiation Transport
http://iron.nuc.berkeley.edu/%7Ebdwirth/Public/NE155/ne155.html
Notes in pdf
http://iron.nuc.berkeley.edu/%7Ebdwirth/Public/NE155/schedule.html
Several files are large.

Brief history of MCNP - Monte Carlo Neutron-Photon
http://library.lanl.gov/cgi-bin/getfile?00418730.pdf

LANL paper - A Monte Carlo Code for Particle Transport
http://www.fas.org/sgp/othergov/doe/lanl/pubs/00326727.pdf

Another historical perspective on MC -
http://library.lanl.gov/cgi-bin/getfile?00326867.pdf

MCNP site
http://mcnp-green.lanl.gov/index.html
http://mcnp-green.lanl.gov/v_r_refs.html
 
Last edited by a moderator:
Milentije said:
Can anyone hepl me with this?I need some web resource,to start learning from scratch.
Milentije,

A very good book on Monte Carlo is by Spanier and Gelbard;
"Monte Carlo Principles and Neutron Transport Problems"

There's also another short text by Carter and Cashwell.

Dr. Gregory Greenman
Physicist
 
Thanks Astronuc and Morbius,I have found the recources very usefull.
 
Hello friends, I am doing simple mc simulation for neutron transport.
The principle of random simulation is L=-(1/C)*ln(u), where u is a random number from the uniform distribution [0,1), and c is the total cross section (absorbed + scattered). Could you explain me what is the meaning of u, and how can I use it in my simulation?.
I wrote a simple code in c, which I have to parallel it in MPI:

#include "mpi.h"
#include <math.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <stdbool.h>
#define PI 3.14159265
int main (int argc, char *argv[])
{
/* Simple "srand()" seed: just use "time()" */
unsigned int iseed = (unsigned int)time(NULL);
srand (iseed);

/*c = mean distance between neutron/atom interaction*/
/*cs = scattering component of c*/
/*cc = absorbing component of c*/
float c,cs,cc; /*mean distance between neutron/atom interaction*/
double h,l; /*thickness of the slab and length travelled*/
double u; /*uniform random number*/
double dd,d; /*direction of the neutron [0,pi]*/
double x; /*position particle in the plate*/
int n=10; /*number of samples*/
int bounce; /*boolean value*/
int i,r,b,t;
r=0; b=0; t=0; /*reflected,absorbed and transmited neutrons*/
/*generates randon values between 0 and 1*/
/*dd = (float) rand()/RAND_MAX;*/
for (i = 1; i <= n; i++)
{
x = 0.0;
d = 0.0;
dd = 0.0;
c = 5.5545;
cc = 0.0035;
cs = 5.551;
h = 10.00;
bounce = 1;
do {
dd = (float) rand()/RAND_MAX;
d=PI*dd;
/*generates randon values between 0 and 1*/
u = (float)rand()/RAND_MAX;
l = -(1/c)*log(u);
/*lenght traveled by the particle*/
x = x + l*cos(d);
//printf("value of x=%2.4f\n",x);
if (x < 0.0) /*reflected*/
{
r = r + 1;
bounce = 0;
// printf("reflec r= %d\n",r);
}
else {
if (x >= h) /*transmited*/
{
t = t+1;
bounce = 0;
// printf("trans t=%d\n",t);
}
else{
if (u < cc/c)
{
b = b+1;
bounce = 0;
// printf("absorbed b=%d\n",b);
}
else d = u * PI;
}
}/*end first else*/
} while (bounce = 1);
} /*end for*/
printf("Particles reflected = %d\n",dd);
printf("Particles absorbed = %d\n",b);
printf("Particles transmittedd = %d\n",b);
}/*end main*/


Please any help is more than welcome
 

Similar threads

Replies
1
Views
1K
  • · Replies 11 ·
Replies
11
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
1
Views
3K