pycphy 0.1.0__py3-none-any.whl → 0.2.0__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.
Files changed (67) hide show
  1. pycphy/__init__.py +11 -0
  2. pycphy/cli.py +145 -0
  3. pycphy/config_manager.py +373 -0
  4. pycphy/foamCaseDeveloper/__init__.py +60 -41
  5. pycphy/foamCaseDeveloper/config/__init__.py +69 -26
  6. pycphy/foamCaseDeveloper/config/cad_mesh_config.py +62 -0
  7. pycphy/foamCaseDeveloper/config/config_hfdibdem.py +193 -0
  8. pycphy/foamCaseDeveloper/config/constant/__init__.py +23 -0
  9. pycphy/foamCaseDeveloper/config/constant/dynamic_mesh_config.py +208 -0
  10. pycphy/foamCaseDeveloper/config/constant/gravity_field_config.py +379 -0
  11. pycphy/foamCaseDeveloper/config/constant/transport_properties_config.py +225 -0
  12. pycphy/foamCaseDeveloper/config/constant/turbulence_config.py +617 -0
  13. pycphy/foamCaseDeveloper/config/csv_boundary_reader.py +219 -0
  14. pycphy/foamCaseDeveloper/config/system/__init__.py +31 -0
  15. pycphy/foamCaseDeveloper/config/system/block_mesh_config.py +184 -0
  16. pycphy/foamCaseDeveloper/config/{control_config.py → system/control_config.py} +113 -1
  17. pycphy/foamCaseDeveloper/config/system/decompose_par_config.py +525 -0
  18. pycphy/foamCaseDeveloper/config/system/fv_options_config.py +575 -0
  19. pycphy/foamCaseDeveloper/config/system/fv_schemes_config.py +363 -0
  20. pycphy/foamCaseDeveloper/config/system/set_fields_config.py +640 -0
  21. pycphy/foamCaseDeveloper/config/system/snappy_hex_mesh_config.py +241 -0
  22. pycphy/foamCaseDeveloper/config/zero/U_config.py +135 -0
  23. pycphy/foamCaseDeveloper/config/zero/__init__.py +22 -0
  24. pycphy/foamCaseDeveloper/config/zero/f_config.py +140 -0
  25. pycphy/foamCaseDeveloper/config/zero/lambda_config.py +157 -0
  26. pycphy/foamCaseDeveloper/config/zero/p_config.py +97 -0
  27. pycphy/foamCaseDeveloper/core/__init__.py +30 -18
  28. pycphy/foamCaseDeveloper/core/block_mesh_developer.py +1 -1
  29. pycphy/foamCaseDeveloper/core/cad_block_mesh_developer.py +463 -0
  30. pycphy/foamCaseDeveloper/core/case_builder.py +1217 -0
  31. pycphy/foamCaseDeveloper/core/foam_case_manager.py +370 -111
  32. pycphy/foamCaseDeveloper/develop_case.py +640 -0
  33. pycphy/foamCaseDeveloper/main.py +260 -260
  34. pycphy/foamCaseDeveloper/utils/myAutoCAD.py +418 -0
  35. pycphy/foamCaseDeveloper/writers/__init__.py +37 -4
  36. pycphy/foamCaseDeveloper/writers/constant/__init__.py +25 -0
  37. pycphy/foamCaseDeveloper/writers/constant/dynamic_mesh_dict_writer.py +75 -0
  38. pycphy/foamCaseDeveloper/writers/constant/gravity_field_writer.py +88 -0
  39. pycphy/foamCaseDeveloper/writers/constant/hfdibdem_dict_writer.py +81 -0
  40. pycphy/foamCaseDeveloper/writers/constant/transport_properties_writer.py +202 -0
  41. pycphy/foamCaseDeveloper/writers/{turbulence_properties_writer.py → constant/turbulence_properties_writer.py} +49 -1
  42. pycphy/foamCaseDeveloper/writers/system/__init__.py +31 -0
  43. pycphy/foamCaseDeveloper/writers/{block_mesh_writer.py → system/block_mesh_writer.py} +1 -1
  44. pycphy/foamCaseDeveloper/writers/{control_dict_writer.py → system/control_dict_writer.py} +37 -1
  45. pycphy/foamCaseDeveloper/writers/system/decompose_par_writer.py +228 -0
  46. pycphy/foamCaseDeveloper/writers/system/fv_options_writer.py +188 -0
  47. pycphy/foamCaseDeveloper/writers/system/fv_schemes_writer.py +155 -0
  48. pycphy/foamCaseDeveloper/writers/system/set_fields_writer.py +191 -0
  49. pycphy/foamCaseDeveloper/writers/system/snappy_hex_mesh_writer.py +123 -0
  50. pycphy/foamCaseDeveloper/writers/zero/__init__.py +24 -0
  51. pycphy/foamCaseDeveloper/writers/zero/f_field_writer.py +89 -0
  52. pycphy/foamCaseDeveloper/writers/zero/lambda_field_writer.py +84 -0
  53. pycphy/foamCaseDeveloper/writers/zero/p_field_writer.py +89 -0
  54. pycphy/foamCaseDeveloper/writers/zero/u_field_writer.py +96 -0
  55. pycphy/foamCaseDeveloper/writers/zero/zero_field_factory.py +388 -0
  56. {pycphy-0.1.0.dist-info → pycphy-0.2.0.dist-info}/METADATA +154 -6
  57. pycphy-0.2.0.dist-info/RECORD +63 -0
  58. pycphy-0.2.0.dist-info/entry_points.txt +3 -0
  59. pycphy/foamCaseDeveloper/config/block_mesh_config.py +0 -90
  60. pycphy/foamCaseDeveloper/config/turbulence_config.py +0 -187
  61. pycphy/foamCaseDeveloper/core/control_dict_writer.py +0 -55
  62. pycphy/foamCaseDeveloper/core/turbulence_properties_writer.py +0 -68
  63. pycphy-0.1.0.dist-info/RECORD +0 -24
  64. pycphy-0.1.0.dist-info/entry_points.txt +0 -2
  65. {pycphy-0.1.0.dist-info → pycphy-0.2.0.dist-info}/WHEEL +0 -0
  66. {pycphy-0.1.0.dist-info → pycphy-0.2.0.dist-info}/licenses/LICENSE +0 -0
  67. {pycphy-0.1.0.dist-info → pycphy-0.2.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,525 @@
1
+ # decompose_par_config.py
2
+
3
+ """
4
+ Decompose Par Configuration for OpenFOAM cases.
5
+
6
+ This module provides configuration options for the decomposePar utility to
7
+ decompose mesh and fields for parallel processing including various
8
+ decomposition methods and load balancing strategies.
9
+ """
10
+
11
+ # =============================================================================
12
+ # *** User Input for decomposeParDict ***
13
+ # =============================================================================
14
+
15
+ # --- Master Control ---
16
+ # Set to True to write 'system/decomposeParDict'.
17
+ WRITE_DECOMPOSE_PAR_DICT = True
18
+
19
+ # =============================================================================
20
+ # *** Decomposition Configuration ***
21
+ # =============================================================================
22
+
23
+ DECOMPOSE_PAR_CONFIG = {
24
+ # Number of domains to decompose into
25
+ # Must match the number of processors you want to use
26
+ "numberOfSubdomains": 4,
27
+
28
+ # Decomposition method
29
+ # Options:
30
+ # "simple": Simple geometric decomposition (fastest)
31
+ # "hierarchical": Hierarchical decomposition (good for structured meshes)
32
+ # "scotch": Scotch decomposition (good load balancing)
33
+ # "metis": METIS decomposition (good load balancing)
34
+ # "manual": Manual decomposition (user-specified)
35
+ # "multiLevel": Multi-level decomposition (for complex geometries)
36
+ # "structured": Structured decomposition (for structured meshes)
37
+ # "kahip": KaHIP decomposition (advanced load balancing)
38
+ # "ptscotch": PT-Scotch decomposition (parallel Scotch)
39
+ "method": "scotch",
40
+
41
+ # Decomposition coefficients (method-specific)
42
+ "coeffs": {
43
+ # For 'simple' method
44
+ "simpleCoeffs": {
45
+ "n": (2, 2, 1), # Number of domains in x, y, z directions
46
+ "delta": 0.001, # Cell skewness factor
47
+ },
48
+
49
+ # For 'hierarchical' method
50
+ "hierarchicalCoeffs": {
51
+ "n": (2, 2, 1), # Number of domains in x, y, z directions
52
+ "delta": 0.001, # Cell skewness factor
53
+ "order": "xyz", # Decomposition order
54
+ },
55
+
56
+ # For 'scotch' method
57
+ "scotchCoeffs": {
58
+ "strategy": "b", # Scotch strategy (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z)
59
+ "processorWeights": [1, 1, 1, 1], # Relative processor weights
60
+ },
61
+
62
+ # For 'metis' method
63
+ "metisCoeffs": {
64
+ "processorWeights": [1, 1, 1, 1], # Relative processor weights
65
+ },
66
+
67
+ # For 'manual' method
68
+ "manualCoeffs": {
69
+ "dataFile": "manualDecompData", # File containing manual decomposition data
70
+ },
71
+
72
+ # For 'multiLevel' method
73
+ "multiLevelCoeffs": {
74
+ "method": "scotch",
75
+ "coeffs": {
76
+ "strategy": "b",
77
+ },
78
+ "multiLevelCoeffs": {
79
+ "method": "simple",
80
+ "coeffs": {
81
+ "n": (2, 2, 1),
82
+ },
83
+ },
84
+ },
85
+
86
+ # For 'structured' method
87
+ "structuredCoeffs": {
88
+ "patches": ["inlet", "outlet"], # Patches to preserve
89
+ "n": (2, 2, 1), # Number of domains in x, y, z directions
90
+ },
91
+
92
+ # For 'kahip' method
93
+ "kahipCoeffs": {
94
+ "config": "fast", # KaHIP configuration (fast, eco, strong)
95
+ "seed": 0, # Random seed
96
+ },
97
+
98
+ # For 'ptscotch' method
99
+ "ptscotchCoeffs": {
100
+ "strategy": "b", # PT-Scotch strategy
101
+ "processorWeights": [1, 1, 1, 1], # Relative processor weights
102
+ },
103
+ },
104
+
105
+ # Additional decomposition options
106
+ "options": {
107
+ # Write decomposition information
108
+ "writeGraph": True,
109
+
110
+ # Write processor weights
111
+ "writeProcWeights": True,
112
+
113
+ # Write cell distribution
114
+ "writeCellDist": True,
115
+
116
+ # Write face distribution
117
+ "writeFaceDist": True,
118
+
119
+ # Write point distribution
120
+ "writePointDist": True,
121
+
122
+ # Write decomposition statistics
123
+ "writeStats": True,
124
+
125
+ # Write decomposition quality metrics
126
+ "writeQuality": True,
127
+
128
+ # Write decomposition visualization
129
+ "writeVTK": True,
130
+
131
+ # Write decomposition log
132
+ "writeLog": True,
133
+
134
+ # Verbose output
135
+ "verbose": True,
136
+
137
+ # Check decomposition
138
+ "checkDecomp": True,
139
+
140
+ # Reconstruct decomposition
141
+ "reconstruct": False,
142
+
143
+ # Force decomposition
144
+ "force": False,
145
+
146
+ # Keep original mesh
147
+ "keepOriginal": True,
148
+
149
+ # Backup original files
150
+ "backup": True,
151
+
152
+ # Compress output
153
+ "compress": False,
154
+
155
+ # Use parallel decomposition
156
+ "parallel": True,
157
+
158
+ # Number of threads for parallel decomposition
159
+ "nThreads": 4,
160
+
161
+ # Memory limit for decomposition
162
+ "memoryLimit": "2GB",
163
+
164
+ # Time limit for decomposition
165
+ "timeLimit": "3600", # 1 hour
166
+ },
167
+
168
+ # Fields to decompose
169
+ "fields": [
170
+ "U", # Velocity field
171
+ "p", # Pressure field
172
+ "T", # Temperature field (if present)
173
+ "k", # Turbulent kinetic energy (if present)
174
+ "epsilon", # Turbulent dissipation rate (if present)
175
+ "omega", # Specific dissipation rate (if present)
176
+ "nuTilda", # Spalart-Allmaras variable (if present)
177
+ "alpha.water", # Volume fraction (if present)
178
+ "rho", # Density (if present)
179
+ "mu", # Dynamic viscosity (if present)
180
+ "phi", # Flux field
181
+ "phi_0", # Flux field (alternative)
182
+ "phi_1", # Flux field (alternative)
183
+ "phi_2", # Flux field (alternative)
184
+ "phi_3", # Flux field (alternative)
185
+ ],
186
+
187
+ # Patches to preserve during decomposition
188
+ "preservePatches": [
189
+ "inlet",
190
+ "outlet",
191
+ "wall",
192
+ "symmetry",
193
+ "cyclic",
194
+ "processor",
195
+ ],
196
+
197
+ # Cell zones to preserve during decomposition
198
+ "preserveCellZones": [
199
+ "porousZone",
200
+ "sourceZone",
201
+ "sinkZone",
202
+ ],
203
+
204
+ # Face zones to preserve during decomposition
205
+ "preserveFaceZones": [
206
+ "interface",
207
+ "contact",
208
+ ],
209
+
210
+ # Point zones to preserve during decomposition
211
+ "preservePointZones": [
212
+ "inletPoints",
213
+ "outletPoints",
214
+ ],
215
+ }
216
+
217
+ # =============================================================================
218
+ # *** Predefined Decomposition Configurations ***
219
+ # =============================================================================
220
+ # Common decomposition configurations for different scenarios
221
+
222
+ PREDEFINED_DECOMPOSITION_CONFIGS = {
223
+ "small_problem": {
224
+ "description": "Small problem decomposition (2-4 processors)",
225
+ "numberOfSubdomains": 2,
226
+ "method": "simple",
227
+ "coeffs": {
228
+ "simpleCoeffs": {
229
+ "n": (2, 1, 1),
230
+ "delta": 0.001,
231
+ },
232
+ },
233
+ "options": {
234
+ "writeGraph": True,
235
+ "verbose": True,
236
+ "parallel": False,
237
+ },
238
+ },
239
+
240
+ "medium_problem": {
241
+ "description": "Medium problem decomposition (4-8 processors)",
242
+ "numberOfSubdomains": 4,
243
+ "method": "scotch",
244
+ "coeffs": {
245
+ "scotchCoeffs": {
246
+ "strategy": "b",
247
+ "processorWeights": [1, 1, 1, 1],
248
+ },
249
+ },
250
+ "options": {
251
+ "writeGraph": True,
252
+ "verbose": True,
253
+ "parallel": True,
254
+ "nThreads": 2,
255
+ },
256
+ },
257
+
258
+ "large_problem": {
259
+ "description": "Large problem decomposition (8-16 processors)",
260
+ "numberOfSubdomains": 8,
261
+ "method": "scotch",
262
+ "coeffs": {
263
+ "scotchCoeffs": {
264
+ "strategy": "b",
265
+ "processorWeights": [1, 1, 1, 1, 1, 1, 1, 1],
266
+ },
267
+ },
268
+ "options": {
269
+ "writeGraph": True,
270
+ "verbose": True,
271
+ "parallel": True,
272
+ "nThreads": 4,
273
+ "memoryLimit": "4GB",
274
+ },
275
+ },
276
+
277
+ "huge_problem": {
278
+ "description": "Huge problem decomposition (16+ processors)",
279
+ "numberOfSubdomains": 16,
280
+ "method": "scotch",
281
+ "coeffs": {
282
+ "scotchCoeffs": {
283
+ "strategy": "b",
284
+ "processorWeights": [1] * 16,
285
+ },
286
+ },
287
+ "options": {
288
+ "writeGraph": True,
289
+ "verbose": True,
290
+ "parallel": True,
291
+ "nThreads": 8,
292
+ "memoryLimit": "8GB",
293
+ "timeLimit": "7200", # 2 hours
294
+ },
295
+ },
296
+
297
+ "structured_mesh": {
298
+ "description": "Decomposition for structured meshes",
299
+ "numberOfSubdomains": 4,
300
+ "method": "structured",
301
+ "coeffs": {
302
+ "structuredCoeffs": {
303
+ "patches": ["inlet", "outlet", "wall"],
304
+ "n": (2, 2, 1),
305
+ },
306
+ },
307
+ "options": {
308
+ "writeGraph": True,
309
+ "verbose": True,
310
+ "parallel": True,
311
+ },
312
+ },
313
+
314
+ "unstructured_mesh": {
315
+ "description": "Decomposition for unstructured meshes",
316
+ "numberOfSubdomains": 4,
317
+ "method": "scotch",
318
+ "coeffs": {
319
+ "scotchCoeffs": {
320
+ "strategy": "b",
321
+ "processorWeights": [1, 1, 1, 1],
322
+ },
323
+ },
324
+ "options": {
325
+ "writeGraph": True,
326
+ "verbose": True,
327
+ "parallel": True,
328
+ },
329
+ },
330
+
331
+ "multiphase_flow": {
332
+ "description": "Decomposition for multiphase flow simulations",
333
+ "numberOfSubdomains": 4,
334
+ "method": "scotch",
335
+ "coeffs": {
336
+ "scotchCoeffs": {
337
+ "strategy": "b",
338
+ "processorWeights": [1, 1, 1, 1],
339
+ },
340
+ },
341
+ "options": {
342
+ "writeGraph": True,
343
+ "verbose": True,
344
+ "parallel": True,
345
+ "writeVTK": True,
346
+ },
347
+ "fields": [
348
+ "U", "p", "alpha.water", "phi", "phi_0", "phi_1", "phi_2", "phi_3",
349
+ ],
350
+ },
351
+
352
+ "turbulent_flow": {
353
+ "description": "Decomposition for turbulent flow simulations",
354
+ "numberOfSubdomains": 4,
355
+ "method": "scotch",
356
+ "coeffs": {
357
+ "scotchCoeffs": {
358
+ "strategy": "b",
359
+ "processorWeights": [1, 1, 1, 1],
360
+ },
361
+ },
362
+ "options": {
363
+ "writeGraph": True,
364
+ "verbose": True,
365
+ "parallel": True,
366
+ },
367
+ "fields": [
368
+ "U", "p", "k", "epsilon", "phi", "phi_0", "phi_1", "phi_2", "phi_3",
369
+ ],
370
+ },
371
+
372
+ "heat_transfer": {
373
+ "description": "Decomposition for heat transfer simulations",
374
+ "numberOfSubdomains": 4,
375
+ "method": "scotch",
376
+ "coeffs": {
377
+ "scotchCoeffs": {
378
+ "strategy": "b",
379
+ "processorWeights": [1, 1, 1, 1],
380
+ },
381
+ },
382
+ "options": {
383
+ "writeGraph": True,
384
+ "verbose": True,
385
+ "parallel": True,
386
+ },
387
+ "fields": [
388
+ "U", "p", "T", "phi", "phi_0", "phi_1", "phi_2", "phi_3",
389
+ ],
390
+ },
391
+
392
+ "compressible_flow": {
393
+ "description": "Decomposition for compressible flow simulations",
394
+ "numberOfSubdomains": 4,
395
+ "method": "scotch",
396
+ "coeffs": {
397
+ "scotchCoeffs": {
398
+ "strategy": "b",
399
+ "processorWeights": [1, 1, 1, 1],
400
+ },
401
+ },
402
+ "options": {
403
+ "writeGraph": True,
404
+ "verbose": True,
405
+ "parallel": True,
406
+ },
407
+ "fields": [
408
+ "U", "p", "T", "rho", "mu", "phi", "phi_0", "phi_1", "phi_2", "phi_3",
409
+ ],
410
+ },
411
+
412
+ "species_transport": {
413
+ "description": "Decomposition for species transport simulations",
414
+ "numberOfSubdomains": 4,
415
+ "method": "scotch",
416
+ "coeffs": {
417
+ "scotchCoeffs": {
418
+ "strategy": "b",
419
+ "processorWeights": [1, 1, 1, 1],
420
+ },
421
+ },
422
+ "options": {
423
+ "writeGraph": True,
424
+ "verbose": True,
425
+ "parallel": True,
426
+ },
427
+ "fields": [
428
+ "U", "p", "Y_CO2", "Y_O2", "Y_N2", "phi", "phi_0", "phi_1", "phi_2", "phi_3",
429
+ ],
430
+ },
431
+
432
+ "high_performance": {
433
+ "description": "High-performance decomposition with advanced options",
434
+ "numberOfSubdomains": 8,
435
+ "method": "scotch",
436
+ "coeffs": {
437
+ "scotchCoeffs": {
438
+ "strategy": "b",
439
+ "processorWeights": [1, 1, 1, 1, 1, 1, 1, 1],
440
+ },
441
+ },
442
+ "options": {
443
+ "writeGraph": True,
444
+ "writeProcWeights": True,
445
+ "writeCellDist": True,
446
+ "writeFaceDist": True,
447
+ "writePointDist": True,
448
+ "writeStats": True,
449
+ "writeQuality": True,
450
+ "writeVTK": True,
451
+ "writeLog": True,
452
+ "verbose": True,
453
+ "checkDecomp": True,
454
+ "parallel": True,
455
+ "nThreads": 8,
456
+ "memoryLimit": "8GB",
457
+ "timeLimit": "3600",
458
+ },
459
+ },
460
+
461
+ "debug_mode": {
462
+ "description": "Debug mode decomposition with extensive output",
463
+ "numberOfSubdomains": 2,
464
+ "method": "simple",
465
+ "coeffs": {
466
+ "simpleCoeffs": {
467
+ "n": (2, 1, 1),
468
+ "delta": 0.001,
469
+ },
470
+ },
471
+ "options": {
472
+ "writeGraph": True,
473
+ "writeProcWeights": True,
474
+ "writeCellDist": True,
475
+ "writeFaceDist": True,
476
+ "writePointDist": True,
477
+ "writeStats": True,
478
+ "writeQuality": True,
479
+ "writeVTK": True,
480
+ "writeLog": True,
481
+ "verbose": True,
482
+ "checkDecomp": True,
483
+ "parallel": False,
484
+ },
485
+ },
486
+
487
+ "production_mode": {
488
+ "description": "Production mode decomposition optimized for performance",
489
+ "numberOfSubdomains": 4,
490
+ "method": "scotch",
491
+ "coeffs": {
492
+ "scotchCoeffs": {
493
+ "strategy": "b",
494
+ "processorWeights": [1, 1, 1, 1],
495
+ },
496
+ },
497
+ "options": {
498
+ "writeGraph": False,
499
+ "writeProcWeights": False,
500
+ "writeCellDist": False,
501
+ "writeFaceDist": False,
502
+ "writePointDist": False,
503
+ "writeStats": False,
504
+ "writeQuality": False,
505
+ "writeVTK": False,
506
+ "writeLog": False,
507
+ "verbose": False,
508
+ "checkDecomp": False,
509
+ "parallel": True,
510
+ "nThreads": 4,
511
+ "compress": True,
512
+ },
513
+ },
514
+ }
515
+
516
+ # =============================================================================
517
+ # *** Configuration Selection ***
518
+ # =============================================================================
519
+ # Select which predefined decomposition configuration to use (overrides manual settings above)
520
+
521
+ USE_PREDEFINED_DECOMPOSITION = None # Set to decomposition config name from PREDEFINED_DECOMPOSITION_CONFIGS or None for manual config
522
+
523
+ # Example usage:
524
+ # USE_PREDEFINED_DECOMPOSITION = "medium_problem" # Will use medium problem decomposition
525
+ # USE_PREDEFINED_DECOMPOSITION = "multiphase_flow" # Will use multiphase flow decomposition