Skip to content

Commit ae89691

Browse files
Export mesh exception for Q3D API (#1231)
* - Export mesh exception for Q3D API * - Export mesh exception for Q3D API * Capacitance Constants * Conductance Constants * Conductance Constants * Conductance Constants * Duplicate method in Q3D.py * Duplicate method in Q3D.py
1 parent fd8050b commit ae89691

File tree

4 files changed

+41
-1
lines changed

4 files changed

+41
-1
lines changed

_unittest/test_12_PostProcessing.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,12 @@ def test_60_test_parse_vector(self):
788788
out = _parse_streamline(os.path.join(local_path, "example_models", "test_streamline.fldplt"))
789789
assert isinstance(out, list)
790790

791-
def test_61_delete_variations(self):
791+
def test_61_export_mesh(self):
792+
assert os.path.exists(self.q3dtest.export_mesh_stats("Setup1"))
793+
assert os.path.exists(self.q3dtest.export_mesh_stats("Setup1", setup_type="AC RL"))
794+
assert os.path.exists(self.aedtapp.export_mesh_stats("Setup1"))
795+
796+
def test_62_delete_variations(self):
792797
assert self.q3dtest.cleanup_solution()
793798
vars = self.field_test.available_variations.get_variation_strings()
794799
assert self.field_test.available_variations.variations()

ignore_words.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ vise
2323
datas
2424
fo
2525
te
26+
sie
2627

pyaedt/generic/constants.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ def scale_units(scale_to_unit):
194194
"rpm": SEC2MIN * V2PI,
195195
},
196196
"Angle": {"deg": DEG2RAD, "rad": 1.0, "degmin": DEG2RAD * SEC2MIN, "degsec": DEG2RAD * SEC2HOUR},
197+
"Capacitance": {"fF": 1e-15, "pF": 1e-12, "nF": 1e-9, "uF": 1e-6, "mF": 1e-3, "F": 1.0},
198+
"Conductance": {"fSie": 1e-15, "pSie": 1e-12, "nSie": 1e-9, "uSie": 1e-6, "mSie": 1e-3, "Sie": 1.0},
197199
"Current": {
198200
"fA": 1e-15,
199201
"pA": 1e-12,
@@ -341,6 +343,8 @@ def scale_units(scale_to_unit):
341343
SI_UNITS = {
342344
"AngularSpeed": "rad_per_sec",
343345
"Angle": "rad",
346+
"Capacitance": "F",
347+
"Conductance": "Sie",
344348
"Current": "A",
345349
"Flux": "vs",
346350
"Force": "newton",

pyaedt/q3d.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,36 @@ def get_traces_for_plot(
159159
category=category,
160160
)
161161

162+
@pyaedt_function_handler()
163+
def export_mesh_stats(self, setup_name, variation_string="", mesh_path=None, setup_type="CG"):
164+
"""Export mesh statistics to a file.
165+
166+
Parameters
167+
----------
168+
setup_name :str
169+
Setup name.
170+
variation_string : str, optional
171+
Variation list. The default is ``""``.
172+
mesh_path : str, optional
173+
Full path to the mesh statistics file. The default is ``None``, in which
174+
caswe the working directory is used.
175+
setup_type : str, optional
176+
Setup type in Q3D. The default is "CG", other options are "AC RL" or "DC RL".
177+
178+
Returns
179+
-------
180+
str
181+
File path.
182+
183+
References
184+
----------
185+
>>> oDesign.ExportMeshStats
186+
"""
187+
if not mesh_path:
188+
mesh_path = os.path.join(self.working_directory, "meshstats.ms")
189+
self.odesign.ExportMeshStats(setup_name, variation_string, setup_type, mesh_path)
190+
return mesh_path
191+
162192

163193
class Q3d(QExtractor, object):
164194
"""Provides the Q3D application interface.

0 commit comments

Comments
 (0)