Exemple #1
0
        public bool Create(string filename_)
        {
            Inputfile = filename_;
            if (LoadFromFile() != 0)
                return false;
//            U = new REAL[imax ,jmax];

            SetParameters();
            count = 0;

            elements = new Element[elementcount];
            int e;
            for (e = 0; e < elementcount; e++)
            {
                elements[e] = new Element();
            }

            for (e = 1; e < elementcount - 1; e++)
            {
                Element elem = elements[e];
                elem.dh = xlength / (elementcount - 2);
                elem.volume = elem.dh * FaceArea;
                elem.u = 0;
                elem.SourceCoeff = 0;
                elem.boundaryType = Element.BoundaryType.BND_NO;
                elem.nbs[0] = elements[e - 1];
                elem.nbs[1] = elements[e + 1];
                elem.facenormals[0] = -1;
                elem.facenormals[1] = 1;
            }


            SetBoundary();


            return true;
        }
Exemple #2
0
        public bool Create(string filename_)
        {
            Inputfile = filename_;
            if (LoadFromFile() != 0)
                return false;
//            U = new REAL[imax ,jmax];

            SetParameters();
            count = 0;

            elements = new Element[7];
            int e;
            int elemnum = elements.Length;
            for (e = 0; e < elemnum; e++)
            {
                elements[e] = new Element();
            }

            //int elementcount = elements.Length;
            for (e = 1; e < elemnum-1; e++)
            {
                Element elem = elements[e];
                elem.dh = xlength / (elemnum-2);
                elem.volume = elem.dh * FaceArea;
                elem.u = 0;
                //                if (elem.boundaryType == Element.BoundaryType.BND_NO)

                int nf;
                for (nf = 0; nf < Element.FACEMAX; nf++)
                {
                    elem.faces[nf] = new Face();
                    elem.faces[nf].Area = FaceArea;
                }
                //if(e==0)
                //{
                //  elem.nbs[0] = -1;
                //  elem.faces[0].nodesdst=elem.dh/2;
                //}
                //else
                //{
                  elem.nbs[0] =e-1;
                  elem.faces[0].nodesdst=elem.dh;
                //}
                //if (e == elemnum-1)
                //{
                //    elem.nbs[1] = -1;
                //    elem.faces[1].nodesdst=elem.dh/2;
                //}
                //else
               //{
                    elem.nbs[1] = e + 1;
                    elem.faces[1].nodesdst=elem.dh;
                //}
                    elem.FluxCoeff = (GlobCoeff * elem.faces[0].Area) / elem.dh;
            }

            double dh2 = (xlength / (elemnum - 2)) / 2;
            elements[0].boundaryType = Element.BoundaryType.BND_CONST;
            elements[0].FluxCoeff = (GlobCoeff * FaceArea) / dh2;

            elements[elements.Length - 1].boundaryType = Element.BoundaryType.BND_CONST;
            elements[elements.Length - 1].FluxCoeff = (GlobCoeff * FaceArea) / dh2;

            SetBoundary();



            return true;
        }