# Stably solve transport equation with source term

I am trying to solve a transport equation of the form for the variable $$\psi(t,r)$$

$$$$\partial_t\psi-\alpha(r)\partial_r\psi-\beta(r)^2\psi-f(t,r)=0 ,$$$$

where I am solving for the function $$f(t,r)$$ from another PDE (a wave equation-so the amplitude of $$f(t,r)$$ oscillates in time and space). My problem is: I know from other arguments that $$\psi$$ should $$not$$ grow exponentially (essentially the term $$\beta^2\psi-f$$ should oscillate in time, so while sometimes $$\psi$$ will grow exponentially, it will also shrink exponentially at a later time so there is no long term secular growth in $$\psi$$). I am having trouble stably integrating this equation though, as if I get a small numerical error that makes $$\psi$$ too large, then $$\beta^2\psi-f$$ stops oscillating and becomes positive definite and I get runaway growth in $$\psi$$.

My question is: are there field redefinitions/solution techniques that could lead to more stable integration of this transport equation? Trying to, e.g. define $$p\equiv \partial_t\psi-\alpha\partial_r\psi$$ does not cure the basic problem.

• There are two problems here. 1. Do you have any precise mathematical argument to show that $\psi$ should not grow in time exponentially? 2. What's your numerical method to solve this advection equation? It's not clear to me what do you mean "if I get a small numerical error that makes $\psi$ too large". Error with respect to what? An analytical solution? How do you make errors small? By reducing the spatial grid size or time step size or both? – Alone Programmer Dec 15 '19 at 19:32
• @AloneProgrammer I do have a precise mathematical argument that shows that $\psi$ should not grow in time exponentially. I am solving the advection equation using a pseudospectral method to compute spatial derivatives, then an RK4 ODE solver to evolve in time. By "small numerical error" I mean $\delta\psi/\psi$ is small. I could make the error smaller by reducing the grid and time step sizes. – PHY314 Dec 15 '19 at 20:10
• Have you tried finite difference with first order time and second order spatial integrators? – Alone Programmer Dec 16 '19 at 1:06
• How smooth is the function $\alpha(r)$ ? If the function $f(t,r)$ oscillates rapidly and/or if $\beta$ is large you will have a stiff problem. Your time steps have to very small or you have to use an implicit scheme. I would recommend at least trying some RK scheme with automatic adaptive time stepping. These are available in many ode libraries. – cfdlab Dec 16 '19 at 8:01