# solve non-homogeneous advection pde with infinitesimal term

I try to solve the following pde with mathematica:

$\frac{\partial u(x,t)}{\partial t}+v\frac{\partial u(x,t)}{\partial x} = P(t)\cdot dx \cdot (k1 \cdot u(x,t) + k2)$

with the boundary condition $u(0,t) = u_{in}(t)$ and the initial condition $u(x,0) = u_0(x)$ for $x \in [0,L]$, $t \in [0,\infty]$

where $dx$ in an infinitesimal piece in the x dimension.

I struggle on incorporating/specifying the $dx$ correctly in the equation in mathematica. Anyone encountered such a problem and could give me some hints on how to tackle this problem?

Edit

The function P(t) is a smooth continuous function that serves as a control input that represents a power input. $dx \cdot (k1 \cdot u(x,t) + k2)$ then describes how this power affects the very thin slice $dx$ at the point x.

In general $P(t) \geq 0$ and $k1,k2 >0$ or for a specific case $k1 = 0.0194,k2=0.5369$

Since I'm new to mathematica I tried to solve the equation with DSolve. To solve it it just specified the constants k1, k2 as a function of x $k1_x [x] = k1 \cdot dx$. However, the solution I get does not quite make sense for me. When I try to solve the integrals and plug in the integration variable into k1,k2 I would get something like $\int k1_x(C_1) dC_1 = k1 \cdot \int dC_1 dC_1$ which makes no sens for me.

sol1 = DSolve[{D[u[x, t], t] + v D[u[x, t], x] ==
P[t] k1[x] u[x, t] + P[t] k2[x] , u[x, 0] == u0[x]},  u[x, t], {x, t}]

• Please give the equation in Mathematica format, provide values for all constants, and expressions for all 1D functions. Most importantly, explain dx clearly. – bbgodfrey Jul 4 '17 at 17:59
• I think you don't need the dx on the rhs. Without it, it does what you describe in the edit. With it, it makes no sense since dx->0 makes the rhs go away. – Chris K Jul 8 '17 at 6:59
• Thanks, Chris. I reworked the derivation and found an error. These terms actually vanish if the derivation is done right. – Dolma Jul 9 '17 at 18:44
• I solve like this problem in Mathimatica for example ( u1=u0-1/2 ∫0^t((∂x ((u0)^2))/.t→s)ds) and I obtain good result, you can write this operator ∂u(x,t)/∂t in Mathimatica like my example. – دنيا خيري شمدين Oct 12 '18 at 18:06