public double DiffAlphaBending(int t, BarElement NextBar) { // when t 0:2 only thisBar derrivatives work // when t 6:8 only nextBar derrivatives work // when t 3:5 both thisBar and nextBar derrivatives work double cosa = B.Dot(NextBar.B) / (L * NextBar.L); double sina = Sqrt(1 - Pow(cosa, 2)); if (sina != 0) { return((-1 / sina) * ((DiffUnitB(0, t) * NextBar.B[0] + DiffUnitB(1, t) * NextBar.B[1] + DiffUnitB(2, t) * NextBar.B[2]) / NextBar.L + (NextBar.DiffUnitB(0, t - 3) * B[0] + NextBar.DiffUnitB(1, t - 3) * B[1] + NextBar.DiffUnitB(2, t - 3) * B[2]) / L)); } return(0); }
public double Diff2AlphaBending(int i, int j, BarElement NextBar) { double cosa = B.Dot(NextBar.B) / (L * NextBar.L); double sina = Sqrt(1 - Pow(cosa, 2)); double Part1 = (-1 / sina); double dPart1 = DiffAlphaBending(i, NextBar) * cosa / Pow(sina, 2); double Part2 = (DiffUnitB(0, j) * NextBar.B[0] + DiffUnitB(1, j) * NextBar.B[1] + DiffUnitB(2, j) * NextBar.B[2]) / NextBar.L + (NextBar.DiffUnitB(0, j - 3) * B[0] + NextBar.DiffUnitB(1, j - 3) * B[1] + NextBar.DiffUnitB(2, j - 3) * B[2]) / L; double dPart2 = (Diff2UnitB(0, i, j) * NextBar.B[0] + Diff2UnitB(1, i, j) * NextBar.B[1] + Diff2UnitB(2, i, j) * NextBar.B[2]) / NextBar.L + (NextBar.Diff2UnitB(0, i - 3, j - 3) * B[0] + NextBar.Diff2UnitB(1, i - 3, j - 3) * B[1] + NextBar.Diff2UnitB(2, i - 3, j - 3) * B[2]) / L + DiffUnitB(0, i) * NextBar.DiffUnitB(0, j - 3) + DiffUnitB(1, i) * NextBar.DiffUnitB(1, j - 3) + DiffUnitB(2, i) * NextBar.DiffUnitB(2, j - 3) + NextBar.DiffUnitB(0, i - 3) * DiffUnitB(0, j) + NextBar.DiffUnitB(1, i - 3) * DiffUnitB(1, j) + NextBar.DiffUnitB(2, i - 3) * DiffUnitB(2, j); // correct return(Part1 * dPart2 + Part2 * dPart1); }