示例#1
0
        // Set displacement differentiation matrix bmat.
        // xi, et - local coordinates,
        // returns  determinant of Jacobian matrix
        private double setBmatrix(double xi, double et)
        {
            // Derivatives of shape functions
            double det = ShapeLin2D.deriv(xi, et, ind, xy, dnxy);

            if (det <= 0)
            {
                UTIL.errorMsg("Negative/zero 4N element area");
            }
            if (FeModel.stressState == FeModel.StrStates.axisym)
            {
                ShapeLin2D.shape(xi, et, ind, an);
                r = 0.0;
                for (int i = 0; i < 4; i++)
                {
                    r += an[i] * xy[i][0];
                }
            }
            // Four blocks of the displacement differentiation matrix
            for (int ib = 0; ib < 4; ib++)
            {
                bmat[0][2 * ib]     = dnxy[ib][0];
                bmat[0][2 * ib + 1] = 0.0;
                bmat[1][2 * ib]     = 0.0;
                bmat[1][2 * ib + 1] = dnxy[ib][1];
                bmat[2][2 * ib]     = dnxy[ib][1];
                bmat[2][2 * ib + 1] = dnxy[ib][0];
                if (FeModel.stressState == FeModel.StrStates.axisym)
                {
                    bmat[3][2 * ib]     = an[ib] / r;
                    bmat[3][2 * ib + 1] = 0.0;
                }
            }
            return(det);
        }
示例#2
0
        // Compute thermal vector
        public override void thermalVector()
        {
            // Zeros to thermal vector evec
            for (int i = 0; i < 8; i++)
            {
                evec[i] = 0.0;
            }
            int ld = (FeModel.stressState == FeModel.StrStates.axisym) ? 4 : 3;

            // Material mat
            mat = (Material)fem.materials[matName];
            mat.elasticityMatrix(emat);
            double alpha = mat.getAlpha();
            double nu    = mat.getNu();

            // Gauss integration loop
            for (int ip = 0; ip < gh.nIntPoints; ip++)
            {
                // Set displacement differentiation matrix bmat
                double det = setBmatrix(gh.xii[ip], gh.eti[ip]);
                // Shape functions an
                ShapeLin2D.shape(gh.xii[ip], gh.eti[ip], ind, an);
                double t = 0.0;
                for (int i = 0; i < 4; i++)
                {
                    t += an[i] * dtn[i];
                }
                double dv = det * gh.wi[ip];
                if (FeModel.stressState == FeModel.StrStates.axisym)
                {
                    dv *= 2.0 * Math.PI * r;
                }
                ept[0] = alpha * t;
                if (FeModel.stressState == FeModel.StrStates.plstrain)
                {
                    ept[0] *= (1 + nu);
                }
                ept[1] = ept[0];
                ept[2] = 0.0;
                ept[3] = ept[0];

                for (int i = 0; i < 8; i++)
                {
                    double s = 0;
                    for (int j = 0; j < ld; j++)
                    {
                        for (int k = 0; k < ld; k++)
                        {
                            s += bmat[k][i] * emat[j][k] * ept[j] * this.t;
                        }
                    }
                    evec[i] += s * dv;
                }
            }
        }
示例#3
0
        // Get temperature at integration point (stress)
        public override double getTemperatureAtIntPoint(int ip)
        {
            ShapeLin2D.shape(gs.xii[ip], gs.eti[ip], ind, an);
            double t = 0;

            for (int i = 0; i < 4; i++)
            {
                t += an[i] * dtn[i];
            }
            return(t);
        }
示例#4
0
        // Set nodal equivalent of distributed face load to evec.
        // surLd - object describing element face load;
        // returns loaded element face
        // or -1 (loaded nodes do not match elem face)
        public override int equivFaceLoad(ElemFaceLoad surLd)
        {
            // Shape functons
            double[] an = new double[2];
            // Derivatives of shape functions
            double[] xin = new double[2];

            for (int i = 0; i < 8; i++)
            {
                evec[i] = 0.0;
            }
            int loadedFace = surLd.rearrange(faceInd, ind);

            if (loadedFace == -1)
            {
                return(-1);
            }

            // Gauss integration loop
            for (int ip = 0; ip < gf.nIntPoints; ip++)
            {
                ShapeLin2D.shapeDerivFace(gf.xii[ip], an, xin);
                double p  = r = 0.0;
                double xs = 0.0;
                double ys = 0.0;
                for (int i = 0; i < 2; i++)
                {
                    p += an[i] * surLd.forceAtNodes[i];
                    int j = faceInd[loadedFace][i];
                    r  += an[i] * xy[j][0];
                    xs += xin[i] * xy[j][0];
                    ys += xin[i] * xy[j][1];
                }
                double dl = Math.Sqrt(xs * xs + ys * ys);
                double ds = dl;
                if (FeModel.stressState == FeModel.StrStates.axisym)
                {
                    ds *= 2.0 * Math.PI * r;
                }
                double p1, p2;
                // direction=0 - normal load, =1,2 - along axes x,y
                if (surLd.direction == 0 && ds > 0.0)
                {
                    p1 = p * ys / dl;
                    p2 = -p * xs / dl;
                }
                else if (surLd.direction == 1)
                {
                    p1 = p; p2 = 0;
                }
                else
                {
                    p1 = 0; p2 = p;
                }

                for (int i = 0; i < 2; i++)
                {
                    int j = faceInd[loadedFace][i];
                    evec[2 * j]     += an[i] * p1 * ds * gf.wi[ip] * this.t;
                    evec[2 * j + 1] += an[i] * p2 * ds * gf.wi[ip] * this.t;
                    // Console.WriteLine(2*j);
                }
            }
            return(loadedFace);
        }