Skip to content

Commit

Permalink
Update with paper
Browse files Browse the repository at this point in the history
  • Loading branch information
vavrines committed Jan 6, 2021
1 parent 9f27ca1 commit 93759cc
Show file tree
Hide file tree
Showing 21 changed files with 194 additions and 82 deletions.
6 changes: 4 additions & 2 deletions Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -552,9 +552,11 @@ version = "0.8.4"

[[KitBase]]
deps = ["CUDA", "Conda", "Dates", "Distributions", "FFTW", "FastGaussQuadrature", "FileIO", "JLD2", "LinearAlgebra", "OffsetArrays", "Plots", "ProgressMeter", "PyCall", "SpecialFunctions", "Test"]
git-tree-sha1 = "7a443ba2aa171ccc5570eececc35525cbf1e9ff1"
git-tree-sha1 = "038edf1373543cc02f98eccf48f7acdae29f9f3c"
repo-rev = "main"
repo-url = "https://github.com/vavrines/KitBase.jl.git"
uuid = "86eed249-3a28-466f-8d3a-596821e1af9a"
version = "0.3.2"
version = "0.3.4"

[[KitML]]
deps = ["DiffEqFlux", "Flux", "KitBase", "Optim", "OrdinaryDiffEq"]
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Kinetic"
uuid = "82403725-3cee-4f7c-b214-1ce71af4a797"
authors = ["Tianbai Xiao <tianbaixiao@gmail.com>"]
version = "0.6.0"
version = "0.7.0"

[deps]
Conda = "8f4d0f93-b110-5947-807f-2305c1781a2d"
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
-->

[![version](https://juliahub.com/docs/Kinetic/version.svg)](https://juliahub.com/ui/Packages/Kinetic/wrVmu)
[![pkgeval](https://juliahub.com/docs/Kinetic/pkgeval.svg)](https://juliahub.com/ui/Packages/Kinetic/wrVmu)
![](https://travis-ci.com/vavrines/Kinetic.jl.svg?branch=master)
[![deps](https://juliahub.com/docs/Kinetic/deps.svg)](https://juliahub.com/ui/Packages/Kinetic/wrVmu?t=2)
[![](https://img.shields.io/badge/docs-dev-blue.svg)](https://xiaotianbai.com/Kinetic.jl/dev/)
![](https://zenodo.org/badge/243490351.svg)

Expand Down
4 changes: 4 additions & 0 deletions benchmark/dynamic-vs-static.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
"""
This file compares the performance by using dynamic and static arrays to store solutions.
"""

using Kinetic, StaticArrays, BenchmarkTools, OffsetArrays
cd(@__DIR__)

Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions example/briowu_1d.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ collision = bgk
nSpecies = 2
interpOrder = 2
limiter = minmod
boundary = extra
cfl = 0.3
maxTime = 0.1

Expand Down
1 change: 1 addition & 0 deletions example/briowu_2d.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ collision = bgk
nSpecies = 2
interpOrder = 2
limiter = minmod
boundary = extra
cfl = 0.3
maxTime = 0.1

Expand Down
1 change: 1 addition & 0 deletions example/mixture_shock.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ collision = bgk
nSpecies = 2
interpOrder = 2
limiter = minmod
boundary = fix
cfl = 0.5
maxTime = 100

Expand Down
1 change: 1 addition & 0 deletions example/shear.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ collision = bgk
nSpecies = 1
interpOrder = 2
limiter = vanleer
boundary = fix
cfl = 0.5
maxTime = 0.005539

Expand Down
5 changes: 2 additions & 3 deletions example/sod.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ t = Kinetic.solve!(ks, ctr, face, t)
# it's equivalent as the following process
dt = Kinetic.timestep(ks, ctr, t)
nt = Int(floor(ks.set.maxTime / dt))
res = zeros(3)
for iter = 1:nt
Kinetic.reconstruct!(ks, ctr)
Kinetic.evolve!(ks, ctr, face, dt)

res = zeros(3)
Kinetic.update!(ks, ctr, face, dt, res)
end

plot_line(ks, ctr)
Kinetic.plot_line(ks, ctr)
1 change: 1 addition & 0 deletions example/sod.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ flux = kfvs
collision = bgk
interpOrder = 2
limiter = vanleer
boundary = fix
cfl = 0.5
maxTime = 0.2

Expand Down
Binary file added paper/bz.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added paper/ns.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added paper/paper.bib
Empty file.
177 changes: 177 additions & 0 deletions paper/paper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
---
title: 'Kinetic.jl: A lightweight finite volume toolbox in Julia'
tags:
- computational fluid dynamics
- kinetic theory
- scientific machine learning
- julia
authors:
- name: Tianbai Xiao
orcid: 0000-0001-9127-9497
affiliation: 1
affiliations:
- name: Karlsruhe Institute of Technology
index: 1
date: 06 January 2021
bibliography: paper.bib
---

# Summary

``Kinetic.jl`` is a lightweight Julia toolbox for computational fluid dynamics and scientific machine learning. It focus on the theoretical and numerical studies of many-particle systems of gases, photons, plasmas, neutrons, etc. The finite volume method (FVM) is implemented to conduct 1-3 dimensional numerical simulations for any advection-diffusion type equations.

The main module consists of ``KitBase.jl`` with basic physics and ``KitML.jl`` with neural dynamics. The high-performance Fortran library ``KitFort.jl`` is not included by default, but can be manually imported when the executing efficiency becomes the priority. A Python wrapper ``kineticpy`` has been built as well to locate the structs and methods through ``pyjulia``. The ecosystem is designed to balance the efficiency for scientific research and the simplicity for educational usage.





An illustrative example of the shock tube problem

configuration file `config.txt`


```
# case
case = sod
space = 1d2f1v
nSpecies = 1
flux = kfvs
collision = bgk
interpOrder = 2
limiter = vanleer
boundary = fix
cfl = 0.5
maxTime = 0.2
# physical space
x0 = 0
x1 = 1
nx = 200
pMeshType = uniform
nxg = 1
# velocity space
vMeshType = rectangle
umin = -5
umax = 5
nu = 28
nug = 0
# gas
knudsen = 0.0001
mach = 0.0
prandtl = 1
inK = 2
omega = 0.81
alphaRef = 1.0
omegaRef = 0.5
```

and execute the following codes

```julia
using Kinetic
ks, ctr, face, t = initialize("config.txt")
t = solve!(ks, ctr, face, t)
plot_line(ks, ctr)
```

`solve!` is equivalent as the low-level solution algorithm

```julia
dt = timestep(ks, ctr, t)
nt = Int(floor(ks.set.maxTime / dt))
res = zeros(3)
for iter = 1:nt
Kinetic.reconstruct!(ks, ctr)
Kinetic.evolve!(ks, ctr, face, dt)
Kinetic.update!(ks, ctr, face, dt, res)
end
```





``Kinetic.jl`` is interested in theoretical and numerical studies of many-particle systems of gases, photons, plasmas, neutrons, etc. It employs the finite volume method (FVM) to conduct 1-3 dimensional numerical simulations on CPUs and GPUs. Any advection-diffusion-type equation can be solved within the framework. Special attentions have been paid on Hilbert's sixth problem, i.e. to build the numerical passage between kinetic theory of gases, e.g. the Boltzmann equation



e.g. compressible gas dynamics.



Hilbert's sixth problem


cubersome
phase field



``Oceananigans.jl`` is designed for high-resolution simulations in idealized
geometries and supports direct numerical simulation, large eddy simulation,
arbitrary numbers of active and passive tracers, and linear and nonlinear
equations of state for seawater. Under the hood, ``Oceananigans.jl`` employs a
finite volume algorithm similar to that used by the Massachusetts Institute of
Technology general circulation model [@Marshall1997].

![Fig. 1](free_convection_and_baroclinic_instability.png)
Fig. 1: (Left) Large eddy simulation of small-scale oceanic boundary layer
turbulence forced by a surface cooling in a horizontally periodic domain using
$256^3$ grid points. The upper layer is well-mixed by turbulent convection and
bounded below by a strong buoyancy interface. (Right) Simulation of
instability of a horizontal density gradient in a rotating channel using
$256\times512\times128$ grid points. A similar process called baroclinic
instability acting on basin-scale temperature gradients fills the oceans with
eddies that stir carbon and heat. Plots made with `matplotlib` [@Hunter2007]
and `cmocean` [@Thyng2016].

``Oceananigans.jl`` leverages the Julia programming language [@Bezanson2017] to
implement high-level, low-cost abstractions, a friendly user interface, and a
high-performance model in one language and a common code base for execution on
the CPU or GPU with Julia’s native GPU compiler [@Besard2019]. Because Julia is
a high-level language, development is streamlined and users can flexibly specify
model configurations, set up arbitrary diagnostics and output, extend the code
base, and implement new features. Configuring a model with `architecture=CPU()`
or `architecture=GPU()` will execute the model on the CPU or GPU. By pinning a
simulation script against a specific version of Oceananigans, simulation results
are reproducible up to hardware differences.

Performance benchmarks show significant speedups when running on a GPU. Large
simulations on an Nvidia Tesla V100 GPU require ~1 nanosecond per grid point per
iteration. GPU simulations are therefore roughly 3x more cost-effective
than CPU simulations on cloud computing platforms such as Google Cloud. A GPU
with 32 GB of memory can time-step models with ~150 million grid points assuming
five fields are being evolved; for example, three velocity components and
tracers for temperature and salinity. These performance gains permit the
long-time integration of realistic simulations, such as large eddy simulation of
oceanic boundary layer turbulence over a seasonal cycle or the generation of
training data for turbulence parameterizations in Earth system models.

``Oceananigans.jl`` is continuously tested on CPUs and GPUs with unit tests,
integration tests, analytic solutions to the incompressible Navier-Stokes
equations, convergence tests, and verification experiments against published
scientific results. Future development plans include support for distributed
parallelism with CUDA-aware MPI as well as topography.

Ocean models that are similar to ``Oceananigans.jl`` include MITgcm
[@Marshall1997] and MOM6 [@Adcroft2019], both written in Fortran. However,
``Oceananigans.jl`` features a more efficient non-hydrostatic pressure solver
than MITgcm (and MOM6 is strictly hydrostatic). PALM [@Maronga2020] is Fortran
software for large eddy simulation of atmospheric and oceanic boundary layers
with complex boundaries on parallel CPU and GPU architectures. ``Oceananigans.jl``
is distinguished by its use of Julia which allows for a script-based interface as
opposed to a configuration-file-based interface used by MITgcm, MOM6, and PALM.
Dedalus [@Burns2020] is Python software with an intuitive script-based interface
that solves general partial differential equations, including the incompressible
Navier-Stokes equations, with spectral methods.

``Kinetic.jl`` is an open-source project hosted on GitHub and distributed under MIT license.

# Acknowledgements

The current work is funded by the Alexander von Humboldt Foundation

# References
Binary file added paper/sod.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 1 addition & 4 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using Test, Kinetic

include("test_moments.jl")
include("test_struct.jl")
include("test_quadrature.jl")
include("test_solver.jl")
ks, ctr, face, simTime = Kinetic.initialize("config.txt")
60 changes: 0 additions & 60 deletions test/test_moments.jl

This file was deleted.

4 changes: 0 additions & 4 deletions test/test_quadrature.jl

This file was deleted.

1 change: 0 additions & 1 deletion test/test_solver.jl

This file was deleted.

5 changes: 0 additions & 5 deletions test/test_struct.jl

This file was deleted.

0 comments on commit 93759cc

Please sign in to comment.