/paralleled_cdugksFoam

Optimized version of dugksFoam with hybrid parallelization strategy and conserved algorithm.

Primary LanguageCOtherNOASSERTION

Paralleled cdugksFoam

About

This project is a work for the paper Unified X-Space Parallelization Algorithm for Conserved Discrete Unified Gas Kinetic Scheme. The open source multiscale flow solver dugksFoam is optimized with unstructured mesh, conserved algorithm, and hybrid space parallelization to achieve better computational accuracy and efficiency.

Features

  • 1D & 2D & 3D in a single solver.

  • Adopt unstructured mesh in both physical space and particle velocity space.

  • Properties in each cell are updated by moments of microscopic variable fluxes to preserve better conservation of the macroscopic physical variables.

  • Decompose each space in a hybrid manner and efficiently parallelize the computation.

Installation

Before installing the code in this repository, we assume that you have installed the MPI library and OpenFOAM version 6.

Then, fetch the source code by git clone or Download ZIP.

If using git:

git clone https://github.com/zzhang777/paralleled_cdugksFoam.git
mv paralleled_cdugksFoam dugksFoam
cd dugksFoam/src
./Allwmake

If using ZIP package :

#move the download file to dir wish to install
unzip paralleled_cdugksFoam-master.zip 
mv paralleled_cdugksFoam-master dugksFoam
cd dugksFoam/src
./Allwmake

NOTE: If permission problems occur during the installation, please run the chmod command.

Usage

Case setup

The case setup method in cdugksFoam is almost the same as the original dugksFoam, whose document is in doc/ directory. Here, only different parts are present.

Prepare the unstructured velocity space

The original dugksFoam adopts a structured mesh in velocity space using Newton-Cotes quadrature and half-range Gauss-Hermite quadrature. This function is implemented by configuring two files: constant/Xis and constant/weights. The former is the velocity set, the latter is their weight.

In unstructured velocity space, the velocity mesh is generated by third-party software, such as pointwise and Gambit. For mesh generation software that supports mesh files in OpenFOAM format, the velocity mesh can be directly exported. For those who don't support, use mesh conversing tools provided by OpenFOAM to transform the format.

After getting the velocity mesh in OpenFOAM mesh format, named the mesh folder vMesh, and put it in the constant/ dir.

Boundary conditions

The current supported boundary conditions are diffusive wall boundary and far field boundary.

Conserved algorithm

The bug “update cell center macro by macro flux” in the dugksFoam source code is fixed to replace the integration to guarantee conservation. To use this function, set the field macroFlux in constant/DVMProperties to yes.

fvDVMparas
{
    xiMax       xiMax [0 1 -1 0 0 0 0]    1;
    xiMin       xiMin [0 1 -1 0 0 0 0]   -1.766485662735688e+03;
    nDV               28;       // Number of discrete velocity, shoud be 4*Z + 1 if using compound N-C quardrature
    //set this field to yes
    macroFlux  yes;
}

Others

xiMaxxiMin and nDV in fvDVMparas in file constant/DVMProperties don't need to be configured. These data will be calculated in the program.

fvDVMparas
{
    xiMax       xiMax [0 1 -1 0 0 0 0]    1;
    xiMin       xiMin [0 1 -1 0 0 0 0]   -1.766485662735688e+03;
    nDV               28;       // Number of discrete velocity, shoud be 4*Z + 1 if using compound N-C quardrature
    macroFlux  yes;
}

Running in parallel

The X-space parallelization strategy can be configured to use physical space parallelization, velocity space parallelization, and hybrid space parallelization, respectively.

First, one should enter the case dir and always make sure the decomposition script multidecompose.py is in the dir. Configure the physical space decomposition method in system/decomposeParDict.

Then, execute the uniform routine listed below.

  1. Domain decomposition
python multidecompose.py -p M -v N

M means physical space is decomposed into M subdomains, N means velocity space is decomposed into N subdomains. M = 1 when using velocity space parallelization, N = 1 when using velocity space parallelization. After domain decomposition, the processor folder will be created under the case directory. It contains a subdomain of physical mesh, velocity mesh, and the initial field.

  1. Launch MPI processes
mpirun -n M ∗ N dugksFoam -parallel -dvParallel -pd M

pd means the number of physical subdomain, pd = 1 when running in velocity space parallelization.

  1. Get computational results
reconsructPar

This command is provided by OpenFOAM to recombination the flow properties of different physical subdomains.

Post processing

Tecplot has supported OpenFOAM data format since the 2013 release. Or you can use ParaView to view simulation results.

Demo

2D lid-driven cavity flow simulation in the paper is provided in demo dir, the case name is cavity0.1.

Citation

@article{zhang2022unified,
  title={{Unified X-space parallelization algorithm for conserved discrete unified gas kinetic scheme}},
  author={Zhang, Qi and Wang, Yunlan and Pan, Dongxin and Chen, Jianfeng and Liu, Sha and Zhuo, Congshan and Zhong, Chengwen},
  journal={Computer Physics Communications},
  pages={108410},
  year={2022},
  publisher={Elsevier}
}

References