SPEED
READ_SISM.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_sism(Xipo,Yipo,Zipo, &
49 X1,Y1,Z1, &
50 X2,Y2,Z2, &
51 X3,Y3,Z3, &
52 nnod,xs,ys,zs, &
53 num_ns,sour_ns,i_sism,&
54 dist_sour_ns,nl_sism,&
55 max_num_ns,loc_n_num, nn_loc, &
56 pos_sour_nx,pos_sour_ny,pos_sour_nz)
57
58
59 implicit none
60
61 integer*4 :: i_sism,isn,i,nn_loc
62 integer*4 :: nnod,node_sism,num_ns,nl_sism,max_num_ns
63
64 integer*4, dimension(nn_loc) :: loc_n_num(nn_loc)
65
66 integer*4, dimension(max_num_ns,nl_sism) :: sour_ns
67
68 real*8 :: xipo,yipo,zipo,x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4,ux,uy,uz,vx,vy,vz,tol
69 real*8 :: p1x,p1y,p1z,p2x,p2y,p2z
70 real*8 :: epsilon, twopi, anglesum, costheta,m1,m2
71
72 real*8, dimension(nn_loc) :: xs,ys,zs
73 real*8, dimension(4) :: x,y,z
74
75 real*8, dimension(max_num_ns,nl_sism) :: dist_sour_ns
76 real*8, dimension(max_num_ns,nl_sism) :: pos_sour_nx,pos_sour_ny,pos_sour_nz
77
78 node_sism = 0
79
80 tol = 6.28
81 epsilon = 1.d-8
82 twopi = 6.283185307179586476925287
83
84 x(1) = x1
85 y(1) = y1
86 z(1) = z1
87
88 x(2) = x2
89 y(2) = y2
90 z(2) = z2
91
92 x(3) = x3
93 y(3) = y3
94 z(3) = z3
95
96 x(4) = x1
97 y(4) = y1
98 z(4) = z1
99
100
101 do isn = 1,nnod
102
103 anglesum = 0.0d0
104 do i = 1,3
105 p1x = x(i) - xs(isn)
106 p1y = y(i) - ys(isn)
107 p1z = z(i) - zs(isn)
108 p2x = x(i+1) - xs(isn)
109 p2y = y(i+1) - ys(isn)
110 p2z = z(i+1) - zs(isn)
111
112 m1 = dsqrt(p1x*p1x + p1y*p1y + p1z*p1z)
113 m2 = dsqrt(p2x*p2x + p2y*p2y + p2z*p2z)
114
115 if ((m1*m2).le.epsilon) then
116 anglesum = twopi
117 else
118 costheta = (p1x*p2x + p1y*p2y + p1z*p2z)/(m1*m2)
119 anglesum = anglesum + dacos(costheta)
120 endif
121 enddo
122
123 if (anglesum.ge.tol) then
124
125 node_sism = node_sism + 1
126 sour_ns(node_sism,i_sism) = loc_n_num(isn)
127 dist_sour_ns(node_sism,i_sism) = dsqrt((xipo - xs(isn))**2 +(yipo - ys(isn))**2 +(zipo - zs(isn))**2)
128 pos_sour_nx(node_sism,i_sism) = xs(isn)
129 pos_sour_ny(node_sism,i_sism) = ys(isn)
130 pos_sour_nz(node_sism,i_sism) = zs(isn)
131
132 endif
133
134 enddo
135
136
137 return
138 end subroutine read_sism
139
subroutine read_sism(xipo, yipo, zipo, x1, y1, z1, x2, y2, z2, x3, y3, z3, nnod, xs, ys, zs, num_ns, sour_ns, i_sism, dist_sour_ns, nl_sism, max_num_ns, loc_n_num, nn_loc, pos_sour_nx, pos_sour_ny, pos_sour_nz)
Generates seismic triangular faults.
Definition READ_SISM.f90:57