. Block coupled calculations in OpenFOAM Chalmers University of Technology Klas Jareteg . Implementing a pressure-velocity coupled solver October 22, 2012 . . . . . . (- simpleFoam, -- pUCoupledFoam) 10 0 Turbulent energy 10 -1 Velocity (x) Pressure -2 10 -3 10 10 -4 Residuals 10 -5 10 -6 -7 10 -8 10 10 -9 10 -10 0 200 400 600 800 1000 Iteration
. Results . Klas Jareteg, Project in CFD with OpenSource software, 2012-10-22 . .Overview . Conclusions OpenFOAM implementation . Pressure-velocity coupling model OpenFOAM background Formulation Introduction Overview Overview 2
. . . . Presentation overview .Overview . Klas Jareteg, Project in CFD with OpenSource software, 2012-10-22 . 3 • Introduction • Block coupling formulation • OpenFOAM background • Pressure-velocity coupled solver • Tests and results • Conclusion
. . . . Learning outcomes .Overview . Klas Jareteg, Project in CFD with OpenSource software, 2012-10-22 . 4 • General understanding of the block matrix structure • Overview of the BlockLduMatrix class with utilities • Understand implementation structure of block coupled solvers • Increased general knowledge on discretization and assembling
. Results . Klas Jareteg, Project in CFD with OpenSource software, 2012-10-22 . .Introduction . Conclusions OpenFOAM implementation . Pressure-velocity coupling model OpenFOAM background Formulation Introduction Overview Introduction 5
. . . Klas Jareteg, Project in CFD with OpenSource software, 2012-10-22 . .Introduction . (2) Introduction (1) . . 6 • Many problems coupled PDE. Example Navier-Stokes: ∇ · ( U ) = 0 ∇ · ( UU ) − ∇ ( ν ∇ U ) = − 1 ρ ∇ p • Traditionally segragated solvers • Alternatively: coupled solvers • OpenFOAM 1.6-ext: BlockLduMatrix
. . . Klas Jareteg, Project in CFD with OpenSource software, 2012-10-22 . .Introduction . (2) Introduction (1) . . 6 • Many problems coupled PDE. Example Navier-Stokes: ∇ · ( U ) = 0 ∇ · ( UU ) − ∇ ( ν ∇ U ) = − 1 ρ ∇ p • Traditionally segragated solvers • Alternatively: coupled solvers • OpenFOAM 1.6-ext: BlockLduMatrix
. . . Klas Jareteg, Project in CFD with OpenSource software, 2012-10-22 . .Introduction . (2) Introduction (1) . . 6 • Many problems coupled PDE. Example Navier-Stokes: ∇ · ( U ) = 0 ∇ · ( UU ) − ∇ ( ν ∇ U ) = − 1 ρ ∇ p • Traditionally segragated solvers • Alternatively: coupled solvers • OpenFOAM 1.6-ext: BlockLduMatrix
. . . Klas Jareteg, Project in CFD with OpenSource software, 2012-10-22 . .Introduction . (2) Introduction (1) . . 6 • Many problems coupled PDE. Example Navier-Stokes: ∇ · ( U ) = 0 ∇ · ( UU ) − ∇ ( ν ∇ U ) = − 1 ρ ∇ p • Traditionally segragated solvers • Alternatively: coupled solvers • OpenFOAM 1.6-ext: BlockLduMatrix
. . . Klas Jareteg, Project in CFD with OpenSource software, 2012-10-22 . .Introduction . (2) Introduction (1) . . 6 • Many problems coupled PDE. Example Navier-Stokes: ∇ · ( U ) = 0 ∇ · ( UU ) − ∇ ( ν ∇ U ) = − 1 ρ ∇ p • Traditionally segragated solvers • Alternatively: coupled solvers • OpenFOAM 1.6-ext: BlockLduMatrix
. Results . Klas Jareteg, Project in CFD with OpenSource software, 2012-10-22 . .Formulation . Conclusions OpenFOAM implementation . Pressure-velocity coupling model OpenFOAM background Formulation Introduction Overview Formulation 7
. y . Klas Jareteg, Project in CFD with OpenSource software, 2012-10-22 . .Formulation . (6) b y B x A y (5) . b 8 (4) . . Formulation (3) • General coupled matrix system: A ( y ) x = a B ( x ) y = b • Solved together (still segregated): [ A ( y ) ] [ x ] [ a ] 0 = 0 B ( x ) • Coupled solution: [ A ′ ] [ x ] [ a ] = B ′
. y . Klas Jareteg, Project in CFD with OpenSource software, 2012-10-22 . .Formulation . (6) b y B x A y (5) . b 8 (4) . . Formulation (3) • General coupled matrix system: A ( y ) x = a B ( x ) y = b • Solved together (still segregated): [ A ( y ) ] [ x ] [ a ] 0 = 0 B ( x ) • Coupled solution: [ A ′ ] [ x ] [ a ] = B ′
. y . Klas Jareteg, Project in CFD with OpenSource software, 2012-10-22 . .Formulation . (6) b y B x A y (5) . b 8 (4) . . Formulation (3) • General coupled matrix system: A ( y ) x = a B ( x ) y = b • Solved together (still segregated): [ A ( y ) ] [ x ] [ a ] 0 = 0 B ( x ) • Coupled solution: [ A ′ ] [ x ] [ a ] = B ′
. . . Klas Jareteg, Project in CFD with OpenSource software, 2012-10-22 . .Formulation (10) y i x i (9) b i a i (8) 9 . . Block coupled approach (7) • Alternative formulation: C z = c [ ] c a , a c a , b C = C i , j = i , j i , j c b , a c b , b i , j i , j i , j ] ⊤ [ c = c i = ] ⊤ z = z i = [ • Element in vectors and matrices: vectors and tensors
. . . Klas Jareteg, Project in CFD with OpenSource software, 2012-10-22 . .Formulation (10) y i x i (9) b i a i (8) 9 . . Block coupled approach (7) • Alternative formulation: C z = c [ ] c a , a c a , b C = C i , j = i , j i , j c b , a c b , b i , j i , j i , j ] ⊤ [ c = c i = ] ⊤ z = z i = [ • Element in vectors and matrices: vectors and tensors
. . . Klas Jareteg, Project in CFD with OpenSource software, 2012-10-22 . .Formulation (10) y i x i (9) b i a i (8) 9 . . Block coupled approach (7) • Alternative formulation: C z = c [ ] c a , a c a , b C = C i , j = i , j i , j c b , a c b , b i , j i , j i , j ] ⊤ [ c = c i = ] ⊤ z = z i = [ • Element in vectors and matrices: vectors and tensors
. . . . Block coupled approach Non-linearities in equations still left! . .Formulation . Klas Jareteg, Project in CFD with OpenSource software, 2012-10-22 . 10 • Coupled system is larger • Implicit coupling → faster convergence • Convergence properties changed
. . . . Block coupled approach Non-linearities in equations still left! . .Formulation . Klas Jareteg, Project in CFD with OpenSource software, 2012-10-22 . 10 • Coupled system is larger • Implicit coupling → faster convergence • Convergence properties changed
. . . . Block coupled approach Non-linearities in equations still left! .Formulation . Klas Jareteg, Project in CFD with OpenSource software, 2012-10-22 . 10 • Coupled system is larger • Implicit coupling → faster convergence • Convergence properties changed
. . . . Block coupled approach Non-linearities in equations still left! . .Formulation . Klas Jareteg, Project in CFD with OpenSource software, 2012-10-22 . 10 • Coupled system is larger • Implicit coupling → faster convergence • Convergence properties changed
. Results . Klas Jareteg, Project in CFD with OpenSource software, 2012-10-22 . OpenFOAM background . Conclusions OpenFOAM implementation . Pressure-velocity coupling model OpenFOAM background Formulation Introduction Overview background OpenFOAM 11
. fvMesh is the finite volume specialization . Klas Jareteg, Project in CFD with OpenSource software, 2012-10-22 . OpenFOAM background . . area. Numbered according to face numbers. Sf() Surface normals with magnitude equal to the cell numbering. V() Volumes of the cells. Numbered according to 12 Face based computational cell: . polyMesh and fvMesh Discretization, assembling and matrices I . . S f OWNER NEIGHBOUR cell i face f cell j
. . . Klas Jareteg, Project in CFD with OpenSource software, 2012-10-22 . OpenFOAM background . Listing 2: Surface normal, owner and neighbour for each face const unallocLabelList & neighbour = mesh . neighbour ( ) ; 3 const unallocLabelList & owner = mesh . owner ( ) ; 2 const surfaceVectorField & Sf = p . mesh ( ) . Sf ( ) ; 1 Listing 1: lduMatrix.H scalarField * lowerPtr_ , * diagPtr_ , * upperPtr_ ; 85 . . Discretization, assembling and matrices II lduMatrix Basic square sparse matrix. Stored in three arrays: the diagonal, the upper and the lower part: // 86 ( not including i n t e r f a c e s ) 13 − C o e f f i c i e n t s • Diagonal elements: numbered as cell numbers • Off-diagonal elements: are numbered according to faces.
. . . Klas Jareteg, Project in CFD with OpenSource software, 2012-10-22 . OpenFOAM background . . 14 Sparsity of matrix: (11) Discretization, assembling and matrices III . . A = A i , j • i , j : contribution from cell j on cell i • j , i : contribution from cell i on cell j • i > j : upper elements • i < j : lower elements • i = j : diagonal elements
. 4 . Klas Jareteg, Project in CFD with OpenSource software, 2012-10-22 . OpenFOAM background . . Listing 3: Part of pEqn.H in simpleFoam U = UEqn ( ) . H ()/ AU ; volScalarField AU = UEqn ( ) . A ( ) ; . 3 fvMatrix Discretization, assembling and matrices IV . . 15 • Specialization for finite volume • Adds source and reference to field • Helper functions:
Recommend
More recommend