Esempio n. 1
0
        public void ReadInitGrid(string property)
        {
            FileReader br = new FileReader();

            Action <string> SetPosition = (name) =>
            {
                int INIT_STEP = 0;
                int index     = -1;

                for (int iw = 0; iw < NAME.Count; ++iw)
                {
                    index = Array.IndexOf(NAME[iw], name);
                    if (index > -1)
                    {
                        INIT_STEP = iw;
                        break;
                    }
                }

                long pointer  = POINTER[INIT_STEP][index];
                long pointerb = POINTERB[INIT_STEP][index];
                br.SetPosition(pointerb * 2147483648 + pointer);
            };

            br.OpenBinaryFile(FILENAME);
            SetPosition(property);
            br.ReadHeader();
            DATA = br.ReadFloatList(br.header.count);
            //
            br.CloseBinaryFile();
        }
Esempio n. 2
0
        public void ReadACTNUM(string filename)
        {
            FILENAME = filename;
            FileReader br = new FileReader();

            br.OpenBinaryFile(filename);

            if (br.Length > 0)
            {
                while (br.Position < br.Length - 24)
                {
                    br.ReadHeader();

                    if (br.header.keyword == "INTEHEAD")
                    {
                        int[] INTH = br.ReadIntList();
                        NX     = INTH[8];
                        NY     = INTH[9];
                        NZ     = INTH[10];
                        NACTIV = INTH[11];
                        IPHS   = INTH[14];
                        continue;
                    }

                    if (br.header.keyword == "PORV")
                    {
                        var PORV = br.ReadFloatList(br.header.count);

                        ACTNUM = new int[NX * NY * NZ];

                        // Для сжатого формата хранения данных
                        // требуется провести индексирования массива активных ячеек
                        // ACTNUM сам по себе это "1" для активной ячейки и "0" для не активной

                        int index = 1;
                        for (int iw = 0; iw < PORV.Length; ++iw)
                        {
                            if (PORV[iw] > 0)
                            {
                                ACTNUM[iw] = index++;
                            }
                        }

                        break;
                    }
                    br.SkipEclipseData();
                }
            }
            br.CloseBinaryFile();
        }
Esempio n. 3
0
        public void ReadRestartGrid(string property)
        {
            FileReader br = new FileReader();

            Action <string> SetPosition = (name) =>
            {
                int  index    = Array.IndexOf(NAME[RESTART_STEP], name);
                long pointer  = POINTER[RESTART_STEP][index];
                long pointerb = POINTERB[RESTART_STEP][index];
                br.SetPosition(pointerb * 2147483648 + pointer);
            };

            br.OpenBinaryFile(FILENAME);
            SetPosition(property);
            br.ReadHeader();
            DATA = br.ReadFloatList(br.header.count);
            //
            br.CloseBinaryFile();
        }
Esempio n. 4
0
        public void ReadUNSMRY(string filename)
        {
            FileReader br = new FileReader();

            br.OpenBinaryFile(filename);
            if (br.Length > 0)
            {
                DATA = new List <float[]>();

                while (br.Position < br.Length - 24)
                {
                    br.ReadHeader();
                    if (br.header.keyword == "PARAMS" && br.header.count == NLIST)
                    {
                        DATA.Add(br.ReadFloatList(NLIST));
                        continue;
                    }
                    br.SkipEclipseData();
                }
            }
            br.CloseBinaryFile();
            NTIME  = DATA.Count;
            TINDEX = Array.IndexOf(KEYWORDS, "TIME");
        }
Esempio n. 5
0
        public RSSPEC(string filename)
        {
            FileReader br = new FileReader();

            br.OpenBinaryFile(filename);

            if (br.Length > 0)
            {
                while (br.Position < br.Length - 24)
                {
                    br.ReadHeader();

                    if (br.header.keyword == "TIME")
                    {
                        br.ReadBytes(4);
                        TIME.Add(br.ReadDouble());
                        br.ReadBytes(4);
                        continue;
                    }

                    if (br.header.keyword == "ITIME")
                    {
                        int[] ITIME = br.ReadIntList();
                        REPORT.Add(ITIME[0]);
                        TYPE_RESTART.Add(ITIME[5]);
                        if (ITIME.Length > 10)
                        {
                            DATE.Add(new DateTime(ITIME[3], ITIME[2], ITIME[1], ITIME[10], ITIME[11], (int)(ITIME[12] * 1e6)));
                        }
                        else
                        {
                            DATE.Add(new DateTime(ITIME[3], ITIME[2], ITIME[1]));
                        }

                        continue;
                    }

                    if (br.header.keyword == "NAME")
                    {
                        NAME.Add(br.ReadStringList());
                        continue;
                    }

                    if (br.header.keyword == "TYPE")
                    {
                        TYPE.Add(br.ReadStringList());
                        continue;
                    }

                    if (br.header.keyword == "UNITS")
                    {
                        UNITS.Add(br.ReadStringList());
                        continue;
                    }

                    if (br.header.keyword == "NUMBER")
                    {
                        NUMBER.Add(br.ReadIntList());
                        continue;
                    }

                    if (br.header.keyword == "ARRAYMAX")
                    {
                        ARRAYMAX.Add(br.ReadFloatList(br.header.count));
                        continue;
                    }

                    if (br.header.keyword == "ARRAYMIN")
                    {
                        ARRAYMIN.Add(br.ReadFloatList(br.header.count));
                        continue;
                    }

                    if (br.header.keyword == "POINTER")
                    {
                        POINTER.Add(br.ReadIntList());
                        continue;
                    }

                    if (br.header.keyword == "POINTERB")
                    {
                        POINTERB.Add(br.ReadIntList());
                        continue;
                    }

                    br.SkipEclipseData();
                }
                br.CloseBinaryFile();
            }
        }
Esempio n. 6
0
        public void ReadRestart(string filename, int step)
        {
            FILENAME     = filename;
            RESTART_STEP = step;

            FileReader br = new FileReader();

            Action <string> SetPosition = (name) =>
            {
                int  index    = Array.IndexOf(NAME[step], name);
                long pointer  = POINTER[step][index];
                long pointerb = POINTERB[step][index];
                br.SetPosition(pointerb * 2147483648 + pointer);
            };


            WELLS = new List <WELLDATA>();
            br.OpenBinaryFile(filename);
            SetPosition("INTEHEAD");
            br.ReadHeader();
            int[] INTH = br.ReadIntList();
            NX     = INTH[8];
            NY     = INTH[9];
            NZ     = INTH[10];
            NACTIV = INTH[11];
            IPHS   = INTH[14];
            NWELLS = INTH[16];
            NCWMAX = INTH[17];
            NIWELZ = INTH[24];
            NSWELZ = INTH[25];
            NXWELZ = INTH[26];
            NZWELZ = INTH[27];
            NICONZ = INTH[32];
            NSCONZ = INTH[33];
            NXCONZ = INTH[34];

            SetPosition("IWEL");
            br.ReadHeader();
            int[] IWEL = br.ReadIntList();

            for (int iw = 0; iw < NWELLS; ++iw)
            {
                WELLS.Add(new WELLDATA
                {
                    I          = IWEL[iw * NIWELZ + 0],
                    J          = IWEL[iw * NIWELZ + 1],
                    K          = IWEL[iw * NIWELZ + 2],
                    COMPLNUM   = IWEL[iw * NIWELZ + 4],
                    GROUPNUM   = IWEL[iw * NIWELZ + 5],
                    WELLTYPE   = IWEL[iw * NIWELZ + 6],
                    WELLSTATUS = IWEL[iw * NIWELZ + 10]
                });
            }

            SetPosition("SWEL");
            br.ReadHeader();

            float[] SWEL = br.ReadFloatList(br.header.count);

            for (int iw = 0; iw < NWELLS; ++iw)
            {
                WELLS[iw].WOPRH     = SWEL[0];
                WELLS[iw].WWPRH     = SWEL[1];
                WELLS[iw].WGPRH     = SWEL[2];
                WELLS[iw].WLPRH     = SWEL[3];
                WELLS[iw].REF_DEPTH = SWEL[9];
                WELLS[iw].WEFA      = SWEL[24];
                WELLS[iw].BHPH      = SWEL[68];
            }

            SetPosition("XWEL");
            br.ReadHeader();

            double[] XWEL = br.ReadDoubleList();

            for (int iw = 0; iw < NWELLS; ++iw)
            {
                WELLS[iw].WOPR  = XWEL[0];
                WELLS[iw].WWPR  = XWEL[1];
                WELLS[iw].WLPR  = XWEL[3];
                WELLS[iw].WBHP  = XWEL[6];
                WELLS[iw].WWCT  = XWEL[7];
                WELLS[iw].WOPT  = XWEL[18];
                WELLS[iw].WWPT  = XWEL[19];
                WELLS[iw].WWIT  = XWEL[23];
                WELLS[iw].WPI   = XWEL[55];
                WELLS[iw].WOPTH = XWEL[75];
                WELLS[iw].WWPTH = XWEL[76];
                WELLS[iw].WWITH = XWEL[81];
                WELLS[iw].WOPTH = XWEL[75];
            }

            SetPosition("ZWEL");
            br.ReadHeader();

            string[] ZWEL = br.ReadStringList();

            for (int iw = 0; iw < NWELLS; ++iw)
            {
                WELLS[iw].WELLNAME = ZWEL[iw * NZWELZ + 0];
            }
            br.CloseBinaryFile();
        }
Esempio n. 7
0
        public int NTIME;                  // Количество временных шагов

        public SMSPEC(string filename)
        {
            FileReader br = new FileReader();

            br.OpenBinaryFile(filename);

            while (br.Position < br.Length - 24)
            {
                br.ReadHeader();

                if (br.header.keyword == "RESTART")
                {
                    var           tmp = br.ReadStringList();
                    StringBuilder str = new StringBuilder();
                    foreach (string item in tmp)
                    {
                        str.Append(item);
                    }

                    RESTART = str.ToString();
                    continue;
                }

                if (br.header.keyword == "MEASRMNT")
                {
                    var tmp    = br.ReadStringList();
                    int lenght = br.header.count / NLIST;
                    MEASRMNT = new string[NLIST];
                    StringBuilder str = new StringBuilder();
                    for (int iw = 0; iw < NLIST; ++iw)
                    {
                        str.Clear();
                        for (int ik = 0; ik < lenght; ++ik)
                        {
                            str.Append(tmp[iw * lenght + ik]);
                        }
                        MEASRMNT[iw] = str.ToString();
                    }
                    continue;
                }

                if (br.header.keyword == "DIMENS")
                {
                    br.ReadBytes(4);
                    NLIST = br.ReadInt32();
                    NDIVX = br.ReadInt32();
                    NDIVY = br.ReadInt32();
                    NDIVZ = br.ReadInt32();
                    br.ReadBytes(4);
                    ISTAR = br.ReadInt32();
                    br.ReadBytes(4);
                    continue;
                }
                if (br.header.keyword == "KEYWORDS")
                {
                    KEYWORDS = br.ReadStringList();
                    continue;
                }

                if (br.header.keyword == "WGNAMES")
                {
                    WGNAMES = br.ReadStringList();
                    continue;
                }

                if (br.header.keyword == "NUMS")
                {
                    NUMS = br.ReadIntList();
                    continue;
                }

                if (br.header.keyword == "UNITS")
                {
                    WGUNITS = br.ReadStringList();
                    continue;
                }

                if (br.header.keyword == "STARTDAT")
                {
                    br.ReadBytes(4);
                    int SDAY   = br.ReadInt32();
                    int SMONTH = br.ReadInt32();
                    int SYEAR  = br.ReadInt32();
                    STARTDATE = new DateTime(SYEAR, SMONTH, SDAY);

                    if (br.header.count == 6)
                    {
                        int SHOUR   = br.ReadInt32();
                        int SMINUTE = br.ReadInt32();
                        int SSECOND = (int)(br.ReadInt32() * 1e6);
                        STARTDATE = new DateTime(SYEAR, SMONTH, SDAY, SHOUR, SMINUTE, SSECOND);
                    }

                    br.ReadBytes(4);
                    continue;
                }
                br.SkipEclipseData();
            }
            br.CloseBinaryFile();
        }
Esempio n. 8
0
        public INSPEC(string filename)
        {
            FileReader br = new FileReader();

            br.OpenBinaryFile(filename);

            if (br.Length > 0)
            {
                while (br.Position < br.Length - 24)
                {
                    br.ReadHeader();

                    if (br.header.keyword == "NAME")
                    {
                        NAME.Add(br.ReadStringList());
                        continue;
                    }

                    if (br.header.keyword == "TYPE")
                    {
                        TYPE.Add(br.ReadStringList());
                        continue;
                    }

                    if (br.header.keyword == "UNITS")
                    {
                        UNITS.Add(br.ReadStringList());
                        continue;
                    }

                    if (br.header.keyword == "NUMBER")
                    {
                        NUMBER.Add(br.ReadIntList());
                        continue;
                    }

                    if (br.header.keyword == "ARRAYMAX")
                    {
                        ARRAYMAX.Add(br.ReadFloatList(br.header.count));
                        continue;
                    }

                    if (br.header.keyword == "ARRAYMIN")
                    {
                        ARRAYMIN.Add(br.ReadFloatList(br.header.count));
                        continue;
                    }

                    if (br.header.keyword == "POINTER")
                    {
                        POINTER.Add(br.ReadIntList());
                        continue;
                    }

                    if (br.header.keyword == "POINTERB")
                    {
                        POINTERB.Add(br.ReadIntList());
                        continue;
                    }

                    br.SkipEclipseData();
                }
                br.CloseBinaryFile();
            }
        }
Esempio n. 9
0
        public int NACTIV; // Количество активных ячеек

        public EGRID(string filename)
        {
            FileReader br = new FileReader();

            br.OpenBinaryFile(filename);

            System.Diagnostics.Debug.WriteLine("EGRID");

            while (br.Position < br.Length - 24)
            {
                br.ReadHeader();
                if (br.header.keyword == "FILEHEAD")
                {
                    FILEHEAD   = br.ReadIntList();
                    GRIDTYPE   = FILEHEAD[4];
                    DUALPORO   = FILEHEAD[5];
                    FORMATDATA = FILEHEAD[6];
                    continue;
                }

                if (br.header.keyword == "MAPUNITS")
                {
                    br.ReadBytes(4);
                    MAPUNITS = br.ReadString(8);
                    br.ReadBytes(4);
                    continue;
                }

                if (br.header.keyword == "MAPAXES")
                {
                    br.ReadBytes(4);
                    XENDYAXIS = br.ReadFloat();
                    YENDYAXIS = br.ReadFloat();
                    XORIGIN   = br.ReadFloat();
                    YORIGIN   = br.ReadFloat();
                    XENDXAXIS = br.ReadFloat();
                    YENDXAXIS = br.ReadFloat();
                    br.ReadBytes(4);
                    continue;
                }

                if (br.header.keyword == "GRIDHEAD")
                {
                    GRIDHEAD = br.ReadIntList();
                    NX       = GRIDHEAD[1];
                    NY       = GRIDHEAD[2];
                    NZ       = GRIDHEAD[3];
                    continue;
                }

                if (br.header.keyword == "COORD")
                {
                    COORD = br.ReadFloatList(6 * (NY + 1) * (NX + 1));
                    continue;
                }

                if (br.header.keyword == "ZCORN")
                {
                    ZCORN = br.ReadBigList((ulong)(8 * NX * NY * NZ));
                    continue;
                }

                if (br.header.keyword == "ACTNUM")
                {
                    ACTNUM = br.ReadIntList();

                    // Для сжатого формата хранения данных
                    // требуется провести индексирования массива активных ячеек
                    // ACTNUM сам по себе это "1" для активной ячейки и "0" для не активной

                    int index = 1;
                    for (int iw = 0; iw < ACTNUM.Length; ++iw)
                    {
                        if (ACTNUM[iw] > 0)
                        {
                            ACTNUM[iw] = index++;
                        }
                    }

                    NACTIV = index - 1;

                    // Теперь ACTNUM хранит ещё и индекс ячейки INDEX, который есть просто линейный порядковый номер
                    // увеличенный на "1", так как надо сохранить нулевые значения в неактивных ячейках
                    continue;
                }

                System.Diagnostics.Debug.WriteLine(br.header.keyword);
                br.SkipEclipseData();
            }
            br.CloseBinaryFile();
        }