You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm trying to solve the 6 DOF harmonic oscillator
xdd + b*xd + cx - F(t) = 0
for x(t) (and F(t)) in 6 spatial dimensions, and b,c constants, using a deeponet mapping from F(t) -> x(t). My strategy is to write an ODE function with 6 ODEs:
File ~\anaconda3\Lib\site-packages\deepxde\model.py:811, in Model._test(self)
806 def _test(self):
807 # TODO Now only print the training loss in rank 0. The correct way is to print the average training loss of all ranks.
808 (
809 self.train_state.y_pred_train,
810 self.train_state.loss_train,
--> 811 ) = self._outputs_losses(
812 True,
813 self.train_state.X_train,
814 self.train_state.y_train,
815 self.train_state.train_aux_vars,
816 )
817 self.train_state.y_pred_test, self.train_state.loss_test = self._outputs_losses(
818 False,
819 self.train_state.X_test,
820 self.train_state.y_test,
821 self.train_state.test_aux_vars,
822 )
824 if isinstance(self.train_state.y_test, (list, tuple)):
File ~\anaconda3\Lib\site-packages\deepxde\data\pde_operator.py:243, in PDEOperatorCartesianProd._losses(self, outputs, loss_fn, inputs, model, num_func)
241 f = []
242 if self.pde.pde is not None:
--> 243 f = self.pde.pde(inputs[1], out, model.net.auxiliary_vars[i][:, None])
244 if not isinstance(f, (list, tuple)):
245 f = [f]
Cell In[129], line 22, in pde(t, y, F)
19 dx0dt = dde.grad.jacobian(y,t,i=0)
20 ddx0dt = dde.grad.hessian(y,t,i=0)
---> 22 dx1dt = dde.grad.jacobian(y,t,i=1)
23 ddx1dt = dde.grad.hessian(y,t,i=1)
25 dx2dt = dde.grad.jacobian(y,t,i=2)
File ~\anaconda3\Lib\site-packages\deepxde\gradients.py:153, in Jacobians.call(self, ys, xs, i, j)
151 if key not in self.Js:
152 self.Js[key] = Jacobian(ys, xs)
--> 153 return self.Js[key](i, j)
File ~\anaconda3\Lib\site-packages\deepxde\gradients.py:39, in Jacobian.call(self, i, j)
35 """Returns J[i][j]. If j is None, returns the gradient of y_i, i.e.,
36 J[i].
37 """
38 if not 0 <= i < self.dim_y:
---> 39 raise ValueError("i={} is not valid.".format(i))
40 if j is not None and not 0 <= j < self.dim_x:
41 raise ValueError("j={} is not valid.".format(j))
ValueError: i=1 is not valid.
If I run the first before the second, and if I run the second again after this error I get:
`Compiling model...
'compile' took 0.000302 s
Warning: epochs is deprecated and will be removed in a future version. Use iterations instead.
Training model...
File ~\anaconda3\Lib\site-packages\deepxde\model.py:811, in Model._test(self)
806 def _test(self):
807 # TODO Now only print the training loss in rank 0. The correct way is to print the average training loss of all ranks.
808 (
809 self.train_state.y_pred_train,
810 self.train_state.loss_train,
--> 811 ) = self._outputs_losses(
812 True,
813 self.train_state.X_train,
814 self.train_state.y_train,
815 self.train_state.train_aux_vars,
816 )
817 self.train_state.y_pred_test, self.train_state.loss_test = self._outputs_losses(
818 False,
819 self.train_state.X_test,
820 self.train_state.y_test,
821 self.train_state.test_aux_vars,
822 )
824 if isinstance(self.train_state.y_test, (list, tuple)):
File ~\anaconda3\Lib\site-packages\deepxde\data\pde_operator.py:243, in PDEOperatorCartesianProd._losses(self, outputs, loss_fn, inputs, model, num_func)
241 f = []
242 if self.pde.pde is not None:
--> 243 f = self.pde.pde(inputs[1], out, model.net.auxiliary_vars[i][:, None])
244 if not isinstance(f, (list, tuple)):
245 f = [f]
TypeError: 'PDE' object is not callable`
Am I misunderstanding how to train the deeponet? I figured I didn't need any spatial geometry since I was able to get away without one in a 1D case, and all derivatives are with respect to time. Do I need 6 inputs in the trunk net? I found two people with a similar issue in this forum but neither of them was followed up on.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I'm trying to solve the 6 DOF harmonic oscillator
xdd + b*xd + cx - F(t) = 0
for x(t) (and F(t)) in 6 spatial dimensions, and b,c constants, using a deeponet mapping from F(t) -> x(t). My strategy is to write an ODE function with 6 ODEs:
'
'
And then setting initial condition x_i(0) = 0, also sampling F from GRFs and setting up the deeponet:
`
ic = dde.icbc.IC(geom, lambda _: 0, lambda _, on_initial: on_initial)
`
However, depending on whether I run the first block of code I listed before the second (I'm using jupyter), I get the following error:
_
If I run the first before the second, and if I run the second again after this error I get:
Am I misunderstanding how to train the deeponet? I figured I didn't need any spatial geometry since I was able to get away without one in a 1D case, and all derivatives are with respect to time. Do I need 6 inputs in the trunk net? I found two people with a similar issue in this forum but neither of them was followed up on.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions