-
I have a basic convection-diffusion-reaction system and got most of everything implemented based on the Brusselator example. However, I want to supply different boundary conditions for the two equations. (Equation is dtci=-udxci+Ddxxci - kc_i) eq = pde.PDE({'c0': f"-{u[0]}*get_x(gradient(c0)) + {d[0]}*laplace(c0) - {k[0]}*c0",
'c1': f"-{u[1]}*get_x(gradient(c1)) + {d[1]}*laplace(c1) - 2*{k[1]}*c1"},
user_funcs={"get_x": lambda arr: arr[0]},
bc=[{"value": bc_c0, "value": bc_c1}, #Two dirchlet bc at the left with different value
{"derivative": 0.0}]) #Neuman bc for both c0 and c1 at the right This approaches doesn't give any errors but all equations have the same left bc... eq = pde.PDE({'c0': f"-{u[0]}*get_x(gradient(c0)) + {d[0]}*laplace(c0) - {k[0]}*c0",
'c1': f"-{u[1]}*get_x(gradient(c1)) + {d[1]}*laplace(c1) - 2*{k[1]}*c1"},
user_funcs={"get_x": lambda arr: arr[0]},
bc=[{"value": numpy.array([bc_c0, bc_c1])}, #Two dirchlet bc at the left with different value
{"derivative": 0.0}]) #Neuman bc for both c0 and c1 at the right But this gave an error that |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Aah I found the solution while reading another post and a bit more in the documentation. I shouldn't use bc but bc_ops. eq = pde.PDE({'c0': f"-{u[0]}*get_x(gradient(c0)) + {d[0]}*laplace(c0) - {k[0]}*c0",
'c1': f"-{u[1]}*get_x(gradient(c1)) + {d[1]}*laplace(c1) - 2*{k[1]}*c1"},
user_funcs={"get_x": lambda arr: arr[0]},
bc_ops={"c0:*": [{"value": bc_c0}, {"derivative": 0.0}],
"c1:*": [{"value": bc_c1}, {"derivative": 0.0}]}) |
Beta Was this translation helpful? Give feedback.
Aah I found the solution while reading another post and a bit more in the documentation. I shouldn't use bc but bc_ops.
The PDE would be defined as such than: