Skip to content

Commit 2c30f97

Browse files
committed
initial commit
0 parents  commit 2c30f97

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+5301
-0
lines changed

.gitignore

+179
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
# Ignore everything under the build.
2+
build/*
3+
4+
# NO, this repo is data-free.
5+
*.dat
6+
*.slug
7+
8+
*slugCode2
9+
10+
# misc
11+
*.DS_Store
12+
*.swp
13+
*.dSYM/
14+
*~
15+
16+
17+
# Created by https://www.gitignore.io/api/fortran
18+
# Edit at https://www.gitignore.io/?templates=fortran
19+
20+
### Fortran ###
21+
# Prerequisites
22+
*.d
23+
24+
# Compiled Object files
25+
*.slo
26+
*.lo
27+
*.o
28+
*.obj
29+
30+
# Precompiled Headers
31+
*.gch
32+
*.pch
33+
34+
# Compiled Dynamic libraries
35+
*.so
36+
*.dylib
37+
*.dll
38+
39+
# Fortran module files
40+
*.mod
41+
*.smod
42+
43+
# Compiled Static libraries
44+
*.lai
45+
*.la
46+
*.a
47+
*.lib
48+
49+
# Executables
50+
*.exe
51+
*.out
52+
*.app
53+
54+
# End of https://www.gitignore.io/api/fortran
55+
56+
# Created by https://www.gitignore.io/api/python
57+
# Edit at https://www.gitignore.io/?templates=python
58+
59+
### Python ###
60+
# Byte-compiled / optimized / DLL files
61+
__pycache__/
62+
*.py[cod]
63+
*$py.class
64+
65+
# C extensions
66+
*.so
67+
68+
# Distribution / packaging
69+
.Python
70+
build/
71+
develop-eggs/
72+
dist/
73+
downloads/
74+
eggs/
75+
.eggs/
76+
lib/
77+
lib64/
78+
parts/
79+
sdist/
80+
var/
81+
wheels/
82+
share/python-wheels/
83+
*.egg-info/
84+
.installed.cfg
85+
*.egg
86+
MANIFEST
87+
88+
# PyInstaller
89+
# Usually these files are written by a python script from a template
90+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
91+
*.manifest
92+
*.spec
93+
94+
# Installer logs
95+
pip-log.txt
96+
pip-delete-this-directory.txt
97+
98+
# Unit test / coverage reports
99+
htmlcov/
100+
.tox/
101+
.nox/
102+
.coverage
103+
.coverage.*
104+
.cache
105+
nosetests.xml
106+
coverage.xml
107+
*.cover
108+
.hypothesis/
109+
.pytest_cache/
110+
111+
# Translations
112+
*.mo
113+
*.pot
114+
115+
# Django stuff:
116+
*.log
117+
local_settings.py
118+
db.sqlite3
119+
120+
# Flask stuff:
121+
instance/
122+
.webassets-cache
123+
124+
# Scrapy stuff:
125+
.scrapy
126+
127+
# Sphinx documentation
128+
docs/_build/
129+
130+
# PyBuilder
131+
target/
132+
133+
# Jupyter Notebook
134+
.ipynb_checkpoints
135+
136+
# IPython
137+
profile_default/
138+
ipython_config.py
139+
140+
# pyenv
141+
.python-version
142+
143+
# celery beat schedule file
144+
celerybeat-schedule
145+
146+
# SageMath parsed files
147+
*.sage.py
148+
149+
# Environments
150+
.env
151+
.venv
152+
env/
153+
venv/
154+
ENV/
155+
env.bak/
156+
venv.bak/
157+
158+
# Spyder project settings
159+
.spyderproject
160+
.spyproject
161+
162+
# Rope project settings
163+
.ropeproject
164+
165+
# mkdocs documentation
166+
/site
167+
168+
# mypy
169+
.mypy_cache/
170+
.dmypy.json
171+
dmypy.json
172+
173+
# Pyre type checker
174+
.pyre/
175+
176+
### Python Patch ###
177+
.venv/
178+
179+
# End of https://www.gitignore.io/api/python

README.md

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#SlugCode2
2+
3+
SlugCode2 is in early development stage.
4+
5+
##Install
6+
7+
```sh
8+
mkdir build
9+
../utils/setupSlug.py
10+
# edit Makefile.header
11+
make
12+
```
13+
14+
It will create Hydro/2D/FDM solver.
15+
16+
##TODOs
17+
18+
### FDM
19+
20+
[x] WENO
21+
[ ] GP
22+
[ ] PIF-SF
23+
24+
### Temporal
25+
26+
[x] RK2
27+
[ ] RK3
28+
[ ] RK4

plotter/bin/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Python plotters
2+
3+
Simple Python scripts use `slugger`. Install `slugger` before use it.

plotter/bin/plot1d

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
4+
import sys
5+
import slugger as slug
6+
import matplotlib.pyplot as plt
7+
from cycler import cycler
8+
9+
if __name__ == "__main__":
10+
11+
# taking command line args
12+
switch = sys.argv[1]
13+
data_files = sys.argv[2:]
14+
varlist = ['dens', 'pres', 'velx', 'eint']
15+
16+
if switch == 'all':
17+
18+
# initialize figures
19+
fig, axes = plt.subplots(2, 2)
20+
21+
# custom cycler
22+
cc = (cycler(color=list('rgb')) + cycler(marker=list('.*^')))
23+
24+
# set title, linestyle
25+
for var, ax in zip(varlist, axes.ravel()):
26+
ax.set_title(var)
27+
ax.set_prop_cycle(cc)
28+
29+
# actual plots
30+
for filename in data_files:
31+
data = slug.data1d.ascii(filename)
32+
33+
for var, ax in zip(varlist, axes.ravel()):
34+
data.plot(var, ax)
35+
36+
axes[0, 0].legend()
37+
plt.show()
38+
39+
else:
40+
# initialize figures
41+
fig, (ax1) = plt.subplots(1, 1)
42+
43+
# title & linestyle
44+
ax1.set_title(switch)
45+
cc = (cycler(color=list('rgb')) + cycler(marker=list('.*^')))
46+
ax1.set_prop_cycle(cc)
47+
48+
# actual plots
49+
for filename in data_files:
50+
data = slug.data1d.ascii(filename)
51+
data.plot(switch, ax1)
52+
53+
ax1.legend()
54+
plt.show()

plotter/bin/plot2d

+111
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
4+
import sys
5+
import slugger as slug
6+
import matplotlib.pyplot as plt
7+
8+
9+
if __name__ == '__main__':
10+
11+
# taking command line args
12+
switch = sys.argv[1]
13+
filename = sys.argv[2]
14+
varlist = ['dens', 'pres', 'velx', 'vely']
15+
16+
if (switch == 'all'):
17+
fig, axes = plt.subplots(2, 2)
18+
19+
# load data
20+
data = slug.load_data2d(filename)
21+
22+
# checking symmetric
23+
sym = data.check_symmetric('pres', tol=1.e-16)
24+
if(not sym):
25+
fig.suptitle('ASYMMETRIC DATA', color='r')
26+
27+
for var, ax in zip(varlist, axes.ravel()):
28+
data.plot_cmap(var, ax, cmap='prism')
29+
ax.set_aspect(aspect=1)
30+
31+
plt.show()
32+
33+
elif (switch == 'diff'):
34+
f2 = sys.argv[3]
35+
36+
d1 = slug.load_data2d(filename)
37+
d2 = slug.load_data2d(f2)
38+
39+
data = d1 - d2
40+
41+
fig, axes = plt.subplots(2, 2)
42+
43+
fig.suptitle('MAX_dens : ' + str(data.dens.max()))
44+
45+
for var, ax in zip(varlist, axes.ravel()):
46+
data.plot_cmap(var, ax, cmap='prism')
47+
ax.set_aspect(aspect=1)
48+
49+
plt.show()
50+
51+
elif (switch == 'cont'):
52+
fig, (ax) = plt.subplots(1, 1)
53+
data = slug.load_data2d(filename)
54+
55+
var = 'dens'
56+
57+
sym = data.check_symmetric(var, tol=1.e-16)
58+
if(not sym):
59+
fig.suptitle('ASYMMETRIC DATA [DENS]', color='r')
60+
61+
data.plot_cmap(var, ax, cmap='jet')
62+
data.plot_contour(var, ax, nlevel=40, linewidths=1,
63+
colors='k') # cmap='black')
64+
65+
ax.set_aspect(aspect=1)
66+
67+
plt.show()
68+
69+
elif (switch == 'sym'):
70+
fig, (ax1, ax2, ax3) = plt.subplots(1, 3)
71+
data = slug.load_data2d(filename)
72+
73+
var = 'dens'
74+
75+
data.plot_symlr(var, ax1, cmap='jet')
76+
data.plot_symud(var, ax2, cmap='jet')
77+
data.plot_sym45(var, ax3, cmap='jet')
78+
79+
ax1.set_aspect(aspect=1)
80+
ax2.set_aspect(aspect=1)
81+
ax3.set_aspect(aspect=1)
82+
83+
plt.show()
84+
85+
else:
86+
fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2)
87+
88+
# load data
89+
data = slug.load_data2d(filename)
90+
91+
# checking symmetric
92+
sym = data.check_symmetric(switch, tol=1.e-4)
93+
if(not sym):
94+
fig.suptitle('ASYMMETRIC DATA', color='r')
95+
96+
data.plot_cmap(switch, ax1, cmap='prism')
97+
data.plot_contour(switch, ax2, nlevel=40, colors='k') # cmap='black')
98+
99+
ax1.set_aspect(aspect=1)
100+
ax2.set_aspect(aspect=1)
101+
102+
data.plot_slicex(switch, ax3, 'r.-', label='x')
103+
# data.plot_slicey(switch, ax4, 'b*-')
104+
data.plot_slice45(switch, ax3, 'b*-', label='45')
105+
106+
data.plot_slicey(switch, ax4, 'r.-', label='y')
107+
data.plot_slice45(switch, ax4, 'b*-', label='45')
108+
109+
ax4.legend()
110+
ax3.legend()
111+
plt.show()

0 commit comments

Comments
 (0)