adr.tex 22.3 KB
Newer Older
1
\chapter{ADRSolver}
Daniele de Grazia's avatar
Daniele de Grazia committed
2 3 4 5 6 7

%3.4/UserGuide/Tutorial/ADRSolver
%3.4/UserGuide/Examples/ADRSolver/1DAdvection
%3.4/UserGuide/Examples/ADRSolver/3DAdvectionMassTransport
%3.4/UserGuide/Examples/ADRSolver/Helmholtz2D

8
\section{Synopsis}
Daniele de Grazia's avatar
Daniele de Grazia committed
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

The ADRSolver is designed to solve partial differential equations of the form:
\begin{equation}
\alpha \dfrac{\partial u}{\partial t} + \lambda u + \nu \nabla u + \epsilon \nabla \cdot (D \nabla u) = f
\end{equation}
in either discontinuous or continuous projections of the solution field. 
For a full list of the equations which are supported, and the capabilities of each equation, 
see the table below.

\begin{table}[h!]
\begin{center}
\tiny
\renewcommand\arraystretch{2.2} 
\begin{tabular}{|l|l|l|l|}
\hline
24
\textbf{Equation to solve} & \textbf{EquationType} & \textbf{Dimensions supported}   & \textbf{Projection supported} \\
Daniele de Grazia's avatar
Daniele de Grazia committed
25
\hline 
26 27
$\nabla^2 u = 0$ & 
    \inltt{Laplace} & All &  Continuous/Discontinuous	\\
Daniele de Grazia's avatar
Daniele de Grazia committed
28
\hline
29 30
$\nabla^2 u  =  f$ & 
    \inltt{Poisson} & All &  Continuous/Discontinuous	\\
Daniele de Grazia's avatar
Daniele de Grazia committed
31
\hline
32 33
$\nabla^2 u  + \lambda u =  f$ & 
    \inltt{Helmholtz} & All & Continuous/Discontinuous \\
Daniele de Grazia's avatar
Daniele de Grazia committed
34
\hline
35 36
$\epsilon \nabla^2 u + \mathbf{V}\nabla u = f$ & 
    \inltt{SteadyAdvectionDiffusion} & 2D only & Continuous/Discontinuous \\
Daniele de Grazia's avatar
Daniele de Grazia committed
37
\hline
38 39
$\epsilon \nabla^2 u +  \lambda u = f$ & 
    \inltt{SteadyDiffusionReaction} & 2D only &  Continuous/Discontinuous \\
Daniele de Grazia's avatar
Daniele de Grazia committed
40
\hline
41 42 43
$\epsilon \nabla^2 u  \mathbf{V}\nabla u + \lambda u = f$ & 
    \inltt{SteadyAdvectionDiffusionReaction} & 2D only & 
    Continuous/Discontinuous \\
Daniele de Grazia's avatar
Daniele de Grazia committed
44
\hline
45 46
$ \dfrac{\partial u}{\partial t} + \mathbf{V}\nabla u = f$ &
    \inltt{UnsteadyAdvection} & All & Continuous/Discontinuous \\
Daniele de Grazia's avatar
Daniele de Grazia committed
47
\hline
48 49
$\dfrac{\partial u}{\partial t}  = \epsilon \nabla^2 u$ & 
    \inltt{UnsteadyDiffusion} & All & Continuous/Discontinuous \\
Daniele de Grazia's avatar
Daniele de Grazia committed
50
\hline
51 52
$\dfrac{\partial u}{\partial t}  + \mathbf{V}\nabla u = \epsilon \nabla^2 u$ &
    \inltt{UnsteadyAdvectionDiffusion} & All & Continuous/Discontinuous \\
Daniele de Grazia's avatar
Daniele de Grazia committed
53
\hline
54 55
$\dfrac{\partial u}{\partial t}  + u\nabla u =  0$ &
    \inltt{UnsteadyInviscidBurger} & 1D only & Continuous/Discontinuous \\
Daniele de Grazia's avatar
Daniele de Grazia committed
56 57 58 59 60 61 62
\hline
\end{tabular}
\end{center}
\caption{Equations supported by the ADRSolver with their capabilities.}
\label{t:ADR1}
\end{table}

63
\section{Usage}
Daniele de Grazia's avatar
Daniele de Grazia committed
64

65
\begin{lstlisting}[style=BashInputStyle]
Daniele de Grazia's avatar
Daniele de Grazia committed
66
ADRSolver session.xml
67
\end{lstlisting}
Daniele de Grazia's avatar
Daniele de Grazia committed
68

69
\section{Session file configuration}
Daniele de Grazia's avatar
Daniele de Grazia committed
70 71 72 73 74

The type of equation which is to be solved is specified through the EquationType 
SOLVERINFO option in the session file. This can be set as in table \ref{t:ADR1}.
At present, the Steady non-symmetric solvers cannot be used in parallel. \\

75
\subsection{Solver Info}
Daniele de Grazia's avatar
Daniele de Grazia committed
76 77 78 79 80 81 82 83 84

The solver info are listed below:
\begin{itemize}
\item \textbf{Eqtype}: This sets the type of equation to solve, according to the table above.
\item \textbf{TimeIntegrationMethod}: The following types of time integration methods have been tested with each solver:
\begin{table}[h!]
\begin{center}
\footnotesize
\renewcommand\arraystretch{1.2} 
85
\begin{tabular}{|l|c|c|c|c|}
Daniele de Grazia's avatar
Daniele de Grazia committed
86
\hline
87 88
\textbf{EqType} & \textbf{Explicit} & \textbf{Diagonally Implicit} &
    \textbf{ IMEX} & \textbf{Implicit}   \\
Daniele de Grazia's avatar
Daniele de Grazia committed
89
\hline 
90
\inltt{UnstedayAdvection} &  \checkmark 	 &	 & 	&\\
Daniele de Grazia's avatar
Daniele de Grazia committed
91
\hline
92
\inltt{UnstedayDifusion} &  \checkmark 	 & \checkmark 	 & 	&\\
Daniele de Grazia's avatar
Daniele de Grazia committed
93
\hline
94
\inltt{UnstedayAdvectionDiffusion} &  	 &   	& \checkmark	&\\
Daniele de Grazia's avatar
Daniele de Grazia committed
95
\hline
96
\inltt{UnstedayInviscidBurger} &  \checkmark 	 &	 & 	&\\
Daniele de Grazia's avatar
Daniele de Grazia committed
97 98 99 100 101 102 103
\hline

\end{tabular}
\end{center}
\label{t:ADR2}
\end{table}
\vspace{-1 cm}
Daniele de Grazia's avatar
Daniele de Grazia committed
104
\item \textbf{Projection}: The Galerkin projection used may be either:
Daniele de Grazia's avatar
Daniele de Grazia committed
105
\begin{itemize}
106 107
	\item \inltt{Continuous} for a C0-continuous Galerkin (CG) projection.
	\item \inltt{Discontinuous} for a discontinous Galerkin (DG) projection.
Daniele de Grazia's avatar
Daniele de Grazia committed
108
\end{itemize}
Daniele de Grazia's avatar
Daniele de Grazia committed
109
\item \textbf{DiffusionAdvancement}: This specifies how to treat the diffusion term. This will be restricted by the choice of time integration scheme:
Daniele de Grazia's avatar
Daniele de Grazia committed
110
\begin{itemize}
111 112 113 114
	\item \inltt{Explicit} Requires the use of an explicit time integration
	scheme.
	\item \inltt{Implcit} Requires the use of a diagonally implicit, IMEX or
	Implicit scheme.
Daniele de Grazia's avatar
Daniele de Grazia committed
115
\end{itemize}
Daniele de Grazia's avatar
Daniele de Grazia committed
116
\item \textbf{AdvectionAdvancement}: This specifies how to treat the advection term. This will be restricted by the choice of time integration scheme:
Daniele de Grazia's avatar
Daniele de Grazia committed
117
\begin{itemize}
118 119 120
	\item \inltt{Explicit} Requires the use of an explicit or IMEX time integration
	scheme.
	\item \inltt{Implicit} Not supported at present.
Daniele de Grazia's avatar
Daniele de Grazia committed
121
\end{itemize}
Daniele de Grazia's avatar
Daniele de Grazia committed
122
\item \textbf{AdvectionType}: Specifies the type of advection:
Daniele de Grazia's avatar
Daniele de Grazia committed
123
\begin{itemize}
124 125
	\item \inltt{NonConservative} (for CG only).
	\item \inltt{WeakDG} (for DG only).
Daniele de Grazia's avatar
Daniele de Grazia committed
126 127 128
\end{itemize}
\item \textbf{DiffusionType}:
\begin{itemize}
129
	\item \inltt{LDG}.
Daniele de Grazia's avatar
Daniele de Grazia committed
130 131 132
\end{itemize}
\item \textbf{UpwindType}:
\begin{itemize}
133
	\item \inltt{Upwind}.
Daniele de Grazia's avatar
Daniele de Grazia committed
134 135 136
\end{itemize}
\end{itemize}

137
\subsection{Parameters}
Daniele de Grazia's avatar
Daniele de Grazia committed
138

139 140
The following parameters can be specified in the \inltt{PARAMETERS} section of
the session file:
Daniele de Grazia's avatar
Daniele de Grazia committed
141
\begin{itemize}
142
\item \inltt{epsilon}: sets the diffusion coefficient $\epsilon$.\\ 
Daniele de Grazia's avatar
Daniele de Grazia committed
143 144
\textit{Can be used} in: SteadyDiffusionReaction, SteadyAdvectionDiffusionReaction, UnsteadyDiffusion, UnsteadyAdvectionDiffusion. \\
\textit{Default value}: 0.
145 146
\item  \inltt{d00}, \inltt{d11}, \inltt{d22}: sets the diagonal entries of the
diffusion tensor $D$. \\
Daniele de Grazia's avatar
Daniele de Grazia committed
147 148
\textit{Can be used in}: UnsteadyDiffusion \\
\textit{Default value}: All set to 1 (i.e. identity matrix). 
149
\item  \inltt{lambda}: sets the reaction coefficient  $\lambda$. \\
Daniele de Grazia's avatar
Daniele de Grazia committed
150 151 152 153
\textit{Can be used in}: SteadyDiffusionReaction, Helmholtz, SteadyAdvectionDiffusionReaction\\
\textit{Default value}: 0.
\end{itemize}

154
\subsection{Functions}
Daniele de Grazia's avatar
Daniele de Grazia committed
155

156 157
The following functions can be specified inside the \inltt{CONDITIONS} section
of the session file:
Daniele de Grazia's avatar
Daniele de Grazia committed
158 159

\begin{itemize}
160 161 162
\item \inltt{AdvectionVelocity}: specifies the advection velocity $\mathbf{V}$.
\item \inltt{InitialConditions}: specifies the initial condition for unsteady problems.
\item \inltt{Forcing}: specifies the forcing function f.
Daniele de Grazia's avatar
Daniele de Grazia committed
163 164
\end{itemize}

165 166
\section{Examples}

Daniele de Grazia's avatar
Daniele de Grazia committed
167
\subsection{1D Advection equation}
Daniele de Grazia's avatar
Daniele de Grazia committed
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298

In this example, it will be demonstrated how the Advection equation can be solved on a one-dimensional domain.
This problem is a particular case of the Advection-Diffusion-Reaction Solver. \\

\textbf{Advection equation}

We consider the hyperbolic partial differential equation:
\begin{equation}
\dfrac{\partial u}{\partial t} + \dfrac{\partial f}{\partial x} = 0,
\end{equation}
where $f =  a u$ i s the advection flux.

\textbf{Input file}

Advection1D.xml

\textbf{\footnotesize{Geometry definition}}

\begin{lstlisting}[style=XMLStyle]
<GEOMETRY DIM="1" SPACE="1">
        <VERTEX>
            <V ID="0"> -1.0  0.0  0.0</V>
            <V ID="1"> -0.8  0.0  0.0</V>
            <V ID="2"> -0.6  0.0  0.0</V>
            <V ID="3"> -0.4  0.0  0.0</V>
            <V ID="4"> -0.2  0.0  0.0</V>
            <V ID="5">  0.0  0.0  0.0</V>
            <V ID="6">  0.2  0.0  0.0</V>
            <V ID="7">  0.4  0.0  0.0</V>
            <V ID="8">  0.6  0.0  0.0</V>
            <V ID="9">  0.8  0.0  0.0</V>
            <V ID="10"> 1.0  0.0  0.0</V>
        </VERTEX> 
        
        <ELEMENT>
            <S ID="0">    0     1 </S>
            <S ID="1">    1     2 </S>
            <S ID="2">    2     3 </S>
            <S ID="3">    3     4 </S>
            <S ID="4">    4     5 </S>
            <S ID="5">    5     6 </S>
            <S ID="6">    6     7 </S>
            <S ID="7">    7     8 </S>
            <S ID="8">    8     9 </S>
            <S ID="9">    9    10 </S>
        </ELEMENT>
        
        <COMPOSITE>
            <C ID="0"> S[0-9] </C>
            <C ID="1"> V[0]   </C>
            <C ID="2"> V[10]  </C>
        </COMPOSITE>
        
        <DOMAIN> C[0] </DOMAIN>
</GEOMETRY>
\end{lstlisting}

\textbf{\footnotesize{Expansion definition}}

\begin{lstlisting}[style=XMLStyle]
<EXPANSIONS>
        <E COMPOSITE="C[0]" FIELDS="u" TYPE="GLL_LAGRANGE_SEM" NUMMODES="4"/>
</EXPANSIONS>
\end{lstlisting}

\textbf{\footnotesize{Conditions definition}}

\begin{lstlisting}[style=XMLStyle]
<CONDITIONS>
    
        <PARAMETERS>
            <P> FinTime         = 20                     </P>
            <P> TimeStep        = 0.01                 </P>
            <P> NumSteps        = FinTime/TimeStep      </P>
            <P> IO_CheckSteps   = 100000                </P>
            <P> IO_InfoSteps    = 100000                </P>
            <P> advx            = 1                     </P>
            <P> advy            = 0                     </P>
        </PARAMETERS>
        
        <SOLVERINFO>
            <I PROPERTY="EQTYPE"                VALUE="UnsteadyAdvection"   />
            <I PROPERTY="Projection"            VALUE="DisContinuous"       />
            <I PROPERTY="AdvectionType"         VALUE="FRDG"                />
            <I PROPERTY="UpwindType"            VALUE="Upwind"              />
            <I PROPERTY="TimeIntegrationMethod" VALUE="ClassicalRungeKutta4"/>
        </SOLVERINFO>

        <VARIABLES>
            <V ID="0"> u </V>
        </VARIABLES>

        <BOUNDARYREGIONS>
            <B ID="0"> C[1] </B>
            <B ID="1"> C[2] </B>
        </BOUNDARYREGIONS>

        <BOUNDARYCONDITIONS>
            <REGION REF="0">
                <P VAR="u" VALUE="[1]" />
            </REGION>
            <REGION REF="1">
                <P VAR="u" VALUE="[0]" />
            </REGION>
        </BOUNDARYCONDITIONS>

        <FUNCTION NAME="AdvectionVelocity">
            <E VAR="Vx" VALUE="advx" />
        </FUNCTION>
        
        <FUNCTION NAME="InitialConditions">
            <E VAR="u" VALUE="exp(-20.0*x*x)" />
        </FUNCTION>

        <FUNCTION NAME="ExactSolution">
            <E VAR="u" VALUE="exp(-20.0*x*x)" />
        </FUNCTION>

</CONDITIONS>
\end{lstlisting}

\textbf{Running the code}

ADRSolver Advection1D.xml

\textbf{Post-processing}

FldToTecplot Advection1D.xml Advection1D.fld \\

FldToVtk Advection1D.xml Advection1D.fld

Daniele de Grazia's avatar
Daniele de Grazia committed
299
\subsection{2D Helmholtz Problem}
Daniele de Grazia's avatar
Daniele de Grazia committed
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390

In this example, it will be demonstrated how the Helmholtz equation can be solved on a two-dimensional domain. 
This problem is a particular case of the Advection-Diffusion-Reaction Solver.

\textbf{Helmholtz equation}

We consider the elliptic partial differential equation:

\begin{equation}
\nabla^2 u  + \lambda u =  f
\end{equation}

where $\nabla^2$ is the Laplacian and $\lambda$ is a real positive constant.

\textbf{Input file} 

For this tutorial, the input file (in the \nekpp input format) used can be found
 in  \nekpp/regressionTests/Solvers/ADRSolver/InputFiles/Test\_Helmholtz2D\_modal.xml.

\textbf{\footnotesize{Geometry definition}}
In the GEOMETRY section, the dimensions of the problem are defined. 
Then, the coordinates (XSCALE, YSCALE, ZSCALE) of each vertices are specified. As this input file defines a two-dimensional problem: ZSCALE = 0.

\begin{lstlisting}[style=XMLStyle]
<GEOMETRY DIM="2" SPACE="2">

    <VERTEX>
        <V ID="0"> -1.000000000000000 3.500000000000000 0.0 </V>
        .
        .
        <V ID="48"> 3.179196984040000 2.779077508740000 0.0 </V>
    </VERTEX>
\end{lstlisting}

Edges can now be defined by two vertices.

\begin{lstlisting}[style=XMLStyle]
 <EDGE>
        <E ID="0"> 1 21 </E>
        .
        .
        <E ID="95"> 10 19 </E>
    </EDGE>
\end{lstlisting}

In the ELEMENT section, the tag T and Q define respectively triangular and quadrilateral element.
 Triangular elements are defined by a sequence of three edges and quadrilateral elements by a sequence of four edges.

\begin{lstlisting}[style=XMLStyle]
<ELEMENT>
        <T ID="0"> 6 7 16 </T>
        .
        .
        <T ID="21"> 29 37 34 </T>
        <Q ID="22"> 35 41 46 40 </Q>
        .
        .
        <Q ID="47"> 91 92 95 93 </Q>
    </ELEMENT>
\end{lstlisting}

Finally, collections of elements are listed in the COMPOSITE section and the DOMAIN section specifies that 
the mesh is composed by all the triangular and quadrilateral elements. The other composites will be used to enforce boundary conditions.

\begin{lstlisting}[style=XMLStyle]
 <COMPOSITE>
        <C ID="0"> Q[22-47] </C>
        <C ID="1"> T[0-21] </C>
        <C ID="2"> E[0-1] </C>
        .
        .
        <C ID="10"> E[84,75,69,62,51,40,30,20,6] </C>
    </COMPOSITE>

    <DOMAIN> C[0-1] </DOMAIN>
</GEOMETRY>
\end{lstlisting}

\textbf{\footnotesize{Expansion definition}}

This section defines the polynomial expansions used on each composites.

\begin{lstlisting}[style=XMLStyle]
<EXPANSIONS>
    <E COMPOSITE="C[0]" NUMMODES="7" FIELDS="u" TYPE="MODIFIED" />
    <E COMPOSITE="C[1]" NUMMODES="7" FIELDS="u" TYPE="MODIFIED" />
</EXPANSIONS>
\end{lstlisting}

\textbf{\footnotesize{Conditions definition}}

Daniele de Grazia's avatar
Daniele de Grazia committed
391
This sections defines the problem solved. In this example $\lambda = 1$ and the Continuous Galerkin Method
Daniele de Grazia's avatar
Daniele de Grazia committed
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475
is used as projection scheme to solve the Helmholtz equation.

\begin{lstlisting}[style=XMLStyle]
<CONDITIONS>

    <PARAMETERS>
        <P> Lambda = 1 </P>
    </PARAMETERS>

    <SOLVERINFO>
        <I PROPERTY="EQTYPE" VALUE="Helmholtz" />
        <I PROPERTY="Projection" VALUE="Continuous" />
    </SOLVERINFO>
\end{lstlisting}

Then, Dirichlet, Neumann and Robin boundary conditions are defined thanks to 
the boundary references given by the BOUNDARYREGIONS section.

\begin{lstlisting}[style=XMLStyle]
<BOUNDARYREGIONS>
        <B ID="0"> C[2] </B>
        .
        .
        <B ID="8"> C[10] </B>
    </BOUNDARYREGIONS>

    <BOUNDARYCONDITIONS>
        <REGION REF="0">
            <D VAR="u" VALUE="sin(PI*x)*sin(PI*y)" />
        </REGION>
        <REGION REF="1">
            <R VAR="u" VALUE="sin(PI*x)*sin(PI*y)-PI*sin(PI*x)*cos(PI*y)" PRIMCOEFF="1" />
        </REGION>
        <REGION REF="2">
            <N VAR="u" VALUE="(5/sqrt(61))*PI*cos(PI*x)*sin(PI*y)-(6/sqrt(61))*PI*sin(PI*x)*cos(PI*y)" />
        </REGION>
        .
        .
\end{lstlisting}

We know that for $f = -(\lambda + 2 \pi^2)sin(\pi x)cos(\pi y)$, the exact solution of the two-dimensional 
Helmholtz equation is $u = sin(\pi x)cos(\pi y)$. These functions are defined at the end of the CONDITIONS section.

\begin{lstlisting}[style=XMLStyle]
<FUNCTION NAME="Forcing">
        <E VAR="u" VALUE="-(Lambda + 2*PI*PI)*sin(PI*x)*sin(PI*y)" />
    </FUNCTION>

    <FUNCTION NAME="ExactSolution">
        <E VAR="u" VALUE="sin(PI*x)*sin(PI*y)" />
    </FUNCTION>

</CONDITIONS>
\end{lstlisting}

The exact solution will be used to evaluate the $L_2$ and $L_{inf}$ errors.

\textbf{Running the code}

The ADRSolver is used to solve the two-dimensional Helmholtz problem. To run the code, the user must first go to the directory: \\

\nekpp/builds/solvers/ADRSolver \\ 

and then copy the input file detailed above in this directory via: \\

cp ../../../regressionTests/Solvers/ADRSolver/InputFiles/Test\_Helmholtz2D\_modal.xml \\

Finally, the following command executes the solver: \\

./ADRSolver Test\_Helmholtz2D\_modal.xml \\

This execution should print out a summary of input file, the $L_2$ and $L_{inf}$ errors and the time spent on the calculation.\\

\textbf{Post-processing}

Simulation results are written in the file Test\_Helmholtz2D\_modal.fld. \nekpp provides

 post-processing tools to be able to display the results. For example, the command:\\
 
\footnotesize../../../utilities/PostProcessing/FldToGmsh Test\_Helmholtz2D\_modal.xml Test\_Helmholtz2D\_modal.fld \\
 
\normalsize 
provides the file Test\_Helmholtz2D\_modal\_u.pos in the Gmsh format which gives the following image.
 
Daniele de Grazia's avatar
Daniele de Grazia committed
476
\begin{figure}[h!]
Daniele de Grazia's avatar
Daniele de Grazia committed
477 478 479 480 481 482 483 484
\begin{center}
\includegraphics[width=6cm]{Figures/Helmholtz2D}
\caption{Solution of the 2D Helmholtz Problem.}
\end{center}
\end{figure}

By writing FldToTecplot or FldToVtk instead of FldToGmsh in the previous command, Tecplot or Paraview can be used to visualize the results.

Daniele de Grazia's avatar
Daniele de Grazia committed
485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655
\subsection{Advection dominated mass transport in a pipe}

The following example demonstrates the application of the ADRsolver for modelling advection dominated mass transport in a straight pipe. 
Such a transport regime is encountered frequently when modelling mass transport in arteries. This is because the diffusion 
coefficient of small blood borne molecules, for example oxygen or adenosine triphosphate, is very small $O(10^{-10})$.

\textbf{Background}

The governing equation for modelling mass transport is the unsteady advection diffusion equation:
\begin{equation}
\dfrac{\partial u}{\partial t}  + v\nabla u +  \epsilon \nabla^2 u = 0
\end{equation}

For small diffusion coefficient, $\epsilon$, the transport is dominated by advection and this leads to a very fine boundary
 layer adjacent to the surface which must be captured in order to get a realistic representation of the wall mass transfer processes.
 This creates problems not only from a meshing perspective, but also numerically where classical oscillations 
 are observed in the solution due to under-resolution of the boundary layer.\\

The Graetz-Nusselt solution is an analytical solution of a developing mass (or heat) transfer boundary layer in a pipe. 
Previously this solution has been used as a benchmark for the accuracy of numerical methods to capture the fine 
boundary layer which develops for high Peclet number transport (the ratio of advection to diffusion). 
The solution is derived based on the assumption that the velocity field within the mass transfer boundary layer 
is linear i.e. the Schmidt number (the relative thickness of the momentum to mass transfer boundary layer) is sufficiently large. 
The analytical solution for the non-dimensional mass transfer at the wall is given by:
\begin{equation}
S h(z) = \dfrac{2^{4/3}(Pe R/z)^{1/3}}{g^{1/3}\Gamma(4/3)} , 
\end{equation}
where $z$ is the streamwise coordinate, $R$ the pipe radius, $\Gamma(4/3)$ an incomplete 
Gamma function and $Pe$ the Peclet number given by:
\begin{equation}
Pe = \dfrac{2 U R}{\epsilon}
\end{equation}

In the following we will numerically solver mass transport in a pipe and compare the calculated mass transfer 
at the wall with the Graetz-Nusselt solution. The Peclet number of the transport regime under consideration is 
750000, which is physiologically relevant.

\textbf{Geometry}

The geometry under consideration is a pipe of radius, $R = 0.5$ and length $l = 0.5$

\begin{figure}[h!]
\begin{center}
\includegraphics[width=6cm]{Figures/pipe}
\caption{Pipe.}
\end{center}
\end{figure}

Since the mass transport boundary layer will be confined to a very small layer adjacent to the wall we do not need to mesh
 the interior region, hence the mesh consists of a layer of ten prismatic elements over a thickness of 0.036R. 
The elements progressively grow over the thickness of domain.

\textbf{Input parameters}

\textbf{\footnotesize{Expansion}}

In this example we utilise heterogeneous polynomial order, in which the polynomial order normal to the wall is
 higher so that we avoid unphysical oscillations, and hence the incorrect solution, in the mass transport boundary layer.
  To do this we specify explicitly the expansion type, points type and distribution in each direction as follows:

\begin{lstlisting}[style=XMLStyle]
<EXPANSIONS>
  <E COMPOSITE="C[0]"
     NUMMODES="3,5,3"
     BASISTYPE="Modified_A,Modified_A,Modified_B"
     NUMPOINTS="4,6,3"
     POINTSTYPE="GaussLobattoLegendre,GaussLobattoLegendre,GaussRadauMAlpha1Beta0"
     FIELDS="u" />
</EXPANSIONS>
\end{lstlisting}

The above represents a quadratic polynomial order in the azimuthal and streamwise direction and 
4th order polynomial normal to the wall for a prismatic element.

\textbf{\footnotesize{Solver information}}

\begin{lstlisting}[style=XMLStyle]
<SOLVERINFO>
   <I PROPERTY="EQTYPE"                VALUE="UnsteadyAdvectionDiffusion" />
   <I PROPERTY="Projection"            VALUE="Continuous" />
   <I PROPERTY="DiffusionAdvancement"  VALUE="Implicit" />
   <I PROPERTY="AdvectionAdvancement"  VALUE="Explicit" />
   <I PROPERTY="TimeIntegrationMethod" VALUE="IMEXOrder1" />
   <I PROPERTY="GlobalSysSoln"         VALUE="IterativeStaticCond" />
</SOLVERINFO>
\end{lstlisting}

\textbf{\footnotesize{Parameters}}

\begin{lstlisting}[style=XMLStyle]
<PARAMETERS>
  <P> TimeStep = 0.0005              </P>
  <P> FinalTime = 30                 </P>
  <P> NumSteps = FinalTime/TimeStep  </P>
  <P> IO_CheckSteps = 1000           </P>
  <P> IO_InfoSteps = 200             </P>
  <P> epsilon = 1.33333e-6           </P>
</PARAMETERS>
\end{lstlisting}

The value of $\epsilon$ is $\epsilon = 1/Pe$.

\textbf{\footnotesize{Boundary conditions}}

The analytical solution represents a developing mass transfer boundary layer in a pipe. In order to 
reproduce this numerically we assume that the inlet concentration is a uniform value and the outer 
wall concentration is zero; this will lead to the development of the mass transport boundary layer along the length 
of the pipe. Since we do not model explicitly the mass transfer in the interior region of the pipe we assume that 
the inner wall surface concentration is the same as the inlet concentration; this assumption is valid based on the large 
Peclet number meaning the concentration boundary layer is confined to the region in the immediate vicinity of the wall.
 The boundary conditions are specified as follows in the input file:

\begin{lstlisting}[style=XMLStyle]
<BOUNDARYREGIONS>
   <B ID="0"> C[3] </B>  <!-- inlet -->
   <B ID="1"> C[4] </B>  <!-- outlet -->
   <B ID="2"> C[2] </B>  <!-- outer surface -->
   <B ID="3"> C[5] </B>  <!-- inner surface -->
</BOUNDARYREGIONS>

<BOUNDARYCONDITIONS>
  <REGION REF="0">
    <D VAR="u" VALUE="1" />
  </REGION>
  <REGION REF="1">
    <N VAR="u" VALUE="0" />
  </REGION>
  <REGION REF="2">
    <D VAR="u" VALUE="0" />
  </REGION>
  <REGION REF="3">
    <D VAR="u" VALUE="1" />
  </REGION>
</BOUNDARYCONDITIONS>
\end{lstlisting}


\textbf{\footnotesize{Functions}}

The velocity field within the domain is fully developed pipe flow (Poiseuille flow), hence we 
can define this through an analytical function as follows:

\begin{lstlisting}[style=XMLStyle]
<FUNCTION NAME="AdvectionVelocity">
  <E VAR="Vx" VALUE="0" />
  <E VAR="Vy" VALUE="0" />
  <E VAR="Vz" VALUE="2.0*(1-(x*x+y*y)/0.25)" />
</FUNCTION>
\end{lstlisting}

We assume that the initial domain concentration is uniform everywhere and the same as the inlet. This is defined by,

\begin{lstlisting}[style=XMLStyle]
<FUNCTION NAME="InitialConditions">
  <E VAR="u" VALUE="1" />
</FUNCTION>
\end{lstlisting}

\textbf{Results}

To compare with the analytical expression we numerically calculate the concentration gradient at the surface of the pipe. 
This is then plotted against the analytical solution by extracting the solution along a line in the streamwise direction.

\begin{figure}[h!]
\begin{center}
\includegraphics[width=7cm]{Figures/graetz-nusselt}
\caption{Concentration gradient at the surface of the pipe.}
\end{center}
\end{figure}


Daniele de Grazia's avatar
Daniele de Grazia committed
656