Skip to content

Commit

Permalink
Clean up some SW on the sphere example code.
Browse files Browse the repository at this point in the history
Use implicit none in src2.f90.
Initialize q array with zeros.
  • Loading branch information
ketch committed Oct 6, 2024
1 parent b049ac4 commit 1eec31c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion examples/shallow_sphere/Rossby_wave.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ def setup(use_petsc=False,solver_type='classic',outdir='./_output', disable_outp
# Set initial conditions
# ======================
# 1) Call fortran function
qtmp = np.ndarray(shape=(solver.num_eqn,mx+2*num_ghost,my+2*num_ghost), dtype=float, order='F')
qtmp = np.zeros(shape=(solver.num_eqn,mx+2*num_ghost,my+2*num_ghost), dtype=float, order='F')
qtmp = sw_sphere_problem.qinit(mx,my,num_ghost,mx,my,xlower,ylower,dx,dy,qtmp,auxtmp,Rsphere)
state.q[:,:,:] = qtmp[:,num_ghost:-num_ghost,num_ghost:-num_ghost]

Expand Down
20 changes: 11 additions & 9 deletions examples/shallow_sphere/src2.f90
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
! =======================================================
subroutine src2(maxmx,maxmy,num_eqn,num_ghost,mx,my,xlower,ylower, &
dx,dy,q,num_aux,aux,t,dt,Rsphere)
! =======================================================

subroutine src2(maxmx,maxmy,num_eqn,num_ghost,mx,my,xlower,ylower, &
dx,dy,q,num_aux,aux,t,dt,Rsphere)

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

implicit none

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

!f2py integer intent(in) maxmx
!f2py integer intent(in) maxmy
Expand Down

0 comments on commit 1eec31c

Please sign in to comment.