Example #1
0
        public static string ShowIsotopes(IEnumerable <Isotope> isotopes)
        {
            string str = "";

            foreach (var iso in isotopes)
            {
                str += Isotope.ShowIsotope(iso);
            }
            return(str);
        }
Example #2
0
        public static string ShowIsotope(Isotope isotope)
        {
            string str = "";

            if (isotope.Name != null)
            {
                str += "Information of " + isotope.Name + " isotope:" + Environment.NewLine;
            }
            str += "Z=" + isotope.Z + "  A=" + isotope.A + Environment.NewLine + "  Amass=" + isotope.AtomicMass + " amu" + Environment.NewLine;
            str += "HF=" + isotope.HalfLife + Environment.NewLine;
            str += "CS=" + (isotope.CS_ng_avg / Constants.barn) + Environment.NewLine;

            for (int i = 0; i < isotope.NRTYPES; i++)
            {
                str += "DECAY MODE = " + isotope.RTYPNAME[isotope.DecayType[i]] + ":" + Environment.NewLine;
                str += "DE=" + isotope.DecayEnergy + " eV\nDP=" + isotope.DecayProbob[isotope.DecayType[i]] * 100 + " %" + Environment.NewLine;
            }
            return(str);
        }
Example #3
0
        public string IsotopeFileName(Isotope iso, int ZA, FILETYP ftype)
        {
            string rtyp = "_";

            if (ftype == FILETYP.DECAY)
            {
                rtyp = "decay/dec-";
            }
            if (ftype == FILETYP.NEUTRON)
            {
                rtyp = "neutron/n-";
            }
            if (ftype == FILETYP.FISSION)
            {
                rtyp = "nfy/nfy-";
            }

            int Z = ZA / 1000;
            int A = ZA - Z * 1000;

            iso.A    = A;
            iso.Z    = Z;
            iso.ZAID = ZA;
            int    z  = 1000 + Z;
            string sz = z.ToString();

            sz = sz.Substring(1, 3);
            int    a  = 1000 + A;
            string sa = a.ToString();

            sa = sa.Substring(1, 3);
            string nm = ElementNames[Z] + sa;

            iso.Name        = nm;
            iso.ElementName = ElementNames[Z];
            string filePath = "xsdir/" + rtyp + sz + "_" + ElementNames[Z] + "_" + sa + ".endf";

            return(filePath);
        }
Example #4
0
        public void ReadAllNuclides()
        {
            int i = 0;

            for (int z = 1; z <= 94; z++) // From H to Pu
            {
                for (int a = (int)(z * 1.5); a < z * 3; a++)
                {
                    var tempIso = new Isotope();
                    int zaid    = z * 1000 + a;
                    int yes     = GetRadDecInf(tempIso, zaid);
                    GetNeuRecInfMF3(tempIso, zaid, 102);

                    if (yes != -1)
                    {
                        Isotopes.Add(tempIso);
                        i++;
                    }
                }
            }
            Console.WriteLine("\nFound nuclides = " + i);
            IsotopeQnt = i;
        }
Example #5
0
 public void SetNuclide(Isotope isotope)
 {
 }
Example #6
0
        int GetNeuRecInfMF3(Isotope iso, int ZAID, int MT)
        {
            int    mat = 0, mfs, mts;
            string s, line;
            int    mfsearch = 3, mtsearch = MT;
            string fn = IsotopeFileName(iso, ZAID, FILETYP.NEUTRON);

            FileStream fileStream;

            try
            {
                fileStream = new FileStream(fn, FileMode.Open, FileAccess.Read);
            }
            catch (FileNotFoundException ex)
            {
                return(-1);
            }

            bool found = false;

            using (var streamReader = new StreamReader(fileStream, Encoding.UTF8))
            {
                while ((line = streamReader.ReadLine()) != null)
                {
                    if (line.Length < 75)
                    {
                        continue;
                    }

                    s = line.Substring(66, 4); mat = Convert.ToInt16(s);
                    s = line.Substring(70, 2); mfs = Convert.ToInt16(s);
                    s = line.Substring(72, 3); mts = Convert.ToInt16(s);
                    if (mfs == mfsearch && mts == mtsearch)
                    {
                        found = true;
                        mfs   = mfsearch;
                        mts   = mtsearch;
                        //Record r = ENDFSplitCONT();
                        break;
                    }

                    /*** not found */
                    if ((mfs > mfsearch) || ((mfs == mfsearch) && (mts > mtsearch)))
                    {
                        mfs = 0;
                        mts = 0;
                        break;
                    }
                }

                if (found)
                {
                    int i = 0;
                    line = streamReader.ReadLine();
                    line = streamReader.ReadLine();
                    Record r         = ENDFSplitCONT(line);
                    int    NumCSData = Convert.ToInt16(r.c1);

                    i = -1;
                    while ((line = streamReader.ReadLine()) != null)
                    {
                        if (line.Length < 75)
                        {
                            continue;
                        }

                        s = line.Substring(66, 4); mat = Convert.ToInt16(s);
                        s = line.Substring(70, 2); mfs = Convert.ToInt16(s);
                        s = line.Substring(72, 3); mts = Convert.ToInt16(s);

                        r = ENDFSplitCONT(line);

                        i++; iso.En_ng.Add(r.c1); iso.Cs_ng.Add(r.c2); if (i >= NumCSData)
                        {
                            break;
                        }
                        i++; iso.En_ng.Add(r.l1); iso.Cs_ng.Add(r.l2); if (i >= NumCSData)
                        {
                            break;
                        }
                        i++; iso.En_ng.Add(r.n1); iso.Cs_ng.Add(r.n2); if (i >= NumCSData)
                        {
                            break;
                        }

                        if (mfs != mfsearch || mts == 2)
                        {
                            break;
                        }
                    }


                    //////////////////////////////////////////////////
                    //
                    //  This part should be implemented with Maxwell distribution
                    //
                    //////////////////////////////////////////////////
                    double cs_sum   = 0.0;
                    double flux_sum = 0.0;

                    for (int k = 0; k < i; k++)
                    {
                        var temp_flux = NeutronSpectra.MaxwellCurve(iso.En_ng[k]);
                        cs_sum   += iso.Cs_ng[k] * temp_flux;
                        flux_sum += temp_flux;
                    }
                    iso.CS_ng_avg      = cs_sum / flux_sum * Constants.barn;
                    iso.cs_ng_file_num = 0;
                    return(NumCSData);
                }
                else
                {
                    iso.cs_ng_file_num = -1;
                    return(-1);
                }
            }
        }
Example #7
0
        int GetRadDecInf(Isotope iso, int ZAID)
        {
            int        mat = 0, mfs, mts;
            string     s, line;
            int        mfsearch = 8, mtsearch = 457;
            string     fn = IsotopeFileName(iso, ZAID, FILETYP.DECAY);
            FileStream fileStream;

            try
            {
                fileStream = new FileStream(fn, FileMode.Open, FileAccess.Read);
            }
            catch (FileNotFoundException ex)
            {
                return(-1);
            }
            bool found = false;

            using (var streamReader = new StreamReader(fileStream, Encoding.UTF8))
            {
                while ((line = streamReader.ReadLine()) != null)
                {
                    if (line.Length < 75)
                    {
                        continue;
                    }

                    s = line.Substring(66, 4); mat = Convert.ToInt16(s);
                    s = line.Substring(70, 2); mfs = Convert.ToInt16(s);
                    s = line.Substring(72, 3); mts = Convert.ToInt16(s);
                    if (mfs == mfsearch && mts == mtsearch)
                    {
                        found = true;
                        mfs   = mfsearch;
                        mts   = mtsearch;
                        //Record r = ENDFSplitCONT();
                        break;
                    }

                    /*** not found */
                    if ((mfs > mfsearch) || ((mfs == mfsearch) && (mts > mtsearch)))
                    {
                        mfs = 0;
                        mts = 0;
                        break;
                    }
                }

                Record r = ENDFSplitCONT(line);
                iso.AtomicMass = r.c2;

                line = streamReader.ReadLine();
                r    = ENDFSplitCONT(line);
                if (r.c1 == 0.0)
                {
                    iso.HalfLife   = Constants.STABLE;
                    iso.DecayConst = Constants.ln2 / Constants.STABLE;
                }
                else
                {
                    iso.HalfLife   = r.c1;
                    iso.DecayConst = Constants.ln2 / r.c1;
                }

                line = streamReader.ReadLine();
                line = streamReader.ReadLine();
                r    = ENDFSplitCONT(line);
                int rt = Convert.ToInt16(r.n2);

                iso.NRTYPES = r.n2;
                if (r.n2 == 0)
                {
                    iso.STABLE = true;
                }
                iso.DecayProbob[0] = 0.0;
                iso.DecayProbob[1] = 0.0;
                iso.DecayProbob[2] = 0.0;
                iso.DecayProbob[3] = 0.0;
                iso.DecayProbob[4] = 0.0;
                iso.DecayProbob[5] = 0.0;
                iso.DecayProbob[6] = 0.0;

                for (int i = 0; i < rt; i++)
                {
                    line            = streamReader.ReadLine();
                    r               = ENDFSplitCONT(line);
                    iso.DecayEnergy = r.l1;

                    iso.DecayProbob[(int)r.c1] = r.n1;
                    iso.DecayType[i]           = (int)r.c1;
                }
            }

            if (found)
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }