forked from bright1998/TCUP_GPS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsource.f
84 lines (74 loc) · 2.51 KB
/
source.f
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
c -------------------
subroutine source
c -------------------
use common
implicit double precision(a-h,o-z)
interface
subroutine gradient(ain,adx,ady,aout1,aout2,is,ie,js,je)
double precision,dimension(:,:),intent(in) :: ain
double precision,dimension(:),intent(in) :: adx,ady
double precision,dimension(:,:),intent(out) :: aout1,aout2
integer :: is,ie,js,je
end subroutine gradient
end interface
C Block for Allocating Working Array --- Please add new array freely ---
dimension :: warray0(1:i0,1:j0)
c#################################################################
c### You can add a steady source term (external force). ###
c### If it is unnecessary, you need not edit this source file. ###
c#################################################################
c Fexx(i,j) : the source term of the momentum equation in the x-direction.
c Fexy(i,j) : in the y-direction.
c Fexz(i,j) : in the z-direction.
c x(i) : the x-coordinate.
c y(j) : the y-coordinate.
c warray(i,j): working array, which you can use freely.
c Start of Editable Block -------------------------------------------
c###################################################################
c If you want to set up the potential like the gravitational energy,
c please use the array "warray".
c###################################################################
do j=1,j0
do i=1,i0
warray0(i,j) = 0.d0
enddo
enddo
c
c##################################################
c Need not calculate the gradient of the potential.
c Please use the subroutine "gradient".
c##################################################
c
call gradient(warray0,dx,dy,Fexx,Fexy,1,i0,1,j0)
c
c Don't forget to set up the boundary condition.
c Example
do j=1,j0
Fexx(1,j) = Fexx(2,j)
Fexx(i0,j) = Fexx(i0-1,j)
enddo
do i=1,i0
Fexy(i,1) = Fexy(i,2)
Fexy(i,j0) = Fexy(i,j0-1)
enddo
do j=1,j0
do i=1,i0
Fexx(i,j) = 0.d0
Fexy(i,j) =-9.8d0
Fexz(i,j) = 0.d0
enddo
enddo
c For CIP Method
do j=1,j0
do i=1,i0-1
Fexxm(i,j) = 0.5d0*(Fexx(i,j) + Fexx(i+1,j))
enddo
enddo
do j=1,j0-1
do i=1,i0
Fexym(i,j) = 0.5d0*(Fexy(i,j) + Fexy(i,j+1))
enddo
enddo
c End of Editable Block
return
end subroutine source