Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Arepo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Volker Springel
Arepo
Commits
20b69921
Commit
20b69921
authored
Mar 20, 2020
by
Rainer Weinberger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Example gresho_2d: added error output option to choose resolution as input parameter.
parent
878b0022
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
6 deletions
+15
-6
examples/gresho_2d/check.py
examples/gresho_2d/check.py
+9
-3
examples/gresho_2d/create.py
examples/gresho_2d/create.py
+5
-2
examples/yee_2d/check.py
examples/yee_2d/check.py
+1
-1
No files found.
examples/gresho_2d/check.py
View file @
20b69921
...
...
@@ -45,6 +45,8 @@ DeltaMaxAllowed = 0.03 * (FloatType(CellsPerDimension) / 40.0)**-1.4
""" loop over all output files """
i_file
=
0
status
=
0
error_data
=
[]
while
True
:
""" try to read in snapshot """
directory
=
simulation_directory
+
"/output/"
...
...
@@ -112,6 +114,8 @@ while True:
## internal energy
abs_delta_utherm
=
np
.
abs
(
Uthermal
-
Uthermal_ref
)
L1_utherm
=
np
.
average
(
abs_delta_utherm
,
weights
=
Volume
)
error_data
.
append
(
np
.
array
([
L1_dens
,
L1_vel
,
L1_utherm
],
dtype
=
FloatType
))
""" printing results """
print
(
"Gresho_2d: L1 error of "
+
filename
+
":"
)
...
...
@@ -177,9 +181,11 @@ while True:
""" criteria for failing the test """
if
L1_dens
>
DeltaMaxAllowed
or
L1_vel
>
DeltaMaxAllowed
or
L1_utherm
>
DeltaMaxAllowed
:
s
ys
.
exit
(
-
1
)
s
tatus
=
1
i_file
+=
1
np
.
savetxt
(
simulation_directory
+
"/error_%03d.txt"
%
CellsPerDimension
,
np
.
array
(
error_data
,
dtype
=
FloatType
))
print
(
"normal exit"
)
""" normal exit """
sys
.
exit
(
0
)
sys
.
exit
(
status
)
examples/gresho_2d/create.py
View file @
20b69921
""" @package ./examples/Gresho_2d/create.py
Code that creates 2d Gresho vortex initial conditions
created by Rainer Weinberger, last modified 2
1.02.2019
-- comments welcome
created by Rainer Weinberger, last modified 2
0.03.2020
-- comments welcome
"""
#### load libraries
...
...
@@ -19,7 +19,10 @@ FloatType = np.float64 # double precision: np.float64, for single use np.float3
IntType
=
np
.
int32
Boxsize
=
FloatType
(
1.0
)
CellsPerDimension
=
IntType
(
40
)
if
len
(
sys
.
argv
)
>
3
:
CellsPerDimension
=
IntType
(
sys
.
argv
[
3
])
else
:
CellsPerDimension
=
IntType
(
40
)
## parameters
density_0
=
1.0
...
...
examples/yee_2d/check.py
View file @
20b69921
""" @package ./examples/Yee_2d/check.py
Code that checks results of 2d Yee vortex problem
created by Rainer Weinberger, last modified
07.01.2018
-- comments welcome
created by Rainer Weinberger, last modified
20.03.2020
-- comments welcome
"""
#### load libraries
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment