Skip to content

Commit ba23cd5

Browse files
committed
TL: updated run_rbc script for scaling tests
1 parent 3862cf2 commit ba23cd5

File tree

2 files changed

+56
-14
lines changed

2 files changed

+56
-14
lines changed

pySDC/playgrounds/dedalus/problems/rbc.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,8 @@ def log(msg):
331331
tComp=t1-t0,
332332
MPI_SIZE=MPI_SIZE,
333333
MPI_BLOCKS=p.mpiBlocks,
334-
tCompAll=(t1-t0)*MPI_SIZE)
334+
tCompAll=(t1-t0)*MPI_SIZE
335+
)
335336
log('End of simulation')
336337
if MPI_RANK == 0:
337338
with open(f"{runDir}/01_finalized.txt", "w") as f:
Lines changed: 54 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,97 @@
11
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33
import argparse
4+
import json
45

5-
from pySDC.playgrounds.dedalus.problems.rbc import RBCProblem2D, RBCProblem3D
66

77
parser = argparse.ArgumentParser(
88
description='Run RBC simulation using Dedalus',
99
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
1010

1111
parser.add_argument(
1212
"runDir", help="name of the simulation directory")
13+
parser.add_argument(
14+
"--baseDt", "-dt", help="time-step used with resFactor=1",
15+
default=1e-2/2, type=float)
16+
parser.add_argument(
17+
"--tEnd", "-t", help="end simulation time (tBeg=0)",
18+
default=100, type=float)
1319

1420
parser.add_argument(
1521
"--dim", "-d", help="dimension for the simulation",
1622
default=2, type=int, choices=[2, 3])
1723
parser.add_argument(
18-
"--aspectRatio", "-ar", help="geometric aspect ratio, Lx = Ly = ar*Lz",
24+
"--aspectRatio", "-ar", help="geometric aspect ratio A, Lx = Ly = A*Lz",
1925
default=4, type=float)
2026
parser.add_argument(
21-
"--meshRatio", "-mr", help="mesh point ratio, Nx/Lx = Ny/Ly = mr*Nz/Lz",
27+
"--meshRatio", "-mr", help="mesh point ratio M, Nx/Lx = Ny/Ly = M*Nz/Lz",
2228
default=1, type=float)
2329
parser.add_argument(
24-
"--resFactor", "-rf", help="resolution factor, Nz = 64*rf (2D) or 32*rf (3D)",
30+
"--resFactor", "-rf", help="resolution factor R, Nz = 64*R (2D) or 32*R (3D)",
2531
default=1, type=float)
2632
parser.add_argument(
27-
"--Rayleigh", "-Ra", help="Rayleigh number",
33+
"--Rayleigh", "-Ra", help="Rayleigh number Ra",
2834
default=1e7, type=float)
2935
parser.add_argument(
30-
"--Prandtl", "-Pr", help="Prandtl number",
36+
"--Prandtl", "-Pr", help="Prandtl number Pr",
3137
default=1, type=float)
3238
parser.add_argument(
3339
"--initField", "-if", help="path for the initial field",
3440
default=None)
3541

36-
parser.add_argument(
37-
"--baseDt", "-dt", help="time-step used with resFactor=1",
38-
default=1e-2/2, type=float)
39-
parser.add_argument(
40-
"--tEnd", "-t", help="end simulation time (tBeg=0)",
41-
default=100, type=float)
4242
parser.add_argument(
4343
"--dtWrite", "-dtw", help="time-step for writing solution output",
4444
default=1, type=float)
4545
parser.add_argument(
4646
"--logEvery", "-l", help="log every [...] time-steps",
4747
default=100, type=int)
4848

49+
parser.add_argument(
50+
"--timeScheme", help="time integration method to be used",
51+
choices=["RK111", "RK222", "RK443", "SDC"])
52+
parser.add_argument(
53+
"--timeParallel", help="which time-parallelization to use with SDC",
54+
choices=["MPI", "MPI2"], default=False)
55+
parser.add_argument(
56+
"--groupTimeProcs", help="wether or not grouping the time processes",
57+
action="store_true")
58+
59+
parser.add_argument(
60+
"--nNodesSDC", help="number of time nodes per step for SDC",
61+
default=4, type=int)
62+
parser.add_argument(
63+
"--nNodesSDC", help="number of time nodes per step for SDC",
64+
default=4, type=int)
65+
parser.add_argument(
66+
"--nSweepSDC", help="number of sweep per step for SDC",
67+
default=4, type=int)
68+
parser.add_argument(
69+
"--implSweepSDC", help="implicit sweep type for SDC",
70+
default="MIN-SR-S")
71+
parser.add_argument(
72+
"--explSweepSDC", help="explicit sweep type for SDC",
73+
default="PIC")
74+
4975
args = parser.parse_args()
76+
77+
# imports library after parsing args (do not import with --help)
78+
from pySDC.playgrounds.dedalus.timestepper import SDCIMEX, MPI
79+
from pySDC.playgrounds.dedalus.problems.rbc import RBCProblem2D, RBCProblem3D
80+
5081
params = args.__dict__
5182

5283
dim = params.pop("dim")
5384
ProblemClass = RBCProblem2D if dim == 2 else RBCProblem3D
85+
SDCIMEX.setParameters(
86+
nNodes=params.pop("nNodesSDC"),
87+
nodeType="LEGENDRE", quadType="RADAU-RIGHT",
88+
nSweeps=params.pop("nSweepSDC"),
89+
initSweep="COPY",
90+
implSweep=params.pop("implSweepSDC"), explSweep=params.pop("explSweepSDC"),
91+
)
5492

5593

56-
ProblemClass.runSimulation(**params)
94+
prob = ProblemClass.runSimulation(**params)
95+
if MPI.COMM_WORLD.Get_rank() == 0:
96+
with open(f"{args.runDir}/infos.json", "w") as f:
97+
json.dump(prob.infos, f)

0 commit comments

Comments
 (0)