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.
- pycphy/__init__.py +11 -0
- pycphy/cli.py +145 -0
- pycphy/config_manager.py +373 -0
- pycphy/foamCaseDeveloper/__init__.py +60 -41
- pycphy/foamCaseDeveloper/config/__init__.py +69 -26
- pycphy/foamCaseDeveloper/config/cad_mesh_config.py +62 -0
- pycphy/foamCaseDeveloper/config/config_hfdibdem.py +193 -0
- pycphy/foamCaseDeveloper/config/constant/__init__.py +23 -0
- pycphy/foamCaseDeveloper/config/constant/dynamic_mesh_config.py +208 -0
- pycphy/foamCaseDeveloper/config/constant/gravity_field_config.py +379 -0
- pycphy/foamCaseDeveloper/config/constant/transport_properties_config.py +225 -0
- pycphy/foamCaseDeveloper/config/constant/turbulence_config.py +617 -0
- pycphy/foamCaseDeveloper/config/csv_boundary_reader.py +219 -0
- pycphy/foamCaseDeveloper/config/system/__init__.py +31 -0
- pycphy/foamCaseDeveloper/config/system/block_mesh_config.py +184 -0
- pycphy/foamCaseDeveloper/config/{control_config.py → system/control_config.py} +113 -1
- pycphy/foamCaseDeveloper/config/system/decompose_par_config.py +525 -0
- pycphy/foamCaseDeveloper/config/system/fv_options_config.py +575 -0
- pycphy/foamCaseDeveloper/config/system/fv_schemes_config.py +363 -0
- pycphy/foamCaseDeveloper/config/system/set_fields_config.py +640 -0
- pycphy/foamCaseDeveloper/config/system/snappy_hex_mesh_config.py +241 -0
- pycphy/foamCaseDeveloper/config/zero/U_config.py +135 -0
- pycphy/foamCaseDeveloper/config/zero/__init__.py +22 -0
- pycphy/foamCaseDeveloper/config/zero/f_config.py +140 -0
- pycphy/foamCaseDeveloper/config/zero/lambda_config.py +157 -0
- pycphy/foamCaseDeveloper/config/zero/p_config.py +97 -0
- pycphy/foamCaseDeveloper/core/__init__.py +30 -18
- pycphy/foamCaseDeveloper/core/block_mesh_developer.py +1 -1
- pycphy/foamCaseDeveloper/core/cad_block_mesh_developer.py +463 -0
- pycphy/foamCaseDeveloper/core/case_builder.py +1217 -0
- pycphy/foamCaseDeveloper/core/foam_case_manager.py +370 -111
- pycphy/foamCaseDeveloper/develop_case.py +640 -0
- pycphy/foamCaseDeveloper/main.py +260 -260
- pycphy/foamCaseDeveloper/utils/myAutoCAD.py +418 -0
- pycphy/foamCaseDeveloper/writers/__init__.py +37 -4
- pycphy/foamCaseDeveloper/writers/constant/__init__.py +25 -0
- pycphy/foamCaseDeveloper/writers/constant/dynamic_mesh_dict_writer.py +75 -0
- pycphy/foamCaseDeveloper/writers/constant/gravity_field_writer.py +88 -0
- pycphy/foamCaseDeveloper/writers/constant/hfdibdem_dict_writer.py +81 -0
- pycphy/foamCaseDeveloper/writers/constant/transport_properties_writer.py +202 -0
- pycphy/foamCaseDeveloper/writers/{turbulence_properties_writer.py → constant/turbulence_properties_writer.py} +49 -1
- pycphy/foamCaseDeveloper/writers/system/__init__.py +31 -0
- pycphy/foamCaseDeveloper/writers/{block_mesh_writer.py → system/block_mesh_writer.py} +1 -1
- pycphy/foamCaseDeveloper/writers/{control_dict_writer.py → system/control_dict_writer.py} +37 -1
- pycphy/foamCaseDeveloper/writers/system/decompose_par_writer.py +228 -0
- pycphy/foamCaseDeveloper/writers/system/fv_options_writer.py +188 -0
- pycphy/foamCaseDeveloper/writers/system/fv_schemes_writer.py +155 -0
- pycphy/foamCaseDeveloper/writers/system/set_fields_writer.py +191 -0
- pycphy/foamCaseDeveloper/writers/system/snappy_hex_mesh_writer.py +123 -0
- pycphy/foamCaseDeveloper/writers/zero/__init__.py +24 -0
- pycphy/foamCaseDeveloper/writers/zero/f_field_writer.py +89 -0
- pycphy/foamCaseDeveloper/writers/zero/lambda_field_writer.py +84 -0
- pycphy/foamCaseDeveloper/writers/zero/p_field_writer.py +89 -0
- pycphy/foamCaseDeveloper/writers/zero/u_field_writer.py +96 -0
- pycphy/foamCaseDeveloper/writers/zero/zero_field_factory.py +388 -0
- {pycphy-0.1.0.dist-info → pycphy-0.2.0.dist-info}/METADATA +154 -6
- pycphy-0.2.0.dist-info/RECORD +63 -0
- pycphy-0.2.0.dist-info/entry_points.txt +3 -0
- pycphy/foamCaseDeveloper/config/block_mesh_config.py +0 -90
- pycphy/foamCaseDeveloper/config/turbulence_config.py +0 -187
- pycphy/foamCaseDeveloper/core/control_dict_writer.py +0 -55
- pycphy/foamCaseDeveloper/core/turbulence_properties_writer.py +0 -68
- pycphy-0.1.0.dist-info/RECORD +0 -24
- pycphy-0.1.0.dist-info/entry_points.txt +0 -2
- {pycphy-0.1.0.dist-info → pycphy-0.2.0.dist-info}/WHEEL +0 -0
- {pycphy-0.1.0.dist-info → pycphy-0.2.0.dist-info}/licenses/LICENSE +0 -0
- {pycphy-0.1.0.dist-info → pycphy-0.2.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,575 @@
|
|
1
|
+
# fv_options_config.py
|
2
|
+
|
3
|
+
"""
|
4
|
+
Finite Volume Options Configuration for OpenFOAM cases.
|
5
|
+
|
6
|
+
This module provides comprehensive configuration options for finite volume source terms,
|
7
|
+
constraints, and modifications including momentum sources, thermal sources, species sources,
|
8
|
+
and various constraint types.
|
9
|
+
"""
|
10
|
+
|
11
|
+
# =============================================================================
|
12
|
+
# *** User Input for fvOptions ***
|
13
|
+
# =============================================================================
|
14
|
+
|
15
|
+
# --- Master Control ---
|
16
|
+
# Set to True to write 'system/fvOptions'.
|
17
|
+
WRITE_FV_OPTIONS = True
|
18
|
+
|
19
|
+
# =============================================================================
|
20
|
+
# *** Momentum Sources ***
|
21
|
+
# =============================================================================
|
22
|
+
# Source terms for momentum equations
|
23
|
+
|
24
|
+
MOMENTUM_SOURCES = {
|
25
|
+
# Enable momentum sources
|
26
|
+
"enabled": False,
|
27
|
+
|
28
|
+
# List of momentum sources
|
29
|
+
"sources": [
|
30
|
+
# Example: Fixed value constraint for velocity
|
31
|
+
# {
|
32
|
+
# "name": "inletVelocity",
|
33
|
+
# "type": "fixedValueConstraint",
|
34
|
+
# "active": True,
|
35
|
+
# "selectionMode": "all",
|
36
|
+
# "patchNames": ["inlet"],
|
37
|
+
# "fields": ["U"],
|
38
|
+
# "value": "(1 0 0)", # Fixed velocity [m/s]
|
39
|
+
# },
|
40
|
+
|
41
|
+
# Example: Momentum source term
|
42
|
+
# {
|
43
|
+
# "name": "momentumSource",
|
44
|
+
# "type": "explicitSetValue",
|
45
|
+
# "active": True,
|
46
|
+
# "selectionMode": "cellSet",
|
47
|
+
# "cellSet": "sourceRegion",
|
48
|
+
# "fields": ["U"],
|
49
|
+
# "mode": "uniform",
|
50
|
+
# "uniformValue": "(0 0 -9.81)", # Gravity-like source [m/s^2]
|
51
|
+
# },
|
52
|
+
|
53
|
+
# Example: Porous media source (Darcy-Forchheimer)
|
54
|
+
# {
|
55
|
+
# "name": "porousRegion",
|
56
|
+
# "type": "explicitSetValue",
|
57
|
+
# "active": True,
|
58
|
+
# "selectionMode": "cellZone",
|
59
|
+
# "cellZone": "porousZone",
|
60
|
+
# "fields": ["U"],
|
61
|
+
# "mode": "uniform",
|
62
|
+
# "uniformValue": "(-1000*U - 100*mag(U)*U)", # Porous resistance
|
63
|
+
# },
|
64
|
+
|
65
|
+
# Example: Actuator disk source
|
66
|
+
# {
|
67
|
+
# "name": "actuatorDisk",
|
68
|
+
# "type": "actuatorDiskSource",
|
69
|
+
# "active": True,
|
70
|
+
# "selectionMode": "cellSet",
|
71
|
+
# "cellSet": "diskRegion",
|
72
|
+
# "fields": ["U"],
|
73
|
+
# "diskDir": "(1 0 0)",
|
74
|
+
# "Cp": 0.4,
|
75
|
+
# "Ct": 0.8,
|
76
|
+
# "eps": 0.1,
|
77
|
+
# "f": 50.0,
|
78
|
+
# },
|
79
|
+
]
|
80
|
+
}
|
81
|
+
|
82
|
+
# =============================================================================
|
83
|
+
# *** Thermal Sources ***
|
84
|
+
# =============================================================================
|
85
|
+
# Source terms for energy/temperature equations
|
86
|
+
|
87
|
+
THERMAL_SOURCES = {
|
88
|
+
# Enable thermal sources
|
89
|
+
"enabled": False,
|
90
|
+
|
91
|
+
# List of thermal sources
|
92
|
+
"sources": [
|
93
|
+
# Example: Fixed temperature boundary condition
|
94
|
+
# {
|
95
|
+
# "name": "wallTemperature",
|
96
|
+
# "type": "fixedValueConstraint",
|
97
|
+
# "active": True,
|
98
|
+
# "selectionMode": "all",
|
99
|
+
# "patchNames": ["hotWall"],
|
100
|
+
# "fields": ["T"],
|
101
|
+
# "value": "uniform 373.15", # Fixed temperature [K]
|
102
|
+
# },
|
103
|
+
|
104
|
+
# Example: Heat source in region
|
105
|
+
# {
|
106
|
+
# "name": "heatSource",
|
107
|
+
# "type": "explicitSetValue",
|
108
|
+
# "active": True,
|
109
|
+
# "selectionMode": "cellSet",
|
110
|
+
# "cellSet": "heaterRegion",
|
111
|
+
# "fields": ["T"],
|
112
|
+
# "mode": "uniform",
|
113
|
+
# "uniformValue": "1000", # Heat source [W/m^3]
|
114
|
+
# },
|
115
|
+
|
116
|
+
# Example: Solar radiation source
|
117
|
+
# {
|
118
|
+
# "name": "solarRadiation",
|
119
|
+
# "type": "explicitSetValue",
|
120
|
+
# "active": True,
|
121
|
+
# "selectionMode": "cellSet",
|
122
|
+
# "cellSet": "solarPanel",
|
123
|
+
# "fields": ["T"],
|
124
|
+
# "mode": "uniform",
|
125
|
+
# "uniformValue": "500", # Solar heating [W/m^3]
|
126
|
+
# },
|
127
|
+
]
|
128
|
+
}
|
129
|
+
|
130
|
+
# =============================================================================
|
131
|
+
# *** Species Sources ***
|
132
|
+
# =============================================================================
|
133
|
+
# Source terms for species transport equations
|
134
|
+
|
135
|
+
SPECIES_SOURCES = {
|
136
|
+
# Enable species sources
|
137
|
+
"enabled": False,
|
138
|
+
|
139
|
+
# List of species sources
|
140
|
+
"sources": [
|
141
|
+
# Example: Fixed concentration boundary
|
142
|
+
# {
|
143
|
+
# "name": "inletConcentration",
|
144
|
+
# "type": "fixedValueConstraint",
|
145
|
+
# "active": True,
|
146
|
+
# "selectionMode": "all",
|
147
|
+
# "patchNames": ["inlet"],
|
148
|
+
# "fields": ["Y_CO2"],
|
149
|
+
# "value": "uniform 0.1", # Fixed mass fraction
|
150
|
+
# },
|
151
|
+
|
152
|
+
# Example: Species source in region
|
153
|
+
# {
|
154
|
+
# "name": "pollutantSource",
|
155
|
+
# "type": "explicitSetValue",
|
156
|
+
# "active": True,
|
157
|
+
# "selectionMode": "cellSet",
|
158
|
+
# "cellSet": "factoryRegion",
|
159
|
+
# "fields": ["Y_POLLUTANT"],
|
160
|
+
# "mode": "uniform",
|
161
|
+
# "uniformValue": "0.05", # Source strength [1/s]
|
162
|
+
# },
|
163
|
+
]
|
164
|
+
}
|
165
|
+
|
166
|
+
# =============================================================================
|
167
|
+
# *** Turbulence Sources ***
|
168
|
+
# =============================================================================
|
169
|
+
# Source terms for turbulence equations
|
170
|
+
|
171
|
+
TURBULENCE_SOURCES = {
|
172
|
+
# Enable turbulence sources
|
173
|
+
"enabled": False,
|
174
|
+
|
175
|
+
# List of turbulence sources
|
176
|
+
"sources": [
|
177
|
+
# Example: Fixed turbulent kinetic energy
|
178
|
+
# {
|
179
|
+
# "name": "inletTurbulence",
|
180
|
+
# "type": "fixedValueConstraint",
|
181
|
+
# "active": True,
|
182
|
+
# "selectionMode": "all",
|
183
|
+
# "patchNames": ["inlet"],
|
184
|
+
# "fields": ["k", "epsilon"],
|
185
|
+
# "value": "uniform 0.01", # Fixed k [m^2/s^2]
|
186
|
+
# },
|
187
|
+
|
188
|
+
# Example: Turbulence source in wake region
|
189
|
+
# {
|
190
|
+
# "name": "wakeTurbulence",
|
191
|
+
# "type": "explicitSetValue",
|
192
|
+
# "active": True,
|
193
|
+
# "selectionMode": "cellSet",
|
194
|
+
# "cellSet": "wakeRegion",
|
195
|
+
# "fields": ["k"],
|
196
|
+
# "mode": "uniform",
|
197
|
+
# "uniformValue": "0.1", # Turbulence generation [m^2/s^3]
|
198
|
+
# },
|
199
|
+
]
|
200
|
+
}
|
201
|
+
|
202
|
+
# =============================================================================
|
203
|
+
# *** Pressure Sources ***
|
204
|
+
# =============================================================================
|
205
|
+
# Source terms for pressure equations
|
206
|
+
|
207
|
+
PRESSURE_SOURCES = {
|
208
|
+
# Enable pressure sources
|
209
|
+
"enabled": False,
|
210
|
+
|
211
|
+
# List of pressure sources
|
212
|
+
"sources": [
|
213
|
+
# Example: Fixed pressure boundary
|
214
|
+
# {
|
215
|
+
# "name": "outletPressure",
|
216
|
+
# "type": "fixedValueConstraint",
|
217
|
+
# "active": True,
|
218
|
+
# "selectionMode": "all",
|
219
|
+
# "patchNames": ["outlet"],
|
220
|
+
# "fields": ["p"],
|
221
|
+
# "value": "uniform 0", # Fixed pressure [Pa]
|
222
|
+
# },
|
223
|
+
|
224
|
+
# Example: Pressure source in region
|
225
|
+
# {
|
226
|
+
# "name": "pressureSource",
|
227
|
+
# "type": "explicitSetValue",
|
228
|
+
# "active": True,
|
229
|
+
# "selectionMode": "cellSet",
|
230
|
+
# "cellSet": "pumpRegion",
|
231
|
+
# "fields": ["p"],
|
232
|
+
# "mode": "uniform",
|
233
|
+
# "uniformValue": "1000", # Pressure source [Pa/s]
|
234
|
+
# },
|
235
|
+
]
|
236
|
+
}
|
237
|
+
|
238
|
+
# =============================================================================
|
239
|
+
# *** Volume Fraction Sources ***
|
240
|
+
# =============================================================================
|
241
|
+
# Source terms for multiphase volume fraction equations
|
242
|
+
|
243
|
+
VOLUME_FRACTION_SOURCES = {
|
244
|
+
# Enable volume fraction sources
|
245
|
+
"enabled": False,
|
246
|
+
|
247
|
+
# List of volume fraction sources
|
248
|
+
"sources": [
|
249
|
+
# Example: Fixed volume fraction boundary
|
250
|
+
# {
|
251
|
+
# "name": "inletAlpha",
|
252
|
+
# "type": "fixedValueConstraint",
|
253
|
+
# "active": True,
|
254
|
+
# "selectionMode": "all",
|
255
|
+
# "patchNames": ["inlet"],
|
256
|
+
# "fields": ["alpha.water"],
|
257
|
+
# "value": "uniform 1", # Fixed volume fraction
|
258
|
+
# },
|
259
|
+
|
260
|
+
# Example: Volume fraction source (phase change)
|
261
|
+
# {
|
262
|
+
# "name": "phaseChange",
|
263
|
+
# "type": "explicitSetValue",
|
264
|
+
# "active": True,
|
265
|
+
# "selectionMode": "cellSet",
|
266
|
+
# "cellSet": "evaporationRegion",
|
267
|
+
# "fields": ["alpha.water"],
|
268
|
+
# "mode": "uniform",
|
269
|
+
# "uniformValue": "-0.1", # Evaporation rate [1/s]
|
270
|
+
# },
|
271
|
+
]
|
272
|
+
}
|
273
|
+
|
274
|
+
# =============================================================================
|
275
|
+
# *** Advanced Sources ***
|
276
|
+
# =============================================================================
|
277
|
+
# Advanced source terms and constraints
|
278
|
+
|
279
|
+
ADVANCED_SOURCES = {
|
280
|
+
# Enable advanced sources
|
281
|
+
"enabled": False,
|
282
|
+
|
283
|
+
# List of advanced sources
|
284
|
+
"sources": [
|
285
|
+
# Example: Time-varying source
|
286
|
+
# {
|
287
|
+
# "name": "timeVaryingSource",
|
288
|
+
# "type": "timeVaryingExplicitSetValue",
|
289
|
+
# "active": True,
|
290
|
+
# "selectionMode": "cellSet",
|
291
|
+
# "cellSet": "sourceRegion",
|
292
|
+
# "fields": ["U"],
|
293
|
+
# "timeStart": 0,
|
294
|
+
# "duration": 10,
|
295
|
+
# "value": "(sin(time*2*pi/10) 0 0)", # Oscillating source
|
296
|
+
# },
|
297
|
+
|
298
|
+
# Example: Tabulated source
|
299
|
+
# {
|
300
|
+
# "name": "tabulatedSource",
|
301
|
+
# "type": "tabulatedExplicitSetValue",
|
302
|
+
# "active": True,
|
303
|
+
# "selectionMode": "cellSet",
|
304
|
+
# "cellSet": "sourceRegion",
|
305
|
+
# "fields": ["T"],
|
306
|
+
# "tableFile": "temperatureTable",
|
307
|
+
# "tableFormat": "foam",
|
308
|
+
# },
|
309
|
+
|
310
|
+
# Example: Function object source
|
311
|
+
# {
|
312
|
+
# "name": "functionObjectSource",
|
313
|
+
# "type": "functionObjectConstraint",
|
314
|
+
# "active": True,
|
315
|
+
# "selectionMode": "cellSet",
|
316
|
+
# "cellSet": "monitoredRegion",
|
317
|
+
# "fields": ["U"],
|
318
|
+
# "functionObject": "fieldAverage",
|
319
|
+
# "functionObjectCoeffs": {
|
320
|
+
# "fields": ["U"],
|
321
|
+
# "average": True,
|
322
|
+
# },
|
323
|
+
# },
|
324
|
+
]
|
325
|
+
}
|
326
|
+
|
327
|
+
# =============================================================================
|
328
|
+
# *** Constraint Types ***
|
329
|
+
# =============================================================================
|
330
|
+
# Available constraint types for reference
|
331
|
+
|
332
|
+
CONSTRAINT_TYPES = {
|
333
|
+
"fixedValueConstraint": {
|
334
|
+
"description": "Fixed value constraint for boundary conditions",
|
335
|
+
"required_fields": ["patchNames", "fields", "value"],
|
336
|
+
"example": {
|
337
|
+
"name": "inletVelocity",
|
338
|
+
"type": "fixedValueConstraint",
|
339
|
+
"patchNames": ["inlet"],
|
340
|
+
"fields": ["U"],
|
341
|
+
"value": "(1 0 0)",
|
342
|
+
}
|
343
|
+
},
|
344
|
+
|
345
|
+
"explicitSetValue": {
|
346
|
+
"description": "Explicit source term in field equations",
|
347
|
+
"required_fields": ["selectionMode", "fields", "mode", "uniformValue"],
|
348
|
+
"selection_modes": ["cellSet", "cellZone", "all", "cellSetAndSet"],
|
349
|
+
"example": {
|
350
|
+
"name": "momentumSource",
|
351
|
+
"type": "explicitSetValue",
|
352
|
+
"selectionMode": "cellSet",
|
353
|
+
"cellSet": "sourceRegion",
|
354
|
+
"fields": ["U"],
|
355
|
+
"mode": "uniform",
|
356
|
+
"uniformValue": "(0 0 -9.81)",
|
357
|
+
}
|
358
|
+
},
|
359
|
+
|
360
|
+
"actuatorDiskSource": {
|
361
|
+
"description": "Actuator disk model for wind turbines/propellers",
|
362
|
+
"required_fields": ["selectionMode", "fields", "diskDir", "Cp", "Ct"],
|
363
|
+
"example": {
|
364
|
+
"name": "windTurbine",
|
365
|
+
"type": "actuatorDiskSource",
|
366
|
+
"selectionMode": "cellSet",
|
367
|
+
"cellSet": "diskRegion",
|
368
|
+
"fields": ["U"],
|
369
|
+
"diskDir": "(1 0 0)",
|
370
|
+
"Cp": 0.4,
|
371
|
+
"Ct": 0.8,
|
372
|
+
"eps": 0.1,
|
373
|
+
"f": 50.0,
|
374
|
+
}
|
375
|
+
},
|
376
|
+
|
377
|
+
"porousZone": {
|
378
|
+
"description": "Porous media resistance model",
|
379
|
+
"required_fields": ["selectionMode", "fields", "d", "f"],
|
380
|
+
"example": {
|
381
|
+
"name": "porousRegion",
|
382
|
+
"type": "explicitSetValue",
|
383
|
+
"selectionMode": "cellZone",
|
384
|
+
"cellZone": "porousZone",
|
385
|
+
"fields": ["U"],
|
386
|
+
"mode": "uniform",
|
387
|
+
"uniformValue": "(-1000*U - 100*mag(U)*U)",
|
388
|
+
}
|
389
|
+
},
|
390
|
+
|
391
|
+
"timeVaryingExplicitSetValue": {
|
392
|
+
"description": "Time-varying source term",
|
393
|
+
"required_fields": ["selectionMode", "fields", "timeStart", "duration", "value"],
|
394
|
+
"example": {
|
395
|
+
"name": "pulsatingSource",
|
396
|
+
"type": "timeVaryingExplicitSetValue",
|
397
|
+
"selectionMode": "cellSet",
|
398
|
+
"cellSet": "sourceRegion",
|
399
|
+
"fields": ["U"],
|
400
|
+
"timeStart": 0,
|
401
|
+
"duration": 10,
|
402
|
+
"value": "(sin(time*2*pi/10) 0 0)",
|
403
|
+
}
|
404
|
+
},
|
405
|
+
|
406
|
+
"tabulatedExplicitSetValue": {
|
407
|
+
"description": "Tabulated source term from file",
|
408
|
+
"required_fields": ["selectionMode", "fields", "tableFile", "tableFormat"],
|
409
|
+
"example": {
|
410
|
+
"name": "tabulatedSource",
|
411
|
+
"type": "tabulatedExplicitSetValue",
|
412
|
+
"selectionMode": "cellSet",
|
413
|
+
"cellSet": "sourceRegion",
|
414
|
+
"fields": ["T"],
|
415
|
+
"tableFile": "temperatureTable",
|
416
|
+
"tableFormat": "foam",
|
417
|
+
}
|
418
|
+
},
|
419
|
+
}
|
420
|
+
|
421
|
+
# =============================================================================
|
422
|
+
# *** Predefined Source Sets ***
|
423
|
+
# =============================================================================
|
424
|
+
# Common source configurations for different simulation types
|
425
|
+
|
426
|
+
PREDEFINED_SOURCE_SETS = {
|
427
|
+
"channel_flow": {
|
428
|
+
"description": "Channel flow with inlet velocity and outlet pressure",
|
429
|
+
"momentum_sources": [
|
430
|
+
{
|
431
|
+
"name": "inletVelocity",
|
432
|
+
"type": "fixedValueConstraint",
|
433
|
+
"active": True,
|
434
|
+
"selectionMode": "all",
|
435
|
+
"patchNames": ["inlet"],
|
436
|
+
"fields": ["U"],
|
437
|
+
"value": "(1 0 0)",
|
438
|
+
},
|
439
|
+
{
|
440
|
+
"name": "outletPressure",
|
441
|
+
"type": "fixedValueConstraint",
|
442
|
+
"active": True,
|
443
|
+
"selectionMode": "all",
|
444
|
+
"patchNames": ["outlet"],
|
445
|
+
"fields": ["p"],
|
446
|
+
"value": "uniform 0",
|
447
|
+
},
|
448
|
+
],
|
449
|
+
"thermal_sources": [],
|
450
|
+
"species_sources": [],
|
451
|
+
"turbulence_sources": [],
|
452
|
+
"pressure_sources": [],
|
453
|
+
"volume_fraction_sources": [],
|
454
|
+
"advanced_sources": [],
|
455
|
+
},
|
456
|
+
|
457
|
+
"porous_flow": {
|
458
|
+
"description": "Flow through porous media",
|
459
|
+
"momentum_sources": [
|
460
|
+
{
|
461
|
+
"name": "porousResistance",
|
462
|
+
"type": "explicitSetValue",
|
463
|
+
"active": True,
|
464
|
+
"selectionMode": "cellZone",
|
465
|
+
"cellZone": "porousZone",
|
466
|
+
"fields": ["U"],
|
467
|
+
"mode": "uniform",
|
468
|
+
"uniformValue": "(-1000*U - 100*mag(U)*U)",
|
469
|
+
},
|
470
|
+
],
|
471
|
+
"thermal_sources": [],
|
472
|
+
"species_sources": [],
|
473
|
+
"turbulence_sources": [],
|
474
|
+
"pressure_sources": [],
|
475
|
+
"volume_fraction_sources": [],
|
476
|
+
"advanced_sources": [],
|
477
|
+
},
|
478
|
+
|
479
|
+
"wind_turbine": {
|
480
|
+
"description": "Wind turbine simulation with actuator disk",
|
481
|
+
"momentum_sources": [
|
482
|
+
{
|
483
|
+
"name": "windTurbine",
|
484
|
+
"type": "actuatorDiskSource",
|
485
|
+
"active": True,
|
486
|
+
"selectionMode": "cellSet",
|
487
|
+
"cellSet": "diskRegion",
|
488
|
+
"fields": ["U"],
|
489
|
+
"diskDir": "(1 0 0)",
|
490
|
+
"Cp": 0.4,
|
491
|
+
"Ct": 0.8,
|
492
|
+
"eps": 0.1,
|
493
|
+
"f": 50.0,
|
494
|
+
},
|
495
|
+
],
|
496
|
+
"thermal_sources": [],
|
497
|
+
"species_sources": [],
|
498
|
+
"turbulence_sources": [],
|
499
|
+
"pressure_sources": [],
|
500
|
+
"volume_fraction_sources": [],
|
501
|
+
"advanced_sources": [],
|
502
|
+
},
|
503
|
+
|
504
|
+
"heat_transfer": {
|
505
|
+
"description": "Heat transfer simulation with thermal sources",
|
506
|
+
"momentum_sources": [],
|
507
|
+
"thermal_sources": [
|
508
|
+
{
|
509
|
+
"name": "wallTemperature",
|
510
|
+
"type": "fixedValueConstraint",
|
511
|
+
"active": True,
|
512
|
+
"selectionMode": "all",
|
513
|
+
"patchNames": ["hotWall"],
|
514
|
+
"fields": ["T"],
|
515
|
+
"value": "uniform 373.15",
|
516
|
+
},
|
517
|
+
{
|
518
|
+
"name": "heatSource",
|
519
|
+
"type": "explicitSetValue",
|
520
|
+
"active": True,
|
521
|
+
"selectionMode": "cellSet",
|
522
|
+
"cellSet": "heaterRegion",
|
523
|
+
"fields": ["T"],
|
524
|
+
"mode": "uniform",
|
525
|
+
"uniformValue": "1000",
|
526
|
+
},
|
527
|
+
],
|
528
|
+
"species_sources": [],
|
529
|
+
"turbulence_sources": [],
|
530
|
+
"pressure_sources": [],
|
531
|
+
"volume_fraction_sources": [],
|
532
|
+
"advanced_sources": [],
|
533
|
+
},
|
534
|
+
|
535
|
+
"multiphase_flow": {
|
536
|
+
"description": "Multiphase flow with volume fraction sources",
|
537
|
+
"momentum_sources": [],
|
538
|
+
"thermal_sources": [],
|
539
|
+
"species_sources": [],
|
540
|
+
"turbulence_sources": [],
|
541
|
+
"pressure_sources": [],
|
542
|
+
"volume_fraction_sources": [
|
543
|
+
{
|
544
|
+
"name": "inletAlpha",
|
545
|
+
"type": "fixedValueConstraint",
|
546
|
+
"active": True,
|
547
|
+
"selectionMode": "all",
|
548
|
+
"patchNames": ["inlet"],
|
549
|
+
"fields": ["alpha.water"],
|
550
|
+
"value": "uniform 1",
|
551
|
+
},
|
552
|
+
{
|
553
|
+
"name": "phaseChange",
|
554
|
+
"type": "explicitSetValue",
|
555
|
+
"active": True,
|
556
|
+
"selectionMode": "cellSet",
|
557
|
+
"cellSet": "evaporationRegion",
|
558
|
+
"fields": ["alpha.water"],
|
559
|
+
"mode": "uniform",
|
560
|
+
"uniformValue": "-0.1",
|
561
|
+
},
|
562
|
+
],
|
563
|
+
"advanced_sources": [],
|
564
|
+
},
|
565
|
+
}
|
566
|
+
|
567
|
+
# =============================================================================
|
568
|
+
# *** Configuration Selection ***
|
569
|
+
# =============================================================================
|
570
|
+
# Select which predefined source set to use (overrides manual settings above)
|
571
|
+
|
572
|
+
USE_PREDEFINED_SOURCES = None # Set to source set name from PREDEFINED_SOURCE_SETS or None for manual config
|
573
|
+
|
574
|
+
# Example usage:
|
575
|
+
# USE_PREDEFINED_SOURCES = "channel_flow" # Will use channel flow sources
|