32 Commits

Author SHA1 Message Date
c32789f34d Update ReadMe.md 2025-03-02 16:27:00 +03:30
09c303a61e Update interaction 2025-03-02 16:21:51 +03:30
0820e003fc Update particleInsertion 2025-03-02 16:20:56 +03:30
c4c6c2fc45 Update settingsDict 2025-03-02 16:04:20 +03:30
d5dd7af06e Update particlesDict 2025-03-02 16:02:04 +03:30
b03d4825ff Update ReadMe.md 2025-03-02 15:50:04 +03:30
67df8ad206 Merge pull request #181 from ramin1728/RotaryAirLockValve
Rotary air lock valve
2025-03-02 15:47:23 +03:30
2df8133c2d RotaryAirLockValve is Updated. 2025-03-02 12:56:59 +03:30
HRN
dc0504d2fa Merge branch 'main' of github.com:PhasicFlow/phasicFlow into main 2025-02-28 11:37:11 +03:30
HRN
27dfdfa599 stationary motion now does not require the dictionary 2025-02-28 11:36:53 +03:30
8b9a9acd0c RotaryAirLockValve is Updated. 2025-02-27 20:53:20 +03:30
c87c9716ef Update README.md 2025-02-27 20:28:21 +03:30
0ed5b2337c Merge pull request #178 from wanqing0421/main - rotartyDrumSmall
update rotatingDrumSmall tutorial
2025-02-27 20:20:44 +03:30
282d9733fc correctiont for rotatingDrumSmall 2025-02-28 00:43:03 +08:00
cfd188587c revise the readme and domainDict 2025-02-27 23:18:01 +08:00
e8e1081345 update rotatingDrumSmall tutorial 2025-02-26 23:31:52 +08:00
HRN
099e85cfb1 Vector now only accepts one type of allocator, the default allocator 2025-02-26 12:19:36 +03:30
HRN
1cbeb1c963 drum-PeriodictBoundary tutorial added 2025-02-25 22:37:19 +03:30
HRN
a33ec7d8e0 corrections for readMe.md v-1.0 2025-02-24 15:09:38 +03:30
HRN
05ecf37eee box now checks for min and max point consistency 2025-02-24 14:40:29 +03:30
HRN
b44c4de3f6 reading particle position from file for partilclesPhasicFlow 2025-02-24 13:55:56 +03:30
05b256ba39 Merge pull request #170 from wanqing0421/main
New rapid filling implement
2025-02-24 12:34:05 +03:30
25b2e37d93 Merge pull request #175 from ramin1728/banarySystemOfParticles
binarySystemOfParticles is Updated.
2025-02-24 12:33:33 +03:30
a2561f0f12 Merge branch 'PhasicFlow:main' into main 2025-02-23 20:40:36 +08:00
89896c0d69 binarySystemOfParticles is Updated. 2025-02-23 15:59:37 +03:30
4552d90eac Merge branch 'PhasicFlow:main' into main 2025-02-21 21:58:50 +08:00
ef1fa1ddaf Merge branch 'PhasicFlow:main' into main 2025-02-18 19:36:21 +08:00
d5b9ca4c43 remove rapid filling tutorial 2025-02-16 13:08:09 +08:00
9ccc487a51 Merge branch 'PhasicFlow:main' into main 2025-02-16 12:38:31 +08:00
ae251598a4 update rapid filling 2025-02-16 12:31:11 +08:00
29d922e3c5 A simple rapid filling demo 2025-02-10 23:12:42 +08:00
3aa6be6676 A simple rapid filling 2025-02-10 23:11:33 +08:00
49 changed files with 1069 additions and 1897 deletions

View File

@ -29,7 +29,7 @@ pFlow::stationaryWall::stationaryWall
: :
fileDictionary(objf, owner) fileDictionary(objf, owner)
{ {
const auto& dummy = this->subDictOrCreate("stationaryInfo");
if(!impl_readDictionary(*this) ) if(!impl_readDictionary(*this) )
{ {
fatalErrorInFunction; fatalErrorInFunction;
@ -46,6 +46,8 @@ pFlow::stationaryWall::stationaryWall
: :
fileDictionary(objf, dict, owner) fileDictionary(objf, dict, owner)
{ {
const auto& dummy = this->subDictOrCreate("stationaryInfo");
if(!impl_readDictionary(*this) ) if(!impl_readDictionary(*this) )
{ {
fatalErrorInFunction; fatalErrorInFunction;

View File

@ -1,51 +0,0 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
template<typename T, typename... properties>
void
insertSetElementH(
ViewType1D<T, properties...>& view,
hostViewType1D<label>& selected,
T val
);
template<typename T, typename... properties>
void
insertSetElementH(
ViewType1D<T, properties...>& view,
hostViewType1D<label>& selected,
hostViewType1D<T>& vals
);
template<typename T, typename... properties>
void
insertSetElementD(
ViewType1D<T, properties...>& view,
deviceViewType1D<label>& selected,
T val
);
template<typename T, typename... properties>
void
insertSetElementD(
ViewType1D<T, properties...>& view,
deviceViewType1D<label>& selected,
deviceViewType1D<T>& vals
);

View File

@ -1,229 +0,0 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __baseAlgorithms_hpp__
#define __baseAlgorithms_hpp__
#include "KokkosUtilities.hpp"
#include "numericConstants.hpp"
inline const size_t sizeToSerial__ = 64;
namespace pFlow
{
// counts the number of elements that matches val
// the execution space is selected based on the View::execution_spcae
/*template<typename T, typename... properties>
INLINE_FUNCTION_H
size_t count(
const ViewType1D<T, properties...>& view,
size_t start,
size_t end,
const T& val
)
{
auto RP = Kokkos::RangePolicy<
Kokkos::IndexType<size_t>,
typename ViewType1D<T, properties...>::execution_space >(start, end);
size_t totalNum=0;
Kokkos::parallel_reduce(
"baseAlgorithms-count",
RP,
LAMBDA_HD(label i, size_t & valueToUpdate){
if( equal(view[i], val) ) valueToUpdate += 1;
}, totalNum );
return totalNum;
}*/
template<typename T, typename... properties>
INLINE_FUNCTION_H T
min(const ViewType1D<T, properties...>& view, size_t start, size_t end)
{
T minValue = largestPositive<T>();
auto RP = Kokkos::RangePolicy<
Kokkos::IndexType<size_t>,
typename ViewType1D<T, properties...>::execution_space>(start, end);
Kokkos::parallel_reduce(
"baseAlgorithms-min",
RP,
LAMBDA_HD(label i, T & valueToUpdate) {
valueToUpdate = min(view[i], valueToUpdate);
},
Kokkos ::Min<T>(minValue)
);
return minValue;
}
template<typename T, typename... properties>
INLINE_FUNCTION_H T
max(const ViewType1D<T, properties...>& view, size_t start, size_t end)
{
T maxValue = largestNegative<T>();
auto RP = Kokkos::RangePolicy<
Kokkos::IndexType<size_t>,
typename ViewType1D<T, properties...>::execution_space>(start, end);
Kokkos::parallel_reduce(
"baseAlgorithms-max",
RP,
LAMBDA_HD(label i, T & valueToUpdate) {
valueToUpdate = max(view[i], valueToUpdate);
},
Kokkos::Max<T>(maxValue)
);
return maxValue;
}
template<typename T, typename... properties>
INLINE_FUNCTION_H T
min_serial(const ViewType1D<T, properties...>& view, size_t start, size_t end)
{
T minValue = largestPositive<T>();
for (label i = start; i < end; ++i)
{
minValue = min(minValue, view[i]);
}
return minValue;
}
template<typename T, typename... properties>
INLINE_FUNCTION_H T
max_serial(const ViewType1D<T, properties...>& view, size_t start, size_t end)
{
T maxValue = largestNegative<T>();
for (label i = start; i < end; ++i)
{
maxValue = max(maxValue, view[i]);
}
return maxValue;
}
template<typename UnaryFunction, typename T, typename... properties>
void
apply_to_each(
const ViewType1D<T, properties...>& view,
size_t start,
size_t end,
UnaryFunction func
)
{
auto RP = Kokkos::RangePolicy<
Kokkos::IndexType<size_t>,
typename ViewType1D<T, properties...>::execution_space>(start, end);
Kokkos::parallel_for(
"baseAlgorithms-for_each", RP, LAMBDA_HD(label i) { view[i] = func(i); }
);
}
template<typename T, typename... properties>
void
insertSetElementH(
ViewType1D<T, properties...>& view,
hostViewType1D<label>& selected,
T val
)
{
for (auto i = 0; i < selected.size(); ++i)
{
view[selected[i]] = val;
}
}
template<typename T, typename... properties>
void
insertSetElementH(
ViewType1D<T, properties...>& view,
hostViewType1D<label>& selected,
hostViewType1D<T>& vals
)
{
for (auto i = 0; i < selected.size(); ++i)
{
view[selected[i]] = static_cast<const T&>(vals[i]);
}
}
template<typename T, typename... properties>
void
insertSetElementD(
ViewType1D<T, properties...>& view,
deviceViewType1D<label>& selected,
T val
)
{
auto RP = Kokkos::RangePolicy<
Kokkos::IndexType<size_t>,
typename ViewType1D<T, properties...>::execution_space>(
0, selected.size()
);
Kokkos::parallel_for(
"baseAlgorithms-insertSetElementD",
RP,
LAMBDA_D(size_t i) { view[selected[i]] = val; }
);
}
template<typename T, typename... properties>
void
insertSetElementD(
ViewType1D<T, properties...>& view,
deviceViewType1D<label>& selected,
deviceViewType1D<T>& vals
)
{
auto RP = Kokkos::RangePolicy<
Kokkos::IndexType<size_t>,
typename ViewType1D<T, properties...>::execution_space>(
0, selected.size()
);
Kokkos::parallel_for(
"baseAlgorithms-insertSetElementD",
RP,
LAMBDA_D(size_t i) { view[selected[i]] = vals[i]; }
);
}
template<typename T, typename... properties>
void
fill(
ViewType3D<T, properties...>& view,
range range1,
range range2,
range range3,
T val
)
{
auto subV = Kokkos::subview(view, range1, range2, range3);
Kokkos::deep_copy(subV, val);
}
}
#endif // __VectorSingleMath_hpp__

View File

@ -52,7 +52,7 @@ class Vector;
template<typename T, typename Allocator = vecAllocator<T> > template<typename T, typename Allocator = std::allocator<T> >
class Vector class Vector
: :
public std::vector<T, Allocator> public std::vector<T, Allocator>

View File

@ -35,19 +35,6 @@ namespace pFlow
{ {
template <class T>
class noConstructAllocator
: public std::allocator<T>
{
public:
using std::allocator<T>::allocator;
template <class U, class... Args> void construct(U*, Args&&...) {}
};
template<typename T>
using vecAllocator = std::allocator<T>;
template<typename T> template<typename T>
inline inline
span<T> makeSpan(std::vector<T>& container) span<T> makeSpan(std::vector<T>& container)

File diff suppressed because it is too large Load Diff

View File

@ -1,113 +0,0 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __VectorDualMath_hpp__
#define __VectorDualMath_hpp__
#include "baseAlgorithms.hpp"
namespace pFlow
{
// - select the side (HostSide or DeviceSide)
template<typename side, typename T, typename MemorySpace>
INLINE_FUNCTION_H
int64 count(const VectorDual<T,MemorySpace>& vec, const T& val)
{
if constexpr (std::is_same<side,HostSide>::value)
{
return count( vec.hostViewAll(), static_cast<size_t>(0), vec.size(), val);
}
else
{
return count( vec.deviceViewAll(), static_cast<size_t>(0), vec.size(), val);
}
return -1;
}
// default to device side
template<typename T, typename MemorySpace>
INLINE_FUNCTION_H
int64 count(const VectorDual<T,MemorySpace>& vec, const T& val)
{
return count<DeviceSide>( vec, val);
}
template<typename side, typename T, typename MemorySpace>
INLINE_FUNCTION_H
int64 min(const VectorDual<T,MemorySpace>& vec)
{
if constexpr (std::is_same<side,HostSide>::value)
{
return min( vec.hostViewAll(), static_cast<size_t>(0), vec.size());
}
else
{
return min( vec.deviceViewAll(), static_cast<size_t>(0), vec.size());
}
return 0.0;
}
// default to device side
template<typename T, typename MemorySpace>
INLINE_FUNCTION_H
int64 min(const VectorDual<T,MemorySpace>& vec)
{
return min<DeviceSide>( vec);
}
template<typename side, typename T, typename MemorySpace>
INLINE_FUNCTION_H
int64 max(const VectorDual<T,MemorySpace>& vec)
{
if constexpr (std::is_same<side,HostSide>::value)
{
return max( vec.hostViewAll(), static_cast<size_t>(0), vec.size());
}
else
{
return max( vec.deviceViewAll(), static_cast<size_t>(0), vec.size());
}
return 0.0;
}
// default to device side
template<typename T, typename MemorySpace>
INLINE_FUNCTION_H
int64 max(const VectorDual<T,MemorySpace>& vec)
{
return max<DeviceSide>( vec);
}
} // pFlow
#endif // __VectorSingleMath_hpp__

View File

@ -1,52 +0,0 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __VectorDuals_hpp__
#define __VectorDuals_hpp__
#include "types.hpp"
#include "VectorDual.hpp"
namespace pFlow
{
using int8Vector_HD = VectorDual<int8>;
using int16Vector_HD = VectorDual<int16>;
using int32Vector_HD = VectorDual<int32>;
using int64Vector_HD = VectorDual<int64>;
using uint32Vector_HD = VectorDual<uint32>;
using labelVector_HD = VectorDual<label>;
using realVector_HD = VectorDual<real>;
using realx3Vector_HD = VectorDual<realx3>;
using realx3x3Vector_HD = VectorDual<realx3x3>;
}
#endif

View File

@ -69,7 +69,7 @@ pFlow::ioErrorMessage(
) )
{ {
errorStream << "\n>>> Fatal IO file error\n" errorStream << "\n>>> Fatal IO file error\n"
<< " IO error at number " << Red_Text(fileLineNumber) << " IO error at number " << Red_Text(fileLineNumber+1)
<< " of file " << Red_Text(fileName) << '\n'; << " of file " << Red_Text(fileName) << '\n';
errorStream << " IO operation is peformed from function " errorStream << " IO operation is peformed from function "
<< Red_Text(fnName) << " in file " << Red_Text(fName) << Red_Text(fnName) << " in file " << Red_Text(fName)

View File

@ -356,7 +356,7 @@ public:
/// Token is WORD, DIRECTIVE, STRING, VARIABLE or VERBATIM /// Token is WORD, DIRECTIVE, STRING, VARIABLE or VERBATIM
inline bool isStringType() const; inline bool isStringType() const;
inline bool isComma()const;
//- Access //- Access
/// Return boolean token value. /// Return boolean token value.

View File

@ -673,6 +673,13 @@ inline bool pFlow::token::isStringType() const
return (isWord() || isString()); return (isWord() || isString());
} }
inline bool pFlow::token::isComma()const
{
if( type_ == tokenType::PUNCTUATION &&
pToken() == punctuationToken::COMMA) return true;
return false;
}
inline void pFlow::token::setBad() inline void pFlow::token::setBad()
{ {
reset(); reset();

View File

@ -36,7 +36,15 @@ pFlow::box::box
( (
dict.getVal<realx3>("max") dict.getVal<realx3>("max")
) )
{} {
if( !(min_ < max_))
{
fatalErrorInFunction<<
"the corenter points of box are not set correctly"<<
" (min point is greater than max point). In dictionary "<< dict.globalName()<<endl;
fatalExit;
}
}
FUNCTION_H FUNCTION_H
pFlow::box::box pFlow::box::box
@ -58,6 +66,13 @@ bool pFlow::box::read(iIstream & is)
{ {
if(!is.nextData<realx3>("min", min_)) return false; if(!is.nextData<realx3>("min", min_)) return false;
if(!is.nextData<realx3>("max", max_)) return false; if(!is.nextData<realx3>("max", max_)) return false;
if(!(min_ < max_))
{
ioErrorInFile(is.name(), is.lineNumber())<<
"the corenter points of box are not set correctly"<<
" (min point is greater than max point). In dictionary "<<endl;
return false;
}
return true; return true;
} }

View File

@ -31,14 +31,14 @@ namespace pFlow
class box class box
{ {
protected: private:
// - min point // - min point
realx3 min_{0,0,0}; realx3 min_{0,0,0};
// - max point // - max point
realx3 max_{1,1,1}; realx3 max_{1,1,1};
public: public:
// - type info // - type info

View File

@ -1,4 +1,4 @@
# Problem Definition # Problem Definition (v-1.0)
The problem is to simulate a Rotary Air-Lock Valve. The external diameter of rotor is about 21 cm. There is one type of particle in this simulation. Particles are inserted into the inlet of the valve from t=**0** s. The problem is to simulate a Rotary Air-Lock Valve. The external diameter of rotor is about 21 cm. There is one type of particle in this simulation. Particles are inserted into the inlet of the valve from t=**0** s.
* **28000** particles with **5 mm** diameter are inserted into the valve with the rate of **4000 particles/s**. * **28000** particles with **5 mm** diameter are inserted into the valve with the rate of **4000 particles/s**.
* The rotor starts its rotation at t = 1.25 s at the rate of 2.1 rad/s. * The rotor starts its rotation at t = 1.25 s at the rate of 2.1 rad/s.
@ -83,14 +83,15 @@ surfaces
// motion component name // motion component name
motion none; motion none;
}
} }
``` ```
## Defining particles ## Defining particles
### Diameter and material of spheres ### Diameter and material of spheres
In the `caseSetup/sphereShape` the diameter and the material name of the particles are defined. In the `caseSetup/shapes` the diameter and the material name of the particles are defined.
<div align="center"> <div align="center">
in <b>caseSetup/sphereShape</b> file in <b>caseSetup/shapes</b> file
</div> </div>
```C++ ```C++
@ -182,15 +183,9 @@ model
// Poisson's ratio [-] // Poisson's ratio [-]
nu (0.25 0.25 nu (0.25 0.25
0.25); 0.25);
// coefficient of normal restitution // coefficient of normal restitution
en (0.7 0.8 en (0.7 0.8
1.0); 1.0);
// coefficient of tangential restitution
et (1.0 1.0
1.0);
// dynamic friction // dynamic friction
mu (0.3 0.35 mu (0.3 0.35
0.35); 0.35);
@ -203,7 +198,7 @@ model
# Performing simulation and seeing the results # Performing simulation and seeing the results
To perform simulations, enter the following commands one after another in the terminal. To perform simulations, enter the following commands one after another in the terminal.
Enter `$ particlesPhasicFlow` command to create the initial fields for particles (here the simulaiton has no particle at the beginning). Enter `particlesPhasicFlow` command to create the initial fields for particles (here the simulaiton has no particle at the beginning).
Enter `$ geometryPhasicFlow` command to create the geometry. Enter `geometryPhasicFlow` command to create the geometry.
At last, enter `$ sphereGranFlow` command to start the simulation. 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. After finishing the simulation, you can use `pFlowtoVTK` to convert the results into vtk format stored in ./VTK folder.

View File

@ -6,34 +6,33 @@ objectName interaction;
objectType dicrionary; objectType dicrionary;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
materials (sphereMat wallMat); // a list of materials names materials (sphereMat wallMat); // a list of materials names
densities (1000 2500); // density of materials [kg/m3] densities (1000 2500); // density of materials [kg/m3]
contactListType sortedContactList; contactListType sortedContactList;
contactSearch contactSearch
{ {
method NBS; // method for broad search method NBS; // method for broad search
updateInterval 10; updateInterval 10;
sizeRatio 1.1; sizeRatio 1.1;
cellExtent 0.55; cellExtent 0.55;
adjustableBox Yes; adjustableBox Yes;
} }
model model
{ {
contactForceModel nonLinearNonLimited; contactForceModel nonLinearNonLimited;
rollingFrictionModel normal; rollingFrictionModel normal;
/* /*
Property (sphereMat-sphereMat sphereMat-wallMat Property (sphereMat-sphereMat sphereMat-wallMat
wallMat-wallMat); wallMat-wallMat);
*/ */
@ -43,19 +42,16 @@ model
Geff (0.8e6 0.8e6 // Shear modulus [Pa] Geff (0.8e6 0.8e6 // Shear modulus [Pa]
0.8e6); 0.8e6);
nu (0.25 0.25 // Poisson's ratio [-] nu (0.25 0.25 // Poisson's ratio [-]
0.25); 0.25);
en (0.70 0.80 // coefficient of normal restitution en (0.70 0.80 // coefficient of normal restitution
1.0); 1.0);
et (1.0 1.0 // coefficient of tangential restitution mu (0.3 0.35 // dynamic friction
1.0); 0.35);
mu (0.3 0.35 // dynamic friction mur (0.1 0.1 // rolling friction
0.35); 0.1);
mur (0.1 0.1 // rolling friction
0.1);
} }

View File

@ -6,42 +6,36 @@ objectName particleInsertion;
objectType dicrionary; objectType dicrionary;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
active yes; // is insertion active -> yes or no
checkForCollision No; // is checked -> yes or no active yes; // is insertion active -> yes or no
/*
one region is considered for inserting particles.
*/
topRegion topRegion
{ {
regionType box; // type of insertion region regionType box; // type of insertion region
timeControl simulationTime; timeControl simulationTime;
rate 4000; // insertion rate (particles/s) rate 4000; // insertion rate (particles/s)
startTime 0; // Start time of Particles insertion (s) startTime 0; // Start time of Particles insertion (s)
endTime 7; // End time of Particles insertion (s) endTime 7; // End time of Particles insertion (s)
insertionInterval 0.025; // Time Interval between each insertion (s) insertionInterval 0.025; // Time Interval between each insertion (s)
boxInfo // Coordinates of BoxRegion (m,m,m) boxInfo
{ {
min ( 0.48 0.58 0.01 ); // (m,m,m) min ( 0.48 0.58 0.01 ); // (m,m,m)
max ( 0.64 0.59 0.05 ); // (m,m,m)
}
max ( 0.64 0.59 0.05 ); // (m,m,m) setFields
} {
velocity realx3 (0.0 -0.6 0.0); // initial velocity of inserted particles
}
setFields mixture
{ {
velocity realx3 (0.0 -0.6 0.0); // initial velocity of inserted particles sphere 1;
} }
mixture
{
sphere 1;
}
} }

View File

@ -6,8 +6,8 @@ objectName particleInsertion;
objectType dicrionary; objectType dicrionary;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
names (sphere); // names of shapes names (sphere); // names of shapes
diameters (0.005); // diameter of shapes diameters (0.005); // diameter of shapes
materials (sphereMat); // material names for shapes materials (sphereMat); // material names for shapes

View File

@ -8,30 +8,13 @@ fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
globalBox // Simulation domain: every particles that goes outside this domain will be deleted globalBox // Simulation domain: every particles that goes outside this domain will be deleted
{ {
min (0.397538 0.178212 0.00); min (0.397538 0.178212 0.00);
max (0.725537 0.600214 0.06); max (0.725537 0.600214 0.06);
}
decomposition
{
direction z;
} }
boundaries boundaries
{ {
neighborListUpdateInterval 50; /* Determines how often (how many iterations) do you want to
rebuild the list of particles in the neighbor list
of all boundaries in the simulation domain */
updateInterval 10; // Determines how often do you want to update the new changes in the boundary
neighborLength 0.004; // The distance from the boundary plane within which particles are marked to be in the boundary list
left left
{ {
type exit; // other options: periodict, reflective type exit; // other options: periodict, reflective

View File

@ -6,21 +6,21 @@ 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
rotatingAxisInfo // information for rotatingAxisMotion motion model rotatingAxisInfo // information for rotatingAxisMotion motion model
{ {
rotAxis rotAxis
{ {
p1 (0.561547 0.372714 0.000); // first point for the axis of rotation p1 (0.561547 0.372714 0.000); // first point for the axis of rotation
p2 (0.561547 0.372714 0.010); // second point for the axis of rotation p2 (0.561547 0.372714 0.010); // second point for the axis of rotation
omega 2.1; // rotation speed (rad/s) omega 2.1; // rotation speed (rad/s)
startTime 1.25; // Start time of Geometry Rotating (s) startTime 1.25; // Start time of Geometry Rotating (s)
endTime 7; // End time of Geometry Rotating (s) endTime 7; // End time of Geometry Rotating (s)
} }
} }
@ -28,24 +28,24 @@ surfaces
{ {
gear gear
{ {
type stlWall; // type of the wall type stlWall; // type of the wall
file gear.stl; // file name in stl folder file gear.stl; // file name in stl folder
material wallMat; // material name of this wall material wallMat; // material name of this wall
motion rotAxis; // motion component name motion rotAxis; // motion component name
} }
surfaces surfaces
{ {
type stlWall; // type of the wall type stlWall; // type of the wall
file surfaces.stl; // file name in stl folder file surfaces.stl; // file name in stl folder
material wallMat; // material name of this wall material wallMat; // material name of this wall
motion none; // motion component name motion none; // motion component name
} }
} }

View File

@ -6,69 +6,21 @@ objectName particlesDict;
objectType dictionary; objectType dictionary;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
setFields setFields
{ {
/* defaultValue
Default value for fields defined for particles: {
velocity realx3 (0 0 0); // linear velocity (m/s)
These fields should always be defined for simulations with spherical particles acceleration realx3 (0 0 0); // linear acceleration (m/s2)
*/ rVelocity realx3 (0 0 0); // rotational velocity (rad/s)
shapeName word sphere; // name of the particle shape
defaultValue }
{ selectors
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 sphere; // name of the particle shape
}
selectors
{
shapeAssigne
{
selector stridedRange; // other options: box, cylinder, sphere, randomPoints
stridedRangeInfo
{
begin 0; // begin index of points
end 50000; // end index of points
stride 3; // stride for selector
}
fieldValue // fields that the selector is applied to
{
shapeName word sphere; // sets shapeName of the selected points to largeSphere
}
}
}
} }
positionParticles // positions particles positionParticles
{ {
method ordered; // other options: random and empty method empty;
orderedInfo
{
diameter 0.005; // diameter of particles
numPoints 50000; // number of particles in the simulation
axisOrder (z x y); // axis order for filling the space with particles
}
regionType cylinder; // other options: box and sphere
cylinderInfo // cylinder information for positioning particles
{
p1 (0.0 0.0 0.003); // begin point of cylinder axis
p2 (0.0 0.0 0.22); // end point of cylinder axis
radius 0.117; // radius of cylinder
}
} }

View File

@ -6,31 +6,31 @@ objectName geometryDict;
objectType dictionary; objectType dictionary;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
run rotatingAirLockValve;
dt 0.00001; // time step for integration (s) run RotaryAirLockValve;
startTime 0; // start time for simulation dt 0.00001; // time step for integration (s)
endTime 7; // end time for simulation startTime 0; // start time for simulation
saveInterval 0.05; // time interval for saving the simulation endTime 7; // end time for simulation
timePrecision 5; // maximum number of digits for time folder saveInterval 0.05; // time interval for saving the simulation
g (0 -9.8 0); // gravity vector (m/s2) timePrecision 5; // maximum number of digits for time folder
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 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 (rVelocity.dy1 pStructPosition.dy1 pStructVelocity.dy1);
integrationMethod AdamsBashforth2; integrationMethod AdamsBashforth2;
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
timersReportInterval 0.1; // time interval for reporting timers
timersReportInterval 0.1; // time interval for reporting timers

View File

@ -1,4 +1,6 @@
# Problem definition
# Problem definition (v-1.0)
A rotating drum is randomly filled with two particle sizes and rotated to observe particle segregation. The focus of this tutorial is to show how to use the preprocessing tool `particlesPhasicFlow` to create the initial mixture of small and large particles. A rotating drum is randomly filled with two particle sizes and rotated to observe particle segregation. The focus of this tutorial is to show how to use the preprocessing tool `particlesPhasicFlow` to create the initial mixture of small and large particles.
@ -15,21 +17,19 @@ a view of the rotating drum with small and large particles after 7 seconds of ro
# Case setup # Case setup
In the file `caseSetup/sphereShape` two particle types with the names `smallSphere` and `largeSphere` and the diameters 3 and 5 mm are defined. Simulation case setup files can be found in [tutorials/sphereGranFlow folder.](https://github.com/PhasicFlow/phasicFlow/tree/main/tutorials/sphereGranFlow/binarySystemOfParticles)
[Simulation case setup files can be found in tutorials/sphereGranFlow folder.](https://github.com/PhasicFlow/phasicFlow/tree/main/tutorials/sphereGranFlow/binarySystemOfParticles)
### Shape definition ### Shape definition
In the file `caseSetup/sphereShape` two particle types with the names `smallSphere` and `largeSphere` and the diameters 3 and 5 mm are defined. In the file `caseSetup/shapes` two particle types with the names `smallSphere` and `largeSphere` and the diameters 3 and 5 mm are defined.
<div align="center"> <div align="center">
in <b>caseSetup/sphereShape</b> file in <b>caseSetup/sphereShape</b> file
</div> </div>
```C++ ```C++
names (smallSphere largeSphere); // names of shapes names (smallSphere largeSphere); // names of shapes
diameters (0.003 0.005); // diameter of shapes (m) diameters (0.003 0.005); // diameter of shapes (m)
materials (prop1 prop1); // material names for shapes materials (prop1 prop1); // material names for shapes
``` ```
### Positioning and initial mixture ### Positioning and initial mixture
@ -47,9 +47,9 @@ 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 diameter 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
} }
regionType cylinder; // other options: box and sphere regionType cylinder; // other options: box and sphere
@ -62,7 +62,7 @@ positionParticles
} }
} }
``` ```
In the `setFields` dictionary, located in the `settings/particlesDict` file, you define the initial `velocity`, `acceleration`, `rotVelocity` and `shapeName` fields for all 30000 particles in the simulation. In the `selectors' dictionary, you can select subsets of particles and set the field value for those subsets. The `selectRange` selector is defined in the `shapeAssigne` subdictionary. It defines a range with `begin`, `end` and `stride` to select particles. And in the `fieldValue` subdictionary the field values for selected particles are set (any number of field values can be set here). In the `setFields` dictionary, located in the `settings/particlesDict` file, you define the initial `velocity`, `acceleration`, `rotVelocity` and `shapeName` fields for all 30000 particles in the simulation. In the `selectors` dictionary, you can select subsets of particles and set the field value for those subsets. The `selectRange` selector is defined in the `shapeAssigne` subdictionary. It defines a range with `begin`, `end` and `stride` to select particles. And in the `fieldValue` subdictionary the field values for selected particles are set (any number of field values can be set here).
**Note:** Other selectors are: `selectBox` that selects particles inside a box and `randomSelect` that selects particles randomly from a given index range. **Note:** Other selectors are: `selectBox` that selects particles inside a box and `randomSelect` that selects particles randomly from a given index range.
@ -91,16 +91,16 @@ setFields
{ {
shapeAssigne shapeAssigne
{ {
selector stridedRange; // other options: box, cylinder, sphere, randomPoints selector stridedRange; // other options: box, cylinder, sphere, randomPoints
stridedRangeInfo stridedRangeInfo
{ {
begin 0; // begin index of points begin 0; // begin index of points
end 30000; // end index of points end 30000; // end index of points
stride 3; // stride for selector stride 3; // stride for selector
} }
fieldValue // fields that the selector is applied to fieldValue // fields that the selector is applied to
{ {
/* /*
sets shapeName of the selected points to largeSphere sets shapeName of the selected points to largeSphere
@ -132,7 +132,7 @@ Each executable in PhasicFlow comes with some command line options that you can
Usage: particlesPhasicFlow [OPTIONS] Usage: particlesPhasicFlow [OPTIONS]
Options: Options:
-h,--help Help for using createParticles of phasicFlow v-0.1 -h,--help Help for using createParticles of phasicFlow v-1.0
-v,--version Program version information -v,--version Program version information
--discription What does this app do? --discription What does this app do?
--positionParticles-only Exectue the positionParticles part only and store the created pointStructure in the time folder. --positionParticles-only Exectue the positionParticles part only and store the created pointStructure in the time folder.

View File

@ -6,31 +6,31 @@ objectName interaction;
objectType dicrionary; objectType dicrionary;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
materials (prop1); // properties of material materials (prop1); // properties of material
densities (1000.0); // density of materials [kg/m3] densities (1000.0); // density of materials [kg/m3]
contactListType sortedContactList; contactListType sortedContactList;
contactSearch contactSearch
{ {
method NBS; // method for broad search method NBS; // method for broad search
updateInterval 10; updateInterval 10;
sizeRatio 1.1; sizeRatio 1.1;
cellExtent 0.55; cellExtent 0.55;
adjustableBox Yes; adjustableBox Yes;
} }
model model
{ {
contactForceModel nonLinearNonLimited; contactForceModel nonLinearNonLimited;
rollingFrictionModel normal; rollingFrictionModel normal;
// Property (solid-solid Properties) // Property (solid-solid Properties)
@ -38,14 +38,12 @@ model
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
et (1.0); // coefficient of tangential restitution mu (0.3); // dynamic friction
mu (0.3); // dynamic friction mur (0.1); // rolling friction
mur (0.1); // rolling friction
} }

View File

@ -6,6 +6,4 @@ objectName particleInsertion;
objectType dicrionary; objectType dicrionary;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
collisionCheck No; // is checked -> yes or no active No; // is insertion active -> yes or no
active No; // is insertion active -> yes or no

View File

@ -6,8 +6,8 @@ objectName sphereDict;
objectType sphereShape; objectType sphereShape;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
names (smallSphere largeSphere); // names of shapes names (smallSphere largeSphere); // names of shapes
diameters (0.003 0.005); // diameter of shapes diameters (0.003 0.005); // diameter of shapes
materials (prop1 prop1); // material names for shapes materials (prop1 prop1); // material names for shapes

View File

View File

@ -6,63 +6,44 @@ 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);
max (0.12 0.12 0.1); max (0.12 0.12 0.1);
} }
decomposition
{
direction z;
}
boundaries boundaries
{ {
// Determines how often (how many iterations) do you want to
// rebuild the list of particles in the neighbor list
// of all boundaries in the simulation domain
neighborListUpdateInterval 50;
// Determines how often do you want to update the new changes in the boundary
updateInterval 10;
// The distance from the boundary plane within which particles are marked to be in the boundary list
neighborLength 0.004;
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

@ -12,11 +12,11 @@ rotatingAxisInfo // information for rotatingAxis
{ {
rotAxis rotAxis
{ {
p1 (0.0 0.0 0.0); // first point for the axis of rotation p1 (0.0 0.0 0.0); // first point for the axis of rotation
p2 (0.0 0.0 1.0); // second point for the axis of rotation p2 (0.0 0.0 1.0); // second point for the axis of rotation
omega 1.214; // rotation speed (rad/s) omega 1.214; // rotation speed (rad/s)
} }
} }
@ -24,21 +24,21 @@ surfaces
{ {
cylinder cylinder
{ {
type cylinderWall; // other options: cuboidWall and planeWall type cylinderWall; // other options: cuboidWall and planeWall
p1 (0.0 0.0 0.0); // begin point of cylinder axis p1 (0.0 0.0 0.0); // begin point of cylinder axis
p2 (0.0 0.0 0.1); // end point of cylinder axis p2 (0.0 0.0 0.1); // end point of cylinder axis
radius1 0.12; // radius at p1 radius1 0.12; // radius at p1
radius2 0.12; // radius at p2 radius2 0.12; // radius at p2
resolution 24; // number of divisions resolution 24; // number of divisions
material prop1; // material name of this wall material prop1; // material name of this wall
motion rotAxis; // motion component name motion rotAxis; // motion component name
} }
/* /*
@ -47,17 +47,17 @@ surfaces
wall1 wall1
{ {
type planeWall; // other options: cuboidWall and cylinderWall type planeWall; // other options: cuboidWall and cylinderWall
p1 (-0.12 -0.12 0.0); // first point of the wall p1 (-0.12 -0.12 0.0); // first point of the wall
p2 (0.12 -0.12 0.0); // second point of the wall p2 (0.12 -0.12 0.0); // second point of the wall
p3 (0.12 0.12 0.0); // third point of the wall p3 (0.12 0.12 0.0); // third point of the wall
p4 (-0.12 0.12 0.0); // fourth point of the wall p4 (-0.12 0.12 0.0); // fourth point of the wall
material prop1; // material name of the wall material prop1; // material name of the wall
motion rotAxis; // motion component name motion rotAxis; // motion component name
} }
@ -68,17 +68,17 @@ surfaces
wall2 wall2
{ {
type planeWall; // other options: cuboidWall and cylinderWall type planeWall; // other options: cuboidWall and cylinderWall
p1 (-0.12 -0.12 0.1); // first point of the wall p1 (-0.12 -0.12 0.1); // first point of the wall
p2 (0.12 -0.12 0.1); // second point of the wall p2 (0.12 -0.12 0.1); // second point of the wall
p3 (0.12 0.12 0.1); // third point of the wall p3 (0.12 0.12 0.1); // third point of the wall
p4 (-0.12 0.12 0.1); // fourth point of the wall p4 (-0.12 0.12 0.1); // fourth point of the wall
material prop1; // material name of the wall material prop1; // material name of the wall
motion rotAxis; // motion component name motion rotAxis; // motion component name
} }

View File

@ -6,33 +6,33 @@ objectName settingsDict;
objectType dictionary; objectType dictionary;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
run binarySystemofParticles; run binarySystemofParticles;
dt 0.00001; // time step for integration (seconds) dt 0.00001; // time step for integration (seconds)
startTime 0.0; // start time for simulation startTime 0.0; // start time for simulation
endTime 10.0; // end time for simulation endTime 10.0; // end time for simulation
saveInterval 0.1; // time interval for saving the simulation saveInterval 0.1; // time interval for saving the simulation
timePrecision 6; // maximum number of digits for time folder timePrecision 6; // maximum number of digits for time folder
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 (rVelocity.dy1 pStructPosition.dy1 pStructVelocity.dy1); excludeObjects (rVelocity.dy1 pStructPosition.dy1 pStructVelocity.dy1);
integrationMethod AdamsBashforth2; // integration method integrationMethod AdamsBashforth2; // integration method
writeFormat ascii; // data writting format (ascii or binary) writeFormat ascii; // data writting format (ascii or binary)
timersReport Yes; // report timers timersReport Yes; // report timers
timersReportInterval 0.01; // time interval for reporting timers timersReportInterval 0.1; // time interval for reporting timers

View File

@ -0,0 +1,86 @@
# Simulating a Rotating Drum with Periodic Boundary Type (v-1.0)
## 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 4-mm spherical particles at a rate of 10,000 particles/s for 2 seconds (a total of 20,000 particles). The timestep for integration is 0.00001 s. We use the `periodic` boundary type in the z-direction to replicate the same drum on both sides (a drum with an infinite length).
<div align="center">
<b>
<img src="./drumPeriodic.jpeg" alt="Rotating Drum with Periodic Boundary" style="width: 600px;">
</b>
<b>
A View of Rotating Drum with Periodic Boundary
</b></div>
***
## Setting Up the Case
Everything is similar to the tutorial on [simulating a small rotating drum](../rotatingDrumSmall), except that the drum does not have the two end plates (it is open from both sides), and we use particle insertion for inserting particles. So, if you don't know how to simulate a rotating drum, first review that tutorial.
Since the goal here is to show you how to use the periodic boundary type, we only review the `domainDict` here.
<div align="center">
in <b>settings/domainDict</b> file
</div>
```C++
// Simulation domain: every particle that goes outside this domain will be deleted
globalBox
{
min (-0.12 -0.12 0.0); // lower corner point of the box
max (0.12 0.12 0.1); // upper corner point of the box
}
boundaries
{
left // x-
{
type exit;
}
right // x+
{
type exit;
}
bottom // y-
{
type exit;
}
top // y+
{
type exit;
}
rear // z-
{
type periodic; // this boundary type should be defined on both z+ and z- sides
}
front // z+
{
type periodic; // this boundary type should be defined on both z+ and z- sides
}
}
```
`globalBox` defines a cuboid with two corner points `min` and `max`. If a particle falls out of this box, it is automatically deleted. So, this box should contain everything in the simulation and should be as small as possible.
`front` and `rear` boundaries represent the front and rear planes of this `globalBox`. If we want to have a periodic boundary in the z direction, we should set the type of boundary to `periodic` for both `front` and `rear` boundaries.
## 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.
```sh
geometryPhasicFlow
particlesPhasicFlow
sphereGranFlow
```
## 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.
```sh
pFlowToVTK --binary
```

View File

@ -0,0 +1,49 @@
/* -------------------------------*- C++ -*--------------------------------- *\
| phasicFlow File |
| copyright: www.cemf.ir |
\* ------------------------------------------------------------------------- */
objectName interaction;
objectType dicrionary;
fileFormat ASCII;
/*---------------------------------------------------------------------------*/
materials (prop1); // a list of materials names
densities (1000.0); // density of materials [kg/m3]
contactListType sortedContactList;
contactSearch
{
method NBS; // method for broad search
updateInterval 10;
sizeRatio 1.1;
cellExtent 0.55;
adjustableBox Yes;
}
model
{
contactForceModel nonLinearNonLimited;
rollingFrictionModel normal;
Yeff (1.0e6); // Young modulus [Pa]
Geff (0.8e6); // Shear modulus [Pa]
nu (0.25); // Poisson's ratio [-]
en (0.7); // coefficient of normal restitution
mu (0.3); // dynamic friction
mur (0.1); // rolling friction
}

View File

@ -0,0 +1,42 @@
/* -------------------------------*- C++ -*--------------------------------- *\
| phasicFlow File |
| copyright: www.cemf.ir |
\* ------------------------------------------------------------------------- */
objectName particleInsertion;
objectType dicrionary;
fileFormat ASCII;
/*---------------------------------------------------------------------------*/
active Yes; // is insertion active -> yes or no
partInsertion
{
timeControl simulationTime; // Time control method
rate 10000; // insertion rate (particles/s)
startTime 0; // Start time for insertion (s)
endTime 2; // End time for insertion (s)
insertionInterval 0.025; // Time interval between insertions (s)
regionType box; // type of insertion region
boxInfo
{
min (-0.07 0.05 0.05); // Minimum coordinates of the box (m,m,m)
max ( 0.07 0.06 0.09); // Maximum coordinates of the box (m,m,m)
}
setFields
{
velocity realx3 (0.0 -0.4 -0.3); // initial velocity of inserted particles
}
mixture
{
sphere1 1; // mixture composition of inserted particles
}
}

View File

@ -6,7 +6,8 @@ objectName sphereDict;
objectType sphereShape; objectType sphereShape;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
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

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
#------------------------------------------------------------------------------

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 KiB

View File

@ -0,0 +1,24 @@
#!/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
echo "\n<--------------------------------------------------------------------->"
echo "4) Converting to VTK"
echo "<--------------------------------------------------------------------->\n"
pFlowToVTK --binary --fields velocity diameter id
#------------------------------------------------------------------------------

View File

@ -0,0 +1,50 @@
/* -------------------------------*- C++ -*--------------------------------- *\
| phasicFlow File |
| copyright: www.cemf.ir |
\* ------------------------------------------------------------------------- */
objectName domainDict;
objectType dictionary;
fileFormat ASCII;
/*---------------------------------------------------------------------------*/
// Simulation domain: every particles that goes outside this domain will be deleted
globalBox
{
min (-0.12 -0.12 0.0); // lower corner point of the box
max (0.12 0.12 0.1); // upper corner point of the box
}
boundaries
{
left // x-
{
type exit;
}
right // x+
{
type exit;
}
bottom // y-
{
type exit;
}
top // y+
{
type exit;
}
rear // z-
{
type periodic; // this boundary type should be defined in both z+ and z- sides
}
front // z+
{
type periodic; // this boundary type should be defined in both z+ and z- sides
}
}

View File

@ -0,0 +1,50 @@
/* -------------------------------*- C++ -*--------------------------------- *\
| phasicFlow File |
| copyright: www.cemf.ir |
\* ------------------------------------------------------------------------- */
objectName geometryDict;
objectType dictionary;
fileFormat ASCII;
/*---------------------------------------------------------------------------*/
motionModel rotatingAxis;
rotatingAxisInfo // information for rotatingAxisMotion motion model
{
rotAxis
{
p1 (0.0 0.0 0.0); // first point for the axis of rotation
p2 (0.0 0.0 1.0); // second point for the axis of rotation
omega 1.214; // rotation speed (rad/s)
}
}
surfaces
{
/*
A cylinder with begin and end radii 0.12 m and axis points at (0 0 0) and (0 0 0.1)
*/
cylinder
{
type cylinderWall; // type of the wall
p1 (0.0 0.0 0.0); // begin point of cylinder axis
p2 (0.0 0.0 0.1); // end point of cylinder axis
radius1 0.12; // radius at p1
radius2 0.12; // radius at p2
resolution 24; // number of divisions
material prop1; // material name of this wall
motion rotAxis; // motion component name
}
}

View File

@ -0,0 +1,34 @@
/* -------------------------------*- C++ -*--------------------------------- *\
| phasicFlow File |
| copyright: www.cemf.ir |
\* ------------------------------------------------------------------------- */
objectName particlesDict;
objectType dictionary;
fileFormat ASCII;
/*---------------------------------------------------------------------------*/
setFields
{
/*
Default value for fields defined for particles
These fields should always be defined for simulations with
spherical particles.
*/
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 sphere1; // name of the particle shape
}
selectors
{}
}
positionParticles
{
method empty; // no particle at the start of simulation
}

View File

@ -0,0 +1,43 @@
/* -------------------------------*- C++ -*--------------------------------- *\
| phasicFlow File |
| copyright: www.cemf.ir |
\* ------------------------------------------------------------------------- */
objectName settingsDict;
objectType dictionary;
fileFormat ASCII;
/*---------------------------------------------------------------------------*/
run drumPeriodic;
dt 0.00001; // time step for integration (s)
startTime 0; // start time for simulation
endTime 5; // end time for simulation
saveInterval 0.05; // time interval for saving the simulation
timePrecision 4; // 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
rVelocity.dy2
rVelocity.dy3
pStructPosition.dy1
pStructPosition.dy2
pStructPosition.dy3
pStructVelocity.dy1
pStructVelocity.dy2
pStructVelocity.dy3);
integrationMethod AdamsBashforth4; // integration method
writeFormat ascii; // data writting format (ascii or binary)
timersReport Yes; // report timers (Yes or No)
timersReportInterval 0.1; // time interval for reporting timers

View File

@ -1,4 +1,4 @@
# Simulating a Simple Homogenization Silo Using Periodic Boundary # Simulating a Simple Homogenization Silo Using Periodic Boundary (v-1.0)
## 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`).

View File

@ -1,10 +1,15 @@
# Simulating a small rotating drum {#rotatingDrumSmall} # Simularing a rotating drum (v-1.0)
## Problem definition ## 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. 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.
<div align="center"><b> <div align="center">
a view of rotating drum <b>
A view of rotating drum
</b>
<b>
![](https://github.com/PhasicFlow/phasicFlow/blob/media/media/rotating-drum-s.png) ![](https://github.com/PhasicFlow/phasicFlow/blob/media/media/rotating-drum-s.png)
</b></div> </b></div>
*** ***
@ -12,35 +17,40 @@ a view of rotating drum
## 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. 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`). 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`).
### Creating particles ### Creating particles
Open the file `settings/particlesDict`. Two dictionaries, `positionParticles` and `setFields` position particles and set the field values for the particles. Open 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 `positionOrdered`, which position particles in order in the space defined by `box`. `box` space is defined by two corner points `min` and `max`. In dictionary `positionOrderedInfo`, `numPoints` defines number of particles; `diameter`, the distance between two adjacent particles, and `axisOrder` defines the axis order for filling the space by 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.
<div align="center"> <div align="center">
in <b>settings/particlesDict</b> file in <b>settings/particlesDict</b> file
</div> </div>
```C++ ```C++
positionParticles positionParticles // positions particles
{ {
method positionOrdered; // ordered positioning method ordered; // other options: random and empty
maxNumberOfParticles 40000; // maximum number of particles in the simulation
mortonSorting Yes; // perform initial sorting based on morton code?
box // box for positioning particles mortonSorting Yes; // perform initial sorting based on morton code?
orderedInfo
{ {
min (-0.08 -0.08 0.015); // lower corner point of the box diameter 0.004; // minimum space between centers of particles
max ( 0.08 0.08 0.098); // upper corner point of the box
numPoints 30000; // number of particles in the simulation
axisOrder (z y x); // axis order for filling the space with particles
} }
positionOrderedInfo regionType box; // other options: cylinder and sphere
boxInfo // box information for positioning particles
{ {
diameter 0.004; // minimum space between centers of particles min (-0.08 -0.08 0.015); // lower corner point of the box
numPoints 30000; // number of particles in the simulation
axisOrder (z y x); // axis order for filling the space with particles max ( 0.08 0.08 0.098); // upper corner point of the box
} }
} }
``` ```
@ -55,39 +65,45 @@ setFields
{ {
defaultValue defaultValue
{ {
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)
rotVelocity realx3 (0 0 0); // rotational velocity (rad/s) acceleration realx3 (0 0 0); // linear acceleration (m/s2)
shapeName word sphere1; // name of the particle shape
rVelocity realx3 (0 0 0); // rotational velocity (rad/s)
shapeName word sphere1; // name of the particle shape
} }
selectors selectors
{} {
}
} }
``` ```
Enter the following command in the terminal to create the particles and store them in `0` folder. Enter the following command in the terminal to create the particles and store them in `0` folder.
`> 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. `rotatingAxisMotion` 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 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.
<div align="center"> <div align="center">
in <b>settings/geometryDict</b> file in <b>settings/geometryDict</b> file
</div> </div>
```C++ ```C++
motionModel rotatingAxisMotion; motionModel rotatingAxis;
.
. rotatingAxisInfo // information for rotatingAxisMotion motion model
.
rotatingAxisMotionInfo
{ {
rotAxis rotAxis
{ {
p1 (0.0 0.0 0.0); // first point for the axis of rotation p1 (0.0 0.0 0.0); // first point for the axis of rotation
p2 (0.0 0.0 1.0); // second point for the axis of rotation
omega 1.214; // rotation speed (rad/s) p2 (0.0 0.0 1.0); // second point for the axis of rotation
omega 1.214; // rotation speed (rad/s)
} }
} }
``` ```
@ -100,36 +116,69 @@ in <b>settings/geometryDict</b> file
```C++ ```C++
surfaces surfaces
{ {
/*
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
p1 (0.0 0.0 0.0); // begin point of cylinder axis
p2 (0.0 0.0 0.1); // end point of cylinder axis p1 (0.0 0.0 0.0); // begin point of cylinder axis
radius1 0.12; // radius at p1
radius2 0.12; // radius at p2 p2 (0.0 0.0 0.1); // end point of cylinder axis
resolution 24; // number of divisions
material prop1; // material name of this wall radius1 0.12; // radius at p1
motion rotAxis; // motion component name
radius2 0.12; // radius at p2
resolution 24; // number of divisions
material prop1; // material name of this wall
motion rotAxis; // motion component name
} }
/*
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
p1 (-0.12 -0.12 0.0); // first point of the wall
p2 ( 0.12 -0.12 0.0); // second point p1 (-0.12 -0.12 0.0); // first point of the wall
p3 ( 0.12 0.12 0.0); // third point
p4 (-0.12 0.12 0.0); // fourth point p2 ( 0.12 -0.12 0.0); // second point
material prop1; // material name of the wall
motion rotAxis; // motion component name p3 ( 0.12 0.12 0.0); // third point
p4 (-0.12 0.12 0.0); // fourth point
material prop1; // material name of the wall
motion rotAxis; // motion component name
} }
/*
This is a plane wall at the front end of cylinder
*/
wall2 wall2
{ {
type planeWall; type planeWall; // type of the wall
p1 (-0.12 -0.12 0.1);
p2 ( 0.12 -0.12 0.1); p1 (-0.12 -0.12 0.1); // first point of the wall
p3 ( 0.12 0.12 0.1);
p4 (-0.12 0.12 0.1); p2 ( 0.12 -0.12 0.1); // second point
material prop1;
motion rotAxis; p3 ( 0.12 0.12 0.1); // third point
p4 (-0.12 0.12 0.1); // fourth point
material prop1; // material name of the wall
motion rotAxis; // motion component name
} }
} }
``` ```
@ -152,79 +201,140 @@ densities (1000.0); // density of materials [kg/m3]
. .
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
et (1.0); // coefficient of tangential 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 and `wallMapping` shows how particles are mapped onto walls for finding neighbor list for particle-wall contacts. `updateFrequency` sets the frequency for 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. 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.
<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 for broad search particle-particle
wallMapping cellsSimple; // method for broad search particle-wall method NBS; // method for broad search
updateInterval 10;
NBSInfo sizeRatio 1.1;
{
updateFrequency 20; // each 20 timesteps, update neighbor list
sizeRatio 1.1; // bounding box size to particle diameter (max)
}
cellsSimpleInfo cellExtent 0.55;
{
updateFrequency 20; // each 20 timesteps, update neighbor list adjustableBox Yes;
cellExtent 0.7; // bounding box for particle-wall search (> 0.5) }
}
}
``` ```
In the file `caseSetup/sphereShape`, 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/shape`, you can define a list of `names` for shapes (`shapeName` in particle field), a list of diameters for shapes and their `properties` names.
<div align="center"> <div align="center">
in <b>caseSetup/sphereShape</b> file in <b>caseSetup/shape</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`. The dictionary `domain` 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. Other settings for the simulation can be set in file `settings/settingsDict`.
<div align="center"> <div align="center">
in <b>settings/settingsDict</b> file in <b>settings/settingsDict</b> file
</div> </div>
```C++ ```C++
dt 0.00001; // time step for integration (s) run rotatingDrumSmall;
startTime 0; // start time for simulation
endTime 10; // end time for simulation dt 0.00001; // time step for integration (s)
saveInterval 0.1; // time interval for saving the simulation
timePrecision 6; // maximum number of digits for time folder startTime 0; // start time for simulation
g (0 -9.8 0); // gravity vector (m/s2)
domain endTime 10; // end time for simulation
{
min (-0.12 -0.12 0); saveInterval 0.1; // time interval for saving the simulation
max (0.12 0.12 0.11);
} timePrecision 6; // maximum number of digits for time folder
integrationMethod AdamsBashforth2; // integration method
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">
in <b>settings/domainDict</b> file
</div>
```C++
// 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
max (0.12 0.12 0.11); // upper corner point of the box
}
boundaries
{
left
{
type exit; // other options: periodic, reflective
}
right
{
type exit; // other options: periodic, reflective
}
bottom
{
type exit; // other options: periodic, reflective
}
top
{
type exit; // other options: periodic, reflective
}
rear
{
type exit; // other options: periodic, reflective
}
front
{
type exit; // other options: periodic, reflective
}
}
```
## Running the case ## Running the case
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. 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.
@ -233,4 +343,4 @@ The solver for this simulation is `sphereGranFlow`. Enter the following command
## 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 converts all the results (particles and geometry) to VTK format and store them in folder `VTK/`. 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/`.
`> pFlowToVTK` `> pFlowToVTK --binary`

View File

@ -40,8 +40,6 @@ model
en (0.7); // coefficient of normal restitution en (0.7); // coefficient of normal restitution
et (1.0); // coefficient of tangential restitution
mu (0.3); // dynamic friction mu (0.3); // dynamic friction
mur (0.1); // rolling friction mur (0.1); // rolling friction

View File

@ -8,57 +8,40 @@ fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
globalBox // Simulation domain: every particles that goes outside this domain will be deleted globalBox // Simulation domain: every particles that goes outside this domain will be deleted
{ {
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
max (0.12 0.12 0.11); // upper corner point of the box max (0.12 0.12 0.11); // upper corner point of the box
}
decomposition
{
direction z;
} }
boundaries boundaries
{ {
neighborListUpdateInterval 50; /* Determines how often (how many iterations) do you want to
rebuild the list of particles in the neighbor list
of all boundaries in the simulation domain */
updateInterval 10; // Determines how often do you want to update the new changes in the boundary
neighborLength 0.004; // The distance from the boundary plane within which particles are marked to be in the boundary list
left left
{ {
type exit; // other options: periodict, reflective type exit; // other options: periodict, reflective
} }
right right
{ {
type exit; // other options: periodict, reflective type exit; // other options: periodict, reflective
} }
bottom bottom
{ {
type exit; // other options: periodict, reflective type exit; // other options: periodict, reflective
} }
top top
{ {
type exit; // other options: periodict, reflective type exit; // other options: periodict, reflective
} }
rear rear
{ {
type exit; // other options: periodict, reflective type exit; // other options: periodict, reflective
} }
front front
{ {
type exit; // other options: periodict, reflective type exit; // other options: periodict, reflective
} }
} }

View File

@ -29,24 +29,8 @@ setFields
selectors selectors
{ {
shapeAssigne
{
selector stridedRange; // other options: box, cylinder, sphere, randomPoints
stridedRangeInfo
{
begin 0; // begin index of points
end 30000; // end index of points }
stride 3; // stride for selector
}
fieldValue // fields that the selector is applied to
{
shapeName word sphere1; // sets shapeName of the selected points to largeSphere
}
}
} }
positionParticles // positions particles positionParticles // positions particles

View File

@ -1,4 +1,4 @@
# Simulating a Screw Conveyor # Simulating a Screw Conveyor (v-1.0)
## Problem Definition ## Problem Definition

View File

@ -4,6 +4,7 @@ particlesPhasicFlow.cpp
positionParticles/positionParticles.cpp positionParticles/positionParticles.cpp
positionOrdered/positionOrdered.cpp positionOrdered/positionOrdered.cpp
positionRandom/positionRandom.cpp positionRandom/positionRandom.cpp
positionFile/positionFile.cpp
empty/empty.cpp empty/empty.cpp
) )
#set(link_lib phasicFlow Kokkos::kokkos Interaction Utilities) #set(link_lib phasicFlow Kokkos::kokkos Interaction Utilities)

View File

@ -0,0 +1,149 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#include "error.hpp"
#include "dictionary.hpp"
#include "positionFile.hpp"
#include "streams.hpp"
// #include "token.hpp"
#include "fileSystem.hpp"
#include "iFstream.hpp"
#include "oFstream.hpp"
bool pFlow::positionFile::positionPointsFile()
{
REPORT(0) << "Reading user defined position file....";
position_.clear();
// Read position data from file.
iFstream is(fileName_);
realx3 tempPoint;
token tok;
while (!is.bad())
{
// read position x
is >> tok;
if(tok.good()&& tok.isNumber()&& !is.eof())
{
tempPoint.x() = tok.realToken();
}
else
{
ioErrorInFile(is.name(), is.lineNumber())<< "Bad char or end of file in reading position x!\n";
return false;
}
if(commaSeparated_)
{
is >> tok;
if( !tok.isComma() || is.eof())
{
ioErrorInFile(is.name(), is.lineNumber())<< "Bad char or end of file in reading comma!\n";
return false;
}
}
// read position y
is >> tok;
if(tok.good()&& tok.isNumber()&& !is.eof())
{
tempPoint.y() = tok.realToken();
}
else
{
ioErrorInFile(is.name(), is.lineNumber())<< "Bad char or end of file in reading position y!\n";
return false;
}
if(commaSeparated_)
{
is >> tok;
if(!tok.isComma() || is.eof())
{
ioErrorInFile(is.name(), is.lineNumber())<< "Bad char or end of file in reading comma!\n";
return false;
}
}
// read position z
is >> tok;
if(tok.good()&& tok.isNumber()&& !is.eof())
{
tempPoint.z() = tok.realToken();
}
else
{
ioErrorInFile(is.name(), is.lineNumber())<< "Bad char or end of file in reading position z!\n";
return false;
}
// insert position data to vector
position_.push_back(tempPoint);
is>>tok;
if(is.eof()) break;
is.putBack(tok);
}
REPORT(0) << "Done!" << END_REPORT;
return true;
}
pFlow::positionFile::positionFile
(
systemControl& control,
const dictionary& dict
)
:
positionParticles(control, dict),
poDict_
(
dict.subDict("fileInfo")
),
fileName_
(
poDict_.getVal<word>("name")
),
commaSeparated_
(
poDict_.getValOrSet("commaSeparated", Logical("Yes"))
),
position_
(
"position",
1,
0,
RESERVE()
)
{
if(!positionPointsFile())
{
fatalExit;
}
}

View File

@ -0,0 +1,105 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __positionFile_hpp__
#define __positionFile_hpp__
#include "positionParticles.hpp"
namespace pFlow
{
class positionFile
:
public positionParticles
{
private:
dictionary poDict_;
// word fileName_;
fileSystem fileName_;
realx3Vector position_;
Logical commaSeparated_;
bool positionPointsFile();
public:
// - type Info
TypeInfo("file");
positionFile(
systemControl& control,
const dictionary& dict);
// - add this class to vCtor selection table
add_vCtor(
positionParticles,
positionFile,
dictionary);
~positionFile() final = default;
//// - Methods
uint32 numPoints()const final
{
return static_cast<uint32>(position_.size());
}
uint32 size()const final
{
return static_cast<uint32>(position_.size());
}
real maxDiameter() const final
{
return 0;
}
// bool commaSeparated()const
// {
// return commaSeparated_();
// }
// - const access to position
const realx3Vector& position()const final
{
return position_;
}
// - access to position
realx3Vector& position() final
{
return position_;
}
};
}
#endif // __positionFile_hpp__