How to solve this linear inhomogenous PDE arising in physics? Let $f: \mathbb R \times \mathbb R \to \mathbb C$ be a 'nice' function. Consider the PDE
$$\partial_t f(x,t) = -\partial_x f(x,t) - u(x) (f(1,t)-f(0,t)-A),$$
where $A \in \mathbb R$ is a constant and $u$ is a function over $\mathbb R$ such that $u(x)=1$ for $0<x<1$, $u(x)=1/2$ at $x=0$ or $1$, and $u(x)=0$ otherwise.
Since this is an inhomogeneous PDE, I think it should be solvable somehow. How can I solve this PDE, i.e., find $f(\cdot,t)$ ($t>0$) given the initial condition $f(\cdot,0)$?
 A: The problematic quantities to deal with are $f(0,t)$ and $f(1,t)$; nevertheless, as they don't depend on $x$, it is easier to solve the equation for that variable first, because they can be then considered as constants.
Concretely, in a fisrt step, let's take the Fourier transform with respect to $t$, hence the new equation
$$
i\omega f(x,\omega) = -\partial_xf(x,\omega)-u(x)g(\omega) \verb+ +\mathrm{with}\verb+ + g(\omega) = f(1,\omega)-f(0,\omega)-A,
$$
which is a first-order inhomogeneous linear ODE. The solution to the homogeneous equation is obviously $f_H(x,\omega) = C(\omega)e^{-i\omega x}$. The particular solution $f_P$ can be determined thanks to the variation of the parameter; we take $f_P(x\omega) = A(x)e^{-i\omega x}$, which leads to the equation $A'(x) = -u(x)g(\omega)e^{i\omega x}$. Before taking its integral, one must recall that $u(x) = H(x)-H(x-1)$, where $H$ is the Heaviside function, which is the antiderivative of the Dirac delta function. One has thus :
$$
\begin{array}{rcll}
A(x)
   &=& \displaystyle
   -g(\omega)\int(H(x)-H(x-1))e^{i\omega x}\mathrm{d}x \\
   &=& \displaystyle
   -g(\omega)\left((H(x)-H(x-1))\frac{e^{i\omega x}}{i\omega} - \int(\delta(x)-\delta(x-1))\frac{e^{i\omega x}}{i\omega}\mathrm{d}x\right) & (1) \\
   &=& \displaystyle -g(\omega)\left((H(x)-H(x-1))\frac{e^{i\omega x}}{i\omega} - \left(\frac{H(x)}{i\omega}-\frac{e^{i\omega}}{i\omega}H(x-1)\right)\right) & (2) \\
   &=& \displaystyle
   -\frac{g(\omega)}{i\omega}\left(H(x)(e^{i\omega x}-1)-H(x-1)(e^{i\omega x}-e^{i\omega})\right)
\end{array}
$$
where we used (1) integration by parts and (2) the facts that $f(x)\delta(x-x_0) \equiv f(x_0)\delta(x-x_0)$ and that $H$ is the antiderivative of $\delta$. The general solution is thus given by
$$
f(x,\omega) = C(\omega)e^{-i\omega x} - \frac{1}{i\omega}\left(H(x)(e^{i\omega x}-1)-H(x-1)(e^{i\omega x}-e^{i\omega})\right)(f(1,\omega)-f(0,\omega)-A)
$$
Then, evaluating the solution at $x=0$ and $x=1$, we get :
$$
\begin{cases}
   \displaystyle
   f(0,\omega) = C(\omega)\verb+  +\;\,\, + \frac{e^{i\omega}-1}{2i\omega}(f(1,\omega)-f(0,\omega)-A) \\
   \displaystyle 
   f(1,\omega) = C(\omega)e^{-i\omega} - \frac{e^{i\omega}-1}{2i\omega}(f(1,\omega)-f(0,\omega)-A)
\end{cases}
$$
hence by substraction
$$
f(1,\omega)-f(0,\omega)-A = C(\omega)e^{-i\omega} - C(\omega) - A - \frac{e^{i\omega}-1}{i\omega}(f(1,\omega)-f(0,\omega)-A)
$$
and
$$
f(1,\omega)-f(0,\omega)-A = i\omega\,\frac{C(\omega)(e^{-i\omega}-1)-A}{e^{i\omega}-1+i\omega}
$$
such that the final solution is given by
$$
f(x,\omega) = C(\omega)e^{-i\omega x} - \frac{C(\omega)(e^{-i\omega}-1)-A}{e^{i\omega}-1+i\omega}\left(H(x)(e^{i\omega x}-1)-H(x-1)(e^{i\omega x}-e^{i\omega})\right)
$$
Inverse Fourier transform still needs to be taken to recover $f(x,t)$, but the result heavily depends on the chosen boundary condition for $C(\omega)$; moreover, note that the denominator $e^{i\omega}-1+i\omega$ will produce poles involving the Lambert $W$ function, if any.
