Skip to content

Commit c083be1

Browse files
committed
reformat; increase ncells; add @time.
1 parent bfeb2ec commit c083be1

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

examples/scalar_law/PROGRAM1/consdiff.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323

2424
function consdiff(fic::Int,lac::Int,fif::Int,laf::Int,fix::Int,lax::Int,
2525
ifirst::Int,ilast::Int,
26-
x::OffsetArray{Float64,1},flux::OffsetArray{Float64,1},
26+
x::OffsetArray{Float64,1},
27+
flux::OffsetArray{Float64,1},
2728
conservd::OffsetArray{Float64,1})
2829
# ******************************************************************
2930
# update conservd to new time

examples/scalar_law/PROGRAM1/linaddmain.jl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ include("consdiff.jl")
4444
include("upwind.jl")
4545

4646
function main()
47+
#const ncells = 100
4748
const ncells = 10000
4849

4950
u = OffsetArray(Float64, -2:ncells+1)
5051
x = OffsetArray(Float64, 0:ncells)
5152
flux = OffsetArray(Float64, 0:ncells)
5253
dfdu = OffsetArray(Float64, -2:ncells+1)
5354

54-
const nsteps = 100
55-
#const nsteps = 10000
55+
const nsteps = 10000
5656
const tmax = 0.8
5757
const cfl = 0.9
5858

@@ -87,16 +87,17 @@ function main()
8787
end
8888

8989
# write final results (plot later)
90-
#@unsafe for ic=0:ncells-1
91-
for ic=0:ncells-1
90+
@unsafe for ic=0:ncells-1
91+
#for ic=0:ncells-1
9292
xc = (x[ic]+x[ic+1])*0.5
9393
uc = u[ic]
94-
@printf("%e %e\n",xc,uc)
94+
#@printf("%e %e\n",xc,uc)
9595
end
9696

9797

9898
end # main
9999

100-
main()
100+
@time main()
101+
@time main()
101102

102103

examples/scalar_law/PROGRAM1/riemprob.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
#***********************************************************************
2323

2424
function initsl(ncells::Int, fc::Int, lc::Int, fx::Int, lx::Int, ifirst::Int, ilast::Int,
25-
conservd::OffsetArray{Float64,1}, x::OffsetArray{Float64,1})
25+
conservd::OffsetArray{Float64,1},
26+
x::OffsetArray{Float64,1})
2627
# ******************************************************************
2728
# interior values only; others defined by boundary conditions
2829
# ******************************************************************
@@ -64,9 +65,9 @@ function bcmesh(fim::Int,lam::Int,ncells::Int, x::OffsetArray{Float64,1})
6465
end
6566

6667
function bccells(fic::Int,lac::Int,ncells::Int, conservd::OffsetArray{Float64,1})
67-
# ******************************************************************
68-
# right side
69-
# ******************************************************************
68+
# ******************************************************************
69+
# right side
70+
# ******************************************************************
7071
if lac >= ncells
7172
# println("treating right side")
7273
@unsafe for ic=ncells:lac

0 commit comments

Comments
 (0)