// 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)
        {
            // Transformation matrix
            L          = Math.Sqrt(Math.Pow((xy[1][0] - xy[0][0]), 2.0) + Math.Pow((xy[1][1] - xy[0][1]), 2.0) + Math.Pow((xy[1][2] - xy[0][2]), 2.0));
            tmat[0][0] = tmat[1][3] = (xy[1][0] - xy[0][0]) / L; // lij
            tmat[0][1] = tmat[1][4] = (xy[1][1] - xy[0][1]) / L; // mij
            tmat[0][2] = tmat[1][5] = (xy[1][2] - xy[0][2]) / L; // nij

            // Shape functons
            double[] an = new double[2];
            // Derivatives of shape functions
            double[] xin = new double[2];

            double[] evec_lcl = new double[2] {
                0, 0
            };

            int loadedFace = surLd.rearrange(faceInd, ind);

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

            // Gauss integration loop
            for (int ip = 0; ip < gf.nIntPoints; ip++)
            {
                shapeDerivFace(gf.xii[ip], an, xin);
                double p = 0.0, xs = 0.0, ys = 0.0, zs = 0.0;
                for (int i = 0; i < 2; i++)
                {
                    p += an[i] * surLd.forceAtNodes[i];
                    int j = faceInd[loadedFace][i];
                    xs += xin[i] * xy[j][0];
                    ys += xin[i] * xy[j][1];
                    zs += xin[i] * xy[j][2];
                }
                double ds = Math.Sqrt(xs * xs + ys * ys + zs * zs);
                for (int i = 0; i < 2; i++)
                {
                    int j = faceInd[loadedFace][i];
                    evec_lcl[j] += an[i] * p * ds * gf.wi[ip];
                    //evec_lcl[j + 1] += an[i] * p * ds * gf.wi[ip];
                }
            }

            // Apply Transform
            for (int i = 0; i < 6; i++)
            {
                evec[i] = tmat[0][i] * evec_lcl[0] + tmat[1][i] * evec_lcl[1];
            }

            return(loadedFace);
        }
Beispiel #2
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);
        }
Beispiel #3
0
        // Set nodal equivalent of distributed face load to evec.
        // surLd - object describing element face load;
        // returns loaded element face
        // or -1 (loaded nodes does not match element face)
        public override int equivFaceLoad(ElemFaceLoad surLd)
        {
            // Shape functons
            double[] an = new double[8];
            // Derivatives of shape functions
            double[][] xin = new double[8][] { new double[2], new double[2], new double[2], new double[2],
                                               new double[2], new double[2], new double[2], new double[2] };
            // Tangent vectors along xi and eta
            double[][] e = new double[2][] { new double[3], new double[3] };
            // Normal vector
            double[] g  = new double[3];
            double[] ps = new double[3];

            for (int i = 0; i < 60; i++)
            {
                evec[i] = 0.0;
            }

            int loadedFace = surLd.rearrange(faceInd, ind);

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

            for (int ip = 0; ip < gf.nIntPoints; ip++)
            {
                ShapeQuad3D.shapeDerivFace(gf.xii[ip], gf.eti[ip], ind, an, xin);
                double p = 0.0;
                for (int i = 0; i < 8; i++)
                {
                    p += an[i] * surLd.forceAtNodes[i];
                }
                // Tangent vectors
                for (int i = 0; i < 2; i++)
                {
                    for (int j = 0; j < 3; j++)
                    {
                        double s = 0;
                        for (int k = 0; k < 8; k++)
                        {
                            s += xin[k][i] * xy[faceInd[loadedFace][k]][j];
                        }
                        e[i][j] = s;
                    }
                }
                // Normal vector g
                g[0] = (e[0][1] * e[1][2] - e[1][1] * e[0][2]);
                g[1] = (e[0][2] * e[1][0] - e[1][2] * e[0][0]);
                g[2] = (e[0][0] * e[1][1] - e[1][0] * e[0][1]);

                // Element of surface ds
                double ds = Math.Sqrt(g[0] * g[0] + g[1] * g[1] + g[2] * g[2]);
                if (ds <= 0)
                {
                    UTIL.errorMsg("Negative/zero element face");
                }
                // Surface load components ps:
                // direction=0 - normal, x=1, y=2, z=3
                if (surLd.direction == 0)
                {
                    for (int i = 0; i < 3; i++)
                    {
                        ps[i] = p * g[i] / ds;
                    }
                }
                else
                {
                    for (int i = 0; i < 3; i++)
                    {
                        ps[i] = 0;
                    }
                    ps[surLd.direction - 1] = p;
                }
                for (int i = 0; i < 8; i++)
                {
                    int k = faceInd[loadedFace][i];
                    for (int j = 0; j < 3; j++)
                    {
                        evec[3 * k + j] += an[i] * ps[j] * ds * gf.wi[ip];
                    }
                }
            }
            return(loadedFace);
        }
Beispiel #4
0
 // Element nodal equivalent of distributed face load
 // (evec[])
 public virtual int equivFaceLoad(ElemFaceLoad surLd)
 {
     return(-1);
 }