Principal Stresses Program - help sought
11-26-2021, 11:42 PM (This post was last modified: 11-27-2021 01:35 PM by Gene.)
Post: #1
 trs32596 Junior Member Posts: 2 Joined: Mar 2021
Principal Stresses Program - help sought
Hi there,

Having trouble creating a program to solve the principal stress equation. This is done by finding the roots of the third order polynomial.

Here is an example of input data:
σx = 60MPa σy =-30MPa σz =-20MPa τxy =40MPa Tyz = 0, Tzx = 0.

Using the normal equation:
σ^3 −(σx +σy +σz )⋅σ^2 +(σxσy +σxσz +σyσz −τxy^2 −τyz^2 −τzx^2 )⋅σ −(σxσyσz +2*τxy*τyz*τzx −σx*τyz^2 −σy*τzx^2 −σz*τxy^2)=0
produces roots of -45.21, -20.0, and 75.21MPa.

My goal is to create a simple program to do this with the input data.

Code:
EXPORT PrincipalStressCoeffs(X,Y,Z,L,M,N)
BEGIN
LOCAL C1:= (X+Y+Z);
LOCAL C2:= (X*Y+X*Z+Y*Z-L^2-M^2-N^2);
LOCAL C3:= (X*Y*Z+2*L*M*N-X*M^2-Y*N^2-Z*L^2);
LOCAL r = CAS( proot([1, -C1, C2, -C3]) );
RETURN(r);
END;

This code ends up returning imaginary numbers and not the same roots. Any help would be much appreciated.
11-27-2021, 04:48 PM
Post: #2
 Edwin Junior Member Posts: 9 Joined: Dec 2013
RE: Principal Stresses Program - help sought
(11-26-2021 11:42 PM)trs32596 Wrote:  Hi there,

Having trouble creating a program to solve the principal stress equation. This is done by finding the roots of the third order polynomial.

Here is an example of input data:
σx = 60MPa σy =-30MPa σz =-20MPa τxy =40MPa Tyz = 0, Tzx = 0.

Using the normal equation:
σ^3 −(σx +σy +σz )⋅σ^2 +(σxσy +σxσz +σyσz −τxy^2 −τyz^2 −τzx^2 )⋅σ −(σxσyσz +2*τxy*τyz*τzx −σx*τyz^2 −σy*τzx^2 −σz*τxy^2)=0
produces roots of -45.21, -20.0, and 75.21MPa.

My goal is to create a simple program to do this with the input data.

Code:
EXPORT PrincipalStressCoeffs(X,Y,Z,L,M,N)
BEGIN
LOCAL C1:= (X+Y+Z);
LOCAL C2:= (X*Y+X*Z+Y*Z-L^2-M^2-N^2);
LOCAL C3:= (X*Y*Z+2*L*M*N-X*M^2-Y*N^2-Z*L^2);
LOCAL r = CAS( proot([1, -C1, C2, -C3]) );
RETURN(r);
END;

This code ends up returning imaginary numbers and not the same roots. Any help would be much appreciated.
You can simply calculate the eigenvalues
Code:
 EXPORT PrincipalStressCoeffs(σx,σy,σz,τxy,τyz,τzx) BEGIN     LOCAL StressTensor:=[[σx,τxy,τzx],[τxy,σy,τyz],[τzx,τyz,σz]];     RETURN(EIGENVAL(StressTensor)); END;

-Edwin-
11-27-2021, 07:13 PM
Post: #3
 trs32596 Junior Member Posts: 2 Joined: Mar 2021
RE: Principal Stresses Program - help sought
Thanks Edwin!

program works great and I completely forgot about doing eigenvalues.

Thanks again!
11-27-2021, 07:25 PM
Post: #4
 roadrunner Senior Member Posts: 396 Joined: Jun 2015
RE: Principal Stresses Program - help sought
To fix the OP's program, change this line:

LOCAL r = CAS( proot([1, -C1, C2, -C3]) );

to this:

LOCAL r = CAS("proot([1, -C1, C2, -C3])");

-road
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)