SlideShare a Scribd company logo
1 of 7
Download to read offline
Beginner’s guide to Basilisks
Vatsal Sanjay
vatsalsanjay@gmail.com
February 18, 2018
Abstract
This document is a review and guide to the installation and working of Basilisk (link), written by Stéphane
Popinet and his group. These notes are for personal use only, and detailed guide could be found at <link>.
Regarding this file: Since basilisk is still in the early stages of development, the facts written in this
document are subject to change. If you find any information here outdated or incomplete, please let me
know. You can also clone this repository (https://github.com/VatsalSy/GuideBasilisk), make changes and
push it.
1 Installing Basilisk
Installation is quite easy. There are two ways: Using darcs OR using tarball. I prefer the first one (darcs)
because it allows to easily pull any update that occurs in Basilisk. The steps of this section are taken from
http://basilisk.fr/src/INSTALL. They are self-explanatory I have included them here, just for the sake of com-
pletion.
1.1 Installing darcs (if unavailable)
vatsal@cloneMachine:∼ $ sudo apt-get install darcs flex make
1.2 Some important side packages
vatsal@cloneMachine:∼ $ sudo apt-get install gnuplot imagemagick libav-tools smpeg-plaympeg graphviz valgrind
gifsicle
1.3 Getting Basilisk source code
vatsal@cloneMachine:∼ $ darcs get http://basilisk.fr/basilisk
Note: In order to pull new changes made in Basilisk, use:
vatsal@cloneMachine:∼ $ cd basilisk
vatsal@cloneMachine:∼ $ darcs pull
Then recompile.
1.4 Compiling/recompiling Basilisk
vatsal@cloneMachine:∼ $ cd basilisk/src
vatsal@cloneMachine:∼ $ export BASILISK=$PWD
vatsal@cloneMachine:∼ $ export PATH=$PATH:$PWD
vatsal@cloneMachine:∼ $ ln -s config.gcc config
vatsal@cloneMachine:∼ $ make -k
vatsal@cloneMachine:∼ $ make
1
2 Basilisk-View
Details of bview: http://basilisk.fr/src/README#interactive-basilisk-view
Basilisk-view is similar to GfsView, with some minor differences:
1. Unlike GfsView, we cannot run bview on the fly while basilisk is running. We can, however, use it to render
pictures and videos on the fly with bview. It can be used to look at the results after simulation is over,
provided we have saved the intermediate files.
2. There is no program written analogous to gfs2oogl for bview. This means that we cannot interpolate the
octree based data using available libraries. We could write our own code for it in future, something similar
to gfs2oogl.
3. The coordinate systems for GfsView and Basilisk are different. GfsView output is rotated counter-clockwise
compared to Gerris: this is due to the new N-ordering of quadtree cells (rather than Z-ordering). See these
link1 and link2.
4. I found a working example for tecplot users (here), but I have not tested it yet.
GfsView can still be used with Basilisk, provided that the code does not use “mask”command. Mask command
is used for creating solid objects and non-square (non-cubical) geometries. The precursor to using gfsview and
writing “.gfs”files, “dump”is not compatible with “mask”. Most likely, even bview cannot be used to look
at intermediate files when “mask”is used, but I have not changed it. For other compatibility issues, visit:
http://basilisk.fr/src/COMPATIBILITY.
2.1 Installing bview
Sources: (go in this order)
1. bview: http://basilisk.fr/src/bview
2. Screen rendering: http://basilisk.fr/src/gl/INSTALL
3. Python for bview-client: http://basilisk.fr/src/bview-client.py
4. Actual installation: http://basilisk.fr/src/bview-server.c
2.1.1 Dependencies
For cluster for off-screen rendering:
vatsal@cloneMachine:∼ $ sudo apt-get install libglu1-mesa-dev libosmesa6-dev
vatsal@cloneMachine:∼ $ cd $BASILISK/gl
vatsal@cloneMachine:∼ $ make libglutils.a libfb osmesa.a
Another method would be to use the following (recommended for laptops), the above dependencies are recom-
mended for clusters.
vatsal@cloneMachine:∼ $ sudo apt-get install libglu1-mesa-dev libglew-dev libgl1-mesa-dev
vatsal@cloneMachine:∼ $ cd $BASILISK/gl
vatsal@cloneMachine:∼ $ make libglutils.a libfb glx.a
The following is required for both the above versions:
vatsal@cloneMachine:∼ $ sudo apt-get install python-pil.imagetk
2.1.2 bview
(Optional) Add this line at the end of config.gcc, depending on the type of machine and dependency selected:
Osmesa (Cluster):
[frame=singhe]
OPENGLIBS = -lfb_osmesa -lGLU -lOSMesa
Glx (Laptop):
OPENGLIBS = -lfb_glx -lGLU -lGLEW -lGL -lX11
Then do this:
vatsal@cloneMachine:∼ $ cd $BASILISK
vatsal@cloneMachine:∼ $ make bview-servers
For a typical bview use and environment, follow the example at:http://basilisk.fr/src/bview
2
3 A typical code
Basilisk codes are modified C++ files.
A good place to start understanding Basilisk would be http://basilisk.fr/Tutorial. Here, I have added the case
of liquid jet atomization. I have tried to compare and contrast this case with the famous jet atomization case
simulated using gerris (which we are more familiar with).
3.1 Header File
Just like a standard C++ code, we need to include the libraries that we are going to use.
#include "navier-stokes/centered.h"
#include "two-phase.h"
#include "tension.h"
#include "tag.h"
#include "view.h"
1. navier-stokes/centered.h is the normal Gerris implemented Navier-Stokes equation solver for incompressible
variable (two-phase) density flow.
2. two-phase.h is the simulations setup file for flows of two fluids separated by an interface (i.e. immiscible
fluids). It is typically used in combination with a NavierStokes solver.
3. tension.h includes the surface tension force, same as Gerris by adding σκδi term in NS equation.
4. tag.h is used to count the number of droplets in the simulation. Unlike Gerris, in Basilisk, we get this special
feature which when combined with a small sub-routine (given later) can count the number of droplets.
5. view.h is important for using Basilisk-View.
3.2 Defining custom variables
#define radius 1./12.
#define length 0.025
#define Re 5800
#define SIGMA 3e-5
int maxlevel = 7;
double uemax = 0.1;
Just like Gerris, here we can define some global variables which can be used later on in the file. For this specific
example, radius is the radius of the liquid jet, length is the initialized length (similar to Gerris, we will initialize
a small length of the jet and highly refine that part at t = 0), Re is the Reynold’s number of the liquid jet,
SIGMA is the σ (surface tension) at liquid-air interface, maxlevel is the maximum octree refinement level and
uemax is the maximum allowable error in the velocity field.
3.3 Initial Conditions
scalar f0[];
//Initial conditions
event init (t = 0) {
if (!restore (file = "dump")) {
refine (x < 1.2*length && sq(y) + sq(z) < 2.*sq(radius) && level < maxlevel);
fraction (f0, sq(radius) - sq(y) - sq(z));
f0.refine = f0.prolongation = fraction_refine;
restriction ({f0});
foreach() {
f[] = f0[]*(x < length);
u.x[] = f[];
}
boundary ({f,u.x});
}
}
3
A scalar field f0 is defined. It is analogous to the T0 variable we usually define in Gerris. An event instance is
declared for declaring initial conditions. The commands are executed if and only if the file named “dump”is not
present. The grid is refined in a cylindrical region, 1.2 times the size of initialized jet and
√
2 times its radius.
Further, the variable field f0 is set at 1 inside the cylinder (y2
+ z2
< r2
) and zero otherwise. Moreover, f0.refine
= f0.prolongation = fraction refine; refines the volume fraction field (details). Further, restriction(f0); is used
for boundary conditions on levels. The foreach command is a modified for loop to initialize the initial conditions
in all the cells. At last, boundary (f,u.x); defines the boundary conditions at t = 0 (details). The stencils located
near the boundary extends beyond it and the last line initializes these ghost values. By default, the boundary
condition is symmetry and if the domain values are modified, it is necessary to modify the ghost values as well
and therefore the last line is needed.
3.4 Boundary Condition
/* We then set an oscillating inflow velocity on the
left-hand-side and free outflow on the right-hand-side. */
u.n[left] = dirichlet(f0[]*(1. + 0.05*sin (10.*2.*pi*t)));
u.t[left] = dirichlet(0);
p[left] = neumann(0);
f[left] = f0[];
u.n[right] = neumann(0);
p[right] = dirichlet(0);
Setting boundary conditions is intuitive and the above code snip is self-explanatory. Unlike Gerris, we do not have
to create the web of boxes and manually see to the inter-connectivities. In order to get a cuboidal (rectangular)
domain or create complex geometries, “mask”can be used. However, “dump”command used to write output data
is not compatible with “mask”yet.
3.5 Adaptive Mesh Refinement
event adapt (i++) {
adapt_wavelet ({f,u}, (double[]){0.01,uemax,uemax,uemax}, maxlevel);
}
Basilisk uses the “wavelet”method for AMR based on the maximum allowable error. In the syntax, {f,u} defines
the variables based on which refinement is to be done (please note, it is a 4 element vector). In the second term,
{0.01,uemax,uemax,uemax} enlists the maximum error allowed.
3.6 The end time of simulation
Unlike Gerris, there is no option to set end-time in Basilisk (that I could find). It is set with the maximum time
event available in the script. Therefore, we can make one event to be executed at the end time of simulation and
do not mention time anywhere else in the code. Please note that the “event”is
event end (t = 2.5) {
printf ("i = %d t = %gn", i, t);
}
3.7 The main run snippet
int main ()
{
/**
The initial domain is discretised with $64^3$ grid points. We set
the origin and domain size. */
init_grid (64);
origin (0, -1.5, -1.5);
L0 = 3.;
/*
We set the density and viscosity of each phase as well as the
surface tension coefficient and start the simulation. */
rho1 = 1., rho2 = 1./27.84;
4
mu1 = 2.*radius/Re*rho1, mu2 = 2.*radius/Re*rho2;
f.sigma = SIGMA;
run();
}
This is the main function which executes the simulation. The command init grid (n) descritizes the domain
length in n number of cells.
Origin: Setting origin is different than that in Gerris. Origin can be set using origin (x0, y0, z0). In this,
(x0, y0, z0) is the co-ordinate location of the left-bottom-back corner with respect to the intended origin. For
example, if you want the origin to be at center of the left wall, the command will read (0, -1.5, -1.5).
L0 is used to set the length of the domain. Please note that the domain is always cubical in Basilisk. So if you
want to make a cuboid then it is necessary to use “mask”. The other variables, mi and rhoi (∀ i ∈ {1, 2}) define
the viscosity and density respectively and are local variables to the file “twophase.h”. At last, f.sigma is the
surface tension for the VOF tracer f.
3.8 Writing log files and on terminal
event logWriting (i++) {
static FILE * fp;
if (i == 0) {
fprintf (ferr, "i dt tn");
fp = fopen ("log", "w");
fprintf (fp, "i dt tn");
fprintf (fp, "%d %g %gn", i, dt, t);
fclose(fp);
} else {
fp = fopen ("log", "a");
fprintf (fp, "%d %g %gn", i, dt, t);
fclose(fp);
}
fprintf (ferr, "%d %g %gn", i, dt, t);
}
This part is used to output the simulation temporal information on the terminal as well as store them in the file
named “log”.
3.9 Generating movies
/**
We generate an animation using Basilisk View. */
event movie (t += 1e-2)
{
#if dimension == 2
scalar omega[];
vorticity (u, omega);
view (tx = -0.5);
clear();
draw_vof ("f");
squares ("omega", linear = true, spread = 10);
box ();
#else // 3D
scalar pid[];
foreach()
pid[] = fmod(pid()*(npe() + 37), npe());
boundary ({pid}); // not used for the moment
view (camera = "iso",
fov = 14.5, tx = -0.418, ty = 0.288,
width = 1600, height = 1200);
5
clear();
draw_vof ("f");
box ();
#endif // 3D
static FILE * fp = popen ("ppm2mp4 > movie.mp4", "w");
save (fp = fp);
}
This is just a typical code to generate movie of the simulation. For details, look at the guide to bview.
3.10 Data dumping
event snapshot (t = 0; t += 0.1)
{
dump (file = "dump");
char nameGfs[80];
sprintf (nameGfs, "intermediateGfs/snapshot-%2.1f.gfs", t);
output_gfs (file = nameGfs, t = t);
char nameBview[80];
sprintf (nameBview, "intermediateBview/snapshot-%2.1f", t);
dump (file = nameBview);
}
These are used to write data files. To write “.gfs”files, output gfs (file = nameGfs, t = t); is used. For writing
data files read and processed by bview, “dump (file = nameBview);’can be used.
3.11 Visualization on the fly
Currently, bview is not equipped for visualization on the fly. But, the following code can be used to run gfsview
on the go.
event gfsview (i++) {
static FILE * fp = popen ("gfsview3D", "w");
output_gfs (fp);
}
Please note that in presence of “mask”, the “dump”and “output gfs”commands will write corrupted intermediate
files.
3.12 Running scripts
3.12.1 At t = 0
To start the simulation, use the script file, named “run0.sh”. It deletes the log and dump files if they exist and
creates the empty folders.
if [ -f "log" ];
then
rm log
fi
if [ -f "dump" ];
then
rm dump
fi
if [ -d "intermediateGfs" ]
then
rm -r intermediateGfs
fi
if [ -d "intermediateBview" ]
6
then
rm -r intermediateBview
fi
mkdir intermediateGfs
mkdir intermediateBview
qcc -O2 -Wall -grid=octree $file.c -o $file -lm 
-L$BASILISK/gl -lglutils -lfb_glx -lGLU -lGLEW -lGL -lX11 -lm
#qcc -O2 -Wall $file.c -o $file -lm 
# -L$BASILISK/gl -lglutils -lfb_osmesa -lGLU -lOSMesa -lm
Moreover, in order to make changes in between the simulation and re-start it, the script file named “runRe.sh”can
be used. This simply compiles the code.
if [ ! -d "intermediateGfs" ]
then
mkdir intermediateGfs
fi
if [ ! -d "intermediateBview" ]
then
mkdir intermediateBview
fi
qcc -O2 -Wall -grid=octree $file.c -o $file -lm 
-L$BASILISK/gl -lglutils -lfb_glx -lGLU -lGLEW -lGL -lX11 -lm
#qcc -O2 -Wall $file.c -o $file -lm 
# -L$BASILISK/gl -lglutils -lfb_osmesa -lGLU -lOSMesa -lm
7

More Related Content

What's hot

Introdcution to Openfoam--working with free software
Introdcution to Openfoam--working with free softwareIntrodcution to Openfoam--working with free software
Introdcution to Openfoam--working with free softwarepengding2
 
Introduction to FINFET, Details of FinFET
Introduction to FINFET, Details of FinFETIntroduction to FINFET, Details of FinFET
Introduction to FINFET, Details of FinFETJustin George
 
1.2V Analog I/O with full local ESD protection for TSMC 65nm technology
1.2V Analog I/O with full local ESD protection for TSMC 65nm technology1.2V Analog I/O with full local ESD protection for TSMC 65nm technology
1.2V Analog I/O with full local ESD protection for TSMC 65nm technologySofics
 
OS Memory Management
OS Memory ManagementOS Memory Management
OS Memory Managementanand hd
 
Full DDR Bank Power and Signal Integrity Analysis with Chip-Package-System Co...
Full DDR Bank Power and Signal Integrity Analysis with Chip-Package-System Co...Full DDR Bank Power and Signal Integrity Analysis with Chip-Package-System Co...
Full DDR Bank Power and Signal Integrity Analysis with Chip-Package-System Co...Ansys
 
MIPI DevCon 2021: Meeting the Needs of Next-Generation Displays with a High-P...
MIPI DevCon 2021: Meeting the Needs of Next-Generation Displays with a High-P...MIPI DevCon 2021: Meeting the Needs of Next-Generation Displays with a High-P...
MIPI DevCon 2021: Meeting the Needs of Next-Generation Displays with a High-P...MIPI Alliance
 
graphics processing unit ppt
graphics processing unit pptgraphics processing unit ppt
graphics processing unit pptNitesh Dubey
 
A solder joint reliability model for the philips lumileds luxeon rebel led c...
A solder joint reliability model for the philips lumileds luxeon rebel led  c...A solder joint reliability model for the philips lumileds luxeon rebel led  c...
A solder joint reliability model for the philips lumileds luxeon rebel led c...Greg Caswell
 
Quad Small Form-factor Pluggable (QSFP) Interconnect System
Quad Small Form-factor Pluggable (QSFP) Interconnect SystemQuad Small Form-factor Pluggable (QSFP) Interconnect System
Quad Small Form-factor Pluggable (QSFP) Interconnect SystemPremier Farnell
 
Memory Management
Memory ManagementMemory Management
Memory ManagementSanthiNivas
 
Fluent Introduction - Some Best Practice_._.pptx
Fluent Introduction - Some Best Practice_._.pptxFluent Introduction - Some Best Practice_._.pptx
Fluent Introduction - Some Best Practice_._.pptxLibinAbrahamKonattu
 
NMOS fabrication process
NMOS fabrication processNMOS fabrication process
NMOS fabrication processSemi Design
 
ISSCC 2018: "Zeppelin": an SoC for Multi-chip Architectures
ISSCC 2018: "Zeppelin": an SoC for Multi-chip ArchitecturesISSCC 2018: "Zeppelin": an SoC for Multi-chip Architectures
ISSCC 2018: "Zeppelin": an SoC for Multi-chip ArchitecturesAMD
 
Real Time OS For Embedded Systems
Real Time OS For Embedded SystemsReal Time OS For Embedded Systems
Real Time OS For Embedded SystemsHimanshu Ghetia
 

What's hot (20)

Introdcution to Openfoam--working with free software
Introdcution to Openfoam--working with free softwareIntrodcution to Openfoam--working with free software
Introdcution to Openfoam--working with free software
 
Introduction to FINFET, Details of FinFET
Introduction to FINFET, Details of FinFETIntroduction to FINFET, Details of FinFET
Introduction to FINFET, Details of FinFET
 
1.2V Analog I/O with full local ESD protection for TSMC 65nm technology
1.2V Analog I/O with full local ESD protection for TSMC 65nm technology1.2V Analog I/O with full local ESD protection for TSMC 65nm technology
1.2V Analog I/O with full local ESD protection for TSMC 65nm technology
 
OS Memory Management
OS Memory ManagementOS Memory Management
OS Memory Management
 
finfet tsmc.pdf
finfet tsmc.pdffinfet tsmc.pdf
finfet tsmc.pdf
 
BGR
BGRBGR
BGR
 
Full DDR Bank Power and Signal Integrity Analysis with Chip-Package-System Co...
Full DDR Bank Power and Signal Integrity Analysis with Chip-Package-System Co...Full DDR Bank Power and Signal Integrity Analysis with Chip-Package-System Co...
Full DDR Bank Power and Signal Integrity Analysis with Chip-Package-System Co...
 
Gpu
GpuGpu
Gpu
 
MIPI DevCon 2021: Meeting the Needs of Next-Generation Displays with a High-P...
MIPI DevCon 2021: Meeting the Needs of Next-Generation Displays with a High-P...MIPI DevCon 2021: Meeting the Needs of Next-Generation Displays with a High-P...
MIPI DevCon 2021: Meeting the Needs of Next-Generation Displays with a High-P...
 
graphics processing unit ppt
graphics processing unit pptgraphics processing unit ppt
graphics processing unit ppt
 
Lecture14
Lecture14Lecture14
Lecture14
 
A solder joint reliability model for the philips lumileds luxeon rebel led c...
A solder joint reliability model for the philips lumileds luxeon rebel led  c...A solder joint reliability model for the philips lumileds luxeon rebel led  c...
A solder joint reliability model for the philips lumileds luxeon rebel led c...
 
Gdi cell
Gdi cellGdi cell
Gdi cell
 
Quad Small Form-factor Pluggable (QSFP) Interconnect System
Quad Small Form-factor Pluggable (QSFP) Interconnect SystemQuad Small Form-factor Pluggable (QSFP) Interconnect System
Quad Small Form-factor Pluggable (QSFP) Interconnect System
 
Power
PowerPower
Power
 
Memory Management
Memory ManagementMemory Management
Memory Management
 
Fluent Introduction - Some Best Practice_._.pptx
Fluent Introduction - Some Best Practice_._.pptxFluent Introduction - Some Best Practice_._.pptx
Fluent Introduction - Some Best Practice_._.pptx
 
NMOS fabrication process
NMOS fabrication processNMOS fabrication process
NMOS fabrication process
 
ISSCC 2018: "Zeppelin": an SoC for Multi-chip Architectures
ISSCC 2018: "Zeppelin": an SoC for Multi-chip ArchitecturesISSCC 2018: "Zeppelin": an SoC for Multi-chip Architectures
ISSCC 2018: "Zeppelin": an SoC for Multi-chip Architectures
 
Real Time OS For Embedded Systems
Real Time OS For Embedded SystemsReal Time OS For Embedded Systems
Real Time OS For Embedded Systems
 

Similar to Basilisk Guide.pdf

AllegroCache with Web Servers
AllegroCache with Web ServersAllegroCache with Web Servers
AllegroCache with Web Serverswebhostingguy
 
Algorithm2e package for Latex
Algorithm2e package for LatexAlgorithm2e package for Latex
Algorithm2e package for LatexChris Lee
 
CoreOS, or How I Learned to Stop Worrying and Love Systemd
CoreOS, or How I Learned to Stop Worrying and Love SystemdCoreOS, or How I Learned to Stop Worrying and Love Systemd
CoreOS, or How I Learned to Stop Worrying and Love SystemdRichard Lister
 
Hadoop Interview Questions and Answers by rohit kapa
Hadoop Interview Questions and Answers by rohit kapaHadoop Interview Questions and Answers by rohit kapa
Hadoop Interview Questions and Answers by rohit kapakapa rohit
 
How Helm, The Package Manager For Kubernetes, Works
How Helm, The Package Manager For Kubernetes, WorksHow Helm, The Package Manager For Kubernetes, Works
How Helm, The Package Manager For Kubernetes, WorksMatthew Farina
 
Apache Cassandra cluster cloning on Kubernetes
Apache Cassandra cluster cloning on KubernetesApache Cassandra cluster cloning on Kubernetes
Apache Cassandra cluster cloning on KubernetesDaniel M. Farrell
 
HPC and HPGPU Cluster Tutorial
HPC and HPGPU Cluster TutorialHPC and HPGPU Cluster Tutorial
HPC and HPGPU Cluster TutorialDirk Hähnel
 
Buffer overflow tutorial
Buffer overflow tutorialBuffer overflow tutorial
Buffer overflow tutorialhughpearse
 
はじめてのGlusterFS
はじめてのGlusterFSはじめてのGlusterFS
はじめてのGlusterFSTakahiro Inoue
 
Angular JS in 2017
Angular JS in 2017Angular JS in 2017
Angular JS in 2017Ayush Sharma
 
CUDA by Example : Atomics : Notes
CUDA by Example : Atomics : NotesCUDA by Example : Atomics : Notes
CUDA by Example : Atomics : NotesSubhajit Sahu
 
Spark 4th Meetup Londond - Building a Product with Spark
Spark 4th Meetup Londond - Building a Product with SparkSpark 4th Meetup Londond - Building a Product with Spark
Spark 4th Meetup Londond - Building a Product with Sparksamthemonad
 
A Domain-Specific Embedded Language for Programming Parallel Architectures.
A Domain-Specific Embedded Language for Programming Parallel Architectures.A Domain-Specific Embedded Language for Programming Parallel Architectures.
A Domain-Specific Embedded Language for Programming Parallel Architectures.Jason Hearne-McGuiness
 

Similar to Basilisk Guide.pdf (20)

Ns2leach
Ns2leachNs2leach
Ns2leach
 
AllegroCache with Web Servers
AllegroCache with Web ServersAllegroCache with Web Servers
AllegroCache with Web Servers
 
OpenMP
OpenMPOpenMP
OpenMP
 
Algorithm2e package for Latex
Algorithm2e package for LatexAlgorithm2e package for Latex
Algorithm2e package for Latex
 
Tutorial
TutorialTutorial
Tutorial
 
CoreOS, or How I Learned to Stop Worrying and Love Systemd
CoreOS, or How I Learned to Stop Worrying and Love SystemdCoreOS, or How I Learned to Stop Worrying and Love Systemd
CoreOS, or How I Learned to Stop Worrying and Love Systemd
 
Hadoop Interview Questions and Answers by rohit kapa
Hadoop Interview Questions and Answers by rohit kapaHadoop Interview Questions and Answers by rohit kapa
Hadoop Interview Questions and Answers by rohit kapa
 
How Helm, The Package Manager For Kubernetes, Works
How Helm, The Package Manager For Kubernetes, WorksHow Helm, The Package Manager For Kubernetes, Works
How Helm, The Package Manager For Kubernetes, Works
 
Apache Cassandra cluster cloning on Kubernetes
Apache Cassandra cluster cloning on KubernetesApache Cassandra cluster cloning on Kubernetes
Apache Cassandra cluster cloning on Kubernetes
 
HPC and HPGPU Cluster Tutorial
HPC and HPGPU Cluster TutorialHPC and HPGPU Cluster Tutorial
HPC and HPGPU Cluster Tutorial
 
Buffer overflow tutorial
Buffer overflow tutorialBuffer overflow tutorial
Buffer overflow tutorial
 
はじめてのGlusterFS
はじめてのGlusterFSはじめてのGlusterFS
はじめてのGlusterFS
 
HPC_MPI_CICID_OA.pptx
HPC_MPI_CICID_OA.pptxHPC_MPI_CICID_OA.pptx
HPC_MPI_CICID_OA.pptx
 
Angular JS in 2017
Angular JS in 2017Angular JS in 2017
Angular JS in 2017
 
Go 1.8 Release Party
Go 1.8 Release PartyGo 1.8 Release Party
Go 1.8 Release Party
 
CUDA by Example : Atomics : Notes
CUDA by Example : Atomics : NotesCUDA by Example : Atomics : Notes
CUDA by Example : Atomics : Notes
 
22 Jop Oct 08
22 Jop Oct 0822 Jop Oct 08
22 Jop Oct 08
 
Spark 4th Meetup Londond - Building a Product with Spark
Spark 4th Meetup Londond - Building a Product with SparkSpark 4th Meetup Londond - Building a Product with Spark
Spark 4th Meetup Londond - Building a Product with Spark
 
A Domain-Specific Embedded Language for Programming Parallel Architectures.
A Domain-Specific Embedded Language for Programming Parallel Architectures.A Domain-Specific Embedded Language for Programming Parallel Architectures.
A Domain-Specific Embedded Language for Programming Parallel Architectures.
 
WebGL 2.0 Reference Guide
WebGL 2.0 Reference GuideWebGL 2.0 Reference Guide
WebGL 2.0 Reference Guide
 

Recently uploaded

Escorts Service Basapura ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Basapura ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Basapura ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Basapura ☎ 7737669865☎ Book Your One night Stand (Bangalore)amitlee9823
 
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779Delhi Call girls
 
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)amitlee9823
 
Editorial design Magazine design project.pdf
Editorial design Magazine design project.pdfEditorial design Magazine design project.pdf
Editorial design Magazine design project.pdftbatkhuu1
 
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun serviceCALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun serviceanilsa9823
 
infant assessment fdbbdbdddinal ppt.pptx
infant assessment fdbbdbdddinal ppt.pptxinfant assessment fdbbdbdddinal ppt.pptx
infant assessment fdbbdbdddinal ppt.pptxsuhanimunjal27
 
call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...Delhi Call girls
 
Top Rated Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...
Top Rated  Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...Top Rated  Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...
Top Rated Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...Call Girls in Nagpur High Profile
 
Peaches App development presentation deck
Peaches App development presentation deckPeaches App development presentation deck
Peaches App development presentation decktbatkhuu1
 
UI:UX Design and Empowerment Strategies for Underprivileged Transgender Indiv...
UI:UX Design and Empowerment Strategies for Underprivileged Transgender Indiv...UI:UX Design and Empowerment Strategies for Underprivileged Transgender Indiv...
UI:UX Design and Empowerment Strategies for Underprivileged Transgender Indiv...RitikaRoy32
 
Design Inspiration for College by Slidesgo.pptx
Design Inspiration for College by Slidesgo.pptxDesign Inspiration for College by Slidesgo.pptx
Design Inspiration for College by Slidesgo.pptxTusharBahuguna2
 
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...home
 
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Hy...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Hy...Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Hy...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Hy...Pooja Nehwal
 
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...Call Girls in Nagpur High Profile
 
Booking open Available Pune Call Girls Kirkatwadi 6297143586 Call Hot Indian...
Booking open Available Pune Call Girls Kirkatwadi  6297143586 Call Hot Indian...Booking open Available Pune Call Girls Kirkatwadi  6297143586 Call Hot Indian...
Booking open Available Pune Call Girls Kirkatwadi 6297143586 Call Hot Indian...Call Girls in Nagpur High Profile
 
CALL ON ➥8923113531 🔝Call Girls Kalyanpur Lucknow best Female service 🧵
CALL ON ➥8923113531 🔝Call Girls Kalyanpur Lucknow best Female service  🧵CALL ON ➥8923113531 🔝Call Girls Kalyanpur Lucknow best Female service  🧵
CALL ON ➥8923113531 🔝Call Girls Kalyanpur Lucknow best Female service 🧵anilsa9823
 
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...amitlee9823
 
call girls in Dakshinpuri (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️
call girls in Dakshinpuri  (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️call girls in Dakshinpuri  (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️
call girls in Dakshinpuri (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Tapestry Clothing Brands: Collapsing the Funnel
Tapestry Clothing Brands: Collapsing the FunnelTapestry Clothing Brands: Collapsing the Funnel
Tapestry Clothing Brands: Collapsing the Funneljen_giacalone
 

Recently uploaded (20)

Escorts Service Basapura ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Basapura ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Basapura ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Basapura ☎ 7737669865☎ Book Your One night Stand (Bangalore)
 
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
 
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
 
Call Girls Service Mukherjee Nagar @9999965857 Delhi 🫦 No Advance VVIP 🍎 SER...
Call Girls Service Mukherjee Nagar @9999965857 Delhi 🫦 No Advance  VVIP 🍎 SER...Call Girls Service Mukherjee Nagar @9999965857 Delhi 🫦 No Advance  VVIP 🍎 SER...
Call Girls Service Mukherjee Nagar @9999965857 Delhi 🫦 No Advance VVIP 🍎 SER...
 
Editorial design Magazine design project.pdf
Editorial design Magazine design project.pdfEditorial design Magazine design project.pdf
Editorial design Magazine design project.pdf
 
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun serviceCALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
 
infant assessment fdbbdbdddinal ppt.pptx
infant assessment fdbbdbdddinal ppt.pptxinfant assessment fdbbdbdddinal ppt.pptx
infant assessment fdbbdbdddinal ppt.pptx
 
call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
 
Top Rated Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...
Top Rated  Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...Top Rated  Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...
Top Rated Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...
 
Peaches App development presentation deck
Peaches App development presentation deckPeaches App development presentation deck
Peaches App development presentation deck
 
UI:UX Design and Empowerment Strategies for Underprivileged Transgender Indiv...
UI:UX Design and Empowerment Strategies for Underprivileged Transgender Indiv...UI:UX Design and Empowerment Strategies for Underprivileged Transgender Indiv...
UI:UX Design and Empowerment Strategies for Underprivileged Transgender Indiv...
 
Design Inspiration for College by Slidesgo.pptx
Design Inspiration for College by Slidesgo.pptxDesign Inspiration for College by Slidesgo.pptx
Design Inspiration for College by Slidesgo.pptx
 
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
 
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Hy...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Hy...Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Hy...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Hy...
 
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...
 
Booking open Available Pune Call Girls Kirkatwadi 6297143586 Call Hot Indian...
Booking open Available Pune Call Girls Kirkatwadi  6297143586 Call Hot Indian...Booking open Available Pune Call Girls Kirkatwadi  6297143586 Call Hot Indian...
Booking open Available Pune Call Girls Kirkatwadi 6297143586 Call Hot Indian...
 
CALL ON ➥8923113531 🔝Call Girls Kalyanpur Lucknow best Female service 🧵
CALL ON ➥8923113531 🔝Call Girls Kalyanpur Lucknow best Female service  🧵CALL ON ➥8923113531 🔝Call Girls Kalyanpur Lucknow best Female service  🧵
CALL ON ➥8923113531 🔝Call Girls Kalyanpur Lucknow best Female service 🧵
 
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
 
call girls in Dakshinpuri (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️
call girls in Dakshinpuri  (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️call girls in Dakshinpuri  (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️
call girls in Dakshinpuri (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️
 
Tapestry Clothing Brands: Collapsing the Funnel
Tapestry Clothing Brands: Collapsing the FunnelTapestry Clothing Brands: Collapsing the Funnel
Tapestry Clothing Brands: Collapsing the Funnel
 

Basilisk Guide.pdf

  • 1. Beginner’s guide to Basilisks Vatsal Sanjay vatsalsanjay@gmail.com February 18, 2018 Abstract This document is a review and guide to the installation and working of Basilisk (link), written by Stéphane Popinet and his group. These notes are for personal use only, and detailed guide could be found at <link>. Regarding this file: Since basilisk is still in the early stages of development, the facts written in this document are subject to change. If you find any information here outdated or incomplete, please let me know. You can also clone this repository (https://github.com/VatsalSy/GuideBasilisk), make changes and push it. 1 Installing Basilisk Installation is quite easy. There are two ways: Using darcs OR using tarball. I prefer the first one (darcs) because it allows to easily pull any update that occurs in Basilisk. The steps of this section are taken from http://basilisk.fr/src/INSTALL. They are self-explanatory I have included them here, just for the sake of com- pletion. 1.1 Installing darcs (if unavailable) vatsal@cloneMachine:∼ $ sudo apt-get install darcs flex make 1.2 Some important side packages vatsal@cloneMachine:∼ $ sudo apt-get install gnuplot imagemagick libav-tools smpeg-plaympeg graphviz valgrind gifsicle 1.3 Getting Basilisk source code vatsal@cloneMachine:∼ $ darcs get http://basilisk.fr/basilisk Note: In order to pull new changes made in Basilisk, use: vatsal@cloneMachine:∼ $ cd basilisk vatsal@cloneMachine:∼ $ darcs pull Then recompile. 1.4 Compiling/recompiling Basilisk vatsal@cloneMachine:∼ $ cd basilisk/src vatsal@cloneMachine:∼ $ export BASILISK=$PWD vatsal@cloneMachine:∼ $ export PATH=$PATH:$PWD vatsal@cloneMachine:∼ $ ln -s config.gcc config vatsal@cloneMachine:∼ $ make -k vatsal@cloneMachine:∼ $ make 1
  • 2. 2 Basilisk-View Details of bview: http://basilisk.fr/src/README#interactive-basilisk-view Basilisk-view is similar to GfsView, with some minor differences: 1. Unlike GfsView, we cannot run bview on the fly while basilisk is running. We can, however, use it to render pictures and videos on the fly with bview. It can be used to look at the results after simulation is over, provided we have saved the intermediate files. 2. There is no program written analogous to gfs2oogl for bview. This means that we cannot interpolate the octree based data using available libraries. We could write our own code for it in future, something similar to gfs2oogl. 3. The coordinate systems for GfsView and Basilisk are different. GfsView output is rotated counter-clockwise compared to Gerris: this is due to the new N-ordering of quadtree cells (rather than Z-ordering). See these link1 and link2. 4. I found a working example for tecplot users (here), but I have not tested it yet. GfsView can still be used with Basilisk, provided that the code does not use “mask”command. Mask command is used for creating solid objects and non-square (non-cubical) geometries. The precursor to using gfsview and writing “.gfs”files, “dump”is not compatible with “mask”. Most likely, even bview cannot be used to look at intermediate files when “mask”is used, but I have not changed it. For other compatibility issues, visit: http://basilisk.fr/src/COMPATIBILITY. 2.1 Installing bview Sources: (go in this order) 1. bview: http://basilisk.fr/src/bview 2. Screen rendering: http://basilisk.fr/src/gl/INSTALL 3. Python for bview-client: http://basilisk.fr/src/bview-client.py 4. Actual installation: http://basilisk.fr/src/bview-server.c 2.1.1 Dependencies For cluster for off-screen rendering: vatsal@cloneMachine:∼ $ sudo apt-get install libglu1-mesa-dev libosmesa6-dev vatsal@cloneMachine:∼ $ cd $BASILISK/gl vatsal@cloneMachine:∼ $ make libglutils.a libfb osmesa.a Another method would be to use the following (recommended for laptops), the above dependencies are recom- mended for clusters. vatsal@cloneMachine:∼ $ sudo apt-get install libglu1-mesa-dev libglew-dev libgl1-mesa-dev vatsal@cloneMachine:∼ $ cd $BASILISK/gl vatsal@cloneMachine:∼ $ make libglutils.a libfb glx.a The following is required for both the above versions: vatsal@cloneMachine:∼ $ sudo apt-get install python-pil.imagetk 2.1.2 bview (Optional) Add this line at the end of config.gcc, depending on the type of machine and dependency selected: Osmesa (Cluster): [frame=singhe] OPENGLIBS = -lfb_osmesa -lGLU -lOSMesa Glx (Laptop): OPENGLIBS = -lfb_glx -lGLU -lGLEW -lGL -lX11 Then do this: vatsal@cloneMachine:∼ $ cd $BASILISK vatsal@cloneMachine:∼ $ make bview-servers For a typical bview use and environment, follow the example at:http://basilisk.fr/src/bview 2
  • 3. 3 A typical code Basilisk codes are modified C++ files. A good place to start understanding Basilisk would be http://basilisk.fr/Tutorial. Here, I have added the case of liquid jet atomization. I have tried to compare and contrast this case with the famous jet atomization case simulated using gerris (which we are more familiar with). 3.1 Header File Just like a standard C++ code, we need to include the libraries that we are going to use. #include "navier-stokes/centered.h" #include "two-phase.h" #include "tension.h" #include "tag.h" #include "view.h" 1. navier-stokes/centered.h is the normal Gerris implemented Navier-Stokes equation solver for incompressible variable (two-phase) density flow. 2. two-phase.h is the simulations setup file for flows of two fluids separated by an interface (i.e. immiscible fluids). It is typically used in combination with a NavierStokes solver. 3. tension.h includes the surface tension force, same as Gerris by adding σκδi term in NS equation. 4. tag.h is used to count the number of droplets in the simulation. Unlike Gerris, in Basilisk, we get this special feature which when combined with a small sub-routine (given later) can count the number of droplets. 5. view.h is important for using Basilisk-View. 3.2 Defining custom variables #define radius 1./12. #define length 0.025 #define Re 5800 #define SIGMA 3e-5 int maxlevel = 7; double uemax = 0.1; Just like Gerris, here we can define some global variables which can be used later on in the file. For this specific example, radius is the radius of the liquid jet, length is the initialized length (similar to Gerris, we will initialize a small length of the jet and highly refine that part at t = 0), Re is the Reynold’s number of the liquid jet, SIGMA is the σ (surface tension) at liquid-air interface, maxlevel is the maximum octree refinement level and uemax is the maximum allowable error in the velocity field. 3.3 Initial Conditions scalar f0[]; //Initial conditions event init (t = 0) { if (!restore (file = "dump")) { refine (x < 1.2*length && sq(y) + sq(z) < 2.*sq(radius) && level < maxlevel); fraction (f0, sq(radius) - sq(y) - sq(z)); f0.refine = f0.prolongation = fraction_refine; restriction ({f0}); foreach() { f[] = f0[]*(x < length); u.x[] = f[]; } boundary ({f,u.x}); } } 3
  • 4. A scalar field f0 is defined. It is analogous to the T0 variable we usually define in Gerris. An event instance is declared for declaring initial conditions. The commands are executed if and only if the file named “dump”is not present. The grid is refined in a cylindrical region, 1.2 times the size of initialized jet and √ 2 times its radius. Further, the variable field f0 is set at 1 inside the cylinder (y2 + z2 < r2 ) and zero otherwise. Moreover, f0.refine = f0.prolongation = fraction refine; refines the volume fraction field (details). Further, restriction(f0); is used for boundary conditions on levels. The foreach command is a modified for loop to initialize the initial conditions in all the cells. At last, boundary (f,u.x); defines the boundary conditions at t = 0 (details). The stencils located near the boundary extends beyond it and the last line initializes these ghost values. By default, the boundary condition is symmetry and if the domain values are modified, it is necessary to modify the ghost values as well and therefore the last line is needed. 3.4 Boundary Condition /* We then set an oscillating inflow velocity on the left-hand-side and free outflow on the right-hand-side. */ u.n[left] = dirichlet(f0[]*(1. + 0.05*sin (10.*2.*pi*t))); u.t[left] = dirichlet(0); p[left] = neumann(0); f[left] = f0[]; u.n[right] = neumann(0); p[right] = dirichlet(0); Setting boundary conditions is intuitive and the above code snip is self-explanatory. Unlike Gerris, we do not have to create the web of boxes and manually see to the inter-connectivities. In order to get a cuboidal (rectangular) domain or create complex geometries, “mask”can be used. However, “dump”command used to write output data is not compatible with “mask”yet. 3.5 Adaptive Mesh Refinement event adapt (i++) { adapt_wavelet ({f,u}, (double[]){0.01,uemax,uemax,uemax}, maxlevel); } Basilisk uses the “wavelet”method for AMR based on the maximum allowable error. In the syntax, {f,u} defines the variables based on which refinement is to be done (please note, it is a 4 element vector). In the second term, {0.01,uemax,uemax,uemax} enlists the maximum error allowed. 3.6 The end time of simulation Unlike Gerris, there is no option to set end-time in Basilisk (that I could find). It is set with the maximum time event available in the script. Therefore, we can make one event to be executed at the end time of simulation and do not mention time anywhere else in the code. Please note that the “event”is event end (t = 2.5) { printf ("i = %d t = %gn", i, t); } 3.7 The main run snippet int main () { /** The initial domain is discretised with $64^3$ grid points. We set the origin and domain size. */ init_grid (64); origin (0, -1.5, -1.5); L0 = 3.; /* We set the density and viscosity of each phase as well as the surface tension coefficient and start the simulation. */ rho1 = 1., rho2 = 1./27.84; 4
  • 5. mu1 = 2.*radius/Re*rho1, mu2 = 2.*radius/Re*rho2; f.sigma = SIGMA; run(); } This is the main function which executes the simulation. The command init grid (n) descritizes the domain length in n number of cells. Origin: Setting origin is different than that in Gerris. Origin can be set using origin (x0, y0, z0). In this, (x0, y0, z0) is the co-ordinate location of the left-bottom-back corner with respect to the intended origin. For example, if you want the origin to be at center of the left wall, the command will read (0, -1.5, -1.5). L0 is used to set the length of the domain. Please note that the domain is always cubical in Basilisk. So if you want to make a cuboid then it is necessary to use “mask”. The other variables, mi and rhoi (∀ i ∈ {1, 2}) define the viscosity and density respectively and are local variables to the file “twophase.h”. At last, f.sigma is the surface tension for the VOF tracer f. 3.8 Writing log files and on terminal event logWriting (i++) { static FILE * fp; if (i == 0) { fprintf (ferr, "i dt tn"); fp = fopen ("log", "w"); fprintf (fp, "i dt tn"); fprintf (fp, "%d %g %gn", i, dt, t); fclose(fp); } else { fp = fopen ("log", "a"); fprintf (fp, "%d %g %gn", i, dt, t); fclose(fp); } fprintf (ferr, "%d %g %gn", i, dt, t); } This part is used to output the simulation temporal information on the terminal as well as store them in the file named “log”. 3.9 Generating movies /** We generate an animation using Basilisk View. */ event movie (t += 1e-2) { #if dimension == 2 scalar omega[]; vorticity (u, omega); view (tx = -0.5); clear(); draw_vof ("f"); squares ("omega", linear = true, spread = 10); box (); #else // 3D scalar pid[]; foreach() pid[] = fmod(pid()*(npe() + 37), npe()); boundary ({pid}); // not used for the moment view (camera = "iso", fov = 14.5, tx = -0.418, ty = 0.288, width = 1600, height = 1200); 5
  • 6. clear(); draw_vof ("f"); box (); #endif // 3D static FILE * fp = popen ("ppm2mp4 > movie.mp4", "w"); save (fp = fp); } This is just a typical code to generate movie of the simulation. For details, look at the guide to bview. 3.10 Data dumping event snapshot (t = 0; t += 0.1) { dump (file = "dump"); char nameGfs[80]; sprintf (nameGfs, "intermediateGfs/snapshot-%2.1f.gfs", t); output_gfs (file = nameGfs, t = t); char nameBview[80]; sprintf (nameBview, "intermediateBview/snapshot-%2.1f", t); dump (file = nameBview); } These are used to write data files. To write “.gfs”files, output gfs (file = nameGfs, t = t); is used. For writing data files read and processed by bview, “dump (file = nameBview);’can be used. 3.11 Visualization on the fly Currently, bview is not equipped for visualization on the fly. But, the following code can be used to run gfsview on the go. event gfsview (i++) { static FILE * fp = popen ("gfsview3D", "w"); output_gfs (fp); } Please note that in presence of “mask”, the “dump”and “output gfs”commands will write corrupted intermediate files. 3.12 Running scripts 3.12.1 At t = 0 To start the simulation, use the script file, named “run0.sh”. It deletes the log and dump files if they exist and creates the empty folders. if [ -f "log" ]; then rm log fi if [ -f "dump" ]; then rm dump fi if [ -d "intermediateGfs" ] then rm -r intermediateGfs fi if [ -d "intermediateBview" ] 6
  • 7. then rm -r intermediateBview fi mkdir intermediateGfs mkdir intermediateBview qcc -O2 -Wall -grid=octree $file.c -o $file -lm -L$BASILISK/gl -lglutils -lfb_glx -lGLU -lGLEW -lGL -lX11 -lm #qcc -O2 -Wall $file.c -o $file -lm # -L$BASILISK/gl -lglutils -lfb_osmesa -lGLU -lOSMesa -lm Moreover, in order to make changes in between the simulation and re-start it, the script file named “runRe.sh”can be used. This simply compiles the code. if [ ! -d "intermediateGfs" ] then mkdir intermediateGfs fi if [ ! -d "intermediateBview" ] then mkdir intermediateBview fi qcc -O2 -Wall -grid=octree $file.c -o $file -lm -L$BASILISK/gl -lglutils -lfb_glx -lGLU -lGLEW -lGL -lX11 -lm #qcc -O2 -Wall $file.c -o $file -lm # -L$BASILISK/gl -lglutils -lfb_osmesa -lGLU -lOSMesa -lm 7