-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor LBB stability script + add 2D figure
- Loading branch information
1 parent
1ba23f3
commit 2fc0fed
Showing
6 changed files
with
142 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
## Checkpoint files | ||
## Output files | ||
*.h5 | ||
*.json | ||
|
||
|
||
## Meshes | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
all: taylor-hood-2d.png taylor-hood-3d.png taylor-hood-3d-2layer.png | ||
|
||
taylor-hood-2d.png: lbb-stability.py | ||
python3 lbb-stability.py --dimension 2 --output $@ | ||
results-2d.pdf: results-2d.json make_plots.py | ||
python make_plots.py --input $< --output $@ | ||
|
||
taylor-hood-3d.png: lbb-stability.py | ||
python3 lbb-stability.py --dimension 3 --output $@ | ||
|
||
taylor-hood-3d-2layer.png: lbb-stability.py | ||
python3 lbb-stability.py --dimension 3 --num-layers 2 --output $@ | ||
results-2d.json: lbb-stability.py | ||
python lbb-stability.py --dimension 2 --element mini --output $@ | ||
python lbb-stability.py --dimension 2 --element taylor-hood --output $@ | ||
python lbb-stability.py --dimension 2 --element crouzeix-raviart --output $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import json | ||
import argparse | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--input") | ||
parser.add_argument("--output") | ||
args = parser.parse_args() | ||
|
||
with open(args.input, "r") as input_file: | ||
data = json.load(input_file) | ||
|
||
fig, ax = plt.subplots() | ||
ax.set_title("Empirical inf-sup constants") | ||
ax.set_xscale("log", base=2) | ||
ax.set_ylim((0.0, 1.0)) | ||
ax.set_xlabel("Mesh spacing") | ||
ax.set_ylabel("inf-sup constant") | ||
for entry in data: | ||
element = entry["element"] | ||
hs, λs = zip(*entry["results"]) | ||
ax.scatter(hs, λs, label=element) | ||
ax.legend() | ||
fig.savefig(args.output, bbox_inches="tight") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters