Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
Experiments
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DG
Experiments
Commits
8a47d407
Verified
Commit
8a47d407
authored
8 months ago
by
Florian Atteneder
Browse files
Options
Downloads
Patches
Plain Diff
burgers_sine: update plot scripts to include cvg rescaling
parent
63c497c3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
burgers_sine/plot_dg.jl
+40
-18
40 additions, 18 deletions
burgers_sine/plot_dg.jl
burgers_sine/plot_dg_selfcvg.jl
+13
-3
13 additions, 3 deletions
burgers_sine/plot_dg_selfcvg.jl
with
53 additions
and
21 deletions
burgers_sine/plot_dg.jl
+
40
−
18
View file @
8a47d407
...
...
@@ -8,7 +8,7 @@ include(joinpath(@__DIR__,"..","theme.jl"))
include
(
joinpath
(
@__DIR__
,
".."
,
"utils.jl"
))
function
make_plot
(
rootdir
::
String
,
dirs
::
Vector
)
function
make_plot
_u_mu
(
rootdir
::
String
,
dirs
::
Vector
)
for
dir
in
dirs
@assert
isdir
(
joinpath
(
rootdir
,
dir
))
"missing output directory
$
(joinpath(rootdir,dir))"
...
...
@@ -59,7 +59,9 @@ function make_plot(rootdir::String, dirs::Vector)
ax_u
=
Axis
(
gl_u
[
1
,
1
],
xlabel
=
L"x"
)
ax_μs
=
[
Axis
(
gl_μs
[
1
,
i
],
xlabel
=
L"x"
)
for
i
in
1
:
length
(
dirs
)
]
# plot density
rng
=
1
:
15
:
1024
scatter!
(
ax_u
,
fv_data
.
x
[
rng
],
fv_data
.
u
[
idx_tend
][
rng
],
color
=
colorant
"deeppink"
,
label
=
"FV, K = 1024"
)
ylabel_u
=
L"u(x)"
Label
(
fig
[
1
,
0
],
ylabel_u
,
tellwidth
=
true
,
tellheight
=
false
,
rotation
=
pi
/
2
,
halign
=:
left
)
...
...
@@ -70,8 +72,6 @@ function make_plot(rootdir::String, dirs::Vector)
color
=
colors
[
periodic_index
(
i
,
length
(
colors
))])
end
end
lines!
(
ax_u
,
fv_data
.
x
,
fv_data
.
u
[
idx_tend
],
color
=:
black
,
linestyle
=:
dot
,
label
=
"FV, K = 1024"
)
xlims!
(
ax_u
,
(
-
0.05
,
1.05
))
ylims!
(
ax_u
,
(
-
1.1
,
1.1
))
...
...
@@ -128,7 +128,7 @@ function make_plot(rootdir::String, dirs::Vector)
end
function
make_plot_no_viscosity
(
rootdir
::
String
,
dirs
::
Vector
)
function
make_plot_no_viscosity
(
rootdir
::
String
,
dirs
::
Vector
;
output
::
String
=
"output1d.h5"
)
for
dir
in
dirs
@assert
isdir
(
joinpath
(
rootdir
,
dir
))
"missing output directory
$
(joinpath(rootdir,dir))"
...
...
@@ -136,11 +136,14 @@ function make_plot_no_viscosity(rootdir::String, dirs::Vector)
### load
data
=
[
readdata
(
joinpath
(
rootdir
,
dir
),
[
"u"
],
output
=
"
output
1d.h5"
)
for
dir
in
dirs
]
output
=
output
)
for
dir
in
dirs
]
pars
=
[
TOML
.
parsefile
(
joinpath
(
rootdir
,
dir
,
"
$
(replace(dir,"
.
previous
"=>"")).toml"
))
for
dir
in
dirs
]
ns
=
[
par
[
"Mesh"
][
"n"
]
for
par
in
pars
]
ks
=
[
par
[
"Mesh"
][
"k"
]
for
par
in
pars
]
fv_data
=
readdata
(
joinpath
(
rootdir
,
"fv_muscl_1024"
),
[
"u"
],
output
=
"output1d.h5"
)
### sort wrt k
P
=
sortperm
(
ks
)
data
=
data
[
P
]
...
...
@@ -155,6 +158,7 @@ function make_plot_no_viscosity(rootdir::String, dirs::Vector)
idxs_tend
=
length
.
(
ts
)
idx_tend
=
minimum
(
idxs_tend
)
idx_tend_fv
=
(
allequal
(
idxs_tend
)
&&
idx_tend
==
length
(
first
(
ts
)))
?
length
(
fv_data
.
t
)
:
idx_tend
#######################################################################
# plotting #
...
...
@@ -165,7 +169,9 @@ function make_plot_no_viscosity(rootdir::String, dirs::Vector)
ax_u
=
Axis
(
gl_u
[
1
,
1
],
xlabel
=
L"x"
)
# plot density
rng
=
1
:
15
:
1024
scatter!
(
ax_u
,
fv_data
.
x
[
rng
],
fv_data
.
u
[
idx_tend_fv
][
rng
],
color
=
colorant
"deeppink"
,
label
=
"FV, K = 1024"
)
ylabel_u
=
L"u(x)"
Label
(
fig
[
1
,
0
],
ylabel_u
,
tellwidth
=
true
,
tellheight
=
false
,
rotation
=
pi
/
2
,
halign
=:
left
)
...
...
@@ -207,7 +213,7 @@ let
rootdir
=
@__DIR__
plotname_prefix
=
"
$
(basename(rootdir))_u_mu"
display_plot
=
true
fontsize
=
40
for
n
in
[
4
,
5
,
6
,
7
,
8
,
9
]
dirs
=
[
...
...
@@ -215,10 +221,9 @@ for n in [4,5,6,7,8,9]
"avmda_
$(n)
_41_cmax_1"
,
"avmda_
$(n)
_81_cmax_1"
,
]
fig
=
with_theme
(
theme
;
fontsize
=
34
)
do
make_plot
(
rootdir
,
dirs
)
fig
=
with_theme
(
theme
;
fontsize
)
do
make_plot
_u_mu
(
rootdir
,
dirs
)
end
display_plot
&&
display
(
fig
)
save
(
joinpath
(
rootdir
,
"
$(plotname_prefix)
_avmda_n
$(n)
_cmax_1.png"
),
fig
)
dirs
=
[
...
...
@@ -226,11 +231,30 @@ for n in [4,5,6,7,8,9]
"avmda_
$(n)
_41_cmax_5"
,
"avmda_
$(n)
_81_cmax_5"
,
]
fig
=
with_theme
(
theme
;
fontsize
=
34
)
do
make_plot
(
rootdir
,
dirs
)
fig
=
with_theme
(
theme
;
fontsize
)
do
make_plot
_u_mu
(
rootdir
,
dirs
)
end
display_plot
&&
display
(
fig
)
save
(
joinpath
(
rootdir
,
"
$(plotname_prefix)
_avmda_n
$(n)
_cmax_5.png"
),
fig
)
dirs
=
[
"avmda_
$(n)
_21_cmax_1"
,
"avmda_
$(n)
_41_cmax_1"
,
"avmda_
$(n)
_81_cmax_1"
,
]
fig
=
with_theme
(
theme
;
fontsize
)
do
make_plot_no_viscosity
(
rootdir
,
dirs
,
output
=
"interpolate.h5"
)
end
save
(
joinpath
(
rootdir
,
"
$(plotname_prefix)
_avmda_n
$(n)
_cmax_1_interpolation.png"
),
fig
)
dirs
=
[
"avmda_
$(n)
_21_cmax_5"
,
"avmda_
$(n)
_41_cmax_5"
,
"avmda_
$(n)
_81_cmax_5"
,
]
fig
=
with_theme
(
theme
;
fontsize
)
do
make_plot_no_viscosity
(
rootdir
,
dirs
,
output
=
"interpolate.h5"
)
end
save
(
joinpath
(
rootdir
,
"
$(plotname_prefix)
_avmda_n
$(n)
_cmax_5_interpolation.png"
),
fig
)
end
dirs
=
[
...
...
@@ -238,10 +262,9 @@ dirs = [
"dg_5_41"
,
"dg_5_81"
,
]
fig
=
with_theme
(
theme
;
fontsize
=
34
)
do
fig
=
with_theme
(
theme
;
fontsize
)
do
make_plot_no_viscosity
(
rootdir
,
dirs
)
end
display_plot
&&
display
(
fig
)
save
(
joinpath
(
rootdir
,
"
$(plotname_prefix)
_dg_n5.png"
),
fig
)
dirs
=
[
...
...
@@ -249,10 +272,9 @@ dirs = [
"dg_4_41"
,
"dg_4_81"
,
]
fig
=
with_theme
(
theme
;
fontsize
=
34
)
do
fig
=
with_theme
(
theme
;
fontsize
)
do
make_plot_no_viscosity
(
rootdir
,
dirs
)
end
display_plot
&&
display
(
fig
)
save
(
joinpath
(
rootdir
,
"
$(plotname_prefix)
_dg_n4.png"
),
fig
)
end
This diff is collapsed.
Click to expand it.
burgers_sine/plot_dg_selfcvg.jl
+
13
−
3
View file @
8a47d407
...
...
@@ -28,6 +28,9 @@ function make_plot(rootdir::String, dirs::Vector)
ks
=
ks
[
P
]
dirs
=
dirs
[
P
]
@assert
allequal
(
ns
)
n
=
first
(
ns
)
ts
=
[
d
.
t
for
d
in
data
]
xs
=
[
d
.
x
for
d
in
data
]
us
=
[
d
.
u
for
d
in
data
]
...
...
@@ -47,7 +50,7 @@ function make_plot(rootdir::String, dirs::Vector)
# plotting #
#######################################################################
fig
=
Figure
(
size
=
(
1
2
00
,
6
00
))
fig
=
Figure
(
size
=
(
1
4
00
,
5
00
))
gl_u
=
fig
[
1
,
1
]
=
GridLayout
()
ylabel_u
=
L"\log_2(|u_1(x) - u_2(x)|)"
...
...
@@ -62,6 +65,12 @@ function make_plot(rootdir::String, dirs::Vector)
end
lines!
(
ax_u
,
xs
[
i
],
log2
.
(
abs
.
(
du
[
end
#= final time =#
])),
label
=
lbl
,
color
=
colors
[
periodic_index
(
i
,
length
(
colors
))])
if
i
>
1
s
=
(
k2
/
k1
)
^
(
n
)
lines!
(
ax_u
,
xs
[
i
],
log2
.
(
s
*
abs
.
(
du
[
end
#= final time =#
])),
color
=
(
colors
[
periodic_index
(
i
-
1
,
length
(
colors
))],
0.5
),
linestyle
=:
dash
)
end
end
xlims!
(
ax_u
,
(
-
0.05
,
1.05
))
...
...
@@ -82,6 +91,7 @@ let
rootdir
=
@__DIR__
plotname_prefix
=
"
$
(basename(rootdir))_u_mu"
fontsize
=
40
for
n
in
[
4
,
5
,
6
,
7
,
8
,
9
]
dirs
=
[
...
...
@@ -90,7 +100,7 @@ for n in [4,5,6,7,8,9]
"avmda_
$(n)
_81_cmax_1"
,
"avmda_
$(n)
_161_cmax_1"
,
]
fig
=
with_theme
(
theme
;
fontsize
=
34
)
do
fig
=
with_theme
(
theme
;
fontsize
)
do
make_plot
(
rootdir
,
dirs
)
end
save
(
joinpath
(
rootdir
,
"
$(plotname_prefix)
_selfcvg_n
$(n)
_cmax_1.png"
),
fig
)
...
...
@@ -101,7 +111,7 @@ for n in [4,5,6,7,8,9]
"avmda_
$(n)
_81_cmax_5"
,
"avmda_
$(n)
_161_cmax_5"
,
]
fig
=
with_theme
(
theme
;
fontsize
=
34
)
do
fig
=
with_theme
(
theme
;
fontsize
)
do
make_plot
(
rootdir
,
dirs
)
end
save
(
joinpath
(
rootdir
,
"
$(plotname_prefix)
_selfcvg_n
$(n)
_cmax_5.png"
),
fig
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment