Skip to content

Python script for solving 1D steady convection-diffusion heat problem using the finite-volume method

Notifications You must be signed in to change notification settings

spietz/1DFiniteVolume

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

About

Python script for solving 1D steady convection-diffusion heat problem using the Finite Volume Method. Central difference fluxes are applied for the diffusive terms, and either central of upwinded difference fluxes are applied for the convective terms. Implementation does not include source terms and is limited to uniform convective velocity u = 1 and the following two sets boundary conditions at x = 0 and x = L:

  1. homogeneous Dirichlet BC at west wall (Tw=0), inhomogeneous Dirichlet at east wall (Tw=1)
  2. homogeneous Dirichlet BC at west wall (Tw=0), inhomogeneous Neumann at east wall (dTw/dx=1)

Linear system of equations solved either directly using Matlab’s backslash, or iteratively using either Jacobi, Gauss-Seidel or SOR stationary methods.

Inputs : Number of cells along x,y-axis

L : Size of square in x,y-direction Pe : Global Peclet number problem : Problem #: 1 or 2, selects case of convective field and BCs linsolver : Linear solver: ‘direct’,’jacobi’,’gs’,’sor’ fvscheme : Finite volume scheme: ‘cds-cds’ or ‘uds-cds’ omegaSOR : Relaxation parameter omega for SOR iterative method imax : Maximum number of iterations for iterative linear solver tol : Relative tolerance on for iterative linear solver, should be selected such that tol > condest(A)*eps

Outputs : Temperature vector at cell nodes, T(1:n)

A : Convection-diffusion system matrix, A(1:n,1:n) s : Source vector with BC contributions, s(1:n) TT : Temperature field extrapolated to walls, TT(1:n+2) CF,DF : Conv. and diff. fluxes through walls, CF=[CFw,CFe] GHC : Global heat conservation, scalar (computed from wall fluxes) solve_time : CPU-time for solving system of linear equations A*T(:)=s(:) Plots of the temperature field etc.

About

Python script for solving 1D steady convection-diffusion heat problem using the finite-volume method

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages