Exemplo n.º 1
0
        private void SubStep(int step, CustomPoint3D startPoint)
        {
            var gamma1 = Rnd(double.Epsilon, 1);

            FreePathLength.Add(-Math.Log(gamma1) / _sigmaS);
            var gamma2x = Rnd(0, 1);
            var gamma2y = Rnd(0, 1);
            //var gamma2z = Rnd(0, 1);
            //var wz = 1 - 2 * gamma2z;
            //var tmp2 = Math.Sqrt(1 - Math.Pow(cosZ, 2));
            //var wx = tmp2 * Math.Cos(TwoPi * gamma2x);
            //var vy = tmp2 * Math.Sin(TwoPi * gamma2y);
            var wx = Math.Cos(TwoPi * gamma2x);
            var wy = Math.Sin(TwoPi * gamma2y);
            var wz = 0;

            GuidedCos.Add(new Vector3D(wx, wy, wz));
            CollisionPoint.Add(new CustomPoint3D(
                                   startPoint.X + GuidedCos[step].X * FreePathLength[step],
                                   startPoint.Y + GuidedCos[step].Y * FreePathLength[step],
                                   startPoint.Z + GuidedCos[step].Z * FreePathLength[step]));
            PathLength += FreePathLength[step];
            var gamma3 = Rnd(0, 1);

            if (gamma3 <= _sigmaA / _sigmaT)
            {
                IsAbsorbed = true;
            }

            //Console.WriteLine(@"FreePathLength: {0};	wx: {1};	wy: {2};wz: {3};	gamma3: {4};	SigmaA: {5};	SigmaTr: {6};	{7}", FreePathLength[step], wx, wy, wz, gamma3, _sigmaA, _sigmaTr, _sigmaA/_sigmaTr);
        }
Exemplo n.º 2
0
        public Neutron(CustomPoint3D startPoint, double sigmaA, double sigmaS, double sigmaTr, double sigmaT)
        {
            _sigmaA  = sigmaA;
            _sigmaS  = sigmaS;
            _sigmaTr = sigmaTr;
            _sigmaT  = sigmaT;
            AverageFreePathLength = 0;

            IsAbsorbed     = false;
            FreePathLength = new List <double>()
            {
                0
            };
            GuidedCos = new List <Vector3D>()
            {
                new Vector3D()
            };
            CollisionPoint = new List <CustomPoint3D>()
            {
                startPoint
            };
        }