Skip to content

Commit a3c3ca1

Browse files
postprocess for segregation
1 parent 94f892f commit a3c3ca1

File tree

11 files changed

+454
-194
lines changed

11 files changed

+454
-194
lines changed
Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
# Post-processing for Evaluating Segregation of Particles
2+
3+
- Compatibility: phasicFlow-v-1.0
4+
- Solvers and tools: sphereGranFlow, postprocessPhasicFlow
5+
6+
## Background
7+
8+
In particle-based simulations, it's often necessary to perform operations on particle fields to obtain bulk properties of the powder system (such as sums or averages). For example, we may need to calculate the mass-averaged velocity of particles in a granular flow. For bulk-processing of particle fields, we can use a mesh structure to obtain bulk properties of the powder in each cell. In this tutorial, we use a rectangular mesh in which a cuboid is divided into equal sub-spaces (cells).
9+
10+
This tutorial demonstrates how to obtain three important bulk properties:
11+
12+
- Mass-averaged solid velocity (and its fluctuations)
13+
- Solid volume fraction
14+
- Volume fraction of small particles (segregation measurement)
15+
16+
## Problem Definition
17+
18+
We will post-process the simulation results from the case [rotating drum with binary particles](../sphereGranFlow/binarySystemOfParticles/). The goal is to create a rectangular mesh with cuboid cells and calculate bulk properties on this mesh to analyze particle segregation patterns.
19+
20+
***
21+
22+
## Case Setup
23+
24+
This tutorial focuses solely on the post-processing aspect of the simulation. It assumes you have already executed the simulation and the results are available for post-processing.
25+
26+
**Important Note:** Postprocessing in phasicFlow can be performed in two modes:
27+
1. **In-simulation postprocessing**: Activated during simulation runtime, allowing calculations on live simulation data
28+
2. **Post-simulation postprocessing**: Performed after the simulation has completed
29+
30+
For more detailed information about different modes of postprocessing, please refer to the [official documentation page](../../../src/PostprocessData/readme.md).
31+
32+
### Configuration File
33+
34+
In `settings/postprocessDataDict`, you configure the post-processing parameters:
35+
36+
```C++
37+
// file: settings/postprocessDataDict
38+
39+
// Enable in-simulation postprocessing (set to "no" for post-simulation only)
40+
runTimeActive yes;
41+
42+
// Shape type used in the simulation
43+
shapeType sphere;
44+
45+
components
46+
(
47+
on_rectMesh
48+
{
49+
// Use Gaussian distribution for sampling and distributing
50+
// particle properties over cells
51+
processMethod GaussianDistribution;
52+
53+
processRegion rectMesh;
54+
55+
// Use time control in settingsDict file
56+
timeControl settingsDict;
57+
58+
// A rectangular mesh is constructed using corner points of the
59+
// mesh region and number of divisions in each direction
60+
rectMeshInfo
61+
{
62+
min (-0.12 -0.12 0.00);
63+
max (0.12 0.12 0.1);
64+
nx 36;
65+
ny 36;
66+
nz 15;
67+
}
68+
69+
operations
70+
(
71+
// Calculate mass-averaged particle velocity
72+
avVelocity
73+
{
74+
function average;
75+
76+
field velocity;
77+
78+
fluctuation2 yes;
79+
80+
threshold 4;
81+
82+
phi mass;
83+
}
84+
85+
// Calculate solid volume fraction
86+
solidVolFraction
87+
{
88+
function sum;
89+
90+
field volume;
91+
92+
divideByVolume yes;
93+
94+
threshold 4;
95+
}
96+
97+
// Calculate volume fraction of small particles
98+
smallSphereVolFraction
99+
{
100+
function average;
101+
102+
field one;
103+
104+
phi volume;
105+
106+
divideByVolume no;
107+
108+
threshold 4;
109+
110+
includeMask lessThan;
111+
112+
lessThanInfo
113+
{
114+
field diameter;
115+
116+
value 0.0031;
117+
}
118+
}
119+
);
120+
121+
}
122+
);
123+
```
124+
125+
### Understanding the Configuration
126+
127+
#### Mesh Configuration
128+
In the `rectMeshInfo` dictionary:
129+
- `min` and `max` define the corner points of the entire domain
130+
- `nx`, `ny`, and `nz` define the number of divisions in each direction
131+
132+
#### Operations
133+
We define three operations to extract bulk properties:
134+
135+
1. **avVelocity**: Calculates mass-averaged particle velocity
136+
137+
The `average` function is defined mathematically as:
138+
139+
$$\text{average} = \frac{\sum_j w_j \cdot \phi_j \cdot \text{field}_j}{\sum_i w_i \cdot \phi_i}$$
140+
141+
When `field` is set to velocity and `phi` is set to mass, we calculate the mass-averaged velocity of particles in each cell. With `fluctuation2` set to yes, we also calculate velocity fluctuations around the mean value.
142+
143+
Note that:
144+
- Cells with fewer than 4 particles are excluded (via the `threshold` parameter)
145+
- $w_j$ is the weight factor determined by the Gaussian distribution function
146+
147+
2. **solidVolFraction**: Calculates solid volume fraction in each cell
148+
149+
The `sum` function is defined as:
150+
151+
$$\text{sum} = \sum_j w_j \cdot \phi_j \cdot \text{field}_j$$
152+
153+
By setting `field` to volume and `divideByVolume` to yes, we sum the volumes of all particles in each cell and divide by the cell volume, giving us the solid volume fraction.
154+
155+
3. **smallSphereVolFraction**: Calculates volume fraction of small particles in each cell
156+
157+
This operation measures the volume fraction of small particles relative to total particle volume. The `includeMask` parameter filters particles by diameter, selecting only those smaller than 0.0031 units.
158+
159+
The numerator of the `average` function calculates the sum of small particle volumes, while the denominator calculates the total volume of all particles.
160+
161+
### Particle Filtering with includeMask
162+
163+
The `includeMask` parameter allows filtering particles based on field values. Available options include:
164+
165+
* `all`: Include all particles (default)
166+
* `lessThan`: Include particles where field < value
167+
* `lessThanEq`: Include particles where field ≤ value
168+
* `greaterThan`: Include particles where field > value
169+
* `greaterThanEq`: Include particles where field ≥ value
170+
* `equal`: Include particles where field = value
171+
* `between`: Include particles where value1 < field < value2
172+
* `betweenEq`: Include particles where value1 ≤ field ≤ value2
173+
174+
## Running the Post-processing Tool
175+
176+
After completing the simulation, execute the post-processing tool with:
177+
178+
```bash
179+
postprocessPhasicFlow
180+
```
181+
182+
The results will be stored in the `./postprocessData` folder.
183+
184+
**Tip:** Run `postprocessPhasicFlow -h` to see all available command-line options, including time range selection for post-processing.

tutorials/postprocessPhasicFlow/segregation/caseSetup/interaction

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,47 +7,42 @@ objectType dicrionary;
77
fileFormat ASCII;
88
/*---------------------------------------------------------------------------*/
99

10-
materials (prop1); // a list of materials names
11-
densities (1000.0); // density of materials [kg/m3]
10+
materials (prop1); // a list of materials names
11+
12+
densities (1000.0); // density of materials [kg/m3]
1213

1314
contactListType sortedContactList;
1415

15-
model
16+
contactSearch
1617
{
17-
contactForceModel nonLinearNonLimited;
18-
rollingFrictionModel normal;
18+
19+
method NBS;
1920

20-
Yeff (1.0e6); // Young modulus [Pa]
21+
updateInterval 10;
2122

22-
Geff (0.8e6); // Shear modulus [Pa]
23+
sizeRatio 1.1;
2324

24-
nu (0.25); // Poisson's ratio [-]
25+
cellExtent 0.55;
2526

26-
en (0.7); // coefficient of normal restitution
27+
adjustableBox Yes;
28+
}
29+
30+
model
31+
{
32+
contactForceModel nonLinearNonLimited;
2733

28-
et (1.0); // coefficient of tangential restitution
34+
rollingFrictionModel normal;
2935

30-
mu (0.3); // dynamic friction
36+
Yeff (1.0e6); // Young modulus [Pa]
3137

32-
mur (0.1); // rolling friction
33-
34-
}
38+
Geff (0.8e6); // Shear modulus [Pa]
3539

36-
contactSearch
37-
{
38-
method multiGridNBS; // method for broad search particle-particle
39-
wallMapping multiGridMapping; // method for broad search particle-wall
40+
nu (0.25); // Poisson's ratio [-]
4041

41-
multiGridNBSInfo
42-
{
43-
updateFrequency 10; // each 10 timesteps, update neighbor list
44-
sizeRatio 1.1; // bounding box size to particle diameter (max)
45-
}
42+
en (0.7); // coefficient of normal restitution
4643

47-
multiGridMappingInfo
48-
{
49-
updateFrequency 10; // each 10 timesteps, update neighbor list
50-
cellExtent 0.6; // bounding box for particle-wall search (> 0.5)
51-
}
44+
mu (0.3); // dynamic friction
5245

46+
mur (0.1); // rolling friction
5347
}
48+

tutorials/postprocessPhasicFlow/segregation/caseSetup/particleInsertion

Lines changed: 0 additions & 14 deletions
This file was deleted.

tutorials/postprocessPhasicFlow/segregation/caseSetup/sphereShape renamed to tutorials/postprocessPhasicFlow/segregation/caseSetup/shapes

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ objectType sphereShape;
77
fileFormat ASCII;
88
/*---------------------------------------------------------------------------*/
99

10-
names (smallSphere largeSphere); // names of shapes
10+
names (smallSphere largeSphere); // names of shapes
11+
1112
diameters (0.003 0.005); // diameter of shapes
13+
1214
materials (prop1 prop1); // material names for shapes

tutorials/postprocessPhasicFlow/segregation/cleanThisCase

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ cd ${0%/*} || exit 1 # Run from this directory
33

44
ls | grep -P "^(([0-9]+\.?[0-9]*)|(\.[0-9]+))$" | xargs -d"\n" rm -rf
55
rm -rf VTK
6-
6+
rm -rf postprocessData
77
#------------------------------------------------------------------------------
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/* -------------------------------*- C++ -*--------------------------------- *\
2+
| phasicFlow File |
3+
| copyright: www.cemf.ir |
4+
\* ------------------------------------------------------------------------- */
5+
objectName domainDict;
6+
objectType dictionary;
7+
fileFormat ASCII;
8+
/*---------------------------------------------------------------------------*/
9+
10+
// Simulation domain: every particles that goes outside this domain will be deleted
11+
globalBox
12+
{
13+
min (-0.12 -0.12 0.00); // lower corner point of the box
14+
15+
max (0.12 0.12 0.11); // upper corner point of the box
16+
}
17+
18+
boundaries
19+
{
20+
left
21+
{
22+
type exit; // other options: periodic, reflective
23+
}
24+
25+
right
26+
{
27+
type exit; // other options: periodic, reflective
28+
}
29+
30+
bottom
31+
{
32+
type exit; // other options: periodic, reflective
33+
}
34+
35+
top
36+
{
37+
type exit; // other options: periodic, reflective
38+
}
39+
40+
rear
41+
{
42+
type exit; // other options: periodic, reflective
43+
}
44+
45+
front
46+
{
47+
type exit; // other options: periodic, reflective
48+
}
49+
}

0 commit comments

Comments
 (0)