private XSubdomain2D_old FindSubdomainWhereNodeEnrichmentIsNotSingular(XCluster2D cluster, XNode node, IEnrichmentItem2D enrichment) { foreach (XSubdomain2D_old subdomain in cluster.Subdomains) { if (subdomain.BoundaryNodes.Contains(node)) { bool isSingularityNode = subdomain.DofOrderer.SingularHeavisideEnrichments.TryGetValue(node, out HashSet <IEnrichmentItem2D> singularEnrichments); if (!isSingularityNode) { return(subdomain); } else if (!singularEnrichments.Contains(enrichment)) { return(subdomain); } } } // This point should not be reached under normal circumstances if (SingularHeavisideEnrichments.ContainsKey(node)) { throw new IncorrectDecompositionException( $"Heaviside dofs of {node} are singular in all subdomains. Investigate further"); } else { throw new ArgumentException( $"In this subdomain, {node} is not a boundary node with singular Heaviside enrichment"); } }
/// <summary> /// If a fixed enrichment area is applied, all nodes inside a circle around the tip are enriched with tip /// functions. They can still be enriched with Heaviside functions, if they do not belong to the tip /// element(s). /// </summary> /// <param name="tipNodes"></param> /// <param name="tipElement"></param> private void ApplyFixedEnrichmentArea(CartesianPoint crackTip, XContinuumElement2D tipElement, HashSet <XNode> tipNodes, IEnrichmentItem2D tipEnrichments) { if (enrichmentRadiusOverElementSize > 0) { var outline = ConvexPolygon2D.CreateUnsafe(tipElement.Nodes); double elementArea = outline.ComputeArea(); double radius = enrichmentRadiusOverElementSize * Math.Sqrt(elementArea); var enrichmentArea = new Circle2D(crackTip, radius); foreach (var element in Mesh.FindElementsInsideCircle(enrichmentArea, tipElement)) { bool completelyInside = true; foreach (var node in element.Nodes) { CirclePointPosition position = enrichmentArea.FindRelativePositionOfPoint(node); if ((position == CirclePointPosition.Inside) || (position == CirclePointPosition.On)) { tipNodes.Add(node); } else { completelyInside = false; } } if (completelyInside) { element.EnrichmentItems.Add(tipEnrichments); } } } }
public void AddEnrichment(IEnrichmentItem2D enrichment) { if (enrichments.Contains(enrichment)) { throw new ArgumentException("This enrichment is already inserted"); } enrichments.Add(enrichment); }