Skip to content

Commit 451d761

Browse files
committed
cleanup.
1 parent df579ef commit 451d761

File tree

2 files changed

+28
-44
lines changed

2 files changed

+28
-44
lines changed

examples/acoustics_1d_example1/bc1.jl

Lines changed: 28 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -35,92 +35,84 @@ function bc1(meqn::Int, mbc::Int, mx::Int, xlower::Float64, dx::Float64,
3535
#-------------------------------------------------------
3636
# # left boundary:
3737
#-------------------------------------------------------
38-
# go to (100,110,120,130) mthbc(1)+1
3938
#
4039
if mthbc[1] == 0
41-
# 100 continue
4240

4341
# user-specified boundary conditions go here in place of error output
4442
println("*** ERROR *** mthbc(1)=0 and no BCs specified in bc1")
43+
exit(-1)
4544

4645
elseif mthbc[1] == 1
4746

48-
# 110 continue
4947
# zero-order extrapolation:
5048
for ibc=1:mbc
5149
for m=1:meqn
5250
q[m,1-ibc] = q[m,1]
5351
end
5452
end
55-
# go to 199
53+
@goto l199
5654

5755
elseif mthbc[1] == 2
58-
# 120 continue
5956
# periodic:
6057
for ibc=1:mbc
6158
for m=1:meqn
6259
q[m,1-ibc] = q[m,mx+1-ibc]
6360
end
6461
end
65-
# go to 199
62+
@goto l199
6663

6764
elseif mthbc[1] == 3
68-
# 130 continue
69-
# # solid wall (assumes 2'nd component is velocity or momentum in x):
70-
for ibc=1:mbc
71-
for m=1:meqn
72-
q[m,1-ibc] = q[m,ibc]
73-
end
74-
q[2,1-ibc] = -q[2,ibc]
75-
end
76-
# # negate the normal velocity:
77-
# go to 199
78-
79-
# 199 continue
65+
# solid wall (assumes 2'nd component is velocity or momentum in x):
66+
for ibc=1:mbc
67+
for m=1:meqn
68+
q[m,1-ibc] = q[m,ibc]
69+
end
70+
q[2,1-ibc] = -q[2,ibc]
71+
end
72+
# negate the normal velocity:
73+
@goto l199
74+
8075
end # if mthbc[1] == ...
8176

77+
@label l199
78+
8279
#
8380
#-------------------------------------------------------
8481
# # right boundary:
8582
#-------------------------------------------------------
86-
# go to (200,210,220,230) mthbc(2)+1
87-
#
83+
8884
if mthbc[2] == 0
89-
# 200 continue
9085
# user-specified boundary conditions go here in place of error output
9186
println("*** ERROR *** mthbc(2)=0 and no BCs specified in bc2")
92-
# go to 299
87+
exit(-1)
9388

9489
elseif mthbc[2] == 1
95-
# 210 continue
9690
# zero-order extrapolation:
9791
for ibc=1:mbc
9892
for m=1:meqn
9993
q[m,mx+ibc] = q[m,mx]
10094
end
10195
end
102-
# go to 299
96+
return
10397

10498
elseif mthbc[2] == 2
105-
# 220 continue
106-
# # periodic:
99+
# periodic:
107100
for ibc=1:mbc
108101
for m=1:meqn
109102
q[m,mx+ibc] = q[m,ibc]
110103
end
111104
end
112-
# go to 299
105+
return
113106

114107
elseif mthbc[2] == 3
115-
# 230 continue
116-
# # solid wall (assumes 2'nd component is velocity or momentum in x):
117-
for ibc=1:mbc
118-
for m=1:meqn
119-
q[m,mx+ibc] = q[m,mx+1-ibc]
120-
end
121-
q[2,mx+ibc] = -q[2,mx+1-ibc]
122-
end
123-
# go to 299
108+
# solid wall (assumes 2'nd component is velocity or momentum in x):
109+
for ibc=1:mbc
110+
for m=1:meqn
111+
q[m,mx+ibc] = q[m,mx+1-ibc]
112+
end
113+
q[2,mx+ibc] = -q[2,mx+1-ibc]
114+
end
115+
return
124116

125117
end # if mthbc[2] == ...
126118
# 299 continue

examples/acoustics_1d_example1/claw1.jl

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -470,17 +470,12 @@ function claw1(parms::CParam,meqn::Int, mwaves::Int, maux::Int, mbc::Int, mx::In
470470
if method[1] == 1
471471
# save old q in case we need to retake step with smaller dt:
472472
#copyq1(meqn,mbc,mx,q,work(i0qwork))
473-
#q_save[:] = q[:]
474473
q_save = q
475474
end
476475

477476
#
478477
@label l40
479478

480-
481-
println("BEFORE endless loop n = $n maxn = $maxn t = $t dt = $dt")
482-
#println("TOP INSIDE endless loop n = $n")
483-
484479
dt2 = dt / 2.0
485480
#println("dt2: $dt2")
486481
thalf = t + dt2 # midpoint in time for Strang splitting
@@ -558,7 +553,6 @@ function claw1(parms::CParam,meqn::Int, mwaves::Int, maux::Int, mbc::Int, mx::In
558553
# reject this step
559554
t = told
560555
#copyq1(meqn,mbc,mx,work(i0qwork),q)
561-
#q[:] = q_save[:]
562556
q = q_save
563557

564558
if method[4] == 1
@@ -568,11 +562,9 @@ function claw1(parms::CParam,meqn::Int, mwaves::Int, maux::Int, mbc::Int, mx::In
568562

569563
if method[1] == 1
570564
# if variable dt, go back and take a smaller step
571-
println("CONTINUE INSIDE endless loop n = $n")
572565
@goto l40
573566
else # if fixed dt, give up and return
574567
cflmax = max(cfl,cflmax)
575-
println("BREAK INSIDE endless loop n = $n")
576568
break
577569
end
578570

0 commit comments

Comments
 (0)