Esempio n. 1
0
        public ContinuumElement3DNonLinear(IReadOnlyList <Node> nodes, IIsoparametricInterpolation3D interpolation,
                                           IQuadrature3D quadratureForStiffness, IQuadrature3D quadratureForMass,
                                           IGaussPointExtrapolation3D gaussPointExtrapolation,
                                           IContinuumMaterial3D material, IDynamicMaterial dynamicProperties)
        {
            this.dynamicProperties           = dynamicProperties;
            this.Interpolation               = interpolation;
            this.QuadratureForConsistentMass = quadratureForMass;
            this.nGaussPoints           = quadratureForStiffness.IntegrationPoints.Count;
            this.QuadratureForStiffness = quadratureForStiffness;
            this.Nodes = nodes;

            materialsAtGaussPoints = new IContinuumMaterial3D[nGaussPoints];
            for (int i = 0; i < nGaussPoints; i++)
            {
                materialsAtGaussPoints[i] = (IContinuumMaterial3D)material.Clone();
            }

            dofTypes = new IDofType[nodes.Count][];
            for (int i = 0; i < nodes.Count; i++)
            {
                dofTypes[i] = new IDofType[]
                {
                    StructuralDof.TranslationX, StructuralDof.TranslationY, StructuralDof.TranslationZ
                };
            }
        }
Esempio n. 2
0
        public ContinuumElement3D(IReadOnlyList <Node> nodes, IIsoparametricInterpolation3D interpolation,
                                  IQuadrature3D quadratureForStiffness, IQuadrature3D quadratureForMass,
                                  IGaussPointExtrapolation3D gaussPointExtrapolation,
                                  IReadOnlyList <IContinuumMaterial3D> materialsAtGaussPoints, IDynamicMaterial dynamicProperties)
        {
            this.dynamicProperties       = dynamicProperties;
            this.materialsAtGaussPoints  = materialsAtGaussPoints;
            this.GaussPointExtrapolation = gaussPointExtrapolation;
            this.Nodes         = nodes;
            this.Interpolation = interpolation;
            this.QuadratureForConsistentMass = quadratureForMass;
            //this.nGaussPoints = quadratureForStiffness.IntegrationPoints.Count;
            this.QuadratureForStiffness = quadratureForStiffness;

            //materialsAtGaussPoints = new IContinuumMaterial3D[nGaussPoints];
            //for (int i = 0; i < nGaussPoints; i++)
            //	materialsAtGaussPoints[i] = (IContinuumMaterial3D)material.Clone();

            dofTypes = new IDofType[nodes.Count][];
            for (int i = 0; i < nodes.Count; i++)
            {
                dofTypes[i] = new IDofType[]
                {
                    StructuralDof.TranslationX, StructuralDof.TranslationY, StructuralDof.TranslationZ
                };
            }

            strainsVec = new double[materialsAtGaussPoints.Count][];
            strainsVecLastConverged = new double[materialsAtGaussPoints.Count][];
            for (int gpoint = 0; gpoint < materialsAtGaussPoints.Count; gpoint++)
            {
                strainsVec[gpoint] = new double[6];
                strainsVecLastConverged[gpoint] = new double[6];
            }
        }
Esempio n. 3
0
 public BodyLoadElement(IBodyLoad bodyLoad, IIsoparametricInterpolation3D interpolation3D,
                        IQuadrature3D quadrature3D, IReadOnlyList <Node> nodes)
 {
     _bodyLoad      = bodyLoad;
     _interpolation = interpolation3D;
     _quadrature    = quadrature3D;
     _nodes         = nodes;
 }
Esempio n. 4
0
 public Shell8NonLinear(IShellMaterial material, IQuadrature3D quadratureForStiffness)
 {
     this.Interpolation          = InterpolationShell8.UniqueInstance;
     this.QuadratureForStiffness = quadratureForStiffness;
     this.nGaussPoints           = quadratureForStiffness.IntegrationPoints.Count;
     materialsAtGaussPoints      = new IShellMaterial[nGaussPoints];
     for (int i = 0; i < nGaussPoints; i++)
     {
         materialsAtGaussPoints[i] = material.Clone();
     }
 }
        public Hexa8NonLinear(IContinuumMaterial3D material, IQuadrature3D quadratureForStiffness)
        {
            this.nGaussPoints           = quadratureForStiffness.IntegrationPoints.Count;
            this.QuadratureForStiffness = quadratureForStiffness;
            this.Interpolation          = InterpolationHexa8Reverse.UniqueInstance;

            materialsAtGaussPoints = new IContinuumMaterial3D[nGaussPoints];
            for (int i = 0; i < nGaussPoints; i++)
            {
                materialsAtGaussPoints[i] = (IContinuumMaterial3D)material.Clone();
            }
        }
Esempio n. 6
0
        public static (Matrix[] ll1, Matrix[] J_0a) Getll1AndJ_0a(IQuadrature3D quadrature, double[] tk,
                                                                  IReadOnlyList <double[]> shapeFunctions, IReadOnlyList <Matrix> shapeFunctionDerivatives)
        {
            int nGaussPoints = quadrature.IntegrationPoints.Count;

            Matrix[] ll1;
            ll1 = new Matrix[nGaussPoints];
            for (int j = 0; j < nGaussPoints; j++)
            {
                ll1[j] = Matrix.CreateZero(3, 24);
            }
            for (int j = 0; j < nGaussPoints; j++)             //calcualte ll1 as a whole, at each gp
            {
                var gaussPoint = quadrature.IntegrationPoints[j];
                for (int k = 0; k < 8; k++)
                {
                    ll1[j][0, 3 * k]     = shapeFunctionDerivatives[j][k, 0];
                    ll1[j][0, 3 * k + 1] = 0.5 * gaussPoint.Zeta * tk[k] * shapeFunctionDerivatives[j][k, 0];
                    ll1[j][0, 3 * k + 2] = -ll1[j][0, 3 * k + 1];
                    ll1[j][1, 3 * k]     = shapeFunctionDerivatives[j][k, 1];
                    ll1[j][1, 3 * k + 1] = 0.5 * gaussPoint.Zeta * tk[k] * shapeFunctionDerivatives[j][k, 1];
                    ll1[j][1, 3 * k + 2] = -ll1[j][1, 3 * k + 1];
                    ll1[j][2, 3 * k]     = 0;
                    ll1[j][2, 3 * k + 1] = 0.5 * tk[k] * shapeFunctions[j][k];
                    ll1[j][2, 3 * k + 2] = -ll1[j][2, 3 * k + 1];
                }
            }

            Matrix[] J_0a;            //final values (not precalculated )
            J_0a = new Matrix[nGaussPoints];
            for (int j = 0; j < nGaussPoints; j++)
            {
                J_0a[j] = Matrix.CreateZero(3, 16);
            }
            for (int j = 0; j < nGaussPoints; j++)
            {
                for (int k = 0; k < 8; k++)
                {
                    J_0a[j][0, 2 * k]     = ll1[j][0, 3 * k];
                    J_0a[j][0, 2 * k + 1] = ll1[j][0, 3 * k + 1];
                    J_0a[j][1, 2 * k]     = ll1[j][1, 3 * k];
                    J_0a[j][1, 2 * k + 1] = ll1[j][1, 3 * k + 1];
                    J_0a[j][2, 2 * k]     = ll1[j][2, 3 * k];
                    J_0a[j][2, 2 * k + 1] = ll1[j][2, 3 * k + 1];
                }
            }

            return(ll1, J_0a);
        }
Esempio n. 7
0
        public Hexa8ThermoHyperElastic(IContinuumMaterial3DDefGrad hyperElasticMaterial, ThermalMaterial thermalMaterial,
                                       IQuadrature3D quadratureForStiffness, IQuadrature3D quadratureForMass, IGaussPointExtrapolation3D gaussPointExtrapolation)
        {
            this.thermalMaterial             = thermalMaterial;
            this.nGaussPoints                = quadratureForStiffness.IntegrationPoints.Count;
            this.QuadratureForConsistentMass = quadratureForMass;
            this.QuadratureForStiffness      = quadratureForStiffness;
            this.Interpolation               = InterpolationHexa8Reverse.UniqueInstance;

            materialsAtGaussPoints = new IContinuumMaterial3DDefGrad[nGaussPoints];
            for (int i = 0; i < nGaussPoints; i++)
            {
                materialsAtGaussPoints[i] = (IContinuumMaterial3DDefGrad)hyperElasticMaterial.Clone();
            }
        }
Esempio n. 8
0
        public ConvectionDiffusionElement3D(IReadOnlyList <Node> nodes, IIsoparametricInterpolation3D interpolation,
                                            IQuadrature3D quadratureForStiffness, IQuadrature3D quadratureForMass,
                                            IGaussPointExtrapolation3D gaussPointExtrapolation, ConvectionDiffusionMaterial material)
        {
            this.material = material;
            this.GaussPointExtrapolation = gaussPointExtrapolation;
            this.Nodes         = nodes;
            this.Interpolation = interpolation;
            this.QuadratureForConsistentMass = quadratureForMass;
            this.QuadratureForStiffness      = quadratureForStiffness;

            dofTypes = new IDofType[nodes.Count][];
            for (int i = 0; i < interpolation.NumFunctions; ++i)
            {
                dofTypes[i] = new IDofType[] { ThermalDof.Temperature }
            }
            ;
        }
        public ContinuumElement3D(IReadOnlyList <Node> nodes, IIsoparametricInterpolation3D interpolation,
                                  IQuadrature3D quadratureForStiffness, IQuadrature3D quadratureForMass,
                                  IGaussPointExtrapolation3D gaussPointExtrapolation,
                                  IReadOnlyList <ElasticMaterial3D> materialsAtGaussPoints, DynamicMaterial dynamicProperties)
        {
            this.dynamicProperties       = dynamicProperties;
            this.materialsAtGaussPoints  = materialsAtGaussPoints;
            this.GaussPointExtrapolation = gaussPointExtrapolation;
            this.Nodes         = nodes;
            this.Interpolation = interpolation;
            this.QuadratureForConsistentMass = quadratureForMass;
            this.QuadratureForStiffness      = quadratureForStiffness;

            dofTypes = new IDofType[nodes.Count][];
            for (int i = 0; i < nodes.Count; i++)
            {
                dofTypes[i] = new IDofType[]
                {
                    StructuralDof.TranslationX, StructuralDof.TranslationY, StructuralDof.TranslationZ
                };
            }
        }
Esempio n. 10
0
        /// <summary>
        /// See <see cref="IIsoparametricInterpolation3D.EvaluateFunctionsAtGaussPoints(IQuadrature3D)"/>.
        /// </summary>
        public IReadOnlyList <double[]> EvaluateFunctionsAtGaussPoints(IQuadrature3D quadrature)
        {
            bool isCached = cachedFunctionsAtGPs.TryGetValue(quadrature,
                                                             out IReadOnlyList <double[]> shapeFunctionsAtGPs);

            if (isCached)
            {
                return(shapeFunctionsAtGPs);
            }
            else
            {
                int numGPs = quadrature.IntegrationPoints.Count;
                var shapeFunctionsAtGPsArray = new double[numGPs][];
                for (int gp = 0; gp < numGPs; ++gp)
                {
                    GaussPoint gaussPoint = quadrature.IntegrationPoints[gp];
                    shapeFunctionsAtGPsArray[gp] = EvaluateAt(gaussPoint.Xi, gaussPoint.Eta, gaussPoint.Zeta);
                }
                cachedFunctionsAtGPs.Add(quadrature, shapeFunctionsAtGPsArray);
                return(shapeFunctionsAtGPsArray);
            }
        }
Esempio n. 11
0
        /// <summary>
        /// See <see cref="IIsoparametricInterpolation3D.EvaluateNaturalGradientsAtGaussPoints(IQuadrature3D)"/>.
        /// </summary>
        /// <param name="quadrature"></param>
        public IReadOnlyList <Matrix> EvaluateNaturalGradientsAtGaussPoints(IQuadrature3D quadrature)
        {
            bool isCached = cachedNaturalGradientsAtGPs.TryGetValue(quadrature,
                                                                    out IReadOnlyList <Matrix> naturalGradientsAtGPs);

            if (isCached)
            {
                return(naturalGradientsAtGPs);
            }
            else
            {
                int numGPs = quadrature.IntegrationPoints.Count;
                var naturalGradientsAtGPsArray = new Matrix[numGPs];
                for (int gp = 0; gp < numGPs; ++gp)
                {
                    GaussPoint gaussPoint = quadrature.IntegrationPoints[gp];
                    naturalGradientsAtGPsArray[gp] = EvaluateGradientsAt(gaussPoint.Xi, gaussPoint.Eta, gaussPoint.Zeta);
                }
                cachedNaturalGradientsAtGPs.Add(quadrature, naturalGradientsAtGPsArray);
                return(naturalGradientsAtGPsArray);
            }
        }
 protected GaussPointExtrapolation3DBase(IQuadrature3D quadrature)
 {
     this.cachedExtrapolationFunctionsAtNodes = new Dictionary <IIsoparametricInterpolation3D, double[][]>();
     this.Quadrature = quadrature;
 }
Esempio n. 13
0
 public Table <INode, IDofType, double> CalculateStabilizingBodyLoad(IIsoparametricInterpolation3D interpolation, IQuadrature3D integration, IReadOnlyList <Node> nodes)
 {
     throw new NotImplementedException();
 }
Esempio n. 14
0
        /// <summary>
        /// See <see cref="IIsoparametricInterpolation3D.EvaluateAllAtGaussPoints(IReadOnlyList{Node}, IQuadrature3D)"/>
        /// </summary>
        public IReadOnlyList <EvalInterpolation3D> EvaluateAllAtGaussPoints(IReadOnlyList <Node> nodes, IQuadrature3D quadrature)
        {
            // The shape functions and natural derivatives at each Gauss point are probably cached from previous calls
            IReadOnlyList <double[]> shapeFunctionsAtGPs          = EvaluateFunctionsAtGaussPoints(quadrature);
            IReadOnlyList <Matrix>   naturalShapeDerivativesAtGPs = EvaluateNaturalGradientsAtGaussPoints(quadrature);

            // Calculate the Jacobians and shape derivatives w.r.t. global cartesian coordinates at each Gauss point
            int numGPs = quadrature.IntegrationPoints.Count;
            var interpolationsAtGPs = new EvalInterpolation3D[numGPs];

            for (int gp = 0; gp < numGPs; ++gp)
            {
                interpolationsAtGPs[gp] = new EvalInterpolation3D(nodes, shapeFunctionsAtGPs[gp],
                                                                  naturalShapeDerivativesAtGPs[gp], new IsoparametricJacobian3D(nodes, naturalShapeDerivativesAtGPs[gp]));
            }
            return(interpolationsAtGPs);
        }
Esempio n. 15
0
        public Table <INode, IDofType, double> CalculateBodyLoad(IIsoparametricInterpolation3D interpolation, IQuadrature3D integration, IReadOnlyList <Node> nodes)
        {
            var loadTable = new Table <INode, IDofType, double>();
            IReadOnlyList <Matrix> shapeGradientsNatural =
                interpolation.EvaluateNaturalGradientsAtGaussPoints(integration);
            IReadOnlyList <double[]> shapeFunctionNatural =
                interpolation.EvaluateFunctionsAtGaussPoints(integration);

            for (int gp = 0; gp < integration.IntegrationPoints.Count; gp++)
            {
                var jacobianMatrix = Matrix.CreateZero(3, 3);
                for (int indexNode = 0; indexNode < nodes.Count; indexNode++)
                {
                    jacobianMatrix[0, 0] += shapeGradientsNatural[gp][indexNode, 0] * nodes[indexNode].X;
                    jacobianMatrix[0, 1] += shapeGradientsNatural[gp][indexNode, 0] * nodes[indexNode].Y;
                    jacobianMatrix[0, 2] += shapeGradientsNatural[gp][indexNode, 0] * nodes[indexNode].Z;

                    jacobianMatrix[1, 0] += shapeGradientsNatural[gp][indexNode, 1] * nodes[indexNode].X;
                    jacobianMatrix[1, 1] += shapeGradientsNatural[gp][indexNode, 1] * nodes[indexNode].Y;
                    jacobianMatrix[1, 2] += shapeGradientsNatural[gp][indexNode, 1] * nodes[indexNode].Z;

                    jacobianMatrix[2, 0] += shapeGradientsNatural[gp][indexNode, 2] * nodes[indexNode].X;
                    jacobianMatrix[2, 1] += shapeGradientsNatural[gp][indexNode, 2] * nodes[indexNode].Y;
                    jacobianMatrix[2, 2] += shapeGradientsNatural[gp][indexNode, 2] * nodes[indexNode].Z;
                }

                var jacdet = jacobianMatrix.CalcDeterminant();

                var weightFactor = integration.IntegrationPoints[gp].Weight;
                for (int indexNode = 0; indexNode < nodes.Count; indexNode++)
                {
                    var node   = nodes[indexNode];
                    var valueX = _acceleration * shapeFunctionNatural[gp][indexNode] * jacdet *
                                 weightFactor * _density;
                    if (loadTable.Contains(node, _dofType))
                    {
                        loadTable[node, _dofType] += valueX;
                    }
                    else
                    {
                        loadTable.TryAdd(node, _dofType, valueX);
                    }
                }
            }

            return(loadTable);
        }
        public Table <INode, IDofType, double> CalculateStabilizingBodyLoad(IIsoparametricInterpolation3D interpolation, IQuadrature3D integration, IReadOnlyList <Node> nodes)
        {
            var loadTable = new Table <INode, IDofType, double>();
            IReadOnlyList <Matrix> shapeGradientsNatural =
                interpolation.EvaluateNaturalGradientsAtGaussPoints(integration);
            IReadOnlyList <double[]> shapeFunctionNatural =
                interpolation.EvaluateFunctionsAtGaussPoints(integration);

            for (int gp = 0; gp < integration.IntegrationPoints.Count; gp++)
            {
                var    jacobian = new IsoparametricJacobian3D(nodes, shapeGradientsNatural[gp]);
                Matrix shapeGradientsCartesian =
                    jacobian.TransformNaturalDerivativesToCartesian(shapeGradientsNatural[gp]);
                //TODO: isn't this just the transpose of [dNi/dxj]?
                var deformation = Matrix.CreateZero(3, nodes.Count);
                for (int nodeIdx = 0; nodeIdx < nodes.Count; ++nodeIdx)
                {
                    deformation[0, nodeIdx] = shapeGradientsCartesian[nodeIdx, 0];
                    deformation[1, nodeIdx] = shapeGradientsCartesian[nodeIdx, 1];
                    deformation[2, nodeIdx] = shapeGradientsCartesian[nodeIdx, 2];
                }
                Vector deformationX = deformation.GetRow(0);
                Vector deformationY = deformation.GetRow(1);
                Vector deformationZ = deformation.GetRow(2);
                Vector partialK     = deformationX.Scale(_material.ConvectionCoeff[0]) +
                                      deformationY.Scale(_material.ConvectionCoeff[1]) +
                                      deformationZ.Scale(_material.ConvectionCoeff[2]);
                //loadTable.AxpyIntoThis(partialK, dA);

                var weightFactor = integration.IntegrationPoints[gp].Weight;
                for (int indexNode = 0; indexNode < nodes.Count; indexNode++)
                {
                    var node   = nodes[indexNode];
                    var valueX = -0.5 * _load * partialK[indexNode] * jacobian.DirectDeterminant *
                                 weightFactor;
                    if (loadTable.Contains(node, _dofType))
                    {
                        loadTable[node, _dofType] += valueX;
                    }
                    else
                    {
                        loadTable.TryAdd(node, _dofType, valueX);
                    }
                }
            }

            return(loadTable);
        }
Esempio n. 17
0
        public Table <INode, IDofType, double> CalculateBodyLoad(IIsoparametricInterpolation3D interpolation, IQuadrature3D integration, IReadOnlyList <Node> nodes)
        {
            var loadTable = new Table <INode, IDofType, double>();
            IReadOnlyList <Matrix> shapeGradientsNatural =
                interpolation.EvaluateNaturalGradientsAtGaussPoints(integration);
            IReadOnlyList <double[]> shapeFunctionNatural =
                interpolation.EvaluateFunctionsAtGaussPoints(integration);

            for (int gp = 0; gp < integration.IntegrationPoints.Count; gp++)
            {
                var jacobian = new IsoparametricJacobian3D(nodes, shapeGradientsNatural[gp]);
                var jacdet   = jacobian.DirectDeterminant;

                var weightFactor = integration.IntegrationPoints[gp].Weight;
                for (int indexNode = 0; indexNode < nodes.Count; indexNode++)
                {
                    var node   = nodes[indexNode];
                    var valueX = _load * shapeFunctionNatural[gp][indexNode] * jacobian.DirectDeterminant *
                                 weightFactor;
                    if (loadTable.Contains(node, _dofType))
                    {
                        loadTable[node, _dofType] += valueX;
                    }
                    else
                    {
                        loadTable.TryAdd(node, _dofType, valueX);
                    }
                }
            }

            return(loadTable);
        }
Esempio n. 18
0
        public ContinuumElement3DNonLinearDefGrad(IReadOnlyList <Node> nodes, IContinuumMaterial3DDefGrad material, IQuadrature3D quadratureForStiffness,
                                                  IIsoparametricInterpolation3D interpolation)
        {
            this.nGaussPoints           = quadratureForStiffness.IntegrationPoints.Count;
            this.QuadratureForStiffness = quadratureForStiffness;
            this.Interpolation          = interpolation;


            materialsAtGaussPoints = new IContinuumMaterial3DDefGrad[nGaussPoints];
            for (int i = 0; i < nGaussPoints; i++)
            {
                materialsAtGaussPoints[i] = (IContinuumMaterial3DDefGrad)material.Clone();
            }

            dofTypes = new IDofType[nodes.Count][];
            for (int i = 0; i < nodes.Count; i++)
            {
                dofTypes[i] = new IDofType[]
                {
                    StructuralDof.TranslationX, StructuralDof.TranslationY, StructuralDof.TranslationZ
                };
            }
        }