/// <summary> /// Rotates the specified tensor. /// </summary> /// <param name="tensor">The tensor.</param> /// <param name="angle">The angle, in radian.</param> /// <returns></returns> public static MembraneStressTensor Rotate(MembraneStressTensor tensor, double angle) { var rads = angle; //formulation based on this: http://www.creatis.insa-lyon.fr/~dsarrut/bib/Archive/others/phys/www.jwave.vt.edu/crcd/batra/lectures/esmmse5984/node38.html // TODO: MAT - set values directly var sigma = new Matrix(2, 2); sigma.SetRow(0, new double[] { tensor.Sx, tensor.Txy }); sigma.SetRow(1, new double[] { tensor.Txy, tensor.Sy }); var t = new Matrix(2, 2); t.SetRow(0, new double[] { Math.Cos(rads), Math.Sin(rads) }); t.SetRow(1, new double[] { -Math.Sin(rads), Math.Cos(rads) }); // TODO: MAT - the product could be directly computed in a helper method (CalcUtil). var rotated = t * sigma * t.Transpose(); var buf = new MembraneStressTensor() { Sx = rotated[0, 0], Sy = rotated[1, 1], Txy = rotated[0, 1] }; return(buf); }
/// <summary> /// Rotates the specified tensor. /// </summary> /// <param name="tensor">The tensor.</param> /// <param name="angle">The angle, in radian.</param> /// <returns></returns> public static MembraneStressTensor Rotate(MembraneStressTensor tensor, double angle) { var rads = angle; //formulation based on this: http://www.creatis.insa-lyon.fr/~dsarrut/bib/Archive/others/phys/www.jwave.vt.edu/crcd/batra/lectures/esmmse5984/node38.html var sigma = new Matrix(2, 2); sigma.SetRow(0, tensor.Sx, tensor.Txy); sigma.SetRow(1, tensor.Txy, tensor.Sy); var t = new Matrix(2, 2); t.SetRow(0, Math.Cos(rads), Math.Sin(rads)); t.SetRow(1, -Math.Sin(rads), Math.Cos(rads)); var rotated = t * sigma * t.Transpose(); var buf = new MembraneStressTensor() { Sx = rotated[0, 0], Sy = rotated[1, 1], Txy = rotated[0, 1] }; return(buf); }
public double Sx, Sy, Txy; //σx, σy, τxy public static MembraneStressTensor operator +(MembraneStressTensor left, MembraneStressTensor right) { var buf = new MembraneStressTensor(); buf.Sx = left.Sx + right.Sx; buf.Sy = left.Sy + right.Sy; buf.Txy = left.Txy + right.Txy; return(buf); }
public static MembraneStressTensor Transform(MembraneStressTensor tensor, Matrix transformationMatrix) { var tensorMatrix = ToMatrix(tensor); var rtd = transformationMatrix.Transpose() * tensorMatrix * transformationMatrix; var buf = FromMatrix(rtd); return(buf); }
public static MembraneStressTensor Transform(MembraneStressTensor tensor, Matrix transformationMatrix) { var tensorMatrix = ToMatrix(tensor); // TODO: MAT - the product could be directly computed in a helper method (CalcUtil). var rtd = transformationMatrix.Transpose() * tensorMatrix * transformationMatrix; var buf = FromMatrix(rtd); return(buf); }
public static MembraneStressTensor GetPrincipalStresses(MembraneStressTensor tens) { var c1 = (tens.Sx + tens.Sy) / 2; var c2 = Math.Sqrt(Math.Pow((tens.Sx - tens.Sy) / 2, 2) + Math.Pow(tens.Txy, 2)); var buf = new MembraneStressTensor(); buf.Sx = c1 + c2; buf.Sy = c1 - c2; return(buf); }
public static MembraneStressTensor Multiply(MembraneStressTensor t1, double coef) { var buf = new MembraneStressTensor(); buf.Sx = t1.Sx * coef; buf.Sy = t1.Sy * coef; buf.Sz = t1.Sz * coef; buf.Txy = t1.Txy * coef; buf.Tyz = t1.Tyz * coef; buf.Tzx = t1.Tzx * coef; return(buf); }
public static MembraneStressTensor operator -(MembraneStressTensor left, MembraneStressTensor right) { var buf = new MembraneStressTensor(); buf.Sx = left.Sx - right.Sx; buf.Sy = left.Sy - right.Sy; buf.Sz = left.Sz - right.Sz; buf.Txy = left.Txy - right.Txy; buf.Tyz = left.Tyz - right.Tyz; buf.Tzx = left.Tzx - right.Tzx; return(buf); }
public static MembraneStressTensor FromMatrix(Matrix mtx) { var buf = new MembraneStressTensor(); buf.Sx = mtx[0, 0]; buf.Sy = mtx[1, 1]; buf.Sz = mtx[2, 2]; buf.Txy = mtx[0, 1]; buf.Tyz = mtx[1, 2]; buf.Tzx = mtx[2, 0]; return(buf); }
public static Matrix ToMatrix(MembraneStressTensor tensor) { var tens = new Matrix(3, 3); tens[0, 0] = tensor.Sx; tens[1, 1] = tensor.Sy; tens[2, 2] = tensor.Sz; tens[0, 1] = tens[1, 0] = tensor.Txy; tens[0, 2] = tens[2, 0] = tensor.Tzx; tens[1, 2] = tens[2, 1] = tensor.Tyz; return(tens); }