133 
% 
% 
134 
%where $\delta_{ij}$ is the Kronecker $\delta$symbol, which is a matrix with ones for its diagonal entries ($i = j$) and zeros for the remaining entries ($i \neq j$). The body force $f$ in Equation (\ref{GENERAL NAVIER STOKES COM}) is the gravity acting in the $x_{3}$ direction and is given as $f = g \rho \delta_{i3}$. 
%where $\delta_{ij}$ is the Kronecker $\delta$symbol, which is a matrix with ones for its diagonal entries ($i = j$) and zeros for the remaining entries ($i \neq j$). The body force $f$ in Equation (\ref{GENERAL NAVIER STOKES COM}) is the gravity acting in the $x_{3}$ direction and is given as $f = g \rho \delta_{i3}$. 
135 
%The Stokes equations is a saddle point problem, and can be solved using a Uzawa scheme. A class called StokesProblemCartesian in Escript can be used to solve for velocity and pressure. 
%The Stokes equations is a saddle point problem, and can be solved using a Uzawa scheme. A class called StokesProblemCartesian in Escript can be used to solve for velocity and pressure. 
136 
%In order to keep numerical stability, the timestep size needs to be below a certain value, known as the Courant number. The Courant number is defined as: 
%In order to keep numerical stability, the timestep size needs to be below a certain value, known as the Courant number \index{Courant number}\index{CFL condition}. The Courant number is defined as: 
137 
% 
% 
138 
%\begin{equation} 
%\begin{equation} 
139 
%C = \frac{v \delta t}{h}. 
%C = \frac{v \delta t}{h}. 
269 
the boundary conditions, viscosity, and body forces; the solving of the Stokes problem for velocity and pressure; then the 
the boundary conditions, viscosity, and body forces; the solving of the Stokes problem for velocity and pressure; then the 
270 
level set procedure. 
level set procedure. 
271 
The output of the level set function, velocity and pressure is saved to file. 
The output of the level set function, velocity and pressure is saved to file. 
272 
The timestep size is selected based on the Courant condition. 
The timestep size is selected based on the Courantâ€“Friedrichsâ€“Lewy condition (CFL condition)\index{Courant number}\index{CFL condition}. 
273 
Due to the number of elements in the computational mesh, the simulation may take a long time to complete on a desktop computer, 
Due to the number of elements in the computational mesh, the simulation may take a long time to complete on a desktop computer, 
274 
so it is preferable to run it on the super computer. 
so it is preferable to run it on the super computer. 
275 
At present, the fine mesh is required to capture the details of the fluid motion and for numerical stability. 
At present, the fine mesh is required to capture the details of the fluid motion and for numerical stability. 
367 


368 
#save interface, velocity and pressure 
#save interface, velocity and pressure 
369 
saveVTK("phi2D.%2.4i.vtu"%t_step,interface=func,velocity=velocity,pressure=pressure) 
saveVTK("phi2D.%2.4i.vtu"%t_step,interface=func,velocity=velocity,pressure=pressure) 
370 
#Courant condition 
#CFL condition 
371 
dt = 0.4*Lsup(mesh.getSize())/Lsup(velocity) 
dt = 0.4*Lsup(mesh.getSize())/Lsup(velocity) 
372 
t_step += 1 
t_step += 1 
373 

