Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
c3d6nm.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 c3d6nm( nsubn, nsubf, &
55  nsubn2, nsubf2, &
56  cooroverlay, elconnoverlay, &
57  sd_subface_parents, &
58  sd_subface_parents2, &
59  sd_subface_mate, &
60  sd_subface_nat_coors, &
61  sd_subface_nat_coors_mate, &
62  faceofvolel, &
63  faceofvolel2, &
64  numnp, numel, &
65  elconn, &
66  nf,nf2, &
67  mapfaceel2vol, &
68  mapfaceel2vol2, &
69  deltan, deltat, sigmax, taumax, sinit, &
70  rnet, disp, sthresh, nummatcoh,matid,signflag)
71 
72  IMPLICIT NONE
73 
74 !-----global variables
75  INTEGER :: nsubn ! number of Overlay nodes
76  INTEGER :: nsubf ! number of Overlay elements
77  INTEGER :: nsubn2, nsubf2
78  REAL*8 :: signflag ! -1 for top material, +1 for bottom material
79 
80  INTEGER :: nf,nf2
81 
82  REAL*8, DIMENSION(1:3,1:nsubn) :: cooroverlay ! Overlay Coordinates
83  INTEGER, DIMENSION(1:3,1:nsubf) :: elconnoverlay ! Overlay Connectivity
84  INTEGER, DIMENSION(1:nsubf) :: sd_subface_parents
85  INTEGER, DIMENSION(1:nsubf) :: sd_subface_mate
86  INTEGER, DIMENSION(1:nsubf2) :: sd_subface_parents2
87  REAL*4, DIMENSION(1:6,1:nsubf) :: sd_subface_nat_coors
88  REAL*4, DIMENSION(1:6,1:nsubf2) :: sd_subface_nat_coors_mate
89  INTEGER, DIMENSION(1:nf) :: mapfaceel2vol
90  INTEGER, DIMENSION(1:nf) :: faceofvolel
91  INTEGER, DIMENSION(1:nf2) :: mapfaceel2vol2
92  INTEGER, DIMENSION(1:nf2) :: faceofvolel2
93 
94  REAL*8, DIMENSION(1:3,1:nsubf) :: sthresh ! the threshold, then damage of face
95 
96  INTEGER :: numnp ! number of nodal points in the overlay mesh
97  INTEGER :: numel ! number of cohesive overlay elements
98  INTEGER :: nummatcoh ! number of cohesive materials
99  INTEGER, DIMENSION(1:4,1:NumEL) :: elconn ! connectivity tables for cohesive el
100 
101 
102  INTEGER, DIMENSION(1:NumEL) :: map2volnd
103 
104  REAL*8 :: rnet(3*numnp) ! Net force at each node(currently=Rcoh)
105  REAL*8 :: disp(3*numnp) ! nodal displacements
106  REAL*8 :: deltan(nummatcoh) ! normal characteristic length
107  REAL*8 :: deltat(nummatcoh) ! tangential characteristic length
108  REAL*8 :: sigmax(nummatcoh) ! maximum normal stress
109  REAL*8 :: taumax(nummatcoh) ! maximum normal stress
110  REAL*8 :: sinit(nummatcoh) ! initial Sthresh
111 !-----local variables
112  REAL*8 :: nn1,nn2,nn3 ! Numbers to input into NN
113  REAL*8 :: deltn, deltt ! the char length of current element
114  REAL*8 :: sig ! max normal stress of element
115  REAL*8 :: tau ! max shearing stress of element
116  INTEGER :: matid ! material number of current element
117  INTEGER :: n1,n2,n3,n4,n5,n6 ! twice the node numbers of element
118  INTEGER :: i,j,k ! loop counters
119  REAL*8 :: x ! dummy variables
120  REAL*8 :: g(3),weight(3) ! integration point locations and weights
121  REAL*8, DIMENSION(1:3,1:18) :: nn ! Shape function matrix
122  REAL*8 :: dloc(18) ! local displacements (u1x u1y u2x u2y ...)
123  REAL*8 :: delta1(2) ! normal and tangential displacement at gauss point
124  REAL*8 :: tn,tt ! normal and tangential tractions
125  REAL*8 :: t(3) ! contains Tx Ty Tz
126  REAL*8, DIMENSION(1:18) :: rcohloc ! local cohesive reaction
127  REAL*8 :: v12(3),v13(3) ! vectors from nodes 1 to 2 and 1 to 3
128  REAL*8 :: normal(3) ! normal vector to element-v12 cross v13
129  REAL*8 :: tangential(3) ! tangential vector
130  REAL*8 :: magnitude ! magnitude of a vector
131  REAL*8 :: delta(3) ! dx dy dz
132  REAL*8 :: aa(18) ! dummy variable
133  REAL*8 :: area, norm
134  INTEGER :: face1, face2
135  INTEGER :: faceel
136 
137  INTEGER :: nd1_overlay,nd2_overlay,nd3_overlay
138  INTEGER :: volel
139  INTEGER :: side
140  INTEGER :: ii,faceel_counterparts
141 
142 
143  weight(1)=0.33333333333333d0 !
144  weight(2)=0.33333333333333d0 ! Weights of each gauss point
145  weight(3)=0.33333333333333d0 !
146 
147 !-----The cohesive law
148 
149 
150  DO i = 1, nsubf ! Loop over all the cohesive elements
151 
152 
153  deltn = 1.d0/deltan(matid) ! deltn and deltt are the same as
154  deltt = 1.d0/deltat(matid) ! 1/dnc and 1/dtc
155 
156  sig = sigmax(matid) ! maximum sigma and tau before failure
157  tau = taumax(matid)
158 
159  nd1_overlay = elconnoverlay(1,i)
160  nd2_overlay = elconnoverlay(2,i)
161  nd3_overlay = elconnoverlay(3,i)
162 
163 
164 ! Build vectors from nodes 1 to 2 and 1 to 3
165 
166  DO j=1,3
167  v12(j) = cooroverlay(j,nd2_overlay)-cooroverlay(j,nd1_overlay)
168  v13(j) = cooroverlay(j,nd3_overlay)-cooroverlay(j,nd1_overlay)
169  END DO
170 
171  magnitude = sqrt((v12(2)*v13(3)-v12(3)*v13(2))**2+ &
172  &(v12(1)*v13(3)-v12(3)*v13(1))**2+ &
173  &(v12(1)*v13(2)-v12(2)*v13(1))**2)
174 
175 ! Find vector normal to element
176 
177 
178  normal(1) = (v12(2)*v13(3)-v12(3)*v13(2))
179  normal(2) = -(v12(1)*v13(3)-v12(3)*v13(1))
180  normal(3) = (v12(1)*v13(2)-v12(2)*v13(1))
181 
182 
183 ! Use the fact that the norm of the cross product vector
184 ! is the area of the parallelogram they form. The triangle they
185 ! form has half that area.
186 !
187 ! Reference:
188 !
189 ! Adrian Bowyer and John Woodwark,
190 ! A Programmer's Geometry,
191 ! Butterworths, 1983.
192 
193  norm = sqrt( normal(1)*normal(1) + normal(2)*normal(2) + normal(3)*normal(3) )
194 
195  area = 0.5d0 * norm
196 
197  normal(1) = normal(1)/magnitude
198  normal(2) = normal(2)/magnitude
199  normal(3) = normal(3)/magnitude
200 
201 
202  faceel = sd_subface_parents(i)
203 
204  volel = mapfaceel2vol(faceel)
205 
206  side = faceofvolel(faceel)
207 
208  IF(side.EQ.1)THEN
209  n1 = 1; n2 = 2; n3 = 3
210  ELSE IF(side.eq.2)THEN
211  n1 = 1; n2 = 2; n3 = 4
212  ELSE IF(side.eq.3)THEN
213  n1 = 2; n2 = 3; n3 = 4
214  ELSE IF(side.eq.4)THEN
215  n1 = 4; n2 = 3; n3 = 1
216  ENDIF
217 
218  n1 = elconn(n1,volel) ! n1 = node number 1 = n1m
219  n2 = elconn(n2,volel) ! n2 = node number 2 = n2m
220  n3 = elconn(n3,volel) ! n3 = node number 3 = n3m
221 
222 
223  faceel_counterparts = sd_subface_parents2(sd_subface_mate(i))
224 
225  volel = mapfaceel2vol2(faceel_counterparts)
226 
227  side = faceofvolel2(faceel_counterparts)
228 
229 
230  IF(side.EQ.1)THEN
231  n4 = 1; n5 = 2; n6 = 3
232  ELSE IF(side.eq.2)THEN
233  n4 = 1; n5 = 2; n6 = 4
234  ELSE IF(side.eq.3)THEN
235  n4 = 2; n5 = 3; n6 = 4
236  ELSE IF(side.eq.4)THEN
237  n4 = 4; n5 = 3; n6 = 1
238  ENDIF
239 
240 
241  n4 = elconn(n4,volel) ! n4 = node number 4 = n1p
242  n5 = elconn(n5,volel) ! n5 = node number 4 = n2p
243  n6 = elconn(n6,volel) ! n6 = node number 4 = n3p
244 
245  dloc(1) = disp(n1*3-2) !
246  dloc(2) = disp(n1*3-1) !
247  dloc(3) = disp(n1*3) !
248  dloc(4) = disp(n2*3-2) !
249  dloc(5) = disp(n2*3-1) !
250  dloc(6) = disp(n2*3) !
251  dloc(7) = disp(n3*3-2) !
252  dloc(8) = disp(n3*3-1) ! Get a local displacement vector from
253  dloc(9) = disp(n3*3) ! the global displacement vector
254  dloc(10) = disp(n4*3-2) !
255  dloc(11) = disp(n4*3-1) !
256  dloc(12) = disp(n4*3) !
257  dloc(13) = disp(n5*3-2) !
258  dloc(14) = disp(n5*3-1) !
259  dloc(15) = disp(n5*3) !
260  dloc(16) = disp(n6*3-2) !
261  dloc(17) = disp(n6*3-1) !
262  dloc(18) = disp(n6*3) !
263 
264 
265 ! loop over the 3 gauss points
266 
267  rcohloc(1:18) = 0.d0
268 
269  ii = 1
270  DO k= 1,3
271 
272 
273 ! Define shape function values
274  nn1 = 1.d0 - dble(sd_subface_nat_coors(ii,i))-dble(sd_subface_nat_coors(ii+1,i)) !
275  nn2 = dble(sd_subface_nat_coors(ii,i)) !
276  nn3 = dble(sd_subface_nat_coors(ii+1,i))
277 
278 ! Build NN
279 
280  nn(1:3,1:9) = 0.d0
281 
282  nn(1,1) = -nn1 !
283  nn(2,2) = -nn1 !
284  nn(3,3) = -nn1 !
285  nn(1,4) = -nn2 !
286  nn(2,5) = -nn2 !
287  nn(3,6) = -nn2 ! Assign values to the shape function
288  nn(1,7) = -nn3 ! matrix
289  nn(2,8) = -nn3 !
290  nn(3,9) = -nn3 !
291 
292 ! Define shape function values
293  nn1 = 1.d0 - dble(sd_subface_nat_coors_mate(ii,faceel_counterparts))- &
294  dble(sd_subface_nat_coors_mate(ii+1,faceel_counterparts)) !
295  nn2 = dble(sd_subface_nat_coors_mate(ii,faceel_counterparts)) !
296  nn3 = dble(sd_subface_nat_coors_mate(ii+1,faceel_counterparts))
297  ii = ii + 2
298 
299 ! Build NN
300 
301  nn(1:3,10:18) = 0.d0
302 
303  nn(1,10) = nn1 !
304  nn(2,11) = nn1 !
305  nn(3,12) = nn1 !
306  nn(1,13) = nn2 !
307  nn(2,14) = nn2 !
308  nn(3,15) = nn2 ! Assign values to the shape function
309  nn(1,16) = nn3 ! matrix
310  nn(2,17) = nn3 !
311  nn(3,18) = nn3 !
312 
313  delta = matmul(nn,dloc) ! dx dy dz at each gauss point
314 
315  ii = ii + 2
316 
317 ! IF(SignFlag.EQ.-1.d0)PRINT*,delta
318 
319 
320 ! Find delta1 <dn dt> at each gauss point
321 
322  delta1(1) = dot_product(delta,normal)
323 
324  DO j=1,3
325  tangential(j) = delta(j)-delta1(1)*normal(j)
326  END DO
327 
328  delta1(2) = sqrt(tangential(1)**2+tangential(2)**2+tangential(3)**2)
329 
330 ! Caluate S value at gauss point
331 
332  x = 1.d0-sqrt((delta1(1)*deltn)**2+(delta1(2)*deltt)**2)
333  sthresh(k,i)=max(0.d0,min(x,sthresh(k,i)))
334 
335 ! PRINT*,Sthresh(k,i)
336 
337  ! deltn = 1/dnc, deltt = 1/dtc
338 
339 ! TRACTIONS
340 
341  IF (delta1(1)>=0.d0) THEN
342  tn=sthresh(k,i)/(1.d0-sthresh(k,i))*sig*delta1(1)*deltn/sinit(matid)
343  ELSE
344  tn=sig*delta1(1)*deltn/(1.d0-sinit(matid))
345  END IF
346 
347  tt=sthresh(k,i)/(1.d0-sthresh(k,i))*tau*delta1(2)*deltt/sinit(matid)
348 
349 
350 ! Build a traction vector <Tx Ty Tz>
351 
352  DO j=1,3
353  t(j)=tn*normal(j)+tt*tangential(j)
354  END DO
355 
356 
357  aa = matmul(transpose(nn),t) ! to make following calc easier
358 
359 ! Build rcohloc
360 !! Check this calculation. Should weight be in there? should it be * 1/3?
361  DO j=1,18
362  rcohloc(j) = rcohloc(j) - area*aa(j)*weight(k)
363  END DO
364 
365  END DO ! End of looping over integration points
366 
367 
368 ! Build Rnet
369 
370 
371  rnet(n1*3-2) = rnet(n1*3-2) + rcohloc(1)
372  rnet(n1*3-1) = rnet(n1*3-1) + rcohloc(2)
373  rnet(n1*3) = rnet(n1*3) + rcohloc(3)
374  rnet(n2*3-2) = rnet(n2*3-2) + rcohloc(4)
375  rnet(n2*3-1) = rnet(n2*3-1) + rcohloc(5)
376  rnet(n2*3) = rnet(n2*3) + rcohloc(6)
377  rnet(n3*3-2) = rnet(n3*3-2) + rcohloc(7)
378  rnet(n3*3-1) = rnet(n3*3-1) + rcohloc(8)
379  rnet(n3*3) = rnet(n3*3) + rcohloc(9)
380 
381 
382  rnet(n4*3-2) = rnet(n4*3-2) + rcohloc(10)
383  rnet(n4*3-1) = rnet(n4*3-1) + rcohloc(11)
384  rnet(n4*3) = rnet(n4*3) + rcohloc(12)
385  rnet(n5*3-2) = rnet(n5*3-2) + rcohloc(13)
386  rnet(n5*3-1) = rnet(n5*3-1) + rcohloc(14)
387  rnet(n5*3) = rnet(n5*3) + rcohloc(15)
388  rnet(n6*3-2) = rnet(n6*3-2) + rcohloc(16)
389  rnet(n6*3-1) = rnet(n6*3-1) + rcohloc(17)
390  rnet(n6*3) = rnet(n6*3) + rcohloc(18)
391 
392 
393  END DO ! End of looping over elements
394 
395 END SUBROUTINE c3d6nm
396 
397 
398 SUBROUTINE crossprod_3d ( x1, y1, z1, x2, y2, z2, x3, y3, z3 )
399 !
400 !*******************************************************************************
401 !
402 !! CROSS_3D computes the cross product of two vectors in 3D.
403 !
404 !
405 ! Definition:
406 !
407 ! The cross product in 3D can be regarded as the determinant of the
408 ! symbolic matrix:
409 !
410 ! | i j k |
411 ! det | x1 y1 z1 |
412 ! | x2 y2 z2 |
413 !
414 ! = ( y1 * z2 - z1 * y2 ) * i
415 ! + ( z1 * x2 - x1 * z2 ) * j
416 ! + ( x1 * y2 - y1 * x2 ) * k
417 !
418 ! Modified:
419 !
420 ! 19 April 1999
421 !
422 ! Author:
423 !
424 ! John Burkardt
425 !
426 ! Parameters:
427 !
428 ! Input, real X1, Y1, Z1, X2, Y2, Z2, the coordinates of the vectors.
429 !
430 ! Output, real X3, Y3, Z3, the cross product vector.
431 !
432  IMPLICIT NONE
433 !
434  REAL*8 :: x1
435  REAL*8 :: x2
436  REAL*8 :: x3
437  REAL*8 :: y1
438  REAL*8 :: y2
439  REAL*8 :: y3
440  REAL*8 :: z1
441  REAL*8 :: z2
442  REAL*8 :: z3
443 !
444  x3 = y1 * z2 - z1 * y2
445  y3 = z1 * x2 - x1 * z2
446  z3 = x1 * y2 - y1 * x2
447 
448  RETURN
449 END SUBROUTINE crossprod_3d
450 
451 
subroutine c3d6nm(nsubn, nsubf, nsubn2, nsubf2, CoorOverlay, ElConnOverlay, sd_subface_parents, sd_subface_parents2, sd_subface_mate, sd_subface_nat_coors, sd_subface_nat_coors_mate, FaceOfVolEl, FaceOfVolEl2, NumNp, NumEl, ElConn, nf, nf2, MapFaceEl2Vol, MapFaceEl2Vol2, deltan, deltat, sigmax, taumax, Sinit, Rnet, Disp, Sthresh, NumMatCoh, MatID, SignFlag)
Definition: c3d6nm.f90:54
subroutine crossprod_3d(x1, y1, z1, x2, y2, z2, x3, y3, z3)
Definition: c3d6nm.f90:398
j indices k indices k
Definition: Indexing.h:6
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
Tfloat magnitude(const int magnitude_type=2) const
Return the norm of the current vector/matrix. ntype = norm type (0=L2, 1=L1, -1=Linf).
Definition: CImg.h:13191
double sqrt(double d)
Definition: double.h:73
Vector_3< Real > normal() const
Get the normal of the incident facet.
Definition: Manifold_2.C:1259
blockLoc i
Definition: read.cpp:79
void int int REAL * x
Definition: read.cpp:74
RT delta(int i) const
Definition: Direction_2.h:159
real side(cv &pt) const
Definition: vector3d.h:208
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:346
j indices j
Definition: Indexing.h:6
long double dot_product(pnt vec1, pnt vec2)
unsigned char g() const
Definition: Color.h:69