# Analytical Solution of the Poisson's Equation for One-Dimensional Domains

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

## General solution using the Heat Transfer example

Consider the heat transfer without convection effects along the following bar:

Remember that the conduction phenomena refers to "the transfer of thermal energy from a region of higher temperature to a region of lower temperature through direct molecular communication within a medium or between mediums in direct physical contact without a flow of the material medium".

As boundary conditions, the temperature is fixed at the beginning of the bar, and the heat flow is given at the end of the bar:

$\varphi = \bar \varphi \mid_{x=x_0}$
$q = \bar q \mid_{x=x_L}$

Taking a differential length and by establishing the balance of heat flows, it can be written:

outflow $(q + dq) - (q) \frac{ }{ }$ inflow $= 0 \frac{ }{ }$
$dq = 0 \frac{ }{ }$

Using the Fourier law[1]:

$q = - k \cdot \frac{d \varphi}{dx}$

Therefore:

$dq = \frac{dq}{dx} dx = - \frac{d}{dx} \left(k \cdot \frac{d \varphi}{dx} \right) dx$
$\frac{d}{dx} \left(k \cdot \frac{d \varphi}{dx} \right) = 0$

If an external heat source is considered, the balance of heat flows becomes:

$(q + dq) - (q) - Q \cdot dx = 0 \frac{ }{ }$

$\frac{dq}{dx} - Q = 0$

$\frac{d}{dx} \left(k \cdot \frac{d \varphi}{dx} \right) + Q = 0$

Rewritting the boundary conditions:

$\varphi - \bar \varphi =0$       en       $x=x_0 \frac{ }{ }$
$q - \bar q = - \left( k \cdot \frac{d \varphi}{dx} + \bar q \right) = 0$       en       $x=x_L\frac{ }{ }$
Generic Solution:
  $\varphi (x)= - \frac{Q}{2k} x^2 + \frac{cte_1}{k} x + cte_2$

  $k \nabla \varphi(x)= - Q x + cte_1$


## The simplest case: homogeneous medium, no sources

### Case 1. With Dirichlet boundary conditions

sources medium boundary

conditions

no sources
homogeneous
Dirichlet
$Q = 0 \frac{ }{ }$
$k(x) = cte \frac{ }{ }$
$\varphi (x_0)= \varphi_0$
$\varphi (x_L)= \varphi_L$

To obtain the constants cte1 and cte2:

$\varphi (x_0)= \frac{cte_1}{k} x_0 + cte_2 = \varphi_0$
$\varphi (x_L)= \frac{cte_1}{k} x_L + cte_2 = \varphi_L$

with the result of:

$cte_1 = k \cdot \frac{\varphi_L - \varphi_0}{x_L - x_0}$
$cte_2 = \varphi_0 - \frac{cte_1}{k} x_0 = \frac{\varphi_0 x_L - \varphi_L x_0}{x_L - x_0}$

that is:

  $\varphi (x) = \frac{\varphi_L - \varphi_0}{x_L - x_0} (x - x_0) + \varphi_0$

$k \cdot \nabla \varphi (x) = k \cdot \frac{\varphi_L - \varphi_0}{x_L - x_0}$


Specific example:

parameters
sources medium b.c. geometry

$Q = 0 \frac{ }{ }$

$k = 5 \frac{ }{ }$

$\varphi_0 = 3$

$\varphi_L = 7$

$x_0 = 0 \frac{ }{ }$

$x_L = 10 \frac{ }{ }$

results
$\varphi (x_0)= 3$
$\varphi (x_L)= 7$
$\frac{d \varphi (x)}{dx} \bigg|_{\forall x} = 0.4$
$k \cdot \frac{d \varphi (x)}{dx} \bigg|_{\forall x} = 2$

To modify the parameters, edit this Matlab code

### Case 2. With Dirichlet and Neumann boundary conditions

sources medium boundary

conditions

no sources
homogeneous
Dirichlet and Neumann
$Q = 0 \frac{ }{ }$
$k(x) = cte \frac{ }{ }$
$\varphi (x_0)= \varphi_0$
$k \cdot \nabla \varphi (x) \mid_{x=x_L}= q_L$
$cte_1 = q_L \frac{}{}$
$cte_2 = \varphi_0 - \frac{q_L}{k} x_0$

that is:

  $\varphi (x) = \frac{q_L}{k} (x - x_0) + \varphi_0$

$k \cdot \nabla \varphi (x) = q_L$


note that:

$\varphi (x_L) = \frac{q_L}{k} (x_L - x_0) + \varphi_0$

Specific example:

parameters
sources medium b.c. geometry

$Q = 0 \frac{ }{ }$

$k = 5 \frac{ }{ }$

$\varphi_0 = 3$

$q_L = 2 \frac{ }{ }$

$x_0 = 0 \frac{ }{ }$

$x_L = 10 \frac{ }{ }$

results
$\varphi (x_0)= 3$
$\varphi (x_L)= 7$
$\frac{d \varphi (x)}{dx} \bigg|_{\forall x} = 0.4$
$k \cdot \frac{d \varphi (x)}{dx} \bigg|_{\forall x} = 2$

To modify the parameters, edit this Matlab code

## Heterogeneous medium, no sources

### Case 3. With Dirichlet boundary conditions

sources medium boundary

conditions

no sources
heterogeneous
Dirichlet
$Q = 0 \frac{ }{ }$
$k(x) = \begin{cases} k_1 & 0 \leqslant x \leqslant x_1 \\ k_2 & x_1 \leqslant x \leqslant x_L \end{cases}$
$\varphi (x_0)= \varphi_0$
$\varphi (x_L)= \varphi_L$

$\varphi (x) = \begin{cases} \frac{cte_1^1}{k_1} x + cte_2^1 & 0 \leqslant x \leqslant x_1 \\ \\ \frac{cte_1^2}{k_2} x + cte_2^2 & x_1 \leqslant x \leqslant x_L \end{cases}$

To obtain the constants cte1 and cte2 in both intervals:

$k_1 \nabla \varphi (x) \mid_{x=x_1} = k_2 \nabla \varphi (x) \mid_{x=x_1}$

therefore cte1 is the same in both intervals.

$\varphi (x_0)= \frac{cte_1}{k_1} x_0 + cte_2^1 = \varphi_0$   and   $\varphi (x_L)= \frac{cte_1}{k_2} x_L + cte_2^2 = \varphi_L$
$\varphi (x_1)= \frac{cte_1}{k_1} x_1 + cte_2^1 = \frac{cte_1}{k_2} x_1 + cte_2^2$

$\begin{bmatrix} \frac{x_0}{k_1} & 1 & 0 \\ \frac{x_L}{k_2} & 0 & 1 \\ \left( \frac{1}{k_1} - \frac{1}{k_2} \right) x_1 & 1 & -1 \end{bmatrix} \begin{bmatrix} \frac{}{} cte_1 \\ \frac{}{} cte_2^1 \\ \frac{}{} cte_2^2 \\ \end{bmatrix} = \begin{bmatrix} \varphi_0 \\ \varphi_L \\ \frac{}{} 0 \\ \end{bmatrix}$

with the result of:

$cte_1 = \frac{k_1 k_2 (\varphi_L - \varphi_0)}{k_1 (x_L - x_1) + k_2 (x_1 - x_0)}$

$cte_2^1 = \frac{k_1 \varphi_0 (x_L - x_1 ) + k_2 (\varphi_0 x_1 - \varphi_L x_0)}{k_1 (x_L - x_1) + k_2 (x_1 - x_0)}$

$cte_2^2 = \frac{k_1 (\varphi_0 x_L - \varphi_L x_1 ) + k_2 \varphi_L ( x_1 - x_0)}{k_1 (x_L - x_1) + k_2 (x_1 - x_0)}$

note that if k1=k2, the case 3 becomes the case 1.

Specific example:

parameters
sources medium b.c. geometry

$Q = 0 \frac{ }{ }$

$k(x) = \begin{cases} k_1 & x_0 \leqslant x \leqslant x_1 \\ k_2 & x_1 \leqslant x \leqslant x_L \end{cases}$

$\varphi_0 = 3$

$\varphi_L = 7 \frac{ }{ }$

$x_0 = 0 \frac{ }{ }$

$x_1 = 9 \frac{ }{ }$

$x_L = 10 \frac{ }{ }$

results
$\varphi (x_0)= 3$
$\varphi (x_L)= 7$
$\frac{d \varphi (x)}{dx} \bigg|_{x_0 \leqslant x \leqslant x_1} = 0.4$
$\frac{d \varphi (x)}{dx} \bigg|_{x_1 \leqslant x \leqslant x_L} = 1$
$k \cdot \frac{d \varphi (x)}{dx} \bigg|_{\forall x} = 5$

To modify the parameters, edit this Matlab code

### Case 4. With Dirichlet and Neumann boundary conditions

sources medium boundary

conditions

no sources
heterogeneous
Dirichlet and Neumann
$Q = 0 \frac{ }{ }$
$k(x) = \begin{cases} k_1 & 0 \leqslant x \leqslant x_1 \\ k_2 & x_1 \leqslant x \leqslant x_L \end{cases}$
$\varphi (x_0)= \varphi_0$
$k \cdot \nabla \varphi (x) \mid_{x=x_L}= q_L$

$\varphi (x) = \begin{cases} \frac{cte_1^1}{k_1} x + cte_2^1 & 0 \leqslant x \leqslant x_1 \\ \\ \frac{cte_1^2}{k_2} x + cte_2^2 & x_1 \leqslant x \leqslant x_L \end{cases}$

To obtain the constants cte1 and cte2 in both intervals:

$k_1 \nabla \varphi (x) \mid_{x=x_1} = k_2 \nabla \varphi (x) \mid_{x=x_1} = q_L = cte_1$

$\varphi (x_0)= \frac{cte_1}{k_1} x_0 + cte_2^1 = \varphi_0$
$\varphi (x_1)= \frac{cte_1}{k_1} x_1 + cte_2^1 = \frac{cte_1}{k_2} x_1 + cte_2^2$

$\begin{bmatrix} \frac{}{} 1 & 0 \\ \frac{}{} 1 & -1 \end{bmatrix} \begin{bmatrix} \frac{}{} cte_2^1 \\ \frac{}{} cte_2^2 \end{bmatrix} = \begin{bmatrix} \varphi_0 - \frac{cte_1 x_0}{k_1}\\ \frac{cte_1 x_1}{k_2} - \frac{cte_1 x_1}{k_1} \end{bmatrix}$

with the result of:

$cte_1 = q_L \frac{}{}$

$cte_2^1 = \varphi_0 - \frac{q_L x_0}{k_1}$

$cte_2^2 = \varphi_0 + \frac{q_L}{k_1} \left( x_1 \frac{k_2 - k_1}{k_2} - x_0 \right)$

note that if k1=k2, the case 4 becomes the case 2.

Specific example:

parameters
sources medium b.c. geometry

$Q = 0 \frac{ }{ }$

$k(x) = \begin{cases} k_1 & x_0 \leqslant x \leqslant x_1 \\ k_2 & x_1 \leqslant x \leqslant x_L \end{cases}$

$\varphi_0 = 3$

$q_L = 5 \frac{ }{ }$

$x_0 = 0 \frac{ }{ }$

$x_1 = 9 \frac{ }{ }$

$x_L = 10 \frac{ }{ }$

results
$\varphi (x_0)= 3$
$\varphi (x_L)= 7$
$\frac{d \varphi (x)}{dx} \bigg|_{x_0 \leqslant x \leqslant x_1} = 0.4$
$\frac{d \varphi (x)}{dx} \bigg|_{x_1 \leqslant x \leqslant x_L} = 1$
$k \cdot \frac{d \varphi (x)}{dx} \bigg|_{\forall x} = 5$

To modify the parameters, edit this Matlab code

## With a source, homogeneous medium

### Case 5. Constant source over the whole domain, Dirichlet boundary conditions

sources medium boundary

conditions

constant sources
homogeneous
Dirichlet
$Q = Q_0 \frac{ }{ }$
$k(x) = cte \frac{ }{ }$
$\varphi (x_0)= \varphi_0$
$\varphi (x_L)= \varphi_L$

$\varphi (x) = - \frac{Q}{2 k} x^2 + \frac{cte_1}{k} x + cte_2$

$k \nabla \varphi (x) = - Q x + cte_1$

To obtain the constants cte1 and cte2:

$\varphi (x_0) = \varphi_0 = - \frac{Q}{2 k} x_0^2 + \frac{cte_1}{k} x_0 + cte_2$
$\varphi (x_L) = \varphi_L = - \frac{Q}{2 k} x_L^2 + \frac{cte_1}{k} x_L + cte_2$

$\begin{bmatrix} \frac{x_0}{k} & 1 \\ \\ \frac{x_L}{k} & 1 \end{bmatrix} \begin{bmatrix} \frac{}{} cte_1 \\ \\ \frac{}{} cte_2 \end{bmatrix} = \begin{bmatrix} \varphi_0 + \frac{Q}{2 k} x_0^2\\ \\ \varphi_L + \frac{Q}{2 k} x_L^2 \end{bmatrix}$

with the result of:

$\vartriangle = \frac{1}{k} (x_0 - x_L)$
$cte_1 = \frac{\left[ (\varphi_0 - \varphi_L) + \frac{Q}{2 k} (x_0^2 - x_L^2) \right] }{\vartriangle}$
$cte_2 = \frac{\left[ (x_0 \varphi_L - x_L \varphi_0) + \frac{Q}{2 k} (x_0 x_L^2 - x_L x_0^2) \right] }{k \vartriangle}$

note that if Q = 0, the case 5 becomes the case 1.

Specific example:

parameters
sources medium b.c. geometry

$Q_0 = 2\frac{ }{ }$

$k = 5 \frac{ }{ }$

$\varphi_0 = 3$

$\varphi_L = 7 \frac{ }{ }$

$x_0 = 0 \frac{ }{ }$

$x_L = 10 \frac{ }{ }$

results
$\varphi (x_0)= 3$
$\varphi (x_L)= 7$
$\frac{d \varphi (x)}{dx} \bigg|_{x=x_0} = 2.4$
$\frac{d \varphi (x)}{dx} \bigg|_{x=x_L} = -1.6$
$k \cdot \frac{d \varphi (x)}{dx} \bigg|_{x=x_0} = 12$
$k \cdot \frac{d \varphi (x)}{dx} \bigg|_{x=x_L} = -8$

To modify the parameters, edit this Matlab code

### Case 6. A constant source over a part of the domain, Dirichlet boundary conditions

sources medium boundary

conditions

constant source
homogeneous
Dirichlet
$Q(x) = \begin{cases} Q_0 & x_0 \leqslant x \leqslant x_f \\ 0 & x_f \leqslant x \leqslant x_L \end{cases}$
$k(x) = cte \frac{ }{ }$
$\varphi (x_0)= \varphi_0$
$\varphi (x_L)= \varphi_L$

$\varphi (x) = \begin{cases} - \frac{Q_0}{2 k} x^2 + \frac{cte_1^1}{k} x + cte_2^1 & 0 \leqslant x \leqslant x_f \\ \\ \frac{cte_1^2}{k} x + cte_2^2 & x_f \leqslant x \leqslant x_L \end{cases}$

$k \nabla \varphi (x) = \begin{cases} - Q_0 x + cte_1^1 & 0 \leqslant x \leqslant x_f \\ \\ cte_1^2 & x_f \leqslant x \leqslant x_L \end{cases}$

To obtain the constants cte1 and cte2 in both intervals:

interval 1:

$\varphi (x_0) = - \frac{Q_0}{2 k} x_0^2 + \frac{cte_1^1}{k} x_0 + cte_2^1 = \varphi_0$
$\varphi (x_f) = - \frac{Q_0}{2 k} x_f^2 + \frac{cte_1^1}{k} x_f + cte_2^1$
$k \nabla \varphi (x) \mid_{x=x_f} = - Q_0 x_f + cte_1^1$

interval 2:

$\varphi (x_L) = \frac{cte_1^2}{k} x_L + cte_2^2 = \varphi_L$
$\varphi (x_f) = \frac{cte_1^2}{k} x_f + cte_2^2$
$k \nabla \varphi (x) \mid_{x=x_f} = cte_1^2$

with the result of:

$cte_1^1 = \frac{k}{x_L - x_0} \left[ (\varphi_L - \varphi_0) - \frac{Q_0}{2k} (x_0^2 - 2 x_L x_f + x_f^2) \right]$
$cte_2^1 = \frac{\varphi_0 x_L - \varphi_L x_0}{x_L - x_0} - \frac{Q_0}{2 k} \frac{x_0}{x_L - x_0} (2 x_L x_f + x_0 x_L - x_f^2)$

$cte_1^2 = - Q_0 x_f + cte_1^1 = \frac{k}{x_L - x_0} \left[ (\varphi_L - \varphi_0) - \frac{Q_0}{2k} (x_0^2 - 2 x_f x_0 + x_f^2) \right]$
$cte_2^2 = cte_2^1 + \frac{1}{2} \frac{Q_0 x_f^2}{k}$

note that if Q0 = 0, the case 6 becomes the case 1.

Specific example:

parameters
sources medium b.c. geometry
$Q(x) = \begin{cases} Q_0 = 2 & x_0 \leqslant x \leqslant x_f \\ 0 & x_f \leqslant x \leqslant x_L \end{cases}$

$k = 5 \frac{ }{ }$

$\varphi_0 = 3$

$\varphi_L = 7 \frac{ }{ }$

$x_0 = 0 \frac{ }{ }$

$x_f = 4 \frac{ }{ }$

$x_L = 10 \frac{ }{ }$

results
$\varphi (x_0)= 3$
$\varphi (x_L)= 7$
$\frac{d \varphi (x)}{dx} \bigg|_{x=x_0} = 1.68$
$\frac{d \varphi (x)}{dx} \bigg|_{x=x_L} = 0.08$
$k \cdot \frac{d \varphi (x)}{dx} \bigg|_{x=x_0} = 8.4$
$k \cdot \frac{d \varphi (x)}{dx} \bigg|_{x=x_L} = 0.4$

To modify the parameters, edit this Matlab code

### Case 7. Constant source over the whole domain, Dirichlet and Neumann boundary conditions

sources medium boundary

conditions

constant sources
homogeneous
Dirichlet and Neumann
$Q = Q_0 \frac{ }{ }$
$k(x) = cte \frac{ }{ }$
$\varphi (x_0)= \varphi_0$
$k \cdot \nabla \varphi (x) \mid_{x=x_L}= q_L$

$\varphi (x) = - \frac{Q}{2 k} x^2 + \frac{cte_1}{k} x + cte_2$

$k \nabla \varphi (x) = - Q x + cte_1$

To obtain the constants cte1 and cte2:

$\varphi (x_0) = \varphi_0 = - \frac{Q}{2 k} x_0^2 + \frac{cte_1}{k} x_0 + cte_2$
$k \nabla \varphi (x) |_{x_L} = - Q x_L + cte_1 = q_L$

with the result of:

$cte_1 = q_L + Q x_L \,$
$cte_2 = - \frac{Q}{2 k} x^2 + (q_L - Q x_L) \frac{x}{L} + \varphi_0$

$\varphi (x) = \frac{Q}{2 k} (x_0^2 - x^2) + \frac{q_L + Q x_L}{k} (x-x_0) + \varphi_0$
$k \nabla \varphi (x) = Q (x_L - x) + q_L$

note that if Q = 0, the case 5 becomes the case 2.

Specific example:

parameters
sources medium b.c. geometry

$Q_0 = 2\frac{ }{ }$

$k = 5 \frac{ }{ }$

$\varphi_0 = 3$

$q_L = 2 \,$

$x_0 = 0 \,$

$x_L = 10 \,$

results
$\varphi (x_0)= 3$
$\varphi (x_L)= 27$
$\frac{d \varphi (x)}{dx} \bigg|_{x=x_0} = 4.4$
$\frac{d \varphi (x)}{dx} \bigg|_{x=x_L} = 0.4$
$k \cdot \frac{d \varphi (x)}{dx} \bigg|_{x=x_0} = 22$
$k \cdot \frac{d \varphi (x)}{dx} \bigg|_{x=x_L} = 2$

To modify the parameters, edit this Matlab code