Пример #1
0
        /// <summary>
        /// Loads the mesh
        /// </summary>
        private void Load()
        {
            //now read input file
            using (ReaderUtilities sr = new ReaderUtilities(FileName))
            {
                while (!sr.EndOfStream)
                {
                    string line = sr.ReadLine();

                    if (line.StartsWith("ROCKS"))
                    {
                        Rocks = new Rocks();
                        Rocks.ReadFromStream(sr);

                        foreach (Element e in Elements)
                        {
                            e.rock = Rocks[e.Material - 1];
                        }
                    }
                    else if (line.StartsWith("INCON"))
                    {
                        while ((line = sr.ReadLine().TrimEnd()) != String.Empty)
                        {
                            if (line.StartsWith("+++"))
                            {
                                break;
                            }

                            string elname = line.Substring(0, 5);

                            if (Elements.Contains(elname))
                            {
                                Elements[elname].Porosity = ReaderUtilities.SplitIntoDoubles(line, 15, 15)[0];

                                if (line.Length > 31)
                                {
                                    Elements[elname].PrimaryVariablesIndex = int.Parse(line.Substring(31, 1));
                                }

                                Elements[elname].PrimaryVaribles = ReaderUtilities.SplitIntoDoubles(sr.ReadLine(), 0, 20);
                            }
                        }
                    }
                    else if (line.StartsWith("PARAM"))
                    {
                        sr.ReadLine();
                        sr.ReadLine();
                        sr.ReadLine();
                        sr.ReadLine();
                        line = sr.ReadLine();
                        var arr = ReaderUtilities.SplitIntoDoubles(line, 0, 20);

                        foreach (var el in Elements)
                        {
                            if (el.PrimaryVaribles == null)
                            {
                                el.PrimaryVaribles = arr.ToArray();
                            }
                        }
                    }
                    else if (line.StartsWith("TSXCD"))
                    {
                        var arr  = sr.ReadLine().Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
                        var ints = arr.Select(var => int.Parse(var));

                        foreach (var i in ints.Skip(1))
                        {
                            if (i <= Elements.Count)
                            {
                                detailedTimeSeries.Add(Elements[i - 1]);
                            }
                        }
                    }
                    else if (line.StartsWith("GENER"))
                    {
                        Wells = new Gener();
                        Wells.ReadFromStream(sr);
                    }
                }
                FileContent = sr.FileContent.ToString();
            }
            NotifyPropertyChanged("FileContent");
            NotifyPropertyChanged("DetailedTimeSeries");
        }
Пример #2
0
        public override string ToString()
        {
            StringBuilder Output = new StringBuilder();


            Output.AppendLine("ROCKS----1----*----2----*----3----*----4----*----5----*----6----*----7----*----8");

            foreach (var r in this)
            {
                Output.Append(r.Name);
                int writemore = 0;
                if (r.RelativePermeabilityModel > 0)
                {
                    if (r.CapillaryPressureModel > 0)
                    {
                        writemore = 2;
                        Output.Append("    2");
                    }
                    else
                    {
                        writemore = 1;
                        Output.Append("    1");
                    }
                }
                else
                {
                    Output.Append("    0");
                }

                Output.AppendLine(ReaderUtilities.JoinIntoString(new double[] { r.Density, r.Porosity, r.PermX, r.PermY, r.PermZ, r.WetHeatConductivity, r.HeatCapacity }, 10));

                Output.AppendLine(ReaderUtilities.JoinIntoString(new double[] { r.Compressibility }, 10));
                if (writemore > 0)
                {
                    if (r.RelativePermeabilityModel > 9)
                    {
                        Output.Append("   ");
                    }
                    else
                    {
                        Output.Append("    ");
                    }
                    Output.Append(r.RelativePermeabilityModel);
                    Output.Append("     ");
                    Output.AppendLine(ReaderUtilities.JoinIntoString(r.RelativePermebilityParameters, 10));
                }

                if (writemore > 1)
                {
                    if (r.CapillaryPressureModel > 9)
                    {
                        Output.Append("   ");
                    }
                    else
                    {
                        Output.Append("    ");
                    }
                    Output.Append(r.CapillaryPressureModel);
                    Output.Append("     ");
                    Output.AppendLine(ReaderUtilities.JoinIntoString(r.CapillaryPressureParameters, 10));
                }
            }
            Output.AppendLine();
            Output.AppendLine();
            return(Output.ToString());
        }
Пример #3
0
    /// <summary>
    /// Loads the mesh
    /// </summary>
    private void Load()
    {
      //now read input file
      using (ReaderUtilities sr = new ReaderUtilities(FileName))
      {
        while (!sr.EndOfStream)
        {
          string line = sr.ReadLine();

          if (line.StartsWith("ROCKS"))
          {
            Rocks = new Rocks();
            Rocks.ReadFromStream(sr);

            foreach (Element e in Elements)
            {
              e.rock = Rocks[e.Material-1];
            }
          }
          else if (line.StartsWith("INCON"))
          {
            while ((line = sr.ReadLine().TrimEnd()) != String.Empty)
            {
              if (line.StartsWith("+++"))
                break;

              string elname = line.Substring(0,5);
              
              if (Elements.Contains(elname))
              {
                Elements[elname].Porosity = ReaderUtilities.SplitIntoDoubles(line, 15, 15)[0];

                if (line.Length > 31)
                  Elements[elname].PrimaryVariablesIndex = int.Parse(line.Substring(31, 1));

                Elements[elname].PrimaryVaribles = ReaderUtilities.SplitIntoDoubles(sr.ReadLine(), 0, 20);
              }
            }
          }
          else if (line.StartsWith("PARAM"))
          {
            sr.ReadLine();
            sr.ReadLine();
            sr.ReadLine();
            sr.ReadLine();
            line = sr.ReadLine();
            var arr = ReaderUtilities.SplitIntoDoubles(line, 0, 20);

            foreach (var el in Elements)
            {
              if (el.PrimaryVaribles == null)
                el.PrimaryVaribles = arr.ToArray();
            }
          }
          else if (line.StartsWith("TSXCD"))
          {
            var arr = sr.ReadLine().Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            var ints = arr.Select(var => int.Parse(var));

            foreach (var i in ints.Skip(1))
            {
              if (i<=Elements.Count)
                detailedTimeSeries.Add(Elements[i - 1]);
            }
          }
          else if (line.StartsWith("GENER"))
          {
            Wells = new Gener();
            Wells.ReadFromStream(sr);
          }
        }
        FileContent = sr.FileContent.ToString();
      }
      NotifyPropertyChanged("FileContent");
      NotifyPropertyChanged("DetailedTimeSeries");
    }