% Reference commands
\newcommand{\SECREF}[1]{Section \ref{#1}}
\newcommand{\secref}[1]{\S~\ref{#1}}
\newcommand{\appref}[1]{Appendix \ref{#1}}
\newcommand{\figref}[1]{Figure \ref{#1}}
\newcommand{\tabref}[1]{Table \ref{#1}}
\newcommand{\lemmaref}[1]{\emph{Lemma \ref{#1}}}
\newcommand{\theoremref}[1]{\emph{Theorem \ref{#1}}}
\newcommand{\remarkref}[1]{\emph{Remark \ref{#1}}}
\newcommand{\corollaryref}[1]{\emph{Corollary \ref{#1}}}

\newcommand{\partref}[1]{Part \ref{#1}}
\newcommand{\chapterref}[1]{Chapter \ref{#1}}
\newcommand{\appendixref}[1]{Appendix \ref{#1}}
\newcommand{\extref}[1]{\S~#1}
\newcommand{\propositionref}[1]{\emph{Proposition \ref{#1}}}

% Brackets for jump operator
\newcommand{\ldbracket}{[\hspace{-1.5pt}[}
\newcommand{\rdbracket}{]\hspace{-1.5pt}]}

% Differential
\newcommand{\ud}{~\mathrm{d}}

% Trace
\newcommand{\tr}{\mathrm{tr}}

% Integral on the reference element
\newcommand{\intVref}[2]{\int_{#1} #2 \ud{\widehat{\bf x}}}
\newcommand{\intB}[2]{\int_{#1} #2 \ud\sigma} % Generic boundary integral
\newcommand{\intK}[1]{\int_{K} #1 \ud{\bf x}}
\newcommand{\intpK}[1]{\int_{\partial K} #1 \ud\sigma}
\newcommand{\intpKin}[1]{\int_{\partial K_{in}} #1 \ud\sigma}
\newcommand{\intpKout}[1]{\int_{\partial K_{out}} #1 \ud\sigma}
\newcommand{\intf}[1]{\int_{f} #1 \ud\sigma}
\newcommand{\intOmega}[1]{\int_{\Omega} #1 \ud{\bf x}}
\newcommand{\intpOmega}[1]{\int_{\partial\Omega} #1 \ud\sigma}
\newcommand{\intpOmegain}[1]{\int_{\partial\Omega_{in}} #1 \ud\sigma}
\newcommand{\intpOmegaout}[1]{\int_{\partial\Omega_{out}} #1 \ud\sigma}
\newcommand{\intGamma}[1]{\int_{\Gamma} #1 \ud\sigma}
\newcommand{\intE}[1]{\int_{\mathcal{E}} #1 \ud\sigma}
\newcommand{\intpKp}[1]{\int_{\partial K_{+}} #1 \ud\sigma}
\newcommand{\intpKm}[1]{\int_{\partial K_{-}} #1 \ud\sigma}
\newcommand{\intOT}[1]{\int_0^T #1 \ud t}
\newcommand{\intOtau}[1]{\int_0^{\tau} #1 \ud t}
\newcommand{\intOmegaOT}[1]{\int_{\Omega\times\left[0, T\right]} #1 \ud{\bf x}\ud t}
\newcommand{\intKOT}[1]{\int_{K \times\left[0, T\right]} #1 \ud{\bf x}\ud t}
\newcommand{\intpKOT}[1]{\int_{\partial K \times\left[0, T\right]} #1 \ud\sigma\ud t}
\newcommand{\intpKpOT}[1]{\int_{\partial K_{+} \times\left[0, T\right]} #1 \ud\sigma\ud t}
\newcommand{\intOneD}[2]{\int_{#1} #2 \ud x}
\newcommand{\intD}[2]{\int_{#1} #2 \ud{\bf x}} 

% Sums
\newcommand{\sumK}{\sum_{K\in\Th}}
\newcommand{\sumf}{\sum_{f\in\mathcal{F}}}

% Product notations
\newcommand{\intprod}[3]{\left( #1, #2 \right)_{#3}}
\newcommand{\crochet}[2]{\left< #1, #2 \right>}
\newcommand{\diad}[2]{#1 \otimes #2}

% Equal by definition
\newcommand{\eqbydef}{\stackrel{\mathrm{def}}{=}}

% Dot product
\newcommand{\dotprod}[2]{ #1 \cdot #2}

% A command to set row height
\newlength{\rowH}
\newcommand{\setH}[1]{
\setlength{\rowH}{#1}
\raisebox{-.5\rowH}{\rule{0pt}{\rowH}}
}



% Non dimensional number
\newcommand{\Reynolds}{\mathrm{Re}}
\newcommand{\Prandtl}{\mathrm{Pr}}
\newcommand{\Rayleigh}{\mathrm{Ra}}
\newcommand{\Nusselt}{\mathrm{Nu}}
\newcommand{\Mach}{\mathrm{M}}

% Trace operators
\newcommand{\jumpo}[1]{\ldbracket #1 \rdbracket}
\newcommand{\jumpn}[1]{\left[ #1 \right]_{\bf n}}
\newcommand{\jumps}[1]{\left[ #1 \right]}

\newcommand{\averg}[1]{\{ #1\}}

% Test functions
\newcommand{\test}{{\phi}}
\newcommand{\testvec}{{\boldsymbol \phi}}
\newcommand{\Test}{{\Phi}}

\newcommand{\Pol}{\mathbb{P}}

% Bold symbols
\newcommand{\avec}{{\bf a}}
%\newcommand{\bvec}{{\bf b}}
\newcommand{\fvec}{{\bf f}}
\newcommand{\nvec}{{\bf n}}
\newcommand{\rvec}{{\bf r}}
\newcommand{\uvec}{{\bf u}}
\newcommand{\Jvec}{{\bf J}}
\newcommand{\svec}{{\bf s}}
\newcommand{\xvec}{{\bf x}}
\newcommand{\vvec}{{\bf v}}
\newcommand{\gvec}{{\bf g}}
\newcommand{\qvec}{{\bf q}}

\newcommand{\Ivec}{{\bf I}}
\newcommand{\Fvec}{{\bf F}}
\newcommand{\Vvec}{{\bf V}}
\newcommand{\Svec}{{\bf S}}
\newcommand{\Gvec}{{\bf g}}
\newcommand{\Omegavec}{{\boldsymbol\Omega}}

\newcommand{\hatFvec}{\widehat{\bf f}}
\newcommand{\hatuvec}{\widehat{\bf u}}

\newcommand{\betavec}{{\boldsymbol{\beta}}}
\newcommand{\tautens}{\boldsymbol{\tau}}
\newcommand{\psitens}{\boldsymbol{\psi}}

\newcommand{\sqrtuc}{a} %{\sqrt{u^2 +c^2}}
\newcommand{\aoseen}{\alpha} %{\sqrt{u^2 +c^2}}

% Commands for implementation

\newcommand{\zvec}{{\bf z}}
\newcommand{\xivec}{{\boldsymbol \xi}}
\newcommand{\wvec}{{\bf w}}
\newcommand{\lvec}{{\bf l}}
\newcommand{\jver}{{\bf j}}
\newcommand{\bvec}{{\bf b}}
\newcommand{\Hvec}{{\bf H}}
\newcommand{\Kvec}{{\bf K}}
\newcommand{\Uvec}{{\bf U}}
\newcommand{\Rvec}{{\bf R}}
\newcommand{\Mmat}{{\bf M}}
\newcommand{\Amat}{{\bf A}}
\newcommand{\Nmat}{{\bf N}}
\newcommand{\Lmat}{{\bf L}}
\newcommand{\Rmat}{{\bf R}}
\newcommand{\Pmat}{{\bf P}}

\newcommand{\hatHvec}{\widehat{\bf H}}
\newcommand{\hatGvec}{\widehat{\bf g}}
%


\newcommand{\newnu}{{\frac{\Prandtl}{\sqrt{\Rayleigh \cdot \Prandtl }}}}
\newcommand{\newal}{{\frac{1}{\sqrt{\Rayleigh \cdot \Prandtl }}}}
\newcommand{\newial}{\sqrt{\Rayleigh \cdot \Prandtl }}


% A command to increase row height
\newlength{\myVSpace}
\setlength{\myVSpace}{1.2cm}
\newcommand\xstrut{\raisebox{-.5\myVSpace}
  {\rule{0pt}{\myVSpace}}
}

% k-epsilon turbulence model
\newcommand{\ke}{$k$-$\epsilon$}

% k-omega turbulence model
\newcommand{\ko}{$k$-$\omega$}
\newcommand{\klo}{$k$-$\lomega$}
\newcommand{\boldko}{$\boldsymbol{k}$-$\boldsymbol{\omega}$}
\newcommand{\lomega}{\widetilde{\omega}}
\newcommand{\romega}{\widetilde{\omega}_{r}}
\newcommand{\romegao}{\widetilde{\omega}_{r0}}
\newcommand{\lk}{\overline{k}}
\newcommand{\mut}{\mu_{t}}
\newcommand{\lmut}{\overline{\mu}_{t}}
\newcommand{\turb}{{\rm Tu}}
\newcommand{\tsca}{\ell}

% ... Sets, Domains, ...
\newcommand{\rnum}{\mathbb{R}}           %  real numbers
\newcommand{\triang}{{\mathcal{T}_h}}    %  domain element set
\newcommand{\interf}{{\mathcal{I}_h}}    %  interface element set
\newcommand{\border}{{\mathcal{B}_h}}    %  boundary element set
\newcommand{\intbor}{{\mathcal{E}_h}}    %  interf.+bound. element set

%%%%%

% Boldface symbols and letters
\newcommand{\JVER}{\boldsymbol{j}}
\newcommand{\BETA}{\boldsymbol{\beta}}
\newcommand{\NABLA}{\boldsymbol{\nabla}}
\newcommand{\NABLAH}{\boldsymbol{\nabla}_h}
\newcommand{\LAMBDA}{\boldsymbol{\lambda}}
\newcommand{\ZERO}{{\bf 0}}
\newcommand{\SIGMA}{\boldsymbol{\sigma}}
\newcommand{\TAU}{\boldsymbol{\tau}}
\newcommand{\EPSILON}{\boldsymbol{\epsilon}}
\newcommand{\ZETA}{\boldsymbol{\zeta}}
\newcommand{\PHI}{\boldsymbol{\phi}}
\newcommand{\XI}{\boldsymbol{\xi}}
\newcommand{\VARPHI}{\boldsymbol{\varphi}}
\newcommand{\jac}{{\bf J}}
\newcommand{\U}{{\bf u}}
\newcommand{\V}{{\bf v}}
\newcommand{\N}{{\bf n}}
\newcommand{\G}{{\bf g}}
\newcommand{\W}{{\bf w}}
%\newcommand{\E}{{\bf e}}
\newcommand{\bS}{{\bf s}}
\newcommand{\X}{{\bf x}}
\newcommand{\rf}[1]{{\bf r}_f(#1)}
\newcommand{\f}{{\bf f}}
\newcommand{\g}{{\bf g}}
\newcommand{\Z}{{\bf z}}
\newcommand{\bF}{{\bf F}}
\newcommand{\bG}{{\bf G}}
\newcommand{\bD}{{\bf D}}
\newcommand{\bC}{{\bf C}}
\newcommand{\bM}{{\bf M}}
\newcommand{\bR}{{\bf R}}
\newcommand{\bU}{{\bf U}}
\newcommand{\bW}{{\bf W}}
\newcommand{\bA}{{\bf A}}
\newcommand{\bH}{{\bf H}}
\newcommand{\bB}{{\bf B}}
\newcommand{\bK}{{\bf K}}
\newcommand{\A}{{\bf a}}
\newcommand{\B}{{\bf b}}

% Divergence operator
\newcommand{\Div}{\mathrm{div}}

% One half and one over Nf
\newcommand{\half}{\frac{1}{2}}
\newcommand{\ooNf}{\frac{1}{N_f}}

% Id est, exempli gratia and et alii
\newcommand{\ie}{\emph{i.e.}}
\newcommand{\eg}{\emph{e.g.}}
\newcommand{\etal}{\emph{et al.}}

% Derivatives
\newcommand{\partialt}[1]{\frac{\partial #1}{\partial t}}
\newcommand{\partialn}[1]{\frac{\partial #1}{\partial\N}}
\newcommand{\partialx}[1]{\frac{\partial #1}{\partial x}}

% Linear operator and bilinear form
\newcommand{\bilin}[3]{#1(#2,#3)}
\newcommand{\BILIN}[3]{#1(#2;#3)}
\newcommand{\lin}[2]{#1(#2)}

% Function
\newcommand{\function}[2]{#1( #2)}

% Norms
\newcommand{\norm}[1]{\| #1\|}
\newcommand{\seminorm}[1]{|#1|}
\newcommand{\tnorm}[1]{\vert\hspace{-1pt}\Vert #1\Vert\hspace{-1pt}\vert}
\newcommand{\sbnorm}[1]{|] #1[|}
\newcommand{\starsnorm}[1]{|#1|_{*}}
\newcommand{\module}[1]{| #1 |}
\newcommand{\Module}[1]{\left| #1\right|}


% Hilbert and Sobolev spaces
\newcommand{\hilbertL}[2]{L^{#1}\left( #2\right)}
\newcommand{\hilbert}[2]{H^{#1}\left( #2\right)}
\newcommand{\sobolev}[3]{W^{#1, #2}\left( #3\right)}
\newcommand{\HilbertL}[2]{{\bf L}^{#1}\left( #2\right)}
\newcommand{\Hilbert}[2]{{\bf H}^{#1}\left( #2\right)}
\newcommand{\Sobolev}[3]{{\bf W}^{#1, #2}\left( #3\right)}

% Darcy projection operator
\newcommand{\Ph}[1]{\mathcal{P}_h #1}
\newcommand{\Qh}[1]{\mathcal{Q}_h #1}

% 3-component vector
\newcommand{\vthree}[3]{
\left[
    \begin{array}{l}
        #1 \\ #2 \\ #3
    \end{array}
\right]}

% Sign operator
\newcommand{\sign}[1]{\mathrm{sign}\left( #1 \right)}

% Big O
\newcommand{\bigO}[1]{\mathcal{O}\left( #1 \right)}

% Max within a set
\newcommand{\maxset}[1]{\max\left\lbrace #1 \right\rbrace}

% Couple and triplet
\newcommand{\couple}[2]{\left( #1, #2\right)}
\newcommand{\triplet}[3]{\left( #1, #2, #3\right)}

% Set
\newcommand{\set}[2]{\left\lbrace #1~:~#2 \right\rbrace}

% Polynomial spaces
\newcommand{\Pk}[1]{\mathbb{P}_k\left( #1\right)}

% Space C^p
\newcommand{\C}[2]{C^{#1}\left( #2\right)}

% Kernel
\newcommand{\kernel}[1]{\mathrm{ker}\left( #1 \right)}

% Restriction
\newcommand{\restrto}[2]{\left. #1 \right|_{#2}}

% In Omega
\newcommand{\inOmega}{\mathrm{in}~\Omega}
\newcommand{\onpOmega}{\mathrm{on}~\partial\Omega}
\newcommand{\inOTOmega}{\mathrm{in}~\left[0, T\right]\times\Omega}

% Th (triangulation of the domain)
\newcommand{\Th}{\mathcal{T}_h}

% Set term
\newcommand{\setterm}[2]{\underbrace{#1}_{\displaystyle{#2}}}

% Superscript for iteration
\newcommand{\iter}[1]{^{\left( #1\right)}}

% Superscript for time step
%\newcommand{\step}[1]{^{ #1}}

% Open and closed intervals
\newcommand{\openint}[2]{\left(#1, #2\right)}
\newcommand{\closedint}[2]{\left[#1, #2\right]}

% Slope limiter
\newcommand{\slim}{\Lambda\Pi_h}

% Style for the summary
%\newcommand{\summary}[1]{\textsf{#1}}

% Mean and variance
\newcommand{\mean}{~\mathrm{mean}}
\newcommand{\var}{~\mathrm{var}}

% Expression template
\newcommand{\ET}{ET}

% Commands for ET chapter
\newcommand{\Int}{\displaystyle{\int}}
\newcommand{\intone}[1]{\int_{\Omega} #1 \ud \omega}
\newcommand{\inton}[2]{\int_{#2} #1 \ud \omega}
\newcommand{\inttwo}[2]{\int_{#2} #1 \ud \gamma}
\newcommand{\intthree}[2]{\int_{0}^{ #1} #2 \ud t}

\newcommand{\wx}{\widehat{x}}
\newcommand{\wy}{\widehat{y}}
\newcommand{\wz}{\widehat{z}}
\newcommand{\wT}{\widehat{T}}
\newcommand{\wphi}{\widehat{\varphi}}
\newcommand{\womega}{\widehat{\omega}}

% A command to print C++ instructions
\newcommand{\cpp}[1]{\lstinline!#1!}

% Shorthand notation for infimum and supremum
\newcommand{\infon}[2]{\underline{#1}_{#2}}
\newcommand{\infonpK}[1]{\infon{#1}{\partial K}}
\newcommand{\infonK}[1]{\infon{#1}{K}}
\newcommand{\supon}[2]{\bar{#1}_{#2}}
\newcommand{\suponpK}[1]{\supon{#1}{\partial K}}
\newcommand{\suponK}[1]{\supon{#1}{K}}

% Error splitting
\newcommand{\epi}[1]{e_{\pi, #1}}
\newcommand{\eh}[1]{e_{h, #1}}
\newcommand{\Epi}[1]{\E_{\pi, #1}}
\newcommand{\Eh}[1]{\E_{h, #1}}

% Polynomials of degree k
\newcommand{\Pn}[1]{$\mathbb{P}^{#1}$}

% Pressure, drag, friction, moment and lift coefficients
% 26 - nov - 2009
\newcommand{\cp}{$\mathrm{C}_{\mathrm{p}}$}
\newcommand{\cd}{$\mathrm{C}_{\mathrm{D}}$}
\newcommand{\cdr}{$\mathrm{C}_{\mathrm{D\,ref}}$~}
\newcommand{\cdp}{$\mathrm{C}_{\mathrm{D}_\mathrm{p}}$}
\newcommand{\cdf}{$\mathrm{C}_{\mathrm{D}_\mathrm{f}}$}
\newcommand{\cf}{$\mathrm{C}_{\mathrm{f}}$}
\newcommand{\cm}{$\mathrm{C}_{\mathrm{m}}$}
\newcommand{\cl}{$\mathrm{C}_{\mathrm{l}}$}

% p- MG operators  
% 22 - nov - 2009
\newcommand{\utrans}{\widetilde{\boldsymbol{\mathcal{I}}}}
\newcommand{\rtrans}{{\bf I}}
