Giter VIP home page Giter VIP logo

mf-lbm-cuda's Introduction

MF-LBM C++/CUDA version

This is a C++/CUDA version of the MF-LBM solver.

Screenshot

Program Screenshot

About the code

MF-LBM is a high-performance lattice Boltzmann (LB) code for direct numerical simulation (DNS) of flow in porous media, primarily developed by Dr. Yu Chen (LANL), under the supervision of Prof. Albert Valocchi (UIUC), Dr. Qinjun Kang (LANL) and Dr. Hari Viswananthan (LANL). 'MF' refers to microfluidics or 'Magic Find'. The code was first developed at University of Illinois at Urbana-Champaign based on a mainstream LB color-gradient multiphase model and further improved at Los Alamos National Laboratory by implementing the Continuum-Surface-Force and geometrical wetting models to reduce spurious currents so that the inertial effects in scCO2 and brine displacement in porous media can be accounted for. In addition, a single-phase flow solver is also provided for absolute permeability measurement or DNS of turbulent flow. Only double precision is supported.

This version

The multiphase MF-LBM solver was rebuilt using the C++ language and the Nvidia C++/CUDA interface. It was developed by Dr. Mahmoud Sedahmed (Alexandria University). The new solver follows the same syntax and naming conventions of the original one to facilitate direct mapping between the two versions. This version supports both single an double precisions. Single precision was added to benifit from the high computional power of Nvidia GPUs used in consumer grade computers. Such devices are becoming more powerful and equipped with many FP32 units. The code was tested on both Linux and Windows (MS Visual Studio) operating systems.

Authors

Mahmoud-Sedahmed

Features

  • Advanced LB multiphase model (CSF model + geometrical wetting model) ensuring relatively small spurious currents.
  • The AA pattern streaming method is employed to significantly reduce memory access and memory consumption.
  • The structure of arrays (SoA) data layout is used to achieve coalesced memory access and maximize vectorization.
  • Single/Double precision solver option.
  • Cross platform (Windows/Linux).
  • Generic array indexing via preprocessor macros (starting at "1" not "0").
  • Portable timing functions using the C++ Chrono library.
  • Automatic code dependency generation in the makefile to reduce source files re-compilation.

Prerequisites

  • GCC compiler (tested on version 9.4.0)
  • CUDA toolkit (tested on version 12.1)
  • Nvidia GPU (tested on RTX 3090)

Installation

  1. Clone the repository
 $ git clone https://github.com/Mahmoud-Sedahmed/MF-LBM-CUDA
  1. Change the current working directory to the MF-LBM-CUDA
$ cd MF-LBM-CUDA/
  1. Edit the Makefile Use your preferred directory to modify the following parameters in the Makefile to match your CUDA toolkit installation and your GPU compute capability.
COMPUTE_CAPABILITY := 
CUDA_LIBRARY_LOCATION := 
CUDA_LNK_PATH := 

Also, choose which type of build to be compiled (release/debug).

 BUILD :=

Optionally, add any additional flags to be passed to the GCC or the NVCC compilers

CPPFLAGS_ADD := 
CUFLAGS_ADD := 
  1. Select the solver precision Use your preferred editor to modify the following parameter in the header file "solver_precision.h"
/* Select solver precision: SINGLE_PRECISION / DOUBLE_PRECISION */
#define PRECISION (SINGLE_PRECISION)	
  1. Compile the program using GNU Make
$ Make
  1. Run the program
$ ./MF_LBM_CUDA

Usage/Examples

  • The file simulation_control.txt is mainly used for customizing the simulations.
  • Lattice units are used in the simulation control file parameters.
  • The original MF-LBM usage section is advised for more details.
  • The configuration files in the original MF-LBM could be easily mapped to the simulation_control.txt file.
  • External geometry files are located in "input/geometry/". The path and name of the geometry required to be loaded in the solver must be specified in the file "Geometry_File_Path.txt". The geometry file's name suffix must not be written in "Geometry_File_Path.txt". The geometry file's name must end in a number.

Ouptut files

One main directory will be created for the simulation results named "results", with three sub-directories:

  • out1.output: bulk properties (i.e., saturation, flow rate) against time. See Monitor.cpp for more information.
  • out2.checkpoint: checkpoint data used to restart simulation. See IO_multiphase.cpp for more information.
  • out3.field_data: legacy vtk files for flow analysis. See IO_multiphase.cpp for more information.

Important Notes

  • Limitations

    i. The contact angle in the control file must be less or equal to 90 degrees due to the particular numerical scheme used, meaning that fluid1 and fluid2 will always be the nonwetting phase and wetting phase, respectively. Drainage and imbibition can be completed by injecting fluid1 and fluid2 respectively.

    ii. Periodic boundary conditions can't be applied in the in X-direction.

  • Potential future upgrades

    i. An alternative geometrical wetting model, e.g. Akai et al., 2018 (recently added to the original MF-LBM solver).

    ii. Multi-GPU implementation

    iii. Support for large scale problems.

    IV. SSS streaming technique for direct addressing data structure.

License

Distributed under the BSD-3 License. See LICENSE for more information.

mf-lbm-cuda's People

Contributors

mahmoudsedahmed avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.