Beispiel #1
0
        private void ParseBiegebalkenGelenk(IReadOnlyList <string> lines)
        {
            nodesPerElement = 2;
            for (var i = 0; i < lines.Count; i++)
            {
                if (lines[i] != "BiegebalkenGelenk")
                {
                    continue;
                }
                FeParser.InputFound += "\nBiegebalkenGelenk";
                do
                {
                    substrings = lines[i + 1].Split(delimiters);

                    switch (substrings.Length)
                    {
                    case 6:
                    {
                        elementId = substrings[0];
                        nodeIds   = new string[nodesPerElement];
                        for (var k = 0; k < nodesPerElement; k++)
                        {
                            nodeIds[k] = substrings[k + 1];
                        }
                        var querschnittId = substrings[3];
                        var materialId    = substrings[4];
                        int type;
                        switch (short.Parse(substrings[5]))
                        {
                        //if (string.Equals(gelenk, "F", StringComparison.OrdinalIgnoreCase)) type = 1;
                        //else if (string.Equals(gelenk, "S", StringComparison.OrdinalIgnoreCase)) type = 2;
                        case 1:
                            type = 1;
                            break;

                        case 2:
                            type = 2;
                            break;

                        default:
                            throw new ParseAusnahme((i + 2) + ": BiegebalkenGelenk, falscher Gelenktyp");
                        }
                        element = new BiegebalkenGelenk(nodeIds, materialId, querschnittId, modell, type)
                        {
                            ElementId = elementId
                        };
                        modell.Elemente.Add(elementId, element);
                        i++;
                        break;
                    }

                    default:
                        throw new ParseAusnahme((i + 2) + ": BiegebalkenGelenk, falsche Anzahl Parameter");
                    }
                } while (lines[i + 1].Length != 0);
                break;
            }
        }
Beispiel #2
0
 // compute and solve system matrix in profile format with status vector *****************************************************
 private void SetProfile()
 {
     foreach (var item in modell.Elemente)
     {
         element = item.Value;
         systemEquations.SetProfile(element.SystemIndicesOfElement);
     }
     systemEquations.AllocateMatrix();
     profile = true;
 }
Beispiel #3
0
 private void ReComputeSystemMatrix()
 {
     // traverse the elements to assemble the stiffness coefficients
     systemEquations.InitializeMatrix();
     foreach (var item in modell.Elemente)
     {
         element = item.Value;
         var indices       = element.SystemIndicesOfElement;
         var elementMatrix = element.ComputeMatrix();
         systemEquations.AddMatrix(indices, elementMatrix);
     }
 }
Beispiel #4
0
        private PathGeometry WärmeflussElementmitte(AbstraktElement abstraktElement, double length)
        {
            Abstrakt2D abstrakt2D   = (Abstrakt2D)abstraktElement;
            var        pathFigure   = new PathFigure();
            var        pathGeometry = new PathGeometry();
            var        cg           = abstrakt2D.ComputeCenterOfGravity();

            int[] fensterKnoten = { (int)(cg.X * auflösung), (int)((-cg.Y + maxY) * auflösung) };
            pathFigure.StartPoint = new Point(fensterKnoten[0] - length / 2, fensterKnoten[1]);
            var endPoint = new Point(fensterKnoten[0] + length / 2, fensterKnoten[1]);

            pathFigure.Segments.Add(new LineSegment(endPoint, true));
            pathFigure.Segments.Add(new LineSegment(new Point(endPoint.X - 3, endPoint.Y - 2), true));
            pathFigure.Segments.Add(new LineSegment(new Point(endPoint.X - 3, endPoint.Y + 2), true));
            pathFigure.Segments.Add(new LineSegment(new Point(endPoint.X, endPoint.Y), true));
            pathGeometry.Figures.Add(pathFigure);
            return(pathGeometry);
        }
Beispiel #5
0
 public void ComputeSystemMatrix()
 {
     if (!setDimension)
     {
         DetermineDimension();
     }
     if (!profile)
     {
         SetProfile();
     }
     // traverse the elements to assemble the stiffness coefficients
     foreach (var item in modell.Elemente)
     {
         element = item.Value;
         var elementMatrix = element.ComputeMatrix();
         systemEquations.AddMatrix(element.SystemIndicesOfElement, elementMatrix);
     }
     SetStatusVector();
 }
Beispiel #6
0
        public void ElementTemperaturZeichnen()
        {
            foreach (var item in modell.Knoten)
            {
                knoten = item.Value;
                temp   = knoten.NodalDof[0];
                if (temp > maxTemp)
                {
                    maxTemp = temp;
                }
                if (temp < minTemp)
                {
                    minTemp = temp;
                }
            }

            foreach (var item in modell.Elemente)
            {
                element = item.Value;
                var pathGeometry       = AktElementZeichnen((Abstrakt2D)element);
                var elementTemperature = element.NodeIds.Where(knotenId
                                                               => modell.Knoten.TryGetValue(knotenId, out knoten)).Sum(knotenId => knoten.NodalDof[0]);
                elementTemperature /= element.NodeIds.Length;
                var intens  = (byte)(255 * (elementTemperature - minTemp) / (maxTemp - minTemp));
                var rot     = FromArgb(intens, 255, 0, 0);
                var myBrush = new SolidColorBrush(rot);

                Shape path = new Path()
                {
                    Stroke          = Blue,
                    StrokeThickness = 1,
                    Fill            = myBrush,
                    Data            = pathGeometry
                };
                TemperaturElemente.Add(path);
                // setz oben/links Position zum Zeichnen auf dem Canvas
                SetLeft(path, RandLinks);
                SetTop(path, RandOben);
                // zeichne Shape
                visualErgebnisse.Children.Add(path);
            }
        }
Beispiel #7
0
        public void ElementeZeichnen()
        {
            foreach (var item in modell.Elemente)
            {
                element = item.Value;
                var pathGeometry = AktElementZeichnen(element);

                Shape path = new Path()
                {
                    Stroke          = Brushes.Black,
                    StrokeThickness = 1,
                    Data            = pathGeometry
                };
                // setz oben/links Position zum Zeichnen auf dem Canvas
                SetLeft(path, RandLinks);
                SetTop(path, RandOben);
                // zeichne Shape
                visualErgebnisse.Children.Add(path);
            }
        }
Beispiel #8
0
        private void ParseElement2D3(IReadOnlyList <string> lines)
        {
            nodesPerElement = 3;
            var delimiters = new[] { '\t' };

            for (var i = 0; i < lines.Count; i++)
            {
                if (lines[i] != "Elemente2D3Knoten")
                {
                    continue;
                }
                InputFound += "\nElemente2D3Knoten";
                do
                {
                    substrings = lines[i + 1].Split(delimiters);
                    switch (substrings.Length)
                    {
                    case 5:
                    {
                        elementId = substrings[0];
                        nodeIds   = new string[nodesPerElement];
                        for (var k = 0; k < nodesPerElement; k++)
                        {
                            nodeIds[k] = substrings[k + 1];
                        }

                        materialId = substrings[4];

                        element = new Element2D3(elementId, nodeIds, materialId, modell);
                        modell.Elemente.Add(elementId, element);
                        i++;
                        break;
                    }

                    default:
                        throw new ParseAusnahme((i + 2) + ": Elemente2D3Knoten, falsche Anzahl Parameter");
                    }
                } while (lines[i + 1].Length != 0);
                break;
            }
        }
Beispiel #9
0
        private void ParseElement2D3(IReadOnlyList <string> lines)
        {
            const int nodesPerElement = 3;
            var       delimiters      = new[] { '\t' };

            for (var i = 0; i < lines.Count; i++)
            {
                if (lines[i] != "Element2D3")
                {
                    continue;
                }
                FeParser.InputFound += "\nElement2D3";
                do
                {
                    substrings = lines[i + 1].Split(delimiters);
                    if (substrings.Length == 6)
                    {
                        elementId = substrings[0];
                        nodeIds   = new string[nodesPerElement];
                        for (var k = 0; k < nodesPerElement; k++)
                        {
                            nodeIds[k] = substrings[k + 1];
                        }

                        var querschnittId = substrings[4];
                        var materialId    = substrings[5];
                        element = new Element2D3(nodeIds, querschnittId, materialId, modell)
                        {
                            ElementId = elementId
                        };
                        modell.Elemente.Add(elementId, element);
                        i++;
                    }
                    else
                    {
                        throw new ParseAusnahme((i + 1) + ": Element2D3 erfordert 6 Eingabeparameter");
                    }
                } while (lines[i + 1].Length != 0);
                break;
            }
        }
Beispiel #10
0
        private void ParseBiegebalken(IReadOnlyList <string> lines)
        {
            nodesPerElement = 2;
            for (var i = 0; i < lines.Count; i++)
            {
                if (lines[i] != "Biegebalken")
                {
                    continue;
                }
                FeParser.InputFound += "\nBiegebalken";
                do
                {
                    substrings = lines[i + 1].Split(delimiters);
                    switch (substrings.Length)
                    {
                    case 5:
                    {
                        elementId = substrings[0];
                        nodeIds   = new string[nodesPerElement];
                        for (var k = 0; k < nodesPerElement; k++)
                        {
                            nodeIds[k] = substrings[k + 1];
                        }
                        var querschnittId = substrings[3];
                        var materialId    = substrings[4];
                        element = new Biegebalken(nodeIds, querschnittId, materialId, modell)
                        {
                            ElementId = elementId
                        };
                        modell.Elemente.Add(elementId, element);
                        i++;
                        break;
                    }

                    default:
                        throw new ParseAusnahme((i + 2) + ": Biegebalken, falsche Anzahl Parameter");
                    }
                } while (lines[i + 1].Length != 0);
                break;
            }
        }
Beispiel #11
0
        private PathGeometry AktElementZeichnen(AbstraktElement aktElement)
        {
            var pathFigure   = new PathFigure();
            var pathGeometry = new PathGeometry();

            if (modell.Knoten.TryGetValue(aktElement.NodeIds[0], out knoten))
            {
            }
            //fensterKnoten = TransformKnoten(knoten, auflösung, maxY);
            var startPoint = TransformKnoten(knoten, auflösung, maxY);

            pathFigure.StartPoint = startPoint;
            for (var i = 1; i < aktElement.NodeIds.Length; i++)
            {
                if (modell.Knoten.TryGetValue(aktElement.NodeIds[i], out knoten))
                {
                }
                var nextPoint = TransformKnoten(knoten, auflösung, maxY);
                pathFigure.Segments.Add(new LineSegment(nextPoint, true));
            }
            pathFigure.IsClosed = true;
            pathGeometry.Figures.Add(pathFigure);
            return(pathGeometry);
        }
Beispiel #12
0
        private void ParseElement3D8Netz(string[] lines)
        {
            const int nodesPerElement = 8;
            var       delimiters      = new[] { '\t' };

            for (var i = 0; i < lines.Length; i++)
            {
                if (lines[i] != "3D8ElementNetz")
                {
                    continue;
                }
                FeParser.InputFound += "\n3D8ElementNetz";
                do
                {
                    substrings = lines[i + 1].Split(delimiters);
                    if (substrings.Length != 4)
                    {
                        throw new ParseAusnahme("falsche Anzahl Parameter für Elementeingabe:\n"
                                                + "muss gleich 4 sein für elementName, Knotennetzname,"
                                                + "Anzahl der Intervalle und Elementmaterial");
                    }
                    var initial    = substrings[0];
                    var eNodeName  = substrings[1];
                    int nIntervals = Int16.Parse(substrings[2]);
                    var eMaterial  = substrings[3];


                    for (var n = 0; n < nIntervals; n++)
                    {
                        var idX  = n.ToString().PadLeft(2, '0');
                        var idXp = (n + 1).ToString().PadLeft(2, '0');
                        for (var m = 0; m < nIntervals; m++)
                        {
                            var idY  = m.ToString().PadLeft(2, '0');
                            var idYp = (m + 1).ToString().PadLeft(2, '0');
                            for (var k = 0; k < nIntervals; k++)
                            {
                                var idZ         = k.ToString().PadLeft(2, '0');
                                var idZp        = (k + 1).ToString().PadLeft(2, '0');
                                var eNode       = new String[nodesPerElement];
                                var elementName = initial + idX + idY + idZ;
                                if (modell.Elemente.TryGetValue(elementName, out element))
                                {
                                    throw new ParseAusnahme("Element \"" + elementName + "\" bereits vorhanden.");
                                }
                                eNode[0] = eNodeName + idX + idY + idZ;
                                eNode[1] = eNodeName + idXp + idY + idZ;
                                eNode[2] = eNodeName + idXp + idYp + idZ;
                                eNode[3] = eNodeName + idX + idYp + idZ;
                                eNode[4] = eNodeName + idX + idY + idZp;
                                eNode[5] = eNodeName + idXp + idY + idZp;
                                eNode[6] = eNodeName + idXp + idYp + idZp;
                                eNode[7] = eNodeName + idX + idYp + idZp;
                                element  = new Element3D8(eNode, eMaterial, modell)
                                {
                                    ElementId = elementName
                                };
                                modell.Elemente.Add(elementName, element);
                            }
                        }
                    }
                } while (lines[i + 2].Length != 0);
                break;
            }
        }