ISAAR.MSolve.XFEM/Elements/XContinuumElement2D.cs
/// <summary>
/// The displacement field derivatives are a 2x2 matrix: gradientU[i,j] = dui/dj where i is the vector component 
/// and j is the coordinate, w.r.t which the differentiation is done. The differentation coordinates and the
/// vector components refer to the global cartesian system. 
/// </summary>
/// <param name="evaluatedInterpolation"></param>
/// <param name="nodalDisplacementsX"></param>
/// <param name="nodalDisplacementsY"></param>
/// <returns></returns>
The displacement field derivatives are a 2x2 matrix: gradientU[i,j] = dui/dj where i is the vector component
and j is the coordinate, w.r.t which the differentiation is done. The differentation coordinates and the
vector components refer to the global cartesian system.
The displacement field derivatives are a 2x2 matrix : gradientU [ i j ] = dui / dj where i is the vector component and j is the coordinate w . r . t which the differentiation is done . The differentation coordinates and the vector components refer to the global cartesian system .
public Matrix2by2 CalculateDisplacementFieldGradient(NaturalPoint gaussPoint,
            EvalInterpolation2D evaluatedInterpolation, Vector standardNodalDisplacements,
            Vector enrichedNodalDisplacements) 
        {
            var displacementGradient = Matrix2by2.CreateZero();
            for (int nodeIdx = 0; nodeIdx < Nodes.Count; ++nodeIdx)
            {
                double displacementX = standardNodalDisplacements[2 * nodeIdx];
                double displacementY = standardNodalDisplacements[2 * nodeIdx + 1];
                double dNdx = evaluatedInterpolation.ShapeGradientsCartesian[nodeIdx, 0];
                double dNdy = evaluatedInterpolation.ShapeGradientsCartesian[nodeIdx, 1];
                displacementGradient[0, 0] += dNdx * displacementX;
                displacementGradient[0, 1] += dNdy * displacementX;
                displacementGradient[1, 0] += dNdx * displacementY;
                displacementGradient[1, 1] += dNdy * displacementY;
            }
            IReadOnlyDictionary<IEnrichmentItem2D, EvaluatedFunction2D[]> evalEnrichments =
                EvaluateEnrichments(gaussPoint, evaluatedInterpolation);
            int dof = 0;
            for (int nodeIdx = 0; nodeIdx < Nodes.Count; ++nodeIdx)
            {
                double N = evaluatedInterpolation.ShapeFunctions[nodeIdx];
                double dNdx = evaluatedInterpolation.ShapeGradientsCartesian[nodeIdx, 0];
                double dNdy = evaluatedInterpolation.ShapeGradientsCartesian[nodeIdx, 1];
                foreach (var nodalEnrichment in Nodes[nodeIdx].EnrichmentItems)
                {
                    EvaluatedFunction2D[] currentEvalEnrichments = evalEnrichments[nodalEnrichment.Key];
                    for (int e = 0; e < currentEvalEnrichments.Length; ++e)
                    {
                        double psi = currentEvalEnrichments[e].Value;
                        Vector2 gradPsi = currentEvalEnrichments[e].CartesianDerivatives;
                        double deltaPsi = psi - nodalEnrichment.Value[e];
                        double Bx = dNdx * deltaPsi + N * gradPsi[0];
                        double By = dNdy * deltaPsi + N * gradPsi[1];
                        double enrDisplacementX = enrichedNodalDisplacements[dof++];
                        double enrDisplacementY = enrichedNodalDisplacements[dof++];
                        displacementGradient[0, 0] += Bx * enrDisplacementX;
                        displacementGradient[0, 1] += By * enrDisplacementX;
                        displacementGradient[1, 0] += Bx * enrDisplacementY;
                        displacementGradient[1, 1] += By * enrDisplacementY;
                    }
                }
            }
            return displacementGradient;
        }
public Matrix2by2 CalculateDisplacementFieldGradient ( NaturalPoint gaussPoint , EvalInterpolation2D evaluatedInterpolation , Vector standardNodalDisplacements , Vector enrichedNodalDisplacements ) { var displacementGradient = Matrix2by2 . CreateZero ( ) ; for ( int nodeIdx = 0 ; nodeIdx < Nodes . Count ; ++ nodeIdx ) { double displacementX = standardNodalDisplacements [ 2 * nodeIdx ] ; double displacementY = standardNodalDisplacements [ 2 * nodeIdx + 1 ] ; double dNdx = evaluatedInterpolation . ShapeGradientsCartesian [ nodeIdx , 0 ] ; double dNdy = evaluatedInterpolation . ShapeGradientsCartesian [ nodeIdx , 1 ] ; displacementGradient [ 0 , 0 ] += dNdx * displacementX ; displacementGradient [ 0 , 1 ] += dNdy * displacementX ; displacementGradient [ 1 , 0 ] += dNdx * displacementY ; displacementGradient [ 1 , 1 ] += dNdy * displacementY ; } IReadOnlyDictionary < IEnrichmentItem2D , EvaluatedFunction2D [ ] > evalEnrichments = EvaluateEnrichments ( gaussPoint , evaluatedInterpolation ) ; int dof = 0 ; for ( int nodeIdx = 0 ; nodeIdx < Nodes . Count ; ++ nodeIdx ) { double N = evaluatedInterpolation . ShapeFunctions [ nodeIdx ] ; double dNdx = evaluatedInterpolation . ShapeGradientsCartesian [ nodeIdx , 0 ] ; double dNdy = evaluatedInterpolation . ShapeGradientsCartesian [ nodeIdx , 1 ] ; foreach ( var nodalEnrichment in Nodes [ nodeIdx ] . EnrichmentItems ) { EvaluatedFunction2D [ ] currentEvalEnrichments = evalEnrichments [ nodalEnrichment . Key ] ; for ( int e = 0 ; e < currentEvalEnrichments . Length ; ++ e ) { double psi = currentEvalEnrichments [ e ] . Value ; Vector2 gradPsi = currentEvalEnrichments [ e ] . CartesianDerivatives ; double deltaPsi = psi - nodalEnrichment . Value [ e ] ; double Bx = dNdx * deltaPsi + N * gradPsi [ 0 ] ; double By = dNdy * deltaPsi + N * gradPsi [ 1 ] ; double enrDisplacementX = enrichedNodalDisplacements [ dof ++ ] ; double enrDisplacementY = enrichedNodalDisplacements [ dof ++ ] ; displacementGradient [ 0 , 0 ] += Bx * enrDisplacementX ; displacementGradient [ 0 , 1 ] += By * enrDisplacementX ; displacementGradient [ 1 , 0 ] += Bx * enrDisplacementY ; displacementGradient [ 1 , 1 ] += By * enrDisplacementY ; } } } return displacementGradient ; }
The displacement field derivatives are a 2x2 matrix: gradientU[i,j] = dui/dj where i is the vector component
and j is the coordinate, w.r.t which the differentiation is done.
The displacement field derivatives are a 2x2 matrix : gradientU [ i j ] = dui / dj where i is the vector component and j is the coordinate w . r . t which the differentiation is done .
//TODO: this must only allow evaluations at Gauss points. It doesn't work for points on the crack interface // Standard contributions // Enriched contributions. TODO: Extract the common steps with building B into a separate method 
None
gaussPoint
NaturalPoint
evaluatedInterpolation
EvalInterpolation2D
None
standardNodalDisplacements
Vector
enrichedNodalDisplacements
Vector
nodalDisplacementsX
None
nodalDisplacementsY
None