This implementation is based on the papers.
This code deals with incompressible fluids and implements the collocated grid Marker-and-Cell (MAC) method using a regular orthogonal grid. It discretizes space using second-order central differencing and time using a first-order explicit Euler method. For pressure calculation, it uses the Red-Black Successive Over-Relaxation (SOR) method.
- 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 in [m^2/s].xlambda
: Second Kinematic viscosity of the fluid in[m^2/s].density
: Density of the fluid in [kg/m^3].width
,height
,depth
: The simulation domain in [m].time
: Total simulation time in [s].inlet_velocity
: Inlet velocity of the fluid in [m/s].outlet_pressure
: Outlet pressure in [gauge].AoA
: Angle of Attack in [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/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