# How to discretize a non-linear PDE with boundary conditions and intial value

Consider this non linear PDE: $$u_t + c(u^2)_x =\alpha u_{xx} \text{ , } -10$$ with $$u(-1,t) = g_L(t) \text{ , } u(1,t) = g_R(t) \text{ and } u(x,0)=f(x)$$ where the 3 functions(gl,gr,f) are known. What is a (explicit) numerical scheme to solve this problem numerically? c and $$\alpha$$ are known constant.

Lately I have been working on the Heat equation (chapter 9 in LeVeque) and the Advection Equation (chapter 10) and I have been implemented Forward Time Central Space for the first one and Forward Time Backward Space for the last one. In both cases it has been very easy to Google information obout the methods and implement them. But I can't seem to google my way out this one, so please help.

Ny Leveque I mean: https://faculty.washington.edu/rjl/fdmbook/

• Nonlinearity does not make discretization here any more difficult; if you figure out how to solve a similar linear problem (replacing $u^2$ by $u$) that will be a step in the right direction. May 3 at 23:48
• You may benefit from reading Iterative Methods for Linear and Nonlinear Equations by C.T. Kelley, particularly Newton-GMRES and Broyden's method chapter. Also, the problem you are trying to solve is called the nonlinear advection-diffusion equation. If you want to solve it using explicit time stepping you may have to use an upwinded finite difference scheme, a finite volume scheme or a discontinuous Galerkin method depending on the viscosity and maxabs of $u$ over the interval. May 4 at 7:05
• @AbdullahAliSivas Thanks! Do yo have a link which shoes "upwinded finite difference scheme"? :) May 4 at 14:17

Your nonlinear equation is a viscous Burgers' equation and could be linearized easily by using Cole-Hopf transformation. If I rewrite your equation as:

$$u_{t} = 2 c \Big (\frac{\alpha}{2 c} u_{x} - \frac{u^{2}}{2}\Big)_{x}$$

And take:

$$\mu = \frac{\alpha}{2c}$$

$$u = -2 \mu \frac{\phi_{x}}{\phi}$$

I would have:

$$u_{x} = \frac{2 \mu}{\phi^{2}} (\phi_{x}^{2} - \phi \phi_{xx})$$

$$u_{t} = -2 \mu \Big( \frac{\phi_{x}}{\phi} \Big)_{t} = -2 \mu \Big ( \frac{\phi_{t}}{\phi} \Big )_{x}$$

$$2c(\mu u_{x} - \frac{u^{2}}{2}) = 2 c \Big (\frac{2 \mu^{2}}{\phi^{2}}(\phi_{x}^{2} - \phi \phi_{xx}) - \frac{2 \mu^{2}}{\phi^{2}} \phi_{x}^{2} \Big ) = \frac{4 c \mu^{2}}{\phi^{2}} (- \phi \phi_{xx}) = -\frac{4 c \mu^{2} \phi_{xx}}{\phi}$$

As a result your Burger's equation could be rewritten as:

$$-2 \mu \Big( \frac{\phi_{t}}{\phi} \Big)_{x} = -4 c \mu^{2} \Big( \frac{\phi_{xx}}{\phi} \Big)_{x}$$

Taking integration:

$$\int_{-1}^{x} \Big (\frac{\phi_{t}}{\phi}\Big)_{x} d x = 2 c \mu \int_{-1}^{x} \Big( \frac{\phi_{xx}}{\phi} \Big)_{x} dx$$

$$\frac{\phi_{t}}{\phi} - \frac{\phi_{t}}{\phi}\Big|_{x = -1} = 2 c \mu \Big( \frac{\phi_{xx}}{\phi} - \frac{\phi_{xx}}{\phi}\Big |_{x = -1} \Big)$$

The integral constant is defined as:

$$C(t) = \frac{\phi_{t}}{\phi}\Big|_{x = -1} - 2 c \mu \frac{\phi_{xx}}{\phi}\Big |_{x = -1}$$

As a result, you have:

$$\phi_{t} = 2 c \mu \phi_{xx} + C(t) \phi$$

Note that $$C(t)$$ only depends on boundary conditions.

Finally take:

$$\phi = \theta \exp\Bigg(\int C(t) dt \Bigg)$$

As a result:

$$\phi_{t} = \theta_{t} \exp \Bigg (\int C(t) dt \Bigg) + \theta C(t) \exp\Bigg(\int C(t) dt \Bigg)$$

$$\phi_{xx} = \theta_{xx} \exp\Bigg(\int C(t) dt \Bigg)$$

So:

$$(\theta_{t} + \theta C(t)) \exp\Bigg(\int C(t) dt \Bigg) = 2 c \mu \theta_{xx} \exp\Bigg(\int C(t) dt \Bigg) + \theta C(t) \exp\Bigg(\int C(t) dt \Bigg)$$

or:

$$\theta_{t} = 2 c \mu \theta_{xx}$$

Which above equation is just a heat transfer equation and you mentioned that you would be able to solve it with finite difference.

• This is wonderfull! :) I will try to implement it and see I can solve it. Thanks! May 4 at 16:23
• How do I transform my inital data from $u$ to $\theta$? May 8 at 1:10
• @econmajorr You know that: $$(\ln(\phi))_{x} = \frac{-1}{2 \mu} u(x,t)$$ so: $$\int_{-1}^{x} (\ln(\phi))_{x}(x^{'},t) dx^{'} = \int_{-1}^{x} \frac{-1}{2 \mu} u(x^{'},t) dx^{'}$$ or: $$\ln(\phi(x,t)) - \ln(\phi(-1,t)) = \int_{-1}^{x} \frac{-1}{2 \mu} u(x^{'},t) dx^{'}$$ or: $$\phi(x,t) = \phi(-1,t) \exp(\frac{-1}{2 \mu} \int_{-1}^{x} u(x^{'},t) dx^{'})$$ so finally: $$\phi(x,0) = \phi(-1,0) \exp\Bigg(\frac{-1}{2 \mu} \int_{-1}^{x} f(x^{'}) dx^{'}\Bigg)$$ where $f$ is the function that you defined as your initial condition. May 11 at 20:14
• @econmajorr For your boundary conditions, remember: $$\frac{\partial \ln(\phi)}{\partial x} \Bigg |_{x=-1} = g_{L}(t)$$ and $$\frac{\partial \ln(\phi)}{\partial x} \Bigg |_{x=1} = g_{R}(t)$$ May 11 at 20:52