mirror of
https://github.com/PhasicFlow/phasicFlow.git
synced 2025-07-28 03:27:05 +00:00
Compare commits
24 Commits
ce7070dc37
...
v-0.1
Author | SHA1 | Date | |
---|---|---|---|
d0aa5af792 | |||
33a838b784 | |||
1817c9e640 | |||
012e386845 | |||
413f054314 | |||
610317715d | |||
e737e60011 | |||
e0796ce711 | |||
23f337f1b7 | |||
311968b955 | |||
e0bf68511c | |||
1b313779a1 | |||
61f48ea654 | |||
5942263e46 | |||
f98c9ab1f7 | |||
3bc35e9e62 | |||
30e43f94a2 | |||
12fe768668 | |||
bca9990bb0 | |||
892c3a09db | |||
709c5263b1 | |||
7d62ba42de | |||
58254fe9f2 | |||
485c5e3142 |
18
README.md
18
README.md
@ -3,7 +3,7 @@
|
||||
</div>
|
||||
|
||||
|
||||
**PhasicFlow** is a parallel C++ code for performing DEM simulations. It can run on shared-memory multi-core computational units such as multi-core CPUs or GPUs (for now it works on CUDA-enabled GPUs). The parallelization method mainly relies on loop-level parallelization on a shared-memory computational unit. You can build and run PhasicFlow in serial mode on regular PCs, in parallel mode for multi-core CPUs, or build it for a GPU device to off-load computations to a GPU. In its current statues you can simulate millions of particles (up to 32M particles tested) on a single desktop computer. You can see the [performance tests of PhasicFlow](https://github.com/PhasicFlow/phasicFlow/wiki/Performance-of-phasicFlow) in the wiki page.
|
||||
**PhasicFlow** is a parallel C++ code for performing DEM simulations. It can run on shared-memory multi-core computational units such as multi-core CPUs or GPUs (for now it works on CUDA-enabled GPUs). The parallelization method mainly relies on loop-level parallelization on a shared-memory computational unit. You can build and run PhasicFlow in serial mode on regular PCs, in parallel mode for multi-core CPUs, or build it for a GPU device to off-load computations to a GPU. In its current statues you can simulate millions of particles (up to 80M particles tested) on a single desktop computer. You can see the [performance tests of PhasicFlow](https://github.com/PhasicFlow/phasicFlow/wiki/Performance-of-phasicFlow) in the wiki page.
|
||||
|
||||
## How to build?
|
||||
You can build PhasicFlow for CPU and GPU executions. [Here is a complete step-by-step procedure](https://github.com/PhasicFlow/phasicFlow/wiki/How-to-Build-PhasicFlow).
|
||||
@ -22,3 +22,19 @@ PhasicFlowPlus is and extension to PhasicFlow for simulating particle-fluid syst
|
||||
* [Kokkos](https://github.com/kokkos/kokkos) from National Technology & Engineering Solutions of Sandia, LLC (NTESS)
|
||||
* [CLI11 1.8](https://github.com/CLIUtils/CLI11) from University of Cincinnati.
|
||||
|
||||
## How to cite PhasicFlow
|
||||
If you are using PhasicFlow in your research or industrial work, cite the following [article](https://www.sciencedirect.com/science/article/pii/S0010465523001662):
|
||||
```
|
||||
@article{NOROUZI2023108821,
|
||||
title = {PhasicFlow: A parallel, multi-architecture open-source code for DEM simulations},
|
||||
journal = {Computer Physics Communications},
|
||||
volume = {291},
|
||||
pages = {108821},
|
||||
year = {2023},
|
||||
issn = {0010-4655},
|
||||
doi = {https://doi.org/10.1016/j.cpc.2023.108821},
|
||||
url = {https://www.sciencedirect.com/science/article/pii/S0010465523001662},
|
||||
author = {H.R. Norouzi},
|
||||
keywords = {Discrete element method, Parallel computing, CUDA, GPU, OpenMP, Granular flow}
|
||||
}
|
||||
```
|
||||
|
@ -31,6 +31,28 @@ Licence:
|
||||
namespace pFlow
|
||||
{
|
||||
|
||||
/**
|
||||
* This class manages all the insertion regions for particles insertion
|
||||
* in the simulation.
|
||||
*
|
||||
* Any number of insertion regions can be defined in a simulation. The
|
||||
* data for particle insertion is provided in particleInsertion file, which
|
||||
* looks like this. A list of insertion regions (class insertionRegion) can be defined in this file.
|
||||
* For more information see file insertionRegion.hpp.
|
||||
* \verbatim
|
||||
active yes;
|
||||
|
||||
region1
|
||||
{
|
||||
// the data for insertionRegion
|
||||
}
|
||||
|
||||
region2
|
||||
{
|
||||
// Data for insertionRegion
|
||||
}
|
||||
\endverbatim
|
||||
*/
|
||||
template<typename ShapeType>
|
||||
class Insertion
|
||||
:
|
||||
|
@ -28,13 +28,18 @@ Licence:
|
||||
namespace pFlow
|
||||
{
|
||||
|
||||
/**
|
||||
* This manages insertion of particles from a region based on the ShapeType
|
||||
*
|
||||
*/
|
||||
template<typename ShapeType>
|
||||
class InsertionRegion
|
||||
:
|
||||
public insertionRegion
|
||||
{
|
||||
protected:
|
||||
// - type of particle shapes
|
||||
|
||||
/// Ref to Shapes
|
||||
const ShapeType& shapes_;
|
||||
|
||||
static bool checkForContact(
|
||||
@ -45,39 +50,52 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
// - type info
|
||||
/// Type info
|
||||
TypeInfoTemplateNV("insertionRegion", ShapeType);
|
||||
|
||||
InsertionRegion(const dictionary& dict, const ShapeType& shapes);
|
||||
// - Constructors
|
||||
|
||||
InsertionRegion(const InsertionRegion<ShapeType>& ) = default;
|
||||
/// Construct from dictionary
|
||||
InsertionRegion(const dictionary& dict, const ShapeType& shapes);
|
||||
|
||||
InsertionRegion(InsertionRegion<ShapeType>&&) = default;
|
||||
/// Copy
|
||||
InsertionRegion(const InsertionRegion<ShapeType>& ) = default;
|
||||
|
||||
InsertionRegion<ShapeType>& operator=(const InsertionRegion<ShapeType>& ) = default;
|
||||
/// Move
|
||||
InsertionRegion(InsertionRegion<ShapeType>&&) = default;
|
||||
|
||||
InsertionRegion<ShapeType>& operator=(InsertionRegion<ShapeType>&&) = default;
|
||||
/// Copy assignment
|
||||
InsertionRegion<ShapeType>& operator=(const InsertionRegion<ShapeType>& ) = default;
|
||||
|
||||
/// Copy assignment
|
||||
InsertionRegion<ShapeType>& operator=(InsertionRegion<ShapeType>&&) = default;
|
||||
|
||||
auto clone()const
|
||||
{
|
||||
return makeUnique<InsertionRegion<ShapeType>>(*this);
|
||||
}
|
||||
/// Clone
|
||||
auto clone()const
|
||||
{
|
||||
return makeUnique<InsertionRegion<ShapeType>>(*this);
|
||||
}
|
||||
|
||||
auto clonePtr()const
|
||||
{
|
||||
return new InsertionRegion<ShapeType>(*this);
|
||||
}
|
||||
/// Clone ptr
|
||||
auto clonePtr()const
|
||||
{
|
||||
return new InsertionRegion<ShapeType>(*this);
|
||||
}
|
||||
|
||||
// - Methods
|
||||
|
||||
bool insertParticles
|
||||
(
|
||||
real currentTime,
|
||||
real dt,
|
||||
wordVector& names,
|
||||
realx3Vector& pos,
|
||||
bool& insertionOccured
|
||||
);
|
||||
/// Insert particles at currentTime
|
||||
/// Check if currentTime is the right moment for
|
||||
/// particle insertion. Fill the vectors name, pos and signal
|
||||
/// if particle insertion occured or not.
|
||||
bool insertParticles
|
||||
(
|
||||
real currentTime,
|
||||
real dt,
|
||||
wordVector& names,
|
||||
realx3Vector& pos,
|
||||
bool& insertionOccured
|
||||
);
|
||||
|
||||
//bool read(const dictionary& dict);
|
||||
|
||||
|
@ -21,49 +21,58 @@ Licence:
|
||||
#ifndef __insertion_hpp__
|
||||
#define __insertion_hpp__
|
||||
|
||||
|
||||
#include "streams.hpp"
|
||||
#include "types.hpp"
|
||||
#include "virtualConstructor.hpp"
|
||||
|
||||
namespace pFlow
|
||||
{
|
||||
|
||||
// forward
|
||||
class particles;
|
||||
class dictionary;
|
||||
|
||||
/**
|
||||
* Base class for particle insertion
|
||||
*/
|
||||
class insertion
|
||||
{
|
||||
protected:
|
||||
// - insertion active
|
||||
|
||||
/// Is insertion active
|
||||
Logical active_ = "No";
|
||||
|
||||
// - check for collision / desabled for now
|
||||
/// Check for collision? It is not active now
|
||||
Logical checkForCollision_ = "No";
|
||||
|
||||
// - particles
|
||||
/// Ref to particles
|
||||
particles& particles_;
|
||||
|
||||
|
||||
/// Read from dictionary
|
||||
bool readInsertionDict(const dictionary& dict);
|
||||
|
||||
/// Write to dictionary
|
||||
bool writeInsertionDict(dictionary& dict)const;
|
||||
|
||||
public:
|
||||
|
||||
// type info
|
||||
/// Type info
|
||||
TypeInfo("insertion");
|
||||
|
||||
/// Construct from component
|
||||
insertion(particles& prtcl);
|
||||
|
||||
|
||||
/// Destructor
|
||||
virtual ~insertion() = default;
|
||||
|
||||
/// is Insertion active
|
||||
bool isActive()const {
|
||||
return active_();
|
||||
}
|
||||
|
||||
|
||||
/// read from iIstream
|
||||
virtual bool read(iIstream& is) = 0;
|
||||
|
||||
/// write to iOstream
|
||||
virtual bool write(iOstream& os)const = 0;
|
||||
|
||||
|
||||
|
@ -31,67 +31,126 @@ namespace pFlow
|
||||
|
||||
class dictionary;
|
||||
|
||||
/**
|
||||
* This class defines all the necessary enteties for defining an insertion
|
||||
* region.
|
||||
*
|
||||
* Insertion region information are supplied through a dictionary in a file.
|
||||
* For example:
|
||||
\verbatim
|
||||
{
|
||||
type cylinderRegion; // type of insertion region
|
||||
rate 15000; // insertion rate (particles/s)
|
||||
startTime 0; // (s)
|
||||
endTime 0.5; // (s)
|
||||
interval 0.025; // (s)
|
||||
|
||||
cylinderRegionInfo
|
||||
{
|
||||
radius 0.09; // radius of cylinder (m)
|
||||
p1 (0.0 0.0 0.10); // (m,m,m)
|
||||
p2 (0.0 0.0 0.11); // (m,m,m)
|
||||
}
|
||||
|
||||
setFields
|
||||
{
|
||||
velocity realx3 (0.0 0.0 -0.6); // initial velocity of inserted particles
|
||||
}
|
||||
|
||||
mixture
|
||||
{
|
||||
lightSphere 1; // mixture composition of inserted particles
|
||||
}
|
||||
} \endverbatim
|
||||
*
|
||||
* More information on the above dictionary entries can be found in
|
||||
* the table below.
|
||||
*
|
||||
*
|
||||
* | Parameter | Type | Description | Optional [default value] |
|
||||
* |----| :---: | ---- | ---- |
|
||||
* | type | word | type of the insertion region with name ### | No |
|
||||
* | rate | real | rate of insertion (particle/s) | No |
|
||||
* | startTime | real | start of insertion (s) | No |
|
||||
* | endTime | real | end of insertion (s) | No |
|
||||
* | interval | real | time interval between successive insertions (s) | No |
|
||||
* | ###Info | dictionary | data for insertion region | No |
|
||||
* | setFields | dictionary | set field for inserted particles (s) | Yes [empty dictionray] |
|
||||
* | mixture | dictionary | mixture of particles to be inserted (s) | No |
|
||||
*
|
||||
*/
|
||||
class insertionRegion
|
||||
:
|
||||
public timeFlowControl
|
||||
{
|
||||
protected:
|
||||
|
||||
// - name of the region
|
||||
/// name of the region
|
||||
word name_;
|
||||
|
||||
// - type of insertion region
|
||||
/// type of insertion region
|
||||
word type_;
|
||||
|
||||
// peakable region of points
|
||||
/// peakable region of points
|
||||
uniquePtr<peakableRegion> pRegion_ = nullptr;
|
||||
|
||||
// mixture of shapes
|
||||
/// mixture of shapes
|
||||
uniquePtr<shapeMixture> mixture_ = nullptr;
|
||||
|
||||
// setFields for insertion region
|
||||
/// setFields for insertion region
|
||||
uniquePtr<setFieldList> setFields_ = nullptr;
|
||||
|
||||
|
||||
/// read from dictionary
|
||||
bool readInsertionRegion(const dictionary& dict);
|
||||
|
||||
/// write to dictionary
|
||||
bool writeInsertionRegion(dictionary& dict) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
/// Type info
|
||||
TypeInfoNV("insertionRegion");
|
||||
|
||||
//// - Constructors
|
||||
// - Constructors
|
||||
|
||||
/// Construct from a dictionary
|
||||
insertionRegion(const dictionary& dict);
|
||||
|
||||
/// Copy
|
||||
insertionRegion(const insertionRegion& src);
|
||||
|
||||
/// Move
|
||||
insertionRegion(insertionRegion&&) = default;
|
||||
|
||||
/// Copy assignment
|
||||
insertionRegion& operator=(const insertionRegion&);
|
||||
|
||||
/// Move assignment
|
||||
insertionRegion& operator=(insertionRegion&&) = default;
|
||||
|
||||
|
||||
/// Destructor
|
||||
~insertionRegion() = default;
|
||||
|
||||
|
||||
//// - Methods
|
||||
// - Methods
|
||||
|
||||
/// Const ref to setFields
|
||||
const auto& setFields()const
|
||||
{
|
||||
return setFields_();
|
||||
}
|
||||
|
||||
/// Const ref to name of the region
|
||||
const auto& name()const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
// - IO operation
|
||||
|
||||
//// - IO operation
|
||||
|
||||
/// read from dictionary
|
||||
bool read(const dictionary& dict)
|
||||
{
|
||||
if(!timeFlowControl::read(dict))return false;
|
||||
@ -99,14 +158,13 @@ public:
|
||||
return readInsertionRegion(dict);
|
||||
}
|
||||
|
||||
/// write to dictionary
|
||||
bool write(dictionary& dict)const
|
||||
{
|
||||
if(!timeFlowControl::write(dict)) return false;
|
||||
|
||||
return writeInsertionRegion(dict);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
} //pFlow
|
||||
|
@ -21,6 +21,17 @@ Licence:
|
||||
#include "timeFlowControl.hpp"
|
||||
#include "dictionary.hpp"
|
||||
|
||||
size_t pFlow::timeFlowControl::numberToBeInserted(real currentTime)
|
||||
{
|
||||
if(currentTime<startTime_)return 0;
|
||||
if(currentTime>endTime_) return 0;
|
||||
|
||||
return static_cast<size_t>
|
||||
(
|
||||
(currentTime - startTime_ + interval_)*rate_ - numInserted_
|
||||
);
|
||||
}
|
||||
|
||||
bool pFlow::timeFlowControl::readTimeFlowControl
|
||||
(
|
||||
const dictionary& dict
|
||||
@ -60,3 +71,13 @@ pFlow::timeFlowControl::timeFlowControl
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool pFlow::timeFlowControl::insertionTime( real currentTime, real dt)
|
||||
{
|
||||
if(currentTime < startTime_) return false;
|
||||
|
||||
if(currentTime > endTime_) return false;
|
||||
if( mod(abs(currentTime-startTime_),interval_)/dt < 1 ) return true;
|
||||
|
||||
return false;
|
||||
}
|
@ -29,32 +29,40 @@ namespace pFlow
|
||||
|
||||
class dictionary;
|
||||
|
||||
/**
|
||||
* Time control for particle insertion
|
||||
*/
|
||||
class timeFlowControl
|
||||
{
|
||||
protected:
|
||||
|
||||
/// start time of insertion
|
||||
real startTime_;
|
||||
|
||||
/// end time of insertion
|
||||
real endTime_;
|
||||
|
||||
/// time interval between each insertion
|
||||
real interval_;
|
||||
|
||||
/// rate of insertion
|
||||
real rate_;
|
||||
|
||||
/// number of inserted particles
|
||||
size_t numInserted_ = 0;
|
||||
|
||||
|
||||
/// Read dictionary
|
||||
bool readTimeFlowControl(const dictionary& dict);
|
||||
|
||||
/// Write to dictionary
|
||||
bool writeTimeFlowControl(dictionary& dict) const;
|
||||
|
||||
size_t numberToBeInserted(real currentTime)
|
||||
{
|
||||
if(currentTime<startTime_)return 0;
|
||||
if(currentTime>endTime_) return 0;
|
||||
|
||||
return static_cast<size_t>( (currentTime - startTime_ + interval_)*rate_ - numInserted_ );
|
||||
}
|
||||
/// Return number of particles to be inserted at time currentTime
|
||||
size_t numberToBeInserted(real currentTime);
|
||||
|
||||
/// Add to numInserted
|
||||
inline
|
||||
size_t addToNumInserted(size_t newInserted)
|
||||
{
|
||||
return numInserted_ += newInserted;
|
||||
@ -62,30 +70,25 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
|
||||
/// Construct from dictionary
|
||||
timeFlowControl(const dictionary& dict);
|
||||
|
||||
/// Is currentTime the insertion moment?
|
||||
bool insertionTime( real currentTime, real dt);
|
||||
|
||||
bool insertionTime( real currentTime, real dt)
|
||||
{
|
||||
if(currentTime < startTime_) return false;
|
||||
|
||||
if(currentTime > endTime_) return false;
|
||||
if( mod(abs(currentTime-startTime_),interval_)/dt < 1 ) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Total number inserted so far
|
||||
size_t totalInserted()const
|
||||
{
|
||||
return numInserted_;
|
||||
}
|
||||
|
||||
/// Read from dictionary
|
||||
bool read(const dictionary& dict)
|
||||
{
|
||||
return readTimeFlowControl(dict);
|
||||
}
|
||||
|
||||
/// Write to dictionary
|
||||
bool write(dictionary& dict)const
|
||||
{
|
||||
return writeTimeFlowControl(dict);
|
||||
|
@ -29,70 +29,95 @@ namespace pFlow
|
||||
|
||||
class dictionary;
|
||||
|
||||
/**
|
||||
* Defines a mixture of particles for particle insertion.
|
||||
*
|
||||
* The mixture composition is defined based on the integer numbers.
|
||||
* For example, if there are 3 shape names in the simulaiotn
|
||||
* (shape1, shape2, and shape3), the mixture composition can be defined as:
|
||||
* \verbatim
|
||||
{
|
||||
shape1 4;
|
||||
shape2 2;
|
||||
shape3 6;
|
||||
}
|
||||
\endverbatim
|
||||
*
|
||||
*/
|
||||
class shapeMixture
|
||||
{
|
||||
|
||||
protected:
|
||||
// - list of shape names
|
||||
|
||||
/// List of shape names
|
||||
wordVector names_;
|
||||
|
||||
// - number composition
|
||||
/// Number composition
|
||||
uint32Vector number_;
|
||||
|
||||
// - number inserted of each shape
|
||||
/// Number of inserted particles of each shape
|
||||
uint32Vector numberInserted_;
|
||||
|
||||
/// Current number of inserted
|
||||
uint32Vector current_;
|
||||
|
||||
public:
|
||||
|
||||
//- type Info
|
||||
/// Type info
|
||||
TypeInfoNV("shapeMixture");
|
||||
|
||||
//// - constrcutores
|
||||
// - Constrcutors
|
||||
|
||||
//
|
||||
/// Construct from dictionary
|
||||
shapeMixture(const dictionary & dict);
|
||||
|
||||
/// Copy
|
||||
shapeMixture(const shapeMixture&) = default;
|
||||
|
||||
/// Move
|
||||
shapeMixture(shapeMixture&&) = default;
|
||||
|
||||
/// Copy assignment
|
||||
shapeMixture& operator=(const shapeMixture&) = default;
|
||||
|
||||
/// Move assignment
|
||||
shapeMixture& operator=(shapeMixture&&) = default;
|
||||
|
||||
|
||||
/// Polymorphic copy
|
||||
uniquePtr<shapeMixture> clone()const
|
||||
{
|
||||
return makeUnique<shapeMixture>(*this);
|
||||
}
|
||||
|
||||
/// Polymorphic copy
|
||||
shapeMixture* clonePtr()const
|
||||
{
|
||||
return new shapeMixture(*this);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
/// Destructor
|
||||
~shapeMixture() = default;
|
||||
|
||||
//// - Methods
|
||||
// - Methods
|
||||
|
||||
/// The name of the next shape that should be inserted
|
||||
word getNextShapeName();
|
||||
|
||||
|
||||
/// The name of the n next shapes that should be inserted
|
||||
void getNextShapeNameN(size_t n, wordVector& names);
|
||||
|
||||
|
||||
/// Size of mixture (names)
|
||||
auto size()const {
|
||||
return names_.size();
|
||||
}
|
||||
|
||||
/// Total number inserted particles
|
||||
auto totalInserted()const {
|
||||
return sum(numberInserted_);
|
||||
}
|
||||
|
||||
//// - IO operatoins
|
||||
// - IO operatoins
|
||||
|
||||
bool read(const dictionary& dict);
|
||||
|
||||
bool write(dictionary& dict) const;
|
||||
|
@ -380,10 +380,13 @@ bool pFlow::sphereParticles::insertParticles
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
auto exclusionListAllPtr = getFieldObjectList();
|
||||
|
||||
auto newInsertedPtr = pStruct().insertPoints( position, setField, time(), exclusionListAllPtr());
|
||||
|
||||
|
||||
if(!newInsertedPtr)
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
|
@ -17,14 +17,13 @@ Licence:
|
||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
-----------------------------------------------------------------------------*/
|
||||
|
||||
/*!
|
||||
@class pFlow::sphereParticles
|
||||
|
||||
@brief Class for managing spherical particles
|
||||
|
||||
This is a top-level class that contains the essential components for
|
||||
defining spherical prticles in a DEM simulation.
|
||||
/**
|
||||
* @class pFlow::sphereParticles
|
||||
*
|
||||
* @brief Class for managing spherical particles
|
||||
*
|
||||
* This is a top-level class that contains the essential components for
|
||||
* defining spherical prticles in a DEM simulation.
|
||||
*/
|
||||
|
||||
#ifndef __sphereParticles_hpp__
|
||||
|
@ -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();
|
||||
|
||||
return false;
|
||||
Kokkos::parallel_for(
|
||||
"insertSetElement",
|
||||
policy(0,indices.size()), LAMBDA_HD(int32 i){
|
||||
dVec(dIndex(i))= val;
|
||||
});
|
||||
Kokkos::fence();
|
||||
|
||||
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;
|
||||
|
@ -379,11 +379,13 @@ pFlow::uniquePtr<pFlow::int32IndexContainer> pFlow::pointStructure::insertPoints
|
||||
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,
|
||||
|
@ -41,7 +41,7 @@ setFields
|
||||
{
|
||||
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)
|
||||
r Velocity realx3 (0 0 0); // rotational velocity (rad/s)
|
||||
shapeName word smallSphere; // name of the particle shape
|
||||
}
|
||||
|
||||
@ -53,8 +53,7 @@ setFields
|
||||
selectRandomInfo
|
||||
{
|
||||
begin 0; // begin index of points
|
||||
end 30000; // end index of points
|
||||
number 29999; // stride for selector
|
||||
end 29999; // end index of points
|
||||
}
|
||||
fieldValue // fields that the selector is applied to
|
||||
{
|
||||
|
209
tutorials/sphereGranFlow/RotaryAirLockValve/ReadMe.md
Normal file
209
tutorials/sphereGranFlow/RotaryAirLockValve/ReadMe.md
Normal file
@ -0,0 +1,209 @@
|
||||
# Problem Definition
|
||||
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**.
|
||||
* The rotor starts its ortation at t = 1.25 s at the rate of 2.1 rad/s.
|
||||
|
||||
|
||||
<html>
|
||||
<body>
|
||||
<div align="center"><b>
|
||||
a view of the Rotary Air-Lock Valve while rotating
|
||||
</div></b>
|
||||
<div align="center">
|
||||
<img src="https://github.com/PhasicFlow/phasicFlow/blob/media/media/rotaryAirLock.gif", width=700px>
|
||||
</div>
|
||||
<div align="center"><i>
|
||||
particles are colored according to time of insertion
|
||||
</div></i>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
# Setting up the Case
|
||||
As it has been explained in the previous simulations, the simulation case setup is based on text-based scripts. Here, the simulation case setup files are stored into three folders: `caseSetup`, `setting`, and `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 of rotor and its speed of rotation are defined. The rotation starts at t = **1.25 s** and ends at t = **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. All surface components are supplied in stl file format. All stl files should be stored under 'stl' folder.
|
||||
|
||||
```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);
|
||||
```
|
||||
### Insertion of Particles
|
||||
Insertion of particles starts from t = 0 s and ends at t = 7 s. A box is defined for the port from which particles are being inderted. The rate of insertion is 4000 particles per second.
|
||||
|
||||
<div align="center">
|
||||
in <b>settings/particleInsertion</b> file
|
||||
</div>
|
||||
|
||||
```C++
|
||||
topRegion
|
||||
{
|
||||
|
||||
// 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 between each 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;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 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 seeing 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 (here the simulaiton has no particle at the beginning).
|
||||
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,54 @@
|
||||
/* -------------------------------*- 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 region is considered for inserting particles.
|
||||
*/
|
||||
topRegion
|
||||
{
|
||||
|
||||
// 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 between each 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)
|
||||
rVelocity 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;
|
||||
|
2018
tutorials/sphereGranFlow/RotaryAirLockValve/stl/gear.stl
Normal file
2018
tutorials/sphereGranFlow/RotaryAirLockValve/stl/gear.stl
Normal file
File diff suppressed because it is too large
Load Diff
4692
tutorials/sphereGranFlow/RotaryAirLockValve/stl/surfaces.stl
Normal file
4692
tutorials/sphereGranFlow/RotaryAirLockValve/stl/surfaces.stl
Normal file
File diff suppressed because it is too large
Load Diff
0
tutorials/sphereGranFlow/RotatingDrumWithBaffles/cleanThisCase
Normal file → Executable file
0
tutorials/sphereGranFlow/RotatingDrumWithBaffles/cleanThisCase
Normal file → Executable file
0
tutorials/sphereGranFlow/RotatingDrumWithBaffles/runThisCase
Normal file → Executable file
0
tutorials/sphereGranFlow/RotatingDrumWithBaffles/runThisCase
Normal file → Executable file
@ -16,7 +16,7 @@ setFields
|
||||
// linear acceleration (m/s2)
|
||||
acceleration realx3 (0 0 0);
|
||||
// rotational velocity (rad/s)
|
||||
rotVelocity realx3 (0 0 0);
|
||||
rVelocity realx3 (0 0 0);
|
||||
// name of the particle shape
|
||||
shapeName word smallSphere;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ setFields
|
||||
acceleration realx3 (0 0 0);
|
||||
|
||||
// rotational velocity (rad/s)
|
||||
rotVelocity realx3 (0 0 0);
|
||||
rVelocity realx3 (0 0 0);
|
||||
|
||||
// name of the particle shape
|
||||
shapeName word smallSphere;
|
||||
|
@ -41,7 +41,7 @@ setFields
|
||||
{
|
||||
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)
|
||||
rVelocity realx3 (0 0 0); // rotational velocity (rad/s)
|
||||
shapeName word smallSphere; // name of the particle shape
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ setFields
|
||||
{
|
||||
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)
|
||||
rVelocity realx3 (0 0 0); // rotational velocity (rad/s)
|
||||
shapeName word lightSphere; // name of the particle shape
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ setFields
|
||||
{
|
||||
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)
|
||||
rVelocity realx3 (0 0 0); // rotational velocity (rad/s)
|
||||
shapeName word glassBead; // name of the particle shape
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ setFields
|
||||
{
|
||||
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)
|
||||
rVelocity realx3 (0 0 0); // rotational velocity (rad/s)
|
||||
shapeName word sphere1; // name of the particle shape
|
||||
}
|
||||
|
||||
|
208
tutorials/sphereGranFlow/screwConveyor/README.md
Normal file
208
tutorials/sphereGranFlow/screwConveyor/README.md
Normal file
@ -0,0 +1,208 @@
|
||||
# Simulating a screw conveyor {#screwConveyor}
|
||||
## Problem definition
|
||||
The problem is to simulate a screw conveyorwith the diameter 0.2 m and the length 1 m and 20 cm pitch. It is filled with 30,000 4-mm spherical particles. The timestep for integration is 0.00001 s.
|
||||
<div align="center"><b>
|
||||
a view of rotating drum
|
||||
|
||||
![]()
|
||||
</b></div>
|
||||
|
||||
***
|
||||
|
||||
## Setting up the case
|
||||
PhasicFlow simulation case setup is based on the text-based scripts that we provide in two folders located in the simulation case folder: `settings` and `caseSetup` (You can find the case setup files in the above folders.
|
||||
All the commands should be entered in the terminal while the current working directory is the simulation case folder (at the top of the `caseSetup` and `settings`).
|
||||
|
||||
|
||||
### Creating 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.
|
||||
|
||||
<div align="center">
|
||||
in <b>settings/particlesDict</b> file
|
||||
</div>
|
||||
|
||||
```C++
|
||||
positionParticles
|
||||
{
|
||||
method empty; // creates the required fields with zero particles (empty).
|
||||
|
||||
maxNumberOfParticles 50000; // maximum number of particles in the simulation
|
||||
mortonSorting Yes; // perform initial sorting based on morton code?
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
Enter the following command in the terminal to create the particles and store them in `0` folder.
|
||||
|
||||
`> particlesPhasicFlow`
|
||||
|
||||
### 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.
|
||||
|
||||
<div align="center">
|
||||
in <b>settings/geometryDict</b> file
|
||||
</div>
|
||||
|
||||
```C++
|
||||
motionModel rotatingAxisMotion;
|
||||
.
|
||||
.
|
||||
.
|
||||
rotatingAxisMotionInfo
|
||||
{
|
||||
rotAxis
|
||||
{
|
||||
p1 (1.09635 0.2010556 0.22313511); // first point for the axis of rotation
|
||||
p2 (0.0957492 0.201556 0.22313511); // second point for the axis of rotation
|
||||
omega 3; // rotation speed (rad/s)
|
||||
startTime 5;
|
||||
endTime 30;
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
In the dictionary `surfaces` you can define all the surfaces (shell) in the simulation. Two main options are available: built-in geometries in PhasicFlow, and providing surfaces with stl file. Here we use built-in geometries. In `cylinder` dictionary, a cylindrical shell with end helix, `material` name `prop1`, `motion` component `none` is defined. `helix` define plane helix at center of cylindrical shell, `material` name `prop1` and `motion` component `rotAxis`.'rotAxis' is use for helix because it is rotating and 'none' is use for shell because It is motionless.
|
||||
|
||||
<div align="center">
|
||||
in <b>settings/geometryDict</b> file
|
||||
</div>
|
||||
|
||||
```C++
|
||||
surfaces
|
||||
{
|
||||
helix
|
||||
{
|
||||
type stlWall; // type of the wall
|
||||
file helix.stl; // file name in stl folder
|
||||
material prop1; // material name of this wall
|
||||
motion rotAxis; // motion component name
|
||||
}
|
||||
|
||||
shell
|
||||
{
|
||||
type stlWall; // type of the wall
|
||||
file shell.stl; // file name in stl folder
|
||||
material prop1; // material name of this wall
|
||||
motion none; // motion component name
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
Enter the following command in the terminal to create the geometry and store it in `0/geometry` folder.
|
||||
|
||||
`> geometryPhasicFlow`
|
||||
|
||||
### Defining properties and interactions
|
||||
In the file `caseSetup/interaction` , you find properties of materials. `materials` defines a list of material names in the simulation and `densities` sets the corresponding density of each material name. model dictionary defines the interaction model for particle-particle and particle-wall interactions. `contactForceModel` selects the model for mechanical contacts (here nonlinear model with limited tangential displacement) and `rollingFrictionModel` selects the model for calculating rolling friction. Other required prosperities should be defined in this dictionary.
|
||||
|
||||
<div align="center">
|
||||
in <b>caseSetup/interaction</b> file
|
||||
</div>
|
||||
|
||||
```C++
|
||||
materials (prop1); // a list of materials names
|
||||
densities (1000.0); // density of materials [kg/m3]
|
||||
|
||||
contactListType sortedContactList;
|
||||
|
||||
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
|
||||
|
||||
et (1.0); // coefficient of tangential restitution
|
||||
|
||||
mu (0.3); // dynamic 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.
|
||||
|
||||
<div align="center">
|
||||
in <b>caseSetup/interaction</b> file
|
||||
</div>
|
||||
|
||||
```C++
|
||||
contactSearch
|
||||
{
|
||||
method NBS; // method for broad search particle-particle
|
||||
wallMapping cellMapping; // method for broad search particle-wall
|
||||
|
||||
NBSInfo
|
||||
{
|
||||
updateFrequency 10; // each 20 timesteps, update neighbor list
|
||||
sizeRatio 1.1; // bounding box size to particle diameter (max)
|
||||
}
|
||||
|
||||
cellMappingInfo
|
||||
{
|
||||
updateFrequency 10; // each 20 timesteps, update neighbor list
|
||||
cellExtent 0.6; // 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.
|
||||
|
||||
<div align="center">
|
||||
in <b>caseSetup/sphereShape</b> file
|
||||
</div>
|
||||
|
||||
```C++
|
||||
names (sphere1); // names of shapes
|
||||
diameters (0.01); // diameter of 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.
|
||||
|
||||
<div align="center">
|
||||
in <b>settings/settingsDict</b> file
|
||||
</div>
|
||||
|
||||
```C++
|
||||
dt 0.0001; // time step for integration (s)
|
||||
startTime 0; // start time for simulation
|
||||
endTime 20; // end time for simulation
|
||||
saveInterval 0.05; // time interval for saving the simulation
|
||||
timePrecision 6; // maximum number of digits for time folder
|
||||
g (0 -9.8 0); // gravity vector (m/s2)
|
||||
|
||||
domain
|
||||
{
|
||||
min (0.0 -0.06 0.001);
|
||||
max (1.2 1 0.5);
|
||||
}
|
||||
|
||||
integrationMethod AdamsBashforth3; // integration method
|
||||
|
||||
timersReport Yes; // report timers?
|
||||
|
||||
timersReportInterval 0.01; // time interval for reporting timers
|
||||
```
|
||||
|
||||
## 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.
|
||||
|
||||
`> 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 converts all the results (particles and geometry) to VTK format and store them in folder `VTK/`.
|
||||
|
||||
`> pFlowToVTK`
|
54
tutorials/sphereGranFlow/screwConveyor/caseSetup/interaction
Executable file
54
tutorials/sphereGranFlow/screwConveyor/caseSetup/interaction
Executable file
@ -0,0 +1,54 @@
|
||||
/* -------------------------------*- 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;
|
||||
|
||||
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
|
||||
|
||||
et (1.0); // coefficient of tangential restitution
|
||||
|
||||
mu (0.3); // dynamic friction
|
||||
|
||||
mur (0.1); // rolling friction
|
||||
|
||||
}
|
||||
|
||||
|
||||
contactSearch
|
||||
{
|
||||
method NBS; // method for broad search particle-particle
|
||||
wallMapping cellMapping; // method for broad search particle-wall
|
||||
|
||||
NBSInfo
|
||||
{
|
||||
updateFrequency 10; // each 20 timesteps, update neighbor list
|
||||
sizeRatio 1.1; // bounding box size to particle diameter (max)
|
||||
}
|
||||
|
||||
cellMappingInfo
|
||||
{
|
||||
updateFrequency 10; // each 20 timesteps, update neighbor list
|
||||
cellExtent 0.6; // bounding box for particle-wall search (> 0.5)
|
||||
}
|
||||
|
||||
}
|
46
tutorials/sphereGranFlow/screwConveyor/caseSetup/particleInsertion
Executable file
46
tutorials/sphereGranFlow/screwConveyor/caseSetup/particleInsertion
Executable file
@ -0,0 +1,46 @@
|
||||
/* -------------------------------*- C++ -*--------------------------------- *\
|
||||
| phasicFlow File |
|
||||
| copyright: www.cemf.ir |
|
||||
\* ------------------------------------------------------------------------- */
|
||||
objectName particleInsertion;
|
||||
objectType dicrionary;
|
||||
fileFormat ASCII;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
active yes; // is insertion active?
|
||||
|
||||
collisionCheck No; // not implemented for yes
|
||||
|
||||
/*
|
||||
five layers of particles are packed one-by-one using 5 insertion steps.
|
||||
*/
|
||||
|
||||
layer0
|
||||
{
|
||||
type cylinderRegion; // type of insertion region
|
||||
rate 5000; // insertion rate (particles/s)
|
||||
startTime 0; // (s)
|
||||
endTime 100; // (s)
|
||||
interval 0.03; //s
|
||||
|
||||
cylinderRegionInfo
|
||||
{
|
||||
radius 0.09; // radius of cylinder (m)
|
||||
p1 (0.22 0.73 0.25); // (m,m,m)
|
||||
p2 (0.22 0.742 0.25); // (m,m,m)
|
||||
}
|
||||
|
||||
setFields
|
||||
{
|
||||
velocity realx3 (0.0 -0.6 -0); // initial velocity of inserted particles
|
||||
}
|
||||
|
||||
mixture
|
||||
{
|
||||
sphere1 1; // mixture composition of inserted particles
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
12
tutorials/sphereGranFlow/screwConveyor/caseSetup/sphereShape
Executable file
12
tutorials/sphereGranFlow/screwConveyor/caseSetup/sphereShape
Executable file
@ -0,0 +1,12 @@
|
||||
/* -------------------------------*- C++ -*--------------------------------- *\
|
||||
| phasicFlow File |
|
||||
| copyright: www.cemf.ir |
|
||||
\* ------------------------------------------------------------------------- */
|
||||
objectName sphereDict;
|
||||
objectType sphereShape;
|
||||
fileFormat ASCII;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
names (sphere1); // names of shapes
|
||||
diameters (0.01); // diameter of shapes
|
||||
materials (prop1); // material names for shapes
|
7
tutorials/sphereGranFlow/screwConveyor/cleanThisCase
Executable file
7
tutorials/sphereGranFlow/screwConveyor/cleanThisCase
Executable 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
|
||||
|
||||
#------------------------------------------------------------------------------
|
21
tutorials/sphereGranFlow/screwConveyor/runThisCase
Executable file
21
tutorials/sphereGranFlow/screwConveyor/runThisCase
Executable file
@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
echo "\n<--------------------------------------------------------------------->"
|
||||
echo "1) Creating particles"
|
||||
echo "<--------------------------------------------------------------------->\n"
|
||||
particlesPhasicFlow
|
||||
|
||||
echo "\n<--------------------------------------------------------------------->"
|
||||
echo "2) Creating geometry"
|
||||
echo "<--------------------------------------------------------------------->\n"
|
||||
geometryPhasicFlow
|
||||
|
||||
echo "\n<--------------------------------------------------------------------->"
|
||||
echo "3) Running the case"
|
||||
echo "<--------------------------------------------------------------------->\n"
|
||||
sphereGranFlow
|
||||
|
||||
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
45
tutorials/sphereGranFlow/screwConveyor/settings/geometryDict
Normal file
45
tutorials/sphereGranFlow/screwConveyor/settings/geometryDict
Normal file
@ -0,0 +1,45 @@
|
||||
/* -------------------------------*- C++ -*--------------------------------- *\
|
||||
| phasicFlow File |
|
||||
| copyright: www.cemf.ir |
|
||||
\* ------------------------------------------------------------------------- */
|
||||
objectName geometryDict;
|
||||
objectType dictionary;
|
||||
fileFormat ASCII;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
// motion model: rotating object around an axis
|
||||
motionModel rotatingAxisMotion;
|
||||
|
||||
surfaces
|
||||
{
|
||||
helix
|
||||
{
|
||||
type stlWall; // type of the wall
|
||||
file helix.stl; // file name in stl folder
|
||||
material prop1; // material name of this wall
|
||||
motion rotAxis; // motion component name
|
||||
}
|
||||
|
||||
shell
|
||||
{
|
||||
type stlWall; // type of the wall
|
||||
file shell.stl; // file name in stl folder
|
||||
material prop1; // material name of this wall
|
||||
motion none; // motion component name
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
rotatingAxisMotionInfo
|
||||
{
|
||||
rotAxis
|
||||
{
|
||||
p1 (1.09635 0.2010556 0.22313511); // first point for the axis of rotation
|
||||
p2 (0.0957492 0.201556 0.22313511); // second point for the axis of rotation
|
||||
omega 3; // rotation speed (rad/s)
|
||||
startTime 5;
|
||||
endTime 30;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,40 @@
|
||||
/* -------------------------------*- C++ -*--------------------------------- *\
|
||||
| phasicFlow File |
|
||||
| copyright: www.cemf.ir |
|
||||
\* ------------------------------------------------------------------------- */
|
||||
objectName particlesDict;
|
||||
objectType dictionary;
|
||||
fileFormat ASCII;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
// positions particles
|
||||
positionParticles
|
||||
{
|
||||
method empty; // creates the required fields with zero particles (empty).
|
||||
|
||||
maxNumberOfParticles 50000; // maximum number of particles in the simulation
|
||||
mortonSorting Yes; // perform initial sorting based on morton
|
||||
|
||||
}
|
||||
|
||||
setFields
|
||||
{
|
||||
defaultValue
|
||||
{
|
||||
// linear velocity (m/s)
|
||||
velocity realx3 (0 0 0);
|
||||
|
||||
// linear acceleration (m/s2)
|
||||
acceleration realx3 (0 0 0);
|
||||
|
||||
// rotational velocity (rad/s)
|
||||
rVelocity realx3 (0 0 0);
|
||||
|
||||
// name of the particle shape
|
||||
shapeName word sphere1;
|
||||
}
|
||||
|
||||
selectors
|
||||
{}
|
||||
}
|
38
tutorials/sphereGranFlow/screwConveyor/settings/settingsDict
Normal file
38
tutorials/sphereGranFlow/screwConveyor/settings/settingsDict
Normal file
@ -0,0 +1,38 @@
|
||||
/* -------------------------------*- C++ -*--------------------------------- *\
|
||||
| phasicFlow File |
|
||||
| copyright: www.cemf.ir |
|
||||
\* ------------------------------------------------------------------------- */
|
||||
objectName settingsDict;
|
||||
objectType dictionary;
|
||||
fileFormat ASCII;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
run layerdSiloFilling;
|
||||
|
||||
dt 0.0001; // time step for integration (s)
|
||||
|
||||
startTime 0; // start time for simulation
|
||||
|
||||
endTime 20; // end time for simulation
|
||||
|
||||
saveInterval 0.05; // time interval for saving the simulation
|
||||
|
||||
timePrecision 6; // maximum number of digits for time folder
|
||||
|
||||
g (0 -9.8 0); // gravity vector (m/s2)
|
||||
|
||||
/*
|
||||
Simulation domain
|
||||
every particles that goes outside this domain is deleted.
|
||||
*/
|
||||
domain
|
||||
{
|
||||
min (0.0 -0.06 0.001);
|
||||
max (1.2 1 0.5);
|
||||
}
|
||||
|
||||
integrationMethod AdamsBashforth3; // integration method
|
||||
|
||||
timersReport Yes; // report timers?
|
||||
|
||||
timersReportInterval 0.01; // time interval for reporting timers
|
16550
tutorials/sphereGranFlow/screwConveyor/stl/helix.stl
Normal file
16550
tutorials/sphereGranFlow/screwConveyor/stl/helix.stl
Normal file
File diff suppressed because it is too large
Load Diff
2368
tutorials/sphereGranFlow/screwConveyor/stl/shell.stl
Normal file
2368
tutorials/sphereGranFlow/screwConveyor/stl/shell.stl
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user