# An analytical solution of time-dependent parabolic equation.

I tried to write a code of ADI (alternating direction implicit) method in Matlab, but I do not know, how to find an analytical solution of my equation (which I need to know in my code). I have an equation which looks like:

$$\frac{\partial U(t,x,y)}{\partial t} = A.\Delta U(t,x,y) + B(\frac{\partial U(t,x,y)}{\partial x} + \frac{\partial U(t,x,y)}{\partial x}) + f$$

where $$\Delta = \frac{\partial ^2 U}{\partial x^2} + \frac{\partial ^2 U}{\partial y^2}$$

$$\qquad$$ $$A,B$$ are constants

$$\qquad$$ $$f$$ is function dependent on $$x,y,t$$

and I know, how an initial conditon and Dirichlet condition looks like. How could I find an analitical solution of the equation mentioned above? Which method should I use?

If it is needed, I can write how exactly my equation and conditions look like.

Thank you!

• I am a bit confused. Do you want an analytic solution or a numerical one? Why do you think that an analytical solution exists? Commented May 21, 2020 at 18:14
• If you want to verify that your solver code is correct, look into MMS - method of manufactured solutions. Keep in mind that the error to the exact solution depends both on the space and time discretizations, if you refine only one of them, the other will be a constant contribution preventing error convergence to zero. Commented May 22, 2020 at 6:56
• @AleksejsFomins I need to write a code for 2D ADI method in Matlab. I found a code for 1D in book Computational Partial Differential Equations Using MATLAB - Jichun Li, Yi-Tung Chen. I tired to change it from 1D to 2D, but if I understand this code, I need to know analytical solution in this code .... I do not understand why, but I need it... I can write ADI method on the paper, but I got stuck in matlab code .... Commented May 22, 2020 at 12:13
• @Ilovemath I still do not understand analytical solution of WHAT equation do you need? I have looked at ADI, it seems to be a method to solve special kind of linear systems. What you have a PDE, a differential equation. One can approximate a PDE by a linear system by discretizing it. Depending on what discretization procedure you use, you get a different type of linear system. Is your question on how to discretize the PDE? Or is it about analytical solution? If you want pure analytical solution, why do you need ADI? Commented May 22, 2020 at 19:44
• @AleksejsFomins I am so sorry. I do not know, how to explain it. I need to solve my PDE (dU/dt =....) and I need to use ADi method. But my teacher used an analytical solution in her code, so I thought that I have to use it too. I found "similar" code for 1D, but I do not know, how to change it (and I also do not know how to find an analytical solution). I posted my question also here: scicomp.stackexchange.com/questions/35202/… I hope that there it is explained clearly. Commented May 22, 2020 at 20:44

The code you have found solves a simple equation $$\frac{\partial U}{\partial t} = \frac{\partial^2 U}{\partial x^2}$$ analytically by separation of variables. This allows the author to write the solution in the form of a sum, from which only a single term survives when they apply the boundary conditions. Also, the authors perform numerical solution of the PDE using the method called finite differences. Then they compare the analytical and numerical solutions.
For your case, separation of variables (in general) is not possible because of the free term $$f(x,y,t)$$. This term makes the equation inhomogeneous, and as far as I know, there is no general approach to solving inhomogeneous equations analytically.