Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MP/Source/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  DO i = 1, interfacenumelems
88 
89 ! Nodes of the Quad ( Vertex Nodes )
90 
91  conn2d(1:4) = interfaceelemconn(1:4,i)
92 
93 ! Uses the fact that the norm of the cross product vector
94 ! is the area of the parallelogram they form. The triangle they
95 ! form has half that area.
96 
97  veca(1:3) = coor(1:3,mapnode(conn2d(2)))- coor(1:3,mapnode(conn2d(1)))
98  vecb(1:3) = coor(1:3,mapnode(conn2d(4)))- coor(1:3,mapnode(conn2d(1)))
99 
100  half_normal_veca(1) = veca(2)*vecb(3) - vecb(2)*veca(3)
101  half_normal_veca(2) = veca(3)*vecb(1) - vecb(3)*veca(1)
102  half_normal_veca(3) = veca(1)*vecb(2) - vecb(1)*veca(2)
103 
104  veca(1:3) = coor(1:3,mapnode(conn2d(4))) - coor(1:3,mapnode(conn2d(3)))
105  vecb(1:3) = coor(1:3,mapnode(conn2d(2))) - coor(1:3,mapnode(conn2d(3)))
106 
107  half_normal_vecb(1) = veca(2)*vecb(3) - vecb(2)*veca(3)
108  half_normal_vecb(2) = veca(3)*vecb(1) - vecb(3)*veca(1)
109  half_normal_vecb(3) = veca(1)*vecb(2) - vecb(1)*veca(2)
110 
111  outwd_surface_normal = half_normal_veca + half_normal_vecb
112 
113 ! MagNormDef = SQRT( outwd_surface_normal(1)**2 + outwd_surface_normal(2)**2 + outwd_surface_normal(3)**2 )
114 
115 ! Area = 0.5*MagNormDef
116 
117  pmag = interfaceelemtract(i)*0.125d0 ! /4 * /2
118 
119  dlvec(1:3) = - pmag * outwd_surface_normal(1:3)
120 
121 ! exactly the same results
122 ! print*,'**', - InterfaceElemTract(i) * Area * 0.25 * outwd_surface_normal(1:3)/MagNormDef
123 ! print*,'***', dlvec(1:3)
124 
125 
126 ! Assembly into global external load vector R_ex
127 
128  conn2d(1:4) = interfaceelemconn(lwrbnd:uppbnd,i)
129 
130  DO j = 1, 4
131  nz = mapnode(conn2d(j))*3 ! volume node
132  nx = nz - 2
133  ny = nz - 1
134  r_ex(nx) = r_ex(nx) + dlvec(1)
135  r_ex(ny) = r_ex(ny) + dlvec(2)
136  r_ex(nz) = r_ex(nz) + dlvec(3)
137  ENDDO
138  ENDDO
139 
140  RETURN
141 END SUBROUTINE tractload_hex
142 
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