This repository provides a Julia version of the MATLAB scripts from this repository for simulating the dynamics of liquid droplets impacting solid substrates. The code systematically explores droplet deformation, spreading, rebound behaviors, and other key physical phenomena, capturing detailed dynamics through numerical simulations.
The project models the complex behavior of liquid droplets when they impact solid surfaces, capturing phenomena like maximum spreading, bounce optimization, energy transfer, and shape deformation using a numerical approach based on spherical harmonics and Newton-Raphson methods. It includes simulation sweeps for parameter exploration such as Weber number (We), Bond number (Bo), and Ohnesorge number (Oh).
Simulations can be run in bulk sweeps or individually. Different from Python, Julia is a JIT compiled language, and details of its installation can be found here. It will be necessary to install additional packages depending on your current package configuration. Instructions on package installation through the command line can be found here.
To perform simulation sweeps, use the sweep_plots.jl script from this folder drop_simulations_sweep.
The function plot_and_save() can be called with either dimensional parameters (rho_in_CGS= fluid density, sigma_in_CGS = surface tension, nu_in_GCS = kinematic viscosity, V_in_CGS = initial velocity) or non-dimensional parameters (Bond, Web, Ohn) along with R_in_CGS.
plot_and_save()runs a single simulation for the given input parameters and saves the resulting data and plots in the following directory structure:- Main directory:
desktop_path = 'drop_simulations_sweep/Mode_Convergence_R={R_in_CGS}_modes={n_thetas}_Web={We}' - Subdirectory:
folder_name = 'simulation_We={We}_Oh={Oh}_Bo={Bo}_modes={n_thetas}'
- Main directory:
Both desktop_path and folder_name are automatically created in this structure, with the folder_name placed inside desktop_path.
Customizing Folder Locations:
To save results to a different location or rename the folder, modify the desktop_path and folder_name variables to point to the desired path or folder.
Sweeping Across Parameters:
- When performing a sweep over the Weber number (
We): Update thedesktop_pathso that it is independent ofWe. This ensures that all results from the Weber-sweep are stored in a single folder. - To sweep over a range of values for
We,Bo, andOh: Callplot_and_save()for each value in the sweep, adjusting the parameters accordingly.
For individual simulations, use the drop_simulations_singular.ipynb. The simulations will be run in a Jupyter Notebook. Plots and videos will not be automatically saved and require manual downloading.
In the "user input" section, adjust the physical constants as desired:
-
$\rho$ = fluid density -
$\sigma$ = surface tension -
$g$ = gravitational acceleration -
$\nu$ = kinematic viscosity -
$R$ = radius -
$V$ = initial velocity -
$T_{end}$ = non-dimensional time of simulation end -
$n_{thetas}$ = number of Legendre Polynomials used for approximation -
n_sampling_time_L_mode: limits the size of the dimensionless time-step. The largern_sampling_time_L_mode, the smaller the timestep.
To run video animations in drop_simulation() and pressure_simulation(), it is necessary to have FFmpeg installed. See below for a guide on how to install FFmpeg.
This project requires FFmpeg to save or render movie simulations.
Please install FFmpeg according to your operating system:
Windows
- Download FFmpeg from the official website.
- Under "Windows", choose a build from sites like Gyan.dev or BtbN.
- Extract the downloaded
.zipfile. - Add the
binfolder (inside the extracted folder) to your System PATH:- Search for "Environment Variables" → Edit the PATH variable → Add the path to the
binfolder.
- Search for "Environment Variables" → Edit the PATH variable → Add the path to the
- Open a new Command Prompt and verify the installation:
ffmpeg -version
macOS
If you have Homebrew installed, run:
brew install ffmpegThen verify:
ffmpeg -versionIf you don't have Homebrew installed, you can install it first by running:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Linux (Ubuntu/Debian)
Update your package list and install FFmpeg:
sudo apt update
sudo apt install ffmpegThen verify:
ffmpeg -version