Content uploaded by Felipe Nornberg Schuch
Author content
All content in this area was uploaded by Felipe Nornberg Schuch on Oct 13, 2020
Content may be subject to copyright.
A Jupyter Sandbox Environment Coupled Into the
High-Order Navier-Stokes Solver Xcompact3d
Motivation
This work aims to break many of the barriers to entry in an academic
Navier-Stokes solver, for instance:
▶The domain decomposition in a distributed-memory system;
▶Coding, compiling, and debugging in programming languages FORTRAN or C;
▶The fear of lower anything in the code;
▶Stability of dierent numerical methods;
▶Lack of documentation and others.
Objective
▶Build a Python layer above the FORTRAN coded Navier-Stokes solver.
Methodology
The Jupyter CFD Sandbox framework is actuality part of two bigger projects:
▶The Navier-Stokes solver Xcompact3d [1, 8] was modified to accept the entire
initial set-up from an external source. The main features of the code are:
•High order finite-dierence schemes;
•Modeling of a solid body inside the computational domain;
•Scalar equations for mass and/or heat transport;
•Scalability across High-performance Computing platforms;
•Support for Direct and Large-Eddy numerical simulations.
▶The initial set-up, in turn, can be done using the Python package
Xcompact3d-toolbox [10] and a Jupyter Notebook, taking advantage of:
•Built-in documentation with markdown cells (including figures, tables, equations and more);
•Visualization and interactivity with widgets and ploing libraries;
•The versatility and readability of Python coding and the Jupyter Ecosystem.
Parameters
▶The physical and computational parameters are built on top of traitlets [5], a framework
that lets Python classes have aributes with type checking, dynamically calculated
default values, and “on change” callbacks;
▶The input parameters can be checked for consistency and compatibility;
▶In addition to ipywidgets [3] for an user friendly interface;
▶See the tutorial on the Documentation page [9].
Dataset
▶Axarray.Dataset [6] is provided (see Why xarray? [7]), initializing the initial and
boundary conditions, and other variables that Xcompact3d expects, all with the proper
size, dimensions, coordinates and aributes;
▶On top of that, the user can build many dierent flow configurations from a Jupyter
Notebook, with no need to recompile the Navier-Stokes solver every time;
▶See examples on the documentation page [9].
Solid Body
▶A solid body can be inserted into the Cartesian domain using a customized Immersed
Boundary Method (IBM) [2];
▶An accessor for xarray.DataArray with standard geometries is included;
▶They can be combined for the creation of unique outcomes, like the Ahmed Body.
Simulate / Analyze
0
10
x2
(a) t= 500
0
10
x2
(b) t= 750
0 50 100 150 200 250
x1
0
10
x2
(c) t= 1000
0.0
0.5
1.0
c
▶Aer the initial set-up, Xcompact3d-toolbox provides methods to write all necessary
variables to the disc with the proper format;
▶Then, the Navier-Stokes solver Xcompact3d can be executed;
▶Notice that Xcompact3d-toolbox also supplies support for post-processing;
▶The figure on the le illustrates the time evolution of the spanwise-averaged
concentration field for the plunging flow in tilted bed [4], simulated by Xcompact3d.
Conclusions
▶The outcome of this work benefits users from dierent levels:
•For students in computational fluid dynamics, it provides direct hands-on experience and a
safe place for practicing and learning;
•For advanced users and code developers, it works as a rapid prototyping tool to test concepts
and then compare results to validate any future implementations at the numerical solver.
▶The presented framework is a useful advance in terms of research reproducibility;
▶It can be ported to any other numerical solver, let us know if you do so.
Acknowledgments
This study was supported by Petrobras S.A. and financed in part by the
Coordenação de Aperfeiçoamento de Pessoal de Nível Superior - Brazil (CAPES) -
Finance Code 88887.154060/2017-00.
References
[1] P. Bartholomew, G. Deskos, R. A. Frantz, F. N. Schuch, E. Lamballais, and S. Laizet. Xcompact3d:
An open-source framework for solving turbulence problems on a cartesian mesh. SowareX, 2020.
[2] R. Gautier, S. Laizet, and E. Lamballais. A dns study of jet control with microjets using an im-
mersed boundary method. International Journal of Computational Fluid Dynamics, 28, 2014.
[3] ipywidgets. View documentation. https://ipywidgets.readthedocs.io.
[4] F. N. Schuch, J. H. Silvestrini, E. Meiburg, and S. Laizet. The plunging of hyperpycnal plumes on
tilted bed by three-dimensional large-eddy simulations. In 12th Spring School on Transition and
Turbulence, Blumenau, SC, Brazil, 2020. ABCM, 10.5281/zenodo.3968993.
[5] traitlets. View documentation. https://traitlets.readthedocs.io.
[6] xarray. View documentation. http://xarray.pydata.org.
[7] xarray. Why xarray? http://xarray.pydata.org/en/stable/why-xarray.html.
[8] Xcompact3d. View on github. https://github.com/xcompact3d/Incompact3d.
[9] Xcompact3d-toolbox. View documentation. https://xcompact3d-toolbox.readthedocs.io.
[10] Xcompact3d-toolbox. View on github. https://github.com/fschuch/xcompact3d_toolbox.
Felipe N. Schuch, Filipi D. Vianna, André Mombach and Jorge H. Silvestrini
Laboratório de Simulação de Escoamentos Turbulentos - LaSET, the CFD lab at PUCRS
School of Technology, Pontical Catholic University of Rio Grande do Sul, Porto Alegre, Brazil