資源簡介
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.

代碼片段和文件信息
%%?Apparently?it?must?be?here!
%?Copyright?(c)?2012?2013?2014?2015;?Ali?Akbar?Eftekhari
%?All?rights?reserved.
%
%?Redistribution?and?use?in?source?and?binary?forms?with?or
%?without?modification?are?permitted?provided?that?the?following
%?conditions?are?met:
%
%?????*???Redistributions?of?source?code?must?retain?the?above?copyright?notice
%?????????this?list?of?conditions?and?the?following?disclaimer.
%?????*???Redistributions?in?binary?form?must?reproduce?the?above
%?????????copyright?notice?this?list?of?conditions?and?the?following
%?????????disclaimer?in?the?documentation?and/or?other?materials?provided
%?????????with?the?distribution.
%
%?THIS?SOFTWARE?IS?PROVIDED?BY?THE?COPYRIGHT?HOLDERS?AND?CONTRIBUTORS?“AS?IS“
%?AND?ANY?EXPRESS?OR?IMPLIED?WARRANTIES?INCLUDING?BUT?NOT?LIMITED?TO
%?THE?IMPLIED?WARRANTIES?OF?MERCHANTABILITY?AND?FITNESS?FOR?A?PARTICULAR
%?PURPOSE?ARE?DISCLAIMED.?IN?NO?EVENT?SHALL?THE?COPYRIGHT?HOLDER?OR
%?CONTRIBUTORS?BE?LIABLE?FOR?ANY?DIRECT?INDIRECT?INCIDENTAL?SPECIAL
%?EXEMPLARY?OR?CONSEQUENTIAL?DAMAGES?(INCLUDING?BUT?NOT?LIMITED?TO
%?PROCUREMENT?OF?SUBSTITUTE?GOODS?OR?SERVICES;?LOSS?OF?USE?DATA
%?OR?PROFITS;?OR?BUSINESS?INTERRUPTION)?HOWEVER?CAUSED?AND?ON?ANY?THEORY?OF
%?LIABILITY?WHETHER?IN?CONTRACT?STRICT?LIABILITY?OR?TORT?(INCLUDING
%?NEGLIGENCE?OR?OTHERWISE)?ARISING?IN?ANY?WAY?OUT?OF?THE?USE?OF?THIS
%?SOFTWARE?EVEN?IF?ADVISED?OF?THE?POSSIBILITY?OF?SUCH?DAMAGE.
clc;?clear;?close?all;
%%?create?a?mesh?and?visualize?it
%?The?first?part?of?this?demo?shows?you?how?to?create?a?mesh?and?visualize
%?it.?The?aim?of?the?visualization?is?to?introduce?you?to?the?mesh
%?structure.
%?Here?we?are?going?to?create?and?visualize?a?1D?uniform?equidistant?mesh
%?and?show?the?cell?centers?with?a?‘o‘?marker?and?the?face?of?each?cell
%?with?a?‘+‘?marker.
%?We?start?by?defining?the?length?of?the?domain:
L?=?1.0;?%?length?of?the?domain
%%
%?Then?we?define?the?number?of?cells?in?the?domain:
%
Nx?=?10;?%?number?of?cells?in?the?domain
%%
%?Now?we?call?createMesh1D?one?of?the?functions?from?a?group?of?createMesh*
%?functions:
%
m?=?createMesh1D(Nx?L);
%%
%?This?function?generates?a?structure?which?keeps?the?domain?and?grid
%?information?which?will?be?used?by?almost?every?other?function?in?the
%?FVMtool.
%
%?In?general?1D?2D?3D?1D?radial?(axial?symetry)?and?2D?cylindrical
%?grids?can?be?constructed.?For?more?information?type
%%
%
%???help?createMesh2D
%???help?createMesh3D
%???help?createMeshCylindrical1D
%???help?createMeshCylindrical2D
%
%%
%?Now?let‘s?have?a?look?at?the?structure?of?the?created?mesh:
%
disp(m);
%%
%?You?can?easily?get?more?information?about?this?structure?by?typing
%%
%???help?createMesh1D
%
%%
%?As?an?example?we?use?the?position?of?the?cell?centers?to?visualize?the
%?domain?the?cells?and?the?interfaces?between?them:
%
figure(2);
plot(m.cellcenters.x?ones(size(m.cellcenters.x))?‘or‘?...
?????m.facecenters.x?ones(size(m.facecenters.x))?‘-+b‘);
legend(‘cell?centers‘?‘face?centers‘);
tit
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-03-23?09:48??FVTool-master\
?????文件??????????16??2018-03-23?09:48??FVTool-master\.gitignore
?????目錄???????????0??2018-03-23?09:48??FVTool-master\Boundary\
?????文件????????1419??2018-03-23?09:48??FVTool-master\Boundary\boundaryCondition.m
?????文件????????2224??2018-03-23?09:48??FVTool-master\Boundary\boundaryCondition1D.m
?????文件????????4184??2018-03-23?09:48??FVTool-master\Boundary\boundaryCondition2D.m
?????文件????????6508??2018-03-23?09:48??FVTool-master\Boundary\boundaryCondition3D.m
?????文件????????7015??2018-03-23?09:48??FVTool-master\Boundary\boundaryConditionCylindrical3D.m
?????文件????????4625??2018-03-23?09:48??FVTool-master\Boundary\boundaryConditionRadial2D.m
?????文件?????????658??2018-03-23?09:48??FVTool-master\Boundary\cellBoundary.m
?????文件????????1161??2018-03-23?09:48??FVTool-master\Boundary\cellBoundary1D.m
?????文件????????2343??2018-03-23?09:48??FVTool-master\Boundary\cellBoundary2D.m
?????文件????????3217??2018-03-23?09:48??FVTool-master\Boundary\cellBoundary3D.m
?????文件????????3372??2018-03-23?09:48??FVTool-master\Boundary\cellBoundaryCylindrical3D.m
?????文件????????2511??2018-03-23?09:48??FVTool-master\Boundary\cellBoundaryRadial2D.m
?????文件?????????699??2018-03-23?09:48??FVTool-master\Boundary\combineBC.m
?????文件????????1444??2018-03-23?09:48??FVTool-master\Boundary\combineBC1D.m
?????文件????????2454??2018-03-23?09:48??FVTool-master\Boundary\combineBC2D.m
?????文件?????????662??2018-03-23?09:48??FVTool-master\Boundary\createBC.m
?????文件?????????771??2018-03-23?09:48??FVTool-master\Boundary\createBC1D.m
?????文件????????1094??2018-03-23?09:48??FVTool-master\Boundary\createBC2D.m
?????文件????????1309??2018-03-23?09:48??FVTool-master\Boundary\createBC3D.m
?????目錄???????????0??2018-03-23?09:48??FVTool-master\Calculus\
?????文件?????????726??2018-03-23?09:48??FVTool-master\Calculus\ddtTerm.m
?????文件?????????800??2018-03-23?09:48??FVTool-master\Calculus\ddtTerm1D.m
?????文件?????????860??2018-03-23?09:48??FVTool-master\Calculus\ddtTerm2D.m
?????文件?????????770??2018-03-23?09:48??FVTool-master\Calculus\ddtTerm3D.m
?????文件????????1031??2018-03-23?09:48??FVTool-master\Calculus\divergenceTerm.m
?????文件?????????742??2018-03-23?09:48??FVTool-master\Calculus\divergenceTerm1D.m
?????文件????????1246??2018-03-23?09:48??FVTool-master\Calculus\divergenceTerm2D.m
?????文件????????1733??2018-03-23?09:48??FVTool-master\Calculus\divergenceTerm3D.m
............此處省略313個文件信息
評論
共有 條評論