Skip to content

Tutorial: incompressible‐‐pimpleHFDIBFoam‐‐fallingParticleDistribution

OStudenik edited this page Aug 22, 2024 · 26 revisions

Case description

This tutorial represents a situation where a number of non-spherical particles of different sizes is sedimenting in a rectangular domain.

Note that in order for the tutorial to be fast to evaluate even on personal computers, it is constructed as two-dimensional. However, the DEM part of the code is suitable only for three-dimensional simulations and the particles properties were adjusted in such a way that the tutorial gives plausible results.

Geometry and boundary conditions

The test case is built with dimensions (120mm,0.1mm,6mm) defined as a single block, as the figure below depicts. The front and back in Y directions are prescribed as type empty, and the active boundaries prescribed as type wall are highlighted in green. These boundaries are prescribed with zeroGradient boundary condition for pressure and noSlip for fluid velocity. Remaining type patch boundary, highlighted in blue, is prescribed with fixedValue set to uniform 0 boundary condition for pressure and zeroGradient for fluid velocity. For details see files

"tutorialDirectory"/system/blockMeshDict

for details regarding mesh construction and

"tutorialDirectory"/0.org/U and "tutorialDirectory"/0.org/p

for details regarding boundary and initial condition settings Incompresible_BlockFigure_2 please note that the dimensions depicted are in millimeters

DEM material properties

To configure the DEM solver you must open the HFDIBDEMDict found at path

"tutorialDirectory"/constant/HFDIBDEMDict

Right below the openFOAM head of the file is located bodyNames() list option. Here, you define particle names that you wish to include in your simulation; if the particle is based on STL surface mesh, please insert the file with the matching in name into the directory. In our case, we are working with a particle named "icoSphere". Therefore, we will modify the list as bodyNames("icoSphere"), which is linked to the file located here:

"tutorialDirectory"/constant/triSurface/icoSphere.stl

next we enter global solver configurations,

  • interpolationSchemes setting for immersed boundary method
  • surfaceThreshold threshold for particle projection and interpolation schemes,
  • stepDEM integration step for DEM solver working splitting global CFD integration step the inverse value is amount of DEM steps per one CFD iteration
  • geometricD active considered active directions(1) for active (-1) for inactive
  • recordSimulation boolean option to separately record the position of particles at a given time
  • recordFirstTimeStep boolean option to record initial position of particles added to domain
  • nSolidsInDomain upper limit of particle which can be active within domain, when not entered the default value is 1000

next is the control of the outputs, while the solver runs are outupts may be required for debugging purpose otherwise they tend to slow down simulation time or even overload memory and lead to the crash of simulation. For these purposes solver enables outputSetup dict where following outputs may be enabled

  • basic simulation time info and body velocities and location per CFD step
  • iB detailed info regarding particle properties per DEM step
  • DEM detailed info regarding particle contact treatment
  • addModel detailed info regarding particle addition into the computational domain
  • parallelDEM detailed info regarding particle contact treatment from all subdomains for parallel computations

next is the DEM dictionary to set material and properties. The materials is the sub-dictionary where multiple materials might be defined using

  • Y - Young Modulus (material stiffness),
  • nu - Poisson ratio,
  • mu - static friction coefficient,
  • adhN- normal adhesion coefficient,
  • eps - coefficient of restitution (dissipation). Next the curvature coefficient LcCoeff represents the local curvature of the considered solids.

collisionPatches is sub-dictionary for a definition of collision boundaries which may or may not correspond with system boundaries each wall is defined as a dictionary consisting of

  • material enter the above defined material,
  • nVec normal vector of the boundary which points out from the domain and
  • planePoint arbitrary point located at the desired patch. Which concludes present DEM options.

The virtualMesh dictionary is a setting of the contact treatment algorithm for STL mesh-based solids. It is described by

  • level - a decomposition level similar to snappyHexMesh settings declaring how much the contact area will be refined
  • charCellSize—the size of the characteristic computational cell for initial refinement of the contact area.

These settings conclude that the general setting of the HFDIBDEMDict does not directly concern particle properties. To prescribe particle properties, the dictionary must be defined with the given name of the particle, in our case, icoSphere{} Within this dictionary, you must define particle motion for freely moving enter

  • fullyCoupledBody; if you wish to determine initial velocity you may enter fullyCoupledBody{velocit (0 1 0);}.
  • To prescribe particle material, define material *name* and state the name of the defined material also define particle density as rho rho [1 -3 0 0 0 0 0] *value*;.
  • To prescribe boundary condition for fluid interaction, define dictionary U{BC noSlip;}, which is the only value presently implemented.
  • For body geometry, bodyGeom, which is in this case convex
  • to enable particle rotation, define updateTorque and set it true
  • for particle to start synchronised with fluid velocity and rotation, set startSynced true in this case we assume no initial velocity for particle
  • to freeze the simulated particle at a place after prolonged contact with a static object, other particle, or boundary use timesToSetStatic and enter the number of time steps after which the particle will be stoped at place in this case this counter is set for 80.

For the given tutorial we wish to add size distribution of the given particle. Therefore, we shall define bodyAddition sub-dictionary and set it to addModel distribution. This is configured as

bodyAddition
{
    addModel distribution;
    distributionCoeffs
    {
        stlBaseSize     0.005;          //stating the referential size of the STL file
        addMode         fieldBased;     //selecting mode to condition particle addition
        fieldBasedCoeffs
        {
            fieldName   lambda;         //name of the indicator field
            fieldValue	0.05;           //targeted volume fraction of the given field
        }

        addDomain      boundBox;       //choosing to create new particles within the bounding box
        boundBoxCoeffs
        {
            minBound (0 -0.001 -0.03);
            maxBound (0.04 0.001 0.03);
        }

        scalingMode    noScaling;      //added particles won't be additionally rescaled
        noScalingCoeffs{};
        rotationMode   noRotation;   /added particles won't be additionally rotated
        noRotationCoeffs{};
    }
}

This addModel in particular requires additional data in file

"tutorialDirectory"/constant/distributionDict

in which particle size distribution is defined in two dictionaries distribution and particleSize for the former state percentage of given particle size you wish to include, this is defined in former as scale factor to STL size stated as convertToMeters. Further more arbitry rotates particles as well.

each particle dict should also include refineBuffers 1;,sdBasedLambda false; the first is for adaptive mesh refinement which can be enabled in dynamicMeshDict, the second is old option which will be removed in next major update.

The case setting is then concluded with prescription of gravity in

"tutorialDirectory"/constant/g

with value (9.81 0 0 ); as this tutorial is for CFD-DEM simulation we must include gravity for fluid flow as well with the use of the fvOptions see

"tutorialDirectory"/system/fvOptions

With this, the solver's configuration should be concluded, and you may proceed to run the simulation. You may also inspect other settings. However, these are common for all OpenFOAM pimpleFOAM-based cases.

Running the case

The case is run using ./Allrun & or bash Allrun & script:

`#!/bin/sh
. $WM_PROJECT_DIR/bin/tools/RunFunctions

rm -rf 0

cp -r 0.org 0


runApplication blockMesh     # mesh generation, see system/blockMeshDict

application=`getApplication` # selects application (pimpleHFDIBFoam) from system/controlDict

runApplication $application  # run the simulation itself

paraFOAM -touch # to create .OpenFOAM file for visualisation in paraview

after the simulation ends, you may proceed to visualization and optional post-processing.

Results visualization

Several approaches might be used to visualize the results of the CFD-DEM simulation depending on the level of detail you wish to achieve.

Let's start with the minimalistic approach using only the paraview, enter the following command in the terminal opened in the tutorial directory

paraFOAM

the paraview window should appear with a loaded file, in this case: "fallingParticleDistribution.OpenFOAM." To set an accurate display, check the boxes marked within red borders and then click Apply. See the figure below PWOutput#1 0

The white rectangle should appear to adjust its position. Use options marked blue in the rectangle below or hold the left mouse button while moving with the mouse. Next, you must select the field you wish to display. For particle positions, select lambda; for the fluid velocity field, select U. The field is scaled according to the range available for a given time level. You may rescale it to fit your preferences. Follow the options marked red in the figure below. If you wish to display both fields simultaneously, you may use a transform filter. First, select the source you want to display this way. Next, click ctrl and space and write "transform." Select the filter and modify it according to the box marked in green in the figure below. Ensure both objects are visible, and select the fields you want to be displayed.
PWOutput#2 0

Alternatively, if you want to display both fields in one figure, you may apply the "threshold" filter to the lambda field with a value above 0.01, as depicted in the figure below and marked with green borders. Please ensure both objects are visible and the right field is selected. PWOutput#3 0

  • The more advanced approach enables the display of full particle geometries, for which the simulation is evaluated. However, it requires preprocessing using python3 scripts, which are also prepared in the directory. First, remove the initial time step by entering

rm -rf 0/

next run

python3 syncTimeLevels.py

please check that the script loaded time levels in the correct order and proceed. Next, merge all individual particle STL meshes into one for each time level by running

python3 merge_STL_outputFiles.py

If everything proceeded correctly, the time levels present should be renamed to integer values starting with 0, and the new directory STLMerged/ should be present. Now, to display results, enter

paraFOAM

Repeat the first two steps of the minimalistic approach as described above for the initial setting. When you have the basic domain displayed prepared, you may right-click the loaded .OpenFOAM object below and click open. Select the "STLMerged/" directory and then click on STL_Results..stl and hit "OK", as indicated in figure below with yellow border. The STL files will be loaded with STLSolidLabeling field you may change this for solid color by following rectangles highlighted with pink in the figure below. PWOutput4 0

If you wish to improve your visualization further, highlight the area where the particles are added to the computational domain. This can be achieved by using the box filter: click ctrl and space and write "box." Select the filter and configure it according to HFDIBDEMDict. Follow the figure below for setting the box filter and possible display of the result.

PWOutput#5 0

This concludes this tutorial; if you have any questions, feel free to contact us by e-mail.