47 subroutine get_cfl4nhe(time_step, nn_loc, loc_n_num, nm, tm, pm, sdeg, &
48 xx_loc, yy_loc, zz_loc, cs_nnz_loc, cs_loc, &
49 rho_nhe, lambda_nhe, mu_nhe, &
50 time_step_cfl, fmax, deltat_fixed, &
51 mpi_comm, mpi_np, mpi_id, b_failCFL)
59 character*3 :: deltat_fixed
61 integer*4 :: nm, im, nn_loc, cs_nnz_loc, mpi_comm, mpi_np, mpi_err
62integer*4 :: ie, i, j, k, nn, mcode, smcode, sdeg_deltat_cfl, sdeg_npoints
63 integer*4 :: nel_loc, ic1, ic2, n1, n2, istart, ifin
65 integer*4,
dimension(1) :: pos
66 integer*4,
dimension(nm) :: tm, sdeg
67 integer*4,
dimension(nn_loc) :: loc_n_num
68 integer*4,
dimension(0:cs_nnz_loc) :: cs_loc
70 real*8 :: time_step, time_step_cfl, fmax
71 real*8 :: length_min,length,vs_length_min,vs_length,length_vp_min
72 real*8 :: percent_deltat
73 real*8 :: num_of_points,vs_npoints,vp_deltat_cfl
74 real*8 :: rho,lambda,mu,vs,vp
75 real*8 :: x1_length_vp_min,y1_length_vp_min,z1_length_vp_min
76 real*8 :: x2_length_vp_min,y2_length_vp_min,z2_length_vp_min
78 real*8,
dimension(:),
allocatable :: ct,ww
79 real*8,
dimension(:),
allocatable :: time_step_glo
80 real*8,
dimension(nn_loc) :: xx_loc, yy_loc, zz_loc
81 real*8,
dimension(nn_loc) :: rho_nhe, lambda_nhe, mu_nhe
83 real*8,
dimension(nm,4) :: pm
84 real*8,
dimension(:,:),
allocatable :: dd
86 real*8,
dimension(:,:,:),
allocatable :: rho_el, lambda_el, mu_el
88 logical :: b_failCFL, b_CFL_failure = .false.
90 nel_loc = cs_loc(0) - 1
97 im = cs_loc(cs_loc(ie -1) +0)
100 allocate(rho_el(nn,nn,nn), lambda_el(nn,nn,nn),mu_el(nn,nn
108 rho_nhe, lambda_nhe, mu_nhe
109 rho_el, lambda_el, mu_el, gamma_el
119 rho = rho + rho_el(i,j,k)
120 lambda = lambda + lambda_el(i,j,k)
121 mu = mu + mu_el(i,j,k)
127 lambda = lambda/(nn**3)
131 vp = dsqrt((lambda+2*mu)/rho)
133 n1 = nn*nn*(1 -1) +nn*(1 -1) +1
134 n2 = nn*nn*(nn -1) +nn*(nn -1) +nn
135 istart = cs_loc(ie -1) +n1
136 ifin = cs_loc(ie -1) +n2
139 do ic1 = istart, ifin
140 do ic2 = ic1 + 1, ifin
142 if(cs_loc(ic1) .ne. 0 .and. cs_loc(ic2) .ne. 0)
then
144 length=dsqrt((xx_loc(cs_loc(ic1))-xx_loc(cs_loc(ic2
145 (yy_loc(cs_loc(ic1))-yy_loc(cs_loc(ic2
146 (zz_loc(cs_loc(ic1))-zz_loc(cs_loc(ic2
148 length_vp = length/vp
149 if (length_vp_min .gt. length_vp)
then
150 length_vp_min = length_vp
151 x1_length_vp_min = xx_loc(cs_loc(ic1))
152 y1_length_vp_min = yy_loc(cs_loc(ic1))
153 z1_length_vp_min = zz_loc(cs_loc(ic1))
154 x2_length_vp_min = xx_loc(cs_loc(ic2))
155 y2_length_vp_min = yy_loc(cs_loc(ic2))
156 z2_length_vp_min = zz_loc(cs_loc(ic2))
158 sdeg_deltat_cfl = smcode
163 vs_length = vs/length
165 if (vs_length_min.gt.vs_length)
then
166 vs_length_min = vs_length
168 sdeg_npoints = smcode
176 deallocate(lambda_el, gamma_el, mu_el, rho_el)
180 nn = sdeg_deltat_cfl + 1
182 time_step_cfl=length_vp_min
184 allocate(time_step_glo(mpi_np))
186 call mpi_barrier(mpi_comm, mpi_err)
187 call mpi_allgather(time_step_cfl, 1, speed_double, time_step_glo
190 pos = minloc(time_step_glo)
192 deallocate(time_step_glo)
194 if((mpi_id + 1) .eq. pos(1))
then
197 write(*,
'(A)')
'--------Stability for time advancing algorithm --------'
198 write(*,
'(A,E12.4)')
'Mininum distance beteween grid nodes :'
199 write(*,
'(A,E12.4)')
'Vp for CFL condition :', vp_deltat_cfl
200 write(*,
'(A,E12.4,E12.4,E12.4)')
'Min. node 1 : ',x1_length_vp_min
201 write(*,
'(A,E12.4,E12.4,E12.4)')
'Min. node 2 : ',x2_length_vp_min
202 write(*,
'(A)')
'-------------------------------------------------------'
203 if (time_step.le.time_step_cfl)
then
204 percent_deltat=time_step/time_step_cfl*100
205 if (percent_deltat.le.1)
then
206 write(*,
'(A,E12.4)')
'WARNING!!! deltat CFL =',&
208 write(*,
'(A,F6.2,A)')
'You are using ',percent_deltat
209 '% of critical time step.'
210 write(*,
'(A)')
'This time step is excedingly lower the deltat CFL'
211 if (deltat_fixed.eq.
'not')
then
212 write(*,
'(A)')
'deltat chosen will be substituted with 10% of deltat CFL'
213 time_step=time_step_cfl*0.1
214 write(*,
'(A,E12.4)')
'deltat chosen :',time_step
216 elseif (percent_deltat.le.25)
then
217 write(*,
'(A,E12.4)')
'OK!!! deltat CFL =',&
219 write(*,
'(A,F6.2,A)')
'You are using ',percent_deltat
220 '% of critical time step.'
222 write(*,
'(A,E12.4)')
'WARNING!!! deltat CFL =',&
224 write(*,
'(A,F6.2,A)')
'You are using ',percent_deltat
225 '% of critical time step.'
226 write(*,
'(A)')
'This could be not enough for the correct working of ABC'
227 if (deltat_fixed.eq.
'not')
then
228 write(*,
'(A)')
'deltat chosen will be substituted with 20% of deltat CFL'
229 time_step=time_step_cfl*0.2
230 write(*,
'(A,E12.4)')
'deltat chosen :',time_step
233 elseif (time_step.gt.time_step_cfl)
then
234 write(*,
'(2X,A,E12.4)')
'ERROR!!! deltat CFL = ',&
235 time_step_cfl,
' < deltat = ',time_step
236 write(*,
'(A)')
'The time advancing scheme will be unstable!'
237 if (deltat_fixed.eq.
'not')
then
238 write(*,
'(A)')
'deltat chosen will be substituted with 20% of deltat CFL'
239 time_step=time_step_cfl*0.2
240 write(*,
'(A,E12.4)')
'deltat chosen :',time_step
242 b_cfl_failure = .true.
245 write(*,
'(A)')
'-------------------------------------------------------'
248 if (b_failcfl .and. b_cfl_failure)
then
249 write(*,*)
'CFL does NOT hold, asked to quit. Program finished.'
250 call mpi_finalize(mpi_err)
256 allocate(ct(nn),ww(nn),dd(nn,nn))
259 num_of_points = vs_length_min*(ct(1)-ct(nn))/(ct(int(nn/2))-ct
261 write(*,
'(A)')
'-----------Number of points per wave length------------'
263 write(*,
'(A,E12.4)')
'Minum vs wrt max frequency :',vs_npoints
264 write(*,
'(A,E12.4)')
'Points per wavelength :',num_of_points
270 call mpi_barrier(mpi_comm, mpi_err)
274 end subroutine get_cfl4nhe
subroutine get_mech_prop_nh_enhanced(ie, nn, nn_loc, cs_nnz_loc, cs_loc, rho_nhe, lambda_nhe, mu_nhe, qs_nh, fmax, rho_el, lambda_el, mu_el, gamma_el)
...Not-Honoring Enhanced (NHE) Implementation
subroutine make_lgl_nw(nb_pnt, xq, wq, dd)
Makes Gauss-Legendre-Lobatto nodes, weigths and spectral derivatives.
integer, parameter exit_cfl