PROGRAM NavierStokesSolver2D
IMPLICIT NONE
DOUBLE PRECISION Q(5, 4, 101, 101, 1001), n(4, 2, 101, 101),
.L(4, 101, 101), A(101, 101)
.X(5, 101), Y(5, 101, 101), T(1001)
DOUBLE PRECISION Xmax, R(3, 101), Tmax, dx, dy(3, 101), dt
.radius, height
INTEGER i, j, k, Imax, Jmax, Kmax
!Setting up the grids
dt = Tmax / (Kmax-1)
dx = Xmax / Imax
DO i=1, Imax
X(1, i) = (i - 1) * dx
X(2, i) = (i - 1) * dx
X(3, i) = (i - .5) * dx
X(4, i) = i * dx
X(5, i) = i * dx
R(1, i) = radius(X(1, i))
R(3, i) = radius(X(5, i))
R(2, i) = (R(1, i) + R(3, i)) / 2
dy(1, i) = 2 * R(1, i) / Jmax
dy(2, i) = 2 * R(2, i) / Jmax
dy(3, i) = 2 * R(3, i) / Jmax
DO j=1, Jmax
Y(1, i, j) = (j - 1) * dy(1, i) + height - R(1, i)
Y(2, i, j) = j * dy(1, i) + height - R(1, i)
Y(3, i, j) = (j - .5) * dy(2, i) + height - R(2, i)
Y(4, i, j) = (j - 1) * dy(3, i) + height - R(3, i)
Y(5, i, j) = j * dy(3, i) + height - R(3, i)
END DO
END DO
!Finding cell areas, side lengths, and normal vectors
DO i=1, Imax
DO j=1, Jmax
A(i, j) = dx * (dy(1, i) + dy(3, i)) / 2
L(1, i, j) = dy(1, i)
L(2, i, j) = sqrt((X(2,i) - X(3,i))**2 +
. (Y(2,i,j) - Y(3,i,j))**2)
L(3, i, j) = dy(3, i)
L(4, i, j) = sqrt((X(1,i) - X(4,i))**2 +
. (Y(1,i,j) - Y(4,i,j))**2)
n(1, 1, i, j) = -1
n(1, 2, i, j) = 0
n(2, 1, i, j) = (Y(3,i,j) - Y(2,i,j)) / L(2, i, j)
n(2, 2, i, j) = (X(2,i) - X(3,i)) / L(2, i, j)
n(3, 1, i, j) = 1
n(3, 2, i, j) = 0
n(4, 1, i, j) = (Y(1,i,j) - Y(4,i,j)) / L(2, i, j)
n(4, 2, i, j) = (X(4,i) - X(1,i)) / L(4, i, j)
END DO
END DO
END PROGRAM NavierStokesSolver2D
FUNCTION radius(x)
IMPLICIT NONE
DOUBLE PRECISION radius, x
radius = 1
RETURN
END
No comments:
Post a Comment