Skip to content

Commit

Permalink
HPC-specific modifications
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Latyshev committed Jan 21, 2025
1 parent e5e0da7 commit 41646c6
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ build/
*.synctex.gz
*.tdo
*.toc

*.out
15 changes: 12 additions & 3 deletions doc/demo/demo_plasticity_mohr_coulomb_mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@
# ### Preamble

# %%
import os, sys
sys.setdlopenflags(os.RTLD_NOW | os.RTLD_GLOBAL)
from mpi4py import MPI
from petsc4py import PETSc

Expand Down Expand Up @@ -113,10 +115,16 @@
psi = 30 * np.pi / 180 # [rad] dilatancy angle
theta_T = 26 * np.pi / 180 # [rad] transition angle as defined by Abbo and Sloan
a = 0.26 * c / np.tan(phi) # [MPa] tension cuff-off parameter
import argparse

parser = argparse.ArgumentParser(description="Demo Plasticity Mohr Coulomb MPI")
parser.add_argument("--N", type=int, default=50, help="Mesh size")
args = parser.parse_args()
N = args.N

# %%
L, H = (1.2, 1.0)
Nx, Ny = (100, 100)
Nx, Ny = (N, N)
gamma = 1.0 / 6778
domain = mesh.create_rectangle(MPI.COMM_WORLD, [np.array([0, 0]), np.array([L, H])], [Nx, Ny])

Expand Down Expand Up @@ -768,6 +776,7 @@ def constitutive_update():
# By demonstrating the loading-displacement curve on the figure below we approve
# that the yield strength limit reached for $\gamma_\text{lim}^\text{num}$ is close to $\gamma_\text{lim}$.

n = MPI.COMM_WORLD.Get_size()
# %%
if len(points_on_process) > 0:
l_lim = 6.69
Expand All @@ -778,10 +787,10 @@ def constitutive_update():
plt.ylabel(r"Soil self-weight $\gamma$ [MPa/mm$^3$]")
plt.grid()
plt.legend()
plt.savefig("mc_mpi.png")
plt.savefig(f"mc_mpi_{N}x{N}_n_{n}.png")

# %%
import pickle
performance_data = {"total_time": total_time, "performance_monitor": external_operator_problem.performance_monitor}
with open("performance_data", "wb") as f:
with open(f"performance_data_{N}x{N}_n_{n}", "wb") as f:
pickle.dump(performance_data, f)
24 changes: 24 additions & 0 deletions doc/demo/run_demo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash -l
#SBATCH -N 1
#SBATCH --ntasks-per-node=4
#SBATCH --cpus-per-task=1
#SBATCH --time=0-02:00:00
#SBATCH -p batch

#SBATCH --job-name=mohr_coulomb
#SBATCH --chdir=slurm_output/

echo "== Starting run at $(date)"
echo "== Job name: ${SLURM_JOB_NAME}"
echo "== Job ID: ${SLURM_JOBID}"
echo "== Node list: ${SLURM_NODELIST}"
echo "== Submit dir: ${SLURM_SUBMIT_DIR}"
echo "== Number of tasks: ${SLURM_NTASKS}"

spack env activate fenicsx-v09
cd ~/dolfinx-external-operator/doc/demo

srun -c 1 --exclusive -n $SLURM_NTASKS python demo_plasticity_mohr_coulomb_mpi.py --N 50

echo ""
echo "== Finished at $(date)"

0 comments on commit 41646c6

Please sign in to comment.