Esempio n. 1
0
 public Endf(NeutronSpectra neutronSpectra)
 {
     NeutronSpectra = neutronSpectra;
     Isotopes       = new List <Isotope>();
     ReadAllNuclides();
 }
Esempio n. 2
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);
                }
            }
        }