Peano
Loading...
Searching...
No Matches
sweargs.py
Go to the documentation of this file.
1# This file is part of the ExaHyPE2 project. For conditions of distribution and
2# use, please see the copyright notice at www.peano-framework.org
3import argparse
4
5import peano4.api
6import exahype2
7
8class SWEArgumentParser(argparse.ArgumentParser):
9 def __init__(self):
10 super(SWEArgumentParser, self).__init__(
11 description="ExaHyPE 2 - Shallow Water Application Argument Parser"
12 )
13
14 self.add_argument(
15 "-dt",
16 "--time-step-size",
17 type=float,
18 default=0.01,
19 help="Time step size for fixed time-stepping.",
20 )
21 self.add_argument(
22 "-cfl",
23 "--time-step-relaxation",
24 type=float,
25 default=0.5,
26 help="Time step relaxation safety factor for adaptive time-stepping.",
27 )
28
29 self.add_argument(
30 "-width",
31 "--width",
32 type=str,
33 help="Specify size of domain in meters as [x, y] as string (e.g. [10, 10], [7e6, 4e6]).",
34 )
35
36 self.add_argument(
37 "-offset",
38 "--offset",
39 type=str,
40 default=[0, 0],
41 help="Specify offset of domain in meters as [x, y] as string (e.g. [-10, -10], [-7e6, -4e6]).",
42 )
43
44 self.add_argument(
45 "-o",
46 "--output",
47 type=str,
48 default="solutions",
49 help="Output path for project solutions output. The project will create a new folder at the given path. Default is 'solutions'.",
50 )
51
52 self.add_argument(
53 "-pbc-x",
54 "--periodic-boundary-conditions-x",
55 action="store_true",
56 help="Use periodic boundary conditions in the x-axis.",
57 )
58 self.add_argument(
59 "-pbc-y",
60 "--periodic-boundary-conditions-y",
61 action="store_true",
62 help="Use periodic boundary conditions in the y-axis.",
63 )
64
65 self.add_argument(
66 "-m",
67 "--build-mode",
68 choices=peano4.api.output.CompileModes,
69 default=peano4.api.output.CompileModes[0], # Release
70 help="|".join(peano4.api.output.CompileModes),
71 )
72
73 self.add_argument(
74 "-et",
75 "--end-time",
76 type=float,
77 default=5.0,
78 help="End time of the simulation.",
79 )
80 self.add_argument(
81 "-ns",
82 "--number-of-snapshots",
83 type=int,
84 default=20,
85 help="Number of snapshots (plots).",
86 )
87
88 self.add_argument(
89 "-ps",
90 "--patch-size",
91 type=int,
92 default=16,
93 help="Number of finite volumes per axis (dimension) per patch.",
94 )
95 self.add_argument(
96 "-dg",
97 "--dg-order",
98 type=int,
99 default=5,
100 help="Order of discretisation for Discontinuous Galerkin.",
101 )
102 self.add_argument(
103 "-md",
104 "--min-depth",
105 type=float,
106 default=4,
107 help="Determines maximum size of a single cell on each axis.",
108 )
109 self.add_argument(
110 "-amr",
111 "--amr-levels",
112 type=int,
113 default=0,
114 help="Number of AMR grid levels on top of max. size of a cell.",
115 )
116
117 self.add_argument(
118 "--storage",
119 type=str,
120 choices=[e.name for e in exahype2.solvers.Storage],
121 default="CallStack",
122 help="The storage scheme to use."
123 )
124
125 available_load_balancing_strategies = [
126 "None",
127 "SpreadOut",
128 "SpreadOutHierarchically",
129 "SpreadOutOnceGridStagnates",
130 "RecursiveBipartition",
131 "SplitOversizedTree",
132 "cascade::SpreadOut_RecursiveBipartition",
133 "cascade::SpreadOut_SplitOversizedTree",
134 ]
135 self.add_argument(
136 "-lbs",
137 "--load-balancing-strategy",
138 choices=available_load_balancing_strategies,
139 default="SpreadOutOnceGridStagnates",
140 help="|".join(available_load_balancing_strategies),
141 )
142 self.add_argument(
143 "-lbq",
144 "--load-balancing-quality",
145 type=float,
146 default=0.99,
147 help="The quality of the load balancing.",
148 )
149 self.add_argument(
150 "--trees",
151 type=int,
152 default=-1,
153 help="Number of trees (partitions) per rank after initial decomposition.",
154 )
155 self.add_argument(
156 "--threads",
157 type=int,
158 default=0,
159 help="Number of threads per rank.",
160 )
161 self.add_argument(
162 "-stateless",
163 "--stateless",
164 action="store_true",
165 default=False,
166 help="Use stateless PDE terms (needed for GPU offloading).",
167 )
168 self.add_argument(
169 "-fpe",
170 "--fpe",
171 action="store_true",
172 help="Enable a floating-point exception handler.",
173 )