Problem getting wall gradients in Modulus v22.09 (works in v22.03)

Hi, I am trying to get wall velocity gradients for my problem. However, it doesn’t seem to work.

Previously, I followed the example in the conjugate heat transfer problem for v22.03. I insert:

# add inferencer
     inferencer = PointwiseInferencer(
         geo.sample_boundary(4000, parameterization=pr),
         ["u__x", "u__y", "u__z",
          "v__x", "v__y", "v__z",
          "w__x", "w__y", "w__z"],
         nodes=flow_nodes,
     )
     flow_domain.add_inferencer(inferencer, "inf_data")

into the orginial code and it worked.

However, now using v22.09, it doesn’t work anymore. The error is:

root@5533d3a0b1f7:/myprojects/three_fin_3d# python three_fin_flow.py
[06:59:25] - JIT using the NVFuser TorchScript backend
[06:59:25] - JitManager: {'_enabled': True, '_arch_mode': <JitArchMode.ONLY_ACTIVATION: 1>, '_use_nvfuser': True, '_autograd_nodes': False}
[06:59:25] - GraphManager: {'_func_arch': False, '_debug': False, '_func_arch_allow_partial_hessian': True}
Error executing job with overrides: []
Traceback (most recent call last):
  File "three_fin_flow.py", line 254, in run
    geo.sample_boundary(4000, parameterization=pr),
AttributeError: 'ThreeFin' object has no attribute 'sample_boundary'

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.

Is there a bug somewhere?

Thanks.

After some checking, it seems that syntax in the new v22.09 is different from v22.03.

By adding:

from modulus.domain.inferencer import PointwiseInferencer
from modulus.utils.io.plotter import ValidatorPlotter, InferencerPlotter

and

inferencer = PointwiseInferencer(
        nodes=flow_nodes,
        invar=openfoam_invar_numpy,
        output_names=["u__x"],
        batch_size=2048,
        plotter=InferencerPlotter(),
    )
    flow_domain.add_inferencer(inferencer)

Moreover, in the conf_flow.yaml:

add:

graph:
  func_arch: true

One should be able to get the gradients.

1 Like

Hi @tsltaywb

That’s correct. We had a large API change between 22.03 and 22.06 (and thus 22.09) related to imports. Please check out the examples for updated imports and implementations.