ansys / ansys/pyfluent

[FEAT]: Support for QueryBuilder.quantity to take a units.Quantity instance

Open
#5,345 0 comments 0 reactions 1 assignee Claimed by @Gobot1234 View on GitHub
enhancement new feature
Dominant language
Python
Stars
497
Forks
77
Avg merge
22h 37m
Merged PRs (30d)
45

Description

### ❓ Problem statement

Currently `.quantity()` takes a value and unit pair. Would be nice to be able to use a `units.Quantity` here or maybe even use binary operators to support it directly in the builder, though I don't remember enough of the binary operator protocol to say this is possible inside of this package to override (I don't really think it would be)

### 💡 Proposed solution

```py
b = CfxExpressionBuilder()
expr = b.reductions.area_ave(
expression=V.TEMPERATURE, location="inlet"
) + b.quantity(1 * K) # or better just + 1 * K
assert str(expr) == "(areaAve(Temperature)@inlet + 1 [K])"
```

### 🔀 Alternatives considered

_No response_

### 📌 Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.