Skip to content

Commit

Permalink
Update experiments
Browse files Browse the repository at this point in the history
  • Loading branch information
s9latimm committed Oct 20, 2024
1 parent 3c80a55 commit 8dbb275
Show file tree
Hide file tree
Showing 14 changed files with 257 additions and 242 deletions.
62 changes: 25 additions & 37 deletions .eval.ps1
Original file line number Diff line number Diff line change
@@ -1,41 +1,29 @@
python -m src.nse -e step --id "eval_2/000/0" -i 1 -n .01 -d cuda -pFG -N 1000 -L 2
# python -m src.nse -e step --id "eval_4/2.1" -d cuda -pFG -N 1 -L 2 -n 0.005 -i 1
# python -m src.nse -e step --id "eval_4/2.2" -d cuda -pFG -N 1 -L 2 -n 0.01 -i 1
# python -m src.nse -e step --id "eval_4/2.3" -d cuda -pFG -N 1 -L 2 -n 0.01 -i 2
# python -m src.nse -e step --id "eval_4/2.4" -d cuda -pFG -N 1 -L 2 -n 0.01 -i 5
# python -m src.nse -e step --id "eval_4/2.5" -d cuda -pFG -N 1 -L 2 -n 0.02 -i 1

python -m src.nse -e step --id "eval_2/025/1" -i 1 -n .01 -d cuda -pFG -N 50000 -L 25:25
# python -m src.nse -e step --id "eval_2/025/2" -i 1 -n .01 -d cuda -pFG -N 30000 -L 25:25:25
python -m src.nse -e step --id "eval_2/025/3" -i 1 -n .01 -d cuda -pFG -N 50000 -L 25:25:25:25
#
# python -m src.nse -e step --id "eval_2/050/1" -i 1 -n .01 -d cuda -pFG -N 30000 -L 50:50
# python -m src.nse -e step --id "eval_2/050/2" -i 1 -n .01 -d cuda -pFG -N 30000 -L 50:50:50
# python -m src.nse -e step --id "eval_2/050/3" -i 1 -n .01 -d cuda -pFG -N 30000 -L 50:50:50:50
#
# python -m src.nse -e step --id "eval_2/075/1" -i 1 -n .01 -d cuda -pFG -N 30000 -L 75:75
# python -m src.nse -e step --id "eval_2/075/2" -i 1 -n .01 -d cuda -pFG -N 30000 -L 75:75:75
# python -m src.nse -e step --id "eval_2/075/3" -i 1 -n .01 -d cuda -pFG -N 30000 -L 75:75:75:75
#
# python -m src.nse -e step --id "eval_2/100/1" -i 1 -n .01 -d cuda -pFG -N 30000 -L 100:100
# python -m src.nse -e step --id "eval_2/100/2" -i 1 -n .01 -d cuda -pFG -N 30000 -L 100:100:100
# python -m src.nse -e step --id "eval_2/100/3" -i 1 -n .01 -d cuda -pFG -N 30000 -L 100:100:100:100
#
# python -m src.nse -e step --id "eval_2/125/1" -i 1 -n .01 -d cuda -pFG -N 30000 -L 125:125
# python -m src.nse -e step --id "eval_2/125/2" -i 1 -n .01 -d cuda -pFG -N 30000 -L 125:125:125
# python -m src.nse -e step --id "eval_2/125/3" -i 1 -n .01 -d cuda -pFG -N 30000 -L 125:125:125:125
#
# python -m src.nse -e step --id "eval_2/150/1" -i 1 -n .01 -d cuda -pFG -N 30000 -L 150:150
# python -m src.nse -e step --id "eval_2/150/2" -i 1 -n .01 -d cuda -pFG -N 30000 -L 150:150:150
# python -m src.nse -e step --id "eval_2/150/3" -i 1 -n .01 -d cuda -pFG -N 30000 -L 150:150:150:150
python -m src.nse -e empty --id "eval_4/1.1" -d cuda -pFG -N 1 -L 2 -n 0.005 -i 1
python -m src.nse -e empty --id "eval_4/1.2" -d cuda -pFG -N 1 -L 2 -n 0.01 -i 1
python -m src.nse -e empty --id "eval_4/1.3" -d cuda -pFG -N 1 -L 2 -n 0.01 -i 2
# python -m src.nse -e empty --id "eval_4/1.4" -d cuda -pFG -N 1 -L 2 -n 0.01 -i 5
# python -m src.nse -e empty --id "eval_4/1.5" -d cuda -pFG -N 1 -L 2 -n 0.02 -i 1

# python -m src.nse -e step --id "eval_2/050/4" -i 1 -n .01 -d cuda -pFG -N 30000 -L 50:50:50:50:50
#
# python -m src.nse -e step --id "eval_2/025/4" -i 1 -n .01 -d cuda -pFG -N 30000 -L 25:25:25:25:25
# python -m src.nse -e step --id "eval_2/025/5" -i 1 -n .01 -d cuda -pFG -N 30000 -L 25:25:25:25:25:25
# python -m src.nse -e step --id "eval_2/025/6" -i 1 -n .01 -d cuda -pFG -N 30000 -L 25:25:25:25:25:25:25
# python -m src.nse -e step --id "eval_2/025/7" -i 1 -n .01 -d cuda -pFG -N 30000 -L 25:25:25:25:25:25:25:25
python -m src.nse -e slalom --id "eval_4/3.1" -d cuda -pFG -N 1 -L 2 -n 0.005 -i 1
python -m src.nse -e slalom --id "eval_4/3.2" -d cuda -pFG -N 1 -L 2 -n 0.01 -i 1
python -m src.nse -e slalom --id "eval_4/3.3" -d cuda -pFG -N 1 -L 2 -n 0.01 -i 2
# python -m src.nse -e slalom --id "eval_4/3.4" -d cuda -pFG -N 1 -L 2 -n 0.01 -i 5
# python -m src.nse -e slalom --id "eval_4/3.5" -d cuda -pFG -N 1 -L 2 -n 0.02 -i 1

python -m src.nse -e block --id "eval_4/4.1" -d cuda -pFG -N 1 -L 2 -n 0.005 -i 1
python -m src.nse -e block --id "eval_4/4.2" -d cuda -pFG -N 1 -L 2 -n 0.01 -i 1
python -m src.nse -e block --id "eval_4/4.3" -d cuda -pFG -N 1 -L 2 -n 0.01 -i 2
# python -m src.nse -e block --id "eval_4/4.4" -d cuda -pFG -N 1 -L 2 -n 0.01 -i 5
# python -m src.nse -e block --id "eval_4/4.5" -d cuda -pFG -N 1 -L 2 -n 0.02 -i 1

python -m src.nse -e step --id "eval_2/175/1" -i 1 -n .01 -d cuda -pFG -N 30000 -L 175:175
python -m src.nse -e step --id "eval_2/175/2" -i 1 -n .01 -d cuda -pFG -N 30000 -L 175:175:175
python -m src.nse -e step --id "eval_2/175/3" -i 1 -n .01 -d cuda -pFG -N 30000 -L 175:175:175:175

python -m src.nse -e step --id "eval_2/200/1" -i 1 -n .01 -d cuda -pFG -N 30000 -L 200:200
python -m src.nse -e step --id "eval_2/200/2" -i 1 -n .01 -d cuda -pFG -N 30000 -L 200:200:200
python -m src.nse -e step --id "eval_2/200/3" -i 1 -n .01 -d cuda -pFG -N 30000 -L 200:200:200:200
python -m src.nse -e slit --id "eval_4/5.1" -d cuda -pFG -N 1 -L 2 -n 0.005 -i 1
python -m src.nse -e slit --id "eval_4/5.2" -d cuda -pFG -N 1 -L 2 -n 0.01 -i 1
python -m src.nse -e slit --id "eval_4/5.3" -d cuda -pFG -N 1 -L 2 -n 0.01 -i 2
# python -m src.nse -e slit --id "eval_4/5.4" -d cuda -pFG -N 1 -L 2 -n 0.01 -i 5
# # python -m src.nse -e slit --id "eval_4/5.5" -d cuda -pFG -N 1 -L 2 -n 0.02 -i 1
51 changes: 0 additions & 51 deletions evaluation.md

This file was deleted.

2 changes: 1 addition & 1 deletion resources
Submodule resources updated 2942 files
4 changes: 3 additions & 1 deletion src/base/view/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

PHI = (1. + np.sqrt(5.)) / 2.

print(sorted(font_manager.get_font_names()))
plt.rcParams['font.family'] = 'cmr10'
plt.rcParams['mathtext.fontset'] = 'cm'
plt.rcParams['axes.unicode_minus'] = False
Expand All @@ -28,3 +27,6 @@
plt.rcParams['xtick.minor.width'] = .5
plt.rcParams['ytick.major.width'] = 1
plt.rcParams['ytick.minor.width'] = .5

if __name__ == '__main__':
print(sorted(font_manager.get_font_names()))
12 changes: 6 additions & 6 deletions src/base/view/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,6 @@ def setup(self, ax: plt.Axes, title: str, boundary: Figure = None, figure: Figur
ax.set_yticks([0, 1, int(np.round(self.__y.max())) // 2, int(np.round(self.__y.max()))])
ax.set_ylim([int(np.round(self.__y.min())) - .05, int(np.round(self.__y.max())) + .05])

# ax.spines['top'].set_visible(False)
# ax.spines['right'].set_visible(False)

if boundary is not None:
for shape in boundary:
draw_shape(ax, shape)
Expand Down Expand Up @@ -208,7 +205,8 @@ def plot_seismic(
[j.y for j in marker],
marker='.',
color=COLORS[0],
zorder=3,
zorder=999999,
clip_on=False,
)

if mesh is not None:
Expand All @@ -220,11 +218,13 @@ def plot_seismic(
ax.scatter(
[j.x for j in ps],
[j.y for j in ps],
marker='o',
marker='D',
edgecolor='k',
c=vs,
cmap=SEISMIC_POSITIVE,
norm=colors.Normalize(vmin=0, vmax=max(vs)),
zorder=3,
zorder=99999,
clip_on=False,
)

cbar = fig.colorbar(
Expand Down
63 changes: 38 additions & 25 deletions src/nse/model/experiments/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from src.base.model.mesh import arrange, Grid, Axis
from src.base.model.shape import Rectangle, Figure, Line
from src.nse.model.experiments.experiment import Experiment
from src.nse.model.experiments.foam import Foam


class Block(Experiment):
Expand All @@ -13,47 +14,59 @@ def __init__(
flow: float = 1,
_: bool = False,
) -> None:
# grid = Grid(Axis('x', 0, 10).arrange(.01, True), Axis('y', 0, 2).arrange(.01, True))
# foam = Foam(
# FOAM_DIR / 'block_01',
# grid,
# .01,
# Figure(Line((0, 0), (10, 0)), Line((0, 2), (10, 2))),
# Figure(Rectangle((0, 0), (1, 1))),
# 0.01,
# 1.,
# )
step = .1
xs = Axis('x', 0, 10)
ys = Axis('y', 0, 2)
boundary = Figure(Line((0, 0), (10, 0)), Line((0, 2), (10, 2)))
obstruction = Figure(Rectangle((4.7, .7), (5.3, 1.3)))

foam = Foam(
xs,
ys,
step,
boundary,
obstruction,
nu,
rho,
flow,
)

super().__init__(
Block.__name__,
Axis('x', 0, 10),
Axis('y', 0, 2),
Figure(Line((0, 0), (10, 0)), Line((0, 2), (10, 2))),
Figure(Rectangle((4.7, .7), (5.3, 1.3))),
xs,
ys,
boundary,
obstruction,
nu,
rho,
Parabola(0, 2, flow),
# foam,
foam,
)

t = .1
s = t / 2
step = .1
stride = step / 2

# inlet
for y in arrange(0, 2, s):
for y in arrange(0, 2, stride):
self._inlet.emplace((0, y), u=self._in(y), v=0)
self._outlet.emplace((10, y))

# border
for x in arrange(s, 10 - s, s):
for x in arrange(stride, 10, stride):
self._knowledge.emplace((x, 0), u=0, v=0)
self._knowledge.emplace((x, 2), u=0, v=0)

for figure in self.obstruction:
for c in figure[::s]:
self._knowledge.emplace(c, u=0, v=0)
# block
for x in arrange(4.7, 5.3, stride):
self._knowledge.emplace((x, .7), u=0, v=0)
self._knowledge.emplace((x, 1.3), u=0, v=0)
for y in arrange(.7 + stride, 1.3 - stride, stride):
self._knowledge.emplace((4.7, y), u=0, v=0)
self._knowledge.emplace((5.3, y), u=0, v=0)

# training
grid = Grid(self.x.arrange(t), self.y.arrange(t))
grid = Grid(self.x.arrange(step), self.y.arrange(step))
for c in grid:
if c not in self._knowledge and c not in self._learning and c not in self.obstruction:
self._learning.emplace(c)
if self.x.start < c.x and self.y.start < c.y < self.y.stop:
if c not in self._knowledge and c not in self.obstruction:
self._learning.emplace(c)
18 changes: 10 additions & 8 deletions src/nse/model/experiments/cylinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,30 @@ def __init__(
nu,
rho,
Parabola(0, 2, flow),
None,
)

t = .1
s = t / 2
step = .1
stride = step / 2

# inlet
for y in arrange(0, 2, s):
for y in arrange(0, 2, stride):
self._inlet.emplace((0, y), u=self._in(y), v=0)
self._outlet.emplace((10, y))

# border
for x in arrange(s, 10, s):
for x in arrange(stride, 10, stride):
self._knowledge.emplace((x, 0), u=0, v=0)
self._knowledge.emplace((x, 2), u=0, v=0)

for figure in self.obstruction:
for c in figure[::s]:
for c in figure[::stride]:
if c not in self._knowledge:
self._knowledge.emplace(c, u=0, v=0)

# training
grid = Grid(self.x.arrange(t), self.y.arrange(t))
grid = Grid(self.x.arrange(step), self.y.arrange(step))
for c in grid:
if c not in self._knowledge and c not in self._learning and c not in self.obstruction:
self._learning.emplace(c)
if self.x.start < c.x and self.y.start < c.y < self.y.stop:
if c not in self._knowledge and c not in self.obstruction:
self._learning.emplace(c)
42 changes: 31 additions & 11 deletions src/nse/model/experiments/empty.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from src.base.model.mesh import arrange, Grid, Axis
from src.base.model.shape import Figure, Line
from src.nse.model.experiments.experiment import Experiment
from src.nse.model.experiments.foam import Foam


class Empty(Experiment):
Expand All @@ -13,32 +14,51 @@ def __init__(
flow: float = 1,
_: bool = False,
) -> None:
step = .1
xs = Axis('x', 0, 10)
ys = Axis('y', 0, 2)
boundary = Figure(Line((0, 0), (10, 0)), Line((0, 2), (10, 2)))
obstruction = Figure()

foam = Foam(
xs,
ys,
step,
boundary,
obstruction,
nu,
rho,
flow,
)

super().__init__(
Empty.__name__,
Axis('x', 0, 10),
Axis('y', 0, 2),
Figure(Line((0, 0), (10, 0)), Line((0, 2), (10, 2))),
Figure(),
xs,
ys,
boundary,
obstruction,
nu,
rho,
Parabola(0, 2, flow),
foam,
)

t = .1
s = t / 2
step = step
stride = step / 2

# inlet
for y in arrange(0, 2, s):
for y in arrange(0, 2, stride):
self._inlet.emplace((0, y), u=self._in(y), v=0)
self._outlet.emplace((10, y))

# border
for x in arrange(s, 10 - s, s):
for x in arrange(stride, 10, stride):
self._knowledge.emplace((x, 0), u=0, v=0)
self._knowledge.emplace((x, 2), u=0, v=0)

# training
grid = Grid(self.x.arrange(t), self.y.arrange(t))
grid = Grid(self.x.arrange(step), self.y.arrange(step))
for c in grid:
if c not in self._knowledge and c not in self._learning:
self._learning.emplace(c)
if self.x.start < c.x and self.y.start < c.y < self.y.stop:
if c not in self._knowledge and c not in self.obstruction:
self._learning.emplace(c)
Loading

0 comments on commit 8dbb275

Please sign in to comment.