Closed Blackrobin15 closed 2 years ago
Try this :
def func_bound1(x): return 100 * np.sin(100*np.pi*x[:,2:3]) * np.ones((len(x),1))
Also, func_bound2, 3 and 4 should have the same form
Thank you for your help. I try this code just now, but it does not work, and it also shows the same error.
In 1-d field, the code below worked:
def func_bound2(x):
return 100*np.sin(100*np.pi*x[:,1:2])
Does the error appear in the definition of the boundary ?
def boundary1(x,on_boundary):
return np.isclose(x[0], 0) and on_boundary
Try this :
def func_bound1(x): return 100 * np.sin(100*np.pi*x[:,2:3]) * np.ones((len(x),1))
Also, func_bound2, 3 and 4 should have the same form
Sorry for giving you the wrong answer... I think there is no error in the boundary definition. Maybe you could try the following codes instead?
bc1 = dde.DirichletBC(geom, lambda x: 100*np.sin(100*np.pi*x[:,2:3]), boundary1 )
No need to apologize, and thank you for your help. This writing and the above method actually have the same meaning, so the same error still occurs.
Sorry for giving you the wrong answer... I think there is no error in the boundary definition. Maybe you could try the following codes instead?
bc1 = dde.DirichletBC(geom, lambda x: 100*np.sin(100*np.pi*x[:,2:3]), boundary1 )
No need to apologize, and thank you for your help. This writing and the above method actually have the same meaning, so the same error still occurs.
Sorry for giving you the wrong answer... I think there is no error in the boundary definition. Maybe you could try the following codes instead?
bc1 = dde.DirichletBC(geom, lambda x: 100*np.sin(100*np.pi*x[:,2:3]), boundary1 )
I ran your code and found the problem:
bc1 = dde.DirichletBC(geomtime, func_bound1, boundary1)
NOT bc1 = dde.DirichletBC(geom, func_bound1, boundary1)
It should work
Thank you very much! The problem is solved.
Hello, Lu I am trying to use deepxde to solve the problems about time-varying electric field. With this tool, I have been able to calculate the one-dimensional electric field. When I tried to two-dimensional electric field and add a time-varying function to a boundary of the rectangular area, an error occurred. How to add different time-varying functions for different boundaries?
ValueError: operands could not be broadcast together with shapes (2760,3) (2,)
The error occurred in the code:
The details are as follows :
ValueError Traceback (most recent call last)