forked from csc-training/hpc-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevolve.f90
More file actions
27 lines (20 loc) · 693 Bytes
/
Copy pathevolve.f90
File metadata and controls
27 lines (20 loc) · 693 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
! SPDX-FileCopyrightText: 2019 CSC - IT Center for Science Ltd. <www.csc.fi>
!
! SPDX-License-Identifier: MIT
subroutine evolve(u, u_previous, nx, ny, a, dt, dx2, dy2)
implicit none
real*8, intent(inout) :: u(nx,ny), u_previous(nx, ny)
integer :: nx, ny
real*8 :: a, dt, dx2, dy2
integer :: i,j
do j = 2, ny-1
do i = 2, nx-1
u(i,j) = u_previous(i,j) + a * dt * ( &
(u_previous(i-1, j) - 2*u_previous(i,j) + &
u_previous(i+1, j)) / dx2 + &
(u_previous(i, j-1) - 2*u_previous(i,j) + &
u_previous(i, j+1)) / dy2 )
end do
end do
u_previous(:,:) = u(:,:)
end subroutine