// Create data for distributed surface load
        // specified inside a box
        private void createBoxSurForces(FeScanner es)
        {
            int[][] faces;
            String  s   = es.next().ToLower();
            int     dir = UTIL.direction(s);

            if (dir == -1)
            {
                UTIL.errorMsg("boxSurForce direction should be x/y/z/n. Specified:" + s);
            }

            if (!es.hasNextDouble())
            {
                UTIL.errorMsg("boxSurForce value is not a double: " + es.next());
            }
            double force = es.nextDouble();

            for (int i = 0; i < 2; i++)
            {
                for (int j = 0; j < fem.nDim; j++)
                {
                    box[i][j] = es.readDouble();
                }
            }

            for (int iel = 0; iel < fem.nEl; iel++)
            {
                Element el = fem.elems[iel];
                faces = el.getElemFaces();
                //FACE:
                foreach (int[] face in faces)
                {
                    int nNodes = face.Length;
                    for (int inod = 0; inod < nNodes; inod++)
                    {
                        iw[inod] = 0;
                    }
                    for (int inod = 0; inod < nNodes; inod++)
                    {
                        int iGl = el.ind[face[inod]];
                        if (iGl > 0)
                        {
                            for (int j = 0; j < fem.nDim; j++)
                            {
                                double x = fem.getNodeCoord(iGl - 1, j);
                                if (x < box[0][j] || x > box[1][j])
                                {
                                    goto FACE;
                                }
                            }
                            iw[inod] = iGl;
                        }
                    }
                    surForces.Add(new ElemFaceLoad(iel, nNodes, dir, iw, force));
                    FACE : { }
                }
            }
        }
示例#2
0
        // Read data for specified constrained displacements
        private void readConstrDisplacements(FeScanner es)
        {
            String s   = es.next().ToLower();
            int    idf = UTIL.direction(s);

            if (idf == -1)
            {
                UTIL.errorMsg("constrDispl direction should be x/y/z. Specified:" + s);
            }
            if (!es.hasNextDouble())
            {
                UTIL.errorMsg("constrDispl value is not a double: " + es.next());
            }
            double vd = es.nextDouble();

            defDs = es.readNumberList(defDs, idf, nDim, vd);
        }
        // Read data for specified nodal forces
        private void readNodalForces(FeScanner es)
        {
            String s   = es.next().ToLower();
            int    idf = UTIL.direction(s);

            if (idf == -1)
            {
                UTIL.errorMsg("nodForce direction should be x/y/z. Specified:" + s);
            }

            if (!es.hasNextDouble())
            {
                UTIL.errorMsg("nodForce value is not a double: " + es.next());
            }
            double vd = es.nextDouble();

            nodForces = es.readNumberList(nodForces, idf, fem.nDim, vd);
        }
示例#4
0
        // Create data for constrained displacements
        // specified inside a box
        private void createBoxConstrDisplacements(FeScanner es)
        {
            String s   = es.next().ToLower();
            int    idf = UTIL.direction(s);

            if (idf == -1)
            {
                UTIL.errorMsg("boxConstrDispl direction should be x/y/z. Specified:" + s);
            }
            if (!es.hasNextDouble())
            {
                UTIL.errorMsg("boxConstrDispl value is not a double: " + es.next());
            }
            double vd = es.nextDouble();

            for (int i = 0; i < 2; i++)
            {
                for (int j = 0; j < nDim; j++)
                {
                    box[i][j] = es.readDouble();
                }
            }
            //NODE:
            for (int i = 0; i < nNod; i++)
            {
                for (int j = 0; j < nDim; j++)
                {
                    double x = getNodeCoord(i, j);
                    if (x < box[0][j] || x > box[1][j])
                    {
                        goto NODE;
                    }
                }
                defDs.Add(new Dof(nDim * i + idf, vd));
                NODE : { }
            }
        }