This package provides an implementation of a 2D finite element method for solving elliptic, parabolic or hyperbolic partial differential equations in Julia. In particular, one can solve
$ (\partial_{t(t)} u) - \nabla (A*\nabla u) + b*\nabla u + c*u = f $ in $\Omega$,
$ u = g\_D $ on $\Gamma\_D$,
$ (A*\nabla u)*n = g\_N $ on $\Gamma\_N$,
$ u = u $ on $\Gamma\_P$,
where $\Omega$ is the domain and $\Gamma_D$, $\Gamma_N$ and $\Gamma_P$ denote Dirichlet, Neumann and periodic boundary, respectively. The term $(\partial_{t(t)} u)$ can be either absent (elliptic equation), or one of $\partial_t u$ (parabolic equation) or $\partial_{tt}$ u (hyperbolic equation).
It is possible to prescribe
An important feature of this implementation in Julia is that the core matrix assembly is faster than in MATLAB (see Figure).
You need:
PyPlot
(Julia Package for plotting functions, https://github.com/stevengj/PyPlot.jl)LightGraphs
(Julia Package for mathematical graphs, https://github.com/JuliaGraphs/LightGraphs.jl)gmsh
(Open source meshing program, http://gmsh.info/)avconv
(Open source frames-to-video-converter, https://libav.org/avconv.html)vlc
(Open source video player, http://www.videolan.org/vlc/)The folder Run
contains the subfolders Elliptic
, Homogenization
, Parabolic
and Hyperbolic
, each of which contains a runner file
runElliptic.jl
, runHomogenization.jl
, runParabolic.jl
or runHyperbolic.jl
, respectively. Simply set your
working directory to the respective path, start Julia and enter include("runElliptic.jl")
in the Julia REPL.
The output images/videos are stored in the Saved images
folder.
The file runElliptic.jl
essentially contains the following Julia code:
equationData = equationDataAssemble("./ellipticEquationDataLPipe.jl")
geoData = equationDataToGeoData(equationData)
geoDataPlot(geoData)
intendedMeshsize = 0.02
meshData = geoDataToMeshData(geoData,intendedMeshsize)
meshDataPlot(meshData)
deltaT = 0.0
lseData = lseDataAssemble(equationData,meshData,deltaT)
lseDataSolve(equationData,meshData,lseData)
lseDataPlot(meshData,lseData)
equationDataAssemble(...)
reads the equationData
from the file ./ellipticEquationDataLPipe.jl
. (You can edit this file to change the geometry of the domain or choose other coefficient functions $A,b,c,f,...$)equationDataToGeoData(...)
discretizes the geometry defined in equationData
and handles the intersection points between domain/holes/subdomains.geoDataPlot(...)
plots the discretized geometry stored in geoData
.geoDataToMeshData(...)
runs gmsh on the discretized domain and stores the output in meshData
.meshDataPlot(...)
plots the triangular mesh generated by gmsh.lseDataAssemble(...)
assembles the system matrix and the load vector of the LSE occuring in the FEM.lseDataSolve(...)
solves the LSE defined in lseData
and stores the solution(s) in lseData
.lseDataPlot(...)
plots the solution and eventually saves the resulting images/videos in the folder Saved images
.
03/02/2016
8 months ago
41 commits