SPEED
NEWTON_RAPSON.f90 File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine newton_rapson (xnod, ynod, znod, alfa11, alfa12, alfa13, alfa21, alfa22, alfa23, alfa31, alfa32, alfa33, beta11, beta12, beta13, beta21, beta22, beta23, beta31, beta32, beta33, gamma1, gamma2, gamma3, delta1, delta2, delta3, tt, csi_s, eta_s, zeta_s, nofi, id_mpi, ipiu, imeno, toll1, toll2, flag)
 Performs the Newton Rapson algorithm.
 

Function/Subroutine Documentation

◆ newton_rapson()

subroutine newton_rapson ( real*8, intent(in)  xnod,
real*8, intent(in)  ynod,
real*8, intent(in)  znod,
real*8  alfa11,
real*8  alfa12,
real*8  alfa13,
real*8  alfa21,
real*8  alfa22,
real*8  alfa23,
real*8  alfa31,
real*8  alfa32,
real*8  alfa33,
real*8  beta11,
real*8  beta12,
real*8  beta13,
real*8  beta21,
real*8  beta22,
real*8  beta23,
real*8  beta31,
real*8  beta32,
real*8  beta33,
real*8  gamma1,
real*8  gamma2,
real*8  gamma3,
real*8  delta1,
real*8  delta2,
real*8  delta3,
integer*4, intent(out)  tt,
real*8, intent(out)  csi_s,
real*8, intent(out)  eta_s,
real*8, intent(out)  zeta_s,
integer*4, intent(in)  nofi,
integer*4, intent(in)  id_mpi,
integer*4, intent(in)  ipiu,
integer*4, intent(in)  imeno,
real*8, intent(in)  toll1,
real*8, intent(in)  toll2,
integer*4, intent(in)  flag 
)

Performs the Newton Rapson algorithm.

Author
Ilario Mazzieri
Date
September, 2013
Version
1.0
Parameters
[in]xnodx-coord of the point
[in]ynody-coord of the point
[in]znodz-coord of the point
[in]alfa11costant for the bilinear map
[in]alfa12costant for the bilinear map
[in]alfa13costant for the bilinear map
[in]alfa21costant for the bilinear map
[in]alfa22costant for the bilinear map
[in]alfa23costant for the bilinear map
[in]alfa31costant for the bilinear map
[in]alfa32costant for the bilinear map
[in]alfa33costant for the bilinear map
[in]beta11costant for the bilinear map
[in]beta12costant for the bilinear map
[in]beta13costant for the bilinear map
[in]beta21costant for the bilinear map
[in]beta22costant for the bilinear map
[in]beta23costant for the bilinear map
[in]beta31costant for the bilinear map
[in]beta32costant for the bilinear map
[in]beta33costant for the bilinear map
[in]gamma1costant for the bilinear map
[in]gamma2costant for the bilinear map
[in]gamma3costant for the bilinear map
[in]delta1costant for the bilinear map
[in]delta2costant for the bilinear map
[in]delta3costant for the bilinear map
[in]tt1 if the node belongs to the element, 0 otherwise
[in]nofinumber of iterations (dummy)
[in]id_mpimpi processor identity
[in]ipiucontrol parameter (dummy)
[in]imenocontrol parameter (dummy)
[in]toll1fixed tolerance
[in]toll2fixed tolerance
[in]flagcontrol parameter
[out]csi_sx-coordinate in the reference element of xnod,ynod,znod
[out]eta_sy-coordinate in the reference element of xnod,ynod,znod
[out]zeta_sz-coordinate in the reference element of xnod,ynod,znod

Definition at line 62 of file NEWTON_RAPSON.f90.

73
74 implicit none
75
76 integer*4 :: nofiter
77 integer*4 :: per_csi, per_eta, per_zeta
78 integer*4 :: iic, il,ih
79 integer*4, intent(out) :: tt
80 integer*4, intent(in) :: nofi,id_mpi,ipiu,imeno, flag
81
82 real*8 :: ll,lm ,xvt1,yvt1,xvt2,yvt2,xvc1,yvc1,xvc2,yvc2
83 real*8 :: a1,a2,a3,b1,b2,b3,c1,c2,c3,d1,d2,d3
84 real*8 :: e1,e2,e3,f1,f2,f3,g1,g2,g3,h1,h2,h3
85 real*8 :: delta_csi, delta_eta, delta_zeta
86 real*8 :: a,b,c,d,e,f,g,h,p, det
87 real*8 :: a11, a12, a13, a21, a22, a23, a31, a32, a33
88 real*8 :: ff1, ff2, ff3
89 real*8 :: alfa11,alfa12,alfa13,alfa21,alfa22,alfa23,alfa31,alfa32,alfa33
90 real*8 :: beta11,beta12,beta13,beta21,beta22,beta23,beta31,beta32,beta33
91 real*8 :: gamma1,gamma2,gamma3,delta1,delta2,delta3
92 real*8, intent(in) :: xnod, ynod, znod, toll1, toll2
93 real*8, intent(out) :: csi_s, eta_s, zeta_s
94
95
96 a1 = 8.d0*gamma1
97 a2 = 8.d0*gamma2
98 a3 = 8.d0*gamma3
99 b1 = 8.d0*beta13
100 b2 = 8.d0*beta23
101 b3 = 8.d0*beta33
102 c1 = 8.d0*beta11
103 c2 = 8.d0*beta21
104 c3 = 8.d0*beta31
105 d1 = 8.d0*beta12
106 d2 = 8.d0*beta22
107 d3 = 8.d0*beta32
108 e1 = 8.d0*alfa11
109 e2 = 8.d0*alfa21
110 e3 = 8.d0*alfa31
111 f1 = 8.d0*alfa12
112 f2 = 8.d0*alfa22
113 f3 = 8.d0*alfa32
114 g1 = 8.d0*alfa13
115 g2 = 8.d0*alfa23
116 g3 = 8.d0*alfa33
117 h1 = 8.d0*delta1
118 h2 = 8.d0*delta2
119 h3 = 8.d0*delta3
120
121 csi_s = 0.d0
122 eta_s = 0.d0
123 zeta_s = 0.d0
124 delta_csi = 0.0d0
125 delta_eta = 0.0d0
126 delta_zeta = 0.0d0
127
128 tt = 0
129 nofiter = 2000
130
131 per_csi = 0
132 per_eta = 0
133 per_zeta = 0
134
135
136 do il = 1, nofiter
137
138 a = a1*eta_s*zeta_s + b1*eta_s + d1*zeta_s + e1
139 b = a1*csi_s*zeta_s + b1*csi_s + c1*zeta_s + f1
140 c = a1*csi_s*eta_s + c1*eta_s + d1*csi_s + g1
141
142 d = a2*eta_s*zeta_s + b2*eta_s + d2*zeta_s + e2
143 e = a2*csi_s*zeta_s + b2*csi_s + c2*zeta_s + f2
144 f = a2*csi_s*eta_s + c2*eta_s + d2*csi_s + g2
145
146 g = a3*eta_s*zeta_s + b3*eta_s + d3*zeta_s + e3
147 h = a3*csi_s*zeta_s + b3*csi_s + c3*zeta_s + f3
148 p = a3*csi_s*eta_s + c3*eta_s + d3*csi_s + g3
149
150 det = a*(e*p - f*h) - b*(d*p - f*g) + c*(d*h -e*g)
151
152 if(det .eq. 0.d0) then
153 return
154 endif
155
156 a11 = e*p - f*h
157 a12 = -d*p + f*g
158 a13 = d*h - e*g
159 a21 = -b*p + c*h
160 a22 = a*p - c*g
161 a23 = -a*h + b*g
162 a31 = b*f - c*e
163 a32 = -a*f + c*d
164 a33 = a*e - b*d
165
166 ff1 = a1*csi_s*eta_s*zeta_s + b1*csi_s*eta_s + c1*eta_s*zeta_s + d1*csi_s*zeta_s &
167 + e1*csi_s + f1*eta_s + g1*zeta_s + h1 -8.d0*xnod
168
169 ff2 = a2*csi_s*eta_s*zeta_s + b2*csi_s*eta_s + c2*eta_s*zeta_s + d2*csi_s*zeta_s &
170 + e2*csi_s + f2*eta_s + g2*zeta_s + h2 -8.d0*ynod
171
172 ff3 = a3*csi_s*eta_s*zeta_s + b3*csi_s*eta_s + c3*eta_s*zeta_s + d3*csi_s*zeta_s &
173 + e3*csi_s + f3*eta_s + g3*zeta_s + h3 -8.d0*znod
174
175
176 delta_csi = (-1.d0/det)*(a11*ff1 + a21*ff2 + a31*ff3)
177
178 delta_eta = (-1.d0/det)*(a12*ff1 + a22*ff2 + a32*ff3)
179
180 delta_zeta = (-1.d0/det)*(a13*ff1 + a23*ff2 + a33*ff3)
181
182
183
184 if (abs(delta_csi).le. toll1 .and. abs(delta_eta).le. toll1 .and. abs(delta_zeta).le. toll1 ) then
185 tt = 1
186
187 if(flag.eq.1) then
188 if (dabs(csi_s) .gt. toll2 .or. dabs(eta_s) .gt. toll2 .or. dabs(zeta_s).gt. toll2 ) then
189 tt = 0
190 return
191 endif
192 endif
193
194 return
195 endif
196
197
198 csi_s = csi_s + delta_csi
199 eta_s = eta_s + delta_eta
200 zeta_s = zeta_s + delta_zeta
201
202 if (csi_s .gt. 1.d0 .AND. csi_s .lt. 2.d0 .AND. per_csi .eq. 0) then
203 csi_s = 1.d0
204 per_csi = 1
205 endif
206
207 if (csi_s .lt. -1.d0 .AND. csi_s .gt. -2.d0 .AND. per_csi .eq. 0) then
208 csi_s = -1.d0
209 per_csi = 1
210 endif
211
212
213 if (eta_s .gt. 1.d0 .AND. eta_s .lt. 2.d0 .AND. per_eta .eq. 0) then
214 eta_s = 1.d0
215 per_eta = 1
216 endif
217
218 if (eta_s .lt. -1.d0 .AND. eta_s .gt. -2.d0 .AND. per_eta .eq. 0) then
219 eta_s = -1.d0
220 per_eta = 1
221 endif
222
223 if (zeta_s .gt. 1.d0 .AND. zeta_s .lt. 2.d0 .AND. per_zeta .eq. 0) then
224 zeta_s = 1.d0
225 per_zeta = 1
226 endif
227
228 if (zeta_s .lt. -1.d0 .AND. zeta_s .gt. -2.d0 .AND. per_zeta .eq. 0) then
229 zeta_s = -1.d0
230 per_zeta = 1
231 endif
232
233
234 enddo
235
236 if(il .ge. nofiter) then
237 tt = 0
238 return
239 endif
240

Referenced by make_dg_interface(), and write_file_dgfs().

Here is the caller graph for this function: