コード例 #1
0
        public double[,] GetPointMatrixH(Jacobian jacobian, double conductivity)
        {
            double[] dndx = jacobian.GetdNdx();
            double[] dndy = jacobian.GetdNdy();
            double   det  = jacobian.GetDetJ();

            double[,] tmpdndx = MatrixOperations.multiply(dndx, MatrixOperations.transpose(dndx), det);
            double[,] tmpdndy = MatrixOperations.multiply(dndy, MatrixOperations.transpose(dndy), det);
            return(MatrixOperations.multiply(MatrixOperations.addition(tmpdndx, tmpdndy), new double[] { conductivity }));
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: dudek-tomasz/university-mes
        private void buildMeshButton_Click(object sender, EventArgs e)
        {
            double initTemp     = double.Parse(initTempBox.Text.Replace('.', ','));
            double symTime      = double.Parse(symTimeBox.Text.Replace('.', ','));
            double symStepTime  = double.Parse(symStepTimeBox.Text.Replace('.', ','));
            double ambientTemp  = double.Parse(ambientTempBox.Text.Replace('.', ','));
            double alpha        = double.Parse(alphaBox.Text.Replace('.', ','));
            double H            = double.Parse(hBox.Text.Replace('.', ','));
            double B            = double.Parse(bBox.Text.Replace('.', ','));
            int    nH           = int.Parse(nHBox.Text);
            int    nB           = int.Parse(nBBox.Text);
            double specHeat     = double.Parse(specHeatBox.Text.Replace('.', ','));
            double conductivity = double.Parse(conductivityBox.Text.Replace('.', ','));
            double density      = double.Parse(densityBox.Text.Replace('.', ','));

            this.globalData = new GlobalData(initTemp, symTime, symStepTime, ambientTemp, alpha, H, B, nH, nB, specHeat, conductivity, density);
            grid            = new Grid(globalData);
            UniversalElement[] universalElements = UniversalElement.CreateUniversalElements();
            int nodeNumber = globalData.GetNumberOfNodes();

            c = new double[nodeNumber, nodeNumber];
            h = new double[nodeNumber, nodeNumber];
            p = new double[nodeNumber];


            foreach (Element element in grid.GetElements())
            {
                int elementNodeNumber = element.GetNodes().Length;
                double[,] elementH = new double[elementNodeNumber, elementNodeNumber];
                double[,] elementC = new double[elementNodeNumber, elementNodeNumber];
                double[] elementP;
                foreach (UniversalElement universalElement in universalElements)
                {
                    Jacobian jacobian = new Jacobian(element, universalElement);
                    elementH = MatrixOperations.addition(elementH, element.GetPointMatrixH(jacobian, globalData.GetConductivity()));
                    elementC = MatrixOperations.addition(elementC, element.GetPointMatrixC(universalElement, jacobian.GetDetJ(), globalData.GetSpecificHeat(), globalData.GetDensity()));
                }
                elementH = MatrixOperations.addition(elementH, element.GetMatrixHbc(globalData.GetAlfa()));
                elementP = element.getVectorP(globalData.GetAlfa(), globalData.GetAmbientTemp());
                Node[] nodes = element.GetNodes();
                for (int i = 0; i < nodes.Length; i++)
                {
                    for (int j = 0; j < nodes.Length; j++)
                    {
                        c[nodes[i].GetId() - 1, nodes[j].GetId() - 1] += elementC[i, j];
                        h[nodes[i].GetId() - 1, nodes[j].GetId() - 1] += elementH[i, j];
                    }
                    p[nodes[i].GetId() - 1] += elementP[i];
                }
            }
        }