All Classes Files Functions Variables Pages
module_source_function.f90
Go to the documentation of this file.
1 !=====================================================================================================================================
2 ! EFISPEC3D !
3 ! (Elements FInis SPECtraux 3D) !
4 ! !
5 ! http://efispec.free.fr !
6 ! !
7 ! !
8 ! This file is part of EFISPEC3D !
9 ! Please refer to http://efispec.free.fr if you use it or part of it !
10 ! !
11 ! !
12 !1 ---> French License: CeCILL V2 !
13 ! !
14 ! Copyright BRGM 2009 contributeurs : Florent DE MARTIN !
15 ! David MICHEA !
16 ! Philippe THIERRY !
17 ! !
18 ! Contact: f.demartin at brgm.fr !
19 ! !
20 ! Ce logiciel est un programme informatique servant a resoudre l'equation du !
21 ! mouvement en trois dimensions via une methode des elements finis spectraux. !
22 ! !
23 ! Ce logiciel est regi par la licence CeCILL soumise au droit francais et !
24 ! respectant les principes de diffusion des logiciels libres. Vous pouvez !
25 ! utiliser, modifier et/ou redistribuer ce programme sous les conditions de la !
26 ! licence CeCILL telle que diffusee par le CEA, le CNRS et l'INRIA sur le site !
27 ! "http://www.cecill.info". !
28 ! !
29 ! En contrepartie de l'accessibilite au code source et des droits de copie, de !
30 ! modification et de redistribution accordes par cette licence, il n'est offert !
31 ! aux utilisateurs qu'une garantie limitee. Pour les memes raisons, seule une !
32 ! responsabilite restreinte pese sur l'auteur du programme, le titulaire des !
33 ! droits patrimoniaux et les concedants successifs. !
34 ! !
35 ! A cet egard l'attention de l'utilisateur est attiree sur les risques associes !
36 ! au chargement, a l'utilisation, a la modification et/ou au developpement et a !
37 ! la reproduction du logiciel par l'utilisateur etant donne sa specificite de !
38 ! logiciel libre, qui peut le rendre complexe a manipuler et qui le reserve donc !
39 ! a des developpeurs et des professionnels avertis possedant des connaissances !
40 ! informatiques approfondies. Les utilisateurs sont donc invites a charger et !
41 ! tester l'adequation du logiciel a leurs besoins dans des conditions permettant !
42 ! d'assurer la securite de leurs systemes et ou de leurs donnees et, plus !
43 ! generalement, a l'utiliser et l'exploiter dans les memes conditions de !
44 ! securite. !
45 ! !
46 ! Le fait que vous puissiez acceder a cet en-tete signifie que vous avez pris !
47 ! connaissance de la licence CeCILL et que vous en avez accepte les termes. !
48 ! !
49 ! !
50 !2 ---> International license: GNU GPL V3 !
51 ! !
52 ! EFISPEC3D is a computer program that solves the three-dimensional equations of !
53 ! motion using a finite spectral-element method. !
54 ! !
55 ! Copyright (C) 2009 Florent DE MARTIN !
56 ! !
57 ! Contact: f.demartin at brgm.fr !
58 ! !
59 ! This program is free software: you can redistribute it and/or modify it under !
60 ! the terms of the GNU General Public License as published by the Free Software !
61 ! Foundation, either version 3 of the License, or (at your option) any later !
62 ! version. !
63 ! !
64 ! This program is distributed in the hope that it will be useful, but WITHOUT ANY !
65 ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A !
66 ! PARTICULAR PURPOSE. See the GNU General Public License for more details. !
67 ! !
68 ! You should have received a copy of the GNU General Public License along with !
69 ! this program. If not, see http://www.gnu.org/licenses/. !
70 ! !
71 ! !
72 !3 ---> Third party libraries !
73 ! !
74 ! EFISPEC3D uses the following of third party libraries: !
75 ! !
76 ! --> METIS 5.1.0 !
77 ! see http://glaros.dtc.umn.edu/gkhome/metis/metis/overview !
78 ! !
79 ! --> Lib_VTK_IO !
80 ! see S. Zaghi's website: https://github.com/szaghi/Lib_VTK_IO !
81 ! !
82 ! --> INTERP_LINEAR !
83 ! see J. Burkardt website: http://people.sc.fsu.edu/~jburkardt/ !
84 ! !
85 ! --> SAC !
86 ! http://ds.iris.edu/files/sac-manual/ !
87 ! !
88 ! --> EXODUS II !
89 ! http://sourceforge.net/projects/exodusii/ !
90 ! !
91 ! --> NETCDF !
92 ! http://www.unidata.ucar.edu/software/netcdf/ !
93 ! !
94 ! --> HDF5 !
95 ! http://www.hdfgroup.org/HDF5/ !
96 ! !
97 ! Some of these libraries are located in directory lib and pre-compiled !
98 ! with intel compiler for x86_64 platform. !
99 ! !
100 ! !
101 !4 ---> Related Articles !
102 ! !
103 ! De Martin, F., Matsushima, M., Kawase, H. (BSSA, 2013) !
104 ! Impact of geometric effects on near-surface Green's functions !
105 ! doi:10.1785/0120130039 !
106 ! !
107 ! Aochi, H., Ducellier, A., Dupros, F., Delatre, M., Ulrich, T., De Martin, F., !
108 ! Yoshimi, M., (Pure Appl. Geophys. 2013) !
109 ! Finite Difference Simulations of Seismic Wave Propagation for the 2007 Mw 6.6 !
110 ! Niigata-ken Chuetsu-Oki Earthquake: Validity of Models and Reliable !
111 ! Input Ground Motion in the Near-Field !
112 ! doi:10.1007/s00024-011-0429-5 !
113 ! !
114 ! De Martin, F. (BSSA, 2011) !
115 ! Verification of a Spectral-Element Method Code for the Southern California !
116 ! Earthquake Center LOH.3 Viscoelastic Case !
117 ! doi:10.1785/0120100305 !
118 ! !
119 !=====================================================================================================================================
120 
123 
127 
128  use mpi
129 
130  implicit none
131 
132  private
133 
134  public :: gabor
135  public :: expcos
136  public :: ispli3
137  public :: ricker
138  public :: spiexp
139  public :: fctanh
140  public :: fctanh_dt
141  public :: interp_linear
142  private :: rvec_ascends_strictly
143  private :: rvec_bracket
144 
145  contains
146 
147 
148 
149 !
150 !
156 !***********************************************************************************************************************************************************************************
157  real function gabor(t,ts,l,a)
158 !***********************************************************************************************************************************************************************************
159 
160  use mod_global_variables, only : rg_pi
161 
162  implicit none
163 
164  real, intent(in) :: t
165  real, intent(in) :: ts
166  real, intent(in) :: l
167  real, intent(in) :: a
168 
169  real :: s
170 
171  s = l/20.0
172 
173  gabor = a*exp(-((t-ts)**2)/(2.0*s**2))* ( cos(2.0*rg_pi*(t-ts)/l) )
174 
175 !***********************************************************************************************************************************************************************************
176  end function gabor
177 !***********************************************************************************************************************************************************************************
178 
179 !
180 !
185 !***********************************************************************************************************************************************************************************
186  real function expcos(t,ts,fp)
187 !***********************************************************************************************************************************************************************************
188 
189  use mod_global_variables, only : rg_pi
190 
191  implicit none
192 
193  real, intent(in) :: t
194  real, intent(in) :: ts
195  real, intent(in) :: fp
196 
197  real :: ome
198  real :: gam
199  real :: the
200 
201  ome = 2.0*rg_pi*fp
202  gam = 2.0
203  the = rg_pi/2.0
204  expcos = exp(-(ome*(t-ts)/gam)**2)*cos(ome*(t-ts)+the)
205 
206 !***********************************************************************************************************************************************************************************
207  end function expcos
208 !***********************************************************************************************************************************************************************************
209 
210 !
211 !
216 !***********************************************************************************************************************************************************************************
217  subroutine ispli3(t,du,s)
218 !***********************************************************************************************************************************************************************************
219  implicit none
220 
221  real, intent(inout) :: s
222  real, intent(in) :: t
223  real, intent(in) :: du
224 
225  real :: dtsp
226  real :: abst
227  real :: t0
228 
229  t0 = du/1.5
230  dtsp = du/4.0
231 
232  abst = abs(t-t0)
233  if (abst >= 2.0*dtsp) then
234  s = 0.0
235  elseif ( (abst < (2.0*dtsp)) .and. (abst >= dtsp) ) then
236  s = ((2.0*dtsp-abst)**3)/(6.0*dtsp**3)
237  else
238  s = (3.0*abst**3 - 6.0*dtsp*abst**2 + 4.0*dtsp**3)/(6.0*dtsp**3)
239  endif
240  s = s/dtsp
241 
242  return
243 !***********************************************************************************************************************************************************************************
244  end subroutine ispli3
245 !***********************************************************************************************************************************************************************************
246 
247 !
248 !
254 !***********************************************************************************************************************************************************************************
255  real function ricker(t,ts,tp,a)
256 !***********************************************************************************************************************************************************************************
257 
258  use mod_global_variables, only : rg_pi
259 
260  implicit none
261 
262  real, intent(in) :: t
263  real, intent(in) :: ts
264  real, intent(in) :: tp
265  real, intent(in) :: a
266 
267  ricker = 2.0*a*((rg_pi**2*(t-ts)**2)/(tp**2)-0.5)*exp((-rg_pi**2*(t-ts)**2)/(tp**2)) ! max peak at -1.00
268 !
269 !***********************************************************************************************************************************************************************************
270  end function ricker
271 !***********************************************************************************************************************************************************************************
272 
273 !
274 !
279 !***********************************************************************************************************************************************************************************
280  real function spiexp(t,tp,a)
281 !***********************************************************************************************************************************************************************************
282 
283  implicit none
284 
285  real, intent(in) :: t
286  real, intent(in) :: tp
287  real, intent(in) :: a
288 
289  spiexp = a*(1.0-(1.0+t/tp)*exp(-t/tp))
290 
291 !***********************************************************************************************************************************************************************************
292  end function spiexp
293 !***********************************************************************************************************************************************************************************
294 
295 !
296 !
302 !***********************************************************************************************************************************************************************************
303  real function fctanh(t,ts,tp,a)
304 !***********************************************************************************************************************************************************************************
305 
306  implicit none
307 
308  real, intent(in) :: t
309  real, intent(in) :: ts
310  real, intent(in) :: tp
311  real, intent(in) :: a
312 
313  real :: tau
314  real :: tt0
315 
316  tau = 2.0*tp
317 ! tt0 = 2.0*tau
318  tt0 = ts
319  fctanh = a*0.5*( 1.0 + tanh((t-tt0)/(tau/5.0)) )
320 
321 !***********************************************************************************************************************************************************************************
322  end function fctanh
323 !***********************************************************************************************************************************************************************************
324 
325 !
326 !
332 !***********************************************************************************************************************************************************************************
333  real function fctanh_dt(t,ts,tp,a)
334 !***********************************************************************************************************************************************************************************
335 
336  implicit none
337 
338  real, intent(in) :: t
339  real, intent(in) :: tp
340  real, intent(in) :: ts
341  real, intent(in) :: a
342 
343  real :: tau
344  real :: fc
345  real :: tt0
346 
347  tau = 2.0*tp
348  fc = 1.0/(4.0*(tau/5.0))
349 ! tt0 = 2.0*tau
350  tt0 = ts
351  fctanh_dt = +a*2.0*fc*(1.0-(tanh(4.0*fc*(t-tt0)))**2)
352 
353 !***********************************************************************************************************************************************************************************
354  end function fctanh_dt
355 !***********************************************************************************************************************************************************************************
356 
357 !
358 !
359 !
393 !***********************************************************************************************************************************************************************************
394  subroutine interp_linear( dim_num, data_num, t_data, p_data, interp_num, t_interp, p_interp )
395 !***********************************************************************************************************************************************************************************
396 
397  use mod_global_variables, only : error_stop
398 
399  implicit none
400 
401  integer, intent( in) :: data_num
402  integer, intent( in) :: dim_num
403  integer, intent( in) :: interp_num
404  real , intent( in) :: t_data(data_num)
405  real , intent( in) :: t_interp(interp_num)
406  real , intent( in) :: p_data(dim_num,data_num)
407  real , intent(out) :: p_interp(dim_num,interp_num)
408 
409  real :: t
410  integer :: interp
411  integer :: left
412  integer :: right
413 
414  character(len=255) :: info
415 
416  if ( .not. rvec_ascends_strictly( data_num, t_data ) ) then
417  write (info,'(a)') 'error in subroutine interp_linear: Independent variable array T_DATA is not strictly increasing.'
418  call error_stop(info)
419  endif
420 
421  do interp = 1, interp_num
422 
423  t = t_interp(interp)
424 !!
425 !! Find the interval [ TDATA(LEFT), TDATA(RIGHT) ] that contains, or is
426 !! nearest to, TVAL.
427 !!
428  call rvec_bracket( data_num, t_data, t, left, right )
429 
430  p_interp(1:dim_num,interp) = &
431  ( ( t_data(right) - t ) * p_data(1:dim_num,left) &
432  + ( t - t_data(left) ) * p_data(1:dim_num,right) ) &
433  / ( t_data(right) - t_data(left) )
434 
435  enddo
436 
437  return
438 !***********************************************************************************************************************************************************************************
439  end subroutine interp_linear
440 !***********************************************************************************************************************************************************************************
441 
442 !
443 !
444 !
446 !
448 !
450 !
454 !***********************************************************************************************************************************************************************************
455  logical function rvec_ascends_strictly(n,x)
456 !***********************************************************************************************************************************************************************************
457 
458  implicit none
459 
460  integer, intent(in) :: n
461  real , intent(in), dimension(n) :: x
462 
463  integer :: i
464 
465  do i = 1, n - 1
466  if ( x(i+1) <= x(i) ) then
467  rvec_ascends_strictly = .false.
468  return
469  endif
470  enddo
471 
472  rvec_ascends_strictly = .true.
473 
474  return
475 !***********************************************************************************************************************************************************************************
476  end function rvec_ascends_strictly
477 !***********************************************************************************************************************************************************************************
478 
479 !
480 !
482 !
484 !
486 !
492 !***********************************************************************************************************************************************************************************
493  subroutine rvec_bracket(n,x,xval,left,right)
494 !***********************************************************************************************************************************************************************************
495 
496  implicit none
497 
498  integer, intent( in) :: n
499  real , intent( in), dimension(n) :: x
500  real , intent( in) :: xval
501  integer, intent(out) :: left
502  integer, intent(out) :: right
503 
504  integer :: i
505 
506  do i = 2,n-1
507 
508  if ( xval < x(i) ) then
509  left = i - 1
510  right = i
511  return
512  endif
513 
514  enddo
515 
516  left = n - 1
517  right = n
518 
519  return
520 !***********************************************************************************************************************************************************************************
521  end subroutine rvec_bracket
522 !***********************************************************************************************************************************************************************************
523 
524 end module mod_source_function
subroutine, public interp_linear(dim_num, data_num, t_data, p_data, interp_num, t_interp, p_interp)
INTERP_LINEAR applies piecewise linear interpolation to data.
subroutine, private rvec_bracket(n, x, xval, left, right)
This subroutine searches a sorted R8VEC for successive brackets of a value.
real function, public spiexp(t, tp, a)
function to compute spice project exponential source function :
real function, public gabor(t, ts, l, a)
function to compute real part of Gabor wavelet :
This module defines all global variables of EFISPEC3D. Scalar variables are initialized directly in t...
real function, public ricker(t, ts, tp, a)
function to compute order 2 Ricker wavelet :
logical function, private rvec_ascends_strictly(n, x)
This function determines if an R8VEC is strictly ascending.
real function, public expcos(t, ts, fp)
function to compute euroseistest project source function for case can1 :
This module contains functions and subroutines to compute tsource functions&#39;s time history...
subroutine, public ispli3(t, du, s)
function to compute order 3 spline : see Wikipedia
real function, public fctanh_dt(t, ts, tp, a)
function to compute first derivative of hyperbolic tangent function : with
real function, public fctanh(t, ts, tp, a)
function to compute hyperbolic tangent function (also called &#39;Bouchon pulse&#39;) : ...