plot3d 1.7.1__tar.gz → 1.7.3__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.
- {plot3d-1.7.1 → plot3d-1.7.3}/PKG-INFO +2 -3
- {plot3d-1.7.1 → plot3d-1.7.3}/plot3d/glennht/class_definitions.py +2 -2
- {plot3d-1.7.1 → plot3d-1.7.3}/plot3d/glennht/export_functions.py +57 -13
- {plot3d-1.7.1 → plot3d-1.7.3}/pyproject.toml +1 -1
- {plot3d-1.7.1 → plot3d-1.7.3}/plot3d/__init__.py +0 -0
- {plot3d-1.7.1 → plot3d-1.7.3}/plot3d/block.py +0 -0
- {plot3d-1.7.1 → plot3d-1.7.3}/plot3d/block_merging_mixed_facepairs.py +0 -0
- {plot3d-1.7.1 → plot3d-1.7.3}/plot3d/blockfunctions.py +0 -0
- {plot3d-1.7.1 → plot3d-1.7.3}/plot3d/connectivity.py +0 -0
- {plot3d-1.7.1 → plot3d-1.7.3}/plot3d/differencing.py +0 -0
- {plot3d-1.7.1 → plot3d-1.7.3}/plot3d/face.py +0 -0
- {plot3d-1.7.1 → plot3d-1.7.3}/plot3d/facefunctions.py +0 -0
- {plot3d-1.7.1 → plot3d-1.7.3}/plot3d/glennht/__init__.py +0 -0
- {plot3d-1.7.1 → plot3d-1.7.3}/plot3d/glennht/import_functions.py +0 -0
- {plot3d-1.7.1 → plot3d-1.7.3}/plot3d/graph.py +0 -0
- {plot3d-1.7.1 → plot3d-1.7.3}/plot3d/gridpro/__init__.py +0 -0
- {plot3d-1.7.1 → plot3d-1.7.3}/plot3d/gridpro/import_functions.py +0 -0
- {plot3d-1.7.1 → plot3d-1.7.3}/plot3d/listfunctions.py +0 -0
- {plot3d-1.7.1 → plot3d-1.7.3}/plot3d/periodicity.py +0 -0
- {plot3d-1.7.1 → plot3d-1.7.3}/plot3d/point_match.py +0 -0
- {plot3d-1.7.1 → plot3d-1.7.3}/plot3d/read.py +0 -0
- {plot3d-1.7.1 → plot3d-1.7.3}/plot3d/split_block.py +0 -0
- {plot3d-1.7.1 → plot3d-1.7.3}/plot3d/write.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
2
|
Name: plot3d
|
|
3
|
-
Version: 1.7.
|
|
3
|
+
Version: 1.7.3
|
|
4
4
|
Summary: Plot3D python utilities for reading and writing and also finding connectivity between blocks
|
|
5
5
|
Author: Paht Juangphanich
|
|
6
6
|
Author-email: paht.juangphanich@nasa.gov
|
|
@@ -8,7 +8,6 @@ Requires-Python: >=3.10.12,<4.0.0
|
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
9
9
|
Classifier: Programming Language :: Python :: 3.11
|
|
10
10
|
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
12
11
|
Requires-Dist: networkx
|
|
13
12
|
Requires-Dist: numpy
|
|
14
13
|
Requires-Dist: pandas
|
|
@@ -114,12 +114,12 @@ class OutletBC(BoundaryCondition):
|
|
|
114
114
|
|
|
115
115
|
@dataclass
|
|
116
116
|
class SymmetricSlipBC(BoundaryCondition):
|
|
117
|
-
|
|
117
|
+
slip_subType: Optional[SymmetricSlipSubtype] = None
|
|
118
118
|
slip_omega: Optional[float] = None
|
|
119
119
|
|
|
120
120
|
@dataclass
|
|
121
121
|
class WallBC(BoundaryCondition):
|
|
122
|
-
|
|
122
|
+
wall_subType: Optional[int] = None
|
|
123
123
|
Twall_const: Optional[float] = None
|
|
124
124
|
have_Twall_prof: bool = False
|
|
125
125
|
filen_Twall_prof: Optional[str] = None
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# glennht_export_functions.py
|
|
2
2
|
from __future__ import annotations
|
|
3
|
+
from collections import defaultdict
|
|
3
4
|
import math
|
|
4
5
|
import json
|
|
5
6
|
import pathlib
|
|
@@ -406,15 +407,34 @@ def export_to_boundary_condition(
|
|
|
406
407
|
else:
|
|
407
408
|
w.write(_export_namelist_block("VZConditions", vz)); w.write("\n")
|
|
408
409
|
|
|
410
|
+
# keep the *first* object for each unique obj.subtype
|
|
411
|
+
def first_by_subtype(objs: Iterable[T], subtype_attr: str, *, include_none=False) -> List[T]:
|
|
412
|
+
seen = set()
|
|
413
|
+
out: List[T] = []
|
|
414
|
+
for o in objs:
|
|
415
|
+
# works for both objects and dicts
|
|
416
|
+
st = getattr(o, subtype_attr, None) if not isinstance(o, dict) else o.get(subtype_attr)
|
|
417
|
+
if st is None and not include_none:
|
|
418
|
+
continue
|
|
419
|
+
if st not in seen:
|
|
420
|
+
seen.add(st)
|
|
421
|
+
out.append(o)
|
|
422
|
+
return out
|
|
423
|
+
|
|
424
|
+
inlet_bc = first_by_subtype(bc_group.Inlets,'inlet_subType')
|
|
425
|
+
outlet_bc = first_by_subtype(bc_group.Outlets,'outlet_subType')
|
|
426
|
+
slip_bc = first_by_subtype(bc_group.SymmetricSlips,'slip_subType')
|
|
427
|
+
wall_bc = first_by_subtype(bc_group.Walls,'wall_subType')
|
|
428
|
+
|
|
409
429
|
# Detailed BC blocks (skip meta + *_unit)
|
|
410
430
|
exclude = {"Name", "SurfaceID", "BCType"}
|
|
411
|
-
for inlet in
|
|
431
|
+
for inlet in inlet_bc:
|
|
412
432
|
w.write(_export_namelist_block("INLET_BC", inlet, exclude_names=exclude)); w.write("\n")
|
|
413
|
-
for outlet in
|
|
433
|
+
for outlet in outlet_bc:
|
|
414
434
|
w.write(_export_namelist_block("OUTLET_BC", outlet, exclude_names=exclude)); w.write("\n")
|
|
415
|
-
for slip in
|
|
435
|
+
for slip in slip_bc:
|
|
416
436
|
w.write(_export_namelist_block("SLIP_BC", slip, exclude_names=exclude)); w.write("\n")
|
|
417
|
-
for wall in
|
|
437
|
+
for wall in wall_bc:
|
|
418
438
|
w.write(_export_namelist_block("WALL_BC", wall, exclude_names=exclude)); w.write("\n")
|
|
419
439
|
|
|
420
440
|
# ============================================================
|
|
@@ -472,6 +492,31 @@ def export_to_job_file(
|
|
|
472
492
|
if exec_mpi:
|
|
473
493
|
w.write(f'execFILE="{exec_mpi}"\n')
|
|
474
494
|
|
|
495
|
+
def summarize_contiguous(records: List[Dict[str, Any]]) -> Dict[str, Any]:
|
|
496
|
+
"""
|
|
497
|
+
Given a list of dicts with keys: 'block_index', 'zone_type', 'contiguous_id',
|
|
498
|
+
return:
|
|
499
|
+
- num_unique_contiguous_ids: int
|
|
500
|
+
- zone_types_by_id: {contiguous_id: [unique zone types]}
|
|
501
|
+
- ids_with_multiple_zone_types: [ids that have >1 zone type]
|
|
502
|
+
"""
|
|
503
|
+
id_to_zone_types = defaultdict(set)
|
|
504
|
+
|
|
505
|
+
for r in records:
|
|
506
|
+
# will raise KeyError if required keys are missing (helpful fail)
|
|
507
|
+
cid = r["contiguous_id"]
|
|
508
|
+
zt = r["zone_type"]
|
|
509
|
+
id_to_zone_types[cid].add(zt)
|
|
510
|
+
|
|
511
|
+
zone_types_by_id = {cid: sorted(zts) for cid, zts in id_to_zone_types.items()}
|
|
512
|
+
ids_with_multiple = [cid for cid, zts in zone_types_by_id.items() if len(zts) > 1]
|
|
513
|
+
|
|
514
|
+
return {
|
|
515
|
+
"num_unique_contiguous_ids": len(zone_types_by_id),
|
|
516
|
+
"zone_types_by_id": zone_types_by_id,
|
|
517
|
+
"ids_with_multiple_zone_types": sorted(ids_with_multiple),
|
|
518
|
+
}
|
|
519
|
+
|
|
475
520
|
|
|
476
521
|
def export_to_glennht_conn(matches:List[Dict[str, Dict[int, str]]],outer_faces:List[Dict[str,int]],filename:str, gifs:List[List[Dict[str, int]]],volume_zones:List[Dict[str,Any]]):
|
|
477
522
|
"""Exports the connectivity to GlennHT format
|
|
@@ -517,19 +562,18 @@ def export_to_glennht_conn(matches:List[Dict[str, Dict[int, str]]],outer_faces:L
|
|
|
517
562
|
for gif in gifs:
|
|
518
563
|
lines.append(f"{gif['id1']} {gif['id2']} -2 1\n") # type: ignore
|
|
519
564
|
|
|
565
|
+
summary = summarize_contiguous(volume_zones)
|
|
520
566
|
# Print volume zones
|
|
521
|
-
|
|
522
|
-
lines.append(f"{
|
|
567
|
+
|
|
568
|
+
lines.append(f"{summary['num_unique_contiguous_ids']}\n")
|
|
523
569
|
# Print what types of zones are there
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
lines.append(f"{zonetype_map[v['zone_type']]} ")
|
|
528
|
-
prevType = v['zone_type']
|
|
570
|
+
for k,v in summary['zone_types_by_id'].items():
|
|
571
|
+
lines.append(f"{k} ")
|
|
572
|
+
lines.append("\n")
|
|
529
573
|
# Print Zone Groups
|
|
530
|
-
columns_to_print =
|
|
574
|
+
columns_to_print = 10
|
|
531
575
|
for i,v in enumerate(volume_zones):
|
|
532
|
-
if i % columns_to_print:
|
|
576
|
+
if i % columns_to_print==0:
|
|
533
577
|
lines.append(f"{v["contiguous_id"]}\n")
|
|
534
578
|
else:
|
|
535
579
|
lines.append(f"{v["contiguous_id"]} ")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|