Exemplo n.º 1
0
        public void OrderSubdomainDofs(ISet <XSubdomain2D_old> enrichedSubdomains, ISet <XSubdomain2D_old> modifiedSubdomains,
                                       ICrackDescription crack)
        {
            int numTotalDofs = NumStandardDofs;

            foreach (var subdomain in enrichedSubdomains)
            {
                if (modifiedSubdomains.Contains(subdomain))
                {
                    subdomain.DofOrderer = XSubdomainDofOrderer.CreateNodeMajor(crack, subdomain);
                }
                subdomain.DofOrderer.FirstGlobalDofIndex = numTotalDofs;
                numTotalDofs += subdomain.DofOrderer.NumEnrichedDofs;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// </summary>
        /// <param name="element"></param>
        /// <param name="globalFreeVector">Both the free standard and enriched dofs.</param>
        /// <returns></returns>
        public Vector ExtractEnrichedDisplacementsOfElementFromGlobal(XCluster2D cluster, XContinuumElement2D element,
                                                                      Vector globalFreeVector)
        {
            // While Heaviside dofs on boundary nodes that would cause singular stiffness matrices are generally avoided,
            // the returned vector of this method must include them. Since H(x)-H(xNode)=0, it wouldn't be wrong to exclude
            // them in theory. However it would cause indexing problems if they are missing, since other XFEM classes (such as
            // XContinuumElement) have no concept of a node being enriched only for some elements.
            DofTable <EnrichedDof> elementDofs = element.GetEnrichedDofs();

            double[] elementVector = new double[elementDofs.EntryCount];
            foreach (XNode node in element.Nodes)
            {
                bool isSingularityNode = SingularHeavisideEnrichments.TryGetValue(node,
                                                                                  out HashSet <IEnrichmentItem2D> singularEnrichments);
                foreach (IEnrichmentItem2D enrichment in node.EnrichmentItems.Keys)
                {
                    XSubdomainDofOrderer correctOrderer = this;
                    if (isSingularityNode && singularEnrichments.Contains(enrichment))
                    {
                        // Find global dof index from other subdomain, sine it is not stored here
                        correctOrderer = FindSubdomainWhereNodeEnrichmentIsNotSingular(cluster, node, enrichment).DofOrderer;
                    }
                    foreach (var dofType in enrichment.Dofs)
                    {
                        int elementDofIdx = elementDofs[node, dofType];
                        int globalDofIdx  = correctOrderer.FirstGlobalDofIndex +
                                            correctOrderer.subdomainEnrichedDofs[node, dofType];
                        elementVector[elementDofIdx] = globalFreeVector[globalDofIdx];
                    }
                }
            }

            //foreach (Tuple<XNode2D, EnrichedDof, int> entry in elementDofs)
            //{
            //    int globalEnrichedDof = globalEnrichedDofs[entry.Item1, entry.Item2];
            //    elementVector[entry.Item3] = globalFreeVector[globalEnrichedDof];
            //}
            return(Vector.CreateFromArray(elementVector));
        }