Skip to content

Commit 1eec31c

Browse files
committed
Clean up some SW on the sphere example code.
Use implicit none in src2.f90. Initialize q array with zeros.
1 parent b049ac4 commit 1eec31c

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

examples/shallow_sphere/Rossby_wave.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ def setup(use_petsc=False,solver_type='classic',outdir='./_output', disable_outp
450450
# Set initial conditions
451451
# ======================
452452
# 1) Call fortran function
453-
qtmp = np.ndarray(shape=(solver.num_eqn,mx+2*num_ghost,my+2*num_ghost), dtype=float, order='F')
453+
qtmp = np.zeros(shape=(solver.num_eqn,mx+2*num_ghost,my+2*num_ghost), dtype=float, order='F')
454454
qtmp = sw_sphere_problem.qinit(mx,my,num_ghost,mx,my,xlower,ylower,dx,dy,qtmp,auxtmp,Rsphere)
455455
state.q[:,:,:] = qtmp[:,num_ghost:-num_ghost,num_ghost:-num_ghost]
456456

examples/shallow_sphere/src2.f90

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1-
! =======================================================
2-
subroutine src2(maxmx,maxmy,num_eqn,num_ghost,mx,my,xlower,ylower, &
3-
dx,dy,q,num_aux,aux,t,dt,Rsphere)
4-
! =======================================================
5-
1+
subroutine src2(maxmx,maxmy,num_eqn,num_ghost,mx,my,xlower,ylower, &
2+
dx,dy,q,num_aux,aux,t,dt,Rsphere)
63

74
! # Compute source term for Rossby-Haurwitz wave.
85
! # The source term models the Coriolis force using a 4-stage RK method
96
! # and the projection of the velocity components to the tangent plane.
107

8+
implicit none
119

12-
implicit double precision (a-h,o-z)
13-
dimension q(num_eqn, 1:mx, 1:my)
14-
dimension aux(num_aux, 1:mx, 1:my)
15-
double precision :: RK(4,3)
10+
real(kind=8) :: q(num_eqn, 1:mx, 1:my)
11+
real(kind=8) :: aux(num_aux, 1:mx, 1:my)
12+
real(kind=8) :: RK(4,3)
13+
real(kind=8) :: a, Omega, df, erx, ery, erz, qn, xc, yc, rad, theta
14+
real(kind=8) :: xp, yp, zp, phi, fcor, hu, hv, hw
15+
integer :: num_eqn, num_ghost, mx, my, num_aux, maxmx, maxmy
16+
integer :: i, j, m
17+
real(kind=8) :: xlower, ylower, dx, dy, t, dt, Rsphere
1618

1719
!f2py integer intent(in) maxmx
1820
!f2py integer intent(in) maxmy

0 commit comments

Comments
 (0)