Skip to content

Commit 1f5dbfe

Browse files
committed
push_for_dp
1 parent 8b77a6c commit 1f5dbfe

File tree

3 files changed

+43
-25
lines changed

3 files changed

+43
-25
lines changed

channel/input.inp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
0 ! iteration to start from (fresh start 0 otherwise different)
33
200000 ! Final time step
44
1000 ! Saving frequency
5-
6.00 ! Streamwise domain lenght Lx
6-
3.00 ! Spanwise domain width Ly
5+
4.0 ! Streamwise domain lenght Lx
6+
2.0 ! Spanwise domain width Ly
77
2.0 ! Wall-normal domain height Lz=2h
8-
0.01 ! Stretching factor quasi~0=uniform 1.5 mid-stretching and 3.0 extreme (do not use zero)
8+
0.0001 ! Stretching factor quasi~0=uniform 1.5 mid-stretching and 3.0 extreme (do not use zero)
99
1 ! inflow condition (0=zero, 1=perturbed 3D field, 2=read from fields)
1010
0 ! phase-field initial condition (0=circular drop, 1=read from fields)
1111
0 ! theta initial condition (0=uniform, 1=read from fields)
12-
0.0005 ! dt for the simulation
13-
0.00666 ! mu (viscosity)
12+
0.0001 ! dt for the simulation
13+
0.0066666 ! mu (viscosity)
1414
1.000 ! density
1515
-1.0 ! Pressure gradient along x (negative if flow along x)
1616
0.0 ! Pressure gradient along y (negative if flow along y)
1717
0.5 ! Initial drop radius for phase-field
1818
0.1d0 ! Surface tension
1919
1.0 ! Ratio eps/dx
2020
0.00666666 ! kappa (thermal diffusivity)
21-
00.0 ! alphag for buoyancy
21+
0.0 ! alphag for buoyancy

channel/main.f90

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ program main
4242
! Code variables
4343
double precision ::err, maxErr, meanp, gmeanp
4444
double complex, device, pointer :: psi3d(:,:,:)
45-
double precision :: k2
45+
double precision :: k2,maxdiv
4646
!integer :: il, jl, ig, jg
4747
integer :: offsets(3), xoff, yoff
4848
integer :: np(3)
@@ -56,7 +56,7 @@ program main
5656
! Enable or disable phase field
5757
#define phiflag 0
5858
! Enable or disable temperature field
59-
#define thetaflag 1
59+
#define thetaflag 0
6060

6161
!########################################################################################################################################
6262
! 1. INITIALIZATION OF MPI AND cuDECOMP AUTOTUNING : START
@@ -178,10 +178,9 @@ program main
178178
allocate(psi_d(max(nElemX_d2z, nElemY_d2z, nElemZ_d2z)))
179179
!NS variables
180180
allocate(u(piX%shape(1),piX%shape(2),piX%shape(3)),v(piX%shape(1),piX%shape(2),piX%shape(3)),w(piX%shape(1),piX%shape(2),piX%shape(3))) !velocity vector
181-
! allocate(ustar(piX%shape(1),piX%shape(2),piX%shape(3)),vstar(piX%shape(1),piX%shape(2),piX%shape(3)),wstar(piX%shape(1),piX%shape(2),piX%shape(3))) ! provisional velocity field
182181
allocate(rhsu(piX%shape(1),piX%shape(2),piX%shape(3)),rhsv(piX%shape(1),piX%shape(2),piX%shape(3)),rhsw(piX%shape(1),piX%shape(2),piX%shape(3))) ! right hand side u,v,w
183182
allocate(rhsu_o(piX%shape(1),piX%shape(2),piX%shape(3)),rhsv_o(piX%shape(1),piX%shape(2),piX%shape(3)),rhsw_o(piX%shape(1),piX%shape(2),piX%shape(3))) ! right hand side u,v,w
184-
!allocate(div(piX%shape(1),piX%shape(2),piX%shape(3))) (debug only)
183+
allocate(div(piX%shape(1),piX%shape(2),piX%shape(3)))
185184
!TDMA solver
186185
allocate(a(0:nz+1),b(0:nz+1),c(0:nz+1),d(0:nz+1),sol(0:nz+1))
187186
!PFM variables
@@ -241,14 +240,14 @@ program main
241240
jg = piX%lo(2) + j - 1 - halo_ext
242241
do i = 1, piX%shape(1)
243242
amp=3.d0
244-
mx=3.03d0
243+
mx=2.001d0
245244
my=2.02d0
246245
mz=4.d0
247246
!3D divergence free flow with fluctuations that satisfies the boundary conditions
248-
u(i,j,k) = 1.d0*(1.d0 - ((2*z(kg) - lz)/lz)**2) !
247+
u(i,j,k) = 20.d0*(1.d0 - ((2*z(kg) - lz)/lz)**2) !
249248
u(i,j,k) = u(i,j,k) - amp*cos(twopi*mx*x(i)/lx)*sin(twopi*my*y(jg)/ly)*2.d0*twopi/lz*sin(twopi*z(kg)/lz)*cos(twopi*z(kg)/lz)
250249
u(i,j,k) = u(i,j,k) + amp*sin(twopi*mx*x(i)/lx)*(-twopi*my/ly)*sin(2.d0*twopi*my*y(jg)/ly)*sin(twopi*z(kg)/lz)*sin(twopi*z(kg)/lz)
251-
v(i,j,k) = -amp*cos(twopi*my*y(jg)/ly)*(twopi*mx/lx)*cos(twopi*mx*x(i)/lx)*sin(twopi*z(kg)/lz)*sin(twopi*z(kg)/lz)
250+
v(i,j,k) = -amp*cos(twopi*my*y(jg)/ly)!*(twopi*mx/lx)*cos(twopi*mx*x(i)/lx)*sin(twopi*z(kg)/lz)*sin(twopi*z(kg)/lz)
252251
w(i,j,k) = amp*cos(twopi*mx*x(i)/lx)*(twopi*mx/lx)*sin(twopi*my*y(jg)/ly)*sin(twopi*z(kg)/lz)*sin(twopi*z(kg)/lz)
253252
enddo
254253
enddo
@@ -837,10 +836,10 @@ program main
837836
! Enforce pressure at one point? one interior point, avodig messing up with BC
838837
! need brackets?
839838
if (ig == 1 .and. jg == 1) then
840-
a(1) = 0.d0
841-
b(1) = 1.d0
842-
c(1) = 0.d0
843-
d(1) = 0.d0
839+
a(nz) = 0.d0
840+
b(nz) = 1.d0
841+
c(nz) = 0.d0
842+
d(nz) = 0.d0
844843
end if
845844
! Forward elimination (Thomas)
846845
!$acc loop seq
@@ -944,18 +943,37 @@ program main
944943
! bottom wall
945944
if (kg .eq. 1) u(i,j,k-1) = -u(i,j,k) ! mean value between kg and kg-1 (wall) equal to zero
946945
if (kg .eq. 1) v(i,j,k-1) = -v(i,j,k) ! mean value between kg and kg-1 (wall) equal to zero
947-
if (kg .eq. 1) w(i,j,k) = 0.d0 ! w point is at the wall
946+
if (kg .eq. 1) w(i,j,k) = 0.d0 ! w point is at the wall
948947
! top wall
949-
if (kg .eq. nz) u(i,j,k+1)= -u(i,j,k) ! mean value between kg and kg+1 (wall) equal to zero
950-
if (kg .eq. nz) v(i,j,k+1)= -v(i,j,k) ! mean value between kg and kg+1 (wall) equal to zero
951-
if (kg .eq. nz+1) w(i,j,k)=0.d0 ! w point (nz+1) is at the wall
948+
if (kg .eq. nz) u(i,j,k+1) = -u(i,j,k) ! mean value between kg and kg+1 (wall) equal to zero
949+
if (kg .eq. nz) v(i,j,k+1) = -v(i,j,k) ! mean value between kg and kg+1 (wall) equal to zero
950+
if (kg .eq. nz+1) w(i,j,k) = 0.d0 ! w point (nz+1) is at the wall
952951
umax=max(umax,u(i,j,k))
953952
vmax=max(vmax,v(i,j,k))
954953
wmax=max(wmax,w(i,j,k))
955954
enddo
956955
enddo
957956
enddo
958957

958+
959+
maxdiv=0.0d0
960+
!$acc parallel loop collapse(3) reduction(max:maxdiv)
961+
do k=1+halo_ext, piX%shape(3)-halo_ext
962+
do j=1+halo_ext, piX%shape(2)-halo_ext
963+
do i = 1, piX%shape(1) ! equal to nx (no halo on x)
964+
ip=i+1
965+
jp=j+1
966+
kp=k+1
967+
kg=piX%lo(3) + k - 1 - halo_ext
968+
if (ip > nx) ip=1
969+
div(i,j,k)=dxi*(u(ip,j,k)-u(i,j,k)) + dyi*(v(i,jp,k)-v(i,j,k)) + dzci(kg)*(w(i,j,kp)-w(i,j,k))
970+
maxdiv=max(maxdiv,abs(div(i,j,k)))
971+
enddo
972+
enddo
973+
enddo
974+
write(*,*) "Max divergence after correction ", maxdiv
975+
976+
959977
call MPI_Allreduce(umax,gumax,1,MPI_DOUBLE_PRECISION,MPI_MAX,MPI_COMM_WORLD, ierr)
960978
call MPI_Allreduce(vmax,gvmax,1,MPI_DOUBLE_PRECISION,MPI_MAX,MPI_COMM_WORLD, ierr)
961979
call MPI_Allreduce(wmax,gwmax,1,MPI_DOUBLE_PRECISION,MPI_MAX,MPI_COMM_WORLD, ierr)
@@ -1025,4 +1043,4 @@ program main
10251043

10261044
call mpi_finalize(ierr)
10271045

1028-
end program main
1046+
end program main

channel/module.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module param
2-
integer, parameter :: nx=200
3-
integer, parameter :: ny=100
4-
integer, parameter :: nz=200
2+
integer, parameter :: nx=256
3+
integer, parameter :: ny=128
4+
integer, parameter :: nz=128
55
double precision :: pi, rhoi, twopi
66
double precision :: lx, dx, dxi, ddxi
77
double precision :: ly, dy, dyi, ddyi

0 commit comments

Comments
 (0)