Skip to content

56 extract proper units from ansys - #58

Merged
sadda merged 13 commits into
mainfrom
56-extract-proper-units-from-ansys
Oct 1, 2026
Merged

sadda merged 13 commits into
mainfrom
56-extract-proper-units-from-ansys

Conversation

@haitao-ZCU

Copy link
Copy Markdown
Collaborator
  • currently, we use solutions.data_real(expr, convert_to_SI=True) to extract the values from Ansys, this can help us obtain the correct vars quickly instead of manually hard-coding and guessing unit scaling factors (a big mess).
  • corresponding tests are also updated, and all passed, including test_ansys_regression_synrm_5f_40s.py.

@haitao-ZCU haitao-ZCU linked an issue Sep 30, 2026 that may be closed by this pull request
@sadda

sadda commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

Good, that makes it much simpler. I would add something like

@staticmethod
def extract_expression(solutions, expr: str) -> np.ndarray:
    return np.asarray(solutions.data_real(expr, convert_to_SI=True))

to ComputationBase so that we do not forget the conversion to SI units by accident later. Please verify that this method is always called and that there are no direct calls to data_real.

@sadda

sadda commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

Also, this duplicates #54, which should be closed.

@haitao-ZCU

Copy link
Copy Markdown
Collaborator Author

@sadda
good idea. I have added it and replaced data_real() with extract_expression(), and all tests passed.

@sadda
sadda merged commit 523d1b8 into main Oct 1, 2026
6 checks passed
@haitao-ZCU
haitao-ZCU deleted the 56-extract-proper-units-from-ansys branch October 1, 2026 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extract proper units from Ansys

2 participants