Merge branch 'main' of https://github.com/PhasicFlow/phasicFlow into main
This commit is contained in:
commit
61f48ea654
|
@ -380,10 +380,13 @@ bool pFlow::sphereParticles::insertParticles
|
|||
return false;
|
||||
}
|
||||
|
||||
auto exclusionListAllPtr = getFieldObjectList();
|
||||
|
||||
|
||||
auto exclusionListAllPtr = getFieldObjectList();
|
||||
|
||||
auto newInsertedPtr = pStruct().insertPoints( position, setField, time(), exclusionListAllPtr());
|
||||
|
||||
|
||||
if(!newInsertedPtr)
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
|
|
|
@ -544,18 +544,21 @@ public:
|
|||
resize(maxInd+1);
|
||||
}
|
||||
|
||||
if constexpr (isHostAccessible_)
|
||||
{
|
||||
fillSelected(deviceVectorAll(), indices.hostView(), indices.size(), val);
|
||||
return true;
|
||||
|
||||
}else
|
||||
{
|
||||
fillSelected(deviceVectorAll(), indices.deviceView(), indices.size(), val);
|
||||
return true;
|
||||
}
|
||||
using policy = Kokkos::RangePolicy<
|
||||
execution_space,
|
||||
Kokkos::IndexType<int32> >;
|
||||
auto dVec = deviceVectorAll();
|
||||
auto dIndex = indices.deviceView();
|
||||
|
||||
Kokkos::parallel_for(
|
||||
"insertSetElement",
|
||||
policy(0,indices.size()), LAMBDA_HD(int32 i){
|
||||
dVec(dIndex(i))= val;
|
||||
});
|
||||
Kokkos::fence();
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
INLINE_FUNCTION_H
|
||||
|
@ -597,13 +600,11 @@ public:
|
|||
bool insertSetElement(const int32IndexContainer& indices, const Vector<T>& vals)
|
||||
{
|
||||
|
||||
//Info<<"start of insertSetElement vecotsingle"<<endInfo;
|
||||
if(indices.size() == 0)return true;
|
||||
if(indices.size() != vals.size())return false;
|
||||
|
||||
auto maxInd = indices.max();
|
||||
/*output<<"maxInd "<< maxInd<<endl;
|
||||
output<<"size() "<< size()<<endl;*/
|
||||
|
||||
if(this->empty() || maxInd > size()-1 )
|
||||
{
|
||||
resize(maxInd+1);
|
||||
|
|
|
@ -158,6 +158,7 @@ void* pFlow::setFieldEntry::setPointFieldSelected
|
|||
if( pointField<VectorDual,Type>::TYPENAME() == fieldTypeName )
|
||||
{
|
||||
|
||||
|
||||
auto& field = owner.lookupObject<pointField<VectorDual,Type>>(fName);
|
||||
if(field.insertSetElement(selected, value))
|
||||
return &field;
|
||||
|
|
|
@ -373,17 +373,19 @@ pFlow::uniquePtr<pFlow::int32IndexContainer> pFlow::pointStructure::insertPoints
|
|||
tobeInsertedIndex_ = newPointsPtr();
|
||||
|
||||
// set the position of new points
|
||||
|
||||
|
||||
if(!pointPosition_.insertSetElement(
|
||||
newPointsPtr(),
|
||||
pos)
|
||||
)return nullptr;
|
||||
|
||||
|
||||
if(!pointFlag_.insertSetElement(
|
||||
newPointsPtr(),
|
||||
static_cast<int8>(PointFlag::ACTIVE))
|
||||
)return nullptr;
|
||||
|
||||
|
||||
setNumMaxPoints();
|
||||
auto minInd = newPointsPtr().min();
|
||||
auto maxInd = newPointsPtr().max();
|
||||
|
@ -393,6 +395,7 @@ pFlow::uniquePtr<pFlow::int32IndexContainer> pFlow::pointStructure::insertPoints
|
|||
|
||||
for(auto sfEntry:setField)
|
||||
{
|
||||
|
||||
if(void* fieldPtr =
|
||||
sfEntry.setPointFieldSelectedAll(
|
||||
owner,
|
||||
|
|
|
@ -0,0 +1,186 @@
|
|||
# Problem Definition
|
||||
The problem is to simulate a Rotary Air-Lock Valve with below diminsions:
|
||||
* Size of Cone:
|
||||
* Cone Gate: 29.17 cm
|
||||
* Cone Exit: 10.37 cm
|
||||
* Size of Outer Exit: 9.42 cm
|
||||
* External diameter of Circle: 20.74 cm
|
||||
There is one type of particle in this blender. Particles are poured into the inlet valve from t=**0** s.
|
||||
* **28000** particles with **5 mm** diameter poured into the valve with rate of **4000 particles/s**.
|
||||
|
||||
<html>
|
||||
<body>
|
||||
<div align="center"><b>
|
||||
a view of the Rotary Air-Lock Valve while rotating
|
||||
</div></b>
|
||||
<div align="center">
|
||||
<img src="sample sample sample sample", width=700px>
|
||||
</div>
|
||||
<div align="center"><i>
|
||||
particles are colored according to their id
|
||||
</div></i>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
# Setting up the Case
|
||||
As it has been explained in the previous cases, the simulation case setup is based on text-based scripts. Here, the simulation case setup files are stored into three folders: `caseSetup`, `setting`, `stl` (see the above folders). See next the section for more information on how we can setup the geometry and its rotation.
|
||||
## Geometry
|
||||
|
||||
### Defining rotation axis
|
||||
In file `settings/geometryDict` the information of rotating axis and speed of rotation are defined. The rotation of this blender starts at time=**0 s** and ends at time=**7 s**.
|
||||
```C++
|
||||
// information for rotatingAxisMotion motion model
|
||||
rotatingAxisMotionInfo
|
||||
{
|
||||
rotAxis
|
||||
{
|
||||
|
||||
// first point for the axis of rotation
|
||||
p1 (0.561547 0.372714 0.000);
|
||||
|
||||
// second point for the axis of rotation
|
||||
p2 (0.561547 0.372714 0.010);
|
||||
|
||||
// rotation speed (rad/s)
|
||||
omega 2.1;
|
||||
|
||||
// Start time of Geometry Rotating (s)
|
||||
startTime 1.25;
|
||||
|
||||
// End time of Geometry Rotating (s)
|
||||
endTime 7;
|
||||
}
|
||||
}
|
||||
```
|
||||
### Surfaces
|
||||
In `settings/geometryDict` file, the surfaces component are defined to form a Rotating Air-Lock Valve.
|
||||
```C++
|
||||
surfaces
|
||||
{
|
||||
gear
|
||||
{
|
||||
// type of the wall
|
||||
type stlWall;
|
||||
|
||||
// file name in stl folder
|
||||
file gear.stl;
|
||||
|
||||
// material name of this wall
|
||||
material wallMat;
|
||||
|
||||
// motion component name
|
||||
motion rotAxis;
|
||||
}
|
||||
surfaces
|
||||
{
|
||||
// type of the wall
|
||||
type stlWall;
|
||||
|
||||
// file name in stl folder
|
||||
file surfaces.stl;
|
||||
|
||||
// material name of this wall
|
||||
material wallMat;
|
||||
|
||||
// motion component name
|
||||
motion none;
|
||||
}
|
||||
```
|
||||
## Defining particles
|
||||
### Diameter and material of spheres
|
||||
In the `caseSetup/sphereShape` the diameter and the material name of the particles are defined.
|
||||
|
||||
<div align="center">
|
||||
in <b>caseSetup/sphereShape</b> file
|
||||
</div>
|
||||
|
||||
```C++
|
||||
// names of shapes
|
||||
names (sphere);
|
||||
|
||||
// diameter of shapes
|
||||
diameters (0.005);
|
||||
|
||||
// material names for shapes
|
||||
materials (sphereMat);
|
||||
```
|
||||
### Particle positioning before start of simulation
|
||||
|
||||
<div align="center">
|
||||
in <b>settings/particlesDict</b> file
|
||||
</div>
|
||||
|
||||
```C++
|
||||
// positions particles
|
||||
positionParticles
|
||||
{
|
||||
|
||||
// creates the required fields with zero particles (empty).
|
||||
method empty;
|
||||
|
||||
// maximum number of particles in the simulation
|
||||
maxNumberOfParticles 50000;
|
||||
|
||||
// perform initial sorting based on morton code?
|
||||
mortonSorting Yes;
|
||||
}
|
||||
```
|
||||
|
||||
## Interaction between particles
|
||||
In `caseSetup/interaction` file, material names and properties and interaction parameters are defined. Since we are defining 1 material type in the simulation, the interaction matrix is 2x2 (interactions are symmetric).
|
||||
```C++
|
||||
// a list of materials names
|
||||
materials (sphereMat wallMat);
|
||||
|
||||
// density of materials [kg/m3]
|
||||
densities (1000 2500);
|
||||
|
||||
contactListType sortedContactList;
|
||||
|
||||
model
|
||||
{
|
||||
contactForceModel nonLinearNonLimited;
|
||||
|
||||
rollingFrictionModel normal;
|
||||
|
||||
/*
|
||||
Property (sphereMat-sphereMat sphereMat-wallMat
|
||||
wallMat-wallMat);
|
||||
*/
|
||||
|
||||
// Young modulus [Pa]
|
||||
Yeff (1.0e6 1.0e6
|
||||
1.0e6);
|
||||
|
||||
// Shear modulus [Pa]
|
||||
Geff (0.8e6 0.8e6
|
||||
0.8e6);
|
||||
|
||||
// Poisson's ratio [-]
|
||||
nu (0.25 0.25
|
||||
0.25);
|
||||
|
||||
// coefficient of normal restitution
|
||||
en (0.7 0.8
|
||||
1.0);
|
||||
|
||||
// coefficient of tangential restitution
|
||||
et (1.0 1.0
|
||||
1.0);
|
||||
|
||||
// dynamic friction
|
||||
mu (0.3 0.35
|
||||
0.35);
|
||||
|
||||
// rolling friction
|
||||
mur (0.1 0.1
|
||||
0.1);
|
||||
}
|
||||
```
|
||||
# Performing Simulation and previewing the results
|
||||
To perform simulations, enter the following commands one after another in the terminal.
|
||||
|
||||
Enter `$ particlesPhasicFlow` command to create the initial fields for particles.
|
||||
Enter `$ geometryPhasicFlow` command to create the geometry.
|
||||
At last, enter `$ sphereGranFlow` command to start the simulation.
|
||||
After finishing the simulation, you can use `$ pFlowtoVTK` to convert the results into vtk format stored in ./VTK folder.
|
|
@ -0,0 +1,83 @@
|
|||
/* -------------------------------*- C++ -*--------------------------------- *\
|
||||
| phasicFlow File |
|
||||
| copyright: www.cemf.ir |
|
||||
\* ------------------------------------------------------------------------- */
|
||||
objectName interaction;
|
||||
objectType dicrionary;
|
||||
fileFormat ASCII;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
// a list of materials names
|
||||
materials (sphereMat wallMat);
|
||||
|
||||
// density of materials [kg/m3]
|
||||
densities (1000 2500);
|
||||
|
||||
contactListType sortedContactList;
|
||||
|
||||
model
|
||||
{
|
||||
contactForceModel nonLinearNonLimited;
|
||||
|
||||
rollingFrictionModel normal;
|
||||
|
||||
/*
|
||||
Property (sphereMat-sphereMat sphereMat-wallMat
|
||||
wallMat-wallMat);
|
||||
*/
|
||||
|
||||
// Young modulus [Pa]
|
||||
Yeff (1.0e6 1.0e6
|
||||
1.0e6);
|
||||
|
||||
// Shear modulus [Pa]
|
||||
Geff (0.8e6 0.8e6
|
||||
0.8e6);
|
||||
|
||||
// Poisson's ratio [-]
|
||||
nu (0.25 0.25
|
||||
0.25);
|
||||
|
||||
// coefficient of normal restitution
|
||||
en (0.7 0.8
|
||||
1.0);
|
||||
|
||||
// coefficient of tangential restitution
|
||||
et (1.0 1.0
|
||||
1.0);
|
||||
|
||||
// dynamic friction
|
||||
mu (0.3 0.35
|
||||
0.35);
|
||||
|
||||
// rolling friction
|
||||
mur (0.1 0.1
|
||||
0.1);
|
||||
}
|
||||
|
||||
contactSearch
|
||||
{
|
||||
// method for broad search particle-particle
|
||||
method NBS;
|
||||
|
||||
// method for broad search particle-wall
|
||||
wallMapping cellMapping;
|
||||
|
||||
NBSInfo
|
||||
{
|
||||
// each 10 timesteps, update neighbor list
|
||||
updateFrequency 10;
|
||||
|
||||
// bounding box size to particle diameter (max)
|
||||
sizeRatio 1.1;
|
||||
}
|
||||
|
||||
cellMappingInfo
|
||||
{
|
||||
// each 20 timesteps, update neighbor list
|
||||
updateFrequency 10;
|
||||
|
||||
// bounding box for particle-wall search (> 0.5)
|
||||
cellExtent 0.6;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/* -------------------------------*- C++ -*--------------------------------- *\
|
||||
| phasicFlow File |
|
||||
| copyright: www.cemf.ir |
|
||||
\* ------------------------------------------------------------------------- */
|
||||
objectName particleInsertion;
|
||||
objectType dicrionary;
|
||||
fileFormat ASCII;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
// is insertion active?
|
||||
active yes;
|
||||
|
||||
// not implemented for yes
|
||||
collisionCheck No;
|
||||
|
||||
/*
|
||||
one layer of particles is added using an insertion step.
|
||||
*/
|
||||
//Insertion Layer
|
||||
layer0
|
||||
{
|
||||
|
||||
// type of insertion region
|
||||
type boxRegion;
|
||||
|
||||
// insertion rate (particles/s)
|
||||
rate 4000;
|
||||
|
||||
// Start time of Particles insertion (s)
|
||||
startTime 0;
|
||||
|
||||
// End time of Particles insertion (s)
|
||||
endTime 7;
|
||||
|
||||
// Time Interval of Particles insertion (s)
|
||||
interval 0.025;
|
||||
|
||||
// Coordinates of BoxRegion (m,m,m)
|
||||
boxRegionInfo
|
||||
{
|
||||
min ( 0.48 0.58 0.01 ); // (m,m,m)
|
||||
max ( 0.64 0.59 0.05 ); // (m,m,m)
|
||||
}
|
||||
|
||||
setFields
|
||||
{
|
||||
// initial velocity of inserted particles
|
||||
velocity realx3 (0.0 -0.6 0.0);
|
||||
}
|
||||
|
||||
mixture
|
||||
{
|
||||
sphere 1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
/* -------------------------------*- C++ -*--------------------------------- *\
|
||||
| phasicFlow File |
|
||||
| copyright: www.cemf.ir |
|
||||
\* ------------------------------------------------------------------------- */
|
||||
objectName particleInsertion;
|
||||
objectType dicrionary;
|
||||
fileFormat ASCII;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
objectName sphereDict;
|
||||
objectType sphereShape;
|
||||
|
||||
// names of shapes
|
||||
names (sphere);
|
||||
|
||||
// diameter of shapes
|
||||
diameters (0.005);
|
||||
|
||||
// material names for shapes
|
||||
materials (sphereMat);
|
|
@ -0,0 +1,66 @@
|
|||
/* -------------------------------*- C++ -*--------------------------------- *\
|
||||
| phasicFlow File |
|
||||
| copyright: www.cemf.ir |
|
||||
\* ------------------------------------------------------------------------- */
|
||||
objectName geometryDict;
|
||||
objectType dictionary;
|
||||
fileFormat ASCII;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
// motion model: rotating object around an axis
|
||||
motionModel rotatingAxisMotion;
|
||||
|
||||
// information for rotatingAxisMotion motion model
|
||||
rotatingAxisMotionInfo
|
||||
{
|
||||
rotAxis
|
||||
{
|
||||
|
||||
// first point for the axis of rotation
|
||||
p1 (0.561547 0.372714 0.000);
|
||||
|
||||
// second point for the axis of rotation
|
||||
p2 (0.561547 0.372714 0.010);
|
||||
|
||||
// rotation speed (rad/s)
|
||||
omega 2.1;
|
||||
|
||||
// Start time of Geometry Rotating (s)
|
||||
startTime 1.25;
|
||||
|
||||
// End time of Geometry Rotating (s)
|
||||
endTime 7;
|
||||
}
|
||||
}
|
||||
|
||||
surfaces
|
||||
{
|
||||
gear
|
||||
{
|
||||
// type of the wall
|
||||
type stlWall;
|
||||
|
||||
// file name in stl folder
|
||||
file gear.stl;
|
||||
|
||||
// material name of this wall
|
||||
material wallMat;
|
||||
|
||||
// motion component name
|
||||
motion rotAxis;
|
||||
}
|
||||
surfaces
|
||||
{
|
||||
// type of the wall
|
||||
type stlWall;
|
||||
|
||||
// file name in stl folder
|
||||
file surfaces.stl;
|
||||
|
||||
// material name of this wall
|
||||
material wallMat;
|
||||
|
||||
// motion component name
|
||||
motion none;
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
/* -------------------------------*- C++ -*--------------------------------- *\
|
||||
| phasicFlow File |
|
||||
| copyright: www.cemf.ir |
|
||||
\* ------------------------------------------------------------------------- */
|
||||
objectName geometryDict;
|
||||
objectType dictionary;
|
||||
fileFormat ASCII;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
setFields
|
||||
{
|
||||
defaultValue
|
||||
{
|
||||
// linear velocity (m/s)
|
||||
velocity realx3 (0 0 0);
|
||||
|
||||
// linear acceleration (m/s2)
|
||||
acceleration realx3 (0 0 0);
|
||||
|
||||
// rotational velocity (rad/s)
|
||||
rotVelocity realx3 (0 0 0);
|
||||
|
||||
// name of the particle shape
|
||||
shapeName word sphere;
|
||||
}
|
||||
|
||||
selectors
|
||||
{}
|
||||
}
|
||||
|
||||
// positions particles
|
||||
positionParticles
|
||||
{
|
||||
|
||||
// creates the required fields with zero particles (empty).
|
||||
method empty;
|
||||
|
||||
// maximum number of particles in the simulation
|
||||
maxNumberOfParticles 50000;
|
||||
|
||||
// perform initial sorting based on morton code?
|
||||
mortonSorting Yes;
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
/* -------------------------------*- C++ -*--------------------------------- *\
|
||||
| phasicFlow File |
|
||||
| copyright: www.cemf.ir |
|
||||
\* ------------------------------------------------------------------------- */
|
||||
objectName geometryDict;
|
||||
objectType dictionary;
|
||||
fileFormat ASCII;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
run rotatingValve;
|
||||
|
||||
// time step for integration (s)
|
||||
dt 0.00001;
|
||||
|
||||
// start time for simulation
|
||||
startTime 0;
|
||||
|
||||
// end time for simulation
|
||||
endTime 7;
|
||||
|
||||
// time interval for saving the simulation
|
||||
saveInterval 0.05;
|
||||
|
||||
// maximum number of digits for time folder
|
||||
timePrecision 6;
|
||||
|
||||
// gravity vector (m/s2)
|
||||
g (0 -9.8 0);
|
||||
|
||||
/*
|
||||
Simulation domain every particles that goes outside this domain is deleted.
|
||||
*/
|
||||
|
||||
domain
|
||||
{
|
||||
min (0.397538 0.178212 0.00);
|
||||
max (0.725537 0.600214 0.06);
|
||||
}
|
||||
|
||||
// integration method
|
||||
integrationMethod AdamsBashforth3;
|
||||
|
||||
// report timers?
|
||||
timersReport Yes;
|
||||
|
||||
// time interval for reporting timers
|
||||
timersReportInterval 0.01;
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue