handling di erent h and p re nements in the framework of

85
WN-CFD-13-46 Handling different h and p refinements in the framework of Spectral Difference Method I. Marter Final report September 1, 2013 © Copyrighted by the author(s) Centre Europ´ een de Recherche et de Formation Avanc´ ee en Calcul Scientifique 42 avenue Coriolis – 31057 Toulouse Cedex 1– France el : +33 5 61 19 31 31 – Fax : +33 5 61 19 30 00 http://www.cerfacs.fr – e-mail: [email protected]

Upload: others

Post on 06-Feb-2022

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Handling di erent h and p re nements in the framework of

WN-CFD-13-46

Handling different h and prefinements in the

framework of SpectralDifference Method

I. Marter

Final reportSeptember 1, 2013

© Copyrighted by the author(s)

Centre Europeen de Recherche et de Formation Avancee en Calcul Scientifique42 avenue Coriolis – 31057 Toulouse Cedex 1 – FranceTel : +33 5 61 19 31 31 – Fax : +33 5 61 19 30 00http://www.cerfacs.fr – e-mail: [email protected]

Page 2: Handling di erent h and p re nements in the framework of

Abstract

This document addresses some technics to achieve order end mesh refinements when a spectralmethod is considered. Spectral methods are based on a polynomial description of the quantitiesinside each mesh element and suppose that the solution is discontinuous at mesh interfaces.Here, attention is focused on the use of the Spectral Difference approach, a new techniquebased on finite differences inside the element and on a Riemann solver at the interface. Inorder to increase accuracy and to limit the CPU usage, spatial and polynomial refinementscan be used. This formalism adds some constraints on the mesh interface treatments: it is aMortar technique. This document shows theoretical results, implementation and validation ofthe Mortar approach dedicated to SD method. Both polynomial (p) and spatial (h) refinementshave been studied.

Resume

Il existe plusieurs moyens d’ameliorer la precision de solutions calculees a l’aide de methodesspectrales, ce document se concentre sur les raffinements d’ordre et d’espace. Les methodesspectrales sont basees sur la definition de polynomes pour decrire les quantites physiques al’interieur de la cellule d’un maillage et la solution est supposee discontinue aux interfacesde chaque cellule. Dans ce document, une nouvelle technique est utilisee, la methode desdifferences spectrales, basee sur les differences finies a l’interieur d’une cellule et sur un solveurde Riemann aux interfaces de celle-ci. Les raffinements d’ordre et d’espace peuvent etre utilisesdans le but d’augmenter la precision de la solution et de diminuer les temps de calculs. Leurutilisation ajoute une contrainte au niveau du traitement des interfaces: une technique deMortier est necessaire. Ce document presente des resultats theoriques sur l’approche Mortiercombinee a la methode des differences spectrales, ainsi que son implementation et sa validation.Le raffinement d’ordre (p) et le raffinement d’espace (h) sont tous les deux etudies.

Page 2 of 85

Page 3: Handling di erent h and p re nements in the framework of

Contents

1 Introduction 71.1 General considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71.2 CERFACS and work team . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81.3 The Spectral Difference method . . . . . . . . . . . . . . . . . . . . . . . . . . . 91.4 Order and mesh refinements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91.5 Description of the work and outline of the document . . . . . . . . . . . . . . . 9

2 Euler equations and Spectral Difference method 112.1 Governing equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.2 Description of the Spectral Difference method in 1D . . . . . . . . . . . . . . . 12

2.2.1 Notations and equations . . . . . . . . . . . . . . . . . . . . . . . . . . . 122.2.2 General principle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132.2.3 Position of solution points and location of internal flux points . . . . . . 142.2.4 Polynomials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152.2.5 Global algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

2.3 SD method in higher dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . 152.3.1 Isoparametric transformation . . . . . . . . . . . . . . . . . . . . . . . . 162.3.2 Effect on Euler equations . . . . . . . . . . . . . . . . . . . . . . . . . . 172.3.3 Point distribution and basis polynomials . . . . . . . . . . . . . . . . . . 172.3.4 Effect on interpolation polynomials . . . . . . . . . . . . . . . . . . . . . 172.3.5 Interpolation and flux derivative . . . . . . . . . . . . . . . . . . . . . . 182.3.6 Interface treatment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192.3.7 Approximated Riemann solver . . . . . . . . . . . . . . . . . . . . . . . 202.3.8 Time discretization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202.3.9 Final algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

2.4 JAGUAR CFD Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

3 p− refinement method 233.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233.2 p−refinement description in 2D . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

3.2.1 Notations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253.2.2 Supplementary requirements . . . . . . . . . . . . . . . . . . . . . . . . 26

3.3 Step 1: transferring the solution onto the Mortar element . . . . . . . . . . . . 263.3.1 Projection method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263.3.2 Interpolation method . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273.3.3 Final choice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

Page 3 of 85

Page 4: Handling di erent h and p re nements in the framework of

3.4 Step 3: transferring the flux onto the interfaces . . . . . . . . . . . . . . . . . . 28

3.4.1 Projection method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

3.4.2 Interpolation method . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

3.4.3 Final choice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

3.5 Proof of conservation and outflow condition in 2D . . . . . . . . . . . . . . . . 29

3.5.1 Flux conservation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

3.5.2 Outflow condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

3.6 Quadrature formula . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

3.7 Extension of p−refinement to the three-dimensional case . . . . . . . . . . . . . 31

3.7.1 Step 1: Transferring the solution onto the Mortar element . . . . . . . . 31

3.7.2 Step 3: Transferring the flux from the Mortar onto the faces by projection 32

3.8 Proof of conservation and outflow condition in 3D . . . . . . . . . . . . . . . . 33

4 Numerical results on the 2D vortex convection 35

4.1 Purpose of the 2D vortex convection test . . . . . . . . . . . . . . . . . . . . . . 35

4.2 Vortex initialization and description . . . . . . . . . . . . . . . . . . . . . . . . 35

4.3 Test cases nomenclature and order representations . . . . . . . . . . . . . . . . 37

4.3.1 Nomenclature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

4.3.2 Representations of the order on meshes . . . . . . . . . . . . . . . . . . 39

4.4 Results on squares . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

4.5 Results on vertical flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

4.6 Results on boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

4.7 Results on horizontal flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

4.8 Results on horizontal flags with different sizes of strips . . . . . . . . . . . . . . 47

4.9 Comparison between different test-cases . . . . . . . . . . . . . . . . . . . . . . 48

4.10 Comparison between structured and unstructured cases . . . . . . . . . . . . . 49

4.11 Computed errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

4.12 Study of computational time . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

5 h− refinement method 55

5.1 h− refinement method in 2D . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

5.2 Solution projection on the Mortar elements . . . . . . . . . . . . . . . . . . . . 58

5.3 Flux projection on faces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

5.4 Properties and stability of the mesh refinement projections in 2D . . . . . . . . 61

5.4.1 Flux conservation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

5.4.2 Outflow condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

5.5 h− refinement method in 3D . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

5.5.1 Solution projection on the Mortar elements . . . . . . . . . . . . . . . . 65

5.5.2 Flux projection on the faces . . . . . . . . . . . . . . . . . . . . . . . . . 66

5.6 Properties and stability of the mesh refinement projections in 3D . . . . . . . . 68

6 Conclusion 71

6.1 Status of current work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

6.2 Future developments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

Bibliography 73

Page 4 of 85

Page 5: Handling di erent h and p re nements in the framework of

A p− refinement method: Application on an example 75A.1 Projection of the solution values . . . . . . . . . . . . . . . . . . . . . . . . . . 75A.2 Projection of the flux on faces . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76A.3 Flux conservation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77A.4 Outflow condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

B Implementation of p− refinement method in JAGUAR 81B.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81B.2 Coefficients computation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

B.2.1 Interpolation coefficients . . . . . . . . . . . . . . . . . . . . . . . . . . . 81B.2.2 Projection coefficients . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82

B.3 Solution interpolation on border flux points . . . . . . . . . . . . . . . . . . . . 83B.3.1 Cell L is the lower order cell . . . . . . . . . . . . . . . . . . . . . . . . 83B.3.2 Cell L is the higher order cell . . . . . . . . . . . . . . . . . . . . . . . . 84

B.4 Flux computation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84B.5 Flux projection on the border flux points . . . . . . . . . . . . . . . . . . . . . 84B.6 Boundary conditions and parallel treatment . . . . . . . . . . . . . . . . . . . . 85

Page 5 of 85

Page 6: Handling di erent h and p re nements in the framework of
Page 7: Handling di erent h and p re nements in the framework of

Chapter 1

Introduction

1.1 General considerations

During the last 40 years, the importance of Computational Fluid Dynamics (CFD) has grown,first in university labs and then in industry. In labs, the development followed the beginningof computers and then supercomputers and the emergence of dedicated schemes to account forconvection or diffusion effects. Industry found immediately the interest of CFD: with CFD,equations are discretized and solved on a given mesh and CFD induces the possibility to handleeasily several shapes, something impossible in a short time during experiences. Parametricstudies are possible with CFD. Moreover, CFD offers the possibility to have information atall time instants and everywhere inside the domain of interest, which is impossible duringexperiments. For all those reasons, industries have made many efforts to introduce, to validateand to define best practices for their configurations.

Industrial flows are generally transonic and turbulent. Turbulence is one of the mostcomplex and mathematically badly-understood phenomena. Turbulence is characterized byvortices of different size and energy that are produced, convected and dissipated by the flow.The largest sizes are linked with the object size, while the lowest sizes are dissipated by viscouseffects.

At the beginning of CFD, some flows could not be solved without modeling: the compu-tational capabilities were too limited. Following the emergence of Reynolds Averaged Navier-Stokes (RANS) equations, many efforts were dedicated to solve this approach and nowadays,industries are able to perform RANS or unsteady RANS computations every day. The basicschemes are second-order accurate and dissipative for stability and robustness. However, theaveraging procedure hides all unsteady turbulence effects and, now, the tendency is to accountfor the unsteadiness of turbulent effects. To do so, the concept of Large Eddy Simulation(LES) is introduced. It consists in applying a filter to the Navier-Stokes equations: the largeturbulence scales are computed and the smallest ones (of size lower than the mesh cell size)are modeled. The principle is therefore to get information from the largest turbulence scales.In practice, this kind of model needs lot of degree of freedom especially near walls. For thisreason, it is better to use high order schemes (higher than two) which will allow to decreasethe number of freedom for the same resolution. Moreover, a low dispersion and dissipationdiscretization is necessary to transport unsteady waves on large distance without changingartificially the flow nature.

LES can give a very accurate information inside the whole computational domain butit needs very refined meshes and accurate unsteady time integration. Moreover, the shapesanalyzed by industry are more and more complex and this complexity must be accounted

Page 7 of 85

Page 8: Handling di erent h and p re nements in the framework of

for in the mesh. For this reason, an unstructured approach is preferred. An unstructuredmesh is generally weakly anisotropic and it is generated automatically in a few hours onregular computers, even for complex geometries. A CFD code based on unstructured meshesis therefore a prerequisite.

With unstructured grids, developing high order schemes is very complex and accuracy isattained with large stencils: the number of degrees of freedom is large. LES needs very refinedmeshes and accurate time integration, which leads to a large computational cost. The solutionis therefore to use High Performance Computing (HPC) and to split the initial problem onthousands of CPU cores. HPC and large stencils are technologies with opposite behaviors anda trade-off has to be found.

Finally, the problem of LES is a key problem that involves several considerations : turbu-lence modeling, unstructured grids and High Performance Computing. Among the differenttechnical possibilities answering these points, Cerfacs has decided to focus on the SpectralMethods. Spectral methods assume that variables are varying in mesh element as polynomialfunctions and take in consideration the discontinuity in data at mesh interfaces. Let’s remindthat there exists several spectral techniques. The oldest one is called Discontinuous Galerkineand it consists in solving with Finite Element the flow inside each computational cell. Com-pared with classical Finite Element techniques, the difference occurs in the lack of continuityasked at the interface between two elements. However, this approach can need complex inte-gral closure and it hasn’t been chosen by Cerfacs. Cerfacs has chosen the Spectral Differencetechnique, detailed in Chapter. 2. A quick introduction, following papers published in theliterature, is also presented in Sec. 1.3.

1.2 CERFACS and work team

CERFACS (Centre Europeen de Recherche et de Formation Avancee en Calcul Scientifique) isa research organization that aims to develop advanced methods for the numerical simulationand the algorithmic solution of large scientific and technological problems of interest for re-search as well as industry, and that requires access to the most powerful computers presentlyavailable. CERFACS is governed by a Conseil de Gerance with representatives from its share-holders, and benefits from the recommendations of its Scientific Council.CERFACS has seven shareholders : CNES, the French Space Agency; EADS France, Euro-pean Aeronautic and Defence Space Company; EDF, Electricite de France; Meteo-France, theFrench meteorological service; ONERA, the French Aerospace Lab; SAFRAN, an internationalhigh-technology group; TOTAL, a multinational energy compagny.CERFACS hosts interdisciplinary teams, both for research and advanced training that arecomprised of: physicists, applied mathematicians, numerical analysts, and software engineers.Approximately 150 people work at CERFACS, including more than 130 researchers and en-gineers, coming from ten different countries. They work on specific projects in nine mainresearch areas: parallel algorithms, code coupling, aerodynamics, gas turbines, combustion,climate, environmental impact, data assimilation, and electromagnetism and acoustics.This work was realized in the CFD/AAM team and more particularly in a team composed ofJ-F Boussuge, G. Puigt, N. Villedieu and an other trainee student A. Cassagne.

Page 8 of 85

Page 9: Handling di erent h and p re nements in the framework of

1.3 The Spectral Difference method

The spectral difference method has been first introduced by Kopriva and Kolias in 1995 [10]and 1996 [11] for meshes based on hexahedral cells. It is a staggered technique with differentsolution points and flux points. The approach has then been forgotten up-to 2006 when Liu,Vinokur and Wang [14] proposed a general formulation for tetrahedra. In 2007, Wang, Liu andSun [17] propose an extension to handle unstructured meshes composed of hexahedra. Withoutentering into details, the SD method enables to control locally the accuracy of the solutionwith the definition of the degree of the polynomial representation of quantities. Moreover, thisapproach is perfect for HPC since the global algorithm only needs a local cell and its directneighbors: the stencil is minimal. Another interest is to be able to manage the solution qualitywithin the computation, performing an automatic refinement in p (polynomial degree) or in h(spatial refinement).

1.4 Order and mesh refinements

A mesh can be characterized by its local size h and the solution on it by its order of ap-proximation p. In order to get an accurate method for a low cost, p and h refinement canbe used. Indeed, p-refinement consists in adapting the polynomial order of mesh elementsand h− refinement consists in reducing cell sizes by dividing them in all their directions. Insmooth region (without a shock), increasing the polynomial order is suitable and this is thep-refinement. In a region of discontinuity (with a chock), accuracy can’t be kept constant nearthe shock and a h-refinement is preferred in order to produce a finer mesh.

For both h− and p− refinements, the key point remains data exchange at the interfacebetween two cells. As it will be explained in the following, SD approach needs interface fluxpoints which are located according to the space dimension h and the polynomial degree p.When one of them is changed, the location changes and the classical flux integration can’t beperformed. A solution is to introduce the Mortar approach. As for the SD method, Kopriva[8] is the pioneer in the use of Mortar elements with the SD method in 1996. Then, Y. Li, S.Premasuthan and A. Jameson study this method of refinements in 2010 [13].

1.5 Description of the work and outline of the document

The goal in this training period is to analyze, to implement and to validate the Mortar approachinside Cerfacs’ in-house SD code called JAGUAR . The goal is therefore to be able to account fordifferent p and h refinements inside a single computational mesh. Moreover, all developmentshave been extended to deal with parallel computations based on a MPI approach. In theframework of this work, we will deal only with Euler equations.

This report is composed of four main parts. The first one permits to recall the physicalequations and to introduce the SD method. The second part presents the p− refinementmethod and the proof that the method satisfies physical principles, as flux conservation, intwo and three dimensions. Then, some numerical results are given and analyzed in order toshow the consequences of p− refinement in a classical test-case for high order schemes. Tofinish, the h− refinement method is presented and physical properties are studied as for p−refinement case. It is possible to find in Appendix how p− refinement has been implementedin JAGUAR .

Page 9 of 85

Page 10: Handling di erent h and p re nements in the framework of
Page 11: Handling di erent h and p re nements in the framework of

Chapter 2

Euler equations and Spectral Difference method

This chapter is an introduction to understand the mathematical context of this work. In par-ticular, attention is first focused on the definition of the Euler equations and on their closure.Then, the Spectral Difference (SD) approach is introduced in the context of ComputationalFluid Dynamics (CFD). Description concerns first one-dimension flow and the natural exten-sion to handle three dimensional unstructured grids composed of hexahedra. In practice, thischapter is a prerequisite to introduce and understand the theoretical and numerical develop-ments regarding spatial and polynomial refinements.

2.1 Governing equations

Formally, Euler equations can be obtained from an analysis of mass, momentum and totalenergy variations inside a domain of interest. Those equations are first obtained in an integralform, as in the Finite Volume (FV) framework. Since those equations are valid whateverthe domain of interest is, the integral can be dropped out in order to obtain a point-basedformulation. In the following, let ρ be the density (in kg.m−3), −→u be the velocity vector withcomponents u, v and w in x, y and z directions (in m.s−1), E be the total energy (in m2/s2)and P be the static pressure (in Pa).

The total energy E is defined as the sum of internal energy e (related to temperature) andkinetic energy:

E = e+‖~u‖2

2(2.1)

Finally, the point-based version of Euler equations is:

∂tρ+∇ · (ρ−→u ) = 0 (2.2)

∂t(ρ−→u ) +∇ · (ρ−→u ⊗−→u ) +∇P = 0 (2.3)

∂t(ρE) +∇ · (−→u (ρE + P )) = 0. (2.4)

The system composed of Eq. 2.2, Eq. 2.3 and Eq. 2.4 is an open system, with more unknownsthan equations. It is closed with physical assumptions.

In this work, the considered fluid is air and it is assumed to follow the perfect gas law:

P = ρRT (2.5)

where T is the temperature and R is a specific constant (R = 287.05 m2s−2K−1 for air).At this level, the system is still open since no relation links temperature and energy. Air is

Page 11 of 85

Page 12: Handling di erent h and p re nements in the framework of

also assumed perfect thermodynamically, which means that air is considered as a polytropicgas characterized by constant heat capacities at constant pressure and volume, Cp and Cvrespectively. In this case, let γ define the polytropic constant. Cp and Cv are defined by:

Cp =γR

γ − 1and Cv =

R

γ − 1, (2.6)

leading to γ = Cp/Cv = 1.4. The closure is obtained from a linear relation between internalenergy and temperature:

e = CvT. (2.7)

Finally, Euler equations can be written in the following compact form:

∂Q

∂t+∇ · F = 0, (2.8)

where Q is the vector of conserved variables Q = (ρ, ρu, ρv, ρw, ρE)t and F can be expressedby its three components (F,G,H) in the three-dimensional case:

F = (ρu, P + ρu2, ρuv, ρuw, u(ρE + P ))T

G = (ρv, ρuv, P + ρv2, ρvw, v(ρE + P ))T

H = (ρw, ρuw, ρvw, P + ρw2, w(ρE + P ))T

This system of equations must be closed using Eq. 2.5, Eq. 2.6 and Eq. 2.7.

2.2 Description of the Spectral Difference method in 1D

2.2.1 Notations and equations

To explain the principle of the Spectral Difference (SD) method in a 1D configuration, weconsider the following 1D unsteady Euler equation:

∂Q

∂t+∂F∂x

= 0, (2.9)

and a mesh composed of several 1D segments.

As it is suggested by its name, the Spectral Difference method can be seen as a newformulation that follows some assumptions of the Finite Difference approach. In particular,there are two key points that are conserved:

1. Equations are solved locally in their local strong conservation form. In particular, thereare not any integral transformation as for the Finite Volume or Finite Element techniques.

2. The term in divergence is explicitly computed: one builds the F term and then differen-tiates it.

Page 12 of 85

Page 13: Handling di erent h and p re nements in the framework of

2.2.2 General principle

The principle of the SD approach is to assume that the vector of unknowns Q varies as apolynomial with a predefined degree inside each segment. In the following and in order tosimplify explanations, we assume that the number of unknowns Q is p + 1: we define p + 1solution points inside the segment, where the solution is known. From those p + 1 values,a p-order interpolation polynomial is built to represent quantity variations inside each meshsegment. As for a Finite Difference approach, solutions are computed in all i solution points:

∂Qi∂t

+∂F∂x|i = 0.

Following an explicit time marching process, the solution evolution is known once the deriva-tive of the flux density is computed at each solution point. Solution points, field values andinterpolation polynomial are shown on Fig. 2.1. One can remark that the SD procedure doesn’tassume that polynomials are continuous on both segment ends.

Figure 2.1: Step 0: Solution points, 2nd orderpolynomial and solution on the segment.

Figure 2.2: Step 1: extrapolation of quantitiesat flux points.

Regarding Euler initial equation Eq. 2.9, keeping a p order polynomial on the quantitiesQ is only possible if F is represented with a p + 1 order polynomial: its derivative is then ap order polynomial. We define p + 2 flux points in a staggered way: we consider the twoend points plus one flux point between two contiguous solution points. We use the polynomialdescription of data to extrapolate the data at all flux points (Fig. 2.2).

The flux density F is obtained as a non linear combination of the quantities Q at the fluxpoints (Fig. 2.3). The segment end points are shared by two segments and since quantities arediscontinuous at the segment end points, the flux is not continuous. This is for sure a problemto prove conservation once solving equations.

Figure 2.3: Step 2: non linear transformationto build the flux density F .

Figure 2.4: Step 3: unique flux computationat segment end points with a Riemann solver

Since solutions are discontinuous at end points, the interface flux can easily be computedusing an approximated Riemann solver and the flux is then defined with uniqueness (Fig. 2.4).By this way, the conservation is guaranteed. In this document, we will only consider the Roe’sapproximated Riemann solver.

Page 13 of 85

Page 14: Handling di erent h and p re nements in the framework of

From flux density, one can build a p + 1-degree interpolation polynomial (Fig. 2.5). Thepolynomial is globally continuous but only differentiable inside each segment and not at theboundaries.

Figure 2.5: Step 4: building a new polynomialfrom flux points (at degree p+ 1).

Figure 2.6: Step 5: differentiation of the fluxpolynomial at solution points.

The last step consists in differentiating the polynomial to compute the increment at eachsolution point (Fig. 2.6).

2.2.3 Position of solution points and location of internal flux points

It is possible to explain the possible choices of solution and flux points locations.The solution points are chosen to be the following Gauss points, as in many papers published

in the literature:

Xs =1

2

[1− cos

(2s− 1

2Nπ

)]with s ∈ {1, . . . , N} . (2.10)

In the following, flux points will be defined with a non integer index, a flux point numbereds + 1/2 is located between solution points indices s and s + 1. There is not any consensus inthe literature regarding the position of the flux points. In our solver, two different kinds ofpoints are available. A first choice follows the location of the Gauss-Lobatto points:

Xs+ 12

=1

2

[1− cos

( sNπ)]

with s ∈ {0, 1, . . . , N} .

Another choice follows the Legendre roots. Those flux points are the roots of Legendre poly-nomial, a serial of polynomial of increasing order defined by the following ordinary differentialequation on [−1; 1]:

d

dx

((1− x2)P ′n(x)

)+ n(n+ 1)Pn(x) = 0, Pn(1) = 1. (2.11)

The roots can be obtained in several ways and we have chosen the simplest choice possible:the values have been copied from the literature [20].

A. Jameson [7] gives the proof of the Spectral Difference method stability. In addition, thesolution point location does not affect the stability nor the accuracy of the method. Never-theless, the study of K. Van Den Abeele [19] shows that flux points location has influence onthese properties. He proves that with an order of accuracy higher than two, the Gauss-Lobattopoints become unstable whereas the Legendre quadrature permits to obtain a stable scheme.Even if many papers present the Gauss-Lobatto points as flux points, we have adopted theLegendre flux points in this work. These point locations are described in Fig. 2.7 for an orderof 3 (i.e. p = 3). Five flux points and four solution points are represented.

Page 14 of 85

Page 15: Handling di erent h and p re nements in the framework of

Figure 2.7: Example of the distribution of solution (circles) and flux (squares) points in 1D fora third-order accurate polynomial

2.2.4 Polynomials

To calculate the flux balance between the cells, the solution values on the cell interface arenecessary, i.e. in {0} and in {1} for the interval [0, 1]. These values can be extrapolated usingthe p-order Lagrange polynomial built on the Gauss points and on the Lagrange basis definedby:

hi(X) =

p+1∏s=1,s 6=i

(X −Xs

Xi −Xs

). (2.12)

The p + 1 degree polynomial (based on the flux points) is also built with a Lagrange basiswhich is the following

li(X) =

p+1∏s=0,s 6=i

(X −Xs+ 1

2

Xi+ 12−Xs+ 1

2

)(2.13)

where Xi+ 12

represents a flux point located between the solution points Xi and Xi+1.

2.2.5 Global algorithm

Finally, the method can be broken up into several steps which are the following

1. Extrapolation of the solution at the flux points using the p − th order polynomial builtwith known solution values Q at the solution points,

2. Computation of the flux in the intern flux points,

3. Treatment of the discontinuity using a Riemann solver to compute the flux on cells faces,

4. Extrapolation of the flux at the solution points using the p + 1 − th order polynomialinterpolation F built with computed flux values F at the flux points,

5. Differentiation of the flux polynomial in the solution points in order to obtain ∇.F ,

6. Computation of the solution Q at the next time step thanks to ∇.F values at solutionpoints and a time integration algorithm.

This algorithm can be extended to higher dimensions, it will be discussed with details in thefollowing section.

2.3 SD method in higher dimensions

In this section, we explain the procedure to extend the 1D approach to 2D and 3D flows.

Page 15 of 85

Page 16: Handling di erent h and p re nements in the framework of

2.3.1 Isoparametric transformation

In the mesh, volume sizes can be different and it could be difficult to arrange the solution andflux points on it. An isoparametric transformation is applied to transform the initial volumein the physical space to the reference volume [0, 1]d defined as a computational domain. If allvolumes are transformed, it is possible to define easily the location of solution and flux pointson the isoparametric volume. To apply the method and to solve the Euler equations in thesimplest way possible, each mesh cell will be transformed to its isoparametric counterpart. Anexample of a 2D case is available in Fig. 2.8.

Figure 2.8: Example of the action of the transformation on a 2D hexahedral cell

Considering the third dimension and assuming that the triplet (I, J,K) denotes the locationof a cell point in the computational domain, the inverse functions X, Y and Z can be definedin order to compute the coordinates (I, J,K) according to the position (x, y, z) of the point inthe physical domain. Coordinates and functions are linked by the following relations

x = X(I,J,K)y = Y(I,J,K)z = Z(I,J,K)

(2.14)

The shape functions can be found in [10] and a study of the transformation is available in [12].In the present work, only the Jacobian matrix will be defined and consequences on the equa-tions examined.With the previous notations, the Jacobian matrix J can be written as a function of shapefunction derivatives

J =

dX

dI

dX

dJ

dX

dKdY

dI

dY

dJ

dY

dKdZ

dI

dZ

dJ

dZ

dK

. (2.15)

This matrix has an important role in the achievement of the method as well as its determinantwhich expression is

|J | = det(J ) =dX

dI

(dY

dJ

dZ

dK− dZ

dJ

dY

dK

)− dY

dI

(dX

dJ

dZ

dK− dZ

dJ

dX

dK

)+

dZ

dI

(dX

dJ

dY

dK− dY

dJ

dX

dK

).

(2.16)

Page 16 of 85

Page 17: Handling di erent h and p re nements in the framework of

2.3.2 Effect on Euler equations

Indeed, as the transformation changes the solution values, the scalar quantities of the physicalsolution vector Q and those of the computational solution vector Q are linked by an expressionthat depends on the Jacobian determinant

Q = |J |Q. (2.17)

In addition, the Euler equations are also modified by the transformation, they can berewritten as

∂Q

∂t+∂F

∂I+∂G

∂J+∂H

∂K= 0 (2.18)

where (F ,G,H)T = |J |J −1(F,G,H)T with F , G and H the vectors defined in section 2.1.Each cell is modified by its own transformation, thus at the interface between two cells, twotransformations have to be considered. A study conducted in [20] shows that if a face is sharedby two cells in the physical domain, those two volumes will share a face in the computationaldomain too and the Jacobian of the transformation is continuous at the interface.

2.3.3 Point distribution and basis polynomials

As said in the previous section in 1D, the choice of the Gauss points (Eq. 2.10) for the solutionpoints is usual and the choice of the Legendre roots (roots of Eq. 2.11) for the flux points is inagreement with the accuracy and stability studies. In a 2D or 3D problem, the simplest wayto implement the method is always to deal with a mono-dimensional problem. In practice,an hexahedron is the natural extension of a segment in 3D and the procedure is finally verysimple:

• From the hexahedron definition, one can easily define 3 privileged space directions re-ferred as i-, j- and k- directions respectively. At this level, the procedure looks like afinite difference treatment regarding mesh directions in a structured block.

• Once the three main directions are chosen, it is possible to define the solution points.Inside the isoparametric element, each coordinate follows the Gauss values and there arefinally (p+ 1)d solution points in a d-dimension space element.

• For the flux points, the treatment is performed direction per direction. In practice, thereare Ndir

FP = (p+ 2)(p+ 1)d−1 flux points for each direction.

An example is shown on Fig. 2.9 for two examples of 2D point distributions (p = 1 andp = 2). There, it is possible to distinguish the flux points in each directions (i or j) by theirshapes; the solid squares represents the flux points in the i− direction and the empty squaresthose in the j− direction.

2.3.4 Effect on interpolation polynomials

When the points are placed, as said previously in 1D, a degree p and a degree p+1 polynomialscan be built with p+1 solution points and with p+2 flux points respectively, using the Lagrangebases defined in Eq. 2.12 and in Eq. 2.13. The extension to dimensions higher than one results

Page 17 of 85

Page 18: Handling di erent h and p re nements in the framework of

Figure 2.9: 2D point distributions with p=1 (at left) and p=2 (at right)

in the following procedure for solution and flux points: the treatment is performed directionper direction and mathematically, this approach is simply defined as a tensor product, directionper direction. For the solution polynomial, it becomes:

(h⊗ h⊗ h)I,J,K(i, j, k) = hI(i)hJ(j)hK(k)

where (i, j, k) is the location of a solution point in the (I, J,K) directions.Regarding the flux points, three basis polynomials are needed because there is one for eachdirectional flux point. For I−, J− and K− directional flux points, the chosen basis polynomialsare given by

(l ⊗ h⊗ h)I+ 12,J,K(i, j, k) = lI+ 1

2(i)hJ(j)hK(k),

(h⊗ l ⊗ h)I,J+ 12,K(i, j, k) = hI(i)lJ+ 1

2(j)hK(k),

(h⊗ h⊗ l)I,J,K+ 12(i, j, k) = hI(i)hJ(j)lK+ 1

2(k).

2.3.5 Interpolation and flux derivative

With these basis polynomials, reconstruction of solution and flux densities in each point of thecomputational domain is possible. The representations for the variables are the following

Q(i, j, k) =(Q)i,j,k

hI(i)hJ(j)hK(k), (2.19)

where(Q)i,j,k

is the solution values in the computational domain in the solution point of

coordinate (i, j, k). The same approach can be used for the flux points and permits to obtainthe following relations

F (i, j, k) =(F)I+ 1

2,J,K

lI+ 12(i)hJ(j)hK(k),

G(i, j, k) =(G)I,J+ 1

2,KhI(i)lJ+ 1

2(j)hK(k),

H(i, j, k) =(H)I,J,K+ 1

2hI(i)hJ(j)lK+ 1

2(k).

(2.20)

Page 18 of 85

Page 19: Handling di erent h and p re nements in the framework of

The flux derivative is needed in order to get the solution at the following time step, that iswhy relations for flux derivative interpolation are necessary. As flux reconstruction, the fluxreconstruction of derivative adheres to the directional principle. The flux components F , Gand H are only differentiated in the directions, I, J and K respectively, thus three relationsare obtained

∂F

∂I(i, j, k) =

(F)I+ 1

2,J,K

l′I+ 1

2

(i)hJ(j)hK(k),

∂G

∂J(i, j, k) =

(G)I,J+ 1

2,KhI(i)l

′J+ 1

2

(j)hK(k),

∂H

∂K(i, j, k) =

(H)I,J,K+ 1

2hI(i)hJ(j)l′

K+ 12

(k),

(2.21)

where l′ is the derivative of the Lagrange basis (Eq. 2.13).

2.3.6 Interface treatment

In higher dimension, the problem of interface discontinuity described in 1D also exists. Indeed,two mesh cells share a face and the interpolated solutions in the flux points (from left and rightsides respectively) are generally not identical. Then, it is necessary to solve a Riemann problemwith an approximated Riemann solver. To do so, the flux points must be located at the sameposition, as shown in Fig. 2.10 in 2D. There are three cells, and in each cell, flux points aredisposed at the interfaces and some solution points are arranged inside the cells. Finally, a 1Dprocedure following the face normal direction can be applied, provided the fact that one candefine properly the left and right extrapolations of quantities, one for each side of the face.

Figure 2.10: Solution and flux points distribution at three cells interfaces.

As explained before, there is a local definition of three direction space (i, j and k) insideeach cell. As a consequence, a hexahedron can be seen as a ”structured sub grid” and recoveringdata exchange between cells is finally based on a transformation matrix, as for a structuredgrid. The transformation matrix is used to define how (i, j, k) directions behave on the oppositeside of the interface. In our solver, all normal vectors are directed from left to right cell and thetransformation matrix is built assuming that (i, j, k) in the left hexahedron are the referenceones.

Page 19 of 85

Page 20: Handling di erent h and p re nements in the framework of

In the d− dimension, the transformation matrix between given left and right cells is a(d× d) matrix. Column 1 to column d of the matrix represent the axis 1 to the axis d of theleft cell, likewise, line 1 to line d represent the axis 1 to the axis d of the right cell. The matrixis filled with -1, 1 and 0. 1 means that the mesh lines continue in the same direction while -1means that the direction is changed. Take the example from Fig. 2.11, the i− axis remains thei− axis (with same direction), the j− axis becomes the k− axis in the same direction and thek− axis becomes the j− axis in the opposite direction.

Figure 2.11: Example of oriented axes on the left and the right cells

So, the associated transformation matrix TM is simply:

TM =

1 0 00 0 −10 1 0

.

Using this matrix, the coordinates of a border flux point on the right cell are obtained accordingto the coordinates of this same flux point on the left cell.

2.3.7 Approximated Riemann solver

In a mono-dimensional configuration, Roe approximation solver, see [18] and [15] consists inthe definition of a numerical flux on the common surface for two cells referred R and L in thefollowing definition

F =1

2(FR + FL)− 1

2

3∑l=1

αl|λl|Rl (2.22)

where αl are the eigenvalues of the linearized Euler system and∑3

l=1 αlRl is the jump of theconserved variables onto the right hand-sided eigenspace.

2.3.8 Time discretization

Unsteady Euler equations computation needs both spatial scheme and temporal scheme. Con-vection and time discretization must be carefully chosen in order to minimize dissipation anddispersion: one needs to combine a high order scheme in space with a high order scheme intime in order to keep a high order method and to minimize numerical errors.

Page 20 of 85

Page 21: Handling di erent h and p re nements in the framework of

The low-storage low-dissipation low-dispersion 6-stage Runge-Kutta approach initially de-veloped by Berland, Bailly and Bogey [4] for aeroacoustics is available. It represents a goodtrade-off between accuracy and CPU efficiency. This second-order scheme is written as follows:

v0i = Qni ,

vli = Qni − αlδt

[(∂F

∂I+∂G

∂J+∂H

∂K

)(vl)

]i

,

Qn+1i = vpi

(2.23)

with l ∈ {1, . . . , 6} and where i ∈ {1, . . . , p+ 1} represents the degrees of freedom of each cell.The coefficients αl are given in [4].

2.3.9 Final algorithm

In summary, the algorithm to compute the inviscid flux derivatives consists of the followingsteps at a fixed time n

1. Given the conserved variables at the solution points (Q)i,j,k, compute the conservedvariables at the flux points, i.e. , for s ∈ {12 , . . . , N + 1

2} , N = p+ 1, Q(s, j, k), Q(i, s, k)and Q(i, j, s) using Eq. 2.19. Transformation of the solution Q in Q with Q = Q/det(J ).

2. Compute the inviscid fluxes at the interior flux points (F )I+ 12,J,K ,(G)I,J+ 1

2,K and (H)I,JK+ 1

2

using the solution Q computed at step 1,

3. Compute the inviscid flux at element interfaces using the Roe solver with Eq. 2.22,

4. Computation of the p+1 order polynomials F , G, H built with the computed flux valuesat the flux points in each direction,

5. Compute the derivatives of the flux polynomial at the solution points∂F∂I (i, j, k),∂G∂J (i, j, k)

and ∂H∂K (i, j, k) using the Eq. 2.21.

Now, it is possible to compute the solution at each solution point of the time n + 1 with theRunge-Kutta scheme given by Eq. 2.23.

2.4 JAGUAR CFD Code

JAGUAR ( proJect of an Aerodynamic solver using General Unstructured grids And high ordeRschemes) is a new CFD code currently developed at Cerfacs. It has been built in order toanswer two issues. First, spectral approaches (like Discontinuous Galerkin, Spectral Differenceor Spectral Volumes and many other ”brothers”) are currently under development inside theCFD community and Cerfacs needs to have such a code in order to be able to implementand analyze the numerical effects of dedicated data structures and algorithms for spectralapproaches. This is essentially due to the fact that the data structure of a classical CFDcode can’t be extended to a spectral approach implementation. Moreover, one of Cerfacsmain activity concerns Large Eddy Simulation to compute the largest turbulent scales insidea turbulent flow, and to model the smallest scales with an algebraic model. LES demands

Page 21 of 85

Page 22: Handling di erent h and p re nements in the framework of

a high computational power due to small time steps and to a large number of degrees offreedom. If spectral approaches can do that as well as classical codes for LES, but with a lowercomputational cost, they may be preferred in the future for LES.

JAGUAR is written in Fortran 90 and can deal with 2D and 3D problems. It is currentlyextended to treat the Navier-Stokes equations with the use of a dedicated diffusion scheme.Meshes are only composed of hexahedra and JAGUAR supports two mesh formats: CGNS - CFDGeneral Notation System- format [1] and GMSH format [6]. Finally, JAGUAR incorporatesparallel capabilities based on a MPI implementation and it is currently extended to hybridconfigurations (MPI / OpenMP paradigms) and to GPGPU architectures, using CUDA [5].

To conclude, JAGUAR is a new kind of CFD code especially designed to perform LEScomputations on unstructured grids. The goal is to prepare the solver to handle in a singlecomputation :

1. several values of the polynomial order (referred as p refinement). This part is treated inChapter 3.

2. spatial refinement without transferring the refinement to surrounding cells. This is pos-sible through the use of ”hanging nodes”. This part is treated in Chapter 5.

Page 22 of 85

Page 23: Handling di erent h and p re nements in the framework of

Chapter 3

p− refinement method

3.1 Introduction

Increasing locally the polynomial degree of the approximation is a good way to assess anaccurate solution by refining the discretization where needed, and not inside the whole com-putational domain. For sure, increasing p must be considered where the flow is sufficientlysmooth, far from shocks. In practice, the goal is also to limit the restitution time: largercells and lower polynomial degrees can be considered far from the region of interest. However,the p refinement is not compatible with the general framework of the SD method, especiallybecause the number of flux points on the interface for left and right cells differs. Up-to now,the treatment of the Riemann solver is possible once the interfacial flux points line up exactlyon all the faces (Fig. 3.1)

Figure 3.1: Example of dot alignment on the sides of two cells with the same order.

In order to handle different values of p in the domain, the key point concerns the treatmentof the interface flux. A solution has been proposed by Kopriva and Kolias [8, 9] based on asolution technique called Mortar element. In practice, the treatment consists in introducing anew element to reconcile the different discretization on both interface sides. The computationof the flux is no longer performed on the cell interface, but on the Mortar element and a methodis needed to transfer information from the Mortar to the right and left cells.

Remark: From now on, note that a Mortar element is only associated with a single facewith two different discretizations, regarding left and right directions (according to the localnormal vector of the face).

This chapter presents the theoretical features for the Mortar method. After introducing theMortar approach for a 2D mesh, the two key points (projection of the solution and interpolationof the flux) are introduced. Finally, the last sections concern the 3D treatment.

Page 23 of 85

Page 24: Handling di erent h and p re nements in the framework of

3.2 p−refinement description in 2D

The following study is conducted in 2D.Two cells are considered, the cell L (at the left) and the cell R (at the right), each one witha different polynomial order pL and pR respectively1. Following SD method, the number offlux points on the interface of cell L and the one on the interface of cell R are different in thisspecial configuration. A very simple example is presented in Fig. 3.2 where there are more fluxpoints on the face of cell 1 than on the face of cell 2.

Figure 3.2: Example of degrees of freedom alignment on the sides of two cells with a variableorder, p = 4 at left and p = 3 at right.

Formally, the introduction of the Mortar element is represented in Fig. 3.3.

Figure 3.3: Representation of the Mortar method.

Reconciling the flux treatment can be easily explained, without entering into details. Thegoal is simply :

1. to define an interpolation of the solution on new flux points according to the maximumpolynomial order

2. to compute the flux at those flux points

1Right and left cells have only a meaning once the normal vector is defined. In JAGUAR , the normal vectoris directed from left to right.

Page 24 of 85

Page 25: Handling di erent h and p re nements in the framework of

3. to transfer flux quantities from the maximum polynomial degree to the minimum polyno-mial degree. The treatment is formally classical for the cell with the largest polynomialdegree.

Of course, several theoretical difficulties are hidden in steps 1 and 3.

3.2.1 Notations

We consider the two cells defined and oriented as in Fig. 3.4. All explanations will be given in

Figure 3.4: Representation of the assumed orientation of the cells.

this special case but of course, the principle remains identical whatever the cells orientation is.Moreover, it will be important to remark that the flux point location on the face is simply thesame as the solution points inside the cell, since the treatment is 1D in the direction normal tothe face. The Mortar approach acts only on the interface and in 2D, an interface is a segmentwhere are located extrapolations of the solution: QLj and QRk are respectively the extrapolationfrom the left and right cells defined as

QLj =(Q)1,j

and QRk =(Q)0,k,

with j = 1, . . . , pL + 1 and k = 1, . . . , pR + 1.

These values can be interpolated on each faces and the obtained polynomials are the fol-lowing

QL(y) =

pL+1∑j=1

QLj hLj (y), (3.1)

QR(y) =

pR+1∑k=1

QRk hRk (y) (3.2)

with y ∈ [0, 1] in the computational domain and hL and hR are the polynomial bases definedin Eq. 2.12 with p = pL on cell L and p = pR on cell R. The solution on the Mortar elementcan be defined as the following polynomials

φL,R(y) =P+1∑l=1

φL,Rl hθl (y), (3.3)

with l ∈ {1, . . . , P + 1}, P = max(pL, pR) and where hθ is the polynomial basis on the Mortarelement defined as in Eq. 2.12 but with p = P . It is necessary to consider these polynomialswith the largest of the two considered orders pL and pR: the polynomial order of the Mortarelement must incorporate these two orders in order to compute the flux with enough accuracy.

Page 25 of 85

Page 26: Handling di erent h and p re nements in the framework of

3.2.2 Supplementary requirements

The SD approach with a fixed polynomial degree is globally conservative since the flux iscontinuous at the mesh interfaces. It is a desire to keep conservation with a varying polynomialdegree. This requirement will motivate choices if necessary.

Moreover, a new condition called ”outflow condition” is also needed. Following Kopriva[8], the goal of this condition is to respect waves traveling inside the computational domainonce solving a hyperbolic system of equations. In a hyperbolic problem, waves can pass by aninterface unaffected by downwind contributions. In the current method, to satisfy the outflowcondition, the solution along the upwind interface must be unchanged after projecting on theMortar element and then back on the face. To do so, the solution along the upwind facemust be unchanged after projecting onto the Mortar and then back to the face. In his article,Kopriva suggests the use of an unweighted L2 projection method and this projection methodwill be described accurately in the following sections.

Remark: Kopriva shows in [10] that the polynomial order of the Mortar space must besufficiently large to include left and right polynomial orders. With our notations, it meansthat P ≥ max(pL, pR) and our choice P = max(pL, pR) respects this constraint.

The goal of section 3.3 is to present the projection of the solution on the Mortar element: itis the first numerical treatment. The second treatment consists in computing the flux, solvinga Riemann problem and the flux computation has been presented in section 2.3.6. Finally, thecomputed flux must be transferred onto the interface and this treatment will be detailed insection 3.4. In the following, two methods will be presented, they will be tested on a simpleexample in appendix A in order to understand which method should be used.

3.3 Step 1: transferring the solution onto the Mortar element

In this section, two methods will be presented in order to transfer the solution values from thefaces onto the Mortar element. The first one will be called the projection method, the secondone the interpolation method.

3.3.1 Projection method

As said previously, in order to compute the flux on the Mortar, the solutions QL,R must betransferred on the Mortar to get the polynomials φL,R and this transfer is performed by the useof a projection operator. To simplify the notations, the order pL of cell L will be considered asthe smaller order, thus, on the Mortar, the order P which is the maximum polynomial order,is P = pR. For cell R with P = pR, the projection operator is simply identity and finallyφR(y) = QR(y). For the projection of cell L, the unweighted L2 projection is used:

∫ 1

0(φL − QL)hθm(y)dy = 0 (3.4)

with m = 1, . . . , P + 1. A study of L2 projection properties will be conducted in Section. 3.5.

Replacing the expressions of QL and of φL given in Eq. 3.3 and in Eq .3.1 respectively,

Page 26 of 85

Page 27: Handling di erent h and p re nements in the framework of

Eq. 3.4 becomes:

pL+1∑j=1

QLj

[∫ 1

0hLj (y)hθm(y)dy

]=

P+1∑l=1

φLl

[∫ 1

0hθl (y)hθm(y)dy

], (3.5)

with m = 1, . . . , P + 1.Then, the matrix M and SL are defined as

Mml =

∫ 1

0hθl (y)hθm(y)dy, SLmj =

∫ 1

0hLj (y)hθm(y)dy,

in order to write Eq. 3.5 as SLQL = MφL where QL is the vector of solution values of allinterface flux points on cell L and φL the one on the Mortar element.Finally, φL is obtained after inverting M :

φL = M−1SLQL. (3.6)

For convenience, a (rectangular) matrix J is introduced as Jl,j =

P+1∑K=1

M−1l,k SLk,j with l ∈

{1, . . . P + 1} and j ∈ {1, . . . pL + 1} to have φLl =

pL+1∑j=1

Jl,jQLj . This approach needs to invert

matrix M and to compute the solution as a matrix vector product.

3.3.2 Interpolation method

The basic assumption for this method is to assume that flux points on the Mortar can bedisposed in the same way as the one on cell R, written X l with l ∈ {1, . . . , pR + 1} and as theones on cell L, written Xj with j ∈ {1, . . . , pL + 1}. These points must be indexed in the samedirection that the ones on cell L, see Fig. 3.5 and the solution values can be extrapolated onthese new flux points using:

φLl =

pL+1∑j=1

hLj (X l)QLj with l ∈ {1, . . . , P + 1} and j ∈ {1, . . . , pL + 1}.

In Fig. 3.5, the squares represent the flux points of cell L and the circles the ones of cell R.It is necessary to remark that on the Mortar, the circles are numbered according to the face ofcell L direction, not according to the one of cell R in order to obtain the correct coordinates ofthe flux points in agreement with the associated index, i.e. the index 1 must be combined withX1 and not X4 as when it is numbered on cell R. This choice is motivated by the possible useof the transformation matrix, as for the classical treatment. Finally, any coefficient obtainedwith the term hLj (X l) is the coefficient (l, j) of the previous matrix J .

3.3.3 Final choice

It is shown in Appendix A that both methods are equivalent, but the interpolation is muchmore easier to implement and cheaper. It will be chosen for the computation.

Page 27 of 85

Page 28: Handling di erent h and p re nements in the framework of

Figure 3.5: Example of points projection on the Mortar.

3.4 Step 3: transferring the flux onto the interfaces

In this section, two methods will be presented to transfer the flux from the Mortar elementonto the interfaces. As for step 1, the first one is a projection method and the second one isan interpolation method.

3.4.1 Projection method

Once the flux computation on the Mortar element is realized, the Mortar flux, denoted ψ, mustbe projected on the face of the cell in order to get FL and FR the flux on cell L and on cellR respectively. We keep the choice of the previous section regarding P : pL < P and P = pR.The procedure is similar to the one of the previous step. The necessary operator to projectthe Mortar flux on the interface is the identity for cell R and FR = ψ. For the projection ofcell L, the unweighted L2 projection is used:∫ 1

0

(FL − ψ

)hLm(y)dy = 0, (3.7)

with m ∈ {1, . . . , pL + 1}. Moreover, the Mortar flux ψ and the flux FL can be written as

FL(y) =

pL+1∑j=1

FLj hLj (y), (3.8)

ψ(y) =

P+1∑k=1

ψkhθk(y). (3.9)

Replacing the expressions of FL and of ψ, given in Eq. 3.8 and in Eq. 3.9, in Eq. 3.7, we obtain:

pL+1∑j=1

FLj

[∫ 1

0hLj (y)hLm(y)dy

]=

P+1∑k=1

ψk

[∫ 1

0hθk(y)hLm(y)dy

], (3.10)

with m ∈ {1, . . . , pL + 1}.Defining the matrices L and S as follows

MLj,m =

∫ 1

0hLj (y)hLm(y)dy, Sm,k =

∫ 1

0hθk(y)hLm(y)dy,

Page 28 of 85

Page 29: Handling di erent h and p re nements in the framework of

Eq. 3.10 can be written in a matrix form MLFL = Sψ, leading to FL = (ML)−1Sψ and tothe introduction of a new matrix L:

Lj,k =

pL+1∑m=1

(ML)−1j,mSm,k,

with j ∈ {1, . . . , pL + 1} and m ∈ {1, . . . , pL + 1}. The coefficients of this matrix L can becomputed in inverting the matrix ML.

3.4.2 Interpolation method

Considering a point distribution on the Mortar as the one shown in Fig. 3.5, the flux valuesknown in the circles can be extrapolated into the square flux points and then projected on theface. The square flux points are always written Xk with k ∈ {1, . . . , P + 1} and the circle fluxpoints written Xj with j ∈ {1, . . . , pL + 1} and an other expression of FL is given by

FLj =P+1∑k=1

hθk(Xj)ψk. (3.11)

So, it is possible to calculate the coefficients (j, k) of the matrix L and the term hθk(Xj).

3.4.3 Final choice

The projection method is chosen in the following since the interpolation is not conservativeand a counterexample can be found in appendix A.

3.5 Proof of conservation and outflow condition in 2D

When the previous projections are used, two criteria are satisfied:

• the approximation is conservative,

• the outflow condition is satisfied.

3.5.1 Flux conservation

To show the first condition, it is necessary to prove that∫ 1

0

(FR(y)− FL(y)

)dy = 0. (3.12)

If this condition is verified, there is flux conservation. It is possible to prove that for theprojection method in a general case. Indeed, the scalar product on L2(0, 1) is defined by(u, v) =

∫ 10 u(y)v(y)dy and by construction, we have

(FL − ψ, v) = 0 and (3.13)

(FR − ψ,w) = 0, (3.14)

Page 29 of 85

Page 30: Handling di erent h and p re nements in the framework of

for v and w in the polynomial spaces of degree pL and pR, P pL+1([0, 1]) and P pR+1([0, 1])respectively, included in L2(0, 1). Since 1 ∈ P pL+1([0, 1]) ⊂ P pR+1([0, 1]), we obtain∫ 1

0FL(y)dy =

∫ 1

0ψ(y)dy and

∫ 1

0FR(y)dy =

∫ 1

0ψ(y)dy

which implies the flux conservation.

3.5.2 Outflow condition

We recall that the approximation of a hyperbolic problem satisfies the outflow condition if thesolution along the upwind interface is unchanged after projecting on the Mortar element andthen back on the face. It is possible to prove in a general way that the projection methodsatisfies the outflow condition. Indeed, in terms of operator, the outflow condition is verified ifP θ→LPL→θ = I where P θ→L is the operator used in the projection of the flux on the faces andPL→θ is the one used in the projection of the solution on the Mortar. So, using the previousnotations,

P θ→L = (ML)−1S and PL→θ = M−1SL.

Calling φ = PL→θQL and QL? = P θ→Lφ, the previous assertion is true if QL = QL?. Byconstruction:

(QL − φ, v) = 0 and (QL? − φ,w) = 0, ∀v ∈ PP and w ∈ P pL ⊂ PP .

Then, (QL − φ,w) = 0 for all w ∈ P pL . That implies that

(QL −QL?, w) = 0, ∀w ∈ P pL .

Furthermore, we have QL −QL? ∈ P pL which proves that QL = QL?.

Many boundary integrals appear in previous equations and they have to be computed. Afirst approach consists in computing them ”by hands” but it is a painstaking work. We havetherefore chosen to use a quadrature formula, as explained in section Sec. 3.6.

3.6 Quadrature formula

In order to construct and exactly integrate a p order polynomial, function values in p+12 quadra-

ture points are needed. All the previous integrals are one-dimensional ones and the integrationformula is:

I =

∫ 1

−1h(y)dy =

n∑1

wih(yi) (3.15)

where n equals to the integer part of p+12 , yi are the p+1

2 quadrature points and wi are the weightcoefficients of the Gauss quadrature formula. In our implementation, we have extracted themfrom [20]. In Eq. 3.15, h is integrated between −1 and 1 while our computational domainis between 0 and 1. A variable change is necessary and it has effects on values for weightcoefficients and on quadrature point locations.

Page 30 of 85

Page 31: Handling di erent h and p re nements in the framework of

3.7 Extension of p−refinement to the three-dimensional case

In the three-dimensional case, the steps of the refinement are the same:

• Solution extrapolation on the Mortar element,

• Flux computation,

• Flux projection on the faces.

The Mortar is now a two-dimensional element, which implies that the solutions, the fluxesand the projections depend on two ”surface” parameters, y and z, assumed to be respectivelythe abscissa and the ordinate of a given face. With these notations, the solution on the facescan be written as:

QL(y, z) =

pL+1∑j=1

pL+1∑k=1

QLj,khLj (y)hLk (z), (3.16)

QR(y, z) =

pR+1∑l=1

pR+1∑n=1

QLl,nhRl (y)hRn (z) (3.17)

with (y, z) ∈ [0, 1] × [0, 1]. The solution on the Mortar element can be defined as follows foran order P = max(pL, pR)

φL,R(y, z) =P+1∑l=1

P+1∑n=1

φL,Rl,n hθl (y)hθn(z). (3.18)

3.7.1 Step 1: Transferring the solution onto the Mortar element

Two approaches can be considered.

Projection of the solution

As previously, the solution of the two cells can be projected on the Mortar in order to computethe flux on it. Cell R is the cell with the higher polynomial order, so, the projection operatoris the identity. For cell L, the L2−projection operator is used and permits to get the followingexpression:

pL+1∑j=1

pL+1∑k=1

QLj,k

[∫ 1

0

∫ 1

0hLj (y)hθm(y)hLk (z)hθr(z)dydz

]=

P+1∑l=1

P+1∑n=1

φl,n

[∫ 1

0

∫ 1

0hθl (y)hθm(y)hθn(z)hθr(z)dydz

],

(3.19)

with m, r ∈ {1, . . . , P + 1}.Eq. 3.19 can be written

pL+1∑j=1

∫ 1

0hLj (y)hθm(y)dy

pL+1∑k=1

QLj,k

∫ 1

0hLk (z)hθr(z)dz =

P+1∑l=1

∫ 1

0hθl (y)hθm(y)dy

P+1∑n=1

φl,n

∫ 1

0hθn(z)hθr(z)dz.

(3.20)

Page 31 of 85

Page 32: Handling di erent h and p re nements in the framework of

It is possible to introduce some matrices

M(l,m) =

∫ 1

0hθl (y)hθm(y)dy, M(n, r) =

∫ 1

0hθn(z)hθr(z)dz,

SL(m, j) =

∫ 1

0hLj (y)hθm(y)dy and SL(k, r) =

∫ 1

0hLk (z)hθr(z)dz,

in order to get φL with a matrix expression:

φL = M−1SLQLSLM−1.

Interpolation method

The projection method being expensive, we have preferred to use the interpolation method,already mentioned in the 2D case, with a lower cost of computation. This method permits toget a simple expression to compute φL as a function of QL:

φLl,n =

pL+1∑j=1

pL+1∑k=1

hLj (X l)hLk (Xn)QLj,k, (3.21)

where the points X are defined in Eq. 2.10 with N = P + 1.

3.7.2 Step 3: Transferring the flux from the Mortar onto the faces by pro-jection

After the flux computation, the Mortar flux, denoted ψ must be projected on the interfaces toget FL and FR the fluxes on cell L and cell R respectively.The Mortar flux and the flux FL can be written as

FL(y, z) =

pL+1∑j=1

pL+1∑k=1

FLj,khLj (y)hLk (z), (3.22)

ψ(y, z) =P+1∑l=1

P+1∑n=1

ψl,nhθl (y)hθn(z). (3.23)

At the cell R interface, the flux projection operator is the identity and at the cell L interface,as previously, the L2−projection is used and permits to get the following expression, for m, r ∈{1, . . . , pL + 1}

pL+1∑j=1

pL+1∑k=1

FLj,k

[∫ 1

0

∫ 1

0hLj (y)hLm(y)hLk (z)hLr (z)dydz

]=

P+1∑l=1

P+1∑n=1

ψl,n

[∫ 1

0

∫ 1

0hθl (y)hLm(y)hθn(z)hLr (z)dydz

],

(3.24)

Page 32 of 85

Page 33: Handling di erent h and p re nements in the framework of

which can also be written as

pL+1∑j=1

∫ 1

0hLj (y)hLm(y)dy

pL+1∑k=1

FLj,k

∫ 1

0hLk (z)hLr (z)dz =

P+1∑l=1

∫ 1

0hθl (y)hLm(y)dy

P+1∑n=1

ψl,n

∫ 1

0hθn(z)hLr (z)dz.

(3.25)

It is possible to introduce some matrices

ML(j,m) =

∫ 1

0hLj (y)hLm(y)dy, ML(k, r) =

∫ 1

0hLk (z)hLr (z)dz,

S(m, l) =

∫ 1

0hθl (y)hLm(y)dy and S(n, r) =

∫ 1

0hθn(z)hLr (z)dz

to write Eq. 3.25 as:

FL = (ML)−1SψS(ML)−1. (3.26)

3.8 Proof of conservation and outflow condition in 3D

As in the two-dimensional case, it is possible to prove that the projection method verifies theoutflow condition. Indeed, it is necessary to prove

• (ML)−1SM−1SL = I,

• SLM−1S(ML)−1 = I.

because, if ψ = M−1SLQLSLM−1 and Q = (ML)−1SLψS(ML)−1, the outflow condition isverified for QL = Q.The first assertion is proved in the two-dimensional study. The second one is also given by thetwo-dimensional case. First, it is possible to remark that S is the matrix transposition of Sand SL the one of SL. Secondly, the matrices M and ML are symmetric, their inverses too.Thus, we can written that

S(ML)−1 =((ML)−1S

)tand SLM−1 =

(M−1SL

)t,

which implies that

SLM−1S(ML)−1 =(M−1SL

)t ((ML)−1S

)t=((ML)−1SM−1SL

)t= I.

Moreover, the method is conservative if and only if∫ 1

0

∫ 1

0(FL − FR)dydz = 0 (3.27)

Using a method similar to the one used in 2D reasoning, it is possible to show that the methodis also conservative in 3D.

Page 33 of 85

Page 34: Handling di erent h and p re nements in the framework of
Page 35: Handling di erent h and p re nements in the framework of

Chapter 4

Numerical results on the 2D vortex convection

This chapter is dedicated to the analysis of numerical results obtained for a simple case: the 2Dconvection of a vortex. This case is chosen for its simplicity, its need of high order schemes tokeep accurately the vortex and the possibility to quantify theoretically the error with respectto the initial ”exact” solution.

4.1 Purpose of the 2D vortex convection test

The aim of computations on this test-case is to prove that the use of p−refinement permits toobtain solutions as accurate as the ones given by the use of a fixed order, but with a decreasein the number of degrees of freedom and in the computational time. The boundary conditionsdefined in all sides are periodic boundary conditions and the vortex continuously crosses thedomain from the left to the right. These conditions allow to compare the solutions between theconstant order case and the variable order case after many passages of the vortex (typicallyabout 20-30). Moreover, in the absence of any diffusion scheme, such a test case is suitableto quantify the effects of numerical schemes independently of boundary conditions and anynonphysical wave stay alive in the domain, leading to bad results and/or to the code crash.

4.2 Vortex initialization and description

A 2D convection vortex can be generated using the following function

ψ(x, y) = Γexp

(−(x− xc)2 + (y − yc)2

2R2c

), (4.1)

where Γ is the circulation, Rc is the radius and (xc, yc) are the coordinates of the vortex.Velocity components and pressure can be obtained from:

u = U0 +∂ψ

∂y, v = −∂ψ

∂xand P − P0 = − ρΓ2

2R2c

exp

(−(x− xc)2 + (y − yc)2

R2c

).

In this work, the flow is initialized with a constant density ρ0 = 1.1717kg.m−3, a constanttemperature T0 = 300K, a constant pressure P0 = 101300Pa and a constant transport velocityU0 = 35m.s−1. The vortex characteristics are defined as Umax = 0.04U0, Rc = L/20 andΓ = UmaxRc

√e, where L is the length of the domain as shown in Fig. 4.1. We consider the

length L equals to 0.3112m, (xc, yc) equals to (0, 0), that implies that Rc equals to 0.01556m

Page 35 of 85

Page 36: Handling di erent h and p re nements in the framework of

Figure 4.1: Representation of the vortex and of the domain.

and Γ equals to 3.59157 × 10−2m2.s−1. To avoid problems on the boundaries, the functiondefined in Eq. 4.1 is truncated as soon as the point (x, y) leaves the circle of diameter 4Rc.

In the following, attention will be paid on the local analysis of the x− component of thevelocity and on the pressure, as suggested in Fig. 4.2 and Fig. 4.3.

Figure 4.2: Global representation of the vortex, cross section and zoom in the box for x−component of the velocity.

Page 36 of 85

Page 37: Handling di erent h and p re nements in the framework of

Figure 4.3: Global representation of the vortex, cross section and zoom in the box for thepressure.

4.3 Test cases nomenclature and order representations

In this section, a nomenclature of the different test-cases is given. Indeed, calculations dependon the order p of each part of the mesh and a classification of the used combinations is necessaryto be clear and to recognize them on graphic legends. In the following description, a simplifiedrepresentation of the different orders present on the mesh is given and associated to a name(under the representation in each case).

4.3.1 Nomenclature

Four types of combination can be distinguished

• Horizontal flags

HF 3 5 a b HF 4 a b HF 8 a b

• Vertical flags

Page 37 of 85

Page 38: Handling di erent h and p re nements in the framework of

VF a b VF a b c

• Squares

S a b S a b c

• Boxes

6B a b c d 7B a b c d

A last type can be found on the figures, the constant order case, named C a for an order a.Two kinds of meshes will be considered. The Cartesian mesh is based on regular subdivisionsin two directions, but it is treated in an unstructured manner. The second kind of mesh isalso composed of hexahedra in a fully unstructured manner and the suffix un will follow thetest-case name for it (Fig. 4.4).

Page 38 of 85

Page 39: Handling di erent h and p re nements in the framework of

Figure 4.4: Example of meshes considered for the computations. Cartesian mesh on the leftand fully unstructured mesh on the right.

4.3.2 Representations of the order on meshes

Test-cases orders are represented in the following table on structured and unstructured meshes.The values of the polynomial degrees are given below the figures.

S a b

Structured mesh Unstructured mesh

a = 3 and b = 5.

Page 39 of 85

Page 40: Handling di erent h and p re nements in the framework of

S a b c

Structured mesh Unstructured mesh

a = 3, b = 4 and c = 5.

VF a b

Structured mesh Unstructured mesh

a = 4 and b = 5.

VF a b c

Structured mesh Unstructured mesh

a = 3, b = 4 and c = 5.

Page 40 of 85

Page 41: Handling di erent h and p re nements in the framework of

HF 8 a b

Structured mesh Unstructured mesh

a = 1 and b = 5.

HF 4 a b

Structured mesh Unstructured mesh

a ∈ {1, 2, 3} and b = 5.

HF 3 5 a b

Structured mesh Unstructured mesh

a = 1 and b = 5.

Page 41 of 85

Page 42: Handling di erent h and p re nements in the framework of

6B a b c d

Structured mesh Unstructured mesh

a = 3, b = 4, c = 2 and d = 5.

7B a b c d

Structured mesh Unstructured mesh

a = 2, b = 3, c = 4 and d = 5 ora = 3, b = 3, c = 4 and d = 5 ora = 3, b = 4, c = 4 and d = 5.

In the following sections, the pressure P and the axial velocity in the direction of the vor-tex propagation (x direction) of previous test-cases will be compared with the same physicalquantities of the constant cases according to the ordinate y. Every time the results on struc-tured and unstructured meshes will be shown. Meshes are composed of four hundred cells(approximately for unstructured meshes). The results are given after twenty-seven passagesfor structured meshes and after twelve passages for unstructured ones. The abscissa x is fixedand equals to the vortex center. In most cases, a zoom is realized to focus attention on thedifferences in the figures.

4.4 Results on squares

The pressure and the x-velocity component for the two square test-cases are shown in Fig 4.5.The same cartesian grid is applied for all computations and results from fixed polynomial

Page 42 of 85

Page 43: Handling di erent h and p re nements in the framework of

degree show a convergence of the results to an asymptotic value once p increases. Moreover,for the multi-p tests, it is clear that results accuracy is between the one for the smallest p andthe one for the largest p. This is due to the fact that the vortex core goes across both regionsand the final accuracy depends on the time spent on each area. This point is particularlyvisible on the S 3 4 5 test case: the solution is much more accurate than on S 3 5 mesh. Thesame conclusions can be obtained on an unstructured mesh: the pressure and the velocity arerepresented in Fig. 4.6.

Figure 4.5: Case A: pressure and x-velocity for two different squares on a structured mesh.

Figure 4.6: Case A: Pressure and x-velocity for squares on an unstructured mesh.

Page 43 of 85

Page 44: Handling di erent h and p re nements in the framework of

4.5 Results on vertical flags

For the vertical flags, the goal is to keep a solution as accurate as for the lowest value of thepolynomial order and to analyze the possible wave reflections in the vortex direction once thevortex goes across the fictitious interface where the polynomial order changes. Same resultsas for the boxes are obtained and the global accuracy varies between the lowest polynomialdegree and the largest value (Fig. 4.7 and Fig. 4.8).

Figure 4.7: Case B: Pressure and x-velocity for two vertical flags on a structured mesh.

Figure 4.8: Case B: Pressure and x-velocity for two vertical flags on an unstructured mesh.

Page 44 of 85

Page 45: Handling di erent h and p re nements in the framework of

4.6 Results on boxes

The interest of the box test cases lies in testing the numerical implementation with a largeblending of p values. Results are shown in Fig. 4.9 for the Cartesian grid and Fig. 4.10 for theunstructured grid.

Figure 4.9: Case C: Pressure and x-velocity for some box test-cases on a structured mesh.

Figure 4.10: Case C: Pressure and x-velocity for some box test-cases on an unstructured mesh.

We consider one box with the 6B configuration and three boxes with the 7B configuration.First, we remark that the 6B 3 4 2 5 and the 7B 3 4 4 5 cases give fith-order accurate solutionswhereas other solutions are located between the third and the fourth order curves. As previ-ously, this fact is explained by the shape of the considered configuration: in the 7B 2 3 4 5and 7B 3 3 4 5 test-cases, the vortex comes in regions where p = 3 while the minimum order

Page 45 of 85

Page 46: Handling di erent h and p re nements in the framework of

on the vortex passage is 4 for other cases. Same conclusions are attained for the unstructuredgrid computations.

4.7 Results on horizontal flags

The horizontal flag configuration represents the typical configuration to encounter with a vary-ing polynomial degree: the degree is maximum on the way of the vortex and it is decreasedelsewhere.

Figure 4.11: Case D: Pressure and x-velocity for some horizontal flag test-cases on a structuredmesh.

Figure 4.12: Case D: Pressure and x-velocity for some horizontal flag test-cases on an unstruc-tured mesh.

Page 46 of 85

Page 47: Handling di erent h and p re nements in the framework of

For the cartesian grid (Fig. 4.11), all test cases permit to get a fifth order approximationof the solution and this is due to the fact that the strips are not on the vortex passage. Thisis the proof that the strips do not have any influence on the solution accuracy. Finally, afirst order representation on the strips enables to decrease the CPU time while keeping agood approximation of the solution. The same conclusion is obtained for unstructured grids(Fig. 4.12), except for the case HF 4 1 5. We suppose that this is due to the fact that thevortex is finally too close to the low order accurate representation and may probably enter thisarea. This assumption will be analyzed in the following section.

4.8 Results on horizontal flags with different sizes of strips

In Fig. 4.13, results for different sizes of the central strip are given: there are cases with centralstrip of size 3.5Rc, 4Rc and 8Rc as said in the previous nomenclature. There is no differencein the structured case because the vortex always passes in the fifth-order strip. In Fig. 4.14,the unstructured case shows some differences: in the 3.5Rc case, the pressure and the velocityare not fifth-order accurate. That is explained by the order representation given in Sec. 4.3.2:for the unstructured case, demarcation is not so clear and it is possible that the vortex passesby low-order cells, which decreases the order of the solution.

Figure 4.13: Case E : Pressure and x-velocity for some horizontal flag test-cases on a structuredmesh.

Page 47 of 85

Page 48: Handling di erent h and p re nements in the framework of

Figure 4.14: Case E : Pressure and x-velocity for some horizontal flag test-cases on an unstruc-tured mesh.

4.9 Comparison between different test-cases

In Fig. 4.15 and Fig. 4.16, the pressure and the velocity of the better box cases, the horizontaland the vertical flag and the square test-cases are represented. The conclusions are

• While the vortex passes by an order equals to four or five uniquely, the error betweenconstant curves and test-case curves is small,

• If the vortex passes by low-order cells, i.e. two orders under the highest one, the errorbetween constant curves and test-case curves increases.

• In the unstructured case, the mesh adds a constraint: the central strip in the horizontalflag cases must be larger than in the structured case because of the nonlinear repartitionof the cells.

Page 48 of 85

Page 49: Handling di erent h and p re nements in the framework of

Figure 4.15: Case F : Pressure and x-velocity for some test-cases on a structured mesh.

Figure 4.16: Case F : Pressure and x-velocity for some test-cases on an unstructured mesh.

4.10 Comparison between structured and unstructured cases

The goal is now to compare accurately the solutions obtained on structured and unstructuredgrids. In Fig. 4.17, the pressure and the velocity of the horizontal flag test-cases are shown. Itis possible to remark that the unstructured mesh implies a larger central strip for this case butgenerally, results don’t show large differences. The conclusion is that the considered mesh hasan influence on the results but a ”good” choice of the polynomial order p permits to maintainaccurate results for both cases.

Page 49 of 85

Page 50: Handling di erent h and p re nements in the framework of

Figure 4.17: Case G: Pressure and x-velocity for a test-case on a structured and an unstructuredmesh.

4.11 Computed errors

After this graphical analysis, a mathematical analysis is now conducted. From the physicalpoint of view, the goal is to keep unchanged the solution after several passages of the vortexinside the computational domain. It is therefore possible to compare after some rotations thenumerical solution with the initial solution. Mathematically, it is convenient to introduce theL2 norm of the difference between the numerical and the initial solutions.The expression used to compute the L2 norm is the following

err =∑i

∑j

[|J |i,jHiHj (initSol(xi, xj)− numSol(xi, xj))2

], (4.2)

where xi, and xj are the abscissas and ordinates of the solution point (i,j), Hi and Hj areweights of the quadrature formula used in this equation, |J | is the Jacobian determinant, seeEq. 2.15, and initSol and numSol are respectively the initial and the final numerical solutions.

A first analysis on Cartesian grids with fixed polynomial order shows that increasing thepolynomial order decreases the numerical error, as it could be expected. At fixed p, errorson the unstructured grids and those on the Cartesian grid can not be compared because thefirst ones are given after 12 vortex passages whereas the second ones are given after 27 vortexpassages. For both, numerical errors with fixed p will be assumed as reference errors and thegoal is to compare the cases with variable p with those errors. The mathematical analysisconfirms the physical analysis ever performed: the global accuracy depends simply on thepolynomial order in the region where the vortex goes through. For unstructured grids, thesituation is less clear but this is essentially due to the fact that defining zones far from thevortex is not as accurate as for the Cartesian grid and the vortex finally goes through cellswith a low polynomial order.

Page 50 of 85

Page 51: Handling di erent h and p re nements in the framework of

Test-case Structured mesh Unstructured mesh

C 3

ρ : 9.08822.10−8

u : 2.23193.10−3

v : 1.72065.10−3

P : 7.56550.10−3

ρ : 3.56752.10−7

u : 1.15541.10−2

v : 1.18394.10−2

P : 4.33533.10−2

C 4

ρ : 8.31334.10−8

u : 2.12371.10−3

V : 1.77727.10−3

P : 6.88804.10−3

ρ : 7.30919.10−8

u : 4.54743.10−4

v : 4.82856.10−4

P : 8.74764.10−3

C 5

ρ : 3.01551.10−8

u : 1.20286.10−4

v : 1.32629.10−4

P : 3.57125.10−3

ρ : 3.46835.10−8

u : 1.17205.10−4

v : 1.19611.10−4

P : 4.20037.10−3

S 3 5

ρ : 4.12661.10−7

u : 1.45745.10−2

v : 1.36558.10−2

P : 5.01950.10−2

ρ : 1.28214.10−7

u : 6.06706.10−3

v : 6.11376.10−3

P : 1.17201.10−2

S 3 4 5

ρ : 2.21391.10−7

u : 6.46965.10−3

v : 6.35048.10−3

P : 2.46382.10−2

ρ : 7.28217.10−8

u : 3.25111.10−3

v : 2.98679.10−3

P : 5.66672.10−3

VF 4 5

ρ : 4.23962.10−8

u : 9.81571.10−4

v : 8.09776.10−4

P : 2.85545.10−3

ρ : 4.85023.10−8

u : 2.57514.10−4

v : 2.46195.10−4

P : 5.53679.10−3

VF 3 4 5

ρ : 2.21466.10−7

u : 6.46968.10−3

v : 6.35049.10−3

P : 2.46726.10−2

ρ : 4.40818.10−7

u : 9.81947.10−2

v : 9.91932.10−2

P : 9.75204.10−2

HF 3 5 1 5

ρ : 3.95311.10−8

u : 4.77161.10−3

v : 6.19474.10−3

P : 8.28015.10−3

ρ : 4.95842.10−7

u : 4.47836.10−2

v : 3.44349.10−2

P : 5.57116.10−2

HF 4 1 5

ρ : 1.26131.10−8

u : 1.91562.10−4

v : 2.07424.10−4

P : 1.12752.10−3

ρ : 1.10411.10−7

u : 1.50299.10−2

v : 8.38607.10−3

P : 1.25827.10−2

HF 4 2 5

ρ : 8.53573.10−9

u : 1.21476.10−4

v : 1.32711.10−4

P : 1.12909.10−3

ρ : 8.67581.10−8

u : 2.38271.10−3

v : 1.104686.10−3

P : 1.04926.10−2

HF 4 3 5

ρ : 1.56086.10−8

u : 1.21243.10−4

v : 1.32794.10−4

P : 1.77304.10−3

ρ : 2.23150.10−8

u : 3.14246.10−4

v : 1.60662.10−4

P : 2.69704.10−3

Page 51 of 85

Page 52: Handling di erent h and p re nements in the framework of

Test-case Structured mesh Unstructured mesh

HF 8 1 5

ρ : 9.00079.10−9

u : 1.34141.10−4

v : 1.48066.10−4

P : 8.10436.10−4

ρ : 8.55408.10−9

u : 1.33057.10−4

v : 1.35981.10−4

P : 1.01419.10−3

6B 3 4 2 5

ρ : 3.70631.10−8

u : 9.81985.10−4

v : 8.10132.10−4

P : 1.45218.10−3

ρ : 6.70332.10−8

u : 1.88421.10−3

v : 9.32653.10−4

P : 7.86941.10−3

7B 2 3 4 5

ρ : 3.23281.10−7

u : 8.54709.10−3

v : 8.18403.10−3

P : 3.82559.10−2

ρ : 1.15957.10−7

u : 3.53504.10−3

v : 3.12776.10−3

P : 1.17014.10−2

7B 3 3 4 5

ρ : 3.23574.10−7

u : 8.54310.10−3

v : 8.19369.10−3

P : 3.83163.10−2

ρ : 8.34588.10−8

u : 3.41793.10−3

v : 3.25623.10−3

P : 6.51922.10−3

7B 3 4 4 5

ρ : 6.91061.10−8

u : 1.17911.10−3

v : 1.17411.10−3

P : 6.86068.10−3

ρ : 2.75631.10−8

u : 3.24899.10−4

v : 2.82858.10−4

P : 2.61787.10−3

Table 4.1: Tables representing computed errors for different test-cases on Cartesian and un-structured meshes.

Page 52 of 85

Page 53: Handling di erent h and p re nements in the framework of

4.12 Study of computational time

The p−refinement is needed to increase locally solution accuracy. Of course, it can also beenapplied to decrease the number of degrees of freedom, especially far from physical phenomena.This will involve a decrease of CPU time. In this section, a study to compare computationaltimes on constant cases with some of the previous test-cases is conducted.

A way to show the computational time decrease is to compare the five-order constantcase with horizontal flag test-cases on Cartesian and unstructured meshes: as said previously,horizontal flags permit to get a solution as good as the five-order constant case one. In thefollowing tables, computational time and gains are available for different horizontal flag test-cases.Remark: It is important to consider that the p− refinement implementation is in its firstversion and therefore not optimized. Results need to be improved.

Structured mesh Unstructured mesh

Test-case Computational time Gain in percent Computational time Gain in percent

C 5 4013.69 s - 5078.23 s -

HF 4 5 1 2478.99 s 38.24 2987.05 s 41.17

HF 4 5 2 2790.40 s 30.47 3428.18 s 32.49

HF 4 5 3 3221.21 s 19.73 4011.87 s 20.99

Table 4.2: Table representing computational time and gains for some test-cases on Cartesianand unstructured meshes.

It is clear that the p− refinement method permits to decrease the computational time andan interesting CPU gain is obtained even with the current non optimized version of JAGUAR .This fact is explained by the large amount of work to perform when p differs: the supplementarycost of the Mortar element is hidden by the gain in computational time dedicated to the workinside low order elements.

Page 53 of 85

Page 54: Handling di erent h and p re nements in the framework of
Page 55: Handling di erent h and p re nements in the framework of

Chapter 5

h− refinement method

Spatial refinement is the second way to increase accuracy. Historically, this approach has beenintroduced since the beginning of CFD. The spatial refinement is a way to attain mathematicalconvergence and to limit numerical errors. In particular, h−refinement is the basic to checkaccuracy order. For spectral methods with discontinuous data at cells interface, h− refinementis a way to increase accuracy where the flow is not smooth enough, and therefore where thep− refinement can’t be considered. In practice, the combination of p− and h− refinementsenables to find the most accurate solution at a given number of degrees of freedom. The choicebetween h− and p− refinements is done after an analysis of the solution and mathematicalconsiderations. Those points won’t be addressed in this document.

There are several possible techniques for the mesh refinement and some examples are shownin Fig. 5.1. Case A represents a partially-conforming refinement and case B a fully non-

Figure 5.1: Examples of h−refinement

conforming one. In this work, only partially-conforming refinement will be studied and it isassumed that a cell can’t be refined more than once in each direction in comparison with theneighboring cells, i.e. only one level of refinement is tolerated. This condition simplifies thenumerical treatment (only one case is considered with a refinement 1 to 2) and smoothes therefinement effects to capture the physical phenomenon by introducing the refinement in thesurrounding cells. This limitation has been considered by other authors, either for the SDmethod [13] or for more advanced techniques like CPR [16]. The node located on the righthand side of case A and not shared with the left (large) volume is called a hanging node inthe literature. In our work, we assume that it is the edge mid-point and the h− refinement

Page 55 of 85

Page 56: Handling di erent h and p re nements in the framework of

consists in slitting a cell in 4 subdomains in 2D or in 8 subcells in 3D. Following rules for theisoparametric transformation, it means that the new mesh node (hanging node) is defined byits coordinate ξ = 1

2 in the computational (isoparametric) space.

5.1 h− refinement method in 2D

The method is close to the p-refinement method in the sense that Mortar elements and L2−projections are also used. In the two-dimensional case, there are two possibilities to define aMortar element for a non-conforming refinement case as shown in Fig. 5.2.

Figure 5.2: Two Mortar configurations for h−refinement

In the first case, two Mortar elements are disposed between the two cells, they coincide withthe short face of the right cell. In the second case, an unique Mortar element is given and itcoincides with the long face of cell L. One has to make a choice. In the second case, the Mortarelement enables to define a unique polynomial on the Mortar for the common treatment ofthe two cells issued from the right hand side. As a consequence, the reconstructed solution onthe Mortar is continuous, while no assumption of continuity is assumed at the hanging nodeand generally, solutions can be discontinuous. This is contradiction with the outflow conditionthat states that the Mortar projection has no effect on the solution. Only the first topologysatisfies the outflow condition. It is important to remark that, in this work, a point on theface of cell R is described by its location ξ ∈ [0, 1].

In order to simplify the notations, we consider that cell R is refined and thus, four differentcells are created. So, there are two faces on cell R shared with an unique face on cell L andthus, two different solution approximations must be defined for cell R, QR1 and QR2 and one

Page 56 of 85

Page 57: Handling di erent h and p re nements in the framework of

for cell L, QL. The solution approximations on the faces are given by:

QL(ξ) =

pL+1∑j=1

QLj hLj (ξ) (5.1)

QR1(ξ) =

pR1+1∑

k=1

QR1k hR1

k (ξ) (5.2)

QR2(ξ) =

pR2+1∑

l=1

QR2l hR2

l (ξ) (5.3)

with ξ ∈ [0, 1] which crosses each face.A representation of the considered coordinate systems of each cell can be found in Fig. 5.3.Now, some notations must be introduced

Figure 5.3: Representation of an example of coordinate systems of the cells

• ξ represents the ordinate of cell R1, cell R2 or cell L,

• θ1 is the first Mortar element represented in Fig. 5.3,

• θ2 is the second Mortar element represented in Fig. 5.3,

• z represents the abscissa of the Mortar element θ1 or θ2,

• ok permits to get a parametrization of each cell face with ξk = ok + 12z, with z ∈ [0, 1]. In

this work, ok belongs in {0, 12}. If ok = 0, a parametrization of the face portion oppositeto the Mortar θ2 is obtained and if ok = 1

2 , a parametrization of the face portion oppositeto the Mortar θ1 is obtained.

Page 57 of 85

Page 58: Handling di erent h and p re nements in the framework of

Moreover, the solution approximations on the Mortar elements can be introduced as

φθ1,L =J1+1∑n=1

φθ1,Ln hθ1n (z) (5.4)

φθ1,R1 =J1+1∑m=1

φθ1,R1m hθ1m(z) (5.5)

φθ2,L =J2+1∑i=1

φθ2,Li hθ2i (z) (5.6)

φθ2,R2 =J2+1∑c=1

φθ2,R2c hθ2c (z) (5.7)

with J1 = max(pL, pR1) and J2 = max(pL, pR2).As previously, the method is composed of three steps

• Projection of the solution values on the Mortar elements, see Section 5.2.

• Flux computation on the Mortar elements using a Riemann solver, see Section 2.3.6.

• Projection of the computed flux on the different faces of the cells, see Section 5.3.

5.2 Solution projection on the Mortar elements

As in the p−refinement method, it is necessary to project the solution values of each cell on theMortar elements in order to compute the flux on them. For that, we also use the unweightedL2− projection on θ1 and on θ2 and the following expressions are obtained:∫ 1

0

(QL(

1

2+

1

2z

)− φθ1,L(z)

)hθ1j (z)dz = 0, (5.8)∫ 1

0

(QR1(z)− φθ1,R1(z)

)hθ1k (z)dz = 0, (5.9)∫ 1

0

(QL(

1

2z

)− φθ2,L(z)

)hθ2r (z)dz = 0, (5.10)∫ 1

0

(QR2(z)− φθ2,R2(z)

)hθ2s (z)dz = 0, (5.11)

with j, k ∈ {1, . . . , J1 +1} and r, s ∈ {1, . . . , J2 +1}. Eq. 5.8 and Eq. 5.9 represent the solutionprojection of cell L and cell R1 on the Mortar θ1 and Eq. 5.10 and Eq. 5.11 are the ones forthe solution projection of cells L and R2 on the Mortar θ2. It is important to remark that theprojection is performed facet by facet and only local parametrization is considered in Eq. 5.8and Eq. 5.10. In Eq. 5.9 for cell R1 and in Eq. 5.11 for cell R2, it is possible to recognize Eq. 3.4obtained for the p−refinement method Chap. 3. For cells R1 and R2, the same projection asfor the p− refinement method is used and only Eq. 5.8 and Eq. 5.10 will be studied in thefollowing.

Page 58 of 85

Page 59: Handling di erent h and p re nements in the framework of

Indeed, h refinement implies some differences in the treatment of cell L. Using Eq. 5.1,Eq. 5.8 can be written∫ 1

0

(pL+1∑l=1

QLl hLl

(1

2+

1

2z

))hθ1j (z)dz =

∫ 1

0

J1+1∑n=1

φθ1,Ln hθ1n (z)

hθ1j (z)dz, (5.12)

with n, j ∈ {1, . . . , J1 + 1} and l ∈ {1, . . . , pL + 1}. In the same way, using Eq. 5.1, Eq. 5.10becomes∫ 1

0

(pL+1∑l=1

QLl hLl

(1

2z

))hθ2r (z)dz =

∫ 1

0

J2+1∑i=1

φθ2,Li hθ2i (z)

hθ2r (z)dz, (5.13)

with i, r ∈ {1, . . . , J2 + 1} and l ∈ {1, . . . , pL + 1}. Furthermore, Eq 5.12 and Eq. 5.13 become

pL+1∑l=1

QLl

(∫ 1

0hLl

(1

2+

1

2z

)hθ1j (z)dz

)=

J1+1∑n=1

φθ1,Ln

(∫ 1

0hθ1n (z)hθ1j (z)dz

)(5.14)

pL+1∑l=1

QLl

(∫ 1

0hLl

(1

2z

)hθ2r (z)dz

)=

J2+1∑i=1

φθ2,Li

(∫ 1

0hθ2i (z)hθ2r (z)dz

). (5.15)

To finish, these equations can be written as matrix expressions:

φθ1,L = M−11 SL1 QL (5.16)

φθ2,L = M−12 SL2 QL (5.17)

where

(M1)n,j =

∫ 1

0hθ1n (z)hθ1j (z)dz, (S1)j,l =

∫ 1

0hLl

(1

2+

1

2z

)hθ1j (z)dz,

(M2)i,r =

∫ 1

0hθ2i (z)hθ2r (z)dz and (S2)r,l =

∫ 1

0hLl

(1

2z

)hθ2r (z)dz,

with n, j ∈ {1, . . . , J1 +1}, i, r ∈ {1, . . . , J2 +1} and l ∈ {1, . . . , pL+1}. Now that the solutionis projected on the Mortar elements, it is possible to compute the flux on them.

5.3 Flux projection on faces

After flux computation, it is necessary to project back the flux polynomial on the differentfaces with the unweighted L2− projection. To do so, some notations must be introduced

• The flux functions ψθ1 and ψθ2 on the Mortar elements θ1 and θ2 are given by

ψθ1(z) =J1+1∑l=1

ψθ1l hθ1l (z), (5.18)

ψθ2(z) =

J2+1∑n=1

ψθ2n hθ2n (z) (5.19)

with l ∈ {1, . . . , J1 + 1}, n ∈ {1, . . . , J2 + 1} and z ∈ [0, 1].

Page 59 of 85

Page 60: Handling di erent h and p re nements in the framework of

• The flux functions on the cell L, R1 and R2 are defined by

FL(ξ) =

pL+1∑j=1

FLj hLj (ξ), (5.20)

FR1(ξ) =

pR1+1∑m=1

FR1

m hR1

m (ξ), (5.21)

FR2(ξ) =

pR2+1∑k=1

FR2

k hR2

k (ξ) (5.22)

with j ∈ {1, . . . , pL + 1}, m ∈ {1, . . . , pR1 + 1}, k ∈ {1, . . . , pR2 + 1} and ξ ∈ [0, 1].

• The flux on the union of the two Mortar elements is defined as

ψ(ξ) =

ψθ1(2ξ − 1) if ξ ∈

[12 , 1]

ψθ2(2ξ) if ξ ∈

[0, 12] . (5.23)

Using these expressions, the projection L2 of the flux on the faces gives∫ 1

0

(FL(ξ)− ψ(ξ)

)hLr (ξ)dξ = 0, (5.24)∫ 1

0

(FR

1(ξ)− ψθ1(ξ)

)hR

1

s (ξ)dξ = 0, (5.25)∫ 1

0

(FR

2(ξ)− ψθ2(ξ)

)hR

2

i (ξ)dξ = 0 (5.26)

with r ∈ {1, . . . , pL + 1}, s ∈ {1, . . . , pR1 + 1} and i ∈ {1, . . . , pR2 + 1}.Eq. 5.25 and Eq. 5.26 are the same as in Chap. 3. So, the study only focuses on Eq. 5.24

and replacing in it the expression of ψ given in Eq. 5.23, it comes:∫ 1

12

(FL(ξ)− ψθ1(2ξ − 1)

)hLj (ξ)dξ +

∫ 12

0

(FL(ξ)− ψθ2(2ξ)

)hLj (ξ)dξ = 0 (5.27)

with j ∈ {1, . . . , pL + 1}. Replacing the expression of FL given in Eq. 5.20, Eq. 5.27 becomes

pL+1∑k=1

FLk

(∫ 12

0hLk (ξ)hLj (ξ)dξ +

∫ 1

12

hLk (ξ)hLj (ξ)dξ

)=

∫ 12

0ψθ2(2ξ)hLj (ξ)dξ +

∫ 1

12

ψθ1(2ξ − 1)hLj (ξ)dξ

(5.28)

with j ∈ {1, . . . , pL + 1} and k ∈ {1, . . . , pL + 1}.Using the variable changes, ξ = 1

2 + 12z on

[12 , 1]

and ξ = 12z on

[0, 12], we obtain

pL+1∑k=1

FLk

(∫ 1

0hLk (ξ)hLj (ξ)dξ

)=

1

2

(∫ 1

0ψθ1(z)hLj

(1

2+

1

2z

)dz +

∫ 1

0ψθ2(z)hLj

(1

2z

)dz

).

Page 60 of 85

Page 61: Handling di erent h and p re nements in the framework of

(5.29)

Now, it is possible to replace the expressions of ψθ1(z) and ψθ2(z) given by Eq. 5.18 andEq. 5.19 in the previous equations and the expression of the flux projection becomes

pL+1∑k=1

FLk

(∫ 1

0hLk (ξ)hLj (ξ)dξ

)=

1

2

( J1+1∑l=1

ψθ1l

∫ 1

0hθ1l (z)hLj

(1

2+

1

2z

)dz+

J2+1∑n=1

ψθ2n

∫ 1

0hθ2n (z)hLj

(1

2z

)dz

) (5.30)

with j ∈ {1, . . . , pL + 1}, k ∈ {1, . . . , pL + 1}, l ∈ {1, . . . , J1 + 1} and n ∈ {1, . . . , J2 + 1}.Considering the flux vector on cell L as FL and the ones on the Mortars as ψθ1 and ψθ2 , theprevious equation can be written in the following matrix form

FL = (ML)−1(S1Lψθ1 + S2Lψθ2

), (5.31)

where

MLk,j =

∫ 1

0hLk (ξ)hLj (ξ)dξ,

S1Lj,l =

1

2

∫ 1

0hθ1l (z)hLj

(1

2+

1

2z

)dz and S2L

j,n =1

2

∫ 1

0hθ2n (z)hLj

(1

2z

)dz.

In the following section, the proof of stability for the h− refinement method will be given.

5.4 Properties and stability of the mesh refinement projectionsin 2D

As in the order refinement case, it is necessary to prove that the method satisfies

• The flux conservation,

• The outflow condition.

These two assumptions will be studied in Section 5.4.2 and Section 5.4.1.

5.4.1 Flux conservation

In order to show that the method is conservative, we need to prove that∫ 1

0

(FL(ξ)− FR(ξ)

)dξ = 0 (5.32)

where FR is defined as

FR(ξ) =

{FR1(2ξ − 1) if ξ ∈

[12 , 1]

FR2(2ξ) if ξ ∈[0, 12] .

Page 61 of 85

Page 62: Handling di erent h and p re nements in the framework of

Using the scalar product defined in Section 3.5.1, by construction, we have

(FL − ψ, u) = 0, (5.33)

(FR1 − ψθ1 , v) = 0, (5.34)

(FR2 − ψθ2 , w) = 0, (5.35)

where u, v and w are in the polynomial spaces of degree pL, pR1 and pR2 respectively, writtenP pL+1([0, 1]), P pR1

+1([0, 1]) and P pR2+1([0, 1]).

To prove Eq. 5.32, it is possible to show that∫ 1

0

(FR(ξ)− ψ(ξ)

)dξ = 0 (5.36)

and ∫ 1

0

(FL(ξ)− ψ(ξ)

)dξ = 0. (5.37)

The proof of Eq. 5.37 comes from Eq. 5.33 and the fact that 1 belongs to P pL+1([0, 1]).It is possible to define a function g in order to prove that (FR − ψ, g) = 0 as

g(ξ) =

{v(2ξ − 1) if ξ ∈

[12 , 1]

w(2ξ) if ξ ∈[0, 12] . (5.38)

Using this expression, we can write∫ 1

0

(FR(ξ)− ψ(ξ)

)g(ξ)dξ =

∫ 12

0

(FR2(2ξ)− ψθ2(2ξ)

)w(2ξ)dξ+∫ 1

12

(FR1(2ξ − 1)− ψθ1(2ξ − 1)

)v(2ξ − 1)dξ.

(5.39)

Using the variable change z = 2ξ if ξ ∈[0, 12]

or z = 2ξ − 1 if ξ ∈[12 , 1], Eq. 5.39 becomes∫ 1

0

(FR(ξ)− ψ(ξ)

)g(ξ)dξ =

∫ 1

0

(FR1(z)− ψθ1(z)

)w(z)dz+∫ 1

0

(FR2(z)− ψθ2(z)

)v(z)dz.

(5.40)

To finish, using Eq. 5.34, Eq. 5.35 and the fact that 1 ∈ P pR1+1([0, 1]) and 1 ∈ P pR2

+1([0, 1]),the result follows.

5.4.2 Outflow condition

In order to prove that the method satisfies the outflow condition, it is necessary to show that

• The outflow condition for cell R1 and R2 : see Section 3.5.2,

Page 62 of 85

Page 63: Handling di erent h and p re nements in the framework of

• The outflow condition for cell L representing by :

P θ1→LPL→θ1 + P θ2→LPL→θ2 = I (5.41)

where I is the identity matrix, P θk→L is the operator used in the projection of the fluxof the Mortar θk on the faces and PL→θk is the one used in the projection of the solutionon the Mortar k.

In order to prove the second assertion, it is necessary to remember or introduce the followingnotations

• The solution on the Mortar element θ1 is : φθ1 = PL→θ1QL,

• The solution on the Mortar element θ2 is : φθ2 = PL→θ2QL,

• It is possible to project back the Mortar solution to the cell and to write QL? =P θ1→Lφθ1 + P θ2→Lφθ2 .

It is possible to prove that QL = QL?. By construction, we have∫ 1

0

(φθ1(z)−QL

(1

2+

1

2z

))v(z)dz = 0,∀v ∈ PP1+1 (5.42)∫ 1

0

(φθ2(z)−QL

(1

2z

))w(z)dz = 0,∀w ∈ PP2+1 (5.43)∫ 1

0

(QL?(ξ)− φ(ξ)

)f(ξ)dξ = 0,∀f ∈ P pL+1, (5.44)

with

φ(ξ) =

φθ1(2ξ − 1) if ξ ∈

[12 , 1]

φθ2(2ξ) if ξ ∈

[0, 12] . (5.45)

Using variable changes, Eq. 5.42 and Eq. 5.43 can be written∫ 12

0

1

2

(φθ

2(2ξ)−QL(ξ)

)v(2ξ)dξ = 0 (5.46)∫ 1

12

1

2

(φθ

1(2ξ − 1)−QL(ξ)

)w(2ξ − 1)dξ = 0 (5.47)

∫ 12

0

(φθ

2(2ξ)−QL?(ξ)

)f(ξ)dξ +

∫ 1

12

(φθ

1(2ξ − 1)−QL?(ξ)

)f(ξ)dξ = 0, (5.48)

for all v, w and f ∈ P pL+1.While removing the factor 1

2 in front of Eq. 5.46 and Eq. 5.47, we obtain, for all f ∈ P pL+1,∫ 1

0

(φ(ξ)−QL(ξ)

)f(ξ)dξ = 0, (5.49)

with φ defined in Eq. 5.45.Using Eq. 5.49, we have

(QL −QL?, f

)= 0. Furthermore, QL − QL? ∈ P pL+1 implies the

results.

Page 63 of 85

Page 64: Handling di erent h and p re nements in the framework of

5.5 h− refinement method in 3D

Refining a cell in the three-dimensional case implies the use of four Mortar elements to computethe flux between this cell and its neighbor. As shown in Fig. 5.4, the left cell is refined in eightcells, indeed, there are four subdomains on the face of right cell, which implies the presenceof four Mortar elements between the two cells. It is important to know that, in this work, torefine a cell, each side is cut in its middle, so, in the point 1

2 in the two directions defining theface.

Figure 5.4: Example of h−refinement in 3D

To simplify the study, the right cell is the refined cell and is composed of cells Rk withk ∈ {1, . . . , 4} on the face. The treatment of the Mortar method for the right cells is identical tothe one in the p−refinement case: the solution projection in each Mortar and the flux projectionback to the face are identical because there is a Mortar per cell. So, only cell L treatmentneeds to be described.

A point on the face of cell L is described by its coordinate (η, ξ) ∈ [0, 1] × [0, 1] and weconsider that cell L is oriented as in Fig. 5.4. On this figure, it is possible to see how a Mortarelement is numbered in order to clarify the method description: its number depend on theorientation of cell L and it increases in the direction η and then in the direction ξ.

Figure 5.5: Representation of an example of coordinate systems on Mortar elements and cellL.

As in the 2D case, it is necessary to introduce some notations, some of them being depictedin Fig. 5.5:

Page 64 of 85

Page 65: Handling di erent h and p re nements in the framework of

• θk is the notation for the k − th Mortar element,

• η and ξ represent the coordinates of a point on the face of cell L,

• y and z represent the coordinates of a point on a Mortar element and (y, z) ∈ [0, 1]2,

• o1k permits to get a parametrization of the abscissa of the portion of face opposite to theMortar element k with the equation η = o1k + 1

2y. o1k belongs to {0, 12}. Indeed, if o1k = 0,we get a parametrization of the abscissa of the portion opposite to the Mortar elementsθ1 and θ3 else if o1k = 1

2 , we get a parametrization of the abscissa of the portion oppositeto the Mortar elements θ2 and θ4,

• o2k permits to get a parametrization of the ordinate of the portion of face opposite to theMortar element k with the equation ξ = o2k + 1

2z. o2k belongs to {0, 12}. Indeed, if o2k = 0,

we get a parametrization of the ordinate of the portion opposite to the Mortar elementsθ1 and θ2 else if o1k = 1

2 , we get a parametrization of the ordinate of the portion oppositeto the Mortar elements θ3 and θ4.

With the previous parametrizations, it is possible to combine them to parametrize the portionopposite to any Mortar element. For example, defining η = 1

2y and ξ = 12 + 1

2z, a parametriza-tion of the portion of face opposite to θ3 is obtained.

Moreover, it is also possible to define the solution approximation QL on the face for cell L

QL(η, ξ) =

pL+1∑j1=1

pL+1∑j2=1

QLj1,j2hLj1(η)hLj2(ξ). (5.50)

The solution approximation on the Mortar element k obtained with cell L can be written as

φLk (y, z) =

Pk+1∑n1=1

Pk+1∑n2=1

(φLk)n1,n2

hθkn1(y)hθkn2

(z) (5.51)

with Pk = max(pL, pRk). As in the 2D case, the method occurs in three steps

• Solution projection on the Mortar elements, see Section 5.5.1,

• Flux computation using a Riemann solver,

• Flux projection on the faces, see Section 5.5.2.

The solution projection on the Mortar element and the flux projection on the face will bestudied in the two following sections.

5.5.1 Solution projection on the Mortar elements

As before, the unweighted L2 projection is used to project the solution values from the cell Lto the Mortar element and this projection is performed for each Mortar element k ∈ {1, . . . , 4}:∫ 1

0

∫ 1

0

(QL(o1k +

1

2y, o2k +

1

2z

)− φLk (y, z)

)hθkr1 (y)hθkr2 (z)dydz = 0 (5.52)

Page 65 of 85

Page 66: Handling di erent h and p re nements in the framework of

with r1, r2 ∈ {1, . . . , Pk + 1}. It is possible to remark that only the solution on the portion ofthe face opposite to the Mortar element k is projected on it.Replacing the expression of QL and φLk of Eq. 5.50 and Eq. 5.51, Eq. 5.52 becomes

pL+1∑j1=1

pL+1∑j2=1

QLj1,j2

∫ 1

0

∫ 1

0hLj1

(o1k +

1

2y

)hLj2

(o2k +

1

2z

)hθkr1 (y)hθkr2 (z)dydz =

Pk+1∑n1=1

Pk+1∑n2=1

(φLk)n1,n2

∫ 1

0

∫ 1

0hθkn1

(y)hθkn2(z)hθkr1 (y)hθkr2 (z)dydz,

(5.53)

which can be rewritten as

pL+1∑j1=1

∫ 1

0hLj1

(o1k +

1

2y

)hθkr1 (y)dy

pL+1∑j2=1

QLj1,j2

∫ 1

0hLj2

(o2k +

1

2z

)hθkr2 (z)dz =

Pk+1∑n1=1

∫ 1

0hθkn1

(y)hθkr1 (y)dy

Pk+1∑n2=1

(φLk)n1,n2

∫ 1

0hθkn2

(z)hθkr2 (z)dz

(5.54)

with r1, r2 ∈ {1, . . . , Pk + 1}.This equation can be written in the following matrix form

φLk =(Mk)−1

Sk,yQL(Sk,z)T(Mk)−1

(5.55)

where matrices are defined by(Mk)n1,r1

=

∫ 1

0hθkn1

(y)hθkr1 (y)dy, (5.56)(Sk,y

)r1,j1

=

∫ 1

0hLj1

(o1k +

1

2y

)hθkr1 (y)dy, (5.57)(

Sk,z)j2,r2

=

∫ 1

0hLj2

(o2k +

1

2z

)hθkr2 (z)dz. (5.58)

for all Mortar element k and r1, r2, n1 ∈ {1, . . . , Pk + 1}, j1, j2 ∈ {1, . . . , pL + 1. The flux oncells Rk is computed using the p− refinement case and, thus, once the flux computed, it mustbe projected on the faces.

5.5.2 Flux projection on the faces

The flux projection on the face of cell Rk is described in chapter 3.It is possible to define the flux functions of the Mortar elements as

ψθk =

Pk+1∑l1=1

Pk+1∑l2=1

ψθkl1,l2hθkl1

(y)hθkl2 (z) (5.59)

and on the cell L as

FL =

pL+1∑r1=1

pL+1∑r2=1

FLr1,r2hLr1(η)hLr2(ξ). (5.60)

Page 66 of 85

Page 67: Handling di erent h and p re nements in the framework of

It is important to define ψ the flux values on the union of the Mortar elements

ψ(η, ξ) =

ψθ1(2η, 2ξ) if (η, ξ) ∈

[0, 12]2

ψθ2(2η − 1, 2ξ) if (η, ξ) ∈

[12 , 1]×[0, 12]

ψθ3(2η, 2ξ − 1) if (η, ξ) ∈

[0, 12]×[12 , 1]

ψθ1(2η − 1, 2ξ − 1) if (η, ξ) ∈

[12 , 1]2

. (5.61)

To project the flux, called FL, on cell L, the L2 projection is also used and we obtain thefollowing equation∫ 1

0

∫ 1

0

(FL(η, ξ)− ψ(η, ξ)

)hLj1(η)hLj2(ξ)dηdξ = 0, (5.62)

with j1, j2 ∈ {1, . . . , pL + 1}.Replacing the expression of ψ given in Eq. 5.23 in Eq. 5.62, we obtain∫ 1

2

0

∫ 12

0

(FL(η, ξ)− ψθ1(2η, 2ξ)

)hLj1(η)hLj2(ξ)dηdξ+∫ 1

12

∫ 12

0

(FL(η, ξ)− ψθ2(2η − 1, 2ξ)

)hLj1(η)hLj2(ξ)dηdξ+

∫ 12

0

∫ 1

12

(FL(η, ξ)− ψθ3(2η, 2ξ − 1)

)hLj1(η)hLj2(ξ)dηdξ+∫ 1

12

∫ 1

12

(FL(η, ξ)− ψθ4(2η − 1, 2ξ − 1)

)hLj1(η)hLj2(ξ)dηdξ = 0.

(5.63)

It is possible to take out FL of the integrals and to do the following variable change in Eq. 5.63

• On[0, 12]2

, y = 2η, z = 2ξ and dηdξ = 14dydz,

• On[12 , 1]×[0, 12], y = 2η − 1, z = 2ξ and dηdξ = 1

4dydz,

• On[0, 12]×[12 , 1], y = 2η, z = 2ξ − 1 and dηdξ = 1

4dydz,

• On[12 , 1]2

, y = 2η − 1, z = 2ξ − 1 and dηdξ = 14dydz,

to get∫ 1

0

∫ 1

0FL(η, ξ)hLj1(η)hLj2(ξ)dηdξ =

1

4

∫ 1

0

∫ 1

0ψθ1(y, z)hLj1

(1

2y

)hLj2

(1

2z

)dydz+

1

4

∫ 1

0

∫ 1

0ψθ2(y, z)hLj1

(1

2y +

1

2

)hLj2

(1

2z

)dydz+

1

4

∫ 1

0

∫ 1

0ψθ3(y, z)hLj1

(1

2y

)hLj2

(1

2z +

1

2

)dydz+

1

4

∫ 1

0

∫ 1

0ψθ4(y, z)hLj1

(1

2y +

1

2

)hLj2

(1

2z +

1

2

)dydz.

(5.64)

Page 67 of 85

Page 68: Handling di erent h and p re nements in the framework of

Replacing expression of FL given in Eq. 5.60 and of ψθk given in Eq. 5.59 in Eq. 5.64, we get

pL+1∑r1=1

∫ 1

0hLr1(η)hLj1(η)dη

pL+1∑r2=1

FLr1,r2

∫ 1

0hLr2(ξ)hLj2(ξ)dξ =

4∑k=1

1

4

Pk+1∑l1=1

∫ 1

0hθkl1 (y)hLj1

(o1k +

1

2y

)dy

Pk+1∑l2=1

ψθkl1,l2

∫ 1

0hθkl2 (z)hLj2

(o2k +

1

2z

)dz

(5.65)

with j1, j2 ∈ {1, . . . , pL + 1} and o1k, o2k defined previously.

This equation can be written in the following matrix form

FL = (ML)−1

(4∑

k=1

S1,kψθkS2,k

)(ML)−1 (5.66)

with

(ML

)r1,j1

=

∫ 1

0hLr1(η)hLj1(η)dη, (5.67)(

S1,k)j1,l1

=1

2

∫ 1

0hθkl1 (y)hLj1

(o1k +

1

2y

)dy, (5.68)(

S2,k)l2,j2

=1

2

∫ 1

0hθkl2 (z)hLj2

(o2k +

1

2z

)dz (5.69)

with l1, l2 ∈ {1, . . . , Pk + 1} and r1, j1, j2 ∈ {1, . . . , pL + 1}.

Now, it is necessary to study the properties of the L2 projection in the three-dimensionalcase.

5.6 Properties and stability of the mesh refinement projectionsin 3D

In the three dimensional case, it is always possible to prove that the method permits to get anapproximation which satisfies the outflow condition and the flux conservation. Some ideas ofthe proofs will be given in the following subsections.

Flux conservation

The principle to prove the flux conservation is identical to the one of the two-dimensional case.A difference is in the fact that, now, the flux FR is defined as

FR(η, ξ) =

FR1(2η, 2ξ) if (η, ξ) ∈[0, 12]2

FR2(2η − 1, 2ξ) if (η, ξ) ∈[12 , 1]×[0, 12]

FR3(2η, 2ξ − 1) if (η, ξ) ∈[0, 12]×[12 , 1]

FR4(2η − 1, 2ξ − 1) if (η, ξ) ∈[12 , 1]2

. (5.70)

Page 68 of 85

Page 69: Handling di erent h and p re nements in the framework of

and this expression permits to get the equality between∫ 1

0

∫ 1

0FL(η, ξ)dηdξ and

∫ 1

0

∫ 1

0FR(η, ξ)dηdξ

using the fact that, by construction, we have(FL − ψ, u

)= 0, (5.71)(

FR1 − ψθ1 , v)

= 0, (5.72)(FR2 − ψθ2 , w

)= 0, (5.73)(

FR3 − ψθ3 , g)

= 0, (5.74)(FR4 − ψθ4 , f

)= 0, (5.75)

where ψ is the function defined in Eq. 5.61 and with u ∈ P pL+1([0, 1]2), v ∈ P pR1+1([0, 1]2),

w ∈ P pR2+1([0, 1]2), g ∈ P pR3

+1([0, 1]2) and f ∈ P pR4+1([0, 1]2).

As in the 2D case, the proof is finished in using variable changes.

Outflow condition

In three dimension, two assertions must be proved in order to get a method which satisfies theoutflow condition

• Outflow condition for cells Rk,

• Outflow condition for cell L by proving

4∑k=1

P θk→L1 PL→θk1 = I, and

4∑k=1

P θk→L2 PL→θk2 = I,

where I is the identity matrix.

The operators P θk→L1 and P θk→L2 are used to project the flux on the face for the first and the

second ordinates respectively; the operators PL→θk1 and PL→θk2 are used to project the solutionon the Mortars elements for the first and the second ordinates respectively.The outflow condition for cells Rk is proved in Chapter 3. For cell L, the main ideas of theproof will be given, for that, some notations are introduced

• The solution on the Mortar element k is : φθk = PL→θk1 QLPL→θk2 ,

• After projection back on the cell face of the Mortar solutions, it is possible to write the

solution on cell L as : QL? =4∑

k=1

P θk→L1 ψθkP θk→L2 .

Page 69 of 85

Page 70: Handling di erent h and p re nements in the framework of

Proving the outflow condition is equivalent to prove that QL = QL?. By construction, we have∫ 1

0

∫ 1

0

(φθ1(y, z)−QL

(1

2y,

1

2z

))v(y, z)dydz = 0, (5.76)∫ 1

0

∫ 1

0

(φθ2(y, z)−QL

(1

2y +

1

2,1

2z

))w(y, z)dydz = 0, (5.77)∫ 1

0

∫ 1

0

(φθ3(y, z)−QL

(1

2y,

1

2z +

1

2

))u(y, z)dydz = 0, (5.78)∫ 1

0

∫ 1

0

(φθ4(y, z)−QL

(1

2y +

1

2,1

2z +

1

2

))g(y, z)dydz = 0, (5.79)∫ 1

0

∫ 1

0

(QL?(η, ξ)− φ(η, ξ)

)f(η, ξ)dηdξ = 0, (5.80)

with

φ(η, ξ) =

φθ1(2η, 2ξ) if (η, ξ) ∈[0, 12]2

φθ2(2η − 1, 2ξ) if (η, ξ) ∈[12 , 1]×[0, 12]

φθ3(2η, 2ξ − 1) if (η, ξ) ∈[0, 12]×[12 , 1]

φθ4(2η − 1, 2ξ − 1) if (η, ξ) ∈[12 , 1]2

. (5.81)

Inspired by the 2D case, i.e. for example using variable changes, we have(QL −QL?

)= 0 and

the result follows considering that QL −QL? ∈ P pL+1([0, 1]2

).

The h−refinement method has been implemented in JAGUAR but the work is not totallyfinished, thus, it will not be presented in this report.

Page 70 of 85

Page 71: Handling di erent h and p re nements in the framework of

Chapter 6

Conclusion

6.1 Status of current work

In this work, we have studied two ways to the minimize CPU cost of a CFD simulation usingSD method. These ways consists in coupling SD method with an automatic process for meshand solution refinements. In addition to the decrease in CPU time , a refinement in polynomialdegree p enables an increase in accuracy when the flow is smooth and a spatial refinement bydividing the initial cell (h− refinement) is preferred near shocks. The first step to handle hand p refinements is to deal with the direct solver, assuming that h− and p− refinements areever provided. This training period consists in introducing a Mortar approach in order to dealwith those refinements.

The results obtained for the p− refinement show that the Mortar approach is implementedand validated for both 2D and 3D flows. Even if the implementation is not optimized, theuse of p− refinement permits a gain of 20 to 40 percents in time and it can be improved. Forthe h− refinement, all theoretical aspects have been carried out and only implementation andvalidation haven’t been finished.

6.2 Future developments

The first work consists in finishing the developments regarding the h− refinement. But evenwhen the code will run, all developments will not be finished for this refinement. In practice,handling the mesh refinement can be performed in two ways. First, one can define a meshfor each refinement level. But using a classical mesh definition is perhaps not the best way towork. Actually, such an approach doesn’t keep the history of refinement. Another drawbackconcerns the definition of mesh nodes. With the h− refinement, new mesh nodes are addedat the mid edges and projected on the geometry if necessary. These new nodes may not becompliant with the high order description of mesh elements. In particular, mid edges are onlyaccounted for when p is even. Finally, another way to proceed may be to couple a classicalmesh description with an octree approach.

This work focuses on Euler equations and this work must be extended to the Navier-Stokesequations. For the diffusion terms, everything depends on the underlying diffusion scheme.A classical approach to compute diffusion flux follows BR2 scheme [3]: from the solutionpolynomials, one builds the gradients in the solution points and then defines the polynomialrepresentation for gradients variations. These polynomials are defined to build extrapolationsof gradients on the cell boundary. The BR2 scheme blends a component based on gradient

Page 71 of 85

Page 72: Handling di erent h and p re nements in the framework of

averaging with a lifting operator based on direct quantities. Extending Mortar approach togradients is easy: one considers each gradient quantity as a new variable. Finally, extendingto the Navier-Stokes equations does not present any theoretical difficulty.

The last point of importance concerns the mesh. The SD approach is well defined forhexahedra and our implementation takes into account the three privileged space directions.However, accounting for multi element shapes is a good extension: many meshers can provide“hybrid meshes” composed of tetrahedra, hexahedra, prisms and pyramids. To do so, thesolution is to upgrade the SD approach to the Correction Procedure via Reconstruction (CPR)method. This new method gives a framework to unify DG and SD methods. Moreover, in theliterature, the CPR method is said to be more efficient that the SD method, especially becauseextrapolation and derivation are not anymore needed.

Finally, the use of adaptive refinements is possible once error estimates are available. Simpleerror estimates can be computed from solution Hessian, as in the Flow-Feature mesh adaptationprocedure. The refinement is performed in the whole computational domain and not accordingto the computation of a quantity, as in the Goal Oriented adaptation procedure. But the latesttechniques needs to implement and to solve an adjoint problem.

Page 72 of 85

Page 73: Handling di erent h and p re nements in the framework of

Bibliography

[1] CFD General Notation System. http://www.cgns.org.

[2] E. Anderson, Z. Bai, C. Bischof, S. Blackford, J. Demmel, J. Dongarra, J. Du Croz,A. Greenbaum, S. Hammarling, A. McKenney, and D. Sorensen. LAPACK Users’ Guide.Society for Industrial and Applied Mathematics, Philadelphia, PA, third edition, 1999.

[3] F. Bassi, S. Rebay, G. Mariottu, S. Pedinotti, and M. Savini. A high-order accurateDiscontinuous Finite Element method for inviscid and viscous turbomachinery flows. InR. Decuypere and G. Dibelius, editors, In 2nd European Conference on TurbomachineryFluid Dynamics and Thermodynamics, pages 99–108, Antwerpen, Belgium, March 5-7,1997.

[4] J. Berland, C. Bailly, and C. Bogey. Low-dissipation and low-dispersion fourth-orderRunge-Kutta algorithm. Computers and Fluids, 35:1459–1463, 2006.

[5] A. Cassagne. Optimisation de JAGUAR pour les accelerateurs de calculs. Master’s thesis,Universite Bordeaux 1 and Cerfacs, 2013.

[6] C. Geuzaine and J.-F. Remacle. Gmsh: a three-dimensional finite element mesh genera-tor with built-in pre- and post-processing facilities. International Journal for NumericalMethods in Engineering, 79(11):1309–1331, 2009.

[7] A. Jameson. A proof of the stability of the spectral difference method for all orders ofaccuracy. Journal of Scientific Computing, 45:348–358, 2010.

[8] D.A. Kopriva. A conservative staggered-grid Chebyshev multidomain method for com-pressible flows. ii: A semi-structured method. ICASE Rept. 96-15, 1996.

[9] D.A. Kopriva. A conservative staggered-grid Chebyshev multidomain method for com-pressible flows. ii. a semi-structured method. Journal of Computational Physics, 128:475–488, 1996.

[10] D.A. Kopriva and J.H. Kolias. Technical report, ICASE, Report 95-18 and NASA Con-tractor Report 195060, 1995.

[11] D.A. Kopriva and J.H. Kolias. A conservative staggered-grid Chebyshev multidomainmethod for compressible flows. Journal of Computational Physics, 125:244–261, 1996.

[12] M. Kuzmin. Spectral difference method for the Euler equations on unstructured grids.Rapport de stage de fin d’etudes d’ingenieur - isae supaero, September 2012.

Page 73 of 85

Page 74: Handling di erent h and p re nements in the framework of

[13] Y. Li, S. Premasuthan, and A. Jameson. Comparison of h- and p- adaptations for spectraldifference methods. In 40th Fluid Dynamics Conference and Exhibit 28 June - 1 July,Chicago, Illinois, AIAA Paper 2010-4435, 2010.

[14] Y. Liu, M. Vinokur, and Z.J. Wang. Spectral difference method for unstructured grids i:Basic formulation. Journal of Computational Physics, 216:780–801, 2006.

[15] P.L. Roe. Approximate Riemann solvers, parameter vectors, and difference schemes.Journal of Computational Physics, 43:357–372, 1981.

[16] L. Shi and Z.J. Wang. Adjoint-based error estimation and hp-adaptation for the high-order CPR method. In 51st AIAA Aerospace Sciences Meeting including the New HorizonsForum and Aerospace Exposition 07 - 10 January, Grapevine (Dallas/Ft. Worth Region),Texas, 2013.

[17] Y. Sun, Z.J. Wang, and Y. Liu. High-order multidomain spectral difference methodfor the Navier-Stokes equations on unstructured hexahedral grids. Communications inComputational Physics, 2:310–333, 2007.

[18] E.L. Toro. Riemann solvers and Numerical Methods for Fluid Dynamics. 1999.

[19] K. Van den Abeele, C. Lacor, and Z.J. Wang. On the stability and accuracy of the spectraldifference method. Journal of Scientific Computing, 37:162–188, 2008.

[20] O.C. Zienkiewicz. The Finite Element Method. Mc Graw-Hill Book Company, 1977.

Page 74 of 85

Page 75: Handling di erent h and p re nements in the framework of

Chapter A

p− refinement method: Application on an example

This chapter is dedicated to explanations of the p−refinement approach on an example, fol-lowing theoretical explanations from Chap. 3. We will analyze the choices of interpolation forthe solution projection and of unweighted projection for the flux projection.

A.1 Projection of the solution values

Some coefficients of the matrix M , of the matrix SL and of hLj (X l) are calculated in order toshow the equivalence between the two methods.The case considered is the following : pL equals 1 and pR equals 2, so, there are two points onthe face of cell L and three on the face of cell R. The sizes of the matrix are (3, 3) for M , (3, 2)for SL and thus, (3, 2) for J . The comparison between the coefficients (l, j) of J and hLj (X l)is possible calculating the following integrals∫ 1

0hθ1(y)hθ1(y)dy =

∫ 1

0

(y −X2

X1 −X2

y −X3

X1 −X3

)2

dy,

∫ 1

0hθ1(y)hθ2(y)dy =

∫ 1

0

y −X2

X1 −X2

y −X3

X1 −X3

y −X1

X2 −X1

y −X3

X2 −X3

dy,∫ 1

0hθ1(y)hθ3(y)dy =

∫ 1

0

y −X2

X1 −X2

y −X3

X1 −X3

y −X1

X3 −X1

y −X2

X3 −X2

dy,

∫ 1

0hθ2(y)hθ2(y)dy =

∫ 1

0

(y −X1

X2 −X1

y −X3

X2 −X3

)2

dy,∫ 1

0hθ2(y)hθ3(y)dy =

∫ 1

0

y −X1

X2 −X1

y −X3

X2 −X3

y −X1

X3 −X1

y −X2

X3 −X2

dy,

∫ 1

0hθ3(y)hθ3(y)dy =

∫ 1

0

(y −X1

X3 −X1

y −X2

X3 −X2

)2

dy

to get M−1, because it is a symmetric matrix and in the same way, calculating these integrals∫ 1

0hL1 (y)hθ1(y)dy,

∫ 1

0hL1 (y)hθ2(y)dy,

∫ 1

0hL1 (y)hθ3(y)dy,

∫ 1

0hL2 (y)hθ1(y)dy,

∫ 1

0hL2 (y)hθ2(y)dy,

∫ 1

0hL2 (y)hθ3(y)dy

Page 75 of 85

Page 76: Handling di erent h and p re nements in the framework of

to get SL with as smaller order flux points Xj ∈ {0.1464, 0.8535} and as higher order fluxpoints X l ∈ {6.70.10−2, 0.4999, 0.9330} in the direction of the face of the cell L. We canremark that the matrix M is composed of polynomial bases integrals, that is why it is veryprobable that this matrix is invertible. It is possible to prove that for an order lower or equalsto five, the matrix is a symmetric positive definite matrix. After integrals calculations andmatrix M inversion using Matlab, we obtain

M '

0.2 0.0444 −0.02220.0444 0.4667 0.0444−0.0222 0.0444 0.2

and SL '

0.2472 −0.02500.2778 0.2778−0.025 0.2472

.

Thus, the following matrix J is obtained

J '

1.1124 −0.11240.5001 0.5001−0.1124 1.1124

.

Now, it remains to calculate the coefficients hLj (X l) using Eq. 2.12 ,i.e.

hL1 (X1) =X1 −X2

X1 −X2= 1.1124, hL2 (X1) =

X1 −X1

X2 −X1= −0.1124,

hL1 (X2) =X2 −X2

X1 −X2= 0.5001, hL2 (X2) =

X2 −X1

X2 −X1= 0.5001,

hL1 (X3) =X3 −X2

X1 −X2= −0.1124, hL2 (X3) =

X3 −X1

X2 −X1= 1.1124.

So, these coefficients depending on the indices j and l practically equals to the coefficients (l, j)of the matrix J . The difference comes from the numerical errors in integral computations andin the matrix inversion to compute M , S and J .For convenience, the projection coefficients are placed in a matrix

H =

1.1124 −0.11240.5001 0.5001−0.1124 1.1124

.

A.2 Projection of the flux on faces

It is possible to compute the matrix coefficients of the projection method and the interpolationcoefficients for the flux projection.Going back to the previous example, the calculations of the matrices M and S involve thecalculation of the following integrals∫ 1

0hL1 (y)hL1 (y)dy =

∫ 1

0

(y −X2

X1 −X2

)2

dy,

∫ 1

0hL1 (y)hL2 (y)dy =

∫ 1

0

y −X2

X1 −X2

y −X1

X2 −X1dy

Page 76 of 85

Page 77: Handling di erent h and p re nements in the framework of

∫ 1

0hL2 (y)hL2 (y)dy =

∫ 1

0

(y −X1

X2 −X1

)2

dy

to obtain M , because it is a symmetric matrix and S is the transposition of the matrix SL

defined in the previous section. As for the solution projection, it is probable that the matrixM will be invertible because it is composed of polynomials bases integrals. After calculatingand inverting the matrix ML, we obtain

ML '(

0.4167 0.08330.0833 0.4167

)and S '

(0.2472 0.2777 −0.025−0.025 0.2758 0.2472

).

Thus,

L '(

0.6305 0.5556 −0.1860−0.1860 0.5556 0.6305

).

Secondly, the coefficients of hθk(Xj) are the following

hθ1(X1) =X1 −X2

X1 −X2

X1 −X3

X1 −X3

= 0.7416, hθ1(X2) =X2 −X2

X1 −X2

X2 −X3

X1 −X3

= −7.491× 10−2,

hθ2(X1) =X1 −X1

X2 −X1

X1 −X3

X2 −X3

= 0.3333, hθ2(X2) =X2 −X1

X2 −X1

X2 −X3

X2 −X3

= 0.3333,

hθ3(X1) =X1 −X1

X3 −X1

X1 −X2

X3 −X2

= −7.491× 10−2, hθ3(X2) =X2 −X1

X3 −X1

X2 −X2

X3 −X2

= 0.7416,

For convenience, it is possible to define the matrix of these coefficients

K =

(0.7416 0.3333 −7.491× 10−2

−7.491× 10−2 0.3333 0.7416

).

The calculations of these integrals and of these coefficients don’t permit to give conclusionsclose to the ones of the projection of the solution on the mortar. The coefficients of the matrixL and the coefficients hθk(Xj) can’t be identified. In the following section, the proof (on thesame example) that the approximation using interpolations is not conservative is given, thatis why, this method will not be used to project the flux on the faces.

A.3 Flux conservation

As shown previously, the projection method is conservative. In order to see if the interpolationmethod permits to get flux conservation, it is possible to return to the previous example, tocalculate the integral in Eq. 3.12 for the two methods and to compare the results.

First, the interpolation method is studied. Expressions of FL and FR habe ever been givenusing the mortar flux ψ and the points Xj with j ∈ {1, . . . , pL} as

FL(y) =

pL+1∑j=1

FLj hLj (y), (A.1)

FR(y) =P+1∑k=1

ψkhθk(y) (A.2)

Page 77 of 85

Page 78: Handling di erent h and p re nements in the framework of

where hθ and hL are defined as previously.Using the expression of FLj with the interpolation coefficients, Eq. A.1 can be written as

FL(y) =

pL+1∑j=1

(P+1∑k=1

hθk(Xj)ψk

)hLj (y), (A.3)

Now, in order to show the flux conservation, using Eq. A.3 and Eq. A.2, the integral in Eq. 3.12can be decomposed into the two following integrals

∫ 1

0

pL+1∑j=1

(P+1∑k=1

hθk(Xj)ψk

)hLj (y)dy =

∫ 1

0

P+1∑k=1

ψkhθk(y)dy. (A.4)

These integrals can be computed as functions of ψk and the coefficients in front of each ψk fork ∈ {1, . . . , P + 1} have to be identical for the two cells to get conservation.First, the computation of the right side of Eq. A.4 is done.

∫ 1

0

P+1∑k=1

ψkhθk(y)dy =

P+1∑k=1

ψk

∫ 1

0hθk(y)dy.

In the previous example, the maximal order equals two, that implies the need to compute threeintegrals ∫ 1

0hθ1(y)dy =

∫ 1

0

y − 0.4999

0.0670− 0.4999

y − 0.9333

0.0670− 0.9330dy = 0.2222,

∫ 1

0hθ2(y)dy =

∫ 1

0

y − 0.0670

0.4999− 0.0670

y − 0.9333

0.4999− 0.9330dy = 0.5556,

∫ 1

0hθ3(y)dy =

∫ 1

0

y − 0.0670

0.9330− 0.0670

y − 0.4999

0.9330− 0.4999dy = 0.2222,

which implies the following expression of the integral

∫ 1

0FR(y)dy = 0.2222ψ1 + 0.5555ψ2 + 0.2222ψ3. (A.5)

These coefficients are now considered as reference coefficients. They will be compared withthe ones from the flux interpolation method and the ones from the flux projection method. Incoefficients are recovered, conservation is proved.

The second step is to computate the left side of Eq. A.4:

Page 78 of 85

Page 79: Handling di erent h and p re nements in the framework of

∫ 1

0

pL+1∑j=1

(P+1∑k=1

hθk(Xj)ψk

)hLj (y)dy =

pL+1∑j=1

(P+1∑k=1

hθk(Xj)ψk

)∫ 1

0hLj (y)dy

=

pL+1∑j=1

(hθ1(Xj)ψ1 + hθ2(Xj)ψ2 + hθ3(Xj)ψ3

)∫ 1

0hLj (y)dy

=(hθ1(X1)ψ1 + hθ2(X1)ψ2 + hθ3(X1)ψ3

) ∫ 1

0hL1 (y)dy+

(hθ1(X2)ψ1 + hθ2(X2)ψ2 + hθ3(X2)ψ3

) ∫ 1

0hL2 (y)dy

= (0.7416ψ1 + 0.3333ψ2 − 0.07491ψ3)

∫ 1

0hL1 (y)dy+

(−0.07491ψ1 + 0.3333ψ2 + 0.7416ψ3)

∫ 1

0hL2 (y)dy,

where ∫ 1

0hL1 (y)dy =

∫ 1

0

y − 0.8535

0.1464− 0.8535dy = 0.4999 and

∫ 1

0hL2 (y)dy =

∫ 1

0

y − 0.1464

0.8535− 0.1464dy = 0.5001.

Replacing these integrals in the previous equation, the coefficients obtained are∫ 1

0FL(y)dy = 0.3333ψ1 + 0.3334ψ2 + 0.3333ψ3. (A.6)

It is possible to remark that the coefficients in front of ψ are not identical to the ones inEq. A.5, that is why the interpolation method is not conservative.

Now, we focus on the projection method and the expression of FL is the following

FLi =

P+1∑k=1

pL+1∑j=1

(ML)−1i,j Sj,kψk, (A.7)

with i ∈ {1, . . . , pL + 1}. Thus, the decomposition of the integral in Eq. 3.12 for the secondmethod gives the following expression

∫ 1

0

pL+1∑i=1

P+1∑k=1

pL+1∑j=1

(ML)−1i,j Sj,kψkhLi (y)dy =

∫ 1

0

P+1∑k=1

ψkhθk(y)dy. (A.8)

Page 79 of 85

Page 80: Handling di erent h and p re nements in the framework of

The left part of the expression can be written as∫ 1

0FL(y)dy =

∫ 1

0

pL+1∑i=1

P+1∑k=1

pL+1∑j=1

(ML)−1i,j Sj,kψkhLi (y)dy

=

pL+1∑i=1

P+1∑k=1

pL+1∑j=1

(ML)−1i,j Sj,kψk

∫ 1

0hLi (y)dy

=

pL+1∑i=1

(0.6305 0.5556 −0.1860−0.1860 0.5555 0.6305

) ψ1

ψ2

ψ3

∫ 1

0hLi (y)dy

= (0.6305ψ1 + 0.5556ψ2 − 0.1860ψ3)

∫ 1

0hL1 (y)dy+

(−0.1860ψ1 + 0.5556ψ2 + 0.6305ψ3)

∫ 1

0hL2 (y)dy

= 0.2222ψ1 + 0.5556ψ2 + 0.2222ψ3

Conservation is finally proved for the projection method.

A.4 Outflow condition

It is possible to show that the two methods satisfy the outflow condition on the previousexample. Indeed, according to the considered method, it is necessary to show

• For the projection method : LJ = I where J and L are the matrices computed in Section3.3 and Section 3.4 and I is the identity.

• For the interpolation method : KH = I where K is the matrix computed in Section 3.4and H equals to the coefficients matrix of the interpolation of the solution on the mortar.

Now, the computations on the same example can be done.In the first case, it gives

LJ =

(0.6305 0.5556 −0.1860−0.1860 0.5556 0.6305

) 1.1124 −0.11240.5001 0.5001−0.1124 1.1124

=

(1 1.10−7

1.10−7 1

).

It seems to be equaled to the identity forgiven the rounding errors.For the interpolation method, the computation gives

KH =

(0.7416 0.3333 −7.491× 10−2

−7.491× 10−2 0.3333 0.7416

) 1.1124 −0.11240.5001 0.5001−0.1124 1.1124

=

(1.00003 −0.00001−0.00001 1.00003

).

So, for all methods, the outflow condition is satisfied.

Page 80 of 85

Page 81: Handling di erent h and p re nements in the framework of

Chapter B

Implementation of p− refinement method in JAGUAR

B.1 Introduction

The goal of this chapter is to focus attention on implementation of variable p approach insideJAGUAR . Of course, the first important point is to assign a value of p to each mesh cell andthis is performed by reading a dedicated file.

The mortar method has incidence on the pretreatment and the flux computation on theinterface. For the first one, some coefficients must be computed for all orders. These coefficientsare needed for the solution interpolation on the mortar element and for the flux projection onthe interfaces. For the second one, on the cell face, there are p + 1 flux points which can belocated according to their (global) coordinates in the mesh. For the use of Roe’s scheme, it isnecessary to know the solution values in each border flux points of the two neighboring cells andthese flux points must be in face-to-face. It is important to remark that, in the code, for eachface, a cell is defined as the left cell and their opposite is the right cell. All interface treatmentare performed according to the reference left cell index directions and a transformation matrixpermits to find, for a given point on cell L, their opposite on cell R according to its coordinatesystem (Sec. 2.3.6). In the following sections, these points will be detailed.

B.2 Coefficients computation

As said in the theoretical description of the method, two kinds of methods are used: the inter-polation method and the projection method. The first is used when the solution is projected onthe mortar element, so, the solution values are extrapolated in the maximum order flux points.The second is used for the flux projection on the faces in order to keep local flux conservationon the interface. The less expensive and more efficient way to implement both methods is tocompute in the pre processing step all coefficients needed and to store them.

B.2.1 Interpolation coefficients

The theoretical analysis shows that for the two-dimensional case, it is possible to compute forj ∈ {1, . . . q + 1} and l ∈ {1, . . . p + 1}, hLj (X l) for all p and q lower than a fixed maximumorder and for p always higher than q. These coefficients are stored in a global vector and theycan be called anywhere in the program.

For the three-dimensional case, for all p and q lower than the maximum order, othercoefficients are computed: hLj (X l)h

Lk (Xn) for all j, k ∈ {1, . . . q + 1} and n, l ∈ {1, . . . p + 1}.

These coefficients are stored in a vector and the coefficient hLj (X l)hLk (Xn) is called using the

Page 81 of 85

Page 82: Handling di erent h and p re nements in the framework of

indices (n− 1)× (p+ 1) + l and (k− 1)× (q+ 1) + j in order to get a method independentof the dimension.

B.2.2 Projection coefficients

It is not so easy to get a method independent of the dimension with the projection method.Indeed, as seen in the description of the theoretical method, in the two-dimensional case, amatrix-matrix product is necessary. So, storing the coefficients of this matrix and doing theproduct of this coefficients to the flux vector is sufficient to effect the projection. But, in thethree-dimensional case, it is necessary to effect two matrix-matrix products. Thus, two kindsof coefficients are stored, the left and the right coefficients which must been multiplied to theflux vector at left and at right.

Two dimensional case

Remember that, these two matrices must be computed

MLj,m =

∫ 1

0hLj (y)hLm(y)dy and Sm,k =

∫ 1

0hθk(y)hLm(y)dy,

with• j,m ∈ {1, . . . p+ 1} and k ∈ {1, . . . q + 1},• p lower or equals to q in order to get the coefficients L(j, k) = (ML)−1j,mSm,k.

The Gauss quadrature presented in Section 3.6 is used to compute those integrals. First,one computes hLj (yi1)h

Lm(yi1) and hθk(yi2)h

Lm(yi2) for all quadrature points yi1 and yi2 with

i1 ∈ {1, . . . , 2p+12 } and i2 ∈ {1, . . . , p+q+1

2 }. The value hθk(yi2)hLm(yi2) is computed for all

orders p and q, then, it is stored in a vector depending on orders, k and m. The final valueof the integrals is obtained by multiplying those values by the Gauss quadrature weights everstored in the program. In practice, matrices M and S are stored. The last step concerns thesolution of the the linear system ML = S. Instead of developing our own procedure, we usethe Fortran 90 version of LAPACK library (Linear Algebra PACKage) [2] and more preciselythe function DGESV. The coefficients of the obtained matrix are stored in a vector, which isused in the flux projection on the face.

Three-dimensional case

It is important to remember the equation to obtain the flux on the face FL as a function ofthe one on the mortar element ψ: FL = (ML)−1SψS(ML)−1 with:

ML(j,m) =

∫ 1

0hLj (y)hLm(y)dy, ML(k, r) =

∫ 1

0hLk (z)hLr (z)dz,

S(m, l) =

∫ 1

0hθl (y)hLm(y)dy and S(n, r) =

∫ 1

0hθn(z)hLr (z)dz.

These matrices must be computed, but it is possible to remark that ML = ML and S = St ifthe same quadrature points are used, and it is the case in this work. Thus, only two matricesmust be computed and stored. Moreover, the integrals computation is identical to the two-dimensional case because they can be split as the product of two one-dimensional integrals.

Page 82 of 85

Page 83: Handling di erent h and p re nements in the framework of

Two sorts of coefficients are stored, first the coefficients of the matrix (ML)−1S, secondly,the ones of the matrix S(ML)−1 i.e. St(ML)−1. The first ones can be computed as in the 2Dconfiguration. To get the second one, the inverse of the matrix M is computed using two func-tions of the LAPACK library: DGETRF and DGETRI. The first gives the LU decompositionof the matrix M , the second uses this decomposition to compute the inverse of M . Then, thetransposition of S is computed and to obtain the right part coefficients, the product St(ML)−1

is performed and stored. Note that the function DGETRI of LAPACK is called twice: the firstcall permits to obtain the optimal coefficients which must be used in the second function call.

B.3 Solution interpolation on border flux points

As said previously, the border flux points of the two cells must be in face-to-face in order tocompute the flux on them with the Roe scheme. Once this is done, it is possible to definetwo vectors, one for the cell L and one for the cell R, which contain the values of the solutionin the border flux points, called respectively primitiveL and primitiveR. Concretely, thesolution values are stored in a vector according to the global solution points location in themesh (considering variable orders). For a face with two different values of p, the number offlux points varies in primitiveL and primitiveR, leading to a non alignment of the data inmemory. To prevent this fact, the number of flux points for a given face are always chosenaccording to the maximum polynomial degree of the two cells that share the face. In practice,the mortar method doesn’t consist in introducing a new element for each face but in initializingthe mentioned vectors with the good size and filling them with the interpolated solution.

For example, referring to Fig. 3.5, the first component of the vector primitiveL containsthe solution values extrapolated from the three square flux points of cell L to the first circle fluxpoints on the mortar element. The first component of primitiveR contains the solution valuesof the fourth circle flux points of cell R because they are stored according to the orientationof cell L.

Finally, the last question concerns the storage of the solution inside primitiveL and prim-itiveR containers. This point is addressed in the following subsections.

B.3.1 Cell L is the lower order cell

An interface in the mesh is considered and it is assumed that the order of the neighboring cellis known as well as their flux points location. In this case, it is assumed pL < pR. FollowingSD method, the knowledge of the polynomial order and of the kind of solution points is theonly information needed to define the flux points on the face. The treatment needs severalsteps:

1. Solution values are extrapolated in the boundary flux points of cell L and they are storedin a buffer vector according to their local positions (depending on the cell order) on theface.

2. Using the interpolation coefficients, the solution at the interface is extrapolated from theflux points associated with pL to new flux points associated with the maximum orderflux points (issued from cell R).

3. The solution is stored in the vector primitiveL, taking care of global positions on theinterface.

Page 83 of 85

Page 84: Handling di erent h and p re nements in the framework of

4. The solution values of cell R are stored in primitiveR. For that, for each maximum orderflux points on cell L, their opposite on cell R is found with the matrix transformationmentioned in Sec. 2.3.6.

To resume, at cell L, the algorithm is based on a data manipulation according to differentreference frames: the mesh frame, the low order face frame, the high order face frame, theglobal face frame. This principle can be resumed by the scheme in Fig. B.1.

Figure B.1: Diagram showing the data manipulation during the solution extrapolation to themortar.

B.3.2 Cell L is the higher order cell

The principle is the same that in the previous case, but one needs to take care of the trans-formation matrix to define properly the position of the flux points for primitiveR: data arearranged according to the matrix transformation and cell L is defined as a reference. Note thatthis transformation is purely driven by directions inside the cell and not by the polynomialdegree representation for any quantity.

B.4 Flux computation

Once primitiveL and primitiveR tables are filled, the flux is computed for each componentof the vectors. An interface flux point is located at the same level in both tables. The lastpoint of interest regarding flux computation concerns the definition of the normal vector: thenormal vector is computed using Jacobian of the isoparametric transformation of the maximumpolynomial degree cell.

B.5 Flux projection on the border flux points

Once the flux is computed, it needs to be projected onto the original flux points for the sidewith the lowest polynomial degree.The global principle for data manipulation is described inFig. B.2 . The key point remains to use and compute data in the same local order on the face.At this step, the flux computed and stored in a face-based array is transferred in a new fluxarray based on a cell-based formalism. This is to be able to define easily the flux polynomialand its derivative in the solution points to time march the equations.

Page 84 of 85

Page 85: Handling di erent h and p re nements in the framework of

Figure B.2: Diagram showing the data manipulation during the flux projection on the face.

B.6 Boundary conditions and parallel treatment

The treatment introduced up-to now only concerns internal faces computed by the same com-putational core. This section addresses the boundary faces and parallel issues.

All computations are performed on the COVO test case, with periodic conditions. Periodicconditions are treated in JAGUAR as translation / rotations joins: they are numerical boundaryconditions and not physical boundary conditions.

For parallel issue, the local treatment is based on an exchange of the extrapolated quantitiesin the flux points according to the maximum polynomial order. This choice is motivated by thepossibility to exchange data arrays with the same size between two domains sharing a list offaces. Once those quantities are available, the flux computation is performed using primitiveLand primitiveR arrays. The last point concerns the local projection of the fluxes on the trueinterface flux points, according to the current polynomial degree. In particular, if the facepolynomial degree is higher than the cell degree, the flux is projected onto the flux points.

As a consequence, all fluxes for join interfaces are computed twice on two different pro-cessors and the key point is the exchange of variables interpolated in the flux points locatedaccording the maximum value of the polynomial degree. It is therefore also necessary to ex-change the polynomial degrees during a pre processing step.

Page 85 of 85