ISAAR.MSolve.XFEM/Elements/XContinuumElement2D.cs
/// <summary>
/// This only works for points that do not lie on the crack interface. As such it is safe to pass GPs only
/// </summary>
/// <param name="gaussPoint"></param>
/// <param name="evaluatedInterpolation"></param>
/// <param name="standardNodalDisplacements"></param>
/// <param name="enrichedNodalDisplacements"></param>
/// <returns></returns>
This only works for points that do not lie on the crack interface. As such it is safe to pass GPs only
This only works for points that do not lie on the crack interface . As such it is safe to pass GPs only
public Vector2 CalculateDisplacementField(NaturalPoint gaussPoint, EvalInterpolation2D evaluatedInterpolation,
            Vector standardNodalDisplacements, Vector enrichedNodalDisplacements)
        {
            #region debug
            double tol = 1e-6;
            if ((Math.Abs(gaussPoint.Xi) <= tol) || (Math.Abs(gaussPoint.Eta) <= tol))
            {
                Console.WriteLine("Found an intersection point that isn't a node.");
            }
            #endregion
            var displacements = new double[2];
            for (int nodeIdx = 0; nodeIdx < Nodes.Count; ++nodeIdx)
            {
                double shapeFunction = evaluatedInterpolation.ShapeFunctions[nodeIdx];
                displacements[0] += shapeFunction * standardNodalDisplacements[2 * nodeIdx];
                displacements[1] += shapeFunction * standardNodalDisplacements[2 * nodeIdx + 1];
            }
            IReadOnlyDictionary<IEnrichmentItem2D, EvaluatedFunction2D[]> evalEnrichments =
                EvaluateEnrichments(gaussPoint, evaluatedInterpolation);
            int dof = 0;
            for (int nodeIdx = 0; nodeIdx < Nodes.Count; ++nodeIdx)
            {
                double shapeFunction = evaluatedInterpolation.ShapeFunctions[nodeIdx];
                foreach (var nodalEnrichment in Nodes[nodeIdx].EnrichmentItems)
                {
                    EvaluatedFunction2D[] currentEvalEnrichments = evalEnrichments[nodalEnrichment.Key];
                    for (int e = 0; e < currentEvalEnrichments.Length; ++e)
                    {
                        double basisFunction = shapeFunction * (currentEvalEnrichments[e].Value - nodalEnrichment.Value[e]);
                        displacements[0] += basisFunction * enrichedNodalDisplacements[dof++];
                        displacements[1] += basisFunction * enrichedNodalDisplacements[dof++];
                    }
                }
            }
            return Vector2.CreateFromArray(displacements);
        }
public Vector2 CalculateDisplacementField ( NaturalPoint gaussPoint , EvalInterpolation2D evaluatedInterpolation , Vector standardNodalDisplacements , Vector enrichedNodalDisplacements ) { region  debug double tol = 1e-6 ; if ( ( Math . Abs ( gaussPoint . Xi ) <= tol ) || ( Math . Abs ( gaussPoint . Eta ) <= tol ) ) { Console . WriteLine ( " " ) ; } endregion var displacements = new double [ 2 ] ; for ( int nodeIdx = 0 ; nodeIdx < Nodes . Count ; ++ nodeIdx ) { double shapeFunction = evaluatedInterpolation . ShapeFunctions [ nodeIdx ] ; displacements [ 0 ] += shapeFunction * standardNodalDisplacements [ 2 * nodeIdx ] ; displacements [ 1 ] += shapeFunction * standardNodalDisplacements [ 2 * nodeIdx + 1 ] ; } IReadOnlyDictionary < IEnrichmentItem2D , EvaluatedFunction2D [ ] > evalEnrichments = EvaluateEnrichments ( gaussPoint , evaluatedInterpolation ) ; int dof = 0 ; for ( int nodeIdx = 0 ; nodeIdx < Nodes . Count ; ++ nodeIdx ) { double shapeFunction = evaluatedInterpolation . ShapeFunctions [ nodeIdx ] ; foreach ( var nodalEnrichment in Nodes [ nodeIdx ] . EnrichmentItems ) { EvaluatedFunction2D [ ] currentEvalEnrichments = evalEnrichments [ nodalEnrichment . Key ] ; for ( int e = 0 ; e < currentEvalEnrichments . Length ; ++ e ) { double basisFunction = shapeFunction * ( currentEvalEnrichments [ e ] . Value - nodalEnrichment . Value [ e ] ) ; displacements [ 0 ] += basisFunction * enrichedNodalDisplacements [ dof ++ ] ; displacements [ 1 ] += basisFunction * enrichedNodalDisplacements [ dof ++ ] ; } } } return Vector2 . CreateFromArray ( displacements ) ; }
This only works for points that do not lie on the crack interface.
This only works for points that do not lie on the crack interface .
// Standard contributions // Enriched contributions //TODO: this should be taken as input, so that it is only computed once if it is needed for displacements, strains,  //      stresses, just like the evaluated interpolation. //double basisFunction = shapeFunction * currentEvalEnrichments[e].Value; // for debugging
None
gaussPoint
NaturalPoint
None
evaluatedInterpolation
EvalInterpolation2D
None
standardNodalDisplacements
Vector
None
enrichedNodalDisplacements
Vector
None