Is it possible to solve a system of PDEs with Danckwerts boundary conditions? #461
-
Hi. I am trying to solve the following problem with two coupled PDEs. Can this be solved with py-pde? The package looks more "physics oriented", which is not my field, so I am a bit overwhelmed with the examples/nomenclature. For instance, I am not sure it is possible to implement the Danckwerts boundary conditions. Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Yes, such a simulation should be rather easy to do. The boundary condition looks like a Robin boundary condition to me; see documentation. |
Beta Was this translation helpful? Give feedback.
-
Sorry to bother again. I got the case above working and I have been trying other stuff. Although, I'm having trouble making this one work. I want First, using bc_z_left = {"type": "mixed", "value": f"-{v} / {D}", "const": f"-{v} / {D} * {C0} * heaviside(0.0125-t, 0)"} but I get the following error: RuntimeError: ("Arguments {'t'} were not defined in expression signature ['x']", "Problems in boundary condition `[{'type': 'mixed', 'value': '-12.732395447351628 / 0.00557', 'const': '-12.732395447351628 / 0.00557 * 3.6 * heaviside(0.0125-t, 0)'}, {'derivative': 0}]` for operator `d2_dx2` in PDE for `C`") Second, I tried defining the boundary condition with a function: def bc_value(adjacent_value, dx, x, t):
"""define the boundary condition for a pulse"""
if t <= tpulse:
C0 = C0
else:
C0 = 0
return -v / D * C0 bc_z_left = {"type": "mixed", "value": f"-{v} / {D}", "const": bc_value} from where I get the following error: TypeError: ("ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''", "Problems in boundary condition `[{'type': 'mixed', 'value': '-12.732395447351628 / 0.00557', 'const': <function bc_value at 0x000001F544DA7880>}, {'derivative': 0}]` for operator `d_dx` in PDE for `C`") Looking at section 3.3.1 and example 2.10 from the docs, it looks like this should be possible. What am I missing? |
Beta Was this translation helpful? Give feedback.
Yes, such a simulation should be rather easy to do. The boundary condition looks like a Robin boundary condition to me; see documentation.