SPEED
READ_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
47
48 subroutine read_expl(Xipo,Yipo,Zipo, &
49 X1,Y1,Z1, &
50 X2,Y2,Z2, &
51 X3,Y3,Z3, &
52 nnod,xs,ys,zs, &
53 num_ne,sour_ne,i,&
54 dist_sour_ne,nl_expl,&
55 max_num_ne, loc_n_num, nn_loc)
56
57
58 implicit none
59
60 integer*4 :: nnod,node_expl,num_ne,nl_expl,max_num_ne, nn_loc
61 integer*4 :: i,isn
62
63 integer*4, dimension(nn_loc) :: loc_n_num(nn_loc)
64
65 integer*4, dimension(max_num_ne,nl_expl) :: sour_ne
66
67 real*8 :: xipo,yipo,zipo,x1,y1,z1,x2,y2,z2,x3,y3,z3,ux,uy,uz,vx,vy,vz,tol
68 real*8 :: xmax,xmin,ymax,ymin,zmax,zmin,a,b,c
69 real*8 :: den
70
71 real*8, dimension(nn_loc) :: xs,ys,zs
72
73 real*8, dimension(max_num_ne,nl_expl) :: dist_sour_ne
74
75 node_expl = 0
76 tol = 5.0d0
77
78 ux=(x1-x2)/sqrt((x1-x2)**2+(y1-y2)**2+(z1-z2)**2)
79 uy=(y1-y2)/sqrt((x1-x2)**2+(y1-y2)**2+(z1-z2)**2)
80 uz=(z1-z2)/sqrt((x1-x2)**2+(y1-y2)**2+(z1-z2)**2)
81 vx=(x3-x2)/sqrt((x3-x2)**2+(y3-y2)**2+(z3-z2)**2)
82 vy=(y3-y2)/sqrt((x3-x2)**2+(y3-y2)**2+(z3-z2)**2)
83 vz=(z3-z2)/sqrt((x3-x2)**2+(y3-y2)**2+(z3-z2)**2)
84
85 a = uy * vz - uz * vy
86 b = uz * vx - ux * vz
87 c = ux * vy - uy * vx
88 den = sqrt(a**2 + b**2 + c**2)
89
90 !Check on the relative position of fault end points
91 !In this preliminary part we check if P1 point is the lower-left fault point or not
92 !If this check would fail the two points are swapped
93
94
95 xmax=max(x1,x2,x3)+tol
96 xmin=min(x1,x2,x3)-tol
97 ymax=max(y1,y2,y3)+tol
98 ymin=min(y1,y2,y3)-tol
99 zmax=max(z1,z2,z3)+tol
100 zmin=min(z1,z2,z3)-tol
101
102
103 do isn = 1,nnod
104
105 if ( dabs( a*(xs(isn)-x1) + b*(ys(isn)-y1) + c*(zs(isn)-z1)/den ).le.tol) then
106 if ((xs(isn).ge.xmin).and.(xs(isn).le.xmax)) then
107 if ((ys(isn).ge.ymin).and.(ys(isn).le.ymax)) then
108 if ((zs(isn).ge.zmin).and.(zs(isn).le.zmax)) then
109
110 node_expl = node_expl + 1
111 sour_ne(node_expl,i) = loc_n_num(isn)
112 dist_sour_ne(node_expl,i) = sqrt((xipo - xs(isn))**2 + (yipo - ys(isn))**2 + (zipo - zs(isn))**2)
113
114 endif
115 endif
116 endif
117 endif
118
119 enddo
120
121
122 return
123 end subroutine read_expl
124
subroutine read_expl(xipo, yipo, zipo, x1, y1, z1, x2, y2, z2, x3, y3, z3, nnod, xs, ys, zs, num_ne, sour_ne, i, dist_sour_ne, nl_expl, max_num_ne, loc_n_num, nn_loc)
Generates explosive triangular faults.
Definition READ_EXPL.f90:56