FrontISTR  5.8.0
Large-scale structural analysis program with finit element method
hecmw_amplitude_f.f90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
2 ! Copyright (c) 2016 The University of Tokyo
3 ! This software is released under the MIT License, see LICENSE.txt
4 !-------------------------------------------------------------------------------
5 
7 
9  use hecmw_util
10  implicit none
11 
12 contains
13 
14  subroutine hecmw_get_amplitude_value(amp, amp_id, time, value)
15  type(hecmwst_amplitude), intent(in) :: amp
16  integer(kind=kint), intent(in) :: amp_id
17  real(kind=kreal), intent(in) :: time
18  real(kind=kreal), intent(inout) :: value
19 
20  integer(kind=kint) :: i, jj1, jj2, s1, s2
21  real(kind=kreal) :: t_1, t_2
22  real(kind=kreal) :: f_t, f_1, f_2
23 
24  if( amp_id <= 0 .or. amp_id > amp%n_amp ) return
25 
26  jj1 = amp%amp_index(amp_id-1)+1
27  jj2 = amp%amp_index(amp_id)
28 
29  if(time >= amp%amp_table(jj2)) then
30  f_t = amp%amp_val(jj2)
31  else if(time <= amp%amp_table(jj1)) then
32  f_t = amp%amp_val(jj1)
33  else
34  do i = jj1+1, jj2
35  if(time <= amp%amp_table(i)) then
36  s2 = i
37  s1 = s2 - 1
38  exit
39  endif
40  end do
41 
42  t_2 = amp%amp_table(s2)
43  t_1 = amp%amp_table(s1)
44  f_2 = amp%amp_val(s2)
45  f_1 = amp%amp_val(s1)
46  if( t_2-t_1 <= 1.0d-20) then
47  f_t = f_2
48  else
49  f_t = ((t_2*f_1 - t_1*f_2) + (f_2 - f_1)*time) / (t_2 - t_1)
50  endif
51  endif
52 
53  if( amp%amp_type_value(amp_id) == hecmw_amp_typeval_relative ) then
54  value = f_t*value
55  else
56  value = f_t
57  end if
58 
59  end subroutine hecmw_get_amplitude_value
60 
61 end module hecmw_amplitude
Handle amplitude.
subroutine hecmw_get_amplitude_value(amp, amp_id, time, value)
I/O and Utility.
Definition: hecmw_util_f.F90:7
integer(kind=4), parameter kreal
integer(kind=kint), parameter hecmw_amp_typeval_relative