Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TractLoad.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(R_ex,numnp, &
54  interfacesfelemtract, &
55  interfacesfnumelems, interfacesfnumnodes, &
56  interfacesfelemconn, &
57  mapnodesf,lwrbnd,uppbnd,coor)
58 
59  IMPLICIT NONE
60 
61 
62 ! 1-3 for 4 node tet (i.e. 3 node triangles)
63 ! 4-6 for 10 node tet (i.e. 6 node triangles, mid-side nodes get traction)
64  INTEGER :: lwrbnd,uppbnd
65 
66  INTEGER :: interfacesfnumelems,interfacesfnumnodes
67  INTEGER, DIMENSION(1:UppBnd,1:InterfaceSFNumElems) :: interfacesfelemconn
68  INTEGER, DIMENSION(1:InterfaceSFNumNodes) :: mapnodesf
69  REAL*8, DIMENSION(1:3, 1:InterfaceSFNumElems) :: interfacesfelemtract
70 
71  INTEGER :: numnp ! number of nodes
72 
73  REAL*8, DIMENSION(1:3*numnp) :: r_ex ! external force
74 
75  INTEGER :: nx, ny, nz
76  INTEGER :: i,j,k
77 
78  INTEGER,DIMENSION(1:3) :: triconn
79  REAL*8,DIMENSION(1:3) :: uniftract
80 
81 ! mesh coordinates
82  REAL*8, DIMENSION(1:3,1:numnp) :: coor
83 
84  REAL*8 :: x0p,y0p,z0p
85  REAL*8 :: x1p,y1p,z1p
86  REAL*8 :: x2p,y2p,z2p
87  REAL*8 :: x3p,y3p,z3p
88 
89 ! Components sides vector
90 
91  REAL*8 :: x1x0, y1y0, z1z0
92  REAL*8 :: x2x0, y2y0, z2z0
93 
94 
95  REAL*8 :: xnorm, area, at
96 
97  at = 0.d0
98 
99  DO i = 1, interfacesfnumelems
100 
101 ! Nodes of the Triangle ( Vertex Nodes )
102 
103  triconn(1:3) = interfacesfelemconn(1:3,i)
104 
105 ! Uses the fact that the norm of the cross product vector
106 ! is the area of the parallelogram they form. The triangle they
107 ! form has half that area.
108 
109  x0p = coor(1,mapnodesf(triconn(1)))
110  y0p = coor(2,mapnodesf(triconn(1)))
111  z0p = coor(3,mapnodesf(triconn(1)))
112 
113  x1p = coor(1,mapnodesf(triconn(2)))
114  y1p = coor(2,mapnodesf(triconn(2)))
115  z1p = coor(3,mapnodesf(triconn(2)))
116 
117  x2p = coor(1,mapnodesf(triconn(3)))
118  y2p = coor(2,mapnodesf(triconn(3)))
119  z2p = coor(3,mapnodesf(triconn(3)))
120 
121 ! Find vector componets of the sides
122 
123  x1x0 = x1p - x0p
124  y1y0 = y1p - y0p
125  z1z0 = z1p - z0p
126 
127  x2x0 = x2p - x0p
128  y2y0 = y2p - y0p
129  z2z0 = z2p - z0p
130 
131 ! Take the cross product
132 
133  x3p = y1y0 * z2z0 - z1z0 * y2y0
134  y3p = z1z0 * x2x0 - x1x0 * z2z0
135  z3p = x1x0 * y2y0 - y1y0 * x2x0
136 
137 ! Computes the Euclidean norm of a vector in 3D
138 
139  xnorm = sqrt( x3p*x3p + y3p*y3p + z3p*z3p )
140 
141  area = 0.5d0*xnorm
142 
143 ! Assign the load weighted equally among the 3 nodes
144 
145  uniftract(1:3) = interfacesfelemtract(1:3,i)*area/3.d0
146 
147 ! Assembly into global external load vector R_ex
148 
149  triconn(1:3) = interfacesfelemconn(lwrbnd:uppbnd,i)
150 
151  DO j = 1, 3
152  nz = mapnodesf(triconn(j))*3 ! volume node
153  nx = nz - 2
154  ny = nz - 1
155  r_ex(nx) = r_ex(nx) + uniftract(1)
156  r_ex(ny) = r_ex(ny) + uniftract(2)
157  r_ex(nz) = r_ex(nz) + uniftract(3)
158  ENDDO
159  ENDDO
160 
161  RETURN
162 END SUBROUTINE tractload
163 
j indices k indices k
Definition: Indexing.h:6
double sqrt(double d)
Definition: double.h:73
blockLoc i
Definition: read.cpp:79
j indices j
Definition: Indexing.h:6
subroutine tractload(R_ex, numnp, InterfaceSFElemTract, InterfaceSFNumElems, InterfaceSFNumNodes, InterfaceSFElemConn, MapNodeSF, LwrBnd, UppBnd, coor)
Definition: TractLoad.f90:53