cffview 0.2.4__tar.gz → 0.2.5__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cffview
3
- Version: 0.2.4
3
+ Version: 0.2.5
4
4
  Summary: A Python CLI tool to inspect Ansys Fluent .cas.h5/.msh.h5 files without opening Fluent
5
5
  Author-email: preamer <1524477126@qq.com>
6
6
  License-Expression: BSD-3-Clause
@@ -57,6 +57,9 @@ pip install .
57
57
 
58
58
  ## Usage
59
59
 
60
+ > [!IMPORTANT]
61
+ > Only tested with Ansys Fluent 25R2!
62
+
60
63
  ```
61
64
  cffview <file> [options]
62
65
  ```
@@ -76,6 +79,7 @@ cffview <file> [options]
76
79
  | `--rd` | Report definitions |
77
80
  | `--plotsets` | Plot sets |
78
81
  | `--monitorsets` | Monitor sets |
82
+ | `--residuals` | Residual settings |
79
83
  | `--iter` | Iteration / time-step settings |
80
84
  | `--contours` | Graphics contours settings |
81
85
  | `--vectors` | Graphics vectors settings |
@@ -103,6 +107,10 @@ cffview case.cas.h5 --version
103
107
  cffview case.cas.h5 --extract
104
108
  ```
105
109
 
110
+ ### Demo
111
+
112
+ [demo.webm](https://github.com/user-attachments/assets/9047a354-b5cb-475e-b030-97609e2a1274)
113
+
106
114
  ---
107
115
 
108
116
  ## License
@@ -33,6 +33,9 @@ pip install .
33
33
 
34
34
  ## Usage
35
35
 
36
+ > [!IMPORTANT]
37
+ > Only tested with Ansys Fluent 25R2!
38
+
36
39
  ```
37
40
  cffview <file> [options]
38
41
  ```
@@ -52,6 +55,7 @@ cffview <file> [options]
52
55
  | `--rd` | Report definitions |
53
56
  | `--plotsets` | Plot sets |
54
57
  | `--monitorsets` | Monitor sets |
58
+ | `--residuals` | Residual settings |
55
59
  | `--iter` | Iteration / time-step settings |
56
60
  | `--contours` | Graphics contours settings |
57
61
  | `--vectors` | Graphics vectors settings |
@@ -79,6 +83,10 @@ cffview case.cas.h5 --version
79
83
  cffview case.cas.h5 --extract
80
84
  ```
81
85
 
86
+ ### Demo
87
+
88
+ [demo.webm](https://github.com/user-attachments/assets/9047a354-b5cb-475e-b030-97609e2a1274)
89
+
82
90
  ---
83
91
 
84
92
  ## License
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "cffview"
7
- version = "0.2.4"
7
+ version = "0.2.5"
8
8
  description = "A Python CLI tool to inspect Ansys Fluent .cas.h5/.msh.h5 files without opening Fluent"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -24,6 +24,7 @@ class Fluid:
24
24
  id_: str
25
25
  material: str = ''
26
26
  sources: str = ''
27
+ sources_terms: str = ''
27
28
  fixed: str = ''
28
29
  mrf_motion: str = ''
29
30
  mgrid_motion: str = ''
@@ -32,6 +33,14 @@ class Fluid:
32
33
  porous: str = ''
33
34
  fanzone: str = ''
34
35
 
36
+ def to_dict(self) -> dict[str, str]:
37
+ data = self.__dict__.copy()
38
+
39
+ if data['sources'] == '#f':
40
+ data.pop('sources_terms', None)
41
+
42
+ return data
43
+
35
44
 
36
45
  @dataclass
37
46
  @BoundaryFactory.register('solid')
@@ -40,6 +49,17 @@ class Solid:
40
49
  id_: str
41
50
  material: str = ''
42
51
  sources: str = ''
52
+ sources_terms: str = ''
53
+ fixed: str = ''
54
+ solid_motion: str = ''
55
+
56
+ def to_dict(self) -> dict[str, str]:
57
+ data = self.__dict__.copy()
58
+
59
+ if data['sources'] == '#f':
60
+ data.pop('sources_terms', None)
61
+
62
+ return data
43
63
 
44
64
 
45
65
  @dataclass
@@ -210,6 +230,13 @@ class PressureOutlet:
210
230
  return data
211
231
 
212
232
 
233
+ @dataclass
234
+ @BoundaryFactory.register('outflow')
235
+ class Outflow:
236
+ name: str
237
+ id_: str
238
+
239
+
213
240
  @dataclass
214
241
  @BoundaryFactory.register('wall')
215
242
  class Wall:
@@ -300,6 +327,13 @@ class Symmetry:
300
327
  id_: str
301
328
 
302
329
 
330
+ @dataclass
331
+ @BoundaryFactory.register('axis')
332
+ class Axis:
333
+ name: str
334
+ id_: str
335
+
336
+
303
337
  @dataclass
304
338
  class NotImplementedBoundary:
305
339
  name: str
@@ -21,8 +21,11 @@ def print_version(file_path: str) -> str:
21
21
 
22
22
 
23
23
  def read_case(file_path: str, **kwargs) -> dict[
24
- Literal['solver', 'materials', 'boundary', 'named-expressions',
25
- 'disc-scheme', 'report-definitions', 'plotsets', 'monitorsets', 'iter'],
24
+ Literal[
25
+ 'solver', 'materials', 'boundary', 'named-expressions',
26
+ 'disc-scheme', 'report-definitions', 'plotsets', 'monitorsets',
27
+ 'residuals', 'iter', 'contours', 'vectors'
28
+ ],
26
29
  dict[str]
27
30
  ]:
28
31
  """Read the cas.h5 file
@@ -185,10 +188,11 @@ def read_case(file_path: str, **kwargs) -> dict[
185
188
  for property_ in boundary_info[2]:
186
189
  property_name = str(property_[0]).replace('-', '_').replace('?', '').replace('/', '_')
187
190
  if hasattr(new_boundary, property_name):
188
- if property_[1] == sexpdata.Symbol('.'):
189
- setattr(new_boundary, property_name, str(property_[2]))
190
- elif isinstance(property_[1], list):
191
- setattr(new_boundary, property_name, f'{property_[1][0]}/{property_[1][2]}')
191
+ if len(property_) > 1:
192
+ if property_[1] == sexpdata.Symbol('.'):
193
+ setattr(new_boundary, property_name, str(property_[2]))
194
+ elif isinstance(property_[1], list):
195
+ setattr(new_boundary, property_name, f'{property_[1][0]}/{property_[1][2]}')
192
196
 
193
197
  b_list.append(new_boundary.to_dict() if hasattr(new_boundary, 'to_dict') else new_boundary.__dict__)
194
198
  data['boundary'][type_] = b_list
@@ -311,6 +315,49 @@ def read_case(file_path: str, **kwargs) -> dict[
311
315
  monitorset_dict['report-defs'] = monitorset[-4][1:]
312
316
  data['monitorsets'][monitorset_dict['name']] = monitorset_dict
313
317
 
318
+ if kwargs['residuals']:
319
+ import sexpdata
320
+
321
+ data['residuals'] = {}
322
+
323
+ for setting in [
324
+ r'advanced-options\?', r'normalize\?', r'compute-local\?',
325
+ r'scale\?', 'convergence-criterion-type', 'n-display',
326
+ 'n-save', r'plot\?', r'print\?', 'n-maximize-norms',
327
+ ]:
328
+ value = re.search(
329
+ fr'\(residuals/{setting}\s+(#[tf]|[\d.]+)\)',
330
+ general_info,
331
+ ).group(1)
332
+ data['residuals'][setting.removesuffix(r'\?')] = value
333
+ cct = data['residuals']['convergence-criterion-type']
334
+ data['residuals']['convergence-criterion-type'] = 'absolute' if cct == '0' else 'none'
335
+
336
+ if not (solver_time := data.get('solver', {}).get('time', None)):
337
+ case_config = re.search(
338
+ r'^\(case-config.*',
339
+ general_info,
340
+ re.M
341
+ ).group()
342
+ is_unsteady = re.search(
343
+ r"\(rp-unsteady\?\s+\.\s+([^()\s]+)\)",
344
+ case_config
345
+ ).group(1)
346
+ solver_time = "transient" if is_unsteady == "#t" else "steady"
347
+ residuals = 'residuals/settings-transient' if solver_time == 'transient' else 'residuals/settings'
348
+ res = re.search(
349
+ fr'(\({residuals}.*)',
350
+ general_info,
351
+ re.M
352
+ ).group(1)
353
+ res: list = sexpdata.loads(res, true=None)[1]
354
+ for eq in res:
355
+ data['residuals'][str(eq[0])] = {
356
+ 'monitor': str(eq[1]),
357
+ 'check-convergence': str(eq[3]),
358
+ 'absolute-criteria': str(eq[4]),
359
+ }
360
+
314
361
  if kwargs['iter']:
315
362
  data['iter'] = {}
316
363
 
@@ -535,6 +582,7 @@ def main() -> None:
535
582
  (("--rd", "--report-definitions"), "show report-definitions settings"),
536
583
  (("--plotsets",), "show report-definitions plotsets settings"),
537
584
  (("--monitorsets",), "show report-definitions monitorsets settings"),
585
+ (("--residuals",), "show residuals settings"),
538
586
  (("--iter",), "show iteration settings"),
539
587
  (("--contours",), "show graphics contours settings"),
540
588
  (("--vectors",), "show graphics vectors settings"),
@@ -567,9 +615,10 @@ def main() -> None:
567
615
  'rd': args.rd,
568
616
  'plotsets': args.plotsets,
569
617
  'monitorsets': args.monitorsets,
618
+ 'residuals': args.residuals,
619
+ 'iter': args.iter,
570
620
  'contours': args.contours,
571
621
  'vectors': args.vectors,
572
- 'iter': args.iter
573
622
  }
574
623
  output = read_case(args.file_path, **kwargs)
575
624
  print_colored_dict(output)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cffview
3
- Version: 0.2.4
3
+ Version: 0.2.5
4
4
  Summary: A Python CLI tool to inspect Ansys Fluent .cas.h5/.msh.h5 files without opening Fluent
5
5
  Author-email: preamer <1524477126@qq.com>
6
6
  License-Expression: BSD-3-Clause
@@ -57,6 +57,9 @@ pip install .
57
57
 
58
58
  ## Usage
59
59
 
60
+ > [!IMPORTANT]
61
+ > Only tested with Ansys Fluent 25R2!
62
+
60
63
  ```
61
64
  cffview <file> [options]
62
65
  ```
@@ -76,6 +79,7 @@ cffview <file> [options]
76
79
  | `--rd` | Report definitions |
77
80
  | `--plotsets` | Plot sets |
78
81
  | `--monitorsets` | Monitor sets |
82
+ | `--residuals` | Residual settings |
79
83
  | `--iter` | Iteration / time-step settings |
80
84
  | `--contours` | Graphics contours settings |
81
85
  | `--vectors` | Graphics vectors settings |
@@ -103,6 +107,10 @@ cffview case.cas.h5 --version
103
107
  cffview case.cas.h5 --extract
104
108
  ```
105
109
 
110
+ ### Demo
111
+
112
+ [demo.webm](https://github.com/user-attachments/assets/9047a354-b5cb-475e-b030-97609e2a1274)
113
+
106
114
  ---
107
115
 
108
116
  ## License
File without changes
File without changes
File without changes