Skip to content

Commit 5077357

Browse files
authored
Merge pull request #303 from mandli/mv-b4step
Move `b4step` into `advanc` to solve `aux` array filling
2 parents 4add1f4 + 58ab34b commit 5077357

File tree

6 files changed

+29
-18
lines changed

6 files changed

+29
-18
lines changed

src/1d/advanc.f

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ subroutine advanc (level,nvar,dtlevnew,vtime,naux)
2626
c
2727
c ::::::::::::::; ADVANC :::::::::::::::::::::::::::::::::::::::::::
2828
c integrate all grids at the input 'level' by one step of its delta(t)
29-
c this includes: setting the ghost cells
29+
c this includes: setting the ghost cells
3030
c advancing the solution on the grid
3131
c adjusting fluxes for flux conservation step later
3232
c :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@@ -78,7 +78,7 @@ subroutine advanc (level,nvar,dtlevnew,vtime,naux)
7878
call cpu_time(cpu_finishBound)
7979
timeBound = timeBound + clock_finishBound - clock_startBound
8080
timeBoundCPU=timeBoundCPU+cpu_finishBound-cpu_startBound
81-
81+
8282
c
8383
c save coarse level values if there is a finer level for wave fixup
8484

@@ -91,7 +91,7 @@ subroutine advanc (level,nvar,dtlevnew,vtime,naux)
9191
dtlevnew = rinfinity
9292
cfl_level = 0.d0 !# to keep track of max cfl seen on each level
9393

94-
c
94+
c
9595
call system_clock(clock_startStepgrid,clock_rate)
9696
call cpu_time(cpu_startStepgrid)
9797

@@ -115,7 +115,7 @@ subroutine advanc (level,nvar,dtlevnew,vtime,naux)
115115

116116
!$OMP CRITICAL (newdt)
117117
dtlevnew = dmin1(dtlevnew,dtnew)
118-
!$OMP END CRITICAL (newdt)
118+
!$OMP END CRITICAL (newdt)
119119

120120
end do
121121
!$OMP END PARALLEL DO
@@ -126,8 +126,8 @@ subroutine advanc (level,nvar,dtlevnew,vtime,naux)
126126
tvoll(level) = tvoll(level) + clock_finish - clock_start
127127
tvollCPU(level) = tvollCPU(level) + cpu_finish - cpu_start
128128
timeStepgrid = timeStepgrid +clock_finish-clock_startStepgrid
129-
timeStepgridCPU=timeStepgridCPU+cpu_finish-cpu_startStepgrid
130-
129+
timeStepgridCPU=timeStepgridCPU+cpu_finish-cpu_startStepgrid
130+
131131
cflmax = dmax1(cflmax, cfl_level)
132132

133133
c
@@ -214,6 +214,9 @@ subroutine par_advanc (mptr,mitot,nvar,naux,dtnew)
214214

215215

216216
locaux = node(storeaux,mptr)
217+
call b4step1(nghost, nx, nvar, alloc(locnew),
218+
& rnode(cornxlo,mptr), hx, time, dt, naux,
219+
& alloc(locaux))
217220
c
218221
if (node(ffluxptr,mptr) .ne. 0) then
219222

src/1d/stepgrid.f

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ subroutine stepgrid(q,fm,fp,mitot,mbc,dt,dtnew,dx,
6262
c
6363
method(1) = 0
6464
c
65-
c
66-
call b4step1(mbc,mx,nvar,q,
67-
& xlowmbc,dx,time,dt,maux,aux)
65+
c This call has been moved out to advanc
66+
c call b4step1(mbc,mx,nvar,q,
67+
c & xlowmbc,dx,time,dt,maux,aux)
6868
c
6969
c
7070
c # take one step on the conservation law:

src/2d/advanc.f

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ subroutine par_advanc (mptr,mitot,mjtot,nvar,naux,dtnew)
198198
nx = node(ndihi,mptr) - node(ndilo,mptr) + 1
199199
ny = node(ndjhi,mptr) - node(ndjlo,mptr) + 1
200200
time = rnode(timemult,mptr)
201+
dt = possk(level)
201202

202203
!$ mythread = omp_get_thread_num()
203204

@@ -212,7 +213,7 @@ subroutine par_advanc (mptr,mitot,mjtot,nvar,naux,dtnew)
212213
c
213214
if (level .lt. mxnest) then
214215
ntot = mitot * mjtot * nvar
215-
cdir$ ivdep
216+
c dir$ ivdep
216217
do i = 1, ntot
217218
alloc(locold + i - 1) = alloc(locnew + i - 1)
218219
end do
@@ -226,9 +227,12 @@ subroutine par_advanc (mptr,mitot,mjtot,nvar,naux,dtnew)
226227
rvoll(level) = rvoll(level) + nx * ny
227228
!$OMP END CRITICAL(rv)
228229

229-
230+
c Call b4step2 here so that time dependent arrays can be filled properly
230231
locaux = node(storeaux,mptr)
231-
c
232+
call b4step2(nghost, nx, ny, nvar, alloc(locnew),
233+
& rnode(cornxlo,mptr), rnode(cornylo,mptr), hx, hy,
234+
& time, dt, naux, alloc(locaux))
235+
232236
if (node(ffluxptr,mptr) .ne. 0) then
233237
lenbc = 2*(nx/intratx(level-1)+ny/intraty(level-1))
234238
locsvf = node(ffluxptr,mptr)

src/2d/stepgrid.f

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ subroutine stepgrid(q,fm,fp,gm,gp,mitot,mjtot,mbc,dt,dtnew,dx,dy,
122122
C mwork1 = mwork - mused !# remaining space (passed to step2)
123123
124124
c
125-
c
126-
call b4step2(mbc,mx,my,nvar,q,
127-
& xlowmbc,ylowmbc,dx,dy,time,dt,maux,aux)
125+
c This call has been moved out to advanc
126+
C call b4step2(mbc,mx,my,nvar,q,
127+
C & xlowmbc,ylowmbc,dx,dy,time,dt,maux,aux)
128128
c
129129
c
130130
c # take one step on the conservation law:

src/3d/advanc.f

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,10 @@ subroutine par_advanc (mptr,mitot,mjtot,mktot,nvar,naux,dtnew)
229229

230230

231231
locaux = node(storeaux,mptr)
232+
call b4step3(nghost, nx, ny, nz, nvar, alloc(locnew),
233+
& rnode(cornxlo,mptr), rnode(cornylo,mptr),
234+
& rnode(cornzlo,mptr), hx, hy, hz, time, dt, naux,
235+
& alloc(locaux))
232236
c
233237
if (node(ffluxptr,mptr) .ne. 0) then
234238
lenbc = 2*( (nx/intratx(level-1))*(nz/intratz(level-1))

src/3d/stepgrid.f

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ subroutine stepgrid(q,fm,fp,gm,gp,hm,hp,mitot,mjtot,mktot,
110110
mused = i0next - 1 !# space already used
111111
mwork1 = mwork - mused !# remaining space (passed to step3)
112112

113-
c 2/28/02 : Added call to b4step3.
114-
call b4step3(mbc,mx,my,mz,nvar,q,
115-
& xlowmbc,ylowmbc,zlowmbc,dx,dy,dz,time,dt,maux,aux)
113+
c Moved call to b4step to advanc
114+
c call b4step3(mbc,mx,my,mz,nvar,q,
115+
c & xlowmbc,ylowmbc,zlowmbc,dx,dy,dz,time,dt,maux,aux)
116116

117117
c
118118
c

0 commit comments

Comments
 (0)