Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HomogenizedMat.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 
54 subroutine homogenizedmat(Density, Em, PRm, Ep, PRp, cm, cd_fastest )
55 
56  IMPLICIT NONE
57 
58 
59  INTEGER :: myid
60  REAL*8 :: density
61  REAL*8 :: em, gm, prm, ep,prp, gp
62  REAL*8 :: cm, c2
63 
64  REAL*8 :: cd_fastest
65 
66  REAL*8 :: e_homog
67  REAL*8 :: pr_homog
68 
69  INTEGER, parameter :: numatv = 2
70 
71  REAL*8, DIMENSION(1:6,1:6,1:numatv) :: l_tensor, m_tensor
72 
73 
74  REAL*8, DIMENSION(1:6,1:6) :: l_bar, m_bar, lo
75 
76  REAL*8, parameter :: alpha1=1.0, alpha2= 0.0
77 
78 !-----Create material constant matrices
79 
80 
81  l_tensor = 0.d0
82  m_tensor = 0.d0
83  c2 = 1.d0 - cm
84  gm = em/(2.d0*(1.d0+prm))
85  gp = ep/(2.d0*(1.d0+prp))
86 
87  m_tensor(1,1,1) = 1.d0 / em
88  m_tensor(1,2,1) = - prm / em
89  m_tensor(1,3,1) = - prm / em
90  m_tensor(2,1,1) = m_tensor(1,2,1)
91  m_tensor(2,2,1) = 1.d0 / em
92  m_tensor(2,3,1) = - prm / em
93  m_tensor(3,1,1) = m_tensor(1,3,1)
94  m_tensor(3,2,1) = m_tensor(2,3,1)
95  m_tensor(3,3,1) = 1.d0 /em
96  m_tensor(4,4,1) = 1.d0/gm
97  m_tensor(5,5,1) = 1.d0/gm
98  m_tensor(6,6,1) = 1.d0/gm
99 
100  m_tensor(1,1,2) = 1.d0 / ep
101  m_tensor(1,2,2) = - prp / ep
102  m_tensor(1,3,2) = - prp / ep
103  m_tensor(2,1,2) = m_tensor(1,2,2)
104  m_tensor(2,2,2) = 1.d0 / ep
105  m_tensor(2,3,2) = - prp / ep
106  m_tensor(3,1,2) = m_tensor(1,3,2)
107  m_tensor(3,2,2) = m_tensor(2,3,2)
108  m_tensor(3,3,2) = 1.d0 /ep
109  m_tensor(4,4,2) = 1.d0/gp
110  m_tensor(5,5,2) = 1.d0/gp
111  m_tensor(6,6,2) = 1.d0/gp
112 
113  CALL invert2(m_tensor(:,:,1), l_tensor(:,:,1), 6)
114  CALL invert2(m_tensor(:,:,2), l_tensor(:,:,2), 6)
115 
116 
117  CALL compositestiffnes(l_tensor(1:6,1:6,1), l_tensor(1:6,1:6,2), m_tensor(1:6,1:6,1), m_tensor(1:6,1:6,2), cm, c2, &
118  alpha1, alpha2, l_bar, m_bar, lo)
119 
120 
121  e_homog = 1.d0/m_bar(1,1)
122  pr_homog = -m_bar(1,2)*1./m_bar(1,1) ! nu = -M(1,2)*E
123 
124 ! IF(myid.EQ.0)THEN
125  print*,'Homogenized Stiffness =', e_homog
126  print*,'Homogenized Poisson'//"'"//'s ratio',pr_homog
127 ! ENDIF
128 
129  cd_fastest = max( cd_fastest, &
130  sqrt(e_homog*(1.d0-pr_homog)/density/(1.d0+pr_homog)/(1.d0-2.d0*pr_homog )) )
131 
132  RETURN
133 END SUBROUTINE homogenizedmat
134 
135 SUBROUTINE compositestiffnes(Lm, L2, Mm, M2, cm, c2, alpha1, alpha2, L_bar, M_bar, Lo)
136 
137  IMPLICIT NONE
138 
139 
140  REAL*8 :: alpha1, alpha2, cm, c2
141 
142  REAL*8, DIMENSION(1:6,1:6) :: lm, l2, mm, m2
143  REAL*8, DIMENSION(1:6,1:6) :: l_bar, m_bar
144 
145  REAL*8, DIMENSION(1:6,1:6) :: dident = reshape( &
146  (/1.d0, 0.d0, 0.d0, 0.d0, 0.d0, 0.d0, &
147  0.d0, 1.d0, 0.d0, 0.d0, 0.d0, 0.d0, &
148  0.d0, 0.d0, 1.d0, 0.d0, 0.d0, 0.d0, &
149  0.d0, 0.d0, 0.d0, 1.d0, 0.d0, 0.d0, &
150  0.d0, 0.d0, 0.d0, 0.d0, 1.d0, 0.d0, &
151  0.d0, 0.d0, 0.d0, 0.d0, 0.d0, 1.d0 /),(/6,6/) )
152 
153  REAL*8, DIMENSION(1:6,1:6) :: lo, mo
154  REAL*8, DIMENSION(1:6,1:6) :: p
155  REAL*8, DIMENSION(1:6,1:6) :: s, sinv
156  REAL*8, DIMENSION(1:6,1:6) :: am, a2, a, b, c, lst, a3
157 
158  INTEGER :: i,j
159 
160 
161 
162 ! Comparison medium, Lo = (a1*L1 + a2*L2)
163 
164  lo = alpha1*lm + alpha2*l2
165 
166  CALL invert2(lo, mo, 6)
167 
168 
169 ! /* Type of inclusion */
170 
171 ! Returns Eshelby tensor S
172 
173  CALL eshelby(0, mo, lo, p, s)
174 
175 
176 ! -1
177 ! Returns S
178 
179  CALL invert2(s, sinv, 6)
180 
181 ! nas_AB (Lo,SI,A,6,6,6); nas_AB (A,B,Lst,6,6,6);
182 !
183 ! I - S
184 
185  b = dident - s
186 
187 ! Lo * ( I - S)
188 
189  a = matmul(lo,sinv)
190 !
191 ! Hill's constrant tensor
192 !
193 ! * -1
194 ! L = S * Lo * ( I - S)
195 
196  lst = matmul(a, b)
197 
198 !!$ PRINT*,'L*'
199 !!$
200 !!$ DO i = 1, 6
201 !!$ PRINT*,Lst(i,:)
202 !!$ ENDDO
203 
204 
205 ! /* Compute L(bar) */
206 
207  a = lst + lm
208  b = lst + l2
209 
210  CALL invert2(a,am,6)
211  CALL invert2(b,a2,6)
212  c = cm*am + c2*a2
213  CALL invert2(c,a,6)
214  l_bar = a - lst
215 
216  a = lst + l_bar
217 
218 ! compute Am
219 
220  a2 = lst + lm
221  CALL invert2(a2,c,6)
222  am = matmul(c,a)
223 
224 ! compute A2
225 
226  a2 = lst + l2
227  CALL invert2(a2,c,6)
228  a2 = matmul(c,a)
229 
230 ! Check concentration factors
231 
232  DO i = 1, 6
233  DO j = 1, 6
234  c(i,j) = cm*am(i,j) + c2*a2(i,j)
235  IF ( i .EQ. j .AND. (c(i,j) <= 0.9999 .OR. c(i,j) >= 1.0001))THEN
236  print*,'a) Incorrect Concentration tensors Am, A2'
237  stop
238  ENDIF
239  IF ( i.NE.j .AND.( c(i,j) >= 1.e-10 .OR. c(i,j) <= -1.e-10))THEN
240  print*,'b) Incorrect Concentration tensors Am, A2'
241  stop
242  ENDIF
243  ENDDO
244  ENDDO
245 
246  CALL invert2(l_bar, m_bar, 6)
247 
248 END SUBROUTINE compositestiffnes
249 
250 SUBROUTINE eshelby(Shape, Mo, Lo, P, S)
251 
252  INTEGER :: shape
253  REAL*8, DIMENSION(1:6,1:6) :: mo, lo
254  REAL*8, DIMENSION(1:6,1:6) :: p
255 
256  REAL*8, DIMENSION(1:6,1:6) :: s
257 
258 
259  REAL*8 :: e, g, nu, k, si, th
260 
261 
262  s = 0.d0
263  p = 0.d0
264 
265  ! Type of inclusion
266 
267  SELECT CASE (shape)
268 
269  CASE (0) ! /* Spherical inclusion in Isotropic medium */
270  e = 1.d0/mo(1,1)
271  g = 1.d0/mo(4,4)
272  nu = -mo(1,2)*e
273  k = e/(3.d0*(1.d0 - 2.d0*nu))
274  si = (1.d0 + nu)/(3.d0*(1.d0 - nu))
275  th = 2.d0*(4.d0 - 5.d0*nu)/(15.d0*(1.d0 - nu))
276 
277  p(1,1) = 1.d0/3.d0*(si/3.d0/k + th/g)
278  p(1,2) = 1.d0/3.d0*(si/3.d0/k - th/2.d0/g)
279  p(1,3) = 1.d0/3.d0*(si/3.d0/k - th/2.d0/g)
280  p(2,1) = 1.d0/3.d0*(si/3.d0/k - th/2.d0/g)
281  p(2,2) = 1.d0/3.d0*(si/3.d0/k + th/g)
282  p(2,3) = 1.d0/3.d0*(si/3.d0/k - th/2.d0/g)
283  p(3,1) = 1.d0/3.d0*(si/3.d0/k - th/2.d0/g)
284  p(3,2) = 1.d0/3.d0*(si/3.d0/k - th/2.d0/g)
285  p(3,3) = 1.d0/3.d0*(si/3.d0/k + th/g)
286  p(4,4) = th/g
287  p(5,5) = th/g
288  p(6,6) = th/g
289  s = matmul(lo,p)
290 
291  CASE default
292  print*, "Non existing shape of inclusion"
293  stop
294  END SELECT
295 
296 END SUBROUTINE eshelby
297 
298 SUBROUTINE invert2( Inv_in, a, nrow)
299 
300 ! *--------------------------------------------------------------------*
301 ! | |
302 ! | Inverts a matrix by gauss jordan elimination and computes the |
303 ! | the determinant. The matrix may be symmetric or nonsymmetric. |
304 ! | |
305 ! | <a> : a square, double precision matrix |
306 ! | <nrow> : dimensioned number of rows for 'a'. also the actual |
307 ! | sizes for inversion computations |
308 ! | <det> : determinant of the matrix ( zero if matrix is singular)|
309 ! | |
310 ! | NOTE : the matrix is overwritten by the inverse. |
311 ! | |
312 ! *--------------------------------------------------------------------*
313  IMPLICIT NONE
314 
315 ! Argument variables
316 
317  INTEGER nrow
318  REAL*8, DIMENSION(1:nrow,1:nrow) :: a, inv_in
319  REAL*8 :: det
320 
321 ! Local variables
322 
323  INTEGER ncol, k, j, i
324 
325  a = inv_in
326 
327 ! Invert matrix
328 
329  det = 1.d0
330  ncol = nrow
331 
332  DO k = 1, nrow
333 
334  IF( a(k,k) .EQ. 0.d0 ) THEN ! Check for singular matrix
335  det = 0.d0
336  print*,' Matrix is singular for inversion'
337  stop
338  END IF
339 
340  det = det * a(k, k)
341 
342  DO j = 1, ncol
343  IF( j .NE. k ) a(k,j) = a(k,j) / a(k,k)
344  END DO
345 
346  a(k,k) = 1.d0 / a(k,k)
347 
348  DO i = 1, nrow
349  IF( i .EQ. k) cycle
350  DO j = 1, ncol
351  IF( j .NE. k) a(i,j) = a(i,j) - a(i,k) * a(k,j)
352  END DO
353  a(i,k) = -a(i,k) * a(k,k)
354  END DO
355 
356  END DO
357 
358 
359  RETURN
360 END SUBROUTINE invert2
361 
const int ncol
Definition: ex1.C:95
j indices k indices k
Definition: Indexing.h:6
double s
Definition: blastest.C:80
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
unsigned char b() const
Definition: Color.h:70
double sqrt(double d)
Definition: double.h:73
RT c() const
Definition: Line_2.h:150
subroutine eshelby(Shape, Mo, Lo, P, S)
blockLoc i
Definition: read.cpp:79
subroutine compositestiffnes(Lm, L2, Mm, M2, cm, c2, alpha1, alpha2, L_bar, M_bar, Lo)
virtual std::ostream & print(std::ostream &os) const
subroutine invert2(Inv_in, a, nrow)
j indices j
Definition: Indexing.h:6
subroutine homogenizedmat(Density, Em, PRm, Ep, PRp, cm, cd_fastest)
const int nrow
Definition: ex1.C:95
RT a() const
Definition: Line_2.h:140
unsigned char g() const
Definition: Color.h:69