
FinTime = 20

TimeStep = 0.01

NumSteps = FinTime/TimeStep

IO_CheckSteps = 100000

IO_InfoSteps = 100000

u C[1] C[2]

\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 committed Aug 11, 2014 299 \subsection{2D Helmholtz Problem}  Daniele de Grazia committed Aug 11, 2014 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: \nabla^2 u + \lambda u = f 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] -1.000000000000000 3.500000000000000 0.0 . . 3.179196984040000 2.779077508740000 0.0 \end{lstlisting} Edges can now be defined by two vertices. \begin{lstlisting}[style=XMLStyle] 1 21 . . 10 19 \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] 6 7 16 . . 29 37 34 35 41 46 40 . . 91 92 95 93 \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] Q[22-47] T[0-21] E[0-1] . . E[84,75,69,62,51,40,30,20,6] C[0-1] \end{lstlisting} \textbf{\footnotesize{Expansion definition}} This section defines the polynomial expansions used on each composites. \begin{lstlisting}[style=XMLStyle] \end{lstlisting} \textbf{\footnotesize{Conditions definition}}  Daniele de Grazia committed Aug 11, 2014 391 This sections defines the problem solved. In this example $\lambda = 1$ and the Continuous Galerkin Method  Daniele de Grazia committed Aug 11, 2014 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]

Lambda = 1

\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] C[2] . . C[10] . . \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]
\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 committed Aug 11, 2014 476 \begin{figure}[h!]  Daniele de Grazia committed Aug 11, 2014 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 committed Aug 11, 2014 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: \dfrac{\partial u}{\partial t} + v\nabla u + \epsilon \nabla^2 u = 0 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: S h(z) = \dfrac{2^{4/3}(Pe R/z)^{1/3}}{g^{1/3}\Gamma(4/3)} , where $z$ is the streamwise coordinate, $R$ the pipe radius, $\Gamma(4/3)$ an incomplete Gamma function and $Pe$ the Peclet number given by: Pe = \dfrac{2 U R}{\epsilon} 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] \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] \end{lstlisting} \textbf{\footnotesize{Parameters}} \begin{lstlisting}[style=XMLStyle]

TimeStep = 0.0005

FinalTime = 30

NumSteps = FinalTime/TimeStep

IO_CheckSteps = 1000

IO_InfoSteps = 200

epsilon = 1.33333e-6

\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] C[3] C[4] C[2] C[5] \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] \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] \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 committed Aug 11, 2014 656