-
Notifications
You must be signed in to change notification settings - Fork 1
/
velforce.f90
executable file
·59 lines (49 loc) · 1.46 KB
/
velforce.f90
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
subroutine velforce
USE param
USE mls_param
use mls_local
use mpi_param
use local_arrays
implicit none
integer ic,jc,kc,ip,jp,kp
real :: for_x_mean, for_y_mean, for_z_mean
character(70) namfile
call update_add_upper_ghost(for_xc)
call update_add_upper_ghost(for_yc)
call update_add_upper_ghost(for_zc)
call update_add_lower_ghost(for_xc)
call update_add_lower_ghost(for_yc)
call update_add_lower_ghost(for_zc)
for_x_mean=0.
for_y_mean=0.
for_z_mean=0.
do kc=kstart, kend
do jc=1,n2m
do ic=1,n1m
for_x_mean = for_x_mean + for_xc(ic,jc,kc)
for_y_mean = for_y_mean + for_yc(ic,jc,kc)
for_z_mean = for_z_mean + for_zc(ic,jc,kc)
end do
end do
end do
call mpi_globalsum_double_var(for_x_mean)
call mpi_globalsum_double_var(for_y_mean)
call mpi_globalsum_double_var(for_z_mean)
for_x_mean = for_x_mean / dble(n1m*n2m*n3m)
for_y_mean = for_y_mean / dble(n1m*n2m*n3m)
for_z_mean = for_z_mean / dble(n1m*n2m*n3m)
! Subtract mean IBM force to obtain statistically steady, isotropic state
do kc=kstart,kend
do jc=1,n2m
do ic=1,n1m
vx(ic,jc,kc) = vx(ic,jc,kc) + for_xc(ic,jc,kc) - for_x_mean
vy(ic,jc,kc) = vy(ic,jc,kc) + for_yc(ic,jc,kc) - for_y_mean
vz(ic,jc,kc) = vz(ic,jc,kc) + for_zc(ic,jc,kc) - for_z_mean
end do
end do
end do
! To obtain a statistically steady state, mean must be subtracted
!vx(:,:,:) = vx(:,:,:) - for_x_mean
!vy(:,:,:) = vy(:,:,:) - for_y_mean
!vz(:,:,:) = vz(:,:,:) - for_z_mean
end