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