tutorials-1 after diameter->distance

This commit is contained in:
Hamidreza 2025-04-25 14:17:09 +03:30
parent a545acb374
commit 7c3b90a22d
52 changed files with 1100 additions and 908 deletions

View File

@ -44,8 +44,8 @@ positionParticles
orderedInfo orderedInfo
{ {
// minimum space between centers of particles // minimum distance between particles centers
diameter 0.001; distance 0.001;
// number of particles in the simulation // number of particles in the simulation
numPoints 50000; numPoints 50000;

View File

@ -24,7 +24,7 @@ positionParticles
positionOrderedInfo positionOrderedInfo
{ {
diameter 0.005; // minimum space between centers of particles distance 0.005; // minimum distance between particles centers
numPoints 30000; // number of particles in the simulation numPoints 30000; // number of particles in the simulation
axisOrder (z x y); // axis order for filling the space with particles axisOrder (z x y); // axis order for filling the space with particles
} }
@ -41,7 +41,7 @@ setFields
{ {
velocity realx3 (0 0 0); // linear velocity (m/s) velocity realx3 (0 0 0); // linear velocity (m/s)
acceleration realx3 (0 0 0); // linear acceleration (m/s2) acceleration realx3 (0 0 0); // linear acceleration (m/s2)
r Velocity realx3 (0 0 0); // rotational velocity (rad/s) rVelocity realx3 (0 0 0); // rotational velocity (rad/s)
shapeName word smallSphere; // name of the particle shape shapeName word smallSphere; // name of the particle shape
} }
@ -54,6 +54,7 @@ setFields
{ {
begin 0; // begin index of points begin 0; // begin index of points
end 29999; // end index of points end 29999; // end index of points
number 10000; // number of points to be selected
} }
fieldValue // fields that the selector is applied to fieldValue // fields that the selector is applied to
{ {

View File

@ -0,0 +1,7 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
ls | grep -P "^(([0-9]+\.?[0-9]*)|(\.[0-9]+))$" | xargs -d"\n" rm -rf
rm -rf VTK
#------------------------------------------------------------------------------

View File

@ -0,0 +1,21 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
echo "\n<--------------------------------------------------------------------->"
echo "1) Creating particles"
echo "<--------------------------------------------------------------------->\n"
particlesPhasicFlow
echo "\n<--------------------------------------------------------------------->"
echo "2) Creating geometry"
echo "<--------------------------------------------------------------------->\n"
geometryPhasicFlow
echo "\n<--------------------------------------------------------------------->"
echo "3) Running the case"
echo "<--------------------------------------------------------------------->\n"
sphereGranFlow
#------------------------------------------------------------------------------

View File

@ -6,7 +6,9 @@ objectName domainDict;
objectType dictionary; objectType dictionary;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
globalBox // Simulation domain: every particles that goes outside this domain will be deleted
// Simulation domain: every particles that goes outside this domain will be deleted
globalBox
{ {
min (0.397538 0.178212 0.00); min (0.397538 0.178212 0.00);

View File

@ -25,10 +25,12 @@ g (0 -9.8 0); // gravity vector (m/s2)
includeObjects (diameter mass); includeObjects (diameter mass);
// exclude unnecessary data from saving on disk // exclude unnecessary data from saving on disk
excludeObjects (rVelocity.dy1 pStructPosition.dy1 pStructVelocity.dy1); excludeObjects ();
integrationMethod AdamsBashforth2; integrationMethod AdamsBashforth2;
integrationHistory off;
writeFormat ascii; // data writting format (ascii or binary) writeFormat ascii; // data writting format (ascii or binary)
timersReport Yes; // report timers: Yes or No timersReport Yes; // report timers: Yes or No

View File

@ -47,7 +47,7 @@ positionParticles
method ordered; // other options: random or empty method ordered; // other options: random or empty
orderedInfo orderedInfo
{ {
diameter 0.005; // minimum space between centers of particles distance 0.005; // minimum space between centers of particles
numPoints 30000; // number of particles in the simulation numPoints 30000; // number of particles in the simulation
axisOrder (z x y); // axis order for filling the space with particles axisOrder (z x y); // axis order for filling the space with particles
} }

View File

View File

@ -6,8 +6,8 @@ objectName domainDict;
objectType dictionary; objectType dictionary;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
// Simulation domain: every particles that goes outside this domain will be deleted
// Simulation domain: every particles that goes outside this domain will be deleted
globalBox globalBox
{ {
min (-0.12 -0.12 0); min (-0.12 -0.12 0);

View File

@ -44,7 +44,6 @@ surfaces
/* /*
This is a plane wall at the rear end of cylinder This is a plane wall at the rear end of cylinder
*/ */
wall1 wall1
{ {
type planeWall; // other options: cuboidWall and cylinderWall type planeWall; // other options: cuboidWall and cylinderWall
@ -65,7 +64,6 @@ surfaces
/* /*
This is a plane wall at the front end of cylinder This is a plane wall at the front end of cylinder
*/ */
wall2 wall2
{ {
type planeWall; // other options: cuboidWall and cylinderWall type planeWall; // other options: cuboidWall and cylinderWall

View File

@ -6,6 +6,7 @@ objectName particlesDict;
objectType dictionary; objectType dictionary;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
setFields setFields
{ {
/* /*
@ -54,7 +55,7 @@ positionParticles // positions particles
orderedInfo orderedInfo
{ {
diameter 0.005; // diameter of particles distance 0.005; // minimum distance between particles centers
numPoints 30000; // number of particles in the simulation numPoints 30000; // number of particles in the simulation

View File

@ -21,15 +21,15 @@ timePrecision 6; // maximum number of digits for time
g (0 -9.8 0); // gravity vector (m/s2) g (0 -9.8 0); // gravity vector (m/s2)
// save necessary (i.e., required) data on disk // save necessary (i.e., required) data on disk
includeObjects (diameter); includeObjects (diameter);
// exclude unnecessary data from saving on disk // exclude unnecessary data from saving on disk
excludeObjects ();
excludeObjects (rVelocity.dy1 pStructPosition.dy1 pStructVelocity.dy1);
integrationMethod AdamsBashforth2; // integration method integrationMethod AdamsBashforth2; // integration method
integrationHistory off; // do not keep integration history on disk (saves space)
writeFormat ascii; // data writting format (ascii or binary) writeFormat ascii; // data writting format (ascii or binary)
timersReport Yes; // report timers timersReport Yes; // report timers

View File

@ -6,14 +6,14 @@ objectName particleInsertion;
objectType dicrionary; objectType dicrionary;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
active Yes; // is insertion active -> yes or no active Yes; // is insertion active -> yes or no
checkForCollision No; // is checked -> yes or no checkForCollision No; // is checked -> yes or no
/* /*
one layers of particles are packed one layer of particles are packed
*/ */
layer0 layer0
{ {
timeControl simulationTime; timeControl simulationTime;

View File

@ -6,6 +6,7 @@ objectName sphereDict;
objectType sphereShape; objectType sphereShape;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
names (lightSphere heavySphere); // names of shapes names (lightSphere heavySphere); // names of shapes
diameters (0.007 0.007); // diameter of shapes diameters (0.007 0.007); // diameter of shapes

View File

@ -6,7 +6,9 @@ objectName domainDict;
objectType dictionary; objectType dictionary;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
globalBox // Simulation domain: every particles that goes outside this domain will be deleted
// Simulation domain: every particles that goes outside this domain will be deleted
globalBox
{ {
min (-0.11 -0.11 -0.41); min (-0.11 -0.11 -0.41);
@ -16,19 +18,15 @@ globalBox // Simulation domain: every par
boundaries boundaries
{ {
// Determines how often (how many iterations) do you want to // Determines how often (how many iterations) do you want to
// rebuild the list of particles in the neighbor list // rebuild the list of particles in the neighbor list
// of all boundaries in the simulation domain // of all boundaries in the simulation domain
neighborListUpdateInterval 30; neighborListUpdateInterval 30;
// Determines how often do you want to update the new changes in the boundary // Determines how often do you want to update the new changes in the boundary
updateInterval 10; updateInterval 10;
// The distance from the boundary plane within which particles are marked to be in the boundary list // The distance from the boundary plane within which particles are marked to be in the boundary list
neighborLength 0.004; neighborLength 0.004;
left left

View File

@ -6,7 +6,9 @@ objectName geometryDict;
objectType dictionary; objectType dictionary;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
motionModel conveyorBelt; // motion model can be rotatingAxis or stationary or vibrating
// motion model can be rotatingAxis or stationary or vibrating
motionModel conveyorBelt;
conveyorBeltInfo conveyorBeltInfo
{ {
@ -73,8 +75,3 @@ surfaces
} }
} }

View File

@ -6,16 +6,14 @@ objectName particlesDict;
objectType dictionary; objectType dictionary;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
setFields setFields
{ {
/* /*
Default value for fields defined for particles Default value for fields defined for particles
These fields should always be defined for simulations with These fields should always be defined for simulations with
spherical particles. spherical particles.
*/ */
defaultValue defaultValue
{ {
velocity realx3 (0 0 0); // linear velocity (m/s) velocity realx3 (0 0 0); // linear velocity (m/s)
@ -31,17 +29,8 @@ setFields
{} {}
} }
positionParticles // positions particles positionParticles
{ {
method empty; // other options: ordered and random method empty; // other options: file, ordered and random
regionType box; // other options: cylinder and sphere
boxInfo // box region for positioning particles
{
min (-0.08 -0.08 0.015); // lower corner point of the box
max ( 0.08 0.08 0.098); // upper corner point of the box
}
} }

View File

@ -6,7 +6,8 @@ objectName settingsDict;
objectType dictionary; objectType dictionary;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
run layerdSiloFilling;
run conveyorBelt;
dt 0.00005; // time step for integration (s) dt 0.00005; // time step for integration (s)
@ -21,13 +22,10 @@ timePrecision 6; // maximum number of digits for ti
g (0 0 -9.8); // gravity vector (m/s2) g (0 0 -9.8); // gravity vector (m/s2)
// save data objects that are not automatically saved on disk. // save data objects that are not automatically saved on disk.
// overrides the default behavior // overrides the default behavior
includeObjects (diameter); includeObjects (diameter);
// exclude unnecessary data from saving on disk // exclude unnecessary data from saving on disk
excludeObjects (rVelocity.dy1 pStructPosition.dy1 pStructVelocity.dy1); excludeObjects (rVelocity.dy1 pStructPosition.dy1 pStructVelocity.dy1);
integrationMethod AdamsBashforth2; // integration method integrationMethod AdamsBashforth2; // integration method

View File

@ -72,7 +72,7 @@ boundaries
## Running the Case ## Running the Case
The solver for this simulation is `sphereGranFlow`. Enter the following commands in the terminal. Depending on the computational power, it may take a few minutes to a few hours to complete. The solver for this simulation is `sphereGranFlow`. Enter the following commands in the terminal. Depending on the computational power, it may take a few minutes to a few hours to complete.
```sh ```
geometryPhasicFlow geometryPhasicFlow
particlesPhasicFlow particlesPhasicFlow
sphereGranFlow sphereGranFlow
@ -81,6 +81,6 @@ sphereGranFlow
## Post Processing ## Post Processing
After finishing the simulation, you can render the results in ParaView. To convert the results to VTK format, just enter the following command in the terminal. This will convert all the results (particles and geometry) to VTK format and store them in the `VTK/` folder. After finishing the simulation, you can render the results in ParaView. To convert the results to VTK format, just enter the following command in the terminal. This will convert all the results (particles and geometry) to VTK format and store them in the `VTK/` folder.
```sh ```
pFlowToVTK --binary pFlowToVTK --binary
``` ```

View File

@ -24,18 +24,12 @@ g (0 -9.8 0); // gravity vector (m/s2)
includeObjects (diameter); // save necessary (i.e., required) data on disk includeObjects (diameter); // save necessary (i.e., required) data on disk
// exclude unnecessary data from saving on disk // exclude unnecessary data from saving on disk
excludeObjects (rVelocity.dy1 excludeObjects ();
rVelocity.dy2
rVelocity.dy3
pStructPosition.dy1
pStructPosition.dy2
pStructPosition.dy3
pStructVelocity.dy1
pStructVelocity.dy2
pStructVelocity.dy3);
integrationMethod AdamsBashforth4; // integration method integrationMethod AdamsBashforth4; // integration method
integrationHistory off; // to save space on disk
writeFormat ascii; // data writting format (ascii or binary) writeFormat ascii; // data writting format (ascii or binary)
timersReport Yes; // report timers (Yes or No) timersReport Yes; // report timers (Yes or No)

View File

@ -3,7 +3,7 @@
## Problem ## Problem
A homogenization silo is used to mix particles inside a silo using the circulation of particles. A pneumatic conveying system carries particles from the exit and re-enters them from the top. Here, we use a `periodic` boundary to simulate the action of the pneumatic conveyor system for circulating particles. Particles exiting from the bottom are re-entered from the top using this boundary (`periodic`). A homogenization silo is used to mix particles inside a silo using the circulation of particles. A pneumatic conveying system carries particles from the exit and re-enters them from the top. Here, we use a `periodic` boundary to simulate the action of the pneumatic conveyor system for circulating particles. Particles exiting from the bottom are re-entered from the top using this boundary (`periodic`).
The simulation case setup is essentially similar to the [`layeredSiloFilling`](https://github.com/PhasicFlow/phasicFlow/tree/main/tutorials/sphereGranFlow/layeredSiloFilling) tutorial. There is also another change with regard to `layeredSiloFilling`. The exit gate is opened after the filling phase of the silo (see `settings/geometryDict` for more details). The simulation case setup is essentially similar to the [`layeredSiloFilling`](../layeredSiloFilling/) tutorial. There is also another change with regard to `layeredSiloFilling`. The exit gate is opened after the filling phase of the silo (see `settings/geometryDict` for more details).
<div align ="center"> <div align ="center">
<img src="./homoSilo.jpeg" style="width: 400px;"> <img src="./homoSilo.jpeg" style="width: 400px;">

View File

@ -37,7 +37,6 @@ model
heavyMat-heavyMat heavyMat-wallMat heavyMat-heavyMat heavyMat-wallMat
wallMat-wallMat ); wallMat-wallMat );
*/ */
Yeff (1.0e6 1.0e6 1.0e6 // Young modulus [Pa] Yeff (1.0e6 1.0e6 1.0e6 // Young modulus [Pa]
1.0e6 1.0e6 1.0e6 1.0e6
1.0e6); 1.0e6);

View File

@ -109,7 +109,6 @@ layer2
mixture mixture
{ {
parType1 1; // only parType1 parType1 1; // only parType1
} }
} }
@ -143,7 +142,6 @@ layer3
mixture mixture
{ {
parType2 1; parType2 1;
} }
} }
@ -176,7 +174,6 @@ layer4
mixture mixture
{ {
parType1 1; parType1 1;
} }
} }
@ -209,6 +206,5 @@ layer5
mixture mixture
{ {
parType2 1; parType2 1;
} }
} }

View File

@ -38,12 +38,12 @@ boundaries
type exit; type exit;
} }
rear rear // z-
{ {
type periodic; type periodic;
} }
front front // z+
{ {
type periodic; type periodic;
} }

View File

@ -61,7 +61,6 @@ surfaces
/* /*
This is a plane wall at the exit of silo This is a plane wall at the exit of silo
*/ */
exitGate exitGate
{ {
type planeWall; // other options: cuboidWall and cylinderWall type planeWall; // other options: cuboidWall and cylinderWall

View File

@ -13,7 +13,6 @@ setFields
These fields should always be defined for simulations with These fields should always be defined for simulations with
spherical particles. spherical particles.
*/ */
defaultValue defaultValue
{ {
velocity realx3 (0 0 0); // linear velocity (m/s) velocity realx3 (0 0 0); // linear velocity (m/s)

View File

@ -25,12 +25,12 @@ g (0 0 -9.8); // gravity vector (m/s2)
includeObjects (diameter); includeObjects (diameter);
// exclude unnecessary data from saving on disk // exclude unnecessary data from saving on disk
excludeObjects (rVelocity.dy1 rVelocity.dy2 rVelocity.dy3 excludeObjects ();
pStructPosition.dy1 pStructPosition.dy2 pStructPosition.dy3
pStructVelocity.dy1 pStructVelocity.dy2 pStructVelocity.dy3);
integrationMethod AdamsBashforth4; // integration method integrationMethod AdamsBashforth4; // integration method
integrationHistory off; // to save space on disk
writeFormat binary; // data writting format (ascii or binary) writeFormat binary; // data writting format (ascii or binary)
timersReport Yes; // report timers timersReport Yes; // report timers

View File

@ -13,7 +13,6 @@ setFields
These fields should always be defined for simulations with These fields should always be defined for simulations with
spherical particles. spherical particles.
*/ */
defaultValue defaultValue
{ {
velocity realx3 (0 0 0); // linear velocity (m/s) velocity realx3 (0 0 0); // linear velocity (m/s)

View File

@ -25,10 +25,12 @@ g (0 0 -9.8); // gravity vector (m/s^2)
includeObjects (diameter mass); includeObjects (diameter mass);
// exclude unnecessary data from saving on disk // exclude unnecessary data from saving on disk
excludeObjects (rVelocity.dy1 pStructPosition.dy1 pStructVelocity.dy1); excludeObjects ();
integrationMethod AdamsBashforth2; // integration method integrationMethod AdamsBashforth2; // integration method
integrationHistory off;
writeFormat ascii; // data writing format (ascii or binary) writeFormat ascii; // data writing format (ascii or binary)
timersReport Yes; // report timers timersReport Yes; // report timers

View File

@ -0,0 +1,161 @@
# Simulating a Medium-Scale Rotating Drum (v-1.0)
## Problem Definition
This tutorial demonstrates the simulation of a medium-sized rotating drum with a diameter of 0.24 m and a length of 0.36 m. The drum is filled with 250,000 spherical glass beads with a diameter of 3 mm. The drum rotates at a constant speed, and the simulation captures the flow behavior and mixing of the particles.
<div align="center">
<b>
A view of the rotating drum simulation
</b>
</div>
***
## Setting up the Case
PhasicFlow simulation case setup is based on text-based scripts provided in two folders located in the simulation case folder: `settings` and `caseSetup`. All commands should be entered in the terminal while the current working directory is the simulation case folder.
### Creating Particles
In the file `settings/particlesDict`, two dictionaries, `positionParticles` and `setFields`, define how particles are positioned and what field values they have initially.
The `positionParticles` dictionary specifies the ordered positioning method to place 250,000 particles within a cylindrical region:
```C++
positionParticles
{
method ordered; // other options: random and empty
orderedInfo
{
distance 0.003; // minimum distance between particles centers
numPoints 250000; // number of particles in the simulation
axisOrder (z y x); // axis order for filling the space with particles
}
regionType cylinder; // other options: box and sphere
cylinderInfo
{
p1 (0.0 0.0 0.003); // begin point of cylinder axis
p2 (0.0 0.0 0.357); // end point of cylinder axis
radius 0.117; // radius of cylinder
}
}
```
The `setFields` dictionary defines the initial values for particle fields:
```C++
setFields
{
defaultValue
{
velocity realx3 (0 0 0); // linear velocity (m/s)
acceleration realx3 (0 0 0); // linear acceleration (m/s2)
rVelocity realx3 (0 0 0); // rotational velocity (rad/s)
shapeName word glassBead; // name of the particle shape
}
}
```
To create the particles based on these settings, enter the following command in the terminal:
```
> particlesPhasicFlow
```
### Creating Geometry
In the file `settings/geometryDict`, you can find information for creating the rotating drum geometry. The simulation uses the `rotatingAxis` motion model to define rotation around a fixed axis.
The surfaces of the drum are defined in the `surfaces` dictionary, including the cylindrical shell and end walls.
To create the geometry based on these settings, enter the following command in the terminal:
```
> geometryPhasicFlow
```
### Defining Properties and Interactions
In the file `caseSetup/shapes`, the particle shape, diameter, and material are defined:
```C++
names (glassBead); // names of shapes
diameters (0.003); // diameter of shapes
materials (glassMat); // material names for shapes
```
In the file `caseSetup/interaction`, the material properties and interaction models are defined:
```C++
materials (glassMat wallMat); // a list of materials names
densities (2500.0 2500); // density of materials [kg/m3]
model
{
contactForceModel nonLinearLimited;
rollingFrictionModel normal;
/*
Property (glassMat-glassMat glassMat-wallMat
wallMat-wallMat);
*/
Yeff (1.0e6 1.0e6
1.0e6); // Young modulus [Pa]
Geff (0.8e6 0.8e6
0.8e6); // Shear modulus [Pa]
nu (0.25 0.25
0.25); // Poisson's ratio [-]
en (0.97 0.85
1.00); // coefficient of normal restitution
mu (0.65 0.65
0.65); // dynamic friction
mur (0.1 0.1
0.1); // rolling friction
}
```
The contact search settings are also defined in this file, including the method, update interval, and other parameters.
## Running the Simulation
To run the simulation, follow these steps in order:
1. Create the initial particle fields:
```
> particlesPhasicFlow
```
2. Create the geometry:
```
> geometryPhasicFlow
```
3. Start the simulation:
```
> sphereGranFlow
```
The simulation will run according to the settings defined in `settings/settingsDict`, including the time step, start/end times, and gravity vector.
## Post-Processing
After the simulation is complete, you can visualize the results using ParaView. To convert the simulation results to VTK format, use the following command:
```
> pFlowToVTK --binary
```
This will create VTK files in the `VTK/` folder that can be opened in ParaView for visualization and analysis.

View File

@ -6,6 +6,7 @@ objectName interaction;
objectType dicrionary; objectType dicrionary;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
materials (glassMat wallMat); // a list of materials names materials (glassMat wallMat); // a list of materials names
densities (2500.0 2500); // density of materials [kg/m3] densities (2500.0 2500); // density of materials [kg/m3]

View File

@ -1,10 +0,0 @@
/* -------------------------------*- C++ -*--------------------------------- *\
| phasicFlow File |
| copyright: www.cemf.ir |
\* ------------------------------------------------------------------------- */
objectName particleInsertion;
objectType dicrionary;
fileFormat ASCII;
/*---------------------------------------------------------------------------*/
active No; // is checked -> Yes or No

View File

@ -6,7 +6,9 @@ objectName domainDict;
objectType dictionary; objectType dictionary;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
globalBox // Simulation domain: every particles that goes outside this domain will be deleted
// Simulation domain: every particles that goes outside this domain will be deleted
globalBox
{ {
min (-0.12 -0.12 0); min (-0.12 -0.12 0);

View File

@ -6,6 +6,7 @@ objectName geometryDict;
objectType dictionary; objectType dictionary;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
motionModel rotatingAxis; // motion model: rotating object around an axis motionModel rotatingAxis; // motion model: rotating object around an axis

View File

@ -36,7 +36,7 @@ positionParticles // positions particles
orderedInfo orderedInfo
{ {
diameter 0.003; // minimum space between centers of particles distance 0.003; // minimum distance between particles centers
numPoints 250000; // number of particles in the simulation numPoints 250000; // number of particles in the simulation

View File

@ -23,7 +23,7 @@ g (0 -9.8 0); // gravity vector (m/s2)
includeObjects (diameter); // save necessary (i.e., required) data on disk includeObjects (diameter); // save necessary (i.e., required) data on disk
// exclude unnecessary data from saving on disk // exclude unnecessary data from saving on disk
excludeObjects (rVelocity.dy1 pStructPosition.dy1 pStructVelocity.dy1); excludeObjects ();
integrationMethod AdamsBashforth2; // integration method integrationMethod AdamsBashforth2; // integration method

View File

@ -1,35 +1,36 @@
# Simularing a rotating drum (v-1.0) # Simulating a Rotating Drum (v-1.0)
## Problem definition
The problem is to simulate a rotating drum with the diameter 0.24 m and the length 0.1 m rotating at 11.6 rpm. It is filled with 30,000 4-mm spherical particles. The timestep for integration is 0.00001 s. ## Problem Definition
The problem is to simulate a rotating drum with a diameter of 0.24 m and a length of 0.1 m, rotating at 11.6 rpm. It is filled with 30,000 spherical particles, each with a diameter of 4 mm. The timestep for integration is 0.00001 s. This tutorial demonstrates the basic setup for creating a rotation-based simulation using built-in geometry in PhasicFlow.
<div align="center"> <div align="center">
<b> <b>
A view of the rotating drum
A view of rotating drum
</b> </b>
<b> <div>
<img src="https://github.com/PhasicFlow/phasicFlow/blob/media/media/rotating-drum-s.png" width="600px">
![](https://github.com/PhasicFlow/phasicFlow/blob/media/media/rotating-drum-s.png) </div>
</div>
</b></div>
*** ***
## Setting up the case ## Setting up the Case
PhasicFlow simulation case setup is based on the text-based scripts that we provide in two folders located in the simulation case folder: `settings` and `caseSetup` (You can find the case setup files in the above folders.
All the commands should be entered in the terminal while the current working directory is the simulation case folder (at the top of the `caseSetup` and `settings`).
PhasicFlow simulation case setup is based on text-based scripts provided in two folders located in the simulation case folder: `settings` and `caseSetup`. All commands should be entered in the terminal while the current working directory is the simulation case folder (at the top level of `caseSetup` and `settings`).
### Creating particles ### Creating Particles
Open the file `settings/particlesDict`. Two dictionaries, `positionParticles` and `setFields` position particles and set the field values for the particles. In the file `settings/particlesDict`, two dictionaries, `positionParticles` and `setFields`, position particles and set the field values for the particles.
In dictionary `positionParticles`, the positioning `method` is `ordered`, which position particles in order in the space defined by `box`. `box` space is defined by two corner points `min` and `max`. In dictionary `orderedInfo`, `numPoints` defines number of particles; `diameter`, the distance between two adjacent particles, and `axisOrder` defines the axis order for filling the space by particles.
The `positionParticles` dictionary uses the `ordered` method to position particles in a space defined by `box`. The box space is defined by two corner points: `min` and `max`. In the `orderedInfo` sub-dictionary, `numPoints` defines the number of particles (30,000), `distance` defines the spacing between adjacent particles (4 mm), and `axisOrder` defines the axis order for filling the space with particles.
<div align="center"> <div align="center">
in <b>settings/particlesDict</b> file in <b>settings/particlesDict</b> file
</div> </div>
```C++ ```C++
positionParticles // positions particles positionParticles
{ {
method ordered; // other options: random and empty method ordered; // other options: random and empty
@ -37,7 +38,7 @@ positionParticles // positions particles
orderedInfo orderedInfo
{ {
diameter 0.004; // minimum space between centers of particles distance 0.004; // minimum space between centers of particles
numPoints 30000; // number of particles in the simulation numPoints 30000; // number of particles in the simulation
@ -54,7 +55,8 @@ positionParticles // positions particles
} }
} }
``` ```
In dictionary `setFields`, dictionary `defaultValue` defines the initial value for particle fields (here, `velocity`, `acceleration`, `rotVelocity`, and `shapeName`). Note that `shapeName` field should be consistent with the name of shape that you later set for shapes (here one shape with name `sphere1`).
In the `setFields` dictionary, the `defaultValue` sub-dictionary defines the initial values for particle fields (velocity, acceleration, rotational velocity, and shape name). The shape name field should be consistent with the name defined in the shapes file (here, "sphere1").
<div align="center"> <div align="center">
in <b>settings/particlesDict</b> file in <b>settings/particlesDict</b> file
@ -76,17 +78,20 @@ setFields
selectors selectors
{ {
// Selectors can be used to modify properties for specific particle groups
} }
} }
``` ```
Enter the following command in the terminal to create the particles and store them in `0` folder. To create the particles and store them in the `0` folder, enter the following command:
`> particlesPhasicFlow` ```
particlesPhasicFlow
```
### Creating geometry ### Creating Geometry
In file `settings/geometryDict` , you can provide information for creating geometry. Each simulation should have a `motionModel` that defines a model for moving the surfaces in the simulation. `rotatingAxis` model defines a fixed axis which rotates around itself. The dictionary `rotAxis` defines an motion component with `p1` and `p2` as the end points of the axis and `omega` as the rotation speed in rad/s. You can define more than one motion component in a simulation.
In the file `settings/geometryDict`, you define the motion model and geometry for the simulation. The `rotatingAxis` motion model defines a fixed axis which rotates around itself. The `rotAxis` dictionary specifies the axis endpoints and rotation speed.
<div align="center"> <div align="center">
in <b>settings/geometryDict</b> file in <b>settings/geometryDict</b> file
@ -95,7 +100,7 @@ in <b>settings/geometryDict</b> file
```C++ ```C++
motionModel rotatingAxis; motionModel rotatingAxis;
rotatingAxisInfo // information for rotatingAxisMotion motion model rotatingAxisInfo
{ {
rotAxis rotAxis
{ {
@ -107,7 +112,11 @@ rotatingAxisInfo // information for rotatingAxis
} }
} }
``` ```
In the dictionary `surfaces` you can define all the surfaces (walls) in the simulation. Two main options are available: built-in geometries in PhasicFlow, and providing surfaces with stl file. Here we use built-in geometries. In `cylinder` dictionary, a cylindrical shell with end radii, `radius1` and `radius2`, axis end points `p1` and `p2`, `material` name `prop1`, `motion` component `rotAxis` is defined. `resolution` sets number of division for the cylinder shell. `wall1` and `wall2` define two plane walls at two ends of cylindrical shell with coplanar corner points `p1`, `p2`, `p3`, and `p4`, `material` name `prop1` and `motion` component `rotAxis`.
The `surfaces` dictionary defines all the walls in the simulation. This tutorial uses built-in geometries provided by PhasicFlow. The geometry consists of:
1. A `cylinder` dictionary defining a cylindrical shell with end radii (`radius1` and `radius2`), axis endpoints (`p1` and `p2`), material name (`prop1`), and motion component (`rotAxis`).
2. Two plane walls (`wall1` and `wall2`) at the ends of the cylindrical shell, each defined with four coplanar corner points, the same material name, and the same motion component.
<div align="center"> <div align="center">
in <b>settings/geometryDict</b> file in <b>settings/geometryDict</b> file
@ -119,7 +128,6 @@ surfaces
/* /*
A cylinder with begin and end radii 0.12 m and axis points at (0 0 0) and (0 0 0.1) A cylinder with begin and end radii 0.12 m and axis points at (0 0 0) and (0 0 0.1)
*/ */
cylinder cylinder
{ {
type cylinderWall; // type of the wall type cylinderWall; // type of the wall
@ -142,7 +150,6 @@ surfaces
/* /*
This is a plane wall at the rear end of cylinder This is a plane wall at the rear end of cylinder
*/ */
wall1 wall1
{ {
type planeWall; // type of the wall type planeWall; // type of the wall
@ -163,7 +170,6 @@ surfaces
/* /*
This is a plane wall at the front end of cylinder This is a plane wall at the front end of cylinder
*/ */
wall2 wall2
{ {
type planeWall; // type of the wall type planeWall; // type of the wall
@ -182,12 +188,16 @@ surfaces
} }
} }
``` ```
Enter the following command in the terminal to create the geometry and store it in `0/geometry` folder.
`> geometryPhasicFlow` To create the geometry and store it in the `0/geometry` folder, enter:
### Defining properties and interactions ```
In the file `caseSetup/interaction` , you find properties of materials. `materials` defines a list of material names in the simulation and `densities` sets the corresponding density of each material name. model dictionary defines the interaction model for particle-particle and particle-wall interactions. `contactForceModel` selects the model for mechanical contacts (here nonlinear model with limited tangential displacement) and `rollingFrictionModel` selects the model for calculating rolling friction. Other required prosperities should be defined in this dictionary. geometryPhasicFlow
```
### Defining Properties and Interactions
In the file `caseSetup/interaction`, you define properties of materials and their interactions. The `materials` entry lists material names, and `densities` sets the corresponding densities. The `model` dictionary defines the contact force and rolling friction models, along with other required properties.
<div align="center"> <div align="center">
in <b>caseSetup/interaction</b> file in <b>caseSetup/interaction</b> file
@ -195,37 +205,41 @@ in <b>caseSetup/interaction</b> file
```C++ ```C++
materials (prop1); // a list of materials names materials (prop1); // a list of materials names
densities (1000.0); // density of materials [kg/m3] densities (1000.0); // density of materials [kg/m3]
.
. contactListType sortedContactList;
.
model model
{ {
contactForceModel nonLinearNonLimited; contactForceModel nonLinearNonLimited;
rollingFrictionModel normal; rollingFrictionModel normal;
Yeff (1.0e6); // Young modulus [Pa] Yeff (1.0e6); // Young modulus [Pa]
Geff (0.8e6); // Shear modulus [Pa] Geff (0.8e6); // Shear modulus [Pa]
nu (0.25); // Poisson's ratio [-] nu (0.25); // Poisson's ratio [-]
en (0.7); // coefficient of normal restitution en (0.7); // coefficient of normal restitution
mu (0.3); // dynamic friction mu (0.3); // dynamic friction
mur (0.1); // rolling friction mur (0.1); // rolling friction
} }
``` ```
Dictionary `contactSearch` sets the methods for particle-particle and particle-wall contact search. `method` specifies the algorithm for finding neighbor list for particle-particle contacts. `updateInterval` sets the number of iterations between each occurance of updating neighbor list and `sizeRatio` sets the size of enlarged cells (with respect to particle diameter) for finding neighbor list. Larger `sizeRatio` include more particles in the neighbor list and you require to update it less frequent. The `contactSearch` dictionary specifies the algorithm and parameters for finding particle-particle contacts. The `method` determines the broad search algorithm, `updateInterval` sets how often to update the neighbor list, and `sizeRatio` controls the enlarged cell size for finding neighbors.
<div align="center"> <div align="center">
in <b>caseSetup/interaction</b> file in <b>caseSetup/interaction</b> file
</div> </div>
```C++ ```C++
contactListType sortedContactList;
contactSearch contactSearch
{ {
method NBS;
method NBS; // method for broad search
updateInterval 10; updateInterval 10;
@ -235,57 +249,25 @@ contactSearch
adjustableBox Yes; adjustableBox Yes;
} }
``` ```
In the file `caseSetup/shape`, you can define a list of `names` for shapes (`shapeName` in particle field), a list of diameters for shapes and their `properties` names. In the file `caseSetup/shapes`, you define particle shapes, including their names, diameters, and material properties:
<div align="center"> <div align="center">
in <b>caseSetup/shape</b> file in <b>caseSetup/shapes</b> file
</div> </div>
```C++ ```C++
names (sphere1); // names of shapes names (sphere1); // names of shapes
diameters (0.004); // diameter of shapes diameters (0.004); // diameter of shapes
materials (prop1); // material names for shapes materials (prop1); // material names for shapes
``` ```
Other settings for the simulation can be set in file `settings/settingsDict`. ### Simulation Domain and Boundaries
<div align="center"> The file `settings/domainDict` defines a rectangular bounding box with boundaries. Particles that exit this box are automatically deleted.
in <b>settings/settingsDict</b> file
</div>
```C++
run rotatingDrumSmall;
dt 0.00001; // time step for integration (s)
startTime 0; // start time for simulation
endTime 10; // end time for simulation
saveInterval 0.1; // time interval for saving the simulation
timePrecision 6; // maximum number of digits for time folder
g (0 -9.8 0); // gravity vector (m/s2)
includeObjects (diameter); // save necessary (i.e., required) data on disk
// exclude unnecessary data from saving on disk
excludeObjects (rVelocity.dy1 pStructPosition.dy1 pStructVelocity.dy1);
integrationMethod AdamsBashforth2; // integration method
writeFormat ascii; // data writting format (ascii or binary)
timersReport Yes; // report timers (Yes or No)
timersReportInterval 0.01; // time interval for reporting timers
```
The dictionary `settings/domainDict` defines the a rectangular bounding box with two corner points for the simulation. Each particle that gets out of this box, will be deleted automatically.
<div align="center"> <div align="center">
in <b>settings/domainDict</b> file in <b>settings/domainDict</b> file
@ -334,13 +316,77 @@ boundaries
} }
``` ```
### Other Settings
## Running the case Additional parameters for the simulation are set in `settings/settingsDict`, including timestep, start and end times, saving intervals, and gravity:
The solver for this simulation is `sphereGranFlow`. Enter the following command in the terminal. Depending on the computational power, it may take a few minutes to a few hours to complete.
`> sphereGranFlow` <div align="center">
in <b>settings/settingsDict</b> file
</div>
## Post processing ```C++
After finishing the simulation, you can render the results in Paraview. To convert the results to VTK format, just enter the following command in the terminal. This will converts all the results (particles and geometry) to VTK format and store them in folder `VTK/`. dt 0.00001; // time step for integration (s)
`> pFlowToVTK --binary` startTime 0; // start time for simulation
endTime 10; // end time for simulation
saveInterval 0.1; // time interval for saving the simulation
timePrecision 6; // maximum number of digits for time folder
g (0 -9.8 0); // gravity vector (m/s2)
includeObjects (diameter); // save necessary (i.e., required) data on disk
// exclude unnecessary data from saving on disk
excludeObjects ();
integrationMethod AdamsBashforth2; // integration method
integrationHistory off; // to save space on disk
writeFormat ascii; // data writing format (ascii or binary)
timersReport Yes; // report timers (Yes or No)
```
## Running the Case
To execute the simulation, follow these steps in order:
1. Create the geometry:
```
geometryPhasicFlow
```
2. Create the initial particle fields:
```
particlesPhasicFlow
```
3. Run the simulation:
```
sphereGranFlow
```
Depending on your computational resources, the simulation may take from a few minutes to several hours to complete.
## Post Processing
After the simulation completes, you can visualize the results in ParaView by converting them to VTK format:
```
pFlowToVTK --binary
```
This command converts all simulation results (particles and geometry) to VTK format and stores them in a `VTK/` folder. You can then open these files in ParaView for detailed analysis and visualization.
For more specific field output, you can specify fields:
```
pFlowToVTK --binary --fields diameter velocity id
```

View File

@ -6,6 +6,7 @@ objectName interaction;
objectType dicrionary; objectType dicrionary;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
materials (prop1); // a list of materials names materials (prop1); // a list of materials names
densities (1000.0); // density of materials [kg/m3] densities (1000.0); // density of materials [kg/m3]

View File

@ -1,13 +0,0 @@
/* -------------------------------*- C++ -*--------------------------------- *\
| phasicFlow File |
| copyright: www.cemf.ir |
\* ------------------------------------------------------------------------- */
objectName particleInsertion;
objectType dicrionary;
fileFormat ASCII;
/*---------------------------------------------------------------------------*/
active No; // is insertion active -> Yes or No
collisionCheck No; // is checked -> Yes or No

View File

@ -6,7 +6,9 @@ objectName domainDict;
objectType dictionary; objectType dictionary;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
globalBox // Simulation domain: every particles that goes outside this domain will be deleted
// Simulation domain: every particles that goes outside this domain will be deleted
globalBox
{ {
min (-0.12 -0.12 0.00); // lower corner point of the box min (-0.12 -0.12 0.00); // lower corner point of the box
@ -17,31 +19,31 @@ boundaries
{ {
left left
{ {
type exit; // other options: periodict, reflective type exit; // other options: periodic, reflective
} }
right right
{ {
type exit; // other options: periodict, reflective type exit; // other options: periodic, reflective
} }
bottom bottom
{ {
type exit; // other options: periodict, reflective type exit; // other options: periodic, reflective
} }
top top
{ {
type exit; // other options: periodict, reflective type exit; // other options: periodic, reflective
} }
rear rear
{ {
type exit; // other options: periodict, reflective type exit; // other options: periodic, reflective
} }
front front
{ {
type exit; // other options: periodict, reflective type exit; // other options: periodic, reflective
} }
} }

View File

@ -6,6 +6,7 @@ objectName geometryDict;
objectType dictionary; objectType dictionary;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
motionModel rotatingAxis; motionModel rotatingAxis;
rotatingAxisInfo // information for rotatingAxisMotion motion model rotatingAxisInfo // information for rotatingAxisMotion motion model
@ -25,7 +26,6 @@ surfaces
/* /*
A cylinder with begin and end radii 0.12 m and axis points at (0 0 0) and (0 0 0.1) A cylinder with begin and end radii 0.12 m and axis points at (0 0 0) and (0 0 0.1)
*/ */
cylinder cylinder
{ {
type cylinderWall; // type of the wall type cylinderWall; // type of the wall
@ -48,7 +48,6 @@ surfaces
/* /*
This is a plane wall at the rear end of cylinder This is a plane wall at the rear end of cylinder
*/ */
wall1 wall1
{ {
type planeWall; // type of the wall type planeWall; // type of the wall
@ -69,7 +68,6 @@ surfaces
/* /*
This is a plane wall at the front end of cylinder This is a plane wall at the front end of cylinder
*/ */
wall2 wall2
{ {
type planeWall; // type of the wall type planeWall; // type of the wall

View File

@ -10,12 +10,9 @@ setFields
{ {
/* /*
Default value for fields defined for particles Default value for fields defined for particles
These fields should always be defined for simulations with These fields should always be defined for simulations with
spherical particles. spherical particles.
*/ */
defaultValue defaultValue
{ {
velocity realx3 (0 0 0); // linear velocity (m/s) velocity realx3 (0 0 0); // linear velocity (m/s)
@ -41,7 +38,7 @@ positionParticles // positions particles
orderedInfo orderedInfo
{ {
diameter 0.004; // minimum space between centers of particles distance 0.004; // minimum distance between particles centers
numPoints 30000; // number of particles in the simulation numPoints 30000; // number of particles in the simulation

View File

@ -6,6 +6,7 @@ objectName settingsDict;
objectType dictionary; objectType dictionary;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
run rotatingDrumSmall; run rotatingDrumSmall;
dt 0.00001; // time step for integration (s) dt 0.00001; // time step for integration (s)
@ -27,6 +28,8 @@ excludeObjects (rVelocity.dy1 pStructPosition.dy1 pStructVelocity.dy1);
integrationMethod AdamsBashforth2; // integration method integrationMethod AdamsBashforth2; // integration method
integrationHistory off;
writeFormat ascii; // data writting format (ascii or binary) writeFormat ascii; // data writting format (ascii or binary)
timersReport Yes; // report timers (Yes or No) timersReport Yes; // report timers (Yes or No)

View File

@ -38,7 +38,7 @@ positionParticles
orderedInfo orderedInfo
{ {
diameter 0.005; // minimum space between centers of particles distance 0.005; // minimum distance between particles centers
numPoints 24000; // number of particles in the simulation numPoints 24000; // number of particles in the simulation