Professional Documents
Culture Documents
Flowcharts and Pseudo Codes
Flowcharts and Pseudo Codes
Flowcharts and Pseudo Codes
CODES
Waves on Shallow Water
MAY 1, 2022
GROUP 5
PROGRAM NAME: MAIN
START
use parameters
use var_model
INPUT
i
call initializer
Do i=2, nt
call eulers
END
MODULE NAME: parameters
INPUT
START
INPUT
nx = 101 g = 9.8065
ny = 101 pi = 3.141592
nt = 10001 HO =1.0
xstart = -5.0 omega = 1E-5
xend = 5.0 vd = 1E-3
ystart = -6.0 nu = 1.5E-5
yend = 6.0 prtrb = 0.01
tstart = 0.0
tend = 1000.0
Lx = xsend – xstart
Ly = yend – ystart
Lt = tend – tstart
dx = Lx / (nx-1)
dy = Ly / (ny-1)
dt = Lt / (nt-1)
OUTPUT
Lx, Ly, Lt
dx, dy, dt
END
MODULE NAME: var_model
START
call meshgrid2d
Use parameters (x, y, xx, yy, nx, ny)
INPUT do i1=1, nt
x, y, t
t(i1) = tstart + dt*(i1-1)
xx, yy
u, v, h, f do i1=1, ny
u (: , : , 1) = 0.0
END
v (: , : , 1) = 0.0
START
END
use parameters
use var_model
INPUT
i1
do i1=1, nx
do i1=1, ny
START
call indices
END
do i2=1, nx
call indices
SUBROUTINE NAME: indices
START
INPUT
i2, nx, xb, xc,xf
END
PSEUDO CODES
I. PROGRAM MAIN
1. Start
2. Predefined the use of parameter and use var_model.
3. Input i.
4. The process of call initializer.
5. Using the formula Do I=1, nt.
6. Function of rungekutta4.
7. End.
1. Start
2. Input the of nx, ny, nt, xstart, xend, ystart, yend, tstart, tend, g, pi, HO, Omega, vd, nu,
prtrb.
3. Use the formula Lx= xend-xstart, Ly= yend-ystart, Lt= tend-tstart, dx=Lx/(nx-1),
dy=Ly/(ny-1), dt=Lx/(nt-1).
4. The output will be Lx, Ly, Lt, dx, dy, dt.
5. End .
1. Start
2. Use of parameter
3. Input the variables x, y, t, xx, ty, u, v, h, f.
4. End
1. Start
2. Predefined the process of parameter and var_model
3. Input i1
4. Using the formula do i1=1, nx x(i1) = xstart + dx*(i1-1), do i1-1, ny y(i1) = ystart +
dy*(i1-1)
5. Connect the page
6. Predefined the process called meshgrid2d (x, y, xx, yy, nx, ny)
7. Use the formula do i1=1, nt
t(i1) = tstart + dt*(i1-1)
do i1=1, ny
f (: , i1) = 2.0*omega*sin(pi*y (i1)/Ly)
u (: , : , 1) = 0.0
v (: , : , 1) = 0.0
h (: , : , 1) = HO – prtrb*exp (-(xx**2.0 + yy**2.0))
8. End
V. PROGRAM CALCULATION
1. Start
2. Predefined the process of parameter and var_model
3. Input the variables hx, hy,ux, uy, vx, by, gx, gy, uxx, uyy, vxx, vyy, H, U, V, fv, fun
4. Use the formula of do j2 = 1, ny
5. Function call indices
6. Use the formula of do i2 = 1, nx
7. Function call indices
8. Connect the page
9. Use the formula of:
Hx= d/dx*((H+h) *u)
Hy= d/dy*((H+h) *v)
Ux= u*du/dx
Uy=v*du/dy
Vx=u*dv/dx
Vy=v*dv/dx
Gx= -g*(dh/dx)
Gy=-g*(dh/dy)
Uxx=d^2u/dx**2
Uyy=d^2u/dy**2
Vxx=d^2v/dx**2
Vyy=d^2v/dy**2
H=-(hx+hy)
U=-(ux+uy)+fv-gx-bu+(uxx+uyy)
V=-(vx+vy)+fu-gy-bv+(vxx+vyy)
10. End
VI. PROGRAM INDICES
1. Start
2. Input the i2, nx, xb, xc, xfxf
3. Use the formula of:
If (i2 ==1) then
Xb = nx
Xc = i2
Xf = i2+1
Else
Xb = i2-1
Xc = i2
Xf = i2 + 1
4. End