private static void CalculateNeumannLoad2D(Element element, NeumannBoundaryCondition neumann, Dictionary <int, double> neumannLoad, Nurbs2D nurbs, int j, double jacdet, IList <GaussLegendrePoint3D> gaussPoints, double xGaussPoint, double yGaussPoint, double zGaussPoint, Vector surfaceBasisVector3) { var elementControlPoints = element.ControlPoints.ToArray(); for (int k = 0; k < elementControlPoints.Length; k++) { int dofIDX = element.Model.GlobalDofOrdering.GlobalFreeDofs[elementControlPoints[k], StructuralDof.TranslationX]; int dofIDY = element.Model.GlobalDofOrdering.GlobalFreeDofs[elementControlPoints[k], StructuralDof.TranslationY]; int dofIDZ = element.Model.GlobalDofOrdering.GlobalFreeDofs[elementControlPoints[k], StructuralDof.TranslationZ]; if (neumannLoad.ContainsKey(dofIDX)) { neumannLoad[dofIDX] += nurbs.NurbsValues[k, j] * jacdet * gaussPoints[j].WeightFactor * neumann.Value(xGaussPoint, yGaussPoint, zGaussPoint)[0] * surfaceBasisVector3[0]; } else { neumannLoad.Add( dofIDX, nurbs.NurbsValues[k, j] * jacdet * gaussPoints[j].WeightFactor * neumann.Value(xGaussPoint, yGaussPoint, zGaussPoint)[0] * surfaceBasisVector3[0]); } if (neumannLoad.ContainsKey(dofIDY)) { neumannLoad[dofIDY] += nurbs.NurbsValues[k, j] * jacdet * gaussPoints[j].WeightFactor * neumann.Value(xGaussPoint, yGaussPoint, zGaussPoint)[1] * surfaceBasisVector3[1]; } else { neumannLoad.Add( dofIDY, nurbs.NurbsValues[k, j] * jacdet * gaussPoints[j].WeightFactor * neumann.Value(xGaussPoint, yGaussPoint, zGaussPoint)[1] * surfaceBasisVector3[1]); } if (neumannLoad.ContainsKey(dofIDZ)) { neumannLoad[dofIDZ] += nurbs.NurbsValues[k, j] * jacdet * gaussPoints[j].WeightFactor * neumann.Value(xGaussPoint, yGaussPoint, zGaussPoint)[2] * surfaceBasisVector3[2]; } else { neumannLoad.Add(dofIDZ, nurbs.NurbsValues[k, j] * jacdet * gaussPoints[j].WeightFactor * neumann.Value(xGaussPoint, yGaussPoint, zGaussPoint)[2] * surfaceBasisVector3[2]); } } }
private static void CalculatePressure1D( Element element, Edge edge, NeumannBoundaryCondition neumann, IList <ControlPoint> controlPoints, IList <GaussLegendrePoint3D> gaussPoints, IDictionary <int, double> neumannLoad) { var nurbs = new Nurbs1D(element, controlPoints, edge); for (int j = 0; j < gaussPoints.Count; j++) { double xGaussPoint = 0; double yGaussPoint = 0; double zGaussPoint = 0; double jacobian1 = 0.0; double jacobian2 = 0.0; var elementControlPoints = element.ControlPointsDictionary.Values.ToArray(); for (int k = 0; k < elementControlPoints.Length; k++) { xGaussPoint += nurbs.NurbsValues[k, j] * elementControlPoints[k].X; yGaussPoint += nurbs.NurbsValues[k, j] * elementControlPoints[k].Y; zGaussPoint += nurbs.NurbsValues[k, j] * elementControlPoints[k].Z; jacobian1 += nurbs.NurbsDerivativeValuesKsi[k, j] * elementControlPoints[k].X; jacobian2 += nurbs.NurbsDerivativeValuesKsi[k, j] * elementControlPoints[k].Y; } double jacdet = Math.Sqrt(Math.Pow(jacobian1, 2) + Math.Pow(jacobian2, 2)); var loadGaussPoint = neumann.Value(xGaussPoint, yGaussPoint, zGaussPoint); for (int k = 0; k < element.ControlPointsDictionary.Count; k++) { if (element.Model.GlobalDofOrdering.GlobalFreeDofs.Contains(elementControlPoints[k], StructuralDof.TranslationX)) { int dofIDX = element.Model.GlobalDofOrdering.GlobalFreeDofs[elementControlPoints[k], StructuralDof.TranslationX]; if (neumannLoad.ContainsKey(dofIDX)) { neumannLoad[dofIDX] += jacdet * gaussPoints[j].WeightFactor * nurbs.NurbsValues[k, j] * loadGaussPoint[0]; } else { neumannLoad.Add( dofIDX, jacdet * gaussPoints[j].WeightFactor * nurbs.NurbsValues[k, j] * loadGaussPoint[0]); } } if (!element.Model.GlobalDofOrdering.GlobalFreeDofs.Contains( elementControlPoints[k], StructuralDof.TranslationY)) { continue; } var dofIDY = element.Model.GlobalDofOrdering.GlobalFreeDofs[ elementControlPoints[k], StructuralDof.TranslationY]; if (neumannLoad.ContainsKey(dofIDY)) { neumannLoad[dofIDY] += jacdet * gaussPoints[j].WeightFactor * nurbs.NurbsValues[k, j] * loadGaussPoint[1]; } else { neumannLoad.Add(dofIDY, jacdet * gaussPoints[j].WeightFactor * nurbs.NurbsValues[k, j] * loadGaussPoint[1]); } } } }