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,219 @@
|
|
1
|
+
"""
|
2
|
+
CSV Boundary Condition Reader
|
3
|
+
|
4
|
+
This module reads boundary condition information from patches.csv and provides
|
5
|
+
it to the zero field writers in the correct format.
|
6
|
+
"""
|
7
|
+
|
8
|
+
import csv
|
9
|
+
from typing import Dict, List, Optional, Any
|
10
|
+
from dataclasses import dataclass
|
11
|
+
|
12
|
+
|
13
|
+
@dataclass
|
14
|
+
class PatchBoundaryCondition:
|
15
|
+
"""Data structure for patch boundary conditions."""
|
16
|
+
region_name: str
|
17
|
+
patch_name: str
|
18
|
+
patch_type: str
|
19
|
+
p_type: str
|
20
|
+
u_type: str
|
21
|
+
f_type: str
|
22
|
+
lambda_type: str
|
23
|
+
p_value: Optional[str] = None
|
24
|
+
u_value: Optional[str] = None
|
25
|
+
f_value: Optional[str] = None
|
26
|
+
lambda_value: Optional[str] = None
|
27
|
+
|
28
|
+
|
29
|
+
class CSVBoundaryReader:
|
30
|
+
"""
|
31
|
+
Reads boundary condition information from patches.csv file.
|
32
|
+
"""
|
33
|
+
|
34
|
+
def __init__(self, csv_file_path: str = "Inputs/patches.csv"):
|
35
|
+
"""
|
36
|
+
Initialize the CSV boundary reader.
|
37
|
+
|
38
|
+
Args:
|
39
|
+
csv_file_path: Path to the patches.csv file
|
40
|
+
"""
|
41
|
+
self.csv_file_path = csv_file_path
|
42
|
+
self.patches = {}
|
43
|
+
self._load_patches()
|
44
|
+
|
45
|
+
def _load_patches(self) -> None:
|
46
|
+
"""Load patch information from CSV file."""
|
47
|
+
try:
|
48
|
+
with open(self.csv_file_path, mode='r', newline='') as infile:
|
49
|
+
reader = csv.DictReader(infile)
|
50
|
+
|
51
|
+
# Check for required columns
|
52
|
+
required_columns = [
|
53
|
+
'RegionName', 'PatchName', 'PatchType',
|
54
|
+
'p', 'U', 'f', 'lambda'
|
55
|
+
]
|
56
|
+
|
57
|
+
if not all(col in reader.fieldnames for col in required_columns):
|
58
|
+
missing = set(required_columns) - set(reader.fieldnames)
|
59
|
+
raise KeyError(f"CSV file missing required columns: {missing}")
|
60
|
+
|
61
|
+
for row in reader:
|
62
|
+
patch_name = row['PatchName']
|
63
|
+
|
64
|
+
# Parse boundary condition types
|
65
|
+
p_type = row['p'].strip() if row['p'] else 'zeroGradient'
|
66
|
+
u_type = row['U'].strip() if row['U'] else 'noSlip'
|
67
|
+
f_type = row['f'].strip() if row['f'] else 'zeroGradient'
|
68
|
+
lambda_type = row['lambda'].strip() if row['lambda'] else 'fixedValue'
|
69
|
+
|
70
|
+
# Parse values (if provided)
|
71
|
+
p_value = row.get('p-value', '').strip() or None
|
72
|
+
u_value = row.get('U-value', '').strip() or None
|
73
|
+
f_value = row.get('f-value', '').strip() or None
|
74
|
+
lambda_value = row.get('lambda-value', '').strip() or None
|
75
|
+
|
76
|
+
self.patches[patch_name] = PatchBoundaryCondition(
|
77
|
+
region_name=row['RegionName'],
|
78
|
+
patch_name=patch_name,
|
79
|
+
patch_type=row['PatchType'],
|
80
|
+
p_type=p_type,
|
81
|
+
u_type=u_type,
|
82
|
+
f_type=f_type,
|
83
|
+
lambda_type=lambda_type,
|
84
|
+
p_value=p_value,
|
85
|
+
u_value=u_value,
|
86
|
+
f_value=f_value,
|
87
|
+
lambda_value=lambda_value
|
88
|
+
)
|
89
|
+
|
90
|
+
print(f"Loaded {len(self.patches)} patches from {self.csv_file_path}")
|
91
|
+
|
92
|
+
except FileNotFoundError:
|
93
|
+
print(f"Warning: {self.csv_file_path} not found. Using default boundary conditions.")
|
94
|
+
self.patches = {}
|
95
|
+
except Exception as e:
|
96
|
+
print(f"Error loading patches from CSV: {e}")
|
97
|
+
self.patches = {}
|
98
|
+
|
99
|
+
def get_pressure_boundary_conditions(self) -> Dict[str, Dict[str, Any]]:
|
100
|
+
"""
|
101
|
+
Get pressure boundary conditions in the format expected by PFieldWriter.
|
102
|
+
|
103
|
+
Returns:
|
104
|
+
Dictionary of boundary conditions for pressure field
|
105
|
+
"""
|
106
|
+
boundary_conditions = {}
|
107
|
+
|
108
|
+
for patch_name, patch in self.patches.items():
|
109
|
+
bc = {
|
110
|
+
'type': patch.p_type
|
111
|
+
}
|
112
|
+
|
113
|
+
# Add value if specified
|
114
|
+
if patch.p_value is not None and patch.p_value != '':
|
115
|
+
try:
|
116
|
+
bc['value'] = float(patch.p_value)
|
117
|
+
except ValueError:
|
118
|
+
bc['value'] = patch.p_value
|
119
|
+
|
120
|
+
boundary_conditions[patch_name] = bc
|
121
|
+
|
122
|
+
return boundary_conditions
|
123
|
+
|
124
|
+
def get_velocity_boundary_conditions(self) -> Dict[str, Dict[str, Any]]:
|
125
|
+
"""
|
126
|
+
Get velocity boundary conditions in the format expected by UFieldWriter.
|
127
|
+
|
128
|
+
Returns:
|
129
|
+
Dictionary of boundary conditions for velocity field
|
130
|
+
"""
|
131
|
+
boundary_conditions = {}
|
132
|
+
|
133
|
+
for patch_name, patch in self.patches.items():
|
134
|
+
bc = {
|
135
|
+
'type': patch.u_type
|
136
|
+
}
|
137
|
+
|
138
|
+
# Add value if specified
|
139
|
+
if patch.u_value is not None and patch.u_value != '':
|
140
|
+
try:
|
141
|
+
# Try to parse as vector (x, y, z)
|
142
|
+
if ',' in patch.u_value:
|
143
|
+
values = [float(x.strip()) for x in patch.u_value.split(',')]
|
144
|
+
bc['value'] = tuple(values)
|
145
|
+
else:
|
146
|
+
bc['value'] = float(patch.u_value)
|
147
|
+
except ValueError:
|
148
|
+
bc['value'] = patch.u_value
|
149
|
+
|
150
|
+
boundary_conditions[patch_name] = bc
|
151
|
+
|
152
|
+
return boundary_conditions
|
153
|
+
|
154
|
+
def get_force_boundary_conditions(self) -> Dict[str, Dict[str, Any]]:
|
155
|
+
"""
|
156
|
+
Get force boundary conditions in the format expected by FFieldWriter.
|
157
|
+
|
158
|
+
Returns:
|
159
|
+
Dictionary of boundary conditions for force field
|
160
|
+
"""
|
161
|
+
boundary_conditions = {}
|
162
|
+
|
163
|
+
for patch_name, patch in self.patches.items():
|
164
|
+
bc = {
|
165
|
+
'type': patch.f_type
|
166
|
+
}
|
167
|
+
|
168
|
+
# Add value if specified
|
169
|
+
if patch.f_value is not None and patch.f_value != '':
|
170
|
+
try:
|
171
|
+
# Try to parse as vector (x, y, z)
|
172
|
+
if ',' in patch.f_value:
|
173
|
+
values = [float(x.strip()) for x in patch.f_value.split(',')]
|
174
|
+
bc['value'] = tuple(values)
|
175
|
+
else:
|
176
|
+
bc['value'] = float(patch.f_value)
|
177
|
+
except ValueError:
|
178
|
+
bc['value'] = patch.f_value
|
179
|
+
|
180
|
+
boundary_conditions[patch_name] = bc
|
181
|
+
|
182
|
+
return boundary_conditions
|
183
|
+
|
184
|
+
def get_lambda_boundary_conditions(self) -> Dict[str, Dict[str, Any]]:
|
185
|
+
"""
|
186
|
+
Get lambda boundary conditions in the format expected by LambdaFieldWriter.
|
187
|
+
|
188
|
+
Returns:
|
189
|
+
Dictionary of boundary conditions for lambda field
|
190
|
+
"""
|
191
|
+
boundary_conditions = {}
|
192
|
+
|
193
|
+
for patch_name, patch in self.patches.items():
|
194
|
+
bc = {
|
195
|
+
'type': patch.lambda_type
|
196
|
+
}
|
197
|
+
|
198
|
+
# Add value if specified
|
199
|
+
if patch.lambda_value is not None and patch.lambda_value != '':
|
200
|
+
try:
|
201
|
+
bc['value'] = float(patch.lambda_value)
|
202
|
+
except ValueError:
|
203
|
+
bc['value'] = patch.lambda_value
|
204
|
+
|
205
|
+
boundary_conditions[patch_name] = bc
|
206
|
+
|
207
|
+
return boundary_conditions
|
208
|
+
|
209
|
+
def get_patch_names(self) -> List[str]:
|
210
|
+
"""Get list of all patch names."""
|
211
|
+
return list(self.patches.keys())
|
212
|
+
|
213
|
+
def get_patch_info(self, patch_name: str) -> Optional[PatchBoundaryCondition]:
|
214
|
+
"""Get information for a specific patch."""
|
215
|
+
return self.patches.get(patch_name)
|
216
|
+
|
217
|
+
|
218
|
+
# Global instance for easy access
|
219
|
+
csv_boundary_reader = CSVBoundaryReader()
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# system/__init__.py
|
2
|
+
"""
|
3
|
+
System directory configuration modules.
|
4
|
+
|
5
|
+
This package contains configuration modules for OpenFOAM system directory files:
|
6
|
+
- blockMeshDict
|
7
|
+
- controlDict
|
8
|
+
- fvSchemes
|
9
|
+
- fvOptions
|
10
|
+
- setFieldsDict
|
11
|
+
- decomposeParDict
|
12
|
+
- snappyHexMeshDict
|
13
|
+
"""
|
14
|
+
|
15
|
+
from . import block_mesh_config
|
16
|
+
from . import control_config
|
17
|
+
from . import fv_schemes_config
|
18
|
+
from . import fv_options_config
|
19
|
+
from . import set_fields_config
|
20
|
+
from . import decompose_par_config
|
21
|
+
from . import snappy_hex_mesh_config
|
22
|
+
|
23
|
+
__all__ = [
|
24
|
+
'block_mesh_config',
|
25
|
+
'control_config',
|
26
|
+
'fv_schemes_config',
|
27
|
+
'fv_options_config',
|
28
|
+
'set_fields_config',
|
29
|
+
'decompose_par_config',
|
30
|
+
'snappy_hex_mesh_config'
|
31
|
+
]
|
@@ -0,0 +1,184 @@
|
|
1
|
+
# block_mesh_config.py
|
2
|
+
|
3
|
+
# =============================================================================
|
4
|
+
# *** Enhanced User Input Configuration for blockMeshDict Generation ***
|
5
|
+
# =============================================================================
|
6
|
+
#
|
7
|
+
# This enhanced configuration supports complex geometries with multiple blocks,
|
8
|
+
# advanced grading, and sophisticated boundary conditions based on OpenFOAM
|
9
|
+
# examples from Resources/Z Foam Collections.
|
10
|
+
#
|
11
|
+
|
12
|
+
# --- 1. Basic Geometry Definition ---
|
13
|
+
|
14
|
+
# `p0`: The minimum corner of the computational domain (x_min, y_min, z_min).
|
15
|
+
# This defines the bottom-left-front corner of the geometry.
|
16
|
+
# Example: (0.0, 0.0, 0.0) for a domain starting at the origin
|
17
|
+
p0 = (0.0, 0.0, 0.0)
|
18
|
+
|
19
|
+
# `p1`: The maximum corner of the computational domain (x_max, y_max, z_max).
|
20
|
+
# This defines the top-right-back corner of the geometry.
|
21
|
+
# Example: (0.5, 0.2, 0.1) for a channel 0.5m long, 0.2m wide, 0.1m high
|
22
|
+
p1 = (0.5, 0.2, 0.1)
|
23
|
+
|
24
|
+
# `scale`: Scaling factor for the mesh coordinates.
|
25
|
+
# Usually set to 1.0 for actual dimensions. Use other values to scale the entire geometry.
|
26
|
+
# Example: 1.0 for meters, 0.001 for millimeters, 1000 for kilometers
|
27
|
+
# Special scaling examples: 0.01 (cm to m), 0.0032 (mm to m), 1000 (m to km)
|
28
|
+
scale = 1.0
|
29
|
+
|
30
|
+
# --- 2. Mesh Complexity Level ---
|
31
|
+
|
32
|
+
# `mesh_type`: Type of mesh to generate
|
33
|
+
# Options: 'simple', 'multi_block', 'complex'
|
34
|
+
# - 'simple': Single block with uniform or simple grading
|
35
|
+
# - 'multi_block': Multiple blocks with different properties
|
36
|
+
# - 'complex': Advanced multi-block with edges, grading, and special features
|
37
|
+
mesh_type = "simple"
|
38
|
+
|
39
|
+
# --- 3. Simple Mesh Configuration (when mesh_type = "simple") ---
|
40
|
+
|
41
|
+
# `cells`: Number of cells in each direction (nx, ny, nz).
|
42
|
+
# This determines the mesh resolution. Higher numbers = finer mesh = longer computation time.
|
43
|
+
# Example: (50, 20, 50) means 50 cells in x-direction, 20 in y-direction, 50 in z-direction
|
44
|
+
# Total cells = nx * ny * nz = 50 * 20 * 50 = 50,000 cells
|
45
|
+
cells = (50, 20, 50)
|
46
|
+
|
47
|
+
# `grading`: Cell size grading for each direction (simpleGrading).
|
48
|
+
# Controls how cell sizes change across the domain.
|
49
|
+
# Example: (1, 1, 1) for uniform cells, (2, 1, 0.5) for graded cells
|
50
|
+
# Grading > 1: cells get larger in that direction
|
51
|
+
# Grading < 1: cells get smaller in that direction
|
52
|
+
grading = (1, 1, 1)
|
53
|
+
|
54
|
+
# --- 4. Multi-Block Configuration (when mesh_type = "multi_block" or "complex") ---
|
55
|
+
|
56
|
+
# `blocks`: List of block definitions for multi-block meshes
|
57
|
+
# Each block is defined by:
|
58
|
+
# - vertices: List of 8 vertex indices (0-7 for a hex)
|
59
|
+
# - cells: Number of cells in each direction (nx, ny, nz)
|
60
|
+
# - grading: Grading specification
|
61
|
+
# - grading_type: 'simpleGrading' or 'edgeGrading'
|
62
|
+
blocks = [
|
63
|
+
{
|
64
|
+
"name": "block1",
|
65
|
+
"vertices": [0, 1, 2, 3, 4, 5, 6, 7], # Standard hex vertices
|
66
|
+
"cells": (40, 40, 1),
|
67
|
+
"grading": (1, 1, 1),
|
68
|
+
"grading_type": "simpleGrading"
|
69
|
+
}
|
70
|
+
]
|
71
|
+
|
72
|
+
# `vertices`: Custom vertex definitions for complex geometries
|
73
|
+
# List of (x, y, z) coordinates. Vertices are referenced by index (0-based)
|
74
|
+
# Example: [(0, 0, 0), (1, 0, 0), (1, 1, 0), (0, 1, 0), ...]
|
75
|
+
vertices = []
|
76
|
+
|
77
|
+
# `edges`: Edge definitions for curved boundaries
|
78
|
+
# List of edge dictionaries with type and parameters
|
79
|
+
# Example: [{"type": "arc", "points": [0, 1], "centre": [0.5, 0.5, 0]}]
|
80
|
+
edges = []
|
81
|
+
|
82
|
+
# --- 5. Boundary Patch Names ---
|
83
|
+
|
84
|
+
# `patch_names`: Dictionary mapping geometric faces to boundary patch names.
|
85
|
+
# These names will be used in boundary condition files and OpenFOAM dictionaries.
|
86
|
+
#
|
87
|
+
# Face identifiers:
|
88
|
+
# 'minX': Face at minimum X (x = p0[0])
|
89
|
+
# 'maxX': Face at maximum X (x = p1[0])
|
90
|
+
# 'minY': Face at minimum Y (y = p0[1])
|
91
|
+
# 'maxY': Face at maximum Y (y = p1[1])
|
92
|
+
# 'minZ': Face at minimum Z (z = p0[2])
|
93
|
+
# 'maxZ': Face at maximum Z (z = p1[2])
|
94
|
+
#
|
95
|
+
# Common patch types in OpenFOAM:
|
96
|
+
# - 'patch': General boundary patch
|
97
|
+
# - 'wall': Solid wall boundary
|
98
|
+
# - 'symmetryPlane': Symmetry boundary
|
99
|
+
# - 'empty': 2D simulation (front/back faces)
|
100
|
+
# - 'cyclic': Periodic boundary condition
|
101
|
+
# - 'wedge': Axisymmetric simulation
|
102
|
+
#
|
103
|
+
# Example for channel flow:
|
104
|
+
patch_names = {
|
105
|
+
'minX': 'inlet', # Inlet face (flow enters here)
|
106
|
+
'maxX': 'outlet', # Outlet face (flow exits here)
|
107
|
+
'minY': 'frontWall', # Front wall (solid boundary)
|
108
|
+
'maxY': 'backWall', # Back wall (solid boundary)
|
109
|
+
'minZ': 'floor', # Floor (solid boundary)
|
110
|
+
'maxZ': 'ceiling' # Ceiling (solid boundary)
|
111
|
+
}
|
112
|
+
|
113
|
+
# `custom_boundaries`: Custom boundary definitions for complex geometries
|
114
|
+
# List of boundary dictionaries with faces and properties
|
115
|
+
custom_boundaries = []
|
116
|
+
|
117
|
+
# --- 6. Advanced Meshing Options ---
|
118
|
+
|
119
|
+
# `merge_patch_pairs`: List of patch pairs to merge (for periodic boundaries).
|
120
|
+
# Example: [('leftWall', 'rightWall')] to create a periodic boundary
|
121
|
+
merge_patch_pairs = []
|
122
|
+
|
123
|
+
# `preserve_cell_zones`: Whether to preserve cell zones during mesh generation
|
124
|
+
preserve_cell_zones = False
|
125
|
+
|
126
|
+
# `preserve_face_zones`: Whether to preserve face zones during mesh generation
|
127
|
+
preserve_face_zones = False
|
128
|
+
|
129
|
+
# `preserve_point_zones`: Whether to preserve point zones during mesh generation
|
130
|
+
preserve_point_zones = False
|
131
|
+
|
132
|
+
# --- 7. Predefined Geometry Templates ---
|
133
|
+
|
134
|
+
# `geometry_template`: Select a predefined geometry template
|
135
|
+
# Options: 'none', 'channel', 'pipe', 'cavity', 'backward_facing_step', 'airfoil'
|
136
|
+
# When 'none' is selected, use custom geometry defined above
|
137
|
+
geometry_template = "none"
|
138
|
+
|
139
|
+
# `template_parameters`: Parameters for the selected template
|
140
|
+
# These override the basic geometry parameters when a template is selected
|
141
|
+
template_parameters = {
|
142
|
+
# Channel flow template
|
143
|
+
"channel": {
|
144
|
+
"length": 1.0, # Channel length [m]
|
145
|
+
"height": 0.1, # Channel height [m]
|
146
|
+
"width": 0.02, # Channel width [m] (2D: small, 3D: actual width)
|
147
|
+
"inlet_length": 0.2, # Inlet development length [m]
|
148
|
+
"outlet_length": 0.2 # Outlet development length [m]
|
149
|
+
},
|
150
|
+
# Pipe flow template
|
151
|
+
"pipe": {
|
152
|
+
"length": 2.0, # Pipe length [m]
|
153
|
+
"diameter": 0.1, # Pipe diameter [m]
|
154
|
+
"inlet_length": 0.5, # Inlet development length [m]
|
155
|
+
"outlet_length": 0.5 # Outlet development length [m]
|
156
|
+
},
|
157
|
+
# Cavity flow template
|
158
|
+
"cavity": {
|
159
|
+
"length": 1.0, # Cavity length [m]
|
160
|
+
"height": 1.0, # Cavity height [m]
|
161
|
+
"depth": 0.01, # Cavity depth [m] (2D: small, 3D: actual depth)
|
162
|
+
"lid_velocity": 1.0 # Lid velocity [m/s]
|
163
|
+
}
|
164
|
+
}
|
165
|
+
|
166
|
+
# --- 8. Validation Settings ---
|
167
|
+
|
168
|
+
# `min_cell_size`: Minimum allowed cell size (for validation).
|
169
|
+
# Used to prevent extremely small cells that could cause numerical issues.
|
170
|
+
min_cell_size = 1e-6
|
171
|
+
|
172
|
+
# `max_cell_size`: Maximum allowed cell size (for validation).
|
173
|
+
# Used to prevent extremely large cells that could cause accuracy issues.
|
174
|
+
max_cell_size = 1.0
|
175
|
+
|
176
|
+
# `max_total_cells`: Maximum allowed total number of cells (for validation).
|
177
|
+
# Used to prevent creating meshes that are too large for available computational resources.
|
178
|
+
max_total_cells = 1000000
|
179
|
+
|
180
|
+
# `aspect_ratio_limit`: Maximum allowed cell aspect ratio
|
181
|
+
aspect_ratio_limit = 100.0
|
182
|
+
|
183
|
+
# `skewness_limit`: Maximum allowed cell skewness
|
184
|
+
skewness_limit = 0.8
|
@@ -164,5 +164,117 @@ control_params = {
|
|
164
164
|
# `pRefValue`: Reference pressure value (for pressure field).
|
165
165
|
# The pressure value at the reference cell.
|
166
166
|
# Example: 0.0 (atmospheric pressure reference)
|
167
|
-
"pRefValue": 0.0
|
167
|
+
"pRefValue": 0.0,
|
168
|
+
|
169
|
+
# --- Library Dependencies ---
|
170
|
+
|
171
|
+
# `libs`: List of additional libraries to load
|
172
|
+
# These are required for certain solvers or function objects
|
173
|
+
# Example: ["interfaceTrackingFvMesh"] for interFoam with interface tracking
|
174
|
+
"libs": [],
|
175
|
+
|
176
|
+
# --- Advanced Time Control ---
|
177
|
+
|
178
|
+
# `maxAlphaCo`: Maximum allowable alpha Courant number for multiphase flows
|
179
|
+
# Controls interface tracking stability in VOF simulations
|
180
|
+
# Typical range: 0.1 to 1.0
|
181
|
+
"maxAlphaCo": 1.0,
|
182
|
+
|
183
|
+
# `maxDi`: Maximum allowable diffusion number
|
184
|
+
# Used for stability control in diffusion-dominated problems
|
185
|
+
"maxDi": 10.0,
|
186
|
+
|
187
|
+
# `maxDeltaT`: Maximum time step limit (safety measure)
|
188
|
+
# Prevents time step from becoming too large
|
189
|
+
"maxDeltaT": 1.0,
|
190
|
+
|
191
|
+
# --- Function Objects and Monitoring ---
|
192
|
+
|
193
|
+
# `functions`: Dictionary of function objects for monitoring and data collection
|
194
|
+
# These enable real-time monitoring, data sampling, and post-processing
|
195
|
+
"functions": {
|
196
|
+
# Example probes for monitoring specific locations
|
197
|
+
"probes": {
|
198
|
+
"type": "probes",
|
199
|
+
"libs": ["sampling"],
|
200
|
+
"fields": ["p", "U", "T"],
|
201
|
+
"probeLocations": [
|
202
|
+
(0.1, 0.05, 0.05), # Near inlet
|
203
|
+
(0.5, 0.05, 0.05), # Mid domain
|
204
|
+
(0.9, 0.05, 0.05) # Near outlet
|
205
|
+
],
|
206
|
+
"writeControl": "timeStep",
|
207
|
+
"writeInterval": 10
|
208
|
+
}
|
209
|
+
},
|
210
|
+
|
211
|
+
# --- Solver-Specific Advanced Options ---
|
212
|
+
|
213
|
+
# `residualControl`: Convergence criteria for iterative solvers
|
214
|
+
# Controls when the solver considers a time step converged
|
215
|
+
"residualControl": {
|
216
|
+
"p": 1e-6,
|
217
|
+
"U": 1e-6,
|
218
|
+
"k": 1e-6,
|
219
|
+
"epsilon": 1e-6,
|
220
|
+
"omega": 1e-6,
|
221
|
+
"alpha.water": 1e-6
|
222
|
+
},
|
223
|
+
|
224
|
+
# `relaxationFactors`: Under-relaxation factors for field updates
|
225
|
+
# Controls stability and convergence rate
|
226
|
+
"relaxationFactors": {
|
227
|
+
"fields": {
|
228
|
+
"p": 0.3,
|
229
|
+
"pFinal": 1.0
|
230
|
+
},
|
231
|
+
"equations": {
|
232
|
+
"U": 0.7,
|
233
|
+
"k": 0.7,
|
234
|
+
"epsilon": 0.7,
|
235
|
+
"omega": 0.7
|
236
|
+
}
|
237
|
+
},
|
238
|
+
|
239
|
+
# `momentumPredictor`: Whether to use momentum predictor
|
240
|
+
# Improves convergence for transient simulations
|
241
|
+
"momentumPredictor": "yes",
|
242
|
+
|
243
|
+
# `transonic`: Whether to use transonic corrections
|
244
|
+
# For compressible flows near Mach 1
|
245
|
+
"transonic": "no",
|
246
|
+
|
247
|
+
# `consistent`: Whether to use consistent discretization
|
248
|
+
# For better accuracy on non-orthogonal meshes
|
249
|
+
"consistent": "yes",
|
250
|
+
|
251
|
+
# --- Turbulence Model Settings ---
|
252
|
+
|
253
|
+
# `turbulence`: Turbulence model configuration
|
254
|
+
"turbulence": "on",
|
255
|
+
|
256
|
+
# `printCoeffs`: Whether to print turbulence model coefficients
|
257
|
+
"printCoeffs": "on",
|
258
|
+
|
259
|
+
# --- Solution Control ---
|
260
|
+
|
261
|
+
# `cacheAgglomeration`: Cache agglomeration for AMG solvers
|
262
|
+
"cacheAgglomeration": "on",
|
263
|
+
|
264
|
+
# `agglomerator`: Agglomeration method for AMG
|
265
|
+
"agglomerator": "faceAreaPair",
|
266
|
+
|
267
|
+
# `mergeLevels`: Number of levels to merge in AMG
|
268
|
+
"mergeLevels": 1,
|
269
|
+
|
270
|
+
# --- Monitoring and Output ---
|
271
|
+
|
272
|
+
# `writeResiduals`: Whether to write residual information
|
273
|
+
"writeResiduals": "yes",
|
274
|
+
|
275
|
+
# `writeMesh`: Whether to write mesh information
|
276
|
+
"writeMesh": "no",
|
277
|
+
|
278
|
+
# `writeGraph`: Whether to write convergence graphs
|
279
|
+
"writeGraph": "yes"
|
168
280
|
}
|