Skip to content

Commit

Permalink
Merge branch 'fix-beam' into 'master'
Browse files Browse the repository at this point in the history
[nb] subprocess.run needs shell=True when args are given as string.

See merge request ogs/ogs!5166
  • Loading branch information
bilke committed Dec 11, 2024
2 parents abe67b2 + 15d11dc commit 039277f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
# %%
import matplotlib.pyplot as plt
import ogstools as ogs
from IPython.display import HTML, Image
from IPython.display import HTML

# %%
ogs.plot.setup.dpi = 30 # resolution
Expand Down Expand Up @@ -142,15 +142,6 @@ def plot_func(ax: plt.Axes, timevalue: float) -> None:
)
HTML(anim.to_jshtml())

# %% [markdown]
# ### Compare simulation results OGS-5 vs. OGS-6
#
# Here, we compare numerical results of OGS-6 to those of OGS-5.
# Settings of both simulators were chosen to be as identical as possible.
# Simulation times were and for $3300 s$ OGS-6 and $7800 s$ OGS-5, respectively.

# %%
Image(url="../elder/elder.gif")

# %% [markdown]
# ## Literature
Expand Down
15 changes: 13 additions & 2 deletions Tests/Data/PhaseField/beam_jupyter_notebook/beam.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,23 +154,32 @@ def ogs_beam(
run(
f"generateStructuredMesh -o {out_dir}/bar_.vtu -e hex --lx {beam_length} --nx {round(beam_length/h)} --ly {beam_height} --ny {round(beam_height/h)} --lz {beam_depth} --nz {round(beam_depth/h)} > {logfile}",
check=True,
shell=True,
)
run(
f"NodeReordering -i {out_dir}/bar_.vtu -o {out_dir}/bar.vtu >> {logfile}",
check=True,
shell=True,
)
run(
f"ExtractSurface -i {out_dir}/bar.vtu -o {out_dir}/bar_left.vtu -x 1 -y 0 -z 0 >> {logfile}",
check=True,
shell=True,
)
run(
f"extractSurface -i {out_dir}/bar.vtu -o {out_dir}/bar_right.vtu -x -1 -y 0 -z 0 >> {logfile}",
check=True,
shell=True,
)
run(
f"partmesh -s -o {out_dir} -i {out_dir}/bar.vtu >> {logfile}",
check=True,
shell=True,
)
run(f"partmesh -s -o {out_dir} -i {out_dir}/bar.vtu >> {logfile}", check=True)
run(
f"partmesh -m -n 3 -o {out_dir} -i {out_dir}/bar.vtu -- {out_dir}/bar_right.vtu {out_dir}/bar_left.vtu >> {logfile}",
check=True,
shell=True,
)
# change properties in prj file
model = ot.Project(
Expand Down Expand Up @@ -206,7 +215,9 @@ def ogs_beam(
t0 = time.time()
print(" > OGS started execution ...")
run(
f"mpirun -n 3 ogs {out_dir}/{prj_name} -o {output_dir} >> {logfile}", check=True
f"mpirun -n 3 ogs {out_dir}/{prj_name} -o {output_dir} >> {logfile}",
check=True,
shell=True,
)
tf = time.time()
print(" > OGS terminated execution. Elapsed time: ", round(tf - t0, 2), " s.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ If a binary runs on a different machine depends on a lot of factors. The followi

#### For redistribution

- `OGS_CPU_ARCHITECTURE`: set to `generic` for good balance between optimization and portability; set to `core2` for maximum portability, more info on [GCC docs](https://gcc.gnu.org/onlinedocs/gcc/gcc-command-options/machine-dependent-options/x86-options.html#cmdoption-x86-mtune)
- `OGS_CPU_ARCHITECTURE`: set to `generic` for good balance between optimization and portability; set to `core2` for maximum portability, more info on [GCC docs](https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html)

#### For optimization

- `OGS_CPU_ARCHITECTURE`: tot to `native` for best optimization for your current CPU, possible values are [listed here](https://stackoverflow.com/a/25095818/80480), more info on [GCC docs](https://gcc.gnu.org/onlinedocs/gcc/gcc-command-options/machine-dependent-options/x86-options.html#cmdoption-x86-mtune)
- `OGS_CPU_ARCHITECTURE`: tot to `native` for best optimization for your current CPU, possible values are [listed here](https://stackoverflow.com/a/25095818/80480), more info on [GCC docs](https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html)

</div>

Expand Down

0 comments on commit 039277f

Please sign in to comment.