-
Notifications
You must be signed in to change notification settings - Fork 39
/
CreateInitialConditions.F90
56 lines (49 loc) · 1.76 KB
/
CreateInitialConditions.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
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! !
! FILE: CreateInitialConditions.F90 !
! CONTAINS: subroutine CreateInitialConditions !
! !
! PURPOSE: Initialization routine. Sets initial !
! conditions for velocity and temperature !
! !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine CreateInitialConditions
use param
use local_arrays, only: vy,vx,temp,vz
use decomp_2d, only: xstart,xend
use mpih
implicit none
integer :: j,k,i
real :: xxx,yyy,eps
eps=0.01d0
do i=xstart(3),xend(3)
do j=xstart(2),xend(2)
do k=1,nxm
vz(k,j,i)=0.0d0
yyy=xm(k)
xxx=yc(j)
vy(k,j,i)=(2.0d0*yyy-6.0d0*yyy**2+4.0d0*yyy**3) &
& *sin(3*xxx)*eps
yyy=xc(k)
xxx=ym(j)
vx(k,j,i)=-yyy**2*(1.0d0-yyy)**2*cos(3.1*xxx)*eps
enddo
enddo
enddo
!assign linear temperature profile in the nodes k=2 to k=nxm
do i=xstart(3),xend(3)
do j=xstart(2),xend(2)
do k=2,nxm
temp(k,j,i)=tempbp(j,i)-(tempbp(j,i)-temptp(j,i))*xc(k)/xc(nx)
enddo
enddo
enddo
!assign the boundary conditions at k=1 and k=nx
do i=xstart(3),xend(3)
do j=xstart(2),xend(2)
temp(1 ,j,i) = tempbp(j,i)
temp(nx,j,i) = temptp(j,i)
end do
end do
return
end