MOLE: Mimetic Operators Library Enhanced
MOLE is a library that implements high-order mimetic operators to solve partial differential equations. This site provides documentation for the Julia implementation of MOLE. More information can be found on the main documentation site and the GitHub repository.
Getting Started
MOLE.jl is not yet available in the Julia's package manager. For now, this repository needs to be cloned locally in order to use the library.
Using MOLE.jl
In order to use the MOLE.jl library, first navigate to the location where the repository has been cloned to. Then, go to the mole/julia/MOLE.jl sub-directory. From here, you can access the library via the REPL or the command line.
From the REPL
In mole/julia/MOLE.jl, start Julia using the command julia --project=.. Next, the package library needs to be instantiated and pre-compiled. Enter the pkg mode by pressing ], then type the commands instantiate and precompile (one at a time). This should activate the MOLE.jl package and install the necessary dependencies.
Then, to run a script such as myScript.jl, you can use the following command in the REPL:
include("path/to/myScript.jl")From the command line
In mole/julia/MOLE.jl, use the following commands to instatiate and precompile the MOLE package:
julia --project=. -e 'using Pkg; Pkg.instantiate()'julia --project=. -e 'using Pkg; Pkg.precompile()'Then, to run a script such as myScript.jl, use the command
julia --project=. path/to/myScript.jlRunning the test suite
To run the unit tests, first enter the Julia REPL as in the above section (that is, by running the command julia --project=. from the directory mole/julia/MOLE.jl). Next, enter the pkg mode by pressing ], then type the command test. The results of the unit tests should be displayed to your console.
Building the documentation
MOLE.jl uses Documenter.jl to build its Julia implementation documentation. From the mole/julia/MOLE.jl directory, navigate to the docs/ directory, with
cd docs/From the REPL
To build the documentation from the docs/ directory, start Julia with the command julia --project=.. You should see the Julia REPL starting with the (docs) environment. Next, enter the pkg mode by pressing ], and then type the commands instantiate and precompile (one at a time). This should activate the docs environment (specific to build the documentation) and install the necessary dependencies.
Then, to build the documentation you can use the following command in the REPL:
include("make.jl")From the command line
To build the documentation from the docs/ directory, use the following commands to instatiate and precompile the documentation environment:
julia --project=. -e 'using Pkg; Pkg.instantiate()'julia --project=. -e 'using Pkg; Pkg.precompile()'Then build the documentation with the command
julia --project=. make.jlPreview the documentation
Once you have built the documentation (either from the REPL or the command line), you can inspect the documentation in docs/build with the index.html file as the homepage.
Functions
Operators
MOLE.Operators.div — Method
div(k, m, dx; dc, nc)Returns a one-dimensional mimetic divergence operator. Default is non periodic.
Arguments
k::Int: Order of accuracym::Int: Number of cellsdx::T: Step sizedc::NTuple{2,T}: Dirichlet coefficients of left and right boundaries (optional)nc::NTuple{2,T}: Neumann coefficients of left and right boundaries (optional)
MOLE.Operators.div — Method
div(k, ticks)Returns a m + 2 by m + 1 non-uniform mimetic divergence operator
Arguments
k::Int: Order of accuracyticks::AbstractArray: Edges' ticks e.g. [0 0.1 0.15 0.2 0.3 0.4 0.45]
MOLE.Operators.div — Method
div(k, m, dx, n, dy; dc, nc)Returns a two-dimensional mimetic divergence operator. Default is non periodic.
Arguments
k::Int: Order of accuracym::Int: Number of cells in x-directiondx::T: Step size in x-directionn::Int: Number of cells in y-directiondy::T: Step size in y-directiondc::NTuple{4,T}: Dirichlet coefficients of left, right, bottom, and top boundaries (optional)nc::NTuple{4,T}: Neumann coefficients of left, right, bottom, and top boundaries (optional)
MOLE.Operators.div — Method
div(k, xticks, yticks)Returns a two-dimensional non-uniform mimetic divergence operator.
Arguments
k::Int: Order of accuracyxticks::AbstractVector: Edges' ticks (x-axis)yticks::AbstractVector: Edges' ticks (y-axis)
MOLE.Operators.grad — Method
grad(k, m, dx; dc, nc)Returns a one-dimensional mimetic gradient operator. Default is non periodic.
Arguments
k::Int: Order of accuracym::Int: Number of cellsdx::T: Step sizedc::NTuple{2,T}: Dirichlet coefficients of the left and right boundaries (optional)nc::NTuple{2,T}: Neumann coefficients of the left and right boundaries (optional)
MOLE.Operators.grad — Method
grad(k, ticks)Returns a m + 1 by m + 2 one-dimensional non-uniform mimetic gradient operator
Arguments
k::Int: Order of accuracyticks::AbstractVector: Centers' ticks e.g. (0 0.5 1 3 5 7 9 9.5 10) (including the boundaries!)
MOLE.Operators.grad — Method
grad(k, m, dx, n, dy; dc, nc)Returns a two-dimensional mimetic gradient operator. Default is non periodic.
Arguments
k::Int: Order of accuracym::Int: Number of cells in x-directiondx::T: Step size in x-directionn::Int: Number of cells in y-directiondy::T: Step size in y-directiondc::NTuple{4,T}: Dirichlet coefficients of the left, right, bottom, and top boundaries (optional)nc::NTuple{4,T}: Neumann coefficients of the left, right, bottom, and top boundaries (optional)
MOLE.Operators.grad — Method
grad(k, xticks, yticks)Returns a two-dimensional non-uniform mimetic gradient operator
Arguments
k::Int: Order of accuracyxticks::AbstractVector: Centers' ticks (x-axis) (includint the boundaries!)yticks::AbstractVector: Centers' ticks (y-axis) (includint the boundaries!)
MOLE.Operators.lap — Method
lap(k, m, dx; dc, nc)Returns a m+2 by m+2 one-dimensional mimetic laplacian operator. Default is non periodic.
Arguments
k::Int: Order of accuracym::Int: Number of cellsdx::T: Step sizedc::NTuple{2,T}: Dirichlet coefficients of the left and right boundaries (optional)nc::NTuple{2,T}: Neumann coefficients of the left and right boundaries (optional)
MOLE.Operators.lap — Method
lap(k, m, dx, n, dy; dc, nc)Returns a two-dimensional mimetic laplacian operator. Default is non periodic.
Arguments
k::Int: Order of accuracym::Int: Number of cells in x-directiondx::T: Step size in x-directionn::Int: Number of cells in y-directiondy::T: Step size in y-directiondc::NTuple{4,T}: Dirichlet coefficients of the left and right boundaries (optional)nc::NTuple{4,T}: Neumann coefficients of the left and right boundaries (optional)
MOLE.Operators.interpol — Method
interpol(m, c)Returns a (m+1)×(m+2) one-dimensional interpolator of 2nd-order
Arguments
m::Int: number of cellsc::Float: left interpolation coefficient
Utilities
MOLE.BCs.robinBC — Method
robinBC(k, m, dx, a, b)Returns a m+2 by m+2 one-dimensional mimetic boundary operator that imposes a boundary condition of Robin's type.
Arguments
k::Int: Order of accuracym::Int: Number of cellsdx: Step sizea: Dirichlet Coefficientb: Neumann Coefficient
MOLE.BCs.robinBC — Method
robinBC(k, m, dx, n, dy, a, b)Alias of robinBC2D
MOLE.BCs.ScalarBC1D — Type
Concrete scalar BC description for 1D.
Fields mirror the MATLAB function:
- dc: Dirichlet coefficients (left,right)
- nc: Neumann/Robin coefficients (left,right)
- v: prescribed boundary value g (left,right)MOLE.BCs.ScalarBC2D — Type
Concrete scalar BC description for 2D.
Fields mirror the MATLAB function:
- dc: Dirichlet coefficients (left, right, bottom, top)
- nc: Neumann/Robin coefficients (left, right, bottom, top)
- vc: prescribed boundary value g (left, right, bottom, top)MOLE.BCs.addScalarBC! — Method
1D BC applicator. Mirrors MATLAB addScalarBC1D.
Signature keeps the discretization params (`k,m,dx`) separate from `bc`.MOLE.BCs.addScalarBC! — Method
2D BC applicator. Mirrors MATLAB addScalarBC2D.
Signature keeps the discretization params (`k,m,dx,n,dy`) separate from `bc`.Examples
The MOLE library contains examples demonstrating how to use the operators, in a broad range of partial differential equations (PDEs). More information on the mathematical content can be found in the main MOLE documentation.
- Elliptic1D Add Scalar Boundary Conditions
- Elliptic 1D
- 1D Elliptic Problems
- Elliptic2D X Dirichlet Y Dirichlet
- Elliptic 2D X Periodic Y Dirichlet
- 2D Elliptic Problems
- Elliptic Problems
- Burgers 1D
- Hyperbolic 1D
- 1D Hyperbolic Problems
- Hyperbolic Problems
- Parabolic2D
- 2D Parabolic Problems
- Parabolic Problems
- Examples
- MOLE: Mimetic Operators Library Enhanced
Currently, the following examples are available in the MOLE Julia package.
- Elliptic Problems
- 1D Examples
elliptic1D: A script that solves the 1D Poisson's equation with Robin boundary conditions using mimetic operators.
- 2D Examples
elliptic2DXDirichletYDirichlet: A script that solves the 2D Laplace equation, $\nabla^2 u = 0$, with Dirichlet boundary conditions in $x$ and $y$ using mimetic operators.elliptic2DXPerYDirichlet: A script that solves the 2D Laplace equation, $\nabla^2 u = 0$, with periodic bonudary conditions in $x$ and Dirichlet boundary conditions in $y$ using mimetic operators.
- 1D Examples
- Hyperbolic Problems
- 1D Examples
burgers1D: A script that solves the 1D conservative form of inviscid Burgers equation using mimetic operators.hyperbolic1D: A script that solves the 1D Hyperbolic Equation with Periodic boundary conditions using mimetic operators.
- 1D Examples
- Parabolic Problems
- 2D Examples
parabolic2D: A script that solves the 2D heat equation, $u_t = \nu \nabla^2 u$, with Dirichlet boundary conditions in $x$ and $y$ using mimetic operators.
- 2D Examples