finite volume methods - "esercizi e...

Post on 26-Jul-2020

2 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Outline

Contents:

• part 1: an informal introduction to Finite Volume Methods(FVMs);

• part 2: application to steady transport problems inconvection-dominated regimes and layer calculation;

Other collaborations:

• application to strongly anisotropic diffusion models: the locking effect(joint work with M. Putti);

• application to partially saturated multi-layered soils: mass conservation(joint work with. S. Ferraris);

The basic model problem:the convection-diffusion equation

• Find a function u(x , t) defined on ! ! +, such that!u!t + div (!u" K#u) = G, in ! ! +,

with ! $ d and

• u, conserved quantity;• ", velocity field, K , diffusion tensor;• f , production/consumption source term;

The basic model problem:the convection-diffusion equation

• u0(x) initial condition,u = u0 in !, t=0,

• gD,gN , boundary condition data defined on !! = "D % "N

u = gD, on "D ! +,

n · K#u = gN , on "N ! +,

with ! $ d .

Sub-problems!u!t + div (!u" K#u) = G, in ! ! +,

u = u0 in !, t=0,u = gD, on "D ! +,

n · K#u = gN , on "N ! +,

• !u/!t = 0, steady-state case;

• |"|>>K , advection-dominated case, layers;

• K = diag(1, #), with #<<1, or #>>1 (and possibly |"| = 0),strongly anisotropic diffusion tensors.

• "N ("D) = &, pure Dirichlet (Neumann) problem.

Four steps towards finite volume discretizations:

• introduce a mesh partitioning of the domain Th =!T", T,

control volumes;

• re-formulate the equation by integrating over each controlvolume T as a balance of physical fluxes;

• mimic the conservation property of the underlyingdivergence operator by a discrete balance of properlydefined numerical fluxes;

• solve for an approximation of cell averages of theconserved quantity and eventually reconstruct piece-wiselinear approximate solutions.

Deeper inside. . .

• we reformulate the model problem as an integral equation oneach control volume;

• we represent the integral equation for each control volume as anordinary differential equation (ODE);

• collecting ODEs from all control volumes we get a system of(possibly non-linear) algebraic equations. . .

• . . . that are (hopefully) amenable to a solution usingcomputational methods.

Thus, we need to approximate volume integrals and surfaceintegrals to form algebraic expressions.

Domain, Zone, Grid, and Cell

Prior to discussing the Finite Volume approximation, let us examinethe control volumes on which volume and surface integrals will beapproximated. . .

The control volumes exists at several levels:• flow domain, extent of CFD analysis

• zone, divide domain for convenience, if needed

• grid, divides each zone into cells

• cell, smallest control volume, but finite

Domain, Zone, Grid, and Celldomain

zone 1

zone 2

grid 2, 32! 16 cells

grid 1, 16! 8 cells

General Classification of Grids

Grids can be classified as• structured,• unstructured,• hybrid.

• Structured grids use a structured grid topology:• cells are arranged in an array structure• location of neighbor items (cells, faces, vertices) is implicitin the array indices (i,j,k)

Use of structured grids allows efficient storage andbook-keeping of grid items information.

Example of a structured grid

i,j+1

i,ji+1,j

i+1,j+1i,j+1

i−1,ji,j

i+1,j

i,j−1

General Classification of Grids

• unstructured grids do not have an underlying “regular”grid topology:

• no inherent ordering of grid items,• the arrangement of grid items must be specified explicitly(by using lists).

Use of unstructured grids allows greater flexibility ingenerating and adapting grids at the expense of greaterstorage of cell information.

• hybrid grids contain both structured and unstructuredgrids, usually in separate zones

Example of an unstructured grid

142

27

38

5137

24

416

Control volume T14 is formed by vertices labeled by {37, 24, 41, 6}and has neighbours labeled by {2, 51, 38, 27}.

RemarksGrids of quadrilaterals may be considered as structured orunstructured, but when control volumes of more general shapeare considered, we must use unstructured grids:

Anatomy of a finite volume cell

As integral equation are approximated on the finite volume cellto form an algebraic relation, we point out that:

• any cell can take on a generalized shape, but they areusually

• non-overlapping;• convex shaped (not always required);

• any cell contains a finite (positive) volume;

• the size of cells, usually denoted by the symbol h, indicatesthe level of computational resolution of error analysis;

For 2-D finite volume cells:• a volume cell is a polygon defined by a control poly-line;• the control poly-line is subdivided into a finite number ofedges (2-D);

• edges are usually straight lines;• an edge is bounded by two non-coincident vertices.

For 3-D finite volume cells:• a volume cell is a polyhedron defined by a control surface;• the control surface is faceted into a finite number of faces(3-D);

• faces can take on a variety of shapes;• a face is bounded by edges;• edges are usually straight lines.

Integral conservation formulation

• We take K = $ , and integrate the equation over thecontrol volume T,#

T

!u!t dV +

#

Tdiv (!u" $#u) dV =

#

TG dV ,

• assume that control-volume shapes be time-independent,ddt

#

Tu dV +

#

Tdiv (!u" $#u) dV =

#

TG dV ,

• and apply the Gauss divergence theorem,ddt

#

Tu dV +

#

!TnT· (!u" $#u) dS =

#

TG dV .

Integral conservation formulation• Some remarks on the equation structure:

ddt

#

TudV

$ %& 'time variation ofu in volume T

+

#

!TnT · (!u" $#u) dS

$ %& 'flux balance of u throughsurface !T

=

#

TG dV

$ %& 'source of uin volume T

.

• We divide by |T| and split face contributions to fluxesddt

1|T|

#

TudV +

1|T|

(

e!!T|e|

)1|e|

#

ene · !udS

"1|e|

#

ene · $#udS

*

=1|T|

#

TG(t)dV

• to obtainddt uT(t) +

1|T|

(

e!!T|e|

+Fe(u) " Ge(u)

,= GT,

Summarizing:

• finite volume methods search for an approximation ofddt uT(t) +

1|T|

(

e!!T|e|

+Fe(u) " Ge(u)

,= GT(t), for all T ' Th

whereuT =

1|T|

#

TudV , cell average of u over T

Fe =1|e|

#

ene,T ·!udS, advective flux

Ge =1|e|

#

ene,T ·$#udS, diffusive flux

GT =1|T|

#

TG dV , cell average of source term over T

Some general remarks

ddt uT(t) +

1|T|

(

e!!T|e|

+Fe(u) " Ge(u)

,= GT, for all T ' Th

• uT is the conserved quantity representing the flow;• the integral conservation equation applies for each controlvolume;

• control surface bounds the control volume;• flow is driven through the control surface by fluxes Fe andGe;

• flow can be time-varying (unsteady), i.e. Fe and Ge dependon uT(t);

• further, we may consider time-dependent control volumesand control surfaces as well.

Finite Volume ApproximationIn the integral equation

ddt uT(t) +

1|T|

(

e!!T|e|

+Fe(u) " Ge(u)

,= GT, for all T ' Th

we approximate the continuous flux balance summation termby the discrete flux balance

(

e!!T|e|

+Fe(u) " Ge(u)

,(

(

e!!T|e|

+Fe(uh) " Ge(uh)

,,

where• uh ( {uT} collects the approximation of cell averages of u;

• Fe(uh) ( 1|e|

#

ene,T ·!u dS, numerical advective flux;

• Ge(uh) ( 1|e|

#

ene,T ·$#u dS, numerical diffusive flux.

Underlying assumptions on solution approximationNote that within the finite volume framework we are approximating

uh(t)|Ti = ui(t) ( uTi (t) =1|Ti |

#

TiudV ,

which is a constant (in space) quantity over Ti .

Thus,• uh = {ui} is a piecewise constant function over !;• uh = {ui} is (also) a vector in NT , NT is the number of cellsforming Th;

• the position of the solution point in the cell is not yet defined(compare with FEM or FDM methods).

Two possible interpretations:• we are approximating cell averages;• we are approximating the value of u at some point inside T(barycenters work up to second-order of accuracy).

Location of the solution in the finite volume cell

The location of the flow solution and geometry of the finitevolume cell with respect to the grid can be of two types:

• cell-centered cell: the flow solution is located at thecentroid of the cell volume defined by the grid lines(primary grid);

• cell-vertex cell (also node-centered cell):• the flow solution is located at the vertices of the grid;• the finite-volume cell is formed about the vertex (dual grid).

Each approach has its advantages and disadvantages, but ifthings are done right, both approaches do well.

Cell-centered grid

Vertex-centered grid

Underlying assumptions on flux approximation

Note that within the finite-volume framework we are approximating

Fe(uh) (1|e|

#

ene,T ·!udS, numerical advective flux;

Ge(uh) (1|e|

#

ene,T ·$#udS, numerical diffusive flux.

Thus,• the flux is uniform over the surface of each face of the cell;

Remark also that:• computing the flux on the face may be one of the most difficultand computationally intensive operations of a finite volume code.

Thus, how do we compute numerical fluxes?

Numerical convective flux: first-order scheme

TiTj

uiuj

• We want to approximate numerically this integral

Feij (uh) (1|eij |

#

eijn·"udS

by taking into account that:

• the face eij is shared by the control volumes Ti and Tj ;• available information is represented by ui and uj ;• information is travelling transported by the velocity field !

) upwinding!

Numerical convective flux: first-order scheme

TiTj

uiuj

eij

Feij (uh) = "+ij ui + ""

ij uj (1|eij |

#

eijn·"udS

upwind velocities:

ij =-"ij ± |"ij |

./2 with "ij =

1|eij |

#

eij" · nij dS.

This approximation is exact for constant functions!

Numerical diffusive flux

uijuji

hij

u!

u"

uiuj

Ti

Tj

• We want to approximate numerically this integral

Gij(uh) (1|eij |

#

eijn · $#udS.

so that the flux approximation is exact for linear functions, i.e.constant gradients.

Numerical diffusive flux

uijuji

hij

u!

u"

uiuj

Ti

Tj

Gij(uh) (1|eij |

#

eijn · $#udS.

• if G#ij (uh) is a constant approximation of #u on the diamond Dij

defined by x i , x j , x" and x# , we setGij(uh) = nij · $ijG#

ij (uh).

• we must express G#ij (uh) as function of uh = {uT}.

Derivation of gradient formula on diamonds, (i)

uijuji

hij

u!

u"

uiuj

Ti

Tj

The flux approximation must be exact for linear functions:• for any integrable function u, we define G#

ij (u) as the gradient ofu averaged on the “diamond” Dij :

G#ij (u) * +#u,

Dij=

1|Dij |

#

Dij

#udV

• transform the volume integral into a boundary integral byapplying the Gauss-Green theorem:

1|Dij |

#

Dij

#u dV =1

|Dij |

#

!Dij

"udS.

Derivation of gradient formula on diamonds, (ii)

• we split the boundary integral in edge contributions,#

!Dij

=

#

ei!+

#

e!j

+

#

ej"+

#

e"i

= (%);

• we apply the trapezoidal rule, which is exact for linear functions,

(%) = ei""i"ui + u"

2 + e"j""ju" + uj

2+ej#"j#

uj + u#

2 + e#i"#iu# + ui

2 ;

• using "i"+""j+"j#+"#i =0, "i"+"#i+"ij =0, and similargeometrical relations yields

(%) =uj " ui|x i " x j |

""#

""# ·#ij+

u# " u"

|x# " x"|

"ij"ij ·#"#

= G#ij ,

(formula by Coudière, Vila, Villedieu, M2AN, (1999)).

Derivation of gradient formula on diamonds, (iii)

uijuji

hij

u!

u"

uiuj

Ti

Tj

Bertolazzi-M., M3AS, (2004) proposed an alternative derivation thatyields the following (equivalent) definition.

• We start by defining the one-sided edge gradients:

Gij(uh) =uij " uihij

nij +u# " u"

|eij |t ij ,

Gji(uh) =uji " ujhji

nji +u" " u#

|eij |t ji

Derivation of gradient formula on diamonds, (iv)

uijuji

hij

u!

u"

uiuj

Ti

Tj

• Edge gradients are averaged to obtain

G#ij (uh) = WijGij(uh) +WjiGji(uh), Wij =

|Ti ||Ti | + |Tj |

.

• Note that

Wij =|Ti |

|Ti | + |Tj |=hijHij

where Hij = hij + hji ,

Derivation of gradient formula on diamonds, (v)

uijuji

hij

u!

u"

uiuj

Ti

Tj

Finally, some calculations yields the final formula for diamondgradients:

G#ij (uh) =

/uj " uiHij

+uij " ujiHij

0nij +

u# " u"

|eij |t ij .

The gradient formula on diamonds

Coudière, Vila, Villedieu, M2AN, (1999) :

G#ij (uh) =

uj " ui|x i " x j |

""#

""# ·#ij+

u# " u"

|x# " x"|

"ij"ij ·#"#

;

Bertolazzi & M., M3AS, (2004) :

G#ij (uh) = Wij

uij " uihij

nij +Wjiuji " ujhji

nji +u# " u"

|eij |t ij .

It can be noted that:• forWij = hij/Hij the two gradient formulas coincide. . .• . . . but a different choice of edge weights gives a differentgradient formula, and thus a different numerical flux;

• furthermore, non-linear weights can be easily introduced;• the formulation by Bertolazzi-M., 2004 can be readily extendedto n " D problems with n > 2.

Gradient formula in 3-D

uji

uijhijhji

u!

u"

u#

uiuj

Ti

Tj

G#ij (uh) = Wij

uij " uihij

nij +Wjiuji " ujhji

nji$ %& '

normal terms

+u# " u"

|eij |t ("#)ij +

u$ " u"

|eij |t ("$)ij

$ %& 'tangential terms

.

Mumble Mumble. . .

So, we are very happy with these gradient formulas. . .

. . . but there is a problem. . .

. . . these formulas for edge gradient require the knowledgeof vertex values!!!

Reconstruction of vertex values by Least-Squares

v

T1u(x) = av+bv ·(x"xv), x '%T!"vT

The reconstruction weights wv,T

uv = 1u(xv) = av =

23Twv,TuT, v internal vertex,

g(xv), v boundary vertex.

are given by taking (av,btv) as minimizers ofJ (av,btv) =

(

T

41u(xT) " uT

52.

Reconstruction of vertex values by Least-Squares

Linear Consistency(

Twv,T = 1,

(

Twv,T(xT " xv) = 0.

Uniform BoundednessmaxT

66wv,T66 < C.

Using these two properties, a weaker form of consistency forthe original scheme has been shown (Coudière et al. (1999)).

Alternative choice of weights for vertices are possible. . .

Numerical convective flux: second-order scheme

Gi

GjTi

Tj

buijbujiui

uj

We want an approximation of the convective flux integral that is exactfor linear functions:

Feij (uh) (1|eij |

#

eijn·"udS

by using the cell reconstructions7uij = ui +(x ij"x i)·Gi(uh)7uji = uj +(x ij"x j)·Gj(uh)

and upwind velocities

ij =-"ij ± |"ij |

./2 with "ij =

1|eij |

#

eij" · nij dS.

Numerical convective flux: second-order scheme

Gi

Gj

Ti

Tj

buijbujiui

uj

bu|Ti (x)=ui+(x"x i)·Gi(uh)buij = bu|Ti (x ij)

bu|Tj (x)=uj+(x"x j)·Gj(uh)buji = bu|Tj (x ij)

Feij (uh) = "+ij 7uij + ""

ij 7uji (166eij

66

#

eijn·"u dS

Feij (uh) = "+ij ui + ""

ij uj$ %& 'first-order term

+

"+ij (x ij " x i) ·Gi(uh) + ""

ij (x ij " x j) ·Gj(uh)$ %& '

second-order correction

,

Reconstruction of cell gradients and slope limitersTo complete the scheme, here is how we define the cell gradients Giand Gj :

(i) define a constant gradient 1GT(uh) within the cell T:• Triangles: take the gradient of the linear function goingthrough the vertex values {(xv, uv)};

• Convex polygons: take the gradient of the linear functionapproximating the vertex values {(xv, uv)} in theLeast-Square sense;

(ii) reconstruct the solution within the cell T asuT(x) = uT + (x " xT) · 1GT(uh)

(iii) introduce a slope limiter factor &T(uh) to reduce slopesGT(uh) = &T(uh)1GT(uh) (à la Barth-Jespersen) to obtain

7uT(x) = uT + (x " xT) ·GT(uh), x ' T.

“Diamond” scheme with non-linear upwind

The shock-capturing technique using limiters introduces anon-linear character into the scheme.

• Some theoretical results:

- Well-posedness: there exists at least one solution of thenon-linear discrete problem

- Quasi-uniqueness: the numerical solutions are within a ballof diameter decreasing as h2

“Diamond” scheme with non-linear upwind

• a very important implementation detail:-A0 + A1(uh)

.uh = f - A0uk+1

h = f " A1(ukh)ukh

solving by a direct method (ma41, HSL) asks for

• a single factorization of the “first-order” matrix A0

• several evaluations of the non-linear correction A1(ukh)ukh• and corresponding resolution of two triangular systemsusing the factors of A0.

) non-linear iterations have a very low cost!

Stencils: reconstruction of vertex values

uk

uV

!uk

"* set of cell-averaged data needed to reconstruct the

vertex value uV

Stencils: numerical definition of the edge flux

uk

eij

!uk

"* set of cell-averaged data needed to evaluate/approximatethe numerical flux integrals Fij , Gij across the edge eij .

Stencils: cell balance of finite volume fluxes

The assembly process yields the system of (non-)linear equations+

F$%&'adv.

" G$%&'diff .

,u(l+1) = G$%&'

source

" f(u(l))$ %& 'nlin adv.

+ g$%&'diff

ui uk

Sparsity of F " G:

row i "- flux balance of Ti!ui

"%

!uk

"k "- non-zeroes of row i

Limiter #1

ui

uk uV

• We reduce the slope of the reconstructed gradients as followsGi(uh) - #Gi(uh),

where # is the maximum value in [0, 1] such thatmin{uk} . min{uV} . max{uV} . max{uk}

and uV = ui + (xV " x i) · #Gi .

Limiter #2

ui

uj

uij

• Additionally, we may require that|uij " ui | . |uj " ui | & sign

-uij " ui

.= sign

-uj " ui

.,

where uij = ui + (x ij " x i) · #Gi , and x ij is the mid-point of eij .

Upwind-biased Least-Squares vertex reconstruction

v

T

Let us consider the linear solution repre-sentation:1u(x) = av+bv ·(x"xv), x '%T!"vT

We solve the $T(")-weighted Least Squares problem for (av,btv) byminimizing

J (av,btv) =(

T$T(")

41u(xT) " uT

52.

The weights $T(") are chosen to incorporate upwind information intothe vertex values.

v

T

Recall:J (av,btv) =

(

T$T(")

41u(xT) " uT

52.

With upwind-biased Least-Squares coeffiicients $T("), thereconstruction weights wv,T still read as

uv = 1u(xv) = av =

23Twv,TuT, v internal vertex,

g(xv), v boundary vertex.

but now upwind information is incorporated into the vertex values.

Final Remarks

Finite Volume Methods are based on• the conservative formulation of the model equations;• a discrete form of flux balance for any control volume;• the numerical discretization of flux integrals;• some reconstruction algorithm for getting vertex valuesfrom cell averages.

top related