Hi,
i’m working on a problem similar to “conjugate heat transfer example”. I’d like to add double criteria condition in a constraint. So i try to add something like this:
def wall_criteria(invar, params):
sdf = geo.piece.sdf(invar, params)
return np.less(sdf["sdf"], -1e-5)
# Channel walls
print("adding channel_walls_constraint")
channel_walls = PointwiseBoundaryConstraint(
nodes=thermal_nodes,
geometry=geo.channel,
outvar={"normal_gradient_theta_f": 0},
batch_size=cfg.batch_size.ChannelWalls,
criteria=And(Eq(pow(x, 2) + pow(y, 2), pow(geo.channel_radius, 2)),
wall_criteria),
lambda_weighting={"normal_gradient_theta_f": 1.0},
)
thermal_domain.add_constraint(channel_walls, "channel_walls")
But this create the error below:
root@58c61e17b357:/examples/autoclave_flow/new_data_file# python thermal.py
[15:06:55] - JIT using the NVFuser TorchScript backend
[15:06:55] - JitManager: {'_enabled': True, '_arch_mode': <JitArchMode.ONLY_ACTIVATION: 1>, '_use_nvfuser': True, '_autograd_nodes': False}
[15:06:55] - GraphManager: {'_func_arch': False, '_debug': False, '_func_arch_allow_partial_hessian': True}
adding inlet_constraint
adding outlet_constraint
adding channel_walls_constraint
Error executing job with overrides: []
Traceback (most recent call last):
File "thermal.py", line 152, in run
criteria=And(Eq(pow(x, 2) + pow(y, 2), pow(geo.channel_radius, 2)),
File "/opt/conda/lib/python3.8/site-packages/sympy/core/operations.py", line 418, in __new__
_args = frozenset(cls._new_args_filter(args))
File "/opt/conda/lib/python3.8/site-packages/sympy/logic/boolalg.py", line 669, in _new_args_filter
args = BooleanFunction.binary_check_and_simplify(*args)
File "/opt/conda/lib/python3.8/site-packages/sympy/core/operations.py", line 411, in <genexpr>
args = (_sympify(arg) for arg in args)
File "/opt/conda/lib/python3.8/site-packages/sympy/core/sympify.py", line 418, in _sympify
return sympify(a, strict=True)
File "/opt/conda/lib/python3.8/site-packages/sympy/core/sympify.py", line 340, in sympify
raise SympifyError(a)
sympy.core.sympify.SympifyError: SympifyError: <function run.<locals>.wall_criteria at 0x7fb445dd4d30>
Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.
Is it possible to add condition of this form in the same constraint?
Thanks