17 real(8),
dimension(:,:),
allocatable:: v, w, t
18 character(len=80):: label
30 SUBROUTINE init (self, label, nMPI, nt, cadence)
32 character(len=*):: label
36 call trace%begin (
'global_t%init')
38 self%cadence = cadence
41 allocate (self%v(nt,nmpi))
42 allocate (self%w(nt,nmpi))
43 allocate (self%t(nt,nmpi))
54 SUBROUTINE update (self, v, w, t)
58 call trace%begin (
'global_t%update')
59 if (t > self%t(self%nt-1,mpi%rank)+self%cadence)
then 60 self%v(1:self%nt-1,mpi%rank) = self%v(2:self%nt,mpi%rank)
61 self%w(1:self%nt-1,mpi%rank) = self%w(2:self%nt,mpi%rank)
62 self%t(1:self%nt-1,mpi%rank) = self%t(2:self%nt,mpi%rank)
63 self%v(self%nt,mpi%rank) = v
64 self%w(self%nt,mpi%rank) = w
65 self%t(self%nt,mpi%rank) = t
66 t1 = (t+self%t(self%nt-1,mpi%rank))/2d0
67 self%istep = self%istep + 1
69 print
'(a,9f12.6)',
'new times:', self%t(:,mpi%rank), t1
70 print
'(a,9f12.6)',
' averages:', self%v(:,mpi%rank), self%average (t1)
73 self%v(self%nt,mpi%rank) = v
74 self%w(self%nt,mpi%rank) = w
75 self%t(self%nt,mpi%rank) = t
83 SUBROUTINE merge (self, nbor)
88 call trace%begin (
'global_t%merge')
91 if (nbor%t(i,j) > self%t(i,j))
then 92 self%v(i,j) = nbor%v(i,j)
93 self%w(i,j) = nbor%w(i,j)
94 self%t(i,j) = nbor%t(i,j)
104 FUNCTION average (self, t)
108 real(8):: v, w, weight
111 call trace%begin (
'global_t%average')
115 v = lagrange%sequence(t, self%t(:,i), self%v(:,i), min(self%order,self%istep))
116 w = lagrange%sequence(t, self%t(:,i), self%w(:,i), min(self%order,self%istep))
118 average = average + v*w
Data type for computing global average, while using only nearest node nbor communication.
Module for Lagrange interpolation.