2.0 KiB
2.0 KiB
TUG: Transport on Uniform Grids for Julia
Overview
The TUG Julia package is a port of the same-named C++ library.
Prerequisites
Before installing TUG, ensure you have Julia installed on your system. Julia can be downloaded and installed from the official Julia website.
Installation
To install the TUG package locally, follow these steps in the Julia REPL (Read-Eval-Print Loop):
- Open Julia REPL: You can start it by executing
juliain your command line. - Enter Pkg mode: Press
]to enter Pkg mode, which is Julia's package manager. - Develop the Package Locally:
(v1.x) pkg> develop path/to/tug/julia/TUG # Replace with the actual path to your TUG directory - Exit Pkg mode: Press
backspaceto exit Pkg mode. - Use the Package:
julia> using TUG
Building the Documentation
To build the documentation for TUG:
- Navigate to the
docsDirectory:cd path/to/tug/julia/TUG/docs - Build the Documentation:
julia make.jl
Running Tests
To run the tests for TUG, follow these steps:
- Navigate to the TUG Package Directory:
cd path/to/tug/julia/TUG - Enter Pkg mode and run the tests:
(v1.x) pkg> test TUG
Getting Started
To get started with TUG:
Creating a Simulation
# Import the TUG package
using TUG
# Create a grid
grid = TUG.Grid{Float64}(5, ones(1, 5))
# Define boundary conditions
boundary = TUG.Boundary{Float64}(grid)
# Initialize a simulation
simulation = TUG.Simulation{Float64}(grid, boundary)
Running the Simulation
# Set initial concentrations
TUG.setConcentrations!(grid, [1.0, 1.0, 20.0, 1.0, 1.0])
# Run the simulation
TUG.run(simulation)
# Retrieve the concentrations
concentrations = TUG.getConcentrations(grid)
More Information
For a detailed reference of all functionalities and more comprehensive examples, please refer to the documentation in this repository.