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,363 @@
1
+ # fv_schemes_config.py
2
+
3
+ """
4
+ Finite Volume Schemes Configuration for OpenFOAM cases.
5
+
6
+ This module provides comprehensive configuration options for finite volume discretization
7
+ schemes including time derivatives, gradients, divergence, Laplacian, interpolation,
8
+ and surface normal gradients.
9
+ """
10
+
11
+ # =============================================================================
12
+ # *** User Input for fvSchemes ***
13
+ # =============================================================================
14
+
15
+ # --- Master Control ---
16
+ # Set to True to write 'system/fvSchemes'.
17
+ WRITE_FV_SCHEMES = True
18
+
19
+ # =============================================================================
20
+ # *** Time Derivative Schemes (ddtSchemes) ***
21
+ # =============================================================================
22
+ # Control how time derivatives are discretized
23
+
24
+ DDT_SCHEMES = {
25
+ # Default scheme for all time derivatives
26
+ # Options:
27
+ # "Euler": First-order explicit Euler (unconditionally unstable)
28
+ # "backward": First-order implicit backward Euler (unconditionally stable)
29
+ # "CrankNicolson": Second-order implicit Crank-Nicolson (conditionally stable)
30
+ # "localEuler": Local time stepping with Euler scheme
31
+ # "steadyState": For steady-state simulations (no time derivative)
32
+ # "localSteadyState": Local steady-state (useful for initialization)
33
+ "default": "backward",
34
+
35
+ # Field-specific schemes (optional)
36
+ "fieldSpecific": {
37
+ # Example: Use different scheme for specific fields
38
+ # "p": "Gauss linear",
39
+ # "U": "Gauss upwind",
40
+ }
41
+ }
42
+
43
+ # =============================================================================
44
+ # *** Gradient Schemes (gradSchemes) ***
45
+ # =============================================================================
46
+ # Control how gradients are computed
47
+
48
+ GRAD_SCHEMES = {
49
+ # Default gradient scheme
50
+ # Options:
51
+ # "Gauss linear": Second-order accurate central difference
52
+ # "Gauss linearUpwind": First-order upwind (stable but diffusive)
53
+ # "Gauss linearUpwind grad": Upwind with gradient correction
54
+ # "Gauss pointCellsLeastSquares": Least squares gradient
55
+ # "Gauss cellMDLimited": Cell-based multi-dimensional limiter
56
+ # "Gauss faceMDLimited": Face-based multi-dimensional limiter
57
+ # "leastSquares": Least squares gradient (alternative syntax)
58
+ "default": "Gauss linear",
59
+
60
+ # Field-specific gradient schemes
61
+ "fieldSpecific": {
62
+ # Example: Use different gradient schemes for different fields
63
+ "p": "Gauss linear", # Pressure gradient
64
+ "U": "Gauss linear", # Velocity gradient
65
+ # "T": "Gauss linearUpwind", # Temperature gradient (upwind for stability)
66
+ # "k": "Gauss linearUpwind", # Turbulent kinetic energy (upwind)
67
+ # "epsilon": "Gauss linearUpwind", # Turbulent dissipation rate (upwind)
68
+ }
69
+ }
70
+
71
+ # =============================================================================
72
+ # *** Divergence Schemes (divSchemes) ***
73
+ # =============================================================================
74
+ # Control how divergence terms are discretized
75
+
76
+ DIV_SCHEMES = {
77
+ # Default divergence scheme
78
+ "default": "none",
79
+
80
+ # Field-specific divergence schemes
81
+ "fieldSpecific": {
82
+ # Convection terms (phi is the flux)
83
+ "div(phi,U)": "Gauss linear", # Momentum convection
84
+ "div(phi,k)": "Gauss upwind", # Turbulent kinetic energy convection
85
+ "div(phi,epsilon)": "Gauss upwind", # Turbulent dissipation convection
86
+ "div(phi,omega)": "Gauss upwind", # Specific dissipation rate convection
87
+ "div(phi,T)": "Gauss linear", # Temperature convection
88
+ "div(phi,Yi)": "Gauss upwind", # Species mass fraction convection
89
+ "div(phi,alpha.water)": "Gauss vanLeer", # Volume fraction convection (VOF)
90
+
91
+ # Diffusion terms
92
+ "div((nuEff*dev2(T(grad(U)))))": "Gauss linear", # Viscous stress divergence
93
+ "div((nuEff*dev(T(grad(U)))))": "Gauss linear", # Viscous stress divergence (alternative)
94
+ "div((alpha*he*U))": "Gauss linear", # Enthalpy convection
95
+ "div((rho*U))": "Gauss linear", # Mass convection
96
+ "div((rho*U*U))": "Gauss linear", # Momentum convection
97
+ "div((rho*phi*U))": "Gauss linear", # Momentum convection with phi
98
+
99
+ # Turbulent terms
100
+ "div(phi,nuTilda)": "Gauss upwind", # Spalart-Allmaras convection
101
+ "div(phi,R)": "Gauss linear", # Reynolds stress convection
102
+
103
+ # Compressible flow terms
104
+ "div(phi,p)": "Gauss linear", # Pressure convection
105
+ "div(phi,h)": "Gauss linear", # Enthalpy convection
106
+ "div(phi,rho)": "Gauss linear", # Density convection
107
+
108
+ # Multiphase flow terms
109
+ "div(phi,alpha1)": "Gauss vanLeer", # Phase fraction convection
110
+ "div(phi,alpha2)": "Gauss vanLeer", # Phase fraction convection
111
+ "div(phi,alpha)": "Gauss vanLeer", # Volume fraction convection
112
+
113
+ # Combustion terms
114
+ "div(phi,Yi)": "Gauss upwind", # Species mass fraction
115
+ "div(phi,Y)": "Gauss upwind", # Mass fraction (generic)
116
+ "div(phi,ft)": "Gauss upwind", # Mixture fraction
117
+ "div(phi,Z)": "Gauss upwind", # Progress variable
118
+ }
119
+ }
120
+
121
+ # =============================================================================
122
+ # *** Laplacian Schemes (laplacianSchemes) ***
123
+ # =============================================================================
124
+ # Control how Laplacian (diffusion) terms are discretized
125
+
126
+ LAPLACIAN_SCHEMES = {
127
+ # Default Laplacian scheme
128
+ # Options:
129
+ # "Gauss linear": Second-order central difference
130
+ # "Gauss linear corrected": Corrected for non-orthogonal meshes
131
+ # "Gauss linear limited": Limited to prevent overshoots
132
+ # "Gauss linear limited corrected": Limited and corrected
133
+ # "Gauss linear uncorrected": Uncorrected (faster but less accurate)
134
+ # "Gauss linear orthogonal": For orthogonal meshes only
135
+ "default": "Gauss linear corrected",
136
+
137
+ # Field-specific Laplacian schemes
138
+ "fieldSpecific": {
139
+ # Diffusion terms
140
+ "laplacian(nu,U)": "Gauss linear corrected", # Viscous diffusion
141
+ "laplacian(nuEff,U)": "Gauss linear corrected", # Effective viscous diffusion
142
+ "laplacian(DT,T)": "Gauss linear corrected", # Thermal diffusion
143
+ "laplacian(DT,h)": "Gauss linear corrected", # Enthalpy diffusion
144
+ "laplacian(D,Yi)": "Gauss linear corrected", # Species diffusion
145
+ "laplacian(alpha,rho)": "Gauss linear corrected", # Density diffusion
146
+ "laplacian(1,p)": "Gauss linear corrected", # Pressure diffusion (Poisson)
147
+ "laplacian(1,rho)": "Gauss linear corrected", # Density diffusion
148
+
149
+ # Turbulent diffusion
150
+ "laplacian(nuTilda,nuTilda)": "Gauss linear corrected", # Spalart-Allmaras
151
+ "laplacian((nu+nuT),U)": "Gauss linear corrected", # Turbulent viscosity
152
+
153
+ # Multiphase diffusion
154
+ "laplacian(alpha,alpha)": "Gauss linear corrected", # Phase fraction diffusion
155
+ "laplacian(D32,alpha)": "Gauss linear corrected", # Phase fraction diffusion
156
+ }
157
+ }
158
+
159
+ # =============================================================================
160
+ # *** Interpolation Schemes (interpolationSchemes) ***
161
+ # =============================================================================
162
+ # Control how values are interpolated from cell centers to face centers
163
+
164
+ INTERPOLATION_SCHEMES = {
165
+ # Default interpolation scheme
166
+ # Options:
167
+ # "linear": Second-order linear interpolation
168
+ # "linearUpwind": First-order upwind (stable but diffusive)
169
+ # "skewCorrected linear": Skewness-corrected linear
170
+ # "cubic": Third-order cubic interpolation
171
+ # "upwind": First-order upwind
172
+ # "midPoint": Mid-point interpolation (first-order)
173
+ # "harmonic": Harmonic mean interpolation
174
+ # "pointCellsLeastSquares": Least squares interpolation
175
+ "default": "linear",
176
+
177
+ # Field-specific interpolation schemes
178
+ "fieldSpecific": {
179
+ # Example: Use different interpolation for different fields
180
+ # "U": "linear", # Velocity interpolation
181
+ # "p": "linear", # Pressure interpolation
182
+ # "T": "linearUpwind", # Temperature interpolation (upwind for stability)
183
+ # "alpha.water": "linear", # Volume fraction interpolation
184
+ }
185
+ }
186
+
187
+ # =============================================================================
188
+ # *** Surface Normal Gradient Schemes (snGradSchemes) ***
189
+ # =============================================================================
190
+ # Control how surface normal gradients are computed
191
+
192
+ SNGRAD_SCHEMES = {
193
+ # Default surface normal gradient scheme
194
+ # Options:
195
+ # "corrected": Corrected for non-orthogonal meshes (recommended)
196
+ # "uncorrected": Uncorrected (faster but less accurate on non-orthogonal meshes)
197
+ # "limited": Limited to prevent overshoots
198
+ # "orthogonal": For orthogonal meshes only
199
+ # "limited corrected": Limited and corrected
200
+ "default": "corrected",
201
+
202
+ # Field-specific surface normal gradient schemes
203
+ "fieldSpecific": {
204
+ # Example: Use different schemes for different fields
205
+ # "p": "corrected", # Pressure gradient
206
+ # "U": "corrected", # Velocity gradient
207
+ # "T": "corrected", # Temperature gradient
208
+ }
209
+ }
210
+
211
+ # =============================================================================
212
+ # *** Flux Required Schemes (fluxRequired) ***
213
+ # =============================================================================
214
+ # Specify which fields require flux computation
215
+
216
+ FLUX_REQUIRED_SCHEMES = {
217
+ # Enable flux computation for specific fields
218
+ "enabled": True,
219
+
220
+ # List of fields that require flux computation
221
+ "fields": [
222
+ "p", # Pressure field
223
+ "U", # Velocity field
224
+ "T", # Temperature field
225
+ # "alpha.water", # Volume fraction field
226
+ # "k", # Turbulent kinetic energy
227
+ # "epsilon", # Turbulent dissipation rate
228
+ # "omega", # Specific dissipation rate
229
+ # "nuTilda", # Spalart-Allmaras variable
230
+ ]
231
+ }
232
+
233
+ # =============================================================================
234
+ # *** Predefined Scheme Sets ***
235
+ # =============================================================================
236
+ # Common scheme configurations for different simulation types
237
+
238
+ PREDEFINED_SCHEME_SETS = {
239
+ "laminar_steady": {
240
+ "description": "Laminar steady-state simulation",
241
+ "ddtSchemes": {"default": "steadyState"},
242
+ "gradSchemes": {"default": "Gauss linear"},
243
+ "divSchemes": {
244
+ "default": "none",
245
+ "fieldSpecific": {
246
+ "div(phi,U)": "Gauss linear",
247
+ "div((nuEff*dev2(T(grad(U)))))": "Gauss linear",
248
+ }
249
+ },
250
+ "laplacianSchemes": {"default": "Gauss linear corrected"},
251
+ "interpolationSchemes": {"default": "linear"},
252
+ "snGradSchemes": {"default": "corrected"},
253
+ },
254
+
255
+ "laminar_transient": {
256
+ "description": "Laminar transient simulation",
257
+ "ddtSchemes": {"default": "backward"},
258
+ "gradSchemes": {"default": "Gauss linear"},
259
+ "divSchemes": {
260
+ "default": "none",
261
+ "fieldSpecific": {
262
+ "div(phi,U)": "Gauss linear",
263
+ "div((nuEff*dev2(T(grad(U)))))": "Gauss linear",
264
+ }
265
+ },
266
+ "laplacianSchemes": {"default": "Gauss linear corrected"},
267
+ "interpolationSchemes": {"default": "linear"},
268
+ "snGradSchemes": {"default": "corrected"},
269
+ },
270
+
271
+ "turbulent_ras": {
272
+ "description": "Reynolds-Averaged Navier-Stokes (RANS) simulation",
273
+ "ddtSchemes": {"default": "backward"},
274
+ "gradSchemes": {"default": "Gauss linear"},
275
+ "divSchemes": {
276
+ "default": "none",
277
+ "fieldSpecific": {
278
+ "div(phi,U)": "Gauss linear",
279
+ "div((nuEff*dev2(T(grad(U)))))": "Gauss linear",
280
+ "div(phi,k)": "Gauss upwind",
281
+ "div(phi,epsilon)": "Gauss upwind",
282
+ }
283
+ },
284
+ "laplacianSchemes": {"default": "Gauss linear corrected"},
285
+ "interpolationSchemes": {"default": "linear"},
286
+ "snGradSchemes": {"default": "corrected"},
287
+ },
288
+
289
+ "turbulent_les": {
290
+ "description": "Large Eddy Simulation (LES)",
291
+ "ddtSchemes": {"default": "backward"},
292
+ "gradSchemes": {"default": "Gauss linear"},
293
+ "divSchemes": {
294
+ "default": "none",
295
+ "fieldSpecific": {
296
+ "div(phi,U)": "Gauss linear",
297
+ "div((nuEff*dev2(T(grad(U)))))": "Gauss linear",
298
+ }
299
+ },
300
+ "laplacianSchemes": {"default": "Gauss linear corrected"},
301
+ "interpolationSchemes": {"default": "linear"},
302
+ "snGradSchemes": {"default": "corrected"},
303
+ },
304
+
305
+ "multiphase_vof": {
306
+ "description": "Multiphase Volume of Fluid (VOF) simulation",
307
+ "ddtSchemes": {"default": "backward"},
308
+ "gradSchemes": {"default": "Gauss linear"},
309
+ "divSchemes": {
310
+ "default": "none",
311
+ "fieldSpecific": {
312
+ "div(phi,U)": "Gauss linear",
313
+ "div((nuEff*dev2(T(grad(U)))))": "Gauss linear",
314
+ "div(phi,alpha.water)": "Gauss vanLeer",
315
+ }
316
+ },
317
+ "laplacianSchemes": {"default": "Gauss linear corrected"},
318
+ "interpolationSchemes": {"default": "linear"},
319
+ "snGradSchemes": {"default": "corrected"},
320
+ },
321
+
322
+ "high_order": {
323
+ "description": "High-order accurate schemes (for smooth flows)",
324
+ "ddtSchemes": {"default": "CrankNicolson"},
325
+ "gradSchemes": {"default": "Gauss linear"},
326
+ "divSchemes": {
327
+ "default": "none",
328
+ "fieldSpecific": {
329
+ "div(phi,U)": "Gauss linear",
330
+ "div((nuEff*dev2(T(grad(U)))))": "Gauss linear",
331
+ }
332
+ },
333
+ "laplacianSchemes": {"default": "Gauss linear corrected"},
334
+ "interpolationSchemes": {"default": "cubic"},
335
+ "snGradSchemes": {"default": "corrected"},
336
+ },
337
+
338
+ "stable_upwind": {
339
+ "description": "Stable upwind schemes (for difficult flows)",
340
+ "ddtSchemes": {"default": "backward"},
341
+ "gradSchemes": {"default": "Gauss linearUpwind"},
342
+ "divSchemes": {
343
+ "default": "none",
344
+ "fieldSpecific": {
345
+ "div(phi,U)": "Gauss upwind",
346
+ "div((nuEff*dev2(T(grad(U)))))": "Gauss linear",
347
+ }
348
+ },
349
+ "laplacianSchemes": {"default": "Gauss linear corrected"},
350
+ "interpolationSchemes": {"default": "linearUpwind"},
351
+ "snGradSchemes": {"default": "corrected"},
352
+ }
353
+ }
354
+
355
+ # =============================================================================
356
+ # *** Configuration Selection ***
357
+ # =============================================================================
358
+ # Select which predefined scheme set to use (overrides manual settings above)
359
+
360
+ USE_PREDEFINED_SCHEMES = None # Set to scheme set name from PREDEFINED_SCHEME_SETS or None for manual config
361
+
362
+ # Example usage:
363
+ # USE_PREDEFINED_SCHEMES = "turbulent_ras" # Will use RANS-appropriate schemes