-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathconvdiffmain.f90
65 lines (51 loc) · 1.6 KB
/
convdiffmain.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
60
61
62
63
64
65
program convdiffmain
use solvergmres
use convdiff
implicit none
integer :: i
integer :: np
integer :: m,n,it
real*8, allocatable :: x0(:),x(:),b(:)
integer :: precondoption
print *,"**********************************************"
print *,"Solving convection diffusion boundary layer equations &
using upwind discretization"
print *,"**********************************************"
print *,"preconditioning options:"
print *,"1 no preconditioning"
print *,"2 mgrid preconditioning"
print *,"3 pjacobi preconditioning"
print *,"4 sor preconditioning"
read(*,*)precondoption
open(unit=5,file='soln.dat')
np = 4097
h = 1.d0/(np-1)
k = 0.1
c = 1.d0
phi0 = 0.d0
phiL = 1.d0
n = np
m = 10
it = 40
allocate(x0(n))
allocate(x(n))
allocate(b(n))
x0 = 0.d0
x = 0.d0
b = 0.d0
call findBupwind(b,n)
if(precondoption .eq. 1) then
call performgmres(b,x0,x,m,n,it,findAXupwind,noprecond)
else if(precondoption .eq. 2) then
call performgmres(b,x0,x,m,n,it,findAXupwind,mgridprecond)
else if(precondoption .eq. 3) then
call performgmres(b,x0,x,m,n,it,findAXupwind,pjacobiprecond)
else if(precondoption .eq. 4) then
call performgmres(b,x0,x,m,n,it,findAXupwind,sorprecond)
endif
!call performgmres(b,x0,x,m,n,it,findAXcentral,noprecond)
do i=1,n
write(5,'(F10.5 F10.5)'),(i-1)*h,x(i)
enddo
close(5)
end program convdiffmain