Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TractLoad_Hex.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 tractload_hex(R_ex,numnp, &
54  interfaceelemtract, &
55  interfacenumelems, interfacenumnodes, &
56  interfaceelemconn, &
57  mapnode,lwrbnd,uppbnd,coor)
58 
59  IMPLICIT NONE
60 
61  INTEGER :: lwrbnd,uppbnd
62 
63  INTEGER :: interfacenumelems,interfacenumnodes
64  INTEGER, DIMENSION(1:UppBnd,1:InterfaceNumElems) :: interfaceelemconn
65  INTEGER, DIMENSION(1:InterfaceNumNodes) :: mapnode
66  REAL*8, DIMENSION(1:InterfaceNumElems) :: interfaceelemtract
67 
68  INTEGER :: numnp ! number of nodes
69 
70  REAL*8, DIMENSION(1:3*numnp) :: r_ex ! external force
71 
72  INTEGER :: nx, ny, nz
73  INTEGER :: i,j,k
74 
75  INTEGER,DIMENSION(1:4) :: conn2d
76  real*8,DIMENSION(1:3) :: dlvec
77  real*8 :: pmag, magnormdef, area
78 
79 ! mesh coordinates
80  REAL*8, DIMENSION(1:3,1:numnp) :: coor
81 
82 
83 
84  REAL*8, DIMENSION(1:3) :: veca, vecb, outwd_surface_normal, &
85  half_normal_veca, half_normal_vecb
86 
87 
88  DO i = 1, interfacenumelems
89 
90 ! Nodes of the Quad ( Vertex Nodes )
91 
92  conn2d(1:4) = interfaceelemconn(1:4,i)
93 
94 ! Uses the fact that the norm of the cross product vector
95 ! is the area of the parallelogram they form. The triangle they
96 ! form has half that area.
97 
98  veca(1:3) = coor(1:3,mapnode(conn2d(2)))- coor(1:3,mapnode(conn2d(1)))
99  vecb(1:3) = coor(1:3,mapnode(conn2d(4)))- coor(1:3,mapnode(conn2d(1)))
100 
101  half_normal_veca(1) = veca(2)*vecb(3) - vecb(2)*veca(3)
102  half_normal_veca(2) = veca(3)*vecb(1) - vecb(3)*veca(1)
103  half_normal_veca(3) = veca(1)*vecb(2) - vecb(1)*veca(2)
104 
105  veca(1:3) = coor(1:3,mapnode(conn2d(4))) - coor(1:3,mapnode(conn2d(3)))
106  vecb(1:3) = coor(1:3,mapnode(conn2d(2))) - coor(1:3,mapnode(conn2d(3)))
107 
108  half_normal_vecb(1) = veca(2)*vecb(3) - vecb(2)*veca(3)
109  half_normal_vecb(2) = veca(3)*vecb(1) - vecb(3)*veca(1)
110  half_normal_vecb(3) = veca(1)*vecb(2) - vecb(1)*veca(2)
111 
112  outwd_surface_normal = half_normal_veca + half_normal_vecb
113 
114 ! MagNormDef = SQRT( outwd_surface_normal(1)**2 + outwd_surface_normal(2)**2 + outwd_surface_normal(3)**2 )
115 
116 ! Area = 0.5*MagNormDef
117 
118  pmag = interfaceelemtract(i)*0.125d0 ! /4 * /2
119 
120  dlvec(1:3) = - pmag * outwd_surface_normal(1:3)
121 
122 ! exactly the same results
123 ! print*,'**', - InterfaceElemTract(i) * Area * 0.25 * outwd_surface_normal(1:3)/MagNormDef
124 ! print*,'***', dlvec(1:3)
125 
126 
127 ! Assembly into global external load vector R_ex
128 
129  conn2d(1:4) = interfaceelemconn(lwrbnd:uppbnd,i)
130 
131  DO j = 1, 4
132  nz = mapnode(conn2d(j))*3 ! volume node
133  nx = nz - 2
134  ny = nz - 1
135  r_ex(nx) = r_ex(nx) + dlvec(1)
136  r_ex(ny) = r_ex(ny) + dlvec(2)
137  r_ex(nz) = r_ex(nz) + dlvec(3)
138  ENDDO
139  ENDDO
140 
141  RETURN
142 END SUBROUTINE tractload_hex
143 
j indices k indices k
Definition: Indexing.h:6
blockLoc i
Definition: read.cpp:79
subroutine tractload_hex(R_ex, numnp, InterfaceElemTract, InterfaceNumElems, InterfaceNumNodes, InterfaceElemConn, MapNode, LwrBnd, UppBnd, coor)
j indices j
Definition: Indexing.h:6