Hello,
I am currently trying to solve the Navier Stokes equations in a 2d channel around an airfoil parameterized by its Angle of attack. I have been successful in training the PINN, however, I have been unable to set up a Pointwise Inferencer to make plots with different parameter values.
My code is:
xmin, xmax = -1,2
ymin, ymax = -1,1
x_space = np.linspace(xmin,xmax,50)
y_space = np.linspace(ymin,ymax,50)
angle_space = np.array([-10*pi/180,-5*pi/180,0,5*pi/180,10*pi/180])
angles = np.zeros(2500*5)
for i,angle in enumerate(angle_space):
for j in range(2500):
angles[i*2500+j] = angle
X, Y = np.meshgrid(x_space, y_space)
X = np.tile(X, 5)
Y = np.tile(Y, 5)
invar_numpy = {"x": np.expand_dims(X.flatten(), axis=-1),
"y": np.expand_dims(Y.flatten(), axis=-1),
"ang_in": np.expand_dims(angles.flatten(), axis=-1)}
grid_inference = PointwiseInferencer(
nodes= flow_nodes,
invar = invar_numpy,
output_names=["u","v","p"],
plotter= CustomInferencePlotter_Parametric(),
)
flow_domain.add_inferencer(grid_inference, "inf_data")
I get the error message:
[16:13:32] - JIT using the NVFuser TorchScript backend
[16:13:32] - JitManager: {'_enabled': True, '_arch_mode': <JitArchMode.ONLY_ACTIVATION: 1>, '_use_nvfuser': True, '_autograd_nodes': False}
[16:13:32] - GraphManager: {'_func_arch': False, '_debug': False, '_func_arch_allow_partial_hessian': True}
####################################
could not unroll graph!
This is probably because you are asking to compute a value that is not an output of any node
####################################
invar: [x, y, ang_in]
requested var: [u, v, p]
computable var: [x, y, ang_in, continuity]
####################################
Nodes in graph:
node: Sympy Node: continuity
evaluate: SympyToTorch
inputs: []
derivatives: [u__x, v__y]
outputs: [continuity]
optimize: False
node: Sympy Node: momentum_x
evaluate: SympyToTorch
inputs: [u, v]
derivatives: [p__x, u__x, u__x__x, u__y, u__y__y]
outputs: [momentum_x]
optimize: False
node: Sympy Node: momentum_y
evaluate: SympyToTorch
inputs: [u, v]
derivatives: [p__y, v__x, v__x__x, v__y, v__y__y]
outputs: [momentum_y]
optimize: False
node: Sympy Node: normal_dot_vel
evaluate: SympyToTorch
inputs: [normal_x, normal_y, normal_z, u, v, w]
derivatives: []
outputs: [normal_dot_vel]
optimize: False
node: Arch Node: flow_network
evaluate: FourierNetArch
inputs: [x, y, angle_in]
derivatives: []
outputs: [u, v, p]
optimize: True
####################################
Error executing job with overrides: []
Traceback (most recent call last):
File "flow_parametric.py", line 173, in run
grid_inference = PointwiseInferencer(
File "/usr/local/lib/python3.8/dist-packages/modulus/sym/domain/inferencer/pointwise.py", line 80, in __init__
self.model = Graph(
File "/usr/local/lib/python3.8/dist-packages/modulus/sym/graph.py", line 108, in __init__
raise RuntimeError("Failed Unrolling Graph")
RuntimeError: Failed Unrolling Graph
I tried running it through only the flow network, but I get the following error:
####################################
could not unroll graph!
This is probably because you are asking to compute a value that is not an output of any node
####################################
invar: [x, y, ang_in]
requested var: [u, v, p]
computable var: [x, y, ang_in]
####################################
Nodes in graph:
node: Arch Node: flow_network
evaluate: FourierNetArch
inputs: [x, y, angle_in]
derivatives: []
outputs: [u, v, p]
optimize: True
####################################
Error executing job with overrides: []
Traceback (most recent call last):
File "flow_parametric.py", line 173, in run
grid_inference = PointwiseInferencer(
File "/usr/local/lib/python3.8/dist-packages/modulus/sym/domain/inferencer/pointwise.py", line 80, in __init__
self.model = Graph(
File "/usr/local/lib/python3.8/dist-packages/modulus/sym/graph.py", line 108, in __init__
raise RuntimeError("Failed Unrolling Graph")
RuntimeError: Failed Unrolling Graph
The issue stems only from the Pointwise Inferencer, as when it is removed from the code everything works. I have successfully used a Pointwise Inferencer in a similar way, but without the parametric values, only x and y.