\documentclass[reqno]{amsart}
\usepackage{hyperref}
\usepackage{graphicx}

\AtBeginDocument{{\noindent\small
\emph{Electronic Journal of Differential Equations},
Vol. 2016 (2016), No. 68, pp. 1--11.\newline
ISSN: 1072-6691. URL: http://ejde.math.txstate.edu or http://ejde.math.unt.edu
\newline ftp ejde.math.txstate.edu}
\thanks{\copyright 2016 Texas State University.}
\vspace{8mm}}

\begin{document}
\title[\hfilneg EJDE-2016/68\hfil Numerical solutions]
{Numerical solutions to heat equations via the spectral method}

\author[M. Abdelwahed, N. Chorfi, V.  R\u{a}dulescu \hfil EJDE-2016/68\hfilneg]
{Mohamed Abdelwahed, Nejmeddine Chorfi, Vicen\c{t}iu  R\u{a}dulescu}

\address{Mohamed Abdelwahed \newline
 Department of Mathematics, College of Sciences,
 King Saud University,
 Riyadh, Saudi Arabia}
\email{mabdelwahed@ksu.edu.sa}

\address{Nejmeddine Chorfi \newline
 Department of Mathematics, College of Sciences,
 King Saud University,
 Riyadh, Saudi Arabia}
\email{nchorfi@ksu.edu.sa}

\address{Vicen\c{t}iu  R\u{a}dulescu \newline
Institute of Mathematics ``Simion Stoilow'' of the Romanian Academy,
P.O. Box 1-764, 014700 Bucharest, Romania. \newline
Department of Mathematics, University of Craiova,
200585 Craiova, Romania}
\email{vicentiu.radulescu@imar.ro}

\thanks{Submitted December 10, 2015. Published March 11, 2016.}
\subjclass[2010]{35K05, 35K20, 58J35, 65M70}
\keywords{Heat equation; Euler's method;
 spectral discretization; 
\hfill\break\indent  error estimate}

\begin{abstract}
 In this article we study a discretized version of the heat equation.
 For the time semi-discrete problem, we use an implicit Euler's scheme,
 and for the space discretization we used the spectral method.
 We estimate for the error between the exact and approximated 
 discrete solutions, and illustrate the features of our method with
 numerical examples.
\end{abstract}

\maketitle
\numberwithin{equation}{section}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{remark}[theorem]{Remark}
\newtheorem{corollary}[theorem]{Corollary}
\allowdisplaybreaks

\section{Introduction}

Let $\Omega\subset \mathbb{R}^{d}$, $d=2,3$ be a bounded connected domain,
with boundary $\Gamma =\partial \Omega$ that is assumed Lipschitz continuous, 
and let $T$ be a positive real number. We consider the heat equation
\begin{equation}\label{pb0}
\begin{gathered}
 \frac{\partial u}{\partial t} -\Delta u=f \quad \text{in } \Omega\times]0,T[,\\
 u=0 \quad \text{on } \partial \Omega \times]0,T[,\\
 u(\cdot,0)=u_0 \quad \text{in } \Omega,
 \end{gathered}
 \end{equation}
 where $f\in L^2(\Omega\times ]0,T[)$ and $u_0 \in L^2(\Omega)$ are given, and
 $u$ is the unknown function.

This model was studied in \cite{BBM} using the finite element discretization.
The aim of this work is to extend this study to the spectral discretization
method known for its high precision \cite{BM2}. 
The spectral element method is used for the discretization of
elliptic equations with discontinuous coefficients. 
This method is also used for the heat diffusion in an inhomogeneous medium,
see \cite{BC}.
A posteriori analysis of the spectral discretization
of the heat equation is presented in \cite{pos}.


We begin by doing the time discretization of the heat equation using an 
implicit Euler scheme. The existence and uniqueness of the
solution are established, and an error  estimate of order $1$ in time is presented.
Then, we use the spectral method for space discretization and we prove an
error estimate.

This article is organized as follows. We begin by presenting in section 2
the variational formulation of the  problem and the proof of existence
and uniqueness of the solution.
Section 3 is devoted to the time and space discretization problems.
The  error estimates on time and space are proved in section 4.
 Finally some numerical results are presented in section 5.

\section{Continuous problem}

We first study the variational formulation of problem \eqref{pb0}.
Then we present the existence and uniqueness of the solution.
In the following, we use the classical Sobolev spaces $H^s(\Omega)$ and
$H_0^s(\Omega)$ endowed with the norm  $\|\cdot\|_{H^s(\Omega)}$
and the seminorm  $|\cdot|_{H^s(\Omega)}$. We use the following notation
 (see \cite{R2,R1}):
\begin{itemize}
\item $(\cdot,\cdot)$ is the scalar product defined on $L^2(\Omega)$ and by extension,
the duality paring between $H^{-s}(\Omega)$ and $H_0^s(\Omega)$,

 \item $L_0^2(\Omega)$ is the space of functions in $L^2(\Omega)$ with a
null integral,

\item $C^0(0,T,X)$ the space of continuous functions from $[0,T]$ with values
in $X$ a Banach space with associated norm $\|\cdot\|_X$,

\item $L^2(0,T,X)$ the space of square integrable functions from $[0,T]$
 with values in $X$ with associated norm
 $$
\|v\|_{L^2(0,t,X)}=\int_0^t\|v(.,s)\|_X^2 ds.
$$
\end{itemize}

\subsection{Variational formulation}

Problem \eqref{pb0} admits the following variational formulation.
Find $u\in C^0(0,T;L^2(\Omega))\cap L^2(0,T;H_0^1(\Omega))$ such that
for all $t \in ]0,T[$,
\begin{gather}\label{pb2}
  u(\cdot,0)=u_0 \quad \text{in } \Omega; \\
\label{pb3}
 \int_\Omega\frac{\partial u}{\partial t}(x,t) v(x) dx
+ \int_\Omega\nabla u(x,t)\nabla v(x) dx
=\int_\Omega f(x,t) v(x) dx \quad \forall v \in H_0^1(\Omega).
\end{gather}
It is shown in \cite[Theorem 7.2.1]{Rav-Tho}, \cite{Li-Ma}, \cite{VT}
that problem \eqref{pb2}-\eqref{pb3}  has a unique solution
$u \in C^0(0,T,L^2(\Omega))\cap L^2(0,T,H_0^1(\Omega))$.

By choosing $v=u$ in \eqref{pb3} and integrating on $]0,t[$, $0\le t \le T$,
we deduce the following stability condition:
\begin{equation}
 [u](t)\le C \Big(\|u_0\|_{L^2(\Omega)}^2+\|f\|_{L^2(0,t,H^{-1}(\Omega))}^2
\Big)^{1/2},
\end{equation}
where $[\cdots]$ is a norm defined for all $w\in L^2(0,t,H_0^1(\Omega))$ by
\begin{equation}
 [w](t)=\Big(\|w\|_{L^2(\Omega)}^2+\|w\|_{L^2(0,t,H_0^1(\Omega))}^2\Big)^{1/2}
\end{equation}
and $C$ is a constant depending only on the domain $\Omega$.

In the same way by taking $v=\frac{\partial u}{\partial t}$ in \eqref{pb3}
and if $u_0\in H_0^1(\Omega)$ we obtain
\begin{equation}
 |u(t)|_{H_0^1(\Omega)}^2+\|\frac{\partial u}{\partial t}
\|_ {L^2(0,T,L^2(\Omega))}^2
\le |u_0|_{H_0^1(\Omega)}^2
+\|f\|_{L^2(\Omega \times(0,T))}^2
\end{equation}
which implies that $u$ is in $L^2(0,T,H^2(\Omega))$.

\section{Discrete problem}

\subsection{Time discretization}
Let $T$ be a fixed positive number and $f$ be a function in 
$C(0,T,H^{-1}(\Omega))$.
We consider the partition of $[0,T]$ into $I$ equal subintervals
$[t_{i-1},t_i]$, $1\le i \le I$ with $t_0 < t_1 < \dots < t_I=T$ and
$\delta t =t_i-t_{i-1}=T/I$.

Let $W_{\delta t}$ be the space of functions $v_{\delta t}$ which are
continuous on $[0,T]$ and affine on each subinterval
$[(i-1)\delta t, i \delta t]$, $0\le i \le I$, with values in $L^2(\Omega)$.
For each family $v^i \in L^2(\Omega)$, $0\le i \le I$, we associate the function
$v_{\delta t} \in W_{\delta t}$ equal to $v^i$ on $i \delta t$, $0\le i \le I$.
This function is written for $0\le i \le I$,
\begin{equation}\label{7}
 v_{\delta t}=v^i+\frac{t_i-t}{\delta t}(v^i-v^{i-1}), \quad
\forall t\in [t_{i-1},t_i].
\end{equation}
For simplicity, we denote by $f^i=f(x,t_i)$. Using the implicit Euler scheme,
the time discrete problem is written
\begin{equation}\label{8}
  \begin{gathered}
  \frac{u^i-u^{i-1}}{\delta t}-\Delta u^i=f^i \quad  \text{in } \Omega, \;
 1\le i \le I,\\
  u^i=0 \quad \text{on } \partial \Omega, \; 1\le i \le I,\\
  u^0=u_0 \quad \text{in } \Omega .
 \end{gathered}
\end{equation}
This problem admits the following equivalent variational formulation.
Find  $u^i$ in $L^2(\Omega)\times H_0^1(\Omega)^I$ ($1\le i \le I$)
 which satisfies
\begin{equation} \label{9}
u^0=u_0\quad \text{in } \Omega,
\end{equation}
and for each $ v\in H_0^1(\Omega)$,
\begin{equation}\label{pb8}
\begin{aligned}
&\int_{\Omega} u^i(x) v(x) dx +\delta t \int_{\Omega} \nabla u^i(x) \nabla v(x) dx\\
&=  \int_{\Omega} u^{i-1}(x) v(x) dx+ \delta t \int_{\Omega} f^i(x) v(x) dx.
\end{aligned}
\end{equation}
Using the Lax-Milgram theorem, we deduce that problem \eqref{9}-\eqref{pb8}
has a unique solution $u^i\in (H_0^1(\Omega))^I$, $1\le i \le I$.

Moreover, by taking $v=u^i$ in  \eqref{pb8}  we obtain
\begin{equation}
 \|u^i\|_{L^2(\Omega)}^2+\delta t \|\nabla u^i\|_{L^2(\Omega)}^2
\le  \|u^{i-1}\|_{L^2(\Omega)}^2+\delta t \|f^i\|^2_{H^{-1}(\Omega)}.
\end{equation}
Summing with respect to $i$, we deduce the following stability condition
on the solution $u^i$, $1\le i \le I$:
\begin{equation}\label{12}
 \|u^i\|_{L^2(\Omega)}^2+\delta t \sum_{l=1}^i\| u^l|_{H^1(\Omega)}^2
\le  C \Big(  \|u^0\|_{L^2(\Omega)}^2+\delta t \sum_{l=1}^i
 \| f^l\|_{H^{-1}(\Omega)}^2 \Big),
\end{equation}
where $C$ is a constant independent of $\delta t$.

For $v_{\delta t }$ in $W_{\delta t }$ and if $u^i \in (H^1(\Omega))^I$,
we define the norm
$$
 [|v_{\delta t}|](t_i)=\Big(\|v^i\|_{L^2(\Omega)}^2
+\delta t \sum_{l=1}^i\| v^l|_{H^1(\Omega)}^2\Big)^{1/2}.
$$
We remark that
$$
[v_{\delta t}](t_i)= \Big(\|v^i\|_{L^2(\Omega)}^2
+\int_0^{t_i}|v_{\delta t}(\cdot,s)|_{H^1(\Omega)}^2 ds \Big)^{1/2}.
$$
Considering that
$$
\int_0^{t_i}|v_{\delta t}(.,s)|_{H^1(\Omega)}^2 ds
= \sum_{l=1}^{i}\int_{t_{l-1}}^{t_l}|v_{\delta t}(.,s)|_{H^1(\Omega)}^2 ds
$$
and using \eqref{7} we obtain
$$
\delta t |v^{l-1}|_{H^1(\Omega)}^2
\le \int_{t_{l-1}}^{t_l}|v_{\delta t}(.,s)|_{H^1(\Omega)}^2 ds
\le \delta t |v^{l}|_{H^1(\Omega)}^2.
$$
Computing the sum, we show finally that there exist two constants $C_1$
and $C_2$ independent of $ \delta t$ such that
\begin{equation}\label{13}
 C_1 [v_{\delta t}] (t_i) \le  [|v_{\delta t}|] (t_i) \le  C_2 [v_{\delta t}] (t_i).
\end{equation}

\subsubsection{A priori error estimates}
Let $e^i=u(t_i)-u^i$, $ 1\le i \le I$ and $e^0=0$.
By writing problem \eqref{pb3} for $t=t_i$ we obtain
$$
 \int_\Omega\frac{\partial u}{\partial t}(x,t_i) v(x) dx
+ \int_\Omega\nabla u(x,t_i)\nabla v(x) dx=\int_\Omega f(x,t_i) v(x) dx.
$$
Next, observing that
$$
 \int_{\Omega}\Big(\int_{t_{i-1}}^{t_i}\frac{\partial u}{\partial t}(x,t)\Big) v(x) dx
=\int_{\Omega}(u(x,t_i)-u(x,t_{i-1}))v(x) dx
$$
and using \eqref{7}, we deduce that for all $v \in H_0^1(\Omega)$, the sequence
 $(e^i)_{1\le i \le I}$ is solution of the problem
\begin{equation}
\begin{aligned}
&\int_\Omega e^i(x) v(x) dx + \delta t  \int_\Omega \nabla e^i(x) \nabla v(x) dx \\
&=  \int_\Omega e^{i-1}(x) v(x) dx +   \delta t
\Big(\frac{1}{\delta t} \int_\Omega \Big(\int_{t_{i-1}}^{t_i}
\frac{\partial u}{\partial t}(x,t) dt
- \frac{\partial u}{\partial t}(x,t_i)\Big) v(x) dx\Big).
  \end{aligned}
\end{equation}
Considering \eqref{12} with
$f^i=\frac{1}{\delta t}\Big(\int_{t_{i-1}}^{t_i}\frac{\partial u}{\partial t}(x,t) dt
 - \frac{\partial u}{\partial t}(x,t_i)  \Big)$ and using the fact that
$\frac{\partial^2 u}{\partial t^2}\in L^2(0,T,H^{-1}(\Omega))$ we deduce
\begin{equation}
 [|u-u_{\delta t}|](t_i)\le C \delta t \|
\frac{\partial^2 u}{\partial t^2}\|_{L^2(0,t_i,H^{-1}(\Omega))}^2
\end{equation}
where $C$ is a constant independent of $\delta t$.
Using the norm equivalence \eqref{13}, we conclude that there exists a
constant $C$ independent of $\delta t$ such that
\begin{equation}
  [u-u_{\delta t}](t_i)\le C \delta t \|u\|_{H^2(0,t_i,H^{-1}(\Omega))}^2.
\end{equation}


\subsection{Space discretization}
We suppose throughout this part that $\Omega$ is a rectangle for $d=2$
or a parallelepiped for $d=3$.

For a positive integer $N$, we denote by $\mathbb{P}_N(\Omega)$ the set of
polynomials with $d$ variables and degree $\le N$ for each variable.
Let $\xi_0=-1$ and $\xi_N=1$, we define $(N-1)$ nodes $\xi_j$,
$1\le j \le (N-1)$ (which are the zeros of the polynomial $L_N'$ where $L_N$
is the Legendre polynomial) and $(N+1)$ weights $\rho_j$, $0\le j \le N$
satisfying the Gauss-Lobatto quadrature formula on $]-1,1[$
\begin{equation}\label{17}
 \int_{-1}^{1} \psi_N dx=\sum_{j=0}^{N} \psi_N(\xi_j)\rho_j\quad, \,
\forall \psi_N \in \mathbb{P}_{2N-1}(]-1,1[).
\end{equation}
We recall the following formula (see \cite{BMR}):
\begin{equation}\label{18}
 \|\psi_N\|_{L^2(]-1,1[)}^2 \le \sum_{j=0}^{N}
\psi_N^2(\xi_j) \rho_j \le 3 \|\psi_N\|_{L^2]-1,1[}^{2}, \quad \forall \psi_N
\in \mathbb{P}_N(]-1,1[).
\end{equation}
Let $F$ be the affine application which transforms $]-1,1[^d$ $(d=2, 3)$ to
 $\Omega$. We introduce the discrete scalar product
\[
 (u,v)_N= \begin{cases}
  \frac{\operatorname{meas}(\Omega)}{4}\sum_{i=0}^{N}
\sum_{j=0}^{N} u \circ F(\xi_i,\xi_j) v \circ F(\xi_i,\xi_j) \rho_i \rho_j , 
&d=2 \\[4pt]
    \frac{\operatorname{meas}(\Omega)}{8}\sum_{i=0}^{N}\sum_{j=0}^{N}
\sum_{k=0}^{N} u \circ F(\xi_i,\xi_j,\xi_k) v \circ F(\xi_i,\xi_j,\xi_k)
 \rho_i \rho_j \rho_k, &d=3
 \end{cases}
\]
We suppose that $u_0$ and $f$ are respectively continuous on $\Omega$
 and $\Omega\times]0,T[$. Using the Galerkin method and numerical integration,
 the space discrete problem of \eqref{pb8} is written as follows.

Find $u_N^i\in (\mathbb{P}_N^0(\Omega))^I$, $1\le i \le I$ such that
\begin{equation}\label{20}
 u_N^0=\mathcal{I}_N(u_0) \quad \text{in } \Omega
\end{equation}
and for $1\le i\le I$,
\begin{equation}\label{21}
(u_N^i,v_N^i)_N+\delta t (\nabla u_N^i, \nabla v_N ^i )_N
= (u_N^{i-1},v_N)_N + \delta t( f^i, v_N)_N ,\quad
 \forall v_N\in  \mathbb{P}_N^0(\Omega),
\end{equation}
where $\mathcal{I}_N$ is the interpolation operator from $L^2(\Omega)$
to $\mathbb{P}_N(\Omega)$.

\begin{proposition} \label{prop3.1}
 Problem \eqref{20}-\eqref{21} has a unique solution
$(u_N^0,u_N^i)_{1\le i \le I}$ in
$\mathbb{P}_N (\Omega)\times (\mathbb{P}_N^0(\Omega))^i$ and there exists
a positive constant $C$ independent of $N$ such that
 \begin{equation}\label{22}
  \|u_N^i\|_{L^2(\Omega)}^2+\delta t \sum_{l=1}^{i}|u^l|_{H^1(\Omega)}^{2}
\le C  \Big( \|\mathcal{I}_N(u_0)\|_{L^2(\Omega)}^2
+\delta t \sum_{l=1}^{i}\|\mathcal{I}_N(f^l)\|_{L^2(\Omega)}^{2} \Big)
 \end{equation}
\end{proposition}

\begin{proof}
 Using the Lax-Milgram theorem, the Cauchy-Schwarz inequality and inequality
\eqref{18}, we show that \eqref{20}-\eqref{21} has a unique solution
$(u_N^0,u_N^i)_{1\le i \le I} \in\mathbb{P}_N (\Omega)\times
 (\mathbb{P}_N^0(\Omega))^i$.

 To prove \eqref{22}, we begin by choosing $v_N=u_N^i$ in \eqref{21} and
using the Cauchy-Schwarz inequality, we obtain
 \begin{equation}\label{eq200}
\begin{aligned}
&(u_N^i,u_N^i)_N+\delta t (\nabla u_N^i, \nabla u_N ^i )_N\\
&\le (u_N^{i-1},u_N^{i-1})_N^{1/2}(u_N^{i},u_N^{i})_N^{1/2}
+ \delta t(\mathcal{I}_N f^i, \mathcal{I}_N f^i)_N^{1/2} (u_N^{i},u_N^{i})_N^{1/2}.
\end{aligned}
\end{equation}
Using the inequality $ab\le \frac{a^2}{2}+ \frac{b^2}{2}$, the
Poincar\'e-Friedrichs inequality and the inequality \eqref{18},
relation \eqref{eq200} becomes
 $$
 \frac{1}{2}\|u_N^i\|^2_{L^2(\Omega)}+\delta t \|\nabla u_N^i\|_{L^2(\Omega)}^2
\le \frac{\|u_N^{i-1}\|^2_{L^2(\Omega)}}{2}
+\delta t \Big(\frac{\|\mathcal{I}_N(f^i)\|^2_{L^2(\Omega)}}{2}
+ C  \|\nabla u_N^i\|_{L^2(\Omega)}^2\Big)
 $$
 where $C$ is the Poincar\'e-Friedrichs  constant.
 Finally, computing the sum on $i$, we deduce the inequality \eqref{22}.
\end{proof}

\section{Error estimate}

We establish now the error estimate between the solution $u$ of the continuous
problem \eqref{pb0} and the solution $(u^i_N)_{0\le i \le I}$ of the
discrete problem \eqref{21}. We define $u_{N \delta t}$ the function in
$W_{\delta t}$ equal to $u_N^i$ on $i \delta t$.

\begin{theorem} \label{thm4.1}
 If $f$ and $u_0$ are respectively continuous on $\overline{\Omega} \times [0,T]$
and $\overline{\Omega}$, we have the following error estimates:
 There exists a constant $C$ independent of $\delta t$ and $N$ such that
 \begin{equation}\label{23}
  \begin{aligned}
&[|u_{\delta t}-u_{N \delta t}|](t_i)\\
&\le C \Big(   \inf_{\substack{v_n^l \in \mathbb{P}_N(\Omega)\times
\mathbb{P}_{N-1}^0(\Omega)\\0\le l \le I}}
   \Big([|u_{\delta t}-v_{N \delta t} |](t_i)+\|u_0-v_N^0\|_{L^2(\Omega)}\Big)
 +\|u_0-\mathcal{I}_N u_0\|_{L^2(\Omega)}\\
&\quad +\Big(\delta t  \sum_{l=1}^{i}\Big[ \inf_{f_N^l\in\mathbb{P}_{N-1}(\Omega)}
\|f^l-f^l_{N}\|_{L^2(\Omega)}+\|f^l-\mathcal{I}_N f^l\|_{L^2(\Omega)}
\Big]\Big)^{1/2}\Big)
  \end{aligned}
 \end{equation}
\end{theorem}

\begin{proof}
 Let $(v_N^i)_{0\le i \le N} \in \mathbb{P}_N(\Omega)\times
(\mathbb{P}_{N-1}^0(\Omega))^I$.
 Considering that $(u_N^i)_{0\le i \le I}$ and $(u^i)_{0\le i \le I}$
are respectively the solutions of \eqref{21} and  \eqref{pb8} and taking
into account that the quadrature formula \eqref{17}  is exact for
polynomials with degree $\le 2N-1$, we deduce that for all
$w_N\in \mathbb{P}_N(\Omega)$
\begin{equation}
 \begin{aligned}
&(u_N^i-v_N^i,w_N)_N+\delta t (\nabla (u_N^i-v_N^i),\nabla w_N)_N\\
&= (u_N^{i-1}-v_N^{i-1},w_N)_N+\int_\Omega (u^i-v_N^i)(x)w_N(x) dx \\
&\quad -\int_\Omega (u^{i-1}-v_N^{i-1})(x)w_N(x) dx
 +\delta t  \int_\Omega \nabla(u^i-v_N^i)(x) \nabla w_N dx\\
&\quad +\delta t(f^i,w_N)_N - \delta t \int_\Omega f^i(x) w_N(x) dx
 \end{aligned}
\end{equation}
 By introducing $f_{N-1}^l$ in $\mathbb{P}_{N-1}(\Omega)$, then
following the exactness of the quadrature formula \eqref{17}, for all
$w_N \in \mathbb{P}_N(\Omega) $,
\begin{equation}\label{24}
 \int_{\Omega} f^l(x) w_N(x) dx - (f^l,w_N)_N
= \int_{\Omega} (f^l - f^l_{N-1})(x) w_N (x) dx
-(\mathcal{I}_N f^l - f_{N-1}^l ,w_N)_N
 \end{equation}
 Summing over $i$ in \eqref{24} and using the fact that
 $$
 \|u_{\delta t} - u_{N \delta t} \|
\le  \|u_{\delta t} - v_{N \delta t} \| + \|u_{N \delta t} - v_{N \delta t} \|
 $$
 we obtain \eqref{23}.
\end{proof}

We define $\Pi_N$ (respectively $\Pi_N^{1,0}$) the orthogonal projection
operator from $L^2(\Omega)^d$ (respectively $H_0^1(\Omega)^d$) onto
$\mathbb{P}_N(\Omega)$ \cite{BMR}.
To obtain the order of convergence with respect to $N$, we take
 $v_N^l=\Pi_N u_0 \times \Pi_N^{1,0} u_l $ and
$f_{N-1}^l= \Pi _{N-1} f^l$; $1 \le l \le i$ in \eqref{23}
and we use the polynomial approximation and interpolation results \cite{BM}.
We obtain the following theorem.

\begin{theorem} \label{thm4.2}
Assume that $f \in C^0([0,T]\times H^{\sigma}(\Omega))$ and
$u_0\in H^{\sigma}(\Omega), \, \sigma > \frac{d}{2}$.
Let $(u^i)_{0\ge i \le I}\in H^{s}(\Omega)$,  $s\ge 1$ be the solution of
 \eqref{21}. Then there exists $C>0$ independent of $\delta t$ and $N$ such that
\begin{align*}
\|u_{\delta t}-u_{N \delta t}\| (t_i)
& \le C \Big(N^{1-s} \Big(  \|u^i\|_{H^s(\Omega)}^2
+  \delta t \sum_{l=1}^{i}  \|u^l\|_{H^s(\Omega)}^2 \bigg )^{1/2} \\
&\quad + N^{-\sigma} \bigg(\|u_0\|_{H^s(\Omega)}+\|f\|_{C^0([0,T],H^s(\Omega))}
 \Big) \Big).
\end{align*}
\end{theorem}

Let $u$ be the solution of  \eqref{pb0}. By writing
$$
[|u-u_{N \delta t}|]\le [|u-u_{\delta t}|]+[|u_{\delta t}-u_{N \delta t}|]
$$
and using the property \eqref{13} we obtain the  following property.

\begin{corollary} \label{cor4.1}
 Let $f\in L^2(0,T,H^{\sigma}(\Omega))$ and
$u_0 \in L^2(0,T,H^{\sigma}(\Omega))$. If we assume that the solution $u$
of problem \eqref{pb0} is in $L^2(0,T,H^{s}(\Omega))$ then
\begin{align*}
&[u-u_{N \delta t}](t_i)\\
&\le C_1 (\delta t + N^{1-s})\|u\|_{L^2(0,t_i,H^{s}(\Omega))}
+C_2(\delta t + N^{-\sigma})(\|f\|_{L^2(0,t_i,H^\sigma(\Omega))}
+\|u_0\|_{H^{\sigma}(\Omega)}).
\end{align*}
 where $C_1$ and $C_2$ are  constants independent of $\delta t$ and $N$.
\end{corollary}

\section{Numerical results}

\begin{figure}[htb]
\begin{center}
\includegraphics[width=0.5\textwidth]{fig1} % erreurreg.png
\end{center}
\caption{Error on time for the solution \eqref{testt1}}\label{fig1}
\end{figure}

\begin{figure}[htb]
\begin{center}
 \includegraphics[width=0.5\textwidth]{fig2} % erreursing.png
\end{center}
\caption{Error on time for the solution \eqref{testt2}}\label{fig2}
\end{figure}

Let $h_j$ be the Lagrange polynomial interpolation defined by
$$
h_j\in \mathbb{P}([-1,1]),\quad h_j(\xi_i)=\delta_{ij},\quad 0\leq i,j\leq N
$$
where $\delta_{ij}$ is the Kronecker symbol.

We have then for each $u_N^i\in \mathbb{P}_N^0(\Omega)^I$ solution of
the discrete problem \eqref{21},
$$
u_N^i(x,y)=\sum_{i=1}^{N-1}\sum_{j=1}^{N-1}u_N^i(\xi_i^x,\xi_j^y) h_i^x(x) h_j^y(y)
$$
where $(\xi_i^x,\xi_j^y)=F(\xi_i,\xi_j)$ and $h_i^x h_j^y$ verify
$h_i^x h_j^y \circ F=h_i h_j$.

If we consider $U^i$ the vector composed by the admissible solutions
$u_N^i(\xi_i^x,\xi_j^y)$ then the discrete problem \eqref{21} can be written
as the  matrix  form
$$
(D+\delta t A) U^i=F^i
$$
where $D$ is a diagonal matrix of components $\rho_r \rho_s$,
$1\le r,s \le N-1$, $A$ is the matrix with components
$(\nabla(h_i h_j);\nabla(h_r h_s))$, $1 \le i,j,r,s\le N-1$ and $F^i$
is a vector with components
$(u_N^{i-1}(\xi_r,\xi_s)+\delta t f^i(\xi_r,\xi_s))\rho_r\rho_s$,
 $1 \le i,r,s\le N-1$.

We note that $D+\delta t A$ is a symmetric, positive definite matrix.
The algorithm is then solved using the gradient conjugate method.

We present in the following some numerical tests in order to confirm
the theoretical results. The numerical results have been performed
in dimension $d=2$.


\begin{figure}[htb]
\begin{center}
\includegraphics[width=0.5\textwidth]{fig3} %errespacereg1.png
\end{center}
\caption{Error on space for the solution \eqref{testt1}}\label{fig3}
\end{figure}

\begin{figure}[htb]
\begin{center}
\includegraphics[width=0.5\textwidth]{fig4} % erroreg2.png
\end{center}
\caption{Error on space for the solution \eqref{testt2}}\label{fig4}
\end{figure}

\begin{figure}[htb]
\begin{center}
 \includegraphics[width=0.48\textwidth]{fig5a} % isoexasol.png
 \includegraphics[width=0.48\textwidth]{fig5b} % isoexasol.png?
\end{center}
\caption{Convergence in space: Continuous solution (right), discrete
 solution (left)}\label{fig5}
\end{figure}


\subsection{Convergence in time}

We are interested in this case to the time convergence. We consider the
domain $\Omega=[-1,1]^2$. Two examples of the exact solution are tested.
The first one is
\begin{equation}\label{testt1}
u(t,x,y)=\cos(\pi t) \sin(\pi x) \sin(\pi y)
\end{equation}
The domain is discretized with $N=20$. $T$ is taken equal to $1$ and
$\delta t=10^{-1}$, $10^{-2}$, $10^{-3}$ and $10^{-4}$. 
We present in Figure \ref{fig1} the quantities 
$\log_{10}\|u-u_{N\delta t}\|_{H^1(\Omega)^2}$
 (in blue) and  $\log_{10}\|u-u_{N\delta t}\|_{L^2(\Omega)^2}$ (in red)
as a function of $\log_{10}(\delta t)$.
For the second test we consider a less regular solution
\begin{equation}\label{testt2}
u(t,x,y)=t^{3/2}(1-x^2)^{5/2}(1-y^2)^{5/2}
\end{equation}
 and we present in Figure \ref{fig2} the same quantities as the Figure  \ref{fig1}
for $N=20$ a time  $T=0.1$ and for time step
$\delta t=5\times 10^{-2}, 10^{-2}, 5\times 10^{-3}, 10^{-4}$.
The obtained figures show that the errors decrease, which prove the convergence
of the method.

\subsection{Convergence in space}

In this test, we fix the time step $\delta t=0.01$ and we vary
$N$ from $5$ to $22$.
We consider
$$
u=(1+t)(1-x^2)(1-y^2)
$$
and $T=1$. We present in figure \ref{fig3} (respectively figure \ref{fig4})
the quantities $\log_{10}\|u-u_{N\delta t}\|_{H^1(\Omega)^2}$
(in blue) and  $\log_{10}\|u-u_{N\delta t}\|_{L^2(\Omega)^2}$ (in red)
as a function of $N$ (respectively $ \log_{10}(N)$). We remark that the
error norm $\log_{10}\|u-u_{N\delta t}\|_{H^1(\Omega)^2}$ decreases until
$N=10$ and becomes sinusoidal for $N>10$. The error
 $\log_{10}\|u-u_{N\delta t}\|_{L^2(\Omega)^2}$ decreases until $N=10$
and stagned for $N>10$. These results are due to the fact that the convergence
order in time is less than that on space and that the time variation polutes
the space convergence.
The isovalues of the exact and discrete solutions for this case when 
$\delta t=0.01$ and $N=22$ are presented in Figure \ref{fig5}.

\begin{figure}[htbp]
\begin{center}
 \includegraphics[width=0.7\textwidth]{fig6} % dom.png
\end{center}
\caption{Physical test domain}\label{fig6}

\end{figure}
\begin{figure}[htbp]
\begin{center}
 \includegraphics[width=0.7\textwidth]{fig7} % newdiapo1.png
\end{center}
\caption{Physical test, $g=1$}\label{fig7}
\end{figure}

\begin{figure}[htbp]
\begin{center}
\includegraphics[width=0.7\textwidth]{fig8} % newdiapo10.png
\end{center}
\caption{Physical test, $g=10$}\label{fig8}
\end{figure}

\begin{figure}[htbp]
\begin{center}
 \includegraphics[width=0.7\textwidth]{fig9} % newdiapo30.png
\end{center}
\caption{Physical test, $g=30$}\label{fig9}
\end{figure}


\subsection{Physical interpretation}

We consider the  test presented in \cite{T} where $u$ represents
the temperature. The domain $\Omega$ is a rectangle $[0,10]\times[0,2]$
(see figure \ref{fig6}). We consider a variable boundary condition $u=g$
at the inlet of the domain and a fixed boundary condition $u=0$ at the
other parts. We consider $T=1$, $\delta t=0.01$ and $N=40$. We present
respectively in figures \ref{fig7}, \ref{fig8} and \ref{fig9} the
isovalues of the discrete  solution for $g$ equal respectively
to $1, 10$ and $30$. We remak the convergence of the solution for
the three cases which correspond to the thermic convection in the
direction of the $x$ axis.


\begin{remark} \rm
Although the spectral methods are known as highly order method in space,
we remark that they have the disadvantage of losing part of this
accuracy due to lower order of temporal discretization (often of order $1$ or $2$).
\end{remark}

 \subsection*{Acknowledgments}
 The first and second authors would like to extend their sincere appreciation
to the Deanship of Scientific Research at King Saud University for funding
this Research group No (RG-1435-026).
The third author thanks the Visiting Professor Programming at King Saud
 University for funding this work.

 \begin{thebibliography}{00}

\bibitem{BBM} A. Bergam, C. Bernardi, Z. Mghazli;
A posteriori analysis of the finite element discretization of some parabolic
equations, \emph{Math. Comp.} \textbf{74} (2005), no. 251, 1117-1138.

\bibitem{BC} C. Bernardi, N. Chorfi;
 Mortar spectral element methods for elliptic equations woth discontinuous
coefficients, \emph{Math. Models Methods Appl. Sci.} \textbf{12} (2002),
no. 4, 497-524.

 \bibitem{BM} C. Bernardi, Y. Maday;
\emph{Approximation spectrales pour les probl\`emes aux limites elliptiques},
Springer-Verlag, Paris, 1992.

\bibitem{BM2} C. Bernardi, Y. Maday;
 \emph{Spectral Methods}, North-Holland, Amsterdam, 1997.

\bibitem{BMR} C. Bernardi, Y. Maday, F. Rapetti;
Discr\'etisations variationnelles de probl\`emes aux limites elliptiques,
\emph{Collection Math\'ematiques et Application}, 45, Springer-Verlag, Paris, 2004.

\bibitem{pos} N. Chorfi, M. Abdelwahed, I. Ben Omrane;
 A posteriori analysis of the spectral element discretization of heat equation,
\emph{An. St. Univ. Ovidius Constanta} \textbf{22}(3) (2014), 13-35.

\bibitem{Li-Ma}  J.-L. Lions, E. Magenes;
\emph{ Probl\`emes aux limites non homog\`enes et applications},
Vol 1, Dunod, Paris, 1968.

\bibitem{Rav-Tho} P. A. Raviart, J. M. Thomas;
 \emph{Introduction \`a l'analyse num\'erique des \'equations aux d\'eriv\'ees
partielles}, Masson, Paris, 1983.

\bibitem{R2} V. R\u adulescu;
 Nonlinear elliptic equations with variable exponent: old and new,
\emph{Nonlinear Anal.} \textbf{121} (2015),  336-369.

\bibitem{R1} V. R\u adulescu, D. Repov\v{s};
\emph{Partial Differential Equations with Variable Exponents:
Variational Methods and Qualitative Analysis}, CRC Press,
Taylor and Francis Group, Boca Raton FL, 2015.

\bibitem{VT} V. Thom\'ee;
\emph{ Galerkin Finite Element Methods for Parabolic Problems},
Springer Series in Computational Mathematics 25, Springer, Paris, 1997.

\bibitem{T} I. Traor\'e;
\emph{Transfers de chaleur et de masse dans les parois des b\^atiments
\`a ossature bois},
 Ph.D thesis, Nancy University, 2011.

\end{thebibliography}

\end{document}
