Finite volume Tool for Matlab

所属分类:matlab编程
开发工具:matlab
文件大小:1571KB
下载次数:23
上传日期:2017-12-26 10:48:24
上 传 者SONNY_YANG
说明:  这是化学/石油工程师的有限体积(玩具)工具箱。 现在,它可以解决一个瞬变对流扩散方程的变速场/扩散系数。 离散化方案 包括: ?? * 中心差异扩散项 ?? * 中央差分对流项 ?? * 逆风对流期 ?? * TVD对流项与各种流量限制器 ?? * 瞬态项 ?? * Dirichlet,Neumann,Robin和周期性边界条件
(This is a finite volume (toy) toolbox for chemical/petroleum engineers. Right now, it can solve a transient convection-diffusion equation with variable velocity field/diffusion coefficients. The discretization schemes include: * central difference diffusion term * central difference convection term * upwind convection term * TVD convection term with various flux limiters * transient term * Dirichlet, Neumann, Robin, and periodic boundary conditions)

文件列表:
Finite volume Tool for Matlab\Boundary\boundaryCondition.m (1407, 2017-12-03)
Finite volume Tool for Matlab\Boundary\boundaryCondition1D.m (2224, 2017-12-03)
Finite volume Tool for Matlab\Boundary\boundaryCondition2D.m (4184, 2017-12-03)
Finite volume Tool for Matlab\Boundary\boundaryCondition3D.m (6508, 2017-12-03)
Finite volume Tool for Matlab\Boundary\boundaryConditionCylindrical3D.m (7015, 2017-12-03)
Finite volume Tool for Matlab\Boundary\boundaryConditionRadial2D.m (4625, 2017-12-03)
Finite volume Tool for Matlab\Boundary\cellBoundary.m (646, 2017-12-03)
Finite volume Tool for Matlab\Boundary\cellBoundary1D.m (1161, 2017-12-03)
Finite volume Tool for Matlab\Boundary\cellBoundary2D.m (2343, 2017-12-03)
Finite volume Tool for Matlab\Boundary\cellBoundary3D.m (3217, 2017-12-03)
Finite volume Tool for Matlab\Boundary\cellBoundaryCylindrical3D.m (3372, 2017-12-03)
Finite volume Tool for Matlab\Boundary\cellBoundaryRadial2D.m (2511, 2017-12-03)
Finite volume Tool for Matlab\Boundary\combineBC.m (699, 2017-12-03)
Finite volume Tool for Matlab\Boundary\combineBC1D.m (1444, 2017-12-03)
Finite volume Tool for Matlab\Boundary\combineBC2D.m (2454, 2017-12-03)
Finite volume Tool for Matlab\Boundary\createBC.m (650, 2017-12-03)
Finite volume Tool for Matlab\Boundary\createBC1D.m (771, 2017-12-03)
Finite volume Tool for Matlab\Boundary\createBC2D.m (1094, 2017-12-03)
Finite volume Tool for Matlab\Boundary\createBC3D.m (1309, 2017-12-03)
Finite volume Tool for Matlab\boundarycond.png (3865, 2017-12-03)
Finite volume Tool for Matlab\Calculus\ddtTerm.m (714, 2017-12-03)
Finite volume Tool for Matlab\Calculus\ddtTerm1D.m (800, 2017-12-03)
Finite volume Tool for Matlab\Calculus\ddtTerm2D.m (860, 2017-12-03)
Finite volume Tool for Matlab\Calculus\ddtTerm3D.m (770, 2017-12-03)
Finite volume Tool for Matlab\Calculus\divergenceTerm.m (971, 2017-12-03)
Finite volume Tool for Matlab\Calculus\divergenceTerm1D.m (742, 2017-12-03)
Finite volume Tool for Matlab\Calculus\divergenceTerm2D.m (1246, 2017-12-03)
Finite volume Tool for Matlab\Calculus\divergenceTerm3D.m (1733, 2017-12-03)
Finite volume Tool for Matlab\Calculus\divergenceTermCylindrical1D.m (1017, 2017-12-03)
Finite volume Tool for Matlab\Calculus\divergenceTermCylindrical2D.m (1569, 2017-12-03)
Finite volume Tool for Matlab\Calculus\divergenceTermCylindrical3D.m (1853, 2017-12-03)
Finite volume Tool for Matlab\Calculus\divergenceTermRadial2D.m (1485, 2017-12-03)
Finite volume Tool for Matlab\Calculus\gradientCellTerm.m (2742, 2017-12-03)
Finite volume Tool for Matlab\Calculus\gradientTerm.m (716, 2017-12-03)
Finite volume Tool for Matlab\Calculus\gradientTerm1D.m (749, 2017-12-03)
Finite volume Tool for Matlab\Calculus\gradientTerm2D.m (949, 2017-12-03)
Finite volume Tool for Matlab\Calculus\gradientTerm3D.m (1182, 2017-12-03)
Finite volume Tool for Matlab\Calculus\gradientTermCylindrical3D.m (1315, 2017-12-03)
Finite volume Tool for Matlab\Calculus\gradientTermRadial2D.m (1064, 2017-12-03)
... ...

# FVTool: Finite volume toy toolbox for Matlab [![DOI](https://zenodo.org/badge/doi/10.5281/zenodo.18156.svg)](http://dx.doi.org/10.5281/zenodo.18156) This is a finite volume (toy) toolbox for chemical/petroleum engineers. Right now, it can solve a transient convection-diffusion equation with variable velocity field/diffusion coefficients. The discretization schemes include: * central difference diffusion term * central difference convection term * upwind convection term * TVD convection term with various flux limiters * transient term * Dirichlet, Neumann, Robin, and periodic boundary conditions ![diffusion pde](Tests/diff_pde.jpg) ## Which equation do you solve? You can solve the following PDE (or a subset of it): ![advection diffusion](pde.png) with the following boundary conditions: ![boundary condition](boundarycond.png) Believe it or not, the above equations describe the majority of the transport phenomena in chemical and petroleum engineering and similar fields. ## How to start Download the package, start matlab, and run `FVToolStartUp` ## Inspiration I started writing this tool after playing with [FiPy] (http://www.ctcms.nist.gov/fipy/), an amazing python-based finite volume solver. This matlab solver is not a clone, and indeed very limited compared to FiPy. I wrote it to have a very handy tool for testing new ideas (new mathematical models) by solving them in 1D uniform Cartesian grids. Then I extended the code to * 1D axisymmetric (radial) * 2D radial (r, theta) * 2D Cartesian * 3D Cartesian * 2D axisymmetric (cylindrical, r, z) * 3D cylindrical (r, theta, z) I have overloaded some of the matlab operators to simplify the switch from 1D codes to 2D and 3D. ### A simple example You can solve a diffusion equation, i.e., $ \nabla. (-D \nabla \phi) = 0 $ by running the following code in Matlab: ```matlab clc; clear; L = 50; % domain length Nx = 20; % number of cells m = createMesh1D(Nx, L); BC = createBC(m); % all Neumann boundary condition structure BC.left.a(:) = 0; BC.left.b(:)=1; BC.left.c(:)=1; % Dirichlet for the left boundary BC.right.a(:) = 0; BC.right.b(:)=1; BC.right.c(:)=0; % right boundary D_val = 1; % value of the diffusion coefficient D = createCellVariable(m, D_val); % assign the diffusion coefficient to the cells D_face = harmonicMean(D); % calculate harmonic average of the diffusion coef on the cell faces Mdiff = diffusionTerm(D_face); % matrix of coefficients for the diffusion term [Mbc, RHSbc] = boundaryCondition(BC); % matix of coefficients and RHS vector for the BC M = Mdiff + Mbc; % matrix of cefficients for the PDE c = solvePDE(m,M, RHSbc); % send M and RHS to the solver visualizeCells(c); % visualize the results ``` change the third line to `m = createMesh2D(Nx,Nx, L,L);` or `m = createMesh3D(Nx,Nx,Nx, L,L,L);` and see the outcome for yourself. ![diff 3D](Tests/diff_pde_3d.jpg) ## Examples There are a few simple examples in the [Tutorial](https://github.com/simulkade/FVTool/tree/master/Examples/Tutorial) folder. You can also find a few more advanced examples (water injection into a heterogeneous oil field, two nonlinear PDE's, coupled fully implicit solution) in the [Advanced](https://github.com/simulkade/FVTool/tree/master/Examples/Advanced) folder. ## Documents comming soon ## But Matlab is not a free software? You can use the code in [octave](http://www.gnu.org/software/octave/). The new (object oriented) version of the code works in Octave 4.0 (with the new `classdef` function). I've re-written the code in [Julia](http://julialang.org/). It works fine, but the visualization on Windows OS has still some issues. ## Questions and bug reports You can ask your questions by creating a new issue here, or by writing a comment in [my blog] (http://fvt.simulkade.com). You can aslo ask your question in the [Matlab file exchange page] (http://www.mathworks.com/matlabcentral/fileexchange/46637-a-simple-finite-volume-solver-for-matlab) of this code. I truly appreciate your feedback and/or contribution. ## How to cite: If you have used the package in your work and you find it usefull, please cite it as: ``` @misc{ali_akbar_eftekhari_2015_32745, author = {Ali Akbar Eftekhari and Kai Schller}, title = {FVTool: a finite volume toolbox for Matlab}, month = oct, year = 2015, doi = {10.5281/zenodo.32745}, url = {https://doi.org/10.5281/zenodo.32745} } ``` I will also appreciate it if you write me a couple of lines about how you have used it in your research. It encourages me to maintain the code.

近期下载者

相关文件


收藏者