Skip to content

Commit 007e095

Browse files
committed
Update remaining source
1 parent 25852e4 commit 007e095

File tree

4 files changed

+59
-53
lines changed

4 files changed

+59
-53
lines changed

src/1d_classic/shallow/claw1.f

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ subroutine claw1(meqn,mwaves,maux,mbc,mx,
66
c ==============================================================
77
c
88
c Solves a hyperbolic system of conservation laws in one space dimension
9-
c of the general form
9+
c of the general form
1010
c
1111
c capa * q_t + A q_x = psi
1212
c
@@ -24,7 +24,7 @@ subroutine claw1(meqn,mwaves,maux,mbc,mx,
2424
c
2525
c The user must supply the following subroutines:
2626
c
27-
c bc1, rp1 subroutines specifying the boundary conditions and
27+
c bc1, rp1 subroutines specifying the boundary conditions and
2828
c Riemann solver.
2929
c These are described in greater detail below.
3030
c
@@ -44,7 +44,7 @@ subroutine claw1(meqn,mwaves,maux,mbc,mx,
4444
c These routines must be declared EXTERNAL in the main program.
4545
c For description of the calling sequences, see below.
4646
c
47-
c Dummy routines b4step1.f and src1.f are available in
47+
c Dummy routines b4step1.f and src1.f are available in
4848
c claw/clawpack/1d/lib
4949
c
5050
c
@@ -74,12 +74,12 @@ subroutine claw1(meqn,mwaves,maux,mbc,mx,
7474
c physical domain. In addition there are mbc grid cells
7575
c along each edge of the grid that are used for boundary
7676
c conditions.
77-
c
78-
c q(meqn, 1-mbc:mx+mbc)
77+
c
78+
c q(meqn, 1-mbc:mx+mbc)
7979
c On input: initial data at time tstart.
8080
c On output: final solution at time tend.
8181
c q(m,i) = value of mth component in the i'th cell.
82-
c Values within the physical domain are in q(m,i)
82+
c Values within the physical domain are in q(m,i)
8383
c for i = 1,2,...,mx
8484
c mbc extra cells on each end are needed for boundary conditions
8585
c as specified in the routine bc1.
@@ -102,15 +102,15 @@ subroutine claw1(meqn,mwaves,maux,mbc,mx,
102102
c stored in aux(mcapa,i).
103103
c In this case we require method(7).ge.mcapa.
104104
c
105-
c dx = grid spacing in x.
105+
c dx = grid spacing in x.
106106
c (for a computation in ax <= x <= bx, set dx = (bx-ax)/mx.)
107107
c
108108
c tstart = initial time.
109109
c
110110
c tend = Desired final time (on input).
111111
c If tend<tstart, then claw1 returns after a single successful
112112
c time step has been taken (single-step mode).
113-
c Otherwise, as many steps are taken as needed to reach tend,
113+
c Otherwise, as many steps are taken as needed to reach tend,
114114
c up to a maximum of nv(1).
115115
c = Actual time reached (on output).
116116
c
@@ -152,13 +152,13 @@ subroutine claw1(meqn,mwaves,maux,mbc,mx,
152152
c comes from the previous step, the Courant number will
153153
c not in general be exactly equal to the desired value
154154
c If the actual Courant number in the next step is
155-
c greater than 1, then this step is redone with a
155+
c greater than 1, then this step is redone with a
156156
c smaller dt.
157157
c
158158
c method(2) = 1 if Godunov's method is to be used, with no 2nd order
159159
c corrections.
160160
c = 2 if second order correction terms are to be added, with
161-
c a flux limiter as specified by mthlim.
161+
c a flux limiter as specified by mthlim.
162162
c
163163
c method(3) is not used in one-dimension.
164164
c
@@ -223,7 +223,7 @@ subroutine claw1(meqn,mwaves,maux,mbc,mx,
223223
c If mwork is too small then the program returns with info = 4
224224
c and prints the necessary value of mwork to unit 6.
225225
c
226-
c
226+
c
227227
c info = output value yielding error information:
228228
c = 0 if normal return.
229229
c = 1 if mbc.lt.2
@@ -241,7 +241,7 @@ subroutine claw1(meqn,mwaves,maux,mbc,mx,
241241
c User-supplied subroutines
242242
c -------------------------
243243
c
244-
c bc1 = subroutine that specifies the boundary conditions.
244+
c bc1 = subroutine that specifies the boundary conditions.
245245
c This subroutine should extend the values of q from cells
246246
c 1:mx to the mbc ghost cells along each edge of the domain.
247247
c
@@ -290,7 +290,7 @@ subroutine claw1(meqn,mwaves,maux,mbc,mx,
290290
c are passed in using auxl and auxr. Again, in the standard routines
291291
c auxl=auxr=aux in the call to rp1.
292292
c
293-
c On output,
293+
c On output,
294294
c wave(m,mw,i) is the m'th component of the jump across
295295
c wave number mw in the ith Riemann problem.
296296
c s(mw,i) is the wave speed of wave number mw in the
@@ -307,7 +307,7 @@ subroutine claw1(meqn,mwaves,maux,mbc,mx,
307307
c into the specification of amdq and apdq.
308308
c
309309
c src1 = subroutine for the source terms that solves the equation
310-
c capa * q_t = psi
310+
c capa * q_t = psi
311311
c over time dt.
312312
c
313313
c If method(5)=0 then the equation does not contain a source
@@ -338,7 +338,7 @@ subroutine claw1(meqn,mwaves,maux,mbc,mx,
338338
c other tasks which must be done every time step.
339339
c
340340
c The form of this subroutine is
341-
c
341+
c
342342
c -------------------------------------------------
343343
c subroutine b4step1(mbc,mx,meqn,q,xlower,dx,time,dt,maux,aux)
344344
c implicit double precision (a-h,o-z)
@@ -353,12 +353,12 @@ subroutine claw1(meqn,mwaves,maux,mbc,mx,
353353
c
354354
c Copyright 1994 -- 2002 R. J. LeVeque
355355
c
356-
c This software is made available for research and instructional use only.
356+
c This software is made available for research and instructional use only.
357357
c You may copy and use this software without charge for these non-commercial
358358
c purposes, provided that the copyright notice and associated text is
359359
c reproduced on all copies. For all other uses (including distribution of
360-
c modified versions), please contact the author at the address given below.
361-
c
360+
c modified versions), please contact the author at the address given below.
361+
c
362362
c *** This software is made available "as is" without any assurance that it
363363
c *** will work for your purposes. The software may in fact have defects, so
364364
c *** use the software at your own risk.
@@ -370,18 +370,18 @@ subroutine claw1(meqn,mwaves,maux,mbc,mx,
370370
c Author: Randall J. LeVeque
371371
c Applied Mathematics
372372
c Box 352420
373-
c University of Washington,
373+
c University of Washington,
374374
c Seattle, WA 98195-2420
375375
376376
c =========================================================================
377377
c
378378
c
379379
c
380-
c
380+
c
381381
c ======================================================================
382382
c Beginning of claw1 code
383383
c ======================================================================
384-
c
384+
c
385385

386386
use gauges_module, only: num_gauges, update_gauges,
387387
& print_gauges_and_reset_nextLoc
@@ -435,7 +435,7 @@ subroutine claw1(meqn,mwaves,maux,mbc,mx,
435435
i0wave = i0f + (mx + 2*mbc) * meqn
436436
i0s = i0wave + (mx + 2*mbc) * meqn * mwaves
437437
i0dtdx = i0s + (mx + 2*mbc) * mwaves
438-
i0qwork = i0dtdx + (mx + 2*mbc)
438+
i0qwork = i0dtdx + (mx + 2*mbc)
439439
i0amdq = i0qwork + (mx + 2*mbc) * meqn
440440
i0apdq = i0amdq + (mx + 2*mbc) * meqn
441441
i0dtdx = i0apdq + (mx + 2*mbc) * meqn
@@ -463,7 +463,7 @@ subroutine claw1(meqn,mwaves,maux,mbc,mx,
463463
c # save old q in case we need to retake step with smaller dt:
464464
call copyq1(meqn,mbc,mx,q,work(i0qwork))
465465
endif
466-
c
466+
c
467467
40 continue
468468
dt2 = dt / 2.d0
469469
thalf = t + dt2 !# midpoint in time for Strang splitting
@@ -532,8 +532,8 @@ subroutine claw1(meqn,mwaves,maux,mbc,mx,
532532
endif
533533
dtmin = dmin1(dt,dtmin)
534534
dtmax = dmax1(dt,dtmax)
535-
536-
535+
536+
537537
else
538538
dt = dtv(2)
539539
endif
@@ -563,13 +563,13 @@ subroutine claw1(meqn,mwaves,maux,mbc,mx,
563563
go to 900
564564
endif
565565
endif
566-
566+
567567
if (.not. topo_finalized) then
568568
! modify topo using dtopo arrays:
569569
call topo_update(t)
570570
call setaux(mbc,mx,xlower,dx,maux,aux)
571571
endif
572-
572+
573573
c
574574
c # see if we are done:
575575
nv(2) = nv(2) + 1
@@ -578,7 +578,7 @@ subroutine claw1(meqn,mwaves,maux,mbc,mx,
578578
100 continue
579579
c
580580
900 continue
581-
c
581+
c
582582
c # return information
583583
c
584584
if (method(1).eq.1 .and. t.lt.tend .and. nv(2) .eq. maxn) then
@@ -602,5 +602,5 @@ subroutine claw1(meqn,mwaves,maux,mbc,mx,
602602
call print_gauges_and_reset_nextLoc(ii,meqn)
603603
end do
604604

605-
return
605+
return
606606
end

src/2d/shallow/b4step2.f90

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
! ============================================
2-
subroutine b4step2(mbc,mx,my,meqn,q,xlower,ylower,dx,dy,t,dt,maux,aux,actualstep)
2+
subroutine b4step2(mbc, mx, my, meqn, q, xlower, ylower, dx, dy, t, dt, &
3+
maux, aux, actualstep)
34
! ============================================
45
!
56
! # called before each call to step
@@ -36,7 +37,7 @@ subroutine b4step2(mbc,mx,my,meqn,q,xlower,ylower,dx,dy,t,dt,maux,aux,actualstep
3637
real(kind=8), intent(inout) :: xlower, ylower, dx, dy, t, dt
3738
real(kind=8), intent(inout) :: q(meqn,1-mbc:mx+mbc,1-mbc:my+mbc)
3839
real(kind=8), intent(inout) :: aux(maux,1-mbc:mx+mbc,1-mbc:my+mbc)
39-
logical, intent (in) :: actualstep
40+
logical, intent(in) :: actualstep
4041

4142
! Local storage
4243
integer :: index,i,j,k,dummy
@@ -95,6 +96,8 @@ subroutine b4step2(mbc,mx,my,meqn,q,xlower,ylower,dx,dy,t,dt,maux,aux,actualstep
9596
endif
9697

9798
! Set wind and pressure aux variables for this grid
98-
call set_storm_fields(maux,mbc,mx,my,xlower,ylower,dx,dy,t,aux)
99+
if (actualstep) then
100+
call set_storm_fields(maux,mbc,mx,my,xlower,ylower,dx,dy,t,aux)
101+
end if
99102

100103
end subroutine b4step2

src/2d/shallow/multilayer/b4step2.f90

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
subroutine b4step2(mbc,mx,my,meqn,q,xlower,ylower,dx,dy,t,dt,maux,aux)
1+
subroutine b4step2(mbc, mx, my, meqn, q, xlower, ylower, dx, dy, t, dt, &
2+
maux, aux, actualstep)
23
! ============================================
3-
!
4+
!
45
! # called before each call to step
56
! # use to set time-dependent aux arrays or perform other tasks.
6-
!
7+
!
78
! This particular routine sets negative values of q(1,i,j) to zero,
89
! as well as the corresponding q(m,i,j) for m=1,meqn.
910
! This is for problems where q(1,i,j) is a depth.
1011
! This should occur only because of rounding error.
11-
!
12+
!
1213
! Also calls movetopo if topography might be moving.
1314

1415
use amr_module, only: xlowdomain => xlower
@@ -27,14 +28,15 @@ subroutine b4step2(mbc,mx,my,meqn,q,xlower,ylower,dx,dy,t,dt,maux,aux)
2728

2829
use multilayer_module, only: num_layers, KAPPA_UNIT, dry_tolerance
2930
use multilayer_module, only: check_richardson, richardson_tolerance
30-
31+
3132
implicit none
32-
33+
3334
! Subroutine arguments
3435
integer, intent(in) :: mbc,mx,my,meqn,maux
3536
real(kind=8), intent(in) :: xlower, ylower, dx, dy, t, dt
3637
real(kind=8), intent(inout) :: q(meqn,1-mbc:mx+mbc,1-mbc:my+mbc)
3738
real(kind=8), intent(inout) :: aux(maux,1-mbc:mx+mbc,1-mbc:my+mbc)
39+
logical, intent(in) :: actualstep
3840

3941
! Local storage
4042
integer :: index,i,j,k
@@ -58,14 +60,17 @@ subroutine b4step2(mbc,mx,my,meqn,q,xlower,ylower,dx,dy,t,dt,maux,aux)
5860
end forall
5961

6062
! Move the topography if needed
61-
if (aux_finalized < 2) then
63+
if (aux_finalized < 2 .and. actualstep) then
6264
call setaux(mbc, mx, my, xlower, ylower, dx, dy, maux, aux)
63-
endif
65+
endif
6466

65-
call set_storm_fields(maux,mbc,mx,my,xlower,ylower,dx,dy,t,aux)
67+
! Set wind and pressure aux variables for this grid
68+
if (actualstep) then
69+
call set_storm_fields(maux,mbc,mx,my,xlower,ylower,dx,dy,t,aux)
70+
end if
6671

6772
! Check Richardson number -- Only implemented for 2 layers
68-
if (num_layers == 2 .and. check_richardson) then
73+
if (num_layers == 2 .and. check_richardson .and. actualstep) then
6974
do i=1,mx
7075
do j=1,my
7176
dry_state = .false.

src/2d/shallow/multilayer/stepgrid.f

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ subroutine stepgrid(q,fm,fp,gm,gp,mitot,mjtot,mbc,dt,dtnew,dx,dy,
2828

2929
use geoclaw_module, only: grav, rho
3030
use amr_module
31-
use fgout_module, only: FGOUT_num_grids, FGOUT_fgrids,
31+
use fgout_module, only: FGOUT_num_grids, FGOUT_fgrids,
3232
& FGOUT_tcfmax, fgout_interp, fgout_grid,
3333
& FGOUT_ttol
3434
use multilayer_module, only: num_layers, dry_tolerance
@@ -54,7 +54,7 @@ subroutine stepgrid(q,fm,fp,gm,gp,mitot,mjtot,mbc,dt,dtnew,dx,dy,
5454
c
5555
FGOUT_tcfmax = -rinfinity
5656
level = node(nestlevel,mptr)
57-
57+
5858

5959
if (dump) then
6060
write(outunit,*)" at start of stepgrid: dumping grid ",mptr
@@ -115,7 +115,7 @@ subroutine stepgrid(q,fm,fp,gm,gp,mitot,mjtot,mbc,dt,dtnew,dx,dy,
115115
c
116116
tc0=time !# start of computational step
117117
tcf=tc0+dt !# end of computational step
118-
118+
119119
c Check if fgout interpolation needed before and after step:
120120

121121
allocate(fgout_interp_needed(FGOUT_num_grids))
@@ -128,7 +128,7 @@ subroutine stepgrid(q,fm,fp,gm,gp,mitot,mjtot,mbc,dt,dtnew,dx,dy,
128128
fgout_interp_needed(ng) = .false.
129129
else
130130
fgout_tnext = fgout%output_times(fgout%next_output_index)
131-
fgout_interp_needed(ng) =
131+
fgout_interp_needed(ng) =
132132
& ((fgout%x_low < xlowmbc + mx * dx) .and.
133133
& (fgout%x_hi > xlowmbc) .and.
134134
& (fgout%y_low < ylowmbc + my * dy) .and.
@@ -146,13 +146,13 @@ subroutine stepgrid(q,fm,fp,gm,gp,mitot,mjtot,mbc,dt,dtnew,dx,dy,
146146

147147

148148
c::::::::::::::::::::::::fgout Output:::::::::::::::::::::::::::::::::
149-
c This has been moved to tick.f, after advancing all patches on
149+
c This has been moved to tick.f, after advancing all patches on
150150
c finest level. No need to check on each patch separately.
151151
c::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
152152

153-
call b4step2(mbc,mx,my,nvar,q,
154-
& xlowmbc,ylowmbc,dx,dy,time,dt,maux,aux,actualstep)
155-
153+
! call b4step2(mbc,mx,my,nvar,q,
154+
! & xlowmbc,ylowmbc,dx,dy,time,dt,maux,aux,actualstep)
155+
156156
c::::::::::::::::::::::::FGOUT DATA before step:::::::::::::::::::::::
157157
c # fill in values at fgout points affected at time tc0
158158
do ng=1,FGOUT_num_grids
@@ -183,7 +183,7 @@ subroutine stepgrid(q,fm,fp,gm,gp,mitot,mjtot,mbc,dt,dtnew,dx,dy,
183183
& q,aux,dx,dy,dt,cflgrid,
184184
& fm,fp,gm,gp,rpn2,rpt2)
185185
c
186-
c
186+
c
187187
mptr_level = node(nestlevel,mptr)
188188

189189
c write(outunit,811) mptr, mptr_level, cflgrid
@@ -319,5 +319,3 @@ subroutine stepgrid(q,fm,fp,gm,gp,mitot,mjtot,mbc,dt,dtnew,dx,dy,
319319
c
320320
return
321321
end
322-
323-

0 commit comments

Comments
 (0)