I am solving a simple 1-D time-dependent PDE as follow ($a$ and $b$ are pre-defined coefficients):
$$\frac{\partial u}{\partial t} = a \frac{\partial u}{\partial x} + b T,\ t \in [0, T],\ x \in [0, L].$$
The initial and boundary conditions are given by:
$$u(t=0) = f(x), u(x=0) = g(t).$$
In simplest form, $f(x)$ and $g(t)$ can be constants.
Following is my code snippet. However, I couldn't find a easy way to implement the boundary conditions ONLY on one side of axis $x$, namely $x=0$. Consequently, results went diverged.
Do you have any suggestions to fix the problem?
T, L = 300, 150
a, b = 0.5, 0.002
grid = pde.CartesianGrid([[0, L]], [100], periodic=False)
state = pde.ScalarField(grid, data=80)
bc = [{"value": 80}, ]
eq = pde.PDE({"u": f"- {a} * d_dx(u) - {b} * u"}, bc=bc)
print(eq.expressions)
sol = eq.solve(state, t_range=T, dt=10, tracker=pde.PlotTracker())
I am solving a simple 1-D time-dependent PDE as follow ($a$ and $b$ are pre-defined coefficients): $$\frac{\partial u}{\partial t} = a \frac{\partial u}{\partial x} + b T,\ t \in [0, T],\ x \in [0, L].$$
The initial and boundary conditions are given by: $$u(t=0) = f(x), u(x=0) = g(t).$$
In simplest form, $f(x)$ and $g(t)$ can be constants.
Following is my code snippet. However, I couldn't find a easy way to implement the boundary conditions ONLY on one side of axis $x$, namely $x=0$. Consequently, results went diverged.
Do you have any suggestions to fix the problem?