Nektar-diffusion proxy-app: An anisotropic thermal conduction proxy-app for the magnetized plasma written in Nektar++ framework [1]. The derivation of the anisotropic thermal conduction in the magnetized plasma and its variational formulation are documented in the docs
folder. For the detailed formulations and tutorials of Nektar++, please refer to the documentation on the Nektar++ website. Some examples are provided in the example
folder.
The variational formulation of the two-dimensional anisotropic thermal conduction in the magnetized plasma can be written as
where
The Nektar-diffusion proxy-app should be compiled against Nektar++ v5.5.0. This can be done by either using pre-compiled binary packages or compiling it from source. Alternatively a Dockerfile image can be generated which includes Nektar++, the nektar-diffusion proxy-app and the included examples.
To use the docker image, clone the nektar-diffusion repository and, from the top directory, build the image using
docker build -t nektar-diffusion .
and then run an interactive shell
docker run -it nektar-diffusion /bin/bash
Install CMake using your normal package management tools.
Install the v5.5.0 libnektar++-dev
or libnektar++-devel
package (as appropriate), following instructions at https://www.nektar.info.
Then compile the nektar-diffusion solver using
mkdir build && cd build
cmake ..
make install
Download the source code for Nektar++ v5.5.0
git clone https://gitlab.nektar.info/nektar/nektar
cd nektar
git checkout v5.5.0
Compile it following the instructions at https://www.nektar.info. To save time, set NEKTAR_BUILD_SOLVERS=OFF and NEKTAR_BUILD_DEMOS=OFF. Many of the dependencies are available as pre-built packages in most Linux distributions (e.g. Boost, TinyXML, Scotch, BLAS, LAPACK). It is recommended to turn on the NEKTAR_USE_MPI option to enable parallel execution. Run make install
to collate the binaries and library files under the dist
sub-directory and (optionally) set CMAKE_INSTALL_PREFIX to your preferred install location. To check Nektar++ is built correctly run ctest
.
Then compile the nektar-diffusion solver using
mkdir build && cd build
cmake -DNektar++_DIR=/path/to/build/dist/lib/nektar++/cmake -DNEKTAR_BUILD_DOCS=ON ..
make install
where /path/to/build/dist/lib/nektar++/cmake
is the path containing the Nektar++Config.cmake file.
Debugging compilation, installation and testing:
If the compilation fails, check the possible broken links during the configuration by the command ccmake .. and toggle the curses interface to the advanced mode by press the t key. A list of detailed links to the libraries will appear for investigation.
If an error was observed during installation, take note the description of this error and identify which program causes it. For example, if it is related to mpi, double check the possible broken links of mpi during configuration or verify the working condition of the pre-installed mpi on the cluster. In addition, the installed programs should be compatible with the version of Nektar++
. The full list of the compatible versions of program can be found in the user-guide.
If some testing cases fail during ctest, check the log files in the $HOME/nektar-v5.5.0/build/Testing/Temporary/ folder and identify the origin of the error.
If Nektar++ has been compiled from source, it is convenient to add the location of the binary files to the system PATH:
export PATH="$PATH:/path/to/nektar++/build/dist/bin"
In the provided examples, the mesh is prepared using gmsh. However, the Nektar++ meshes are also provided.
To modify the mesh, Gmsh is required. It can be installed by using binary packages provided the Linux distribution or compiling from source by running
cd $HOME
wget https://gmsh.info/bin/Linux/gmsh-2.16.0-Linux64.tgz
tar -xvzf gmsh-2.16.0-Linux64.tgz
cd gmsh-2.16.0-Linux
echo 'PATH=$HOME/gmsh-2.16.0-Linux/bin:$PATH' >> $HOME/.bashrc
source $HOME/.bashrc
To run the examples provided in the example folder, access the folder containing a particular example and execute the following command:
- convert mesh
gmsh -2 -order 1 domain.geo
NekMesh domain.msh domain.xml
- execute simulation
mpirun -np 4 DiffusionSolver domain.xml conditions.xml
- post-processing
FieldConvert domain.xml domain.fld domain.vtu
The output file format is in .vtu (VTK file) which can be visualised in Paraview.
The key parameters to set up the simulation are listed below:
Parameter | Description |
---|---|
theta | angle of magnetic field |
B | magnitude of magnetic field |
k_par | thermal conductivity parallel to magnetic field |
k_perp | thermal conductivity perpendicular to magnetic field |
epsilon | diffusion coefficient |
A = m_i/m_p | ratio between masses of ions and proton |
Z | ion charge state |
lambda | Coulomb logarithm |
TimeStep | time step size |
NumSteps | total number of time steps |
IO_CheckSteps | output frequency |
Typically the angle and magnitude of the magnetic field should be specified a prior. The angle is measured with respect to the positive
Two examples are provided:
This example has initial conditions of a heat sink with a Gaussian shape on one side of an annular domain; an equal heat sink is on the opposite side of the annulus. A magnetic field circulates around the void. The thermal conductivity along the magnetic field lines is much greater than the conductivity perpendicular to the field lines. The function describing the sources and sinks is (in Cartesian coordinates):
where
The domain is subject to Dirichlet boundary conditions
Shown below is the system at an early stage
Shown below is the system at a later stage
The second example is a poloidal section through the MAST-U device, using the magnetic field given in the file B.pts
. The heat diffusion is again isotropic, favouring the magnetic field direction.
For the boundary conditions, the core region is held at a high temperature TCore
, and the outer region at a low temperature (300 and 0 respectively for these images). Currently the domain does not have axial symmetry, so does not completely represent the true scenario.
Shown below is the system at an early stage
Shown below is the system at a later stage
[1] Cantwell et al, Nektar++: An open-source spectral/hp element framework., JCP, 2015 [DOI]
See the LICENSE file for license rights and limitations (MIT).