zoomy-core 0.1.11__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of zoomy-core might be problematic. Click here for more details.
- zoomy_core/__init__.py +7 -0
- zoomy_core/decorators/decorators.py +25 -0
- zoomy_core/fvm/flux.py +52 -0
- zoomy_core/fvm/nonconservative_flux.py +97 -0
- zoomy_core/fvm/ode.py +55 -0
- zoomy_core/fvm/solver_numpy.py +297 -0
- zoomy_core/fvm/timestepping.py +13 -0
- zoomy_core/mesh/mesh.py +1236 -0
- zoomy_core/mesh/mesh_extrude.py +168 -0
- zoomy_core/mesh/mesh_util.py +487 -0
- zoomy_core/misc/custom_types.py +6 -0
- zoomy_core/misc/interpolation.py +140 -0
- zoomy_core/misc/io.py +439 -0
- zoomy_core/misc/logger_config.py +18 -0
- zoomy_core/misc/misc.py +213 -0
- zoomy_core/model/analysis.py +147 -0
- zoomy_core/model/basefunction.py +113 -0
- zoomy_core/model/basemodel.py +512 -0
- zoomy_core/model/boundary_conditions.py +193 -0
- zoomy_core/model/initial_conditions.py +171 -0
- zoomy_core/model/model.py +63 -0
- zoomy_core/model/models/GN.py +70 -0
- zoomy_core/model/models/advection.py +53 -0
- zoomy_core/model/models/basisfunctions.py +181 -0
- zoomy_core/model/models/basismatrices.py +377 -0
- zoomy_core/model/models/core.py +564 -0
- zoomy_core/model/models/coupled_constrained.py +60 -0
- zoomy_core/model/models/poisson.py +41 -0
- zoomy_core/model/models/shallow_moments.py +757 -0
- zoomy_core/model/models/shallow_moments_sediment.py +378 -0
- zoomy_core/model/models/shallow_moments_topo.py +423 -0
- zoomy_core/model/models/shallow_moments_variants.py +1509 -0
- zoomy_core/model/models/shallow_water.py +266 -0
- zoomy_core/model/models/shallow_water_topo.py +111 -0
- zoomy_core/model/models/shear_shallow_flow.py +594 -0
- zoomy_core/model/models/sme_turbulent.py +613 -0
- zoomy_core/model/models/vam.py +455 -0
- zoomy_core/postprocessing/postprocessing.py +72 -0
- zoomy_core/preprocessing/openfoam_moments.py +452 -0
- zoomy_core/transformation/helpers.py +25 -0
- zoomy_core/transformation/to_amrex.py +238 -0
- zoomy_core/transformation/to_c.py +181 -0
- zoomy_core/transformation/to_jax.py +14 -0
- zoomy_core/transformation/to_numpy.py +115 -0
- zoomy_core/transformation/to_openfoam.py +254 -0
- zoomy_core/transformation/to_ufl.py +67 -0
- zoomy_core-0.1.11.dist-info/METADATA +225 -0
- zoomy_core-0.1.11.dist-info/RECORD +51 -0
- zoomy_core-0.1.11.dist-info/WHEEL +5 -0
- zoomy_core-0.1.11.dist-info/licenses/LICENSE +674 -0
- zoomy_core-0.1.11.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import re
|
|
3
|
+
import textwrap
|
|
4
|
+
import sympy as sp
|
|
5
|
+
from sympy.printing.cxx import CXX11CodePrinter
|
|
6
|
+
|
|
7
|
+
class FoamPrinter(CXX11CodePrinter):
|
|
8
|
+
"""
|
|
9
|
+
Convert SymPy expressions to OpenFOAM 12 compatible C++ code.
|
|
10
|
+
- Q, Qaux: Foam::List<Foam::scalar>
|
|
11
|
+
- Matrices: Foam::List<Foam::List<Foam::scalar>>
|
|
12
|
+
- Vectors: Foam::vector (.x(), .y(), .z())
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def __init__(self, model, *args, **kwargs):
|
|
16
|
+
super().__init__(*args, **kwargs)
|
|
17
|
+
|
|
18
|
+
self.n_dof_q = model.n_variables
|
|
19
|
+
self.n_dof_qaux = model.n_aux_variables
|
|
20
|
+
|
|
21
|
+
# Map variable names to Q[i], Qaux[i]
|
|
22
|
+
self.map_Q = {k: f"Q[{i}]" for i, k in enumerate(model.variables.values())}
|
|
23
|
+
self.map_Qaux = {k: f"Qaux[{i}]" for i, k in enumerate(model.aux_variables.values())}
|
|
24
|
+
self.map_param = {k: str(float(model.parameter_values[i])) for i, k in enumerate(model.parameters.values())}
|
|
25
|
+
|
|
26
|
+
# Map normal/position to n.x(), n.y(), n.z()
|
|
27
|
+
self.map_normal = {k: ["n.x()", "n.y()", "n.z()"][i] for i, k in enumerate(model.normal.values())}
|
|
28
|
+
self.map_position = {k: ["X.x()", "X.y()", "X.z()"][i] for i, k in enumerate(model.position.values())}
|
|
29
|
+
|
|
30
|
+
self._std_regex = re.compile(r'std::([A-Za-z_]\w*)')
|
|
31
|
+
|
|
32
|
+
self._argument_table = {"Q": "const Foam::List<Foam::scalar>& Q",
|
|
33
|
+
"Qaux": "const Foam::List<Foam::scalar>& Qaux",
|
|
34
|
+
"n": "const Foam::vector& n",
|
|
35
|
+
"X": "const Foam::vector& X",
|
|
36
|
+
"time": "const Foam::scalar& time",
|
|
37
|
+
"dX": "const Foam::scalar& dX",
|
|
38
|
+
"z": "const Foam::scalar& z"
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
def create_lambertw(self):
|
|
42
|
+
return textwrap.dedent("""\
|
|
43
|
+
inline Foam::scalar lambertw(const Foam::scalar x)
|
|
44
|
+
{
|
|
45
|
+
// valid for x > -exp(-1)
|
|
46
|
+
Foam::scalar w = (x < 1.0 ? x : log(1.0 + x)); // good initial guess
|
|
47
|
+
for (int i = 0; i < 5; ++i)
|
|
48
|
+
{
|
|
49
|
+
Foam::scalar ew = exp(w);
|
|
50
|
+
Foam::scalar wew = w * ew;
|
|
51
|
+
Foam::scalar diff = wew - x;
|
|
52
|
+
w -= diff / (ew * (w + 1.0) - (w + 2.0) * diff / (2.0 * w + 2.0));
|
|
53
|
+
}
|
|
54
|
+
return w;
|
|
55
|
+
}
|
|
56
|
+
""")
|
|
57
|
+
|
|
58
|
+
def get_function_arguments(self, arguments):
|
|
59
|
+
out = ",\n".join([self._argument_table[arg] for arg in arguments])
|
|
60
|
+
return out
|
|
61
|
+
|
|
62
|
+
# --- Symbol printing --------------------------------------------------
|
|
63
|
+
def _print_Symbol(self, s):
|
|
64
|
+
for m in [self.map_Q, self.map_Qaux, self.map_param, self.map_normal, self.map_position]:
|
|
65
|
+
if s in m:
|
|
66
|
+
return m[s]
|
|
67
|
+
return super()._print_Symbol(s)
|
|
68
|
+
|
|
69
|
+
# --- Pow printing -----------------------------------------------------
|
|
70
|
+
def _print_Pow(self, expr):
|
|
71
|
+
base, exp = expr.as_base_exp()
|
|
72
|
+
if exp.is_Integer:
|
|
73
|
+
n = int(exp)
|
|
74
|
+
if n == 0:
|
|
75
|
+
return "1.0"
|
|
76
|
+
if n == 1:
|
|
77
|
+
return self._print(base)
|
|
78
|
+
if n < 0:
|
|
79
|
+
return f"(1.0 / Foam::pow({self._print(base)}, {abs(n)}))"
|
|
80
|
+
return f"Foam::pow({self._print(base)}, {n})"
|
|
81
|
+
return f"Foam::pow({self._print(base)}, {self._print(exp)})"
|
|
82
|
+
|
|
83
|
+
# Print as a plain C function call "lambertw(...)"
|
|
84
|
+
def _print_LambertW(self, expr):
|
|
85
|
+
return f"lambertw({self._print(expr.args[0])})"
|
|
86
|
+
|
|
87
|
+
# --- Expression conversion --------------------------------------------
|
|
88
|
+
def convert_expression_body(self, expr, target='res'):
|
|
89
|
+
tmp_sym = sp.numbered_symbols('t')
|
|
90
|
+
temps, simplified = sp.cse(expr, symbols=tmp_sym)
|
|
91
|
+
lines = []
|
|
92
|
+
for lhs, rhs in temps:
|
|
93
|
+
lines.append(f"Foam::scalar {self.doprint(lhs)} = {self.doprint(rhs)};")
|
|
94
|
+
for i in range(expr.rows):
|
|
95
|
+
for j in range(expr.cols):
|
|
96
|
+
lines.append(f"{target}[{i}][{j}] = {self.doprint(simplified[0][i, j])};")
|
|
97
|
+
return "\n ".join(lines)
|
|
98
|
+
|
|
99
|
+
# --- Matrix factory ---------------------------------------------------
|
|
100
|
+
def createMatrix(self, rows, cols):
|
|
101
|
+
return f"Foam::List<Foam::List<Foam::scalar>>({rows}, Foam::List<Foam::scalar>({cols}, 0.0))"
|
|
102
|
+
|
|
103
|
+
# --- Header / Footer --------------------------------------------------
|
|
104
|
+
def create_file_header(self, n_dof_q, n_dof_qaux, dim, list_sorted_function_names):
|
|
105
|
+
return textwrap.dedent(f"""\
|
|
106
|
+
#pragma once
|
|
107
|
+
#include "List.H"
|
|
108
|
+
#include "vector.H"
|
|
109
|
+
#include "scalar.H"
|
|
110
|
+
|
|
111
|
+
namespace Model
|
|
112
|
+
{{
|
|
113
|
+
constexpr int n_dof_q = {n_dof_q};
|
|
114
|
+
constexpr int n_dof_qaux = {n_dof_qaux};
|
|
115
|
+
constexpr int dimension = {dim};
|
|
116
|
+
const Foam::List<Foam::word> map_boundary_tag_to_function_index{{ {", ".join(f'"{item}"' for item in list_sorted_function_names)} }};
|
|
117
|
+
""")
|
|
118
|
+
|
|
119
|
+
def create_file_footer(self):
|
|
120
|
+
return "\n} // namespace Model\n"
|
|
121
|
+
|
|
122
|
+
def create_generic_function(self, name, expr, arguments, n_dof_q, n_dof_qaux, target='res'):
|
|
123
|
+
if isinstance(expr, list):
|
|
124
|
+
dim = len(expr)
|
|
125
|
+
return [self.create_function(f"{name}_{d}", expr[i], n_dof_q, n_dof_qaux)
|
|
126
|
+
for i, d in enumerate(['x', 'y', 'z'][:dim])]
|
|
127
|
+
|
|
128
|
+
rows, cols = expr.shape
|
|
129
|
+
body = self.convert_expression_body(expr, target)
|
|
130
|
+
return f"""
|
|
131
|
+
inline Foam::List<Foam::List<Foam::scalar>> {name}(
|
|
132
|
+
{self.get_function_arguments(arguments)})
|
|
133
|
+
{{
|
|
134
|
+
auto {target} = {self.createMatrix(rows, cols)};
|
|
135
|
+
{body}
|
|
136
|
+
return {target};
|
|
137
|
+
}}
|
|
138
|
+
"""
|
|
139
|
+
|
|
140
|
+
# --- Function generators ---------------------------------------------
|
|
141
|
+
def create_function(self, name, expr, n_dof_q, n_dof_qaux, target='res'):
|
|
142
|
+
if isinstance(expr, list):
|
|
143
|
+
dim = len(expr)
|
|
144
|
+
return [self.create_function(f"{name}_{d}", expr[i], n_dof_q, n_dof_qaux)
|
|
145
|
+
for i, d in enumerate(['x', 'y', 'z'][:dim])]
|
|
146
|
+
|
|
147
|
+
rows, cols = expr.shape
|
|
148
|
+
body = self.convert_expression_body(expr, target)
|
|
149
|
+
return f"""
|
|
150
|
+
inline Foam::List<Foam::List<Foam::scalar>> {name}(
|
|
151
|
+
const Foam::List<Foam::scalar>& Q,
|
|
152
|
+
const Foam::List<Foam::scalar>& Qaux)
|
|
153
|
+
{{
|
|
154
|
+
auto {target} = {self.createMatrix(rows, cols)};
|
|
155
|
+
{body}
|
|
156
|
+
return {target};
|
|
157
|
+
}}
|
|
158
|
+
"""
|
|
159
|
+
|
|
160
|
+
def create_function_normal(self, name, expr, n_dof_q, n_dof_qaux, dim, target='res'):
|
|
161
|
+
if isinstance(expr, list):
|
|
162
|
+
return [self.create_function_normal(f"{name}_{d}", expr[i], n_dof_q, n_dof_qaux, dim)
|
|
163
|
+
for i, d in enumerate(['x', 'y', 'z'][:dim])]
|
|
164
|
+
|
|
165
|
+
rows, cols = expr.shape
|
|
166
|
+
body = self.convert_expression_body(expr, target)
|
|
167
|
+
return f"""
|
|
168
|
+
inline Foam::List<Foam::List<Foam::scalar>> {name}(
|
|
169
|
+
const Foam::List<Foam::scalar>& Q,
|
|
170
|
+
const Foam::List<Foam::scalar>& Qaux,
|
|
171
|
+
const Foam::vector& n)
|
|
172
|
+
{{
|
|
173
|
+
auto {target} = {self.createMatrix(rows, cols)};
|
|
174
|
+
{body}
|
|
175
|
+
return {target};
|
|
176
|
+
}}
|
|
177
|
+
"""
|
|
178
|
+
|
|
179
|
+
def create_function_interpolate(self, name, expr, n_dof_q, n_dof_qaux, target='res'):
|
|
180
|
+
rows, cols = expr.shape
|
|
181
|
+
body = self.convert_expression_body(expr, target)
|
|
182
|
+
return f"""
|
|
183
|
+
inline Foam::List<Foam::List<Foam::scalar>> {name}(
|
|
184
|
+
const Foam::List<Foam::scalar>& Q,
|
|
185
|
+
const Foam::List<Foam::scalar>& Qaux,
|
|
186
|
+
const Foam::vector& X)
|
|
187
|
+
{{
|
|
188
|
+
auto {target} = {self.createMatrix(rows, cols)};
|
|
189
|
+
{body}
|
|
190
|
+
return {target};
|
|
191
|
+
}}
|
|
192
|
+
"""
|
|
193
|
+
|
|
194
|
+
def create_function_boundary(self, name, expr, n_dof_q, n_dof_qaux, dim, target='res'):
|
|
195
|
+
rows, cols = expr.shape
|
|
196
|
+
body = self.convert_expression_body(expr, target)
|
|
197
|
+
return f"""
|
|
198
|
+
inline Foam::List<Foam::List<Foam::scalar>> {name}(
|
|
199
|
+
const Foam::List<Foam::scalar>& Q,
|
|
200
|
+
const Foam::List<Foam::scalar>& Qaux,
|
|
201
|
+
const Foam::vector& n,
|
|
202
|
+
const Foam::vector& X,
|
|
203
|
+
const Foam::scalar& time,
|
|
204
|
+
const Foam::scalar& dX)
|
|
205
|
+
{{
|
|
206
|
+
auto {target} = {self.createMatrix(rows, cols)};
|
|
207
|
+
{body}
|
|
208
|
+
return {target};
|
|
209
|
+
}}
|
|
210
|
+
"""
|
|
211
|
+
|
|
212
|
+
# --- Full model generation ------------------------------------------
|
|
213
|
+
def create_model(self, model, additional_writes=None):
|
|
214
|
+
n_dof = model.n_variables
|
|
215
|
+
n_dof_qaux = model.n_aux_variables
|
|
216
|
+
dim = model.dimension
|
|
217
|
+
funcs = []
|
|
218
|
+
funcs.append(self.create_lambertw())
|
|
219
|
+
funcs += self.create_function('flux', model.flux(), n_dof, n_dof_qaux)
|
|
220
|
+
funcs += self.create_function('flux_jacobian', model.flux_jacobian(), n_dof, n_dof_qaux)
|
|
221
|
+
funcs += self.create_function('dflux', model.dflux(), n_dof, n_dof_qaux)
|
|
222
|
+
funcs += self.create_function('dflux_jacobian', model.dflux_jacobian(), n_dof, n_dof_qaux)
|
|
223
|
+
funcs += self.create_function('nonconservative_matrix', model.nonconservative_matrix(), n_dof, n_dof_qaux)
|
|
224
|
+
funcs += self.create_function('quasilinear_matrix', model.quasilinear_matrix(), n_dof, n_dof_qaux)
|
|
225
|
+
funcs.append(self.create_function_normal('eigenvalues', model.eigenvalues(), n_dof, n_dof_qaux, dim))
|
|
226
|
+
funcs.append(self.create_function('left_eigenvectors', model.left_eigenvectors(), n_dof, n_dof_qaux))
|
|
227
|
+
funcs.append(self.create_function('right_eigenvectors', model.right_eigenvectors(), n_dof, n_dof_qaux))
|
|
228
|
+
funcs.append(self.create_function('source', model.source(), n_dof, n_dof_qaux))
|
|
229
|
+
funcs.append(self.create_function('residual', model.residual(), n_dof, n_dof_qaux))
|
|
230
|
+
funcs.append(self.create_function('source_implicit', model.source_implicit(), n_dof, n_dof_qaux))
|
|
231
|
+
funcs.append(self.create_function_interpolate('interpolate', model.project_2d_to_3d(), n_dof, n_dof_qaux))
|
|
232
|
+
funcs.append(self.create_function_boundary(
|
|
233
|
+
'boundary_conditions',
|
|
234
|
+
model.boundary_conditions.get_boundary_condition_function(
|
|
235
|
+
model.time, model.position, model.distance,
|
|
236
|
+
model.variables, model.aux_variables, model.parameters, model.normal),
|
|
237
|
+
n_dof, n_dof_qaux, dim))
|
|
238
|
+
if additional_writes is not None:
|
|
239
|
+
for a in additional_writes:
|
|
240
|
+
funcs.append(self.create_generic_function(
|
|
241
|
+
a['name'], a['expression'], a['arguments'], n_dof, n_dof_qaux))
|
|
242
|
+
|
|
243
|
+
return self.create_file_header(n_dof, n_dof_qaux, dim, model.boundary_conditions.list_sorted_function_names) + "\n".join(funcs) + self.create_file_footer()
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
def write_code(model, settings, additional_writes=None):
|
|
247
|
+
printer = FoamPrinter(model)
|
|
248
|
+
code = printer.create_model(model, additional_writes=additional_writes)
|
|
249
|
+
main_dir = os.getenv("ZOOMY_DIR")
|
|
250
|
+
path = os.path.join(main_dir, settings.output.directory, ".foam_interface")
|
|
251
|
+
os.makedirs(path, exist_ok=True)
|
|
252
|
+
file_path = os.path.join(path, "Model.H")
|
|
253
|
+
with open(file_path, "w+") as f:
|
|
254
|
+
f.write(code)
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
from attrs import define
|
|
2
|
+
import ufl
|
|
3
|
+
from zoomy_core.transformation.to_numpy import NumpyRuntimeModel
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@define(kw_only=False, slots=True, frozen=True)
|
|
8
|
+
class UFLRuntimeModel(NumpyRuntimeModel):
|
|
9
|
+
printer=None
|
|
10
|
+
|
|
11
|
+
module = {
|
|
12
|
+
'ones_like': lambda x: 0*x + 1,
|
|
13
|
+
'zeros_like': lambda x: 0*x,
|
|
14
|
+
'array': ufl.as_vector,
|
|
15
|
+
'squeeze': lambda x: x,
|
|
16
|
+
|
|
17
|
+
# --- Elementary arithmetic ---
|
|
18
|
+
"Abs": abs,
|
|
19
|
+
"sign": ufl.sign,
|
|
20
|
+
"Min": ufl.min_value,
|
|
21
|
+
"Max": ufl.max_value,
|
|
22
|
+
# --- Powers and roots ---
|
|
23
|
+
"sqrt": ufl.sqrt,
|
|
24
|
+
"exp": ufl.exp,
|
|
25
|
+
"ln": ufl.ln,
|
|
26
|
+
"pow": lambda x, y: x**y,
|
|
27
|
+
# --- Trigonometric functions ---
|
|
28
|
+
"sin": ufl.sin,
|
|
29
|
+
"cos": ufl.cos,
|
|
30
|
+
"tan": ufl.tan,
|
|
31
|
+
"asin": ufl.asin,
|
|
32
|
+
"acos": ufl.acos,
|
|
33
|
+
"atan": ufl.atan,
|
|
34
|
+
"atan2": ufl.atan2,
|
|
35
|
+
# --- Hyperbolic functions ---
|
|
36
|
+
"sinh": ufl.sinh,
|
|
37
|
+
"cosh": ufl.cosh,
|
|
38
|
+
"tanh": ufl.tanh,
|
|
39
|
+
# --- Piecewise / conditional logic ---
|
|
40
|
+
"Heaviside": lambda x: ufl.conditional(x >= 0, 1.0, 0.0),
|
|
41
|
+
"Piecewise": ufl.conditional,
|
|
42
|
+
"signum": ufl.sign,
|
|
43
|
+
# --- Vector & tensor ops ---
|
|
44
|
+
"dot": ufl.dot,
|
|
45
|
+
"inner": ufl.inner,
|
|
46
|
+
"outer": ufl.outer,
|
|
47
|
+
"cross": ufl.cross,
|
|
48
|
+
# --- Differential operators (used in forms) ---
|
|
49
|
+
"grad": ufl.grad,
|
|
50
|
+
"div": ufl.div,
|
|
51
|
+
"curl": ufl.curl,
|
|
52
|
+
# --- Common constants ---
|
|
53
|
+
"pi": ufl.pi,
|
|
54
|
+
"E": ufl.e,
|
|
55
|
+
# --- Matrix and linear algebra ---
|
|
56
|
+
"transpose": ufl.transpose,
|
|
57
|
+
"det": ufl.det,
|
|
58
|
+
"inv": ufl.inv,
|
|
59
|
+
"tr": ufl.tr,
|
|
60
|
+
# --- Python builtins (SymPy may emit these) ---
|
|
61
|
+
"abs": abs,
|
|
62
|
+
"min": ufl.min_value,
|
|
63
|
+
"max": ufl.max_value,
|
|
64
|
+
"sqrt": ufl.sqrt,
|
|
65
|
+
"sum": lambda x: ufl.Constant(sum(x)) if isinstance(x, (list, tuple)) else x,
|
|
66
|
+
"ImmutableDenseMatrix": lambda x: x,
|
|
67
|
+
}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: zoomy_core
|
|
3
|
+
Version: 0.1.11
|
|
4
|
+
Summary: A simulation software for dimensionally-reduced free surface flows.
|
|
5
|
+
Author-email: Ingo Steldermann <steldermann@mbd.rwth-aachen.de>
|
|
6
|
+
License: GNU
|
|
7
|
+
Project-URL: Homepage, https://github.com/mbd-rwth/Zoomy
|
|
8
|
+
Project-URL: Documentation, https://mbd-rwth.github.io/Zoomy
|
|
9
|
+
Project-URL: Source, https://github.com/mbd-rwth/Zoomy
|
|
10
|
+
Project-URL: Issues, https://github.com/mbd-rwth/Zoomy/issues
|
|
11
|
+
Keywords: simulation,shallow flow,free surface flow,shallow moments,shallow water,VAM
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Framework :: Jupyter
|
|
16
|
+
Requires-Python: >=3.9
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: attrs
|
|
20
|
+
Requires-Dist: sympy>=1.14
|
|
21
|
+
Requires-Dist: numpy
|
|
22
|
+
Requires-Dist: scipy
|
|
23
|
+
Requires-Dist: loguru
|
|
24
|
+
Requires-Dist: h5py
|
|
25
|
+
Requires-Dist: matplotlib
|
|
26
|
+
Requires-Dist: meshio
|
|
27
|
+
Requires-Dist: pytest
|
|
28
|
+
Provides-Extra: gui
|
|
29
|
+
Requires-Dist: pyvista; extra == "gui"
|
|
30
|
+
Requires-Dist: trame; extra == "gui"
|
|
31
|
+
Requires-Dist: trame-vtk; extra == "gui"
|
|
32
|
+
Requires-Dist: trame-vuetify; extra == "gui"
|
|
33
|
+
Requires-Dist: panel; extra == "gui"
|
|
34
|
+
Provides-Extra: coupling
|
|
35
|
+
Requires-Dist: precice; extra == "coupling"
|
|
36
|
+
Provides-Extra: testing
|
|
37
|
+
Requires-Dist: swashes; extra == "testing"
|
|
38
|
+
Requires-Dist: pyswashes; extra == "testing"
|
|
39
|
+
Provides-Extra: mesh
|
|
40
|
+
Requires-Dist: gmsh; extra == "mesh"
|
|
41
|
+
Requires-Dist: python-gmsh; extra == "mesh"
|
|
42
|
+
Requires-Dist: rasterio; extra == "mesh"
|
|
43
|
+
Provides-Extra: dev
|
|
44
|
+
Requires-Dist: watchfiles; extra == "dev"
|
|
45
|
+
Requires-Dist: Cython; extra == "dev"
|
|
46
|
+
Requires-Dist: pytest-html; extra == "dev"
|
|
47
|
+
Dynamic: license-file
|
|
48
|
+
|
|
49
|
+
# Zoomy
|
|
50
|
+
|
|
51
|
+
Flexible modeling and simulation software for free-surface flows.
|
|
52
|
+
|
|
53
|
+

|
|
54
|
+
|
|
55
|
+
Zoomy's main objective is to provide a convenient modeling interface for complex free-surface flow models. Zoomy transitions from a **symbolic** modeling layer to **numerical** layer, compatible with a multitude of numerical solvers, e.g. Numpy, Jax, Firedrake, FenicsX, OpenFOAM and AMReX. Additionally, we support the PreCICE coupling framework in many of our numerical implementations, to allow for a convenient integration of our solver with your existing code.
|
|
56
|
+
|
|
57
|
+
## Documentation
|
|
58
|
+
|
|
59
|
+
See our [Documentation](https://mbd-rwth.github.io/Zoomy/) for details on
|
|
60
|
+
|
|
61
|
+
- how to get started
|
|
62
|
+
- tutorials
|
|
63
|
+
- examples
|
|
64
|
+
- API
|
|
65
|
+
- ...
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
The Zoomy code is free open-source software, licensed under version 3 or later of the GNU General Public License. See the file [LICENSE](LICENSE) for full copying permissions.
|
|
70
|
+
|
|
71
|
+
## BibTex Citation
|
|
72
|
+
|
|
73
|
+
T.b.d.
|
|
74
|
+
|
|
75
|
+
## Installation
|
|
76
|
+
|
|
77
|
+
### Conda/Mamba
|
|
78
|
+
|
|
79
|
+
The project is composed out of different environment files. We start by installing the base and than adding 'flavors', depdening on the solver backend that you want to use.
|
|
80
|
+
|
|
81
|
+
#### Default solver (Linux / Mac)
|
|
82
|
+
|
|
83
|
+
**Base Installation**
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
cd install
|
|
87
|
+
conda env create -f install/zoomy.yml
|
|
88
|
+
./conda_config_setup.sh
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**Mesh support for Numpy/Jax solver**
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
conda env update -f install/env-mesh.yml
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
\*\* CPU/GPU solver with JAX\*\*
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
conda env update -f install/env-jax.yml
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
#### FenicsX (Linux / Mac)
|
|
104
|
+
|
|
105
|
+
**Base Installation**
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
cd install
|
|
109
|
+
conda env create -f install/zoomy.yml
|
|
110
|
+
./conda_config_setup.sh
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**FenicsX**
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
conda env update -f install/env-fenicsx.yml
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
#### Firedrake (Linux / Mac)
|
|
120
|
+
|
|
121
|
+
**Base Installation**
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
cd install
|
|
125
|
+
conda env create -f install/zoomy.yml
|
|
126
|
+
./conda_config_setup.sh
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**Firedrake**
|
|
130
|
+
|
|
131
|
+
Activate the environment before installing any Firedrake dependencies.
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
conda activate zoomy
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Mainly follow the instructions on the [Firedrake Webpage](https://www.firedrakeproject.org/install.html#install-firedrake).
|
|
138
|
+
|
|
139
|
+
Deviating from the instructions on the webpage, we use
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
python3 ../firedrake-configure --show-petsc-configure-options --with-pnetcdf=0 | xargs -L1 ./configure
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
to compile PetSc without PNetCDF and then install Firedrake inside our conda environment
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
pip install --no-binary h5py 'firedrake[check]'
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
#### AMReX (Linux / Mac)
|
|
152
|
+
|
|
153
|
+
**Base Installation**
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
cd install
|
|
157
|
+
conda env create -f install/zoomy.yml
|
|
158
|
+
./conda_config_setup.sh
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
**AMReX**
|
|
162
|
+
|
|
163
|
+
Note that the AMReX installation is *completely indepdenent* and the AMReX solver does not depend on the Conda/Mamba environment. Follow the instructions on the [AMReX Webpage](https://amrex-codes.github.io/amrex/docs_html/Introduction.html)
|
|
164
|
+
|
|
165
|
+
#### OpenFOAM 12 (Linux / Mac)
|
|
166
|
+
|
|
167
|
+
T.b.d
|
|
168
|
+
|
|
169
|
+
**Activation**
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
conda activate zoomy
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Docker
|
|
176
|
+
|
|
177
|
+
T.b.d
|
|
178
|
+
|
|
179
|
+
### Apptainer
|
|
180
|
+
|
|
181
|
+
T.b.d
|
|
182
|
+
|
|
183
|
+
### Manual installation
|
|
184
|
+
|
|
185
|
+
See the `install/zoomy.yml` for a complete list of requirements. Once the requirements are fulfilled, simply clone the repository.
|
|
186
|
+
|
|
187
|
+
The following environment variables need to be set
|
|
188
|
+
|
|
189
|
+
```{bash}
|
|
190
|
+
PYTHONPATH=/path/to/Zoomy
|
|
191
|
+
ZOOMY_DIR=/path/to/Zoomy
|
|
192
|
+
JAX_ENABLE_X64=True
|
|
193
|
+
PETSC_DIR=/path/to/petsc/installation
|
|
194
|
+
PETSC_ARCH=architecture used for compiling petsc
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### External dependencies
|
|
198
|
+
|
|
199
|
+
#### PreCICE
|
|
200
|
+
|
|
201
|
+
T.b.d.
|
|
202
|
+
|
|
203
|
+
### Working in Jupyter Notebooks
|
|
204
|
+
|
|
205
|
+
Make sure to export the environment variables
|
|
206
|
+
|
|
207
|
+
```{bash}
|
|
208
|
+
PYTHONPATH=/path/to/Zoomy
|
|
209
|
+
ZOOMY_DIR=/path/to/Zoomy
|
|
210
|
+
JAX_ENABLE_X64=True //(if you use JAX)
|
|
211
|
+
PETSC_DIR=/path/to/petsc/installation
|
|
212
|
+
PETSC_ARCH=architecture used for compiling petsc
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Testing
|
|
216
|
+
|
|
217
|
+
T.b.d.
|
|
218
|
+
|
|
219
|
+
## Publications
|
|
220
|
+
|
|
221
|
+
T.b.d.
|
|
222
|
+
|
|
223
|
+
## Dependencies and acknowledgements
|
|
224
|
+
|
|
225
|
+
This
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
zoomy_core/__init__.py,sha256=Gur2AV4_XwhwlIzdBX-E5BBQhw9KZVPo2xpbQMOYaH4,216
|
|
2
|
+
zoomy_core/decorators/decorators.py,sha256=4fmdDDkHKoRFRbxMpTdM3KqDMV-dOL02DH2Ig29cpR0,853
|
|
3
|
+
zoomy_core/fvm/flux.py,sha256=5EKXY_xqnH5T5o4cZTC-_SON14WLoXwygel8OTbPdAk,1888
|
|
4
|
+
zoomy_core/fvm/nonconservative_flux.py,sha256=80iRIOZ5xiRJ7yeVgzrlf-kNmLlrqnUzQTEZxsHPZyc,3359
|
|
5
|
+
zoomy_core/fvm/ode.py,sha256=Cx7DgLoWm7aqIjPtWUhoD9FnScZyPjKSuI4--uaiuU0,1453
|
|
6
|
+
zoomy_core/fvm/solver_numpy.py,sha256=y5szY7jz1FQ8kHQip5NvHy3ww4r68bSaz0jFoGa_Om4,10835
|
|
7
|
+
zoomy_core/fvm/timestepping.py,sha256=SqYjV0YAj4v5Ug2y7sEdZgF3DRH1lHPDa5BFsXzrm14,405
|
|
8
|
+
zoomy_core/mesh/mesh.py,sha256=52ca4gx-pbFWHz7LfmT1KYS1yHKsQVw2H4V0z1mFwzs,50213
|
|
9
|
+
zoomy_core/mesh/mesh_extrude.py,sha256=ln9bD5l_BEELUgx--j1I70Wv3tGgdqVcrxcDXKBMVyE,5992
|
|
10
|
+
zoomy_core/mesh/mesh_util.py,sha256=IOe5FZ2vhiCTGRsRxUHEoek1o6N2QQAceuLUhuioG_k,16174
|
|
11
|
+
zoomy_core/misc/custom_types.py,sha256=l1kfQJWPzT0PEvW-8bh4MD4BaIspWmtfQ4Y8Oq2qcT4,141
|
|
12
|
+
zoomy_core/misc/interpolation.py,sha256=Z27uhcGRE_BWPm9voUbxHV5Ptj3cJnWd9vAWNqIfGIM,5095
|
|
13
|
+
zoomy_core/misc/io.py,sha256=I5gCL3-JX6lI8CrybIOVYWTkCy6WoWgV5GGZDttUsu0,14504
|
|
14
|
+
zoomy_core/misc/logger_config.py,sha256=506zLc8d9hn7b-r55ZWHWWx7GY0NjayVGMLNcNJQr5E,478
|
|
15
|
+
zoomy_core/misc/misc.py,sha256=yunquXkPtZqWOa8RwRx4Y7rdqAK69S6QKIyohzRICzk,7390
|
|
16
|
+
zoomy_core/model/analysis.py,sha256=qt7cs3s5ijen5I11ntS3Y5pVPI8ufijjCJj-7Is9YMo,5332
|
|
17
|
+
zoomy_core/model/basefunction.py,sha256=XtlKQCkamWnM_ohW0-3PYXrkK0_poIFHMtz-o52JYSo,3542
|
|
18
|
+
zoomy_core/model/basemodel.py,sha256=RAVhFPNFo5GJ8OpxgrRfFsBXaW2ugIg3MqUGM38QQI8,16883
|
|
19
|
+
zoomy_core/model/boundary_conditions.py,sha256=_TFYppTc9Q8ANXCjsKxcVvNbLyqHKr-VYjdcLZxV3no,6608
|
|
20
|
+
zoomy_core/model/initial_conditions.py,sha256=3ZmJeABD1xHb-qZ2tBlIFnHVvHWJxygTgtIw5t7k1oM,5427
|
|
21
|
+
zoomy_core/model/model.py,sha256=teSVpgtePlbdeAEthF05Edd3IIoQGVx_debIKQrd92c,1928
|
|
22
|
+
zoomy_core/model/models/GN.py,sha256=ymOlDpn8I5Xzk2GvXm2gvialSWTzxpPSvxzkP0qOMlc,1913
|
|
23
|
+
zoomy_core/model/models/advection.py,sha256=G-oDMNbKAahlW90ocyf-HGM55-JX59cMARV8JaRfe_g,2111
|
|
24
|
+
zoomy_core/model/models/basisfunctions.py,sha256=ZHeQYXwgpB8YAZ-8l3NYYvi8CSuvFzJ0xiyaai4WsCA,5410
|
|
25
|
+
zoomy_core/model/models/basismatrices.py,sha256=6zGgXXrGH-3VjJFlcvXR1W9Vv3AfWzjrONSpejEM4RM,13024
|
|
26
|
+
zoomy_core/model/models/core.py,sha256=Tjc2kX0DfwgK_KtYnb60Y0YlTWpHm1hylzArk3lbieo,19350
|
|
27
|
+
zoomy_core/model/models/coupled_constrained.py,sha256=q2qOh7Vf3ryG0rS9VXD4oUDMaHEZ7g74AtgHQePXEC0,1741
|
|
28
|
+
zoomy_core/model/models/poisson.py,sha256=B_8qc_6FnEzB91-fdKzWlHo8Jiq1Kmjxp1xBC6YB-ag,1075
|
|
29
|
+
zoomy_core/model/models/shallow_moments.py,sha256=kSNxnAQnCmmFBggcXmOh1yVlF_1_8-QxDGLPvajcELo,27098
|
|
30
|
+
zoomy_core/model/models/shallow_moments_sediment.py,sha256=rt1ohClioEpPOYO0w1zB9VHGkjP0RWxM4M18BEA00rI,14292
|
|
31
|
+
zoomy_core/model/models/shallow_moments_topo.py,sha256=_5KWvT3iUbPU5zAZN4J904b1r5yJiMTFojmeVD7oxsg,17402
|
|
32
|
+
zoomy_core/model/models/shallow_moments_variants.py,sha256=NsRF9kaiYxQtV94oOZsMBDFXwzmm_R-rz6fAUuYQRxc,52059
|
|
33
|
+
zoomy_core/model/models/shallow_water.py,sha256=1Sn8mVCUiYZue2SvLfGfRMOsfD0G9hL72x_ENdA9QRU,8412
|
|
34
|
+
zoomy_core/model/models/shallow_water_topo.py,sha256=Y-ibbM9Hj7gPreZUmTEBcYlhM0AzIiMYKuEeJYi-Pxc,3455
|
|
35
|
+
zoomy_core/model/models/shear_shallow_flow.py,sha256=O2JZaK1E8qUPVJHYaTksMDV3IuxD9nez1hHmdKHRJng,17250
|
|
36
|
+
zoomy_core/model/models/sme_turbulent.py,sha256=8PzvbSdEYNEaz-9LCvahL_-Gt_tdGv3PPjBqYRz11V4,24048
|
|
37
|
+
zoomy_core/model/models/vam.py,sha256=aHI1LCkNQC8g8uEZujp36NYVuaKxfCapl9W-5fSzLWk,15114
|
|
38
|
+
zoomy_core/postprocessing/postprocessing.py,sha256=WD8o4H7PE6B6lEsKwVsMnJufhx2mUm2jCf_5aTYQV8E,2814
|
|
39
|
+
zoomy_core/preprocessing/openfoam_moments.py,sha256=DJWXRGAwLH1gin2XwAINdP0QcCbs9wd7BH9nciu_9iY,14684
|
|
40
|
+
zoomy_core/transformation/helpers.py,sha256=KClsyBc0LZNocKzbfknhhYPshA83cDLkzfAKkPGoy1o,915
|
|
41
|
+
zoomy_core/transformation/to_amrex.py,sha256=usIOIS05reWBNk0MuH7xUdjDZV81JJ4sQmIlR0yQiV8,9593
|
|
42
|
+
zoomy_core/transformation/to_c.py,sha256=a_22vacgMvSZTCsrr1XAZqD0SqVYgKbp25HnoBBZxjE,7198
|
|
43
|
+
zoomy_core/transformation/to_jax.py,sha256=XkQHMv8hNm9kMcUm8xHZMhlsQqK9_4IDuUw8phFJviU,395
|
|
44
|
+
zoomy_core/transformation/to_numpy.py,sha256=lUt7ijRuQ7jWu3i6zH9xQB3Za2cqb-CcTSfV36e8xlQ,4730
|
|
45
|
+
zoomy_core/transformation/to_openfoam.py,sha256=KykbKVsr6ktPSjG2C1YYr9K1g1Adugd1GVOLymBsf9g,10676
|
|
46
|
+
zoomy_core/transformation/to_ufl.py,sha256=U4TQpBStlR44bXP8_ochYYDSYk1kZTlpKl-aZ7WNTqw,1991
|
|
47
|
+
zoomy_core-0.1.11.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
48
|
+
zoomy_core-0.1.11.dist-info/METADATA,sha256=KeDZvy2u0XSaH4jMjjf3K0oCfrjQ9ni0RU_ix6ZKPvI,5495
|
|
49
|
+
zoomy_core-0.1.11.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
50
|
+
zoomy_core-0.1.11.dist-info/top_level.txt,sha256=NCamZmp9nka6uLXNdAbb47vtoiLmvm3uBKvaBuUdfdQ,11
|
|
51
|
+
zoomy_core-0.1.11.dist-info/RECORD,,
|