plot3d 1.7.3__tar.gz → 1.7.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.
- {plot3d-1.7.3 → plot3d-1.7.5}/PKG-INFO +1 -1
- {plot3d-1.7.3 → plot3d-1.7.5}/plot3d/glennht/export_functions.py +30 -24
- {plot3d-1.7.3 → plot3d-1.7.5}/plot3d/gridpro/import_functions.py +14 -13
- {plot3d-1.7.3 → plot3d-1.7.5}/pyproject.toml +1 -1
- {plot3d-1.7.3 → plot3d-1.7.5}/plot3d/__init__.py +0 -0
- {plot3d-1.7.3 → plot3d-1.7.5}/plot3d/block.py +0 -0
- {plot3d-1.7.3 → plot3d-1.7.5}/plot3d/block_merging_mixed_facepairs.py +0 -0
- {plot3d-1.7.3 → plot3d-1.7.5}/plot3d/blockfunctions.py +0 -0
- {plot3d-1.7.3 → plot3d-1.7.5}/plot3d/connectivity.py +0 -0
- {plot3d-1.7.3 → plot3d-1.7.5}/plot3d/differencing.py +0 -0
- {plot3d-1.7.3 → plot3d-1.7.5}/plot3d/face.py +0 -0
- {plot3d-1.7.3 → plot3d-1.7.5}/plot3d/facefunctions.py +0 -0
- {plot3d-1.7.3 → plot3d-1.7.5}/plot3d/glennht/__init__.py +0 -0
- {plot3d-1.7.3 → plot3d-1.7.5}/plot3d/glennht/class_definitions.py +0 -0
- {plot3d-1.7.3 → plot3d-1.7.5}/plot3d/glennht/import_functions.py +0 -0
- {plot3d-1.7.3 → plot3d-1.7.5}/plot3d/graph.py +0 -0
- {plot3d-1.7.3 → plot3d-1.7.5}/plot3d/gridpro/__init__.py +0 -0
- {plot3d-1.7.3 → plot3d-1.7.5}/plot3d/listfunctions.py +0 -0
- {plot3d-1.7.3 → plot3d-1.7.5}/plot3d/periodicity.py +0 -0
- {plot3d-1.7.3 → plot3d-1.7.5}/plot3d/point_match.py +0 -0
- {plot3d-1.7.3 → plot3d-1.7.5}/plot3d/read.py +0 -0
- {plot3d-1.7.3 → plot3d-1.7.5}/plot3d/split_block.py +0 -0
- {plot3d-1.7.3 → plot3d-1.7.5}/plot3d/write.py +0 -0
|
@@ -161,8 +161,8 @@ def _write_bsurf_spec(w, bc):
|
|
|
161
161
|
# GIF + Volume Zone writers (dict inputs supported)
|
|
162
162
|
# ============================================================
|
|
163
163
|
def _write_gif_from_dict(w, gdict: Dict[str, Any]) -> None:
|
|
164
|
-
sid1 = int(gdict.get("
|
|
165
|
-
sid2 = int(gdict.get("
|
|
164
|
+
sid1 = int(gdict.get("a", 0))
|
|
165
|
+
sid2 = int(gdict.get("b", 0))
|
|
166
166
|
name1 = f"surface {sid1}"
|
|
167
167
|
name2 = f"surface {sid2}"
|
|
168
168
|
bctype = 4 # GIF
|
|
@@ -312,7 +312,7 @@ def export_to_boundary_condition(
|
|
|
312
312
|
file_path_to_write: str,
|
|
313
313
|
job_settings: Job,
|
|
314
314
|
bc_group: BCGroup,
|
|
315
|
-
|
|
315
|
+
gif_pairs: List[GIF] | List[Dict[str,Any]],
|
|
316
316
|
volume_zones: List[VolumeZone] | List[Dict[str,Any]],
|
|
317
317
|
):
|
|
318
318
|
file_path_to_write = ensure_extension(file_path_to_write, '.bcs')
|
|
@@ -326,10 +326,10 @@ def export_to_boundary_condition(
|
|
|
326
326
|
"slips": [_asdict_soft(x) for x in bc_group.SymmetricSlips],
|
|
327
327
|
"walls": [_asdict_soft(x) for x in bc_group.Walls],
|
|
328
328
|
"volume_zones": [x for x in volume_zones],
|
|
329
|
-
"
|
|
329
|
+
"gif_pairs": [_asdict_soft(x) for x in gif_pairs],
|
|
330
330
|
"job_settings": _asdict_soft(job_settings),
|
|
331
331
|
}
|
|
332
|
-
json_path.write_text(json.dumps(json_payload, indent=
|
|
332
|
+
json_path.write_text(json.dumps(json_payload, indent=4))
|
|
333
333
|
|
|
334
334
|
# ---- Robust reference defaults (use inlet values if missing)
|
|
335
335
|
ref = job_settings.ReferenceCondFull
|
|
@@ -383,24 +383,24 @@ def export_to_boundary_condition(
|
|
|
383
383
|
_write_bsurf_spec(w, wall)
|
|
384
384
|
|
|
385
385
|
# GIFS (dicts or dataclasses)
|
|
386
|
-
for
|
|
387
|
-
if isinstance(
|
|
388
|
-
_write_gif_from_dict(w,
|
|
386
|
+
for pair in gif_pairs:
|
|
387
|
+
if isinstance(pair, dict):
|
|
388
|
+
_write_gif_from_dict(w, pair)
|
|
389
389
|
else:
|
|
390
|
-
name1 = getattr(
|
|
391
|
-
name2 = getattr(
|
|
390
|
+
name1 = getattr(pair, "Name1", f"surface {pair.GIFSurface1}")
|
|
391
|
+
name2 = getattr(pair, "Name2", f"surface {pair.GIFSurface2}")
|
|
392
392
|
w.write(
|
|
393
|
-
f" &BSurf_Spec\nBSurfID={
|
|
393
|
+
f" &BSurf_Spec\nBSurfID={pair.GIFSurface1}, BCType={int(pair.BCType)}, "
|
|
394
394
|
f"BSurfName='{name1}'\n &END\n\n"
|
|
395
395
|
)
|
|
396
396
|
w.write(
|
|
397
|
-
f" &BSurf_Spec\nBSurfID={
|
|
397
|
+
f" &BSurf_Spec\nBSurfID={pair.GIFSurface2}, BCType={int(pair.BCType)}, "
|
|
398
398
|
f"BSurfName='{name2}'\n &END\n\n"
|
|
399
399
|
)
|
|
400
|
-
w.write(f" &GIF_Spec\nSurfID_1={
|
|
400
|
+
w.write(f" &GIF_Spec\nSurfID_1={pair.GIFSurface1}, SurfID2={pair.GIFSurface2}\n &END\n\n")
|
|
401
401
|
|
|
402
402
|
# VZConditions (dict templates)
|
|
403
|
-
volume_zone_unique = {d["
|
|
403
|
+
volume_zone_unique = {d["contiguous_index"]: d for d in volume_zones}.values()
|
|
404
404
|
for vz in volume_zone_unique:
|
|
405
405
|
if isinstance(vz, dict):
|
|
406
406
|
_write_vzconditions(w, vz)
|
|
@@ -504,7 +504,7 @@ def summarize_contiguous(records: List[Dict[str, Any]]) -> Dict[str, Any]:
|
|
|
504
504
|
|
|
505
505
|
for r in records:
|
|
506
506
|
# will raise KeyError if required keys are missing (helpful fail)
|
|
507
|
-
cid = r["
|
|
507
|
+
cid = r["contiguous_index"]
|
|
508
508
|
zt = r["zone_type"]
|
|
509
509
|
id_to_zone_types[cid].add(zt)
|
|
510
510
|
|
|
@@ -512,13 +512,15 @@ def summarize_contiguous(records: List[Dict[str, Any]]) -> Dict[str, Any]:
|
|
|
512
512
|
ids_with_multiple = [cid for cid, zts in zone_types_by_id.items() if len(zts) > 1]
|
|
513
513
|
|
|
514
514
|
return {
|
|
515
|
-
"
|
|
515
|
+
"num_unique_contiguous_indices": len(zone_types_by_id),
|
|
516
516
|
"zone_types_by_id": zone_types_by_id,
|
|
517
517
|
"ids_with_multiple_zone_types": sorted(ids_with_multiple),
|
|
518
518
|
}
|
|
519
519
|
|
|
520
520
|
|
|
521
|
-
def export_to_glennht_conn(matches:List[Dict[str, Dict[int, str]]],outer_faces:List[Dict[str,int]],filename:str,
|
|
521
|
+
def export_to_glennht_conn(matches:List[Dict[str, Dict[int, str]]],outer_faces:List[Dict[str,int]],filename:str,
|
|
522
|
+
gif_pairs:List[List[Dict[str, int]]],gif_faces:List[List[Dict[str, int]]],
|
|
523
|
+
volume_zones:List[Dict[str,Any]]):
|
|
522
524
|
"""Exports the connectivity to GlennHT format
|
|
523
525
|
|
|
524
526
|
Args:
|
|
@@ -544,7 +546,11 @@ def export_to_glennht_conn(matches:List[Dict[str, Dict[int, str]]],outer_faces:L
|
|
|
544
546
|
|
|
545
547
|
lines.append(f"{block_indx:3d}\t{block_IMIN:5d} {block_JMIN:5d} {block_KMIN:5d}\t{block_IMAX:5d} {block_JMAX:5d} {block_KMAX:5d}\n")
|
|
546
548
|
# Print Surfaces
|
|
547
|
-
# Get total number of surfaces
|
|
549
|
+
# Get total number of surfaces
|
|
550
|
+
outer_faces.extend(gif_faces)
|
|
551
|
+
outer_faces = sorted(outer_faces, key=lambda d: d["id"])
|
|
552
|
+
|
|
553
|
+
lines.append(f"{len(outer_faces)}\n")
|
|
548
554
|
for surface in outer_faces:
|
|
549
555
|
block_indx = surface['block_index']+1 # type: ignore
|
|
550
556
|
IMIN = surface['IMIN']+1 # type: ignore
|
|
@@ -558,14 +564,14 @@ def export_to_glennht_conn(matches:List[Dict[str, Dict[int, str]]],outer_faces:L
|
|
|
558
564
|
lines.append(f"{block_indx:3d}\t{IMIN:5d} {JMIN:5d} {KMIN:5d}\t{IMAX:5d} {JMAX:5d} {KMAX:5d}\t{id:4d}\n")
|
|
559
565
|
|
|
560
566
|
# Print GIFs
|
|
561
|
-
lines.append(f"{len(
|
|
562
|
-
for
|
|
563
|
-
lines.append(f"{
|
|
567
|
+
lines.append(f"{len(gif_pairs)}\n")
|
|
568
|
+
for pairs in gif_pairs:
|
|
569
|
+
lines.append(f"{pairs['a']} {pairs['b']} -2 1\n") # type: ignore
|
|
564
570
|
|
|
565
571
|
summary = summarize_contiguous(volume_zones)
|
|
566
572
|
# Print volume zones
|
|
567
573
|
|
|
568
|
-
lines.append(f"{summary['
|
|
574
|
+
lines.append(f"{summary['num_unique_contiguous_indices']}\n")
|
|
569
575
|
# Print what types of zones are there
|
|
570
576
|
for k,v in summary['zone_types_by_id'].items():
|
|
571
577
|
lines.append(f"{k} ")
|
|
@@ -574,9 +580,9 @@ def export_to_glennht_conn(matches:List[Dict[str, Dict[int, str]]],outer_faces:L
|
|
|
574
580
|
columns_to_print = 10
|
|
575
581
|
for i,v in enumerate(volume_zones):
|
|
576
582
|
if i % columns_to_print==0:
|
|
577
|
-
lines.append(f"{v["
|
|
583
|
+
lines.append(f"{v["contiguous_index"]}\n")
|
|
578
584
|
else:
|
|
579
|
-
lines.append(f"{v["
|
|
585
|
+
lines.append(f"{v["contiguous_index"]} ")
|
|
580
586
|
|
|
581
587
|
filename = ensure_extension(filename,'.ght_conn')
|
|
582
588
|
with open(f'{filename}','w') as fp:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from typing import Dict, List, Tuple, Optional
|
|
2
2
|
import numpy as np
|
|
3
3
|
from tqdm import tqdm
|
|
4
|
-
from typing import List, Tuple, Optional
|
|
4
|
+
from typing import List, Tuple, Optional, Any
|
|
5
5
|
from plot3d import Block
|
|
6
6
|
from collections import defaultdict
|
|
7
7
|
|
|
@@ -97,7 +97,7 @@ def read_gridpro_connectivity(
|
|
|
97
97
|
"bc_group": {"inlet":[...], "outlet":[...], "symm_slip":[...], "wall":[...]},
|
|
98
98
|
"gifs": List[List[face_dict]], # grouped by sf1
|
|
99
99
|
"periodic_faces": List[{"block1":{...}, "block2":{...}}],
|
|
100
|
-
"volume_zones": List[{"pty":int, "zone":str, "
|
|
100
|
+
"volume_zones": List[{"pty":int, "zone":str, "contiguous_index":int}],
|
|
101
101
|
}
|
|
102
102
|
"""
|
|
103
103
|
# ---------------------------- parsing ----------------------------
|
|
@@ -219,16 +219,7 @@ def read_gridpro_connectivity(
|
|
|
219
219
|
"symm_slip": bc_faces_for(4),
|
|
220
220
|
"wall": bc_faces_for(2),
|
|
221
221
|
}
|
|
222
|
-
|
|
223
|
-
gif_faces: List[Dict[str, int]] = []
|
|
224
|
-
for p in patches:
|
|
225
|
-
if (12 <= p["pty"] <= 21) or (p["pty"] == 1000): # type: ignore
|
|
226
|
-
face_temp = face_dict(p["sb1"], p["L1i"], p["L1j"], p["L1k"], p["H1i"], p["H1j"], p["H1k"]) # type: ignore
|
|
227
|
-
face_temp["id1"] = int(p["sf1"]) # type: ignore
|
|
228
|
-
face_temp["id2"] = int(p["sf2"]) # type: ignore
|
|
229
|
-
face_temp["pty"] = int(p["pty"]) # type: ignore
|
|
230
|
-
gif_faces.append(face_temp)
|
|
231
|
-
|
|
222
|
+
|
|
232
223
|
# Periodic faces: pty == 3 (explicit pairs)
|
|
233
224
|
periodic_faces: List[Dict[str, Dict[str, int]]] = []
|
|
234
225
|
for p in patches:
|
|
@@ -239,6 +230,16 @@ def read_gridpro_connectivity(
|
|
|
239
230
|
p["sb2"], (p["L2i"], p["L2j"], p["L2k"], p["H2i"], p["H2j"], p["H2k"]), # type: ignore
|
|
240
231
|
)
|
|
241
232
|
)
|
|
233
|
+
|
|
234
|
+
# GIF faces grouped by sf1 for pty in 12..21 or == 1000
|
|
235
|
+
gif_faces: List[Dict[str, int]] = []
|
|
236
|
+
for p in patches:
|
|
237
|
+
#? This is how we identify gifs inside of a grid pro connectivity file.
|
|
238
|
+
#? If the PTY is between 12 and 21 these are gifs
|
|
239
|
+
if (12 <= p["pty"] <= 21) or (p["pty"] == 1000): # type: ignore
|
|
240
|
+
face_temp = face_dict(p["sb1"], p["L1i"], p["L1j"], p["L1k"], p["H1i"], p["H1j"], p["H1k"]) # type: ignore
|
|
241
|
+
face_temp["id"] = p["pty"] # type: ignore
|
|
242
|
+
gif_faces.append(face_temp)
|
|
242
243
|
|
|
243
244
|
# Volume zones (unique superblock ptys; odd→fluid, even→solid) with contiguous ids
|
|
244
245
|
volume_zones: List[Dict[str, object]] = []
|
|
@@ -249,7 +250,7 @@ def read_gridpro_connectivity(
|
|
|
249
250
|
if zone is not prevZoneType:
|
|
250
251
|
cid += 1
|
|
251
252
|
prevZoneType = zone
|
|
252
|
-
volume_zones.append({"block_index": id, "zone_type": zone, "
|
|
253
|
+
volume_zones.append({"block_index": id, "zone_type": zone, "contiguous_index": cid})
|
|
253
254
|
|
|
254
255
|
|
|
255
256
|
return {
|
|
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
|