Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
principal_stress.f90
Go to the documentation of this file.
1 !*********************************************************************
2 !* Illinois Open Source License *
3 !* *
4 !* University of Illinois/NCSA *
5 !* Open Source License *
6 !* *
7 !* Copyright@2008, University of Illinois. All rights reserved. *
8 !* *
9 !* Developed by: *
10 !* *
11 !* Center for Simulation of Advanced Rockets *
12 !* *
13 !* University of Illinois *
14 !* *
15 !* www.csar.uiuc.edu *
16 !* *
17 !* Permission is hereby granted, free of charge, to any person *
18 !* obtaining a copy of this software and associated documentation *
19 !* files (the "Software"), to deal with the Software without *
20 !* restriction, including without limitation the rights to use, *
21 !* copy, modify, merge, publish, distribute, sublicense, and/or *
22 !* sell copies of the Software, and to permit persons to whom the *
23 !* Software is furnished to do so, subject to the following *
24 !* conditions: *
25 !* *
26 !* *
27 !* @ Redistributions of source code must retain the above copyright *
28 !* notice, this list of conditions and the following disclaimers. *
29 !* *
30 !* @ Redistributions in binary form must reproduce the above *
31 !* copyright notice, this list of conditions and the following *
32 !* disclaimers in the documentation and/or other materials *
33 !* provided with the distribution. *
34 !* *
35 !* @ Neither the names of the Center for Simulation of Advanced *
36 !* Rockets, the University of Illinois, nor the names of its *
37 !* contributors may be used to endorse or promote products derived *
38 !* from this Software without specific prior written permission. *
39 !* *
40 !* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
41 !* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
42 !* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
43 !* NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
44 !* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
45 !* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
46 !* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
47 !* USE OR OTHER DEALINGS WITH THE SOFTWARE. *
48 !*********************************************************************
49 !* Please acknowledge The University of Illinois Center for *
50 !* Simulation of Advanced Rockets in works and publications *
51 !* resulting from this software or its derivatives. *
52 !*********************************************************************
53 SUBROUTINE principal_stress(s11,s22,s33,&
54  s12,s23,s13, &
55  istrgss,numelvol,svonmises)
56 
57 !!****f* Rocfrac/Rocfrac/Source/principal_stress.f90
58 !!
59 !! NAME
60 !! principal_stress
61 !!
62 !! FUNCTION
63 !!
64 !! Computes Principal Values of Symmetric Second Rank Tensor
65 !!
66 !! INPUTS
67 !!
68 !! S = Symmetric Second-Rank Tensor Stored as a Vector
69 !! P = Principal Values
70 !!
71 !! .. The Components of S Must be Stored in the Following Orders
72 !!
73 !! 2-D Problems, S11,S12,S22
74 !! 3-D Problems, S11,S12,S13,S22,S23,S33
75 !!
76 !! OUTPUTS
77 !! SVonMises -- VonMises Stress
78 !!
79 !!****
80 
81 
82 
83  IMPLICIT NONE
84 
85  INTEGER :: numelvol
86  INTEGER :: i,j, istrgss
87  REAL*8, DIMENSION(1:NumElVol) :: svonmises
88  REAL*8, DIMENSION(1:6) :: s
89  REAL*8, DIMENSION(1:istrgss,1:NumElVol) :: s11, s22, s33, s12, s23, s13
90 
91  REAL*8 :: prin1, prin2, prin3
92 
93  REAL*8 :: r,x,y,z,t,u,a
94 
95  REAL*8 :: rt2 = 1.414213562373090
96  REAL*8 :: pi23 = 2.094395102393210
97 
98  DO j = 1, numelvol
99 
100  prin1 = 0.0
101  prin2 = 0.0
102  prin3 = 0.0
103 
104  DO i = 1, istrgss
105 
106  s(1) = s11(i,j)
107  s(2) = s12(i,j)
108  s(3) = s13(i,j)
109  s(4) = s22(i,j)
110  s(5) = s23(i,j)
111  s(6) = s33(i,j)
112 
113 !.... 3-D Problem
114 
115  r = 0.0
116  x = (s(1)+s(4)+s(6))/3.0
117  y = s(1)*(s(4)+s(6))+s(4)*s(6)-s(2)*s(2)-s(3)*s(3)-s(5)*s(5)
118  z = s(1)*s(4)*s(6)+2.0*s(2)*s(3)*s(5)-s(1)*s(5)*s(5) &
119  -s(4)*s(3)*s(3)-s(6)*s(2)*s(2)
120  t = 3.0*x*x-y
121  u = 0.0
122  IF(t.lt.1.0e-7.AND.t.gt.-1.0e-7) goto 20
123  u = sqrt(2.0*t/3.0)
124  a = (z + (t-x*x)*x)*rt2/u**3
125  r = sqrt(abs(1.d0 - a*a))
126  r = datan2(r,a)/3.d0
127 
128 20 continue
129  prin1 = prin1 + x + u*rt2*cos(r)
130  prin2 = prin2 + x + u*rt2*cos(r - pi23)
131  prin3 = prin3 + x + u*rt2*cos(r + pi23)
132 
133  ENDDO
134 
135  ! average the guass points for the 10 node tetrahedra
136 
137  prin1 = prin1/float(istrgss)
138  prin2 = prin2/float(istrgss)
139  prin3 = prin3/float(istrgss)
140 
141 ! Von Mises' equivalent stress
142 
143  svonmises(j) = sqrt((prin1-prin2)**2 + (prin2-prin3)**2 + (prin3-prin1)**2)/sqrt(2.d0)
144 
145  ENDDO
146 
147 
148  RETURN
149 END SUBROUTINE principal_stress
150 
unsigned char r() const
Definition: Color.h:68
void int int REAL REAL * y
Definition: read.cpp:74
double s
Definition: blastest.C:80
double sqrt(double d)
Definition: double.h:73
void int int int REAL REAL REAL * z
Definition: write.cpp:76
blockLoc i
Definition: read.cpp:79
void int int REAL * x
Definition: read.cpp:74
subroutine principal_stress(s11, s22, s33, s12, s23, s13, istrgss, NumElVol, SVonMises)
j indices j
Definition: Indexing.h:6
NT & cos
RT a() const
Definition: Line_2.h:140