SPEED
GET_DIME_EXPL.f90
Go to the documentation of this file.
1! Copyright (C) 2012 The SPEED FOUNDATION
2! Author: Ilario Mazzieri
3!
4! This file is part of SPEED.
5!
6! SPEED is free software; you can redistribute it and/or modify it
7! under the terms of the GNU Affero General Public License as
8! published by the Free Software Foundation, either version 3 of the
9! License, or (at your option) any later version.
10!
11! SPEED is distributed in the hope that it will be useful, but
12! WITHOUT ANY WARRANTY; without even the implied warranty of
13! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14! Affero General Public License for more details.
15!
16! You should have received a copy of the GNU Affero General Public License
17! along with SPEED. If not, see <http://www.gnu.org/licenses/>.
18
41
42 subroutine get_dime_expl(Xipo,Yipo,Zipo, &
43 X1,Y1,Z1, &
44 X2,Y2,Z2, &
45 X3,Y3,Z3, &
46 nnod,xs,ys,zs, &
47 node_expl,nnloc)
48
49 implicit none
50
51 integer*4 :: nnod,node_expl,nnloc
52 integer*4 :: isn
53
54 real*8 :: xipo,yipo,zipo,x1,y1,z1,x2,y2,z2,x3,y3,z3,ux,uy,uz,vx,vy,vz,tol
55 real*8 :: xmax,xmin,ymax,ymin,zmin,zmax,a,b,c, den
56 real*8, dimension(nnloc) :: xs,ys,zs
57
58 node_expl = 0
59 tol = 5.0d0
60
61 ux=(x1-x2)/sqrt((x1-x2)**2+(y1-y2)**2+(z1-z2)**2)
62 uy=(y1-y2)/sqrt((x1-x2)**2+(y1-y2)**2+(z1-z2)**2)
63 uz=(z1-z2)/sqrt((x1-x2)**2+(y1-y2)**2+(z1-z2)**2)
64 vx=(x3-x2)/sqrt((x3-x2)**2+(y3-y2)**2+(z3-z2)**2)
65 vy=(y3-y2)/sqrt((x3-x2)**2+(y3-y2)**2+(z3-z2)**2)
66 vz=(z3-z2)/sqrt((x3-x2)**2+(y3-y2)**2+(z3-z2)**2)
67
68 a = uy * vz - uz * vy
69 b = uz * vx - ux * vz
70 c = ux * vy - uy * vx
71 den = sqrt(a**2 + b**2 + c**2)
72
73 !Check on the relative position of fault end points
74 !In this preliminary part we check if P1 point is the lower-left fault point or not
75 !If this check would fail the two points are swapped
76
77 xmax=max(x1,x2,x3)+tol
78 xmin=min(x1,x2,x3)-tol
79 ymax=max(y1,y2,y3)+tol
80 ymin=min(y1,y2,y3)-tol
81 zmax=max(z1,z2,z3)+tol
82 zmin=min(z1,z2,z3)-tol
83
84
85 do isn = 1,nnod
86 if ( dabs( a*(xs(isn)-xipo) + b*(ys(isn)-yipo) + c*(zs(isn)-zipo)/den ).le.tol) then
87 if ((xs(isn).ge.xmin).and.(xs(isn).le.xmax)) then
88 if ((ys(isn).ge.ymin).and.(ys(isn).le.ymax)) then
89 if ((zs(isn).ge.zmin).and.(zs(isn).le.zmax)) then
90 node_expl = node_expl+1
91 endif
92 endif
93 endif
94 endif
95 enddo
96
97 return
98 end subroutine get_dime_expl
99
subroutine get_dime_expl(xipo, yipo, zipo, x1, y1, z1, x2, y2, z2, x3, y3, z3, nnod, xs, ys, zs, node_expl, nnloc)
Computes local number of nodes where explosive source is imposed.