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,379 @@
|
|
1
|
+
# gravity_field_config.py
|
2
|
+
|
3
|
+
"""
|
4
|
+
Gravity Field Configuration for OpenFOAM cases.
|
5
|
+
|
6
|
+
This module provides configuration options for the gravity field (g) including
|
7
|
+
standard gravitational acceleration, custom gravity vectors, and variable
|
8
|
+
gravity fields for specialized simulations.
|
9
|
+
"""
|
10
|
+
|
11
|
+
# =============================================================================
|
12
|
+
# *** User Input for gravity field (g) ***
|
13
|
+
# =============================================================================
|
14
|
+
|
15
|
+
# --- Master Control ---
|
16
|
+
# Set to True to write 'constant/g'.
|
17
|
+
WRITE_GRAVITY_FIELD = True
|
18
|
+
|
19
|
+
# =============================================================================
|
20
|
+
# *** Gravity Field Configuration ***
|
21
|
+
# =============================================================================
|
22
|
+
|
23
|
+
GRAVITY_FIELD = {
|
24
|
+
# Gravity vector components [m/s^2]
|
25
|
+
# Standard Earth gravity: (0 0 -9.81) for downward gravity in z-direction
|
26
|
+
# Zero gravity: (0 0 0) for microgravity or space simulations
|
27
|
+
# Custom gravity: (gx gy gz) for arbitrary gravity directions
|
28
|
+
"value": (0, 0, -9.81), # Standard Earth gravity downward
|
29
|
+
|
30
|
+
# Dimensions of the gravity field
|
31
|
+
# [0 1 -2 0 0 0 0] = [length time^-2] = acceleration
|
32
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
33
|
+
|
34
|
+
# Description of the gravity configuration
|
35
|
+
"description": "Standard Earth gravity (9.81 m/s^2 downward)",
|
36
|
+
}
|
37
|
+
|
38
|
+
# =============================================================================
|
39
|
+
# *** Predefined Gravity Configurations ***
|
40
|
+
# =============================================================================
|
41
|
+
# Common gravity configurations for different simulation types
|
42
|
+
|
43
|
+
PREDEFINED_GRAVITY_CONFIGS = {
|
44
|
+
"earth_standard": {
|
45
|
+
"value": (0, 0, -9.81),
|
46
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
47
|
+
"description": "Standard Earth gravity (9.81 m/s^2 downward)"
|
48
|
+
},
|
49
|
+
|
50
|
+
"earth_horizontal": {
|
51
|
+
"value": (-9.81, 0, 0),
|
52
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
53
|
+
"description": "Earth gravity in negative x-direction"
|
54
|
+
},
|
55
|
+
|
56
|
+
"earth_45_degree": {
|
57
|
+
"value": (0, -6.93, -6.93), # 9.81 * sin(45°), 9.81 * cos(45°)
|
58
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
59
|
+
"description": "Earth gravity at 45° angle"
|
60
|
+
},
|
61
|
+
|
62
|
+
"moon": {
|
63
|
+
"value": (0, 0, -1.62),
|
64
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
65
|
+
"description": "Moon gravity (1.62 m/s^2 downward)"
|
66
|
+
},
|
67
|
+
|
68
|
+
"mars": {
|
69
|
+
"value": (0, 0, -3.71),
|
70
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
71
|
+
"description": "Mars gravity (3.71 m/s^2 downward)"
|
72
|
+
},
|
73
|
+
|
74
|
+
"jupiter": {
|
75
|
+
"value": (0, 0, -24.79),
|
76
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
77
|
+
"description": "Jupiter gravity (24.79 m/s^2 downward)"
|
78
|
+
},
|
79
|
+
|
80
|
+
"microgravity": {
|
81
|
+
"value": (0, 0, 0),
|
82
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
83
|
+
"description": "Microgravity/zero gravity environment"
|
84
|
+
},
|
85
|
+
|
86
|
+
"centrifuge_100g": {
|
87
|
+
"value": (0, 0, -981.0),
|
88
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
89
|
+
"description": "Centrifuge at 100g (981 m/s^2 downward)"
|
90
|
+
},
|
91
|
+
|
92
|
+
"centrifuge_1000g": {
|
93
|
+
"value": (0, 0, -9810.0),
|
94
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
95
|
+
"description": "Centrifuge at 1000g (9810 m/s^2 downward)"
|
96
|
+
},
|
97
|
+
|
98
|
+
"rotating_frame": {
|
99
|
+
"value": (0, 0, -9.81),
|
100
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
101
|
+
"description": "Gravity in rotating frame of reference"
|
102
|
+
},
|
103
|
+
|
104
|
+
"inclined_plane_30deg": {
|
105
|
+
"value": (0, -4.905, -8.496), # 9.81 * sin(30°), 9.81 * cos(30°)
|
106
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
107
|
+
"description": "Gravity on 30° inclined plane"
|
108
|
+
},
|
109
|
+
|
110
|
+
"inclined_plane_45deg": {
|
111
|
+
"value": (0, -6.93, -6.93), # 9.81 * sin(45°), 9.81 * cos(45°)
|
112
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
113
|
+
"description": "Gravity on 45° inclined plane"
|
114
|
+
},
|
115
|
+
|
116
|
+
"inclined_plane_60deg": {
|
117
|
+
"value": (0, -8.496, -4.905), # 9.81 * sin(60°), 9.81 * cos(60°)
|
118
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
119
|
+
"description": "Gravity on 60° inclined plane"
|
120
|
+
},
|
121
|
+
|
122
|
+
"custom_2d": {
|
123
|
+
"value": (0, -9.81, 0),
|
124
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
125
|
+
"description": "2D gravity in y-direction"
|
126
|
+
},
|
127
|
+
|
128
|
+
"custom_3d": {
|
129
|
+
"value": (-5.0, -5.0, -5.0),
|
130
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
131
|
+
"description": "Custom 3D gravity vector"
|
132
|
+
},
|
133
|
+
|
134
|
+
"buoyancy_test": {
|
135
|
+
"value": (0, 0, -9.81),
|
136
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
137
|
+
"description": "Gravity for buoyancy-driven flow tests"
|
138
|
+
},
|
139
|
+
|
140
|
+
"free_surface": {
|
141
|
+
"value": (0, 0, -9.81),
|
142
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
143
|
+
"description": "Gravity for free surface flow simulations"
|
144
|
+
},
|
145
|
+
|
146
|
+
"droplet_impact": {
|
147
|
+
"value": (0, 0, -9.81),
|
148
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
149
|
+
"description": "Gravity for droplet impact simulations"
|
150
|
+
},
|
151
|
+
|
152
|
+
"particle_sedimentation": {
|
153
|
+
"value": (0, 0, -9.81),
|
154
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
155
|
+
"description": "Gravity for particle sedimentation studies"
|
156
|
+
},
|
157
|
+
|
158
|
+
"convection_benchmark": {
|
159
|
+
"value": (0, 0, -9.81),
|
160
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
161
|
+
"description": "Gravity for natural convection benchmarks"
|
162
|
+
},
|
163
|
+
|
164
|
+
"turbulence_gravity": {
|
165
|
+
"value": (0, 0, -9.81),
|
166
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
167
|
+
"description": "Gravity for gravity-driven turbulence"
|
168
|
+
},
|
169
|
+
|
170
|
+
"stratified_flow": {
|
171
|
+
"value": (0, 0, -9.81),
|
172
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
173
|
+
"description": "Gravity for stratified flow simulations"
|
174
|
+
},
|
175
|
+
|
176
|
+
"dam_break": {
|
177
|
+
"value": (0, 0, -9.81),
|
178
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
179
|
+
"description": "Gravity for dam break simulations"
|
180
|
+
},
|
181
|
+
|
182
|
+
"sloshing": {
|
183
|
+
"value": (0, 0, -9.81),
|
184
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
185
|
+
"description": "Gravity for tank sloshing simulations"
|
186
|
+
},
|
187
|
+
|
188
|
+
"wave_generation": {
|
189
|
+
"value": (0, 0, -9.81),
|
190
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
191
|
+
"description": "Gravity for wave generation and propagation"
|
192
|
+
},
|
193
|
+
|
194
|
+
"tsunami": {
|
195
|
+
"value": (0, 0, -9.81),
|
196
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
197
|
+
"description": "Gravity for tsunami simulation"
|
198
|
+
},
|
199
|
+
|
200
|
+
"flood_simulation": {
|
201
|
+
"value": (0, 0, -9.81),
|
202
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
203
|
+
"description": "Gravity for flood simulation"
|
204
|
+
},
|
205
|
+
|
206
|
+
"environmental_flow": {
|
207
|
+
"value": (0, 0, -9.81),
|
208
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
209
|
+
"description": "Gravity for environmental flow studies"
|
210
|
+
},
|
211
|
+
|
212
|
+
"biomedical_flow": {
|
213
|
+
"value": (0, 0, -9.81),
|
214
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
215
|
+
"description": "Gravity for biomedical flow simulations"
|
216
|
+
},
|
217
|
+
|
218
|
+
"food_processing": {
|
219
|
+
"value": (0, 0, -9.81),
|
220
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
221
|
+
"description": "Gravity for food processing simulations"
|
222
|
+
},
|
223
|
+
|
224
|
+
"mixing_tank": {
|
225
|
+
"value": (0, 0, -9.81),
|
226
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
227
|
+
"description": "Gravity for mixing tank simulations"
|
228
|
+
},
|
229
|
+
|
230
|
+
"chemical_reactor": {
|
231
|
+
"value": (0, 0, -9.81),
|
232
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
233
|
+
"description": "Gravity for chemical reactor simulations"
|
234
|
+
},
|
235
|
+
|
236
|
+
"heat_exchanger": {
|
237
|
+
"value": (0, 0, -9.81),
|
238
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
239
|
+
"description": "Gravity for heat exchanger simulations"
|
240
|
+
},
|
241
|
+
|
242
|
+
"boiler": {
|
243
|
+
"value": (0, 0, -9.81),
|
244
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
245
|
+
"description": "Gravity for boiler simulations"
|
246
|
+
},
|
247
|
+
|
248
|
+
"condenser": {
|
249
|
+
"value": (0, 0, -9.81),
|
250
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
251
|
+
"description": "Gravity for condenser simulations"
|
252
|
+
},
|
253
|
+
|
254
|
+
"evaporator": {
|
255
|
+
"value": (0, 0, -9.81),
|
256
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
257
|
+
"description": "Gravity for evaporator simulations"
|
258
|
+
},
|
259
|
+
|
260
|
+
"distillation_column": {
|
261
|
+
"value": (0, 0, -9.81),
|
262
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
263
|
+
"description": "Gravity for distillation column simulations"
|
264
|
+
},
|
265
|
+
|
266
|
+
"extraction_column": {
|
267
|
+
"value": (0, 0, -9.81),
|
268
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
269
|
+
"description": "Gravity for extraction column simulations"
|
270
|
+
},
|
271
|
+
|
272
|
+
"absorption_column": {
|
273
|
+
"value": (0, 0, -9.81),
|
274
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
275
|
+
"description": "Gravity for absorption column simulations"
|
276
|
+
},
|
277
|
+
|
278
|
+
"packed_bed": {
|
279
|
+
"value": (0, 0, -9.81),
|
280
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
281
|
+
"description": "Gravity for packed bed reactor simulations"
|
282
|
+
},
|
283
|
+
|
284
|
+
"fluidized_bed": {
|
285
|
+
"value": (0, 0, -9.81),
|
286
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
287
|
+
"description": "Gravity for fluidized bed simulations"
|
288
|
+
},
|
289
|
+
|
290
|
+
"bubble_column": {
|
291
|
+
"value": (0, 0, -9.81),
|
292
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
293
|
+
"description": "Gravity for bubble column simulations"
|
294
|
+
},
|
295
|
+
|
296
|
+
"stirred_tank": {
|
297
|
+
"value": (0, 0, -9.81),
|
298
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
299
|
+
"description": "Gravity for stirred tank simulations"
|
300
|
+
},
|
301
|
+
|
302
|
+
"pipeline_flow": {
|
303
|
+
"value": (0, 0, -9.81),
|
304
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
305
|
+
"description": "Gravity for pipeline flow simulations"
|
306
|
+
},
|
307
|
+
|
308
|
+
"valve_flow": {
|
309
|
+
"value": (0, 0, -9.81),
|
310
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
311
|
+
"description": "Gravity for valve flow simulations"
|
312
|
+
},
|
313
|
+
|
314
|
+
"pump_flow": {
|
315
|
+
"value": (0, 0, -9.81),
|
316
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
317
|
+
"description": "Gravity for pump flow simulations"
|
318
|
+
},
|
319
|
+
|
320
|
+
"compressor": {
|
321
|
+
"value": (0, 0, -9.81),
|
322
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
323
|
+
"description": "Gravity for compressor simulations"
|
324
|
+
},
|
325
|
+
|
326
|
+
"turbine": {
|
327
|
+
"value": (0, 0, -9.81),
|
328
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
329
|
+
"description": "Gravity for turbine simulations"
|
330
|
+
},
|
331
|
+
|
332
|
+
"wind_turbine": {
|
333
|
+
"value": (0, 0, -9.81),
|
334
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
335
|
+
"description": "Gravity for wind turbine simulations"
|
336
|
+
},
|
337
|
+
|
338
|
+
"hydro_turbine": {
|
339
|
+
"value": (0, 0, -9.81),
|
340
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
341
|
+
"description": "Gravity for hydro turbine simulations"
|
342
|
+
},
|
343
|
+
|
344
|
+
"solar_collector": {
|
345
|
+
"value": (0, 0, -9.81),
|
346
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
347
|
+
"description": "Gravity for solar collector simulations"
|
348
|
+
},
|
349
|
+
|
350
|
+
"geothermal": {
|
351
|
+
"value": (0, 0, -9.81),
|
352
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
353
|
+
"description": "Gravity for geothermal simulations"
|
354
|
+
},
|
355
|
+
|
356
|
+
"nuclear_reactor": {
|
357
|
+
"value": (0, 0, -9.81),
|
358
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
359
|
+
"description": "Gravity for nuclear reactor simulations"
|
360
|
+
},
|
361
|
+
|
362
|
+
"fusion_reactor": {
|
363
|
+
"value": (0, 0, -9.81),
|
364
|
+
"dimensions": [0, 1, -2, 0, 0, 0, 0],
|
365
|
+
"description": "Gravity for fusion reactor simulations"
|
366
|
+
},
|
367
|
+
}
|
368
|
+
|
369
|
+
# =============================================================================
|
370
|
+
# *** Configuration Selection ***
|
371
|
+
# =============================================================================
|
372
|
+
# Select which predefined gravity configuration to use (overrides manual settings above)
|
373
|
+
|
374
|
+
USE_PREDEFINED_GRAVITY = None # Set to gravity config name from PREDEFINED_GRAVITY_CONFIGS or None for manual config
|
375
|
+
|
376
|
+
# Example usage:
|
377
|
+
# USE_PREDEFINED_GRAVITY = "earth_standard" # Will use standard Earth gravity
|
378
|
+
# USE_PREDEFINED_GRAVITY = "microgravity" # Will use zero gravity
|
379
|
+
# USE_PREDEFINED_GRAVITY = "moon" # Will use Moon gravity
|
@@ -0,0 +1,225 @@
|
|
1
|
+
# transport_properties_config.py
|
2
|
+
|
3
|
+
"""
|
4
|
+
Transport Properties Configuration for OpenFOAM cases.
|
5
|
+
|
6
|
+
This module provides comprehensive configuration options for fluid transport properties
|
7
|
+
including Newtonian and non-Newtonian models, thermal properties, and species transport.
|
8
|
+
"""
|
9
|
+
|
10
|
+
# =============================================================================
|
11
|
+
# *** User Input for transportProperties ***
|
12
|
+
# =============================================================================
|
13
|
+
|
14
|
+
# --- Master Control ---
|
15
|
+
# Set to True to write 'constant/transportProperties'.
|
16
|
+
WRITE_TRANSPORT_PROPERTIES = True
|
17
|
+
|
18
|
+
# --- Transport Model Selection ---
|
19
|
+
# Choose the transport model for your fluid simulation:
|
20
|
+
# Options:
|
21
|
+
# "Newtonian": Standard Newtonian fluid (constant viscosity)
|
22
|
+
# "NonNewtonian": Non-Newtonian fluid models (shear-thinning, etc.)
|
23
|
+
# "BirdCarreau": Bird-Carreau viscosity model
|
24
|
+
# "CrossPowerLaw": Cross power law viscosity model
|
25
|
+
# "HerschelBulkley": Herschel-Bulkley model for yield stress fluids
|
26
|
+
# "PowerLaw": Power law viscosity model
|
27
|
+
# "Casson": Casson model for yield stress fluids
|
28
|
+
# "GeneralizedNewtonian": General non-Newtonian model
|
29
|
+
TRANSPORT_MODEL = "Newtonian"
|
30
|
+
|
31
|
+
# =============================================================================
|
32
|
+
# *** Newtonian Transport Properties ***
|
33
|
+
# =============================================================================
|
34
|
+
# Used when TRANSPORT_MODEL = "Newtonian"
|
35
|
+
|
36
|
+
NEWTONIAN_PROPERTIES = {
|
37
|
+
# Dynamic viscosity in [Pa s] or kinematic viscosity in [m^2/s]
|
38
|
+
# For incompressible flows, use kinematic viscosity (nu)
|
39
|
+
# For compressible flows, use dynamic viscosity (mu) and specify density
|
40
|
+
"nu": "1e-05", # Kinematic viscosity [m^2/s] for water at 20°C
|
41
|
+
|
42
|
+
# Optional: Dynamic viscosity [Pa s] (for compressible flows)
|
43
|
+
# "mu": "1e-03", # Dynamic viscosity [Pa s]
|
44
|
+
|
45
|
+
# Optional: Density [kg/m^3] (for compressible flows)
|
46
|
+
# "rho": "1000", # Density [kg/m^3]
|
47
|
+
}
|
48
|
+
|
49
|
+
# =============================================================================
|
50
|
+
# *** Non-Newtonian Transport Properties ***
|
51
|
+
# =============================================================================
|
52
|
+
# Used when TRANSPORT_MODEL = "NonNewtonian"
|
53
|
+
|
54
|
+
NON_NEWTONIAN_PROPERTIES = {
|
55
|
+
# Base properties
|
56
|
+
"nu": "1e-05", # Reference kinematic viscosity [m^2/s]
|
57
|
+
|
58
|
+
# Non-Newtonian model selection
|
59
|
+
"model": "BirdCarreau", # Options: "BirdCarreau", "CrossPowerLaw", "HerschelBulkley", "PowerLaw", "Casson"
|
60
|
+
|
61
|
+
# Model coefficients
|
62
|
+
"modelCoeffs": {
|
63
|
+
# Bird-Carreau model coefficients
|
64
|
+
"nu0": "1e-05", # Zero shear rate viscosity [m^2/s]
|
65
|
+
"nuInf": "1e-07", # Infinite shear rate viscosity [m^2/s]
|
66
|
+
"k": "1.0", # Consistency index [s]
|
67
|
+
"n": "0.5", # Power law index
|
68
|
+
|
69
|
+
# Cross power law model coefficients (alternative)
|
70
|
+
# "nu0": "1e-05", # Zero shear rate viscosity [m^2/s]
|
71
|
+
# "nuInf": "1e-07", # Infinite shear rate viscosity [m^2/s]
|
72
|
+
# "k": "1.0", # Consistency index [s]
|
73
|
+
# "n": "0.5", # Power law index
|
74
|
+
|
75
|
+
# Herschel-Bulkley model coefficients (alternative)
|
76
|
+
# "tau0": "0.1", # Yield stress [Pa]
|
77
|
+
# "k": "1.0", # Consistency index [Pa s^n]
|
78
|
+
# "n": "0.5", # Power law index
|
79
|
+
|
80
|
+
# Power law model coefficients (alternative)
|
81
|
+
# "k": "1.0", # Consistency index [Pa s^n]
|
82
|
+
# "n": "0.5", # Power law index
|
83
|
+
|
84
|
+
# Casson model coefficients (alternative)
|
85
|
+
# "tau0": "0.1", # Yield stress [Pa]
|
86
|
+
# "mu": "1e-03", # Plastic viscosity [Pa s]
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
# =============================================================================
|
91
|
+
# *** Thermal Transport Properties ***
|
92
|
+
# =============================================================================
|
93
|
+
# Additional thermal properties for heat transfer simulations
|
94
|
+
|
95
|
+
THERMAL_PROPERTIES = {
|
96
|
+
# Enable thermal properties
|
97
|
+
"enableThermal": False,
|
98
|
+
|
99
|
+
# Thermal conductivity [W/(m K)]
|
100
|
+
"k": "0.6", # Thermal conductivity of water at 20°C
|
101
|
+
|
102
|
+
# Specific heat capacity [J/(kg K)]
|
103
|
+
"Cp": "4180", # Specific heat of water at 20°C
|
104
|
+
|
105
|
+
# Thermal diffusivity [m^2/s] (alternative to k and Cp)
|
106
|
+
# "alpha": "1.43e-07", # Thermal diffusivity of water at 20°C
|
107
|
+
|
108
|
+
# Prandtl number (alternative to k and Cp)
|
109
|
+
# "Pr": "7.0", # Prandtl number of water at 20°C
|
110
|
+
}
|
111
|
+
|
112
|
+
# =============================================================================
|
113
|
+
# *** Species Transport Properties ***
|
114
|
+
# =============================================================================
|
115
|
+
# Properties for multi-species simulations
|
116
|
+
|
117
|
+
SPECIES_PROPERTIES = {
|
118
|
+
# Enable species transport
|
119
|
+
"enableSpecies": False,
|
120
|
+
|
121
|
+
# Number of species
|
122
|
+
"nSpecies": 2,
|
123
|
+
|
124
|
+
# Species names
|
125
|
+
"speciesNames": ["air", "water"],
|
126
|
+
|
127
|
+
# Molecular diffusivity [m^2/s] for each species
|
128
|
+
"D": ["2e-05", "1e-09"], # Air and water diffusivity
|
129
|
+
|
130
|
+
# Schmidt number (alternative to D)
|
131
|
+
# "Sc": ["1.0", "1000.0"], # Schmidt numbers for air and water
|
132
|
+
}
|
133
|
+
|
134
|
+
# =============================================================================
|
135
|
+
# *** Advanced Transport Properties ***
|
136
|
+
# =============================================================================
|
137
|
+
# Additional advanced properties for specialized simulations
|
138
|
+
|
139
|
+
ADVANCED_PROPERTIES = {
|
140
|
+
# Enable advanced properties
|
141
|
+
"enableAdvanced": False,
|
142
|
+
|
143
|
+
# Surface tension [N/m] (for multiphase flows)
|
144
|
+
"sigma": "0.072", # Surface tension of water-air interface
|
145
|
+
|
146
|
+
# Contact angle [degrees] (for wetting simulations)
|
147
|
+
"contactAngle": "90", # Neutral wetting
|
148
|
+
|
149
|
+
# Compressibility [1/Pa] (for compressible flows)
|
150
|
+
"kappa": "4.5e-10", # Compressibility of water
|
151
|
+
|
152
|
+
# Bulk viscosity [Pa s] (for compressible flows)
|
153
|
+
"lambda": "0.0", # Bulk viscosity (usually zero for most fluids)
|
154
|
+
|
155
|
+
# Molecular weight [kg/mol] (for gas mixtures)
|
156
|
+
"molecularWeight": "28.97", # Molecular weight of air
|
157
|
+
|
158
|
+
# Reference temperature [K]
|
159
|
+
"TRef": "293.15", # Reference temperature (20°C)
|
160
|
+
|
161
|
+
# Reference pressure [Pa]
|
162
|
+
"pRef": "101325", # Reference pressure (1 atm)
|
163
|
+
}
|
164
|
+
|
165
|
+
# =============================================================================
|
166
|
+
# *** Predefined Fluid Properties ***
|
167
|
+
# =============================================================================
|
168
|
+
# Common fluid property sets for quick configuration
|
169
|
+
|
170
|
+
PREDEFINED_FLUIDS = {
|
171
|
+
"water_20C": {
|
172
|
+
"nu": "1e-06", # Kinematic viscosity [m^2/s]
|
173
|
+
"rho": "998.2", # Density [kg/m^3]
|
174
|
+
"k": "0.6", # Thermal conductivity [W/(m K)]
|
175
|
+
"Cp": "4182", # Specific heat [J/(kg K)]
|
176
|
+
"sigma": "0.0728", # Surface tension [N/m]
|
177
|
+
"description": "Water at 20°C"
|
178
|
+
},
|
179
|
+
|
180
|
+
"air_20C": {
|
181
|
+
"nu": "1.51e-05", # Kinematic viscosity [m^2/s]
|
182
|
+
"rho": "1.205", # Density [kg/m^3]
|
183
|
+
"k": "0.0257", # Thermal conductivity [W/(m K)]
|
184
|
+
"Cp": "1005", # Specific heat [J/(kg K)]
|
185
|
+
"sigma": "0.0", # Surface tension [N/m]
|
186
|
+
"description": "Air at 20°C and 1 atm"
|
187
|
+
},
|
188
|
+
|
189
|
+
"oil_sae30": {
|
190
|
+
"nu": "1e-04", # Kinematic viscosity [m^2/s]
|
191
|
+
"rho": "900", # Density [kg/m^3]
|
192
|
+
"k": "0.15", # Thermal conductivity [W/(m K)]
|
193
|
+
"Cp": "2000", # Specific heat [J/(kg K)]
|
194
|
+
"sigma": "0.03", # Surface tension [N/m]
|
195
|
+
"description": "SAE 30 motor oil"
|
196
|
+
},
|
197
|
+
|
198
|
+
"blood": {
|
199
|
+
"nu": "3e-06", # Kinematic viscosity [m^2/s]
|
200
|
+
"rho": "1050", # Density [kg/m^3]
|
201
|
+
"k": "0.5", # Thermal conductivity [W/(m K)]
|
202
|
+
"Cp": "3600", # Specific heat [J/(kg K)]
|
203
|
+
"sigma": "0.05", # Surface tension [N/m]
|
204
|
+
"description": "Human blood (approximate)"
|
205
|
+
},
|
206
|
+
|
207
|
+
"polymer_solution": {
|
208
|
+
"model": "BirdCarreau",
|
209
|
+
"nu0": "1e-04", # Zero shear viscosity [m^2/s]
|
210
|
+
"nuInf": "1e-06", # Infinite shear viscosity [m^2/s]
|
211
|
+
"k": "10.0", # Consistency index [s]
|
212
|
+
"n": "0.4", # Power law index
|
213
|
+
"description": "Typical polymer solution"
|
214
|
+
}
|
215
|
+
}
|
216
|
+
|
217
|
+
# =============================================================================
|
218
|
+
# *** Configuration Selection ***
|
219
|
+
# =============================================================================
|
220
|
+
# Select which predefined fluid to use (overrides manual settings above)
|
221
|
+
|
222
|
+
USE_PREDEFINED_FLUID = None # Set to fluid name from PREDEFINED_FLUIDS or None for manual config
|
223
|
+
|
224
|
+
# Example usage:
|
225
|
+
# USE_PREDEFINED_FLUID = "water_20C" # Will use water properties at 20°C
|