/tutorial-2021-icosahom

Trixi.jl: High-Order Numerical Simulations of Hyperbolic PDEs in Julia

Primary LanguageJupyter NotebookMIT LicenseMIT

Trixi.jl: High-Order Numerical Simulations of Hyperbolic PDEs in Julia

License: MIT DOI

This is the companion repository for the tutorial on Trixi.jl at ICOSAHOM 2021:

Tutorial 2: Trixi.jl
Venue: gather.town
Date & time: Wednesday, 14th July 2021, 6:10pm - 8:10pm (CEST)
Chaired by: Hendrik Ranocha, Michael Schlottke-Lakemper
Link: conference agenda

The gather.town link will be available in the conference agenda just shortly before the official start.

In case of questions before the beginning of the tutorial, please get in touch with Hendrik or Michael, create an issue, or join the Trixi.jl Slack workspace.

Table of contents

  1. Schedule
  2. Floor plan
  3. Tutorial files
  4. Abstract
  5. Getting started
    1. Using mybinder.org
    2. Setting up a local Julia/Jupyter installation
  6. Authors
  7. License

Schedule

The Auditorium will be used to give a few guided sessions on how to use Trixi.jl and Julia. The Computer Lab has work spaces to try out Trixi.jl on your own and with the help of our instructors. Please check out the floor plan to help with finding out where everything is located.

Note: All times are in Central European Summer Time (CEST).

Auditorium

  1. 6:20pm: What is Trixi.jl and how can I use it for my own projects?
    Speaker: Hendrik Ranocha
    Duration: approx. 15 minutes + Q&A

    • Overview of Trixi's capabilities
    • Learn how to set up and run simulations
    • Extend Trixi for your own research
    • Q&A

    Hands-on: the Jupyter notebook introduction_to_trixi.ipynb (see below) can be used to simultaneously try out the examples in the presentation

  2. 6:45pm: Getting started with Julia
    Speaker: Hendrik Ranocha
    Duration: approx. 10 minutes + Q&A

    • Brief introduction to Julia for newcomers
    • Learn about the syntax, the type model, and multiple dispatch
    • Q&A

    Hands-on: the Jupyter notebook introduction_to_julia.ipynb (see below) can be used to simultaneously try out the examples in the presentation

  3. 7:05pm: From grid generation to visualization: Working with unstructured curved meshes in Trixi.jl
    Speaker: Andrew R. Winters
    Duration: approx. 15 minutes + Q&A

    • Introduction to using HOHQMesh.jl to generate high-order meshes
    • Understand how to set up an unstructured simulation in Trixi
    • Learn about the visualization pipeline with Trixi2Vtk.jl and ParaView
    • Q&A

Computer Lab

The Computer Lab can be used any time to try out Julia and Trixi.jl in a hands-on session either in small groups or alone. There are 18 lab tables available (see floor plan), each being a private space where you can talk to all people at the same table. Throughout the room and/or at the organizer table near the south wall, you will find a number of instructors who you can ask for assistance with using Trixi.jl or Julia (just walk up to us and ask away!):

  • Christof Czernik
  • Erik Faulhaber
  • Hendrik Ranocha
  • Michael Schlottke-Lakemper
  • Andrew R. Winters

Floor plan

floorplan-icosahom-tutorial

Tutorial files

Item nbviewer mybinder
introduction_to_trixi.ipynb nbviewer Binder
introduction_to_julia.ipynb nbviewer Binder
exercises_linear_advection.ipynb nbviewer Binder
exercises_euler.ipynb nbviewer Binder
unstructured_mesh/exercises_unstructured_mesh.ipynb nbviewer Binder

Additional tutorials are available in the documentation of Trixi.jl.

Abstract

Trixi.jl is a numerical simulation framework for adaptive, high-order discretizations of conservation laws. It has a modular architecture that allows users to easily extend its functionality and was designed to be useful to experienced researchers and new users alike. In this tutorial we will demonstrate what you can do with Trixi.jl and how you can use it (and extend it) for your own research. Furthermore, there will be a hands-on session to try out Trixi for yourself, and time to talk to the Trixi developers. We will also include a short introduction to Julia for those who have not used the language before.

Getting started

You can view a static version of the Jupyter notebooks *.ipynb

  • directly on GitHub (select the notebook; this may fail sometimes)
  • or on nbviewer.jupyter.org (select the "render" badges in the table of contents above)

These static versions do not contain output of the code cells.

Below you will find information on how to use the notebooks either via mybinder.org or by setting up a local installation. If you are only interested in installing Julia and Trixi without the Jupyter setup, you can also watch a video on YouTube.

Using mybinder.org

The easiest way to get started is to click on the Launch Binder badges in the table of contents above. This launches the notebook for interactive use in your browser without the need to download or install anything locally.

In this case, you can skip the rest of this Getting started section. A Jupyter instance will be started automagically in the cloud via mybinder.org, and the notebook will loaded directly from this repository.

Note: Depending on current usage and available resources, it typically takes a few minutes to launch a notebook with mybinder.org (sometimes a little longer), so try to remain patient. Similarly, the first two cells of the notebook take much longer to execute than usual (around 1.5 minutes for the first Trixi simulation and about 1 minute for the first plot), since Julia compiles all methods "just-ahead-of-time" at first use. Subsequent runs will be much faster.

Setting up a local Julia/Jupyter installation

Alternatively, you can also clone this repository and open the notebook on your local machine. This is recommended if you already have a Julia + Jupyter setup or if you plan to try out Julia anyways.

Installing Julia and IJulia

To obtain Julia, go to https://julialang.org/downloads/ and download the latest stable release (v1.6.1 as of 2021-07-07; neither use the LTS release nor Julia Pro). Then, follow the platform-specific instructions to install Julia on your machine. Note that there is no need to compile anything if you are using Linux, MacOS, or Windows.

After the installation, open a terminal and start the Julia REPL (i.e., the interactive prompt) with

julia

To use the notebook, you also need to get the IJulia package, which provides a Julia backend for Jupyter. In the REPL, execute

using Pkg
Pkg.add("IJulia")

to install IJulia. For more details, especially on how to use an existing Jupyter installation, please refer to the IJulia documentation. From here on, we assume that you have a working installation of Julia, Jupyter, and the Julia kernel for Jupyter.

Installing the required Julia packages

To make the notebook fully reproducible, we have used Julia's package manager to pin all packages to a fixed release. This ensures that you always have a Julia environment in which all examples in this notebook work. Later you can always install the latest versions of Trixi and its dependencies by following the instructions in the Trixi documentation.

If you have not done it yet, clone the repository where this notebook is stored:

git clone https://github.com/trixi-framework/tutorial-2021-icosahom.git

Then, navigate to your repository folder and install the required packages:

cd tutorial-2021-icosahom
julia --project=. -e 'using Pkg; Pkg.instantiate()'

This will download and build all required packages, including the ODE package OrdinaryDiffEq, the visualization package Plots, and of course Trixi. The --project=. argument tells Julia to use the Project.toml and Manifest.toml files from this repository to figure out which packages to install.

As an alternative to running the examples in the notebook directly, you may also just view the notebook statically by opening it within Jupyter NBViewer.

General note: Make sure that you execute the examples (either in the notebook or in the REPL) in order, at least for the first time. Both the notebook and the Julia REPL maintain an internal state and and some snippets depend on earlier statements having been executed.

Displaying the presentation

To display the presentation as in the talk (skipping some cells/slides that provide further information), you need the Jupyter extension RISE, that you can install via

pip3 install --user RISE

After opening the Jupyter notebook, you can enter the RISE presentation mode with Alt + R.

Authors

This repository was initiated by Hendrik Ranocha, Michael Schlottke-Lakemper and Andrew R. Winters.

License

The contents of this repository are licensed under the MIT license (see LICENSE.md).