Skip to content

Export mesh exception for Q3D API #1231

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jun 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion _unittest/test_12_PostProcessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,12 @@ def test_60_test_parse_vector(self):
out = _parse_streamline(os.path.join(local_path, "example_models", "test_streamline.fldplt"))
assert isinstance(out, list)

def test_61_delete_variations(self):
def test_61_export_mesh(self):
assert os.path.exists(self.q3dtest.export_mesh_stats("Setup1"))
assert os.path.exists(self.q3dtest.export_mesh_stats("Setup1", setup_type="AC RL"))
assert os.path.exists(self.aedtapp.export_mesh_stats("Setup1"))

def test_62_delete_variations(self):
assert self.q3dtest.cleanup_solution()
vars = self.field_test.available_variations.get_variation_strings()
assert self.field_test.available_variations.variations()
Expand Down
1 change: 1 addition & 0 deletions ignore_words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ vise
datas
fo
te
sie

4 changes: 4 additions & 0 deletions pyaedt/generic/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ def scale_units(scale_to_unit):
"rpm": SEC2MIN * V2PI,
},
"Angle": {"deg": DEG2RAD, "rad": 1.0, "degmin": DEG2RAD * SEC2MIN, "degsec": DEG2RAD * SEC2HOUR},
"Capacitance": {"fF": 1e-15, "pF": 1e-12, "nF": 1e-9, "uF": 1e-6, "mF": 1e-3, "F": 1.0},
"Conductance": {"fSie": 1e-15, "pSie": 1e-12, "nSie": 1e-9, "uSie": 1e-6, "mSie": 1e-3, "Sie": 1.0},
"Current": {
"fA": 1e-15,
"pA": 1e-12,
Expand Down Expand Up @@ -341,6 +343,8 @@ def scale_units(scale_to_unit):
SI_UNITS = {
"AngularSpeed": "rad_per_sec",
"Angle": "rad",
"Capacitance": "F",
"Conductance": "Sie",
"Current": "A",
"Flux": "vs",
"Force": "newton",
Expand Down
30 changes: 30 additions & 0 deletions pyaedt/q3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,36 @@ def get_traces_for_plot(
category=category,
)

@pyaedt_function_handler()
def export_mesh_stats(self, setup_name, variation_string="", mesh_path=None, setup_type="CG"):
"""Export mesh statistics to a file.

Parameters
----------
setup_name :str
Setup name.
variation_string : str, optional
Variation list. The default is ``""``.
mesh_path : str, optional
Full path to the mesh statistics file. The default is ``None``, in which
caswe the working directory is used.
setup_type : str, optional
Setup type in Q3D. The default is "CG", other options are "AC RL" or "DC RL".

Returns
-------
str
File path.

References
----------
>>> oDesign.ExportMeshStats
"""
if not mesh_path:
mesh_path = os.path.join(self.working_directory, "meshstats.ms")
self.odesign.ExportMeshStats(setup_name, variation_string, setup_type, mesh_path)
return mesh_path


class Q3d(QExtractor, object):
"""Provides the Q3D application interface.
Expand Down