This implementation is based on the papers.
This code addresses incompressible fluid dynamics using the collocated grid Marker-and-Cell (MAC) method on a Cartesian grid. Spatial discretization is performed with second-order central differencing, while temporal discretization employs a first-order explicit Euler method. For pressure calculations, the Red-Black Successive Over-Relaxation (SOR) method is implemented.
- PixelFlow
To build and run this project, you will need the following tools and libraries installed on a Linux environment:
- CMake: A cross-platform build system generator.
- Make: A build automation tool.
- GCC: The GNU Compiler Collection, including the C compiler.
- G++: The GNU C++ Compiler.
- GFortran: The GNU Fortran Compiler.
Make sure you have the required tools and libraries installed. You can install them using the package manager of your Linux distribution. For example, on Debian-based systems like Ubuntu, you can use apt-get
:
sudo apt-get update
sudo apt-get install -y cmake make gcc g++ gfortran
-
Open a terminal and navigate to the desired working directory.
-
Clone the repository from GitHub:
git clone https://github.com/nobu-n2002/PixelFlow.git
-
Move into the application directory:
cd PixelFlow
-
Build all sources:
make build
-
Create working directory:
make project f=<your_project_name>
The usage of
make
is as follows:Usage: make [OPTIONS] options build Build all source codes project f=<folder_name> Create a new folder with the specified name help Display Usage
-
Check the
bin
Folder:-
Upon a successful build, executable files are generated in the
bin
folder. -
Open a terminal or command prompt and run the following command to verify the presence of the generated executable file(s) in the
bin
folder.ls bin
-
Ensure that the application's executable file is present in the
bin
folder.
-
-
Grant execution permissions to the executable files in the
bin
folder:chmod +x bin/*
-
Verify the
config
Folder:-
Proper configuration is crucial for the application. During the build, a configuration file named
controlDict.txt
should be created in theconfig
folder. -
Open a terminal or command prompt and run the following command to confirm the existence of the
controlDict.txt
file in theconfig
folder.cd projects/<folder_name> ls config
-
Confirm that the
controlDict.txt
file is present in theconfig
folder.
-
-
Follow the steps in the Getting Started section to set up the environment and configure the simulation.
-
Proceed to the Running Simulations section to execute the simulation.
- Place the solid boundary information file (
.csv
) in thedata/
directory.
-
Open the
config/controlDict.txt
file in a text editor. For detailed information on each parameter and how to configure your simulations, refer to the Configuring Simulations section. -
Edit the variables according to your simulation requirements.
!******************************************** &physical !--- Kinematic viscosity coefficient [m2/s] xnue = 0.001000 !--- Second viscosity coefficient [m2/s] xlambda = 0.000000 !--- Fluid density [kg/m3] density = 1.000000 !--- Domein [m] width = 1.0000000 height = 1.0000000 depth = 1.0000000 !--- Simulation time [s] time = 1.000000 ... !******************************************** &solver_control !--- SOR max iteration steps iter_max = 100 !--- SOR reluxation factor (1<w<2) relux_factor = 1.700000 / !********************************************
-
Save the changes and close the file.
-
Run the simulation script:
make run
You will be prompted to select an executable file. If you are using OpenMP parallelization code, please set parallel threads in
config/omp_config.conf
.Available executable files: 0: ibm2_drag_omp 1: ibm2_omp 2: ibm3_air_condition_omp 3: ibm3_omp Using OMP_NUM_THREADS = ${$OMP_NUM_THREADS} Running ibm2_omp...
-
The processes are output to
runlog_*.log
files inside thelogs/
folder. Additionally, execution information is output toprocess.log
inside thelogs/
folder. -
The output in the
{output_folder}/
directory. -
If you need to forcibly terminate the process during computation, please enter the following command. You will receive the process ID and a confirmation message. Input 'yes' followed by pressing enter to forcibly terminate the running process.
make quit
The config/controlDict.txt
file contains parameters that define the properties of the simulation. Here's a breakdown of the important parameters:
-
xnue
: Kinematic viscosity of the fluid,$\nu = (\mu/\rho$ ) [m^2/s]. -
xlambda
: Second Kinematic viscosity of the fluid, ($\lambda/\rho$ ) [m^2/s]. -
density
: Density of the fluid,$\rho$ [kg/m^3]. -
width
,height
,depth
: The simulation domain,$X, Y, Z$ [m]. -
time
: Total simulation time,$t$ [s]. -
inlet_velocity
: Inlet velocity of the fluid,$U_{in}$ [m/s]. -
outlet_pressure
: Outlet pressure,$P_{out}$ [Pa]. -
AoA
: Angle of Attack,$\alpha$ [degree].
istep_out
: Output interval for saving results, specified as the number of time steps.
istep_max
: Maximum number of time steps for the simulation.
-
thickness
: Thickness of boundary region,$\Delta^*(=\Delta/dx$ ).
nonslip
: Specify.true.
for no-slip conditions or.false.
for slip conditions.
output_folder
: Name of the folder where simulation results will be stored.csv_file
: Path to the solid boundary information file in CSV format.
Adjust these parameters according to your simulation requirements. The output_folder
will be created to store the simulation results, and the csv_file
should point to the CSV file containing solid boundary information.
[1] Oshima, N., A novel approach for wall-boundary immersed flow simulation (proposal of modified Navier-Stokes equation), Journal of Fluid Science and Technology, Vol.18, No.4 (2023), https://doi.org/10.1299/jfst.2023jfst0034
[2] Oshima, N., A novel approach for wall-boundary immersed flow simulation (part 2: modeling of wall shear stress), Journal of Fluid Science and Technology, Vol.19, No.3 (2024), https://doi.org/10.1299/jfst.2024jfst0026
[3] Oshima, N., Program for flow simulation immersing wall boundary, Hokkaido university collection of scholarly and academic papers. http://hdl.handle.net/2115/89344
[4] Nakamichi, N., Cho, Y. and Oshima, N., Image-data-driven simulation of fluid dynamics (proposal and evaluation), Mechanical Engineering Journal, Vol.11, No.6 (2024), https://doi.org/10.1299/mej.24-00196
[5] Nakamichi, N., Laeron, E., Cho, Y. and Oshima, N., Moving boundary flow simulation using immersed boundary Navier–Stokes equation, The 38th Computational Fluid Dynamics Symposium (in Japanese), http://hdl.handle.net/2115/93762
[6] Nakamichi, N., Cho, Y. and Oshima, N., Fluid Simulation directly Driven by 3D image data, The 52th Visualization Symposium (in Japanese), http://hdl.handle.net/2115/93764