Merge branch 'PhasicFlow:main' into main

This commit is contained in:
Wenxuan XU
2025-04-25 23:00:10 +08:00
committed by GitHub
142 changed files with 3668 additions and 1638 deletions

View File

@ -24,7 +24,7 @@ Licence:
#include "types.hpp" #include "types.hpp"
#include "span.hpp" #include "span.hpp"
namespace pFlow namespace pFlow::postprocessData
{ {
template<typename T> template<typename T>

View File

@ -26,20 +26,18 @@ Licence:
#include "fieldFunctions.hpp" #include "fieldFunctions.hpp"
#include "dictionary.hpp" #include "dictionary.hpp"
namespace pFlow
{
bool pointFieldGetType(const word& TYPENAME, word& fieldType, word& fieldSpace); bool pFlow::postprocessData::fieldsDataBase::loadPointStructureToTime()
}
bool pFlow::fieldsDataBase::loadPointStructureToTime()
{ {
return false; return false;
} }
bool pFlow::fieldsDataBase::checkForUpdate(const word &compoundName, bool forceUpdate) bool pFlow::postprocessData::fieldsDataBase::checkForUpdate
(
const word &compoundName,
bool forceUpdate
)
{ {
auto t = currentTime(); auto t = currentTime();
bool shouldUpdate = false; bool shouldUpdate = false;
@ -58,7 +56,10 @@ bool pFlow::fieldsDataBase::checkForUpdate(const word &compoundName, bool forceU
return shouldUpdate; return shouldUpdate;
} }
pFlow::span<pFlow::real> pFlow::fieldsDataBase::createOrGetRealField(const word &name) pFlow::span<pFlow::real> pFlow::postprocessData::fieldsDataBase::createOrGetRealField
(
const word &name
)
{ {
bool shouldUpdate = checkForUpdate(name); bool shouldUpdate = checkForUpdate(name);
@ -83,7 +84,10 @@ pFlow::span<pFlow::real> pFlow::fieldsDataBase::createOrGetRealField(const word
field.size()); field.size());
} }
pFlow::span<pFlow::real> pFlow::fieldsDataBase::createOrGetVolume(bool forceUpdate) pFlow::span<pFlow::real> pFlow::postprocessData::fieldsDataBase::createOrGetVolume
(
bool forceUpdate
)
{ {
const word fName = "volume"; const word fName = "volume";
bool shouldUpdate = checkForUpdate(fName, forceUpdate); bool shouldUpdate = checkForUpdate(fName, forceUpdate);
@ -119,7 +123,7 @@ pFlow::span<pFlow::real> pFlow::fieldsDataBase::createOrGetVolume(bool forceUpda
} }
pFlow::span<pFlow::real> pFlow::fieldsDataBase::createOrGetDensity(bool forceUpdate) pFlow::span<pFlow::real> pFlow::postprocessData::fieldsDataBase::createOrGetDensity(bool forceUpdate)
{ {
const word fName = "density"; const word fName = "density";
@ -155,7 +159,7 @@ pFlow::span<pFlow::real> pFlow::fieldsDataBase::createOrGetDensity(bool forceUpd
field.size()); field.size());
} }
pFlow::span<pFlow::real> pFlow::fieldsDataBase::createOrGetOne(bool forceUpdate) pFlow::span<pFlow::real> pFlow::postprocessData::fieldsDataBase::createOrGetOne(bool forceUpdate)
{ {
const word fName = "one"; const word fName = "one";
@ -182,7 +186,7 @@ pFlow::span<pFlow::real> pFlow::fieldsDataBase::createOrGetOne(bool forceUpdate)
field.size()); field.size());
} }
pFlow::span<pFlow::real> pFlow::fieldsDataBase::createOrGetMass(bool forceUpdate) pFlow::span<pFlow::real> pFlow::postprocessData::fieldsDataBase::createOrGetMass(bool forceUpdate)
{ {
const word fName = "mass"; const word fName = "mass";
@ -218,7 +222,7 @@ pFlow::span<pFlow::real> pFlow::fieldsDataBase::createOrGetMass(bool forceUpdate
field.size()); field.size());
} }
pFlow::span<pFlow::real> pFlow::fieldsDataBase::createOrGetI(bool forceUpdate) pFlow::span<pFlow::real> pFlow::postprocessData::fieldsDataBase::createOrGetI(bool forceUpdate)
{ {
const word fName = "I"; const word fName = "I";
@ -254,7 +258,7 @@ pFlow::span<pFlow::real> pFlow::fieldsDataBase::createOrGetI(bool forceUpdate)
field.size()); field.size());
} }
bool pFlow::fieldsDataBase::findFunction( bool pFlow::postprocessData::fieldsDataBase::findFunction(
const word &compoundFieldName, const word &compoundFieldName,
word &fieldName, word &fieldName,
fieldsDataBase::Functions &func) fieldsDataBase::Functions &func)
@ -360,7 +364,7 @@ bool pFlow::fieldsDataBase::findFunction(
return false; // No match return false; // No match
} }
bool pFlow::fieldsDataBase::inputOutputType bool pFlow::postprocessData::fieldsDataBase::inputOutputType
( (
fieldsDataBase::Functions func, fieldsDataBase::Functions func,
const word &inputType, const word &inputType,
@ -458,7 +462,7 @@ bool pFlow::fieldsDataBase::inputOutputType
return false; return false;
} }
pFlow::fieldsDataBase::fieldsDataBase pFlow::postprocessData::fieldsDataBase::fieldsDataBase
( (
systemControl& control, systemControl& control,
const dictionary& postDict, const dictionary& postDict,
@ -488,12 +492,12 @@ pFlow::fieldsDataBase::fieldsDataBase
} }
} }
pFlow::timeValue pFlow::fieldsDataBase::currentTime() const pFlow::timeValue pFlow::postprocessData::fieldsDataBase::currentTime() const
{ {
return time_.currentTime(); return time_.currentTime();
} }
bool pFlow::fieldsDataBase::getFieldTypeNameFunction bool pFlow::postprocessData::fieldsDataBase::getFieldTypeNameFunction
( (
const word& compoundName, const word& compoundName,
word& pointFieldName, word& pointFieldName,
@ -543,7 +547,7 @@ bool pFlow::fieldsDataBase::getFieldTypeNameFunction
return true; return true;
} }
bool pFlow::fieldsDataBase::getFieldType bool pFlow::postprocessData::fieldsDataBase::getFieldType
( (
const word& compoundName, const word& compoundName,
word& originalType, word& originalType,
@ -559,7 +563,7 @@ bool pFlow::fieldsDataBase::getFieldType
return true; return true;
} }
bool pFlow::fieldsDataBase::getFieldType bool pFlow::postprocessData::fieldsDataBase::getFieldType
( (
const word &compoundName, const word &compoundName,
word &typeAfterFunction word &typeAfterFunction
@ -575,7 +579,7 @@ bool pFlow::fieldsDataBase::getFieldType
return true; return true;
} }
pFlow::span<pFlow::realx3> pFlow::fieldsDataBase::updatePoints(bool forceUpdate) pFlow::span<pFlow::realx3> pFlow::postprocessData::fieldsDataBase::updatePoints(bool forceUpdate)
{ {
const word fName = "position"; const word fName = "position";
bool shouldUpdate = checkForUpdate(fName, forceUpdate); bool shouldUpdate = checkForUpdate(fName, forceUpdate);
@ -604,7 +608,7 @@ pFlow::span<pFlow::realx3> pFlow::fieldsDataBase::updatePoints(bool forceUpdate)
} }
pFlow::span<pFlow::realx3> pFlow::fieldsDataBase::updateFieldRealx3 pFlow::span<pFlow::realx3> pFlow::postprocessData::fieldsDataBase::updateFieldRealx3
( (
const word &compoundName, const word &compoundName,
bool forceUpdate bool forceUpdate
@ -640,7 +644,7 @@ pFlow::span<pFlow::realx3> pFlow::fieldsDataBase::updateFieldRealx3
} }
pFlow::span<pFlow::realx4> pFlow::fieldsDataBase::updateFieldRealx4 pFlow::span<pFlow::realx4> pFlow::postprocessData::fieldsDataBase::updateFieldRealx4
( (
const word &compoundName, const word &compoundName,
bool forceUpdate bool forceUpdate
@ -676,7 +680,7 @@ pFlow::span<pFlow::realx4> pFlow::fieldsDataBase::updateFieldRealx4
} }
pFlow::span<pFlow::real> pFlow::fieldsDataBase::updateFieldReal pFlow::span<pFlow::real> pFlow::postprocessData::fieldsDataBase::updateFieldReal
( (
const word &compoundName, const word &compoundName,
bool forceUpdate bool forceUpdate
@ -843,7 +847,7 @@ pFlow::span<pFlow::real> pFlow::fieldsDataBase::updateFieldReal
return span<real>(nullptr, 0); return span<real>(nullptr, 0);
} }
pFlow::span<pFlow::uint32> pFlow::fieldsDataBase::updateFieldUint32 pFlow::span<pFlow::uint32> pFlow::postprocessData::fieldsDataBase::updateFieldUint32
( (
const word& name, const word& name,
bool forceUpdate bool forceUpdate
@ -852,7 +856,7 @@ pFlow::span<pFlow::uint32> pFlow::fieldsDataBase::updateFieldUint32
return updateField<uint32>(name, forceUpdate); return updateField<uint32>(name, forceUpdate);
} }
pFlow::allPointFieldTypes pFlow::fieldsDataBase::updateFieldAll pFlow::postprocessData::allPointFieldTypes pFlow::postprocessData::fieldsDataBase::updateFieldAll
( (
const word &compoundName, const word &compoundName,
bool forceUpdate bool forceUpdate
@ -888,10 +892,24 @@ pFlow::allPointFieldTypes pFlow::fieldsDataBase::updateFieldAll
} }
} }
bool pFlow::postprocessData::fieldsDataBase::pointFieldGetType
(
const word& TYPENAME,
word& fieldType,
word& fieldSpace
)
{
std::regex match("pointField\\<([A-Za-z1-9_]*)\\,([A-Za-z1-9_]*)\\>");
std::smatch search;
if(!std::regex_match(TYPENAME, search, match)) return false;
if(search.size()!= 3) return false;
fieldType = search[1];
fieldSpace = search[2];
return true;
}
pFlow::uniquePtr<pFlow::postprocessData::fieldsDataBase>
pFlow::uniquePtr<pFlow::fieldsDataBase> pFlow::postprocessData::fieldsDataBase::create
pFlow::fieldsDataBase::create
( (
systemControl& control, systemControl& control,
const dictionary& postDict, const dictionary& postDict,
@ -931,14 +949,5 @@ pFlow::uniquePtr<pFlow::fieldsDataBase>
return nullptr; return nullptr;
} }
bool pFlow::pointFieldGetType(const word& TYPENAME, word& fieldType, word& fieldSpace)
{
std::regex match("pointField\\<([A-Za-z1-9_]*)\\,([A-Za-z1-9_]*)\\>");
std::smatch search;
if(!std::regex_match(TYPENAME, search, match)) return false;
if(search.size()!= 3) return false;
fieldType = search[1];
fieldSpace = search[2];
return true;
}

View File

@ -29,13 +29,15 @@ Licence:
#include "Map.hpp" #include "Map.hpp"
#include "shape.hpp" #include "shape.hpp"
namespace pFlow namespace pFlow
{ {
class dictionary;
class systemControl;
class Time;
}
class dictionary; namespace pFlow::postprocessData
class systemControl; {
class Time;
class fieldsDataBase class fieldsDataBase
@ -303,6 +305,12 @@ public:
return -1.0; return -1.0;
} }
static
bool pointFieldGetType(
const word& TYPENAME,
word& fieldType,
word& fieldSpace);
static static
uniquePtr<fieldsDataBase> create( uniquePtr<fieldsDataBase> create(
systemControl& control, systemControl& control,
@ -311,7 +319,7 @@ public:
timeValue startTime); timeValue startTime);
}; };
} // namespace pFlow } // namespace pFlow::postprocessData
#include "fieldsDataBaseTemplates.cpp" #include "fieldsDataBaseTemplates.cpp"

View File

@ -9,7 +9,7 @@
#include "types.hpp" #include "types.hpp"
#include "span.hpp" #include "span.hpp"
namespace pFlow namespace pFlow::postprocessData
{ {

View File

@ -23,9 +23,9 @@ Licence:
#include "fieldsDataBase.hpp" #include "fieldsDataBase.hpp"
template<pFlow::ValidFieldType T> template<pFlow::postprocessData::ValidFieldType T>
inline inline
pFlow::span<T> pFlow::fieldsDataBase::updateField(const word& name, bool forceUpdate) pFlow::span<T> pFlow::postprocessData::fieldsDataBase::updateField(const word& name, bool forceUpdate)
{ {
bool shouldUpdate = checkForUpdate(name, forceUpdate); bool shouldUpdate = checkForUpdate(name, forceUpdate);
@ -40,8 +40,8 @@ pFlow::span<T> pFlow::fieldsDataBase::updateField(const word& name, bool forceUp
{ {
if( loadPointFieldToTime(name) ) if( loadPointFieldToTime(name) )
{ {
const auto& pField = time_.lookupObject<pointField_D<T>>(name); const auto& pField = time_.template lookupObject<pointField_D<T>>(name);
allFields_.emplaceBackOrReplace<FieldTypeHost<T>>( allFields_.template emplaceBackOrReplace<FieldTypeHost<T>>(
name, name,
pField.activeValuesHost()); pField.activeValuesHost());
} }
@ -63,9 +63,9 @@ pFlow::span<T> pFlow::fieldsDataBase::updateField(const word& name, bool forceUp
} }
template<pFlow::ValidFieldType T> template<pFlow::postprocessData::ValidFieldType T>
inline inline
pFlow::span<T> pFlow::fieldsDataBase::updateReservedField pFlow::span<T> pFlow::postprocessData::fieldsDataBase::updateReservedField
( (
const word& name, const word& name,
bool forceUpdate bool forceUpdate

View File

@ -3,38 +3,38 @@
#include "dynamicPointStructure.hpp" #include "dynamicPointStructure.hpp"
#include "vocabs.hpp" #include "vocabs.hpp"
namespace pFlow
{
bool pointFieldGetType(const word& TYPENAME, word& fieldType, word& fieldSpace);
}
bool pFlow::simulationFieldsDataBase::pointFieldNameExists(const word &name) const
bool pFlow::postprocessData::simulationFieldsDataBase::pointFieldNameExists(const word &name) const
{ {
return time().lookupObjectName(name); return time().lookupObjectName(name);
} }
bool pFlow::simulationFieldsDataBase::loadPointFieldToTime(const word &name) bool pFlow::postprocessData::simulationFieldsDataBase::loadPointFieldToTime(const word &name)
{ {
return time().lookupObjectName(name); return time().lookupObjectName(name);
} }
bool pFlow::simulationFieldsDataBase::loadPointStructureToTime() bool pFlow::postprocessData::simulationFieldsDataBase::loadPointStructureToTime()
{ {
// it is already in the Time object // it is already in the Time object
return time().lookupObjectName(pointStructureFile__); return time().lookupObjectName(pointStructureFile__);
} }
const pFlow::shape& pFlow::simulationFieldsDataBase::getShape() const const pFlow::shape& pFlow::postprocessData::simulationFieldsDataBase::getShape() const
{ {
return shape_; return shape_;
} }
pFlow::word pFlow::simulationFieldsDataBase::getPointFieldType(const word &name) const pFlow::word pFlow::postprocessData::simulationFieldsDataBase::getPointFieldType
(
const word &name
) const
{ {
word pfType = time().lookupObjectTypeName(name); word pfType = time().lookupObjectTypeName(name);
word type, space; word type, space;
if(!pointFieldGetType(pfType, type, space)) if(!fieldsDataBase::pointFieldGetType(pfType, type, space))
{ {
fatalErrorInFunction fatalErrorInFunction
<<"Error in retriving the type of pointField " <<"Error in retriving the type of pointField "
@ -44,7 +44,7 @@ pFlow::word pFlow::simulationFieldsDataBase::getPointFieldType(const word &name)
return type; return type;
} }
pFlow::simulationFieldsDataBase::simulationFieldsDataBase pFlow::postprocessData::simulationFieldsDataBase::simulationFieldsDataBase
( (
systemControl &control, systemControl &control,
const dictionary& postDict, const dictionary& postDict,
@ -60,7 +60,7 @@ pFlow::simulationFieldsDataBase::simulationFieldsDataBase
{ {
} }
const pFlow::pointStructure &pFlow::simulationFieldsDataBase::pStruct() const const pFlow::pointStructure &pFlow::postprocessData::simulationFieldsDataBase::pStruct() const
{ {
return return
static_cast<const pointStructure&> static_cast<const pointStructure&>

View File

@ -23,7 +23,7 @@ Licence:
#include "fieldsDataBase.hpp" #include "fieldsDataBase.hpp"
namespace pFlow namespace pFlow::postprocessData
{ {
class simulationFieldsDataBase class simulationFieldsDataBase

View File

@ -1,6 +1,9 @@
#include "PostprocessOperationAvMassVelocity.hpp" #include "PostprocessOperationAvMassVelocity.hpp"
pFlow::PostprocessOperationAvMassVelocity::PostprocessOperationAvMassVelocity namespace pFlow::postprocessData
{
PostprocessOperationAvMassVelocity::PostprocessOperationAvMassVelocity
( (
const dictionary &opDict, const dictionary &opDict,
const regionPoints &regPoints, const regionPoints &regPoints,
@ -18,3 +21,5 @@ pFlow::PostprocessOperationAvMassVelocity::PostprocessOperationAvMassVelocity
) )
{ {
} }
}

View File

@ -132,7 +132,7 @@ Licence:
#include "regionField.hpp" #include "regionField.hpp"
#include "includeMask.hpp" #include "includeMask.hpp"
namespace pFlow namespace pFlow::postprocessData
{ {
@ -168,6 +168,6 @@ public:
}; };
} } // namespace pFlow::postprocessData
#endif //__PostprocessOperationAvMassVelocity_hpp__ #endif //__PostprocessOperationAvMassVelocity_hpp__

View File

@ -3,8 +3,11 @@
#include "fieldsDataBase.hpp" #include "fieldsDataBase.hpp"
#include "operationFunctions.hpp" #include "operationFunctions.hpp"
namespace pFlow::postprocessData
{
/// Constructs average processor and initializes result field based on input field type /// Constructs average processor and initializes result field based on input field type
pFlow::PostprocessOperationAverage::PostprocessOperationAverage PostprocessOperationAverage::PostprocessOperationAverage
( (
const dictionary &opDict, const dictionary &opDict,
const regionPoints &regPoints, const regionPoints &regPoints,
@ -39,7 +42,7 @@ pFlow::PostprocessOperationAverage::PostprocessOperationAverage
} }
} }
pFlow::PostprocessOperationAverage::PostprocessOperationAverage PostprocessOperationAverage::PostprocessOperationAverage
( (
const dictionary &opDict, const dictionary &opDict,
const word &fieldName, const word &fieldName,
@ -77,8 +80,9 @@ pFlow::PostprocessOperationAverage::PostprocessOperationAverage
} }
} }
/// Performs weighted average of field values within each region /// Performs weighted average of field values within each region
bool pFlow::PostprocessOperationAverage::execute bool PostprocessOperationAverage::execute
( (
const std::vector<span<real>>& weights, const std::vector<span<real>>& weights,
const regionField<real>& volFactor const regionField<real>& volFactor
@ -109,7 +113,7 @@ bool pFlow::PostprocessOperationAverage::execute
allField) allField)
); );
if(calculateFluctuation2_) if(calculateFluctuation2_())
{ {
auto& processedRegField = processedRegFieldPtr_(); auto& processedRegField = processedRegFieldPtr_();
fluctuation2FieldPtr_ = makeUnique<processedRegFieldType> fluctuation2FieldPtr_ = makeUnique<processedRegFieldType>
@ -138,3 +142,40 @@ bool pFlow::PostprocessOperationAverage::execute
return true; return true;
} }
bool PostprocessOperationAverage::write(const fileSystem &parDir) const
{
if(! postprocessOperation::write(parDir))
{
return false;
}
if(!calculateFluctuation2_())
{
return true;
}
auto ti = time().TimeInfo();
if(!os2Ptr_)
{
fileSystem path = parDir+(
processedFieldName()+"_prime2" + ".Start_" + ti.timeName());
os2Ptr_ = makeUnique<oFstream>(path);
regPoints().write(os2Ptr_());
}
std::visit
(
[&](auto&& arg)->bool
{
return writeField(os2Ptr_(), ti.t(), arg, threshold());
},
fluctuation2FieldPtr_()
);
return true;
}
} // namespace pFlow::postprocessData

View File

@ -132,10 +132,9 @@ Licence:
#include "regionField.hpp" #include "regionField.hpp"
#include "includeMask.hpp" #include "includeMask.hpp"
namespace pFlow namespace pFlow::postprocessData
{ {
class PostprocessOperationAverage class PostprocessOperationAverage
: :
public postprocessOperation public postprocessOperation
@ -150,6 +149,9 @@ private:
uniquePtr<processedRegFieldType> fluctuation2FieldPtr_ = nullptr; uniquePtr<processedRegFieldType> fluctuation2FieldPtr_ = nullptr;
/// Pointer to the output stream for writing fluctuation2 results
mutable uniquePtr<oFstream> os2Ptr_ = nullptr;
public: public:
TypeInfo("PostprocessOperation<average>"); TypeInfo("PostprocessOperation<average>");
@ -190,6 +192,10 @@ public:
return processedRegFieldPtr_(); return processedRegFieldPtr_();
} }
/// write to os stream
bool write(const fileSystem &parDir)const override;
/// @brief Execute average operation on field values /// @brief Execute average operation on field values
/// @param weights Weight factors for particles /// @param weights Weight factors for particles
/// @return True if successful /// @return True if successful
@ -200,6 +206,6 @@ public:
}; };
} } // namespace pFlow::postprocessData
#endif //__PostprocessOperationAverage_hpp__ #endif //__PostprocessOperationAverage_hpp__

View File

@ -3,8 +3,11 @@
#include "fieldsDataBase.hpp" #include "fieldsDataBase.hpp"
#include "operationFunctions.hpp" #include "operationFunctions.hpp"
namespace pFlow::postprocessData
{
/// Constructs sum processor and initializes result field based on input field type /// Constructs sum processor and initializes result field based on input field type
pFlow::PostprocessOperationSum::PostprocessOperationSum PostprocessOperationSum::PostprocessOperationSum
( (
const dictionary &opDict, const dictionary &opDict,
const regionPoints &regPoints, const regionPoints &regPoints,
@ -39,7 +42,7 @@ pFlow::PostprocessOperationSum::PostprocessOperationSum
} }
/// Performs weighted sum of field values within each region /// Performs weighted sum of field values within each region
bool pFlow::PostprocessOperationSum::execute bool PostprocessOperationSum::execute
( (
const std::vector<span<real>>& weights, const std::vector<span<real>>& weights,
const regionField<real>& volFactor const regionField<real>& volFactor
@ -72,3 +75,6 @@ bool pFlow::PostprocessOperationSum::execute
return true; return true;
} }
}

View File

@ -129,7 +129,7 @@ Licence:
#include "regionField.hpp" #include "regionField.hpp"
#include "includeMask.hpp" #include "includeMask.hpp"
namespace pFlow namespace pFlow::postprocessData
{ {
@ -182,6 +182,6 @@ public:
}; };
} } // namespace pFlow::postprocessData
#endif //__PostprocessOperationSum_hpp__ #endif //__PostprocessOperationSum_hpp__

View File

@ -28,7 +28,7 @@ Licence:
#include "regionField.hpp" #include "regionField.hpp"
#include "includeMask.hpp" #include "includeMask.hpp"
namespace pFlow namespace pFlow::postprocessData
{ {
template<typename T> template<typename T>
@ -190,6 +190,6 @@ regionField<T> executeFluctuation2Operation
return processedField; return processedField;
} }
} // namespace pFlow } // namespace pFlow::postprocessData
#endif //__operationFunctions_hpp__ #endif //__operationFunctions_hpp__

View File

@ -61,7 +61,7 @@ Licence:
#include "Time.hpp" #include "Time.hpp"
namespace pFlow namespace pFlow::postprocessData
{ {
template<typename T, typename Operator> template<typename T, typename Operator>
@ -270,7 +270,7 @@ public:
}; };
} // pFlow } // pFlow::postprocessData
#endif //__IncludeMask_hpp__ #endif //__IncludeMask_hpp__

View File

@ -20,31 +20,34 @@ Licence:
#include "IncludeMask.hpp" #include "IncludeMask.hpp"
namespace pFlow::postprocessData
{
// real // real
template class pFlow::IncludeMask<pFlow::real, pFlow::compareOne<pFlow::real, pFlow::lessThanOp> >; template class IncludeMask<real, compareOne<real, lessThanOp> >;
template class pFlow::IncludeMask<pFlow::real, pFlow::compareOne<pFlow::real, pFlow::lessThanEqOp> >; template class IncludeMask<real, compareOne<real, lessThanEqOp> >;
template class pFlow::IncludeMask<pFlow::real, pFlow::compareOne<pFlow::real, pFlow::greaterThanOp> >; template class IncludeMask<real, compareOne<real, greaterThanOp> >;
template class pFlow::IncludeMask<pFlow::real, pFlow::compareOne<pFlow::real, pFlow::greaterThanEqOp> >; template class IncludeMask<real, compareOne<real, greaterThanEqOp> >;
template class pFlow::IncludeMask<pFlow::real, pFlow::compareOne<pFlow::real, pFlow::equalOp> >; template class IncludeMask<real, compareOne<real, equalOp> >;
template class pFlow::IncludeMask<pFlow::real, pFlow::compareTwo<pFlow::real, pFlow::betweenOp> >; template class IncludeMask<real, compareTwo<real, betweenOp> >;
template class pFlow::IncludeMask<pFlow::real, pFlow::compareTwo<pFlow::real, pFlow::betweenEqOp> >; template class IncludeMask<real, compareTwo<real, betweenEqOp> >;
template class pFlow::IncludeMask<pFlow::real, pFlow::allOp<pFlow::real>>; template class IncludeMask<real, allOp<real>>;
// realx3 // realx3
template class pFlow::IncludeMask<pFlow::realx3, pFlow::compareOne<pFlow::realx3, pFlow::lessThanOp> >; template class IncludeMask<realx3, compareOne<realx3, lessThanOp> >;
template class pFlow::IncludeMask<pFlow::realx3, pFlow::compareOne<pFlow::realx3, pFlow::lessThanEqOp> >; template class IncludeMask<realx3, compareOne<realx3, lessThanEqOp> >;
template class pFlow::IncludeMask<pFlow::realx3, pFlow::compareOne<pFlow::realx3, pFlow::greaterThanOp> >; template class IncludeMask<realx3, compareOne<realx3, greaterThanOp> >;
template class pFlow::IncludeMask<pFlow::realx3, pFlow::compareOne<pFlow::realx3, pFlow::greaterThanEqOp> >; template class IncludeMask<realx3, compareOne<realx3, greaterThanEqOp> >;
template class pFlow::IncludeMask<pFlow::realx3, pFlow::compareOne<pFlow::realx3, pFlow::equalOp> >; template class IncludeMask<realx3, compareOne<realx3, equalOp> >;
template class pFlow::IncludeMask<pFlow::realx3, pFlow::compareTwo<pFlow::realx3, pFlow::betweenOp> >; template class IncludeMask<realx3, compareTwo<realx3, betweenOp> >;
template class pFlow::IncludeMask<pFlow::realx3, pFlow::compareTwo<pFlow::realx3, pFlow::betweenEqOp> >; template class IncludeMask<realx3, compareTwo<realx3, betweenEqOp> >;
// realx4 } // postprocessData

View File

@ -24,7 +24,10 @@ Licence:
#include "fieldsDataBase.hpp" #include "fieldsDataBase.hpp"
pFlow::includeMask::includeMask namespace pFlow::postprocessData
{
includeMask::includeMask
( (
const dictionary& dict, const dictionary& dict,
fieldsDataBase& fieldDB fieldsDataBase& fieldDB
@ -33,7 +36,7 @@ pFlow::includeMask::includeMask
database_(fieldDB) database_(fieldDB)
{} {}
pFlow::includeMask::includeMask includeMask::includeMask
( (
const word &type, const word &type,
const dictionary &opDict, const dictionary &opDict,
@ -44,7 +47,7 @@ pFlow::includeMask::includeMask
{ {
} }
pFlow::uniquePtr<pFlow::includeMask> pFlow::includeMask::create uniquePtr<includeMask> includeMask::create
( (
const dictionary& opDict, const dictionary& opDict,
fieldsDataBase& fieldsDB fieldsDataBase& fieldsDB
@ -97,8 +100,7 @@ pFlow::uniquePtr<pFlow::includeMask> pFlow::includeMask::create
return nullptr; return nullptr;
} }
pFlow::uniquePtr<pFlow::includeMask> uniquePtr<includeMask> includeMask::create
pFlow::includeMask::create
( (
const word &type, const word &type,
const dictionary &opDict, const dictionary &opDict,
@ -150,3 +152,5 @@ pFlow::uniquePtr<pFlow::includeMask>
} }
return nullptr; return nullptr;
} }
}

View File

@ -47,11 +47,15 @@ Licence:
#include "virtualConstructor.hpp" #include "virtualConstructor.hpp"
namespace pFlow namespace pFlow
{
class dictionary;
}
namespace pFlow::postprocessData
{ {
// forward declaration // forward declaration
class fieldsDataBase; class fieldsDataBase;
class dictionary;
class includeMask class includeMask
@ -188,7 +192,7 @@ public:
} // pFlow } // pFlow::postprocessData
#endif //__IncludeMask_hpp__ #endif //__IncludeMask_hpp__

View File

@ -24,7 +24,7 @@ Licence:
#include "types.hpp" #include "types.hpp"
#include "dictionary.hpp" #include "dictionary.hpp"
namespace pFlow namespace pFlow::postprocessData
{ {
template<typename T> template<typename T>
@ -176,6 +176,6 @@ public:
} }
}; };
} } // namespace pFlow::postprocessData
#endif //__maskOperation_hpp__ #endif //__maskOperation_hpp__

View File

@ -23,66 +23,11 @@ Licence:
#include "regionPoints.hpp" #include "regionPoints.hpp"
#include "fieldsDataBase.hpp" #include "fieldsDataBase.hpp"
namespace pFlow
namespace pFlow::postprocessData
{ {
template<typename T> postprocessOperation::postprocessOperation
inline
bool writeField
(
iOstream& os,
timeValue t,
const regionField<T> field,
uint32 threshold,
const T& defValue=T{}
)
{
const auto& regPoints = field.regPoints();
const uint32 n = field.size();
os<<t<<tab;
for(uint32 i=0; i<n; i++)
{
auto numPar = regPoints.indices(i).size();
if(numPar >= threshold)
{
if constexpr(std::is_same_v<T,realx3>)
{
os<<field[i].x()<<' '<<field[i].y()<<' '<<field[i].z()<<tab;
}
else if constexpr( std::is_same_v<T,realx4>)
{
os << field[i].x() << ' ' << field[i].y() << ' ' << field[i].z() << ' ' << field[i].w() << tab;
}
else
{
os<<field[i]<<tab;
}
}
else
{
if constexpr(std::is_same_v<T,realx3>)
{
os<<defValue.x()<<' '<<defValue.y()<<' '<<defValue.z()<<tab;
}
else if constexpr( std::is_same_v<T,realx4>)
{
os << defValue.x() << ' ' << defValue.y() << ' ' << defValue.z() << ' ' << defValue.w() << tab;
}
else
{
os<<defValue<<tab;
}
}
}
os<<endl;
return true;
}
}
pFlow::postprocessOperation::postprocessOperation
( (
const dictionary &opDict, const dictionary &opDict,
const regionPoints& regPoints, const regionPoints& regPoints,
@ -100,7 +45,7 @@ pFlow::postprocessOperation::postprocessOperation
) )
{} {}
pFlow::postprocessOperation::postprocessOperation postprocessOperation::postprocessOperation
( (
const dictionary &opDict, const dictionary &opDict,
const word &fieldName, const word &fieldName,
@ -147,12 +92,12 @@ pFlow::postprocessOperation::postprocessOperation
fatalExit; fatalExit;
} }
} }
const pFlow::Time& pFlow::postprocessOperation::time() const const Time& postprocessOperation::time() const
{ {
return database_.time(); return database_.time();
} }
bool pFlow::postprocessOperation::write(const fileSystem &parDir) const bool postprocessOperation::write(const fileSystem &parDir) const
{ {
auto ti = time().TimeInfo(); auto ti = time().TimeInfo();
@ -179,11 +124,12 @@ bool pFlow::postprocessOperation::write(const fileSystem &parDir) const
return true; return true;
} }
pFlow::uniquePtr<pFlow::postprocessOperation> uniquePtr<postprocessOperation> postprocessOperation::create
pFlow::postprocessOperation::create( (
const dictionary &opDict, const dictionary &opDict,
const regionPoints &regPoints, const regionPoints &regPoints,
fieldsDataBase &fieldsDB) fieldsDataBase &fieldsDB
)
{ {
word func = opDict.getVal<word>("function"); word func = opDict.getVal<word>("function");
word method = angleBracketsNames("PostprocessOperation", func); word method = angleBracketsNames("PostprocessOperation", func);
@ -209,3 +155,5 @@ pFlow::postprocessOperation::create(
return nullptr; return nullptr;
} }
} }
}

View File

@ -76,23 +76,19 @@ Licence:
#include "oFstream.hpp" #include "oFstream.hpp"
#include "regionField.hpp" #include "regionField.hpp"
#include "includeMask.hpp" #include "includeMask.hpp"
#include "postprocessOperationFunctions.hpp"
namespace pFlow namespace pFlow
{ {
class Time;
}
/// Type alias for processed region field types. namespace pFlow::postprocessData
/// Only regionField<real>, regionField<realx3>, and regionField<realx4> are supported {
/// in the postprocessOperation class.
using processedRegFieldType = std::variant
<
regionField<real>,
regionField<realx3>,
regionField<realx4>
>;
/// - forward declaration /// - forward declaration
class fieldsDataBase; class fieldsDataBase;
class Time;
class postprocessOperation class postprocessOperation
{ {
@ -103,7 +99,7 @@ public:
private: private:
/// Dictionary containing operation-specific parameters. /// Dictionary containing operation-specific parameters.
dictionary operationDict_; pFlow::dictionary operationDict_;
/// This Threshold is used to exclude the regions which contain /// This Threshold is used to exclude the regions which contain
/// fewer than this value. /// fewer than this value.
@ -273,6 +269,6 @@ public:
}; };
} } // namespace pFlow::postprocessData
#endif //__postprocessOperation_hpp__ #endif //__postprocessOperation_hpp__

View File

@ -0,0 +1,100 @@
/*------------------------------- 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 __postprocessOperationFunctions_hpp__
#define __postprocessOperationFunctions_hpp__
#include <variant>
#include "types.hpp"
#include "iOstream.hpp"
#include "regionField.hpp"
namespace pFlow::postprocessData
{
/// Type alias for processed region field types.
/// Only regionField<real>, regionField<realx3>, and regionField<realx4> are supported
/// in the postprocessOperation class.
using processedRegFieldType = std::variant
<
regionField<real>,
regionField<realx3>,
regionField<realx4>
>;
template<typename T>
inline
bool writeField
(
iOstream& os,
timeValue t,
const regionField<T> field,
uint32 threshold,
const T& defValue=T{}
)
{
const auto& regPoints = field.regPoints();
const uint32 n = field.size();
os<<t<<tab;
for(uint32 i=0; i<n; i++)
{
auto numPar = regPoints.indices(i).size();
if(numPar >= threshold)
{
if constexpr(std::is_same_v<T,realx3>)
{
os<<field[i].x()<<' '<<field[i].y()<<' '<<field[i].z()<<tab;
}
else if constexpr( std::is_same_v<T,realx4>)
{
os << field[i].x() << ' ' << field[i].y() << ' ' << field[i].z() << ' ' << field[i].w() << tab;
}
else
{
os<<field[i]<<tab;
}
}
else
{
if constexpr(std::is_same_v<T,realx3>)
{
os<<defValue.x()<<' '<<defValue.y()<<' '<<defValue.z()<<tab;
}
else if constexpr( std::is_same_v<T,realx4>)
{
os << defValue.x() << ' ' << defValue.y() << ' ' << defValue.z() << ' ' << defValue.w() << tab;
}
else
{
os<<defValue<<tab;
}
}
}
os<<endl;
return true;
}
} // namespace pFlow::postprocessData
#endif //__postprocessOperationFunctions_hpp__

View File

@ -20,7 +20,7 @@ Licence:
-----------------------------------------------------------------------------*/ -----------------------------------------------------------------------------*/
template<typename RegionType, typename ProcessMethodType> template<typename RegionType, typename ProcessMethodType>
pFlow::PostprocessComponent<RegionType,ProcessMethodType>::PostprocessComponent pFlow::postprocessData::PostprocessComponent<RegionType,ProcessMethodType>::PostprocessComponent
( (
const dictionary& dict, const dictionary& dict,
fieldsDataBase& fieldsDB, fieldsDataBase& fieldsDB,
@ -61,7 +61,7 @@ pFlow::PostprocessComponent<RegionType,ProcessMethodType>::PostprocessComponent
template <typename RegionType, typename ProcessMethodType> template <typename RegionType, typename ProcessMethodType>
bool pFlow::PostprocessComponent<RegionType, ProcessMethodType>::execute bool pFlow::postprocessData::PostprocessComponent<RegionType, ProcessMethodType>::execute
( (
const timeInfo &ti, const timeInfo &ti,
bool forceUpdate bool forceUpdate
@ -129,7 +129,7 @@ bool pFlow::PostprocessComponent<RegionType, ProcessMethodType>::execute
template <typename RegionType, typename ProcessMethodType> template <typename RegionType, typename ProcessMethodType>
inline inline
bool pFlow::PostprocessComponent<RegionType, ProcessMethodType>::write bool pFlow::postprocessData::PostprocessComponent<RegionType, ProcessMethodType>::write
( (
const fileSystem &parDir const fileSystem &parDir
) const ) const

View File

@ -32,7 +32,7 @@ Licence:
#include "regionPoints.hpp" #include "regionPoints.hpp"
#include "regionField.hpp" #include "regionField.hpp"
namespace pFlow namespace pFlow::postprocessData
{ {
template<typename RegionType, typename ProcessMethodType> template<typename RegionType, typename ProcessMethodType>

View File

@ -24,7 +24,7 @@ Licence:
#include "PostprocessComponent.hpp" #include "PostprocessComponent.hpp"
#include "arithmetic.hpp" #include "arithmetic.hpp"
namespace pFlow namespace pFlow::postprocessData
{ {
template<typename RegionType> template<typename RegionType>

View File

@ -25,7 +25,7 @@ Licence:
#include "GaussianDistribution.hpp" #include "GaussianDistribution.hpp"
#include "numericConstants.hpp" #include "numericConstants.hpp"
namespace pFlow namespace pFlow::postprocessData
{ {
template<typename RegionType> template<typename RegionType>

View File

@ -24,7 +24,7 @@ Licence:
#include "PostprocessComponent.hpp" #include "PostprocessComponent.hpp"
#include "uniformDistribution.hpp" #include "uniformDistribution.hpp"
namespace pFlow namespace pFlow::postprocessData
{ {
template<typename RegionType> template<typename RegionType>

View File

@ -27,16 +27,18 @@ Licence:
#include "lineRegionPoints.hpp" #include "lineRegionPoints.hpp"
#include "multipleSpheresRegionPoints.hpp" #include "multipleSpheresRegionPoints.hpp"
namespace pFlow::postprocessData
{
template class PostprocessComponentGaussian<sphereRegionPoints>;
template class PostprocessComponentUniform<sphereRegionPoints>;
template class PostprocessComponentArithmetic<sphereRegionPoints>;
template class pFlow::PostprocessComponentGaussian<pFlow::sphereRegionPoints>; template class PostprocessComponentGaussian<multipleSpheresRegionPoints>;
template class pFlow::PostprocessComponentUniform<pFlow::sphereRegionPoints>; template class PostprocessComponentUniform<multipleSpheresRegionPoints>;
template class pFlow::PostprocessComponentArithmetic<pFlow::sphereRegionPoints>; template class PostprocessComponentArithmetic<multipleSpheresRegionPoints>;
template class pFlow::PostprocessComponentGaussian<pFlow::multipleSpheresRegionPoints>; template class PostprocessComponentGaussian<lineRegionPoints>;
template class pFlow::PostprocessComponentUniform<pFlow::multipleSpheresRegionPoints>; template class PostprocessComponentUniform<lineRegionPoints>;
template class pFlow::PostprocessComponentArithmetic<pFlow::multipleSpheresRegionPoints>; template class PostprocessComponentArithmetic<lineRegionPoints>;
template class pFlow::PostprocessComponentGaussian<pFlow::lineRegionPoints>;
template class pFlow::PostprocessComponentUniform<pFlow::lineRegionPoints>;
template class pFlow::PostprocessComponentArithmetic<pFlow::lineRegionPoints>;
}

View File

@ -1,7 +1,27 @@
/*------------------------------- 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 "particleProbePostprocessComponent.hpp" #include "particleProbePostprocessComponent.hpp"
#include "Time.hpp" #include "Time.hpp"
namespace pFlow namespace pFlow::postprocessData
{ {
template<typename T> template<typename T>
@ -62,7 +82,7 @@ inline bool writeField
} }
pFlow::particleProbePostprocessComponent::particleProbePostprocessComponent pFlow::postprocessData::particleProbePostprocessComponent::particleProbePostprocessComponent
( (
const dictionary &dict, const dictionary &dict,
fieldsDataBase &fieldsDB, fieldsDataBase &fieldsDB,
@ -81,7 +101,7 @@ pFlow::particleProbePostprocessComponent::particleProbePostprocessComponent
name_(dict.name()) name_(dict.name())
{} {}
bool pFlow::particleProbePostprocessComponent::execute bool pFlow::postprocessData::particleProbePostprocessComponent::execute
( (
const timeInfo &ti, const timeInfo &ti,
bool forceExecute bool forceExecute
@ -126,7 +146,7 @@ bool pFlow::particleProbePostprocessComponent::execute
} }
bool pFlow::particleProbePostprocessComponent::write(const fileSystem& parDir)const bool pFlow::postprocessData::particleProbePostprocessComponent::write(const fileSystem& parDir)const
{ {
if(! executed_ ) return true; if(! executed_ ) return true;

View File

@ -27,7 +27,7 @@ Licence:
#include "regionField.hpp" #include "regionField.hpp"
#include "oFstream.hpp" #include "oFstream.hpp"
namespace pFlow namespace pFlow::postprocessData
{ {

View File

@ -1,9 +1,29 @@
/*------------------------------- 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 "postprocessComponent.hpp" #include "postprocessComponent.hpp"
#include "fieldsDataBase.hpp" #include "fieldsDataBase.hpp"
#include "Time.hpp" #include "Time.hpp"
pFlow::postprocessComponent::postprocessComponent pFlow::postprocessData::postprocessComponent::postprocessComponent
( (
const dictionary &dict, const dictionary &dict,
fieldsDataBase &fieldsDB, fieldsDataBase &fieldsDB,
@ -23,7 +43,7 @@ pFlow::postprocessComponent::postprocessComponent
} }
pFlow::uniquePtr<pFlow::postprocessComponent> pFlow::postprocessComponent::create pFlow::uniquePtr<pFlow::postprocessData::postprocessComponent> pFlow::postprocessData::postprocessComponent::create
( (
const dictionary& dict, const dictionary& dict,
fieldsDataBase& fieldsDB, fieldsDataBase& fieldsDB,

View File

@ -25,12 +25,17 @@ Licence:
#include "dictionary.hpp" #include "dictionary.hpp"
#include "virtualConstructor.hpp" #include "virtualConstructor.hpp"
namespace pFlow namespace
{
class dictionary;
}
namespace pFlow::postprocessData
{ {
class fieldsDataBase;
class regionPoints; class regionPoints;
class dictionary; class fieldsDataBase;
class postprocessComponent class postprocessComponent
{ {
@ -112,6 +117,6 @@ public:
}; };
} // namespace pFlow } // namespace pFlow::postprocessData
#endif // __postprocessComponent_hpp__ #endif // __postprocessComponent_hpp__

View File

@ -1,4 +1,3 @@
/*------------------------------- phasicFlow --------------------------------- /*------------------------------- phasicFlow ---------------------------------
O C enter of O C enter of
O O E ngineering and O O E ngineering and
@ -25,7 +24,7 @@ Licence:
#include "postprocessGlobals.hpp" #include "postprocessGlobals.hpp"
#include "postprocessComponent.hpp" #include "postprocessComponent.hpp"
pFlow::postprocessData::postprocessData pFlow::postprocessData::postprocessData::postprocessData
( (
const systemControl &control, const systemControl &control,
timeValue startTime timeValue startTime
@ -45,7 +44,7 @@ pFlow::postprocessData::postprocessData
) )
) )
{ {
postProcessGlobals::defaultDir__ = CWD()/pFlow::postProcessGlobals::defaultRelDir__; defaultDir__ = CWD()/defaultRelDir__;
// if dictionary is not provided, no extra action is required. // if dictionary is not provided, no extra action is required.
if( !dict_.fileExist() || !dict_.headerOk() ) if( !dict_.fileExist() || !dict_.headerOk() )
@ -98,8 +97,10 @@ pFlow::postprocessData::postprocessData
} }
bool pFlow::postprocessData::execute() bool pFlow::postprocessData::postprocessData::execute()
{ {
if( inSimulation_ && !activeInSimulation_() ) return true;
const auto& ti = time_.TimeInfo(); const auto& ti = time_.TimeInfo();
for(auto& component:postprocesses_) for(auto& component:postprocesses_)
@ -116,8 +117,10 @@ bool pFlow::postprocessData::execute()
return true; return true;
} }
bool pFlow::postprocessData::write() const bool pFlow::postprocessData::postprocessData::write() const
{ {
if( inSimulation_ && !activeInSimulation_() ) return true;
for(auto& component:postprocesses_) for(auto& component:postprocesses_)
{ {
if(!component->executed()) if(!component->executed())
@ -125,7 +128,7 @@ bool pFlow::postprocessData::write() const
continue; continue;
} }
if(!component->write(postProcessGlobals::defaultDir__/component->name())) if(!component->write(defaultDir__/component->name()))
{ {
fatalErrorInFunction fatalErrorInFunction
<<"Error occured in writing postprocess component: " <<"Error occured in writing postprocess component: "
@ -136,7 +139,7 @@ bool pFlow::postprocessData::write() const
return true; return true;
} }
void pFlow::postprocessData::setOutputDirectory(const fileSystem &path) const void pFlow::postprocessData::postprocessData::setOutputDirectory(const fileSystem &path) const
{ {
postProcessGlobals::defaultDir__ = path; defaultDir__ = path;
} }

View File

@ -28,7 +28,6 @@ Licence:
#include "fieldsDataBase.hpp" #include "fieldsDataBase.hpp"
#include "postprocessComponent.hpp" #include "postprocessComponent.hpp"
namespace pFlow namespace pFlow
{ {
@ -36,6 +35,11 @@ class systemControl;
class Time; class Time;
class timeInfo; class timeInfo;
}
namespace pFlow::postprocessData
{
/** /**
* @class postprocessData * @class postprocessData
@ -109,6 +113,6 @@ public:
void setOutputDirectory(const fileSystem& path)const; void setOutputDirectory(const fileSystem& path)const;
}; };
} // namespace pFlow } // namespace pFlow::postprocessData
#endif // __postprocessData_hpp__ #endif // __postprocessData_hpp__

View File

@ -23,7 +23,7 @@ Licence:
#include "fileSystem.hpp" #include "fileSystem.hpp"
namespace pFlow::postProcessGlobals namespace pFlow::postprocessData
{ {
static fileSystem defaultDir__; static fileSystem defaultDir__;

View File

@ -22,9 +22,11 @@ Licence:
#define __postprocessTimeControl_hpp__ #define __postprocessTimeControl_hpp__
#include "baseTimeControl.hpp" #include "baseTimeControl.hpp"
#include "dictionary.hpp"
namespace pFlow namespace pFlow::postprocessData
{ {
class postprocessTimeControl class postprocessTimeControl
: :
public baseTimeControl public baseTimeControl
@ -60,6 +62,6 @@ postprocessTimeControl(
// Additional methods and members can be added here // Additional methods and members can be added here
}; };
} // namespace pFlow } // namespace pFlow::postprocessData
#endif // __postprocessTimeControl_hpp__ #endif // __postprocessTimeControl_hpp__

View File

@ -28,7 +28,7 @@ Licence:
#include "span.hpp" #include "span.hpp"
#include "numericConstants.hpp" #include "numericConstants.hpp"
namespace pFlow namespace pFlow::postprocessData
{ {
class GaussianDistribution class GaussianDistribution

View File

@ -32,6 +32,9 @@ namespace pFlow
class dictionary; class dictionary;
namespace postprocessData
{
class arithmetic class arithmetic
{ {
private: private:
@ -86,6 +89,8 @@ public:
}; };
} } // namespace postprocessData
} // namespace pFlow
#endif //__arithmetic_hpp__ #endif //__arithmetic_hpp__

View File

@ -32,6 +32,9 @@ namespace pFlow
class dictionary; class dictionary;
namespace postprocessData
{
class uniformDistribution class uniformDistribution
{ {
private: private:
@ -86,6 +89,8 @@ public:
}; };
} } // namespace postprocessData
} // namespace pFlow
#endif //__uniformDistribution_hpp__ #endif //__uniformDistribution_hpp__

View File

@ -0,0 +1,569 @@
# PostprocessData Module in phasicFlow
The `PostprocessData` module in phasicFlow provides powerful tools for analyzing particle-based simulations both during runtime (in-simulation) and after simulation completion (post-simulation). This document explains how to configure and use the postprocessing features through the dictionary-based input system.
- in-simulation: this is postprocessing that is active during simulation. When running a solver, it allows for real-time data analysis and adjustments based on the simulation's current state. See below to see how you can activate in-simulation postprocessing.
- post-simulation: this is postprocessing that is done after the simulation is completed. It allows for detailed analysis of the simulation results, including data extraction and visualization based on the results that are stored in time-folders. If you want to use post-simulation, you need to run utility `postprocessPhasicFlow` in terminal (in the simulation case setup folder) to run the postprocessing. This utility reads the `postprocessDataDict` file and performs the specified operations on the simulation data.
## 1. Overview
Postprocessing in phasicFlow allows you to:
- Extract information about particles in specific regions of the domain
- Calculate statistical properties such as averages and sums of particle attributes
- Track specific particles throughout the simulation
- Apply different weighing methods when calculating statistics
- Perform postprocessing at specific time intervals
## Table of Contents
- [1. Overview](#1-overview)
- [2. Setting Up Postprocessing](#2-setting-up-postprocessing)
- [2.1. Basic Configuration](#21-basic-configuration)
- [3. Time Control Options](#3-time-control-options)
- [4. Processing Methods](#4-processing-methods)
- [5. Region Types](#5-region-types)
- [6. Processing Operations](#6-processing-operations)
- [6.1. Available Functions in average](#61-available-functions-in-average)
- [6.2. About fluctuation2 in average function](#62-about-fluctuation2-in-average-function)
- [6.3. Derived Functions](#63-derived-functions)
- [6.4. Available Fields](#64-available-fields)
- [6.5. Optional Parameters](#65-optional-parameters)
- [7. Examples](#7-examples)
- [7.1. Example 1: Probing Individual Particles](#71-example-1-probing-individual-particles)
- [7.2. Example 2: Processing in a Spherical Region](#72-example-2-processing-in-a-spherical-region)
- [7.3. Example 3: Processing Along a Line](#73-example-3-processing-along-a-line)
- [8. Advanced Features](#8-advanced-features)
- [8.1. Special functions applied on fields](#81-special-functions-applied-on-fields)
- [8.2. Particle Filtering with includeMask](#82-particle-filtering-with-includemask)
- [8.3. Implementation Notes](#83-implementation-notes)
- [9. Mathematical Formulations](#9-mathematical-formulations)
- [10. A complete dictionary file (postprocessDataDict)](#10-a-complete-dictionary-file-postprocessdatadict)
## 2. Setting Up Postprocessing
Postprocessing is configured through a dictionary file named `postprocessDataDict` which should be placed in the `settings` directory. Below is a detailed explanation of the configuration options.
### 2.1. Basic Configuration
The input dictionary, **settings/postprocessDataDict**, may look like this:
```cpp
// PostprocessData dictionary
// Enable/disable postprocessing during simulation
runTimeActive yes; // Options: yes, no
// Shape type - only needed when doing post-simulation processing
shapeType sphere; // Options depend on the simulation type: sphere, grain, etc.
// Default time control for postprocessing components
defaultTimeControl
{
timeControl timeStep; // Options: timeStep, simulationTime, settings
startTime 0; // Start time for postprocessing
endTime 1000; // End time for postprocessing
executionInterval 150; // How frequently to run postprocessing
}
// List of postprocessing components
components
(
// Component definitions here...
);
```
If you want to activate in-simulation postprocessing, you need to add these lines to the `settings/settingsDict` file:
```cpp
libs ("libPostprocessData.so");
auxFunctions postprocessData;
```
This will link the postprocessing library to your simulation, allowing you to use its features. Note that, anytime you want to deactivate the in-simulation postprocessing, you can simply change the `runTimeActive` option to `no` in `postprocessDataDict` file.
## 3. Time Control Options
Each postprocessing component can either use the default time control settings or define its own. There are three main options for time control:
| Option | Description | Required Parameters |
|--------|-------------|---------------------|
| `timeStep` | Controls execution based on simulation time steps | `startTime`, `endTime`, `executionInterval` |
| `simulationTime` | Controls execution based on simulation time | `startTime`, `endTime`, `executionInterval` |
| `settings` | Uses parameters from settingsDict file | None (defined elsewhere) |
| `default` | Uses the default time control settings (uses `defaultTimeControl` settings)| None (uses default) |
If no time control is specified, the `default` option is used automatically.
## 4. Processing Methods
The postprocessing module provides several methods for processing particle data. They are categorized into two main groups: bulk and individual methods.
- **Bulk Methods**: Operate on all particles that are located in a specified locations/regions (cells, spheres, etc.).
- **Individual Methods**: Operate on specific particles, allowing for targeted particle property extraction.
| Method | Property type | Description | Formula |
|--------|------------------|-------------|---------|
| `arithmetic` | bulk | Simple arithmetic mean/sum with equal weights | Each particle contributes equally |
| `uniformDistribution` | bulk | Each particle contributes inversely proportional to the total number of particles | $w_i = 1/n$ where $n$ is the number of particles |
| `GaussianDistribution` | bulk | Weight contribution based on distance from center with Gaussian falloff | $w_i = \exp(-\|x_i - c\|^2/(2\sigma^2))/\sqrt{2\pi\sigma^2}$ |
| `particleProbe` | individual | Extracts values from specific particles | Direct access to particle properties |
## 5. Region Types
Regions define where in the domain the postprocessing operations are applied:
| Region Type | Description | Required Parameters | Compatible with |
|-------------|-------------|---------------------|-----------------|
| `sphere` | A spherical region | `radius`, `center` | bulk |
| `multipleSpheres` | Multiple spherical regions | `centers`, `radii` | bulk |
| `line` | Spheres along a line with specified radius | `p1`, `p2`, `nSpheres`, `radius` | bulk |
| `centerPoints` | Specific particles selected by ID | `ids` | individual |
## 6. Processing Operations
Within each processing region of type `bulk`, you can define multiple operations to be performed:
### 6.1. Available Functions in average
| Function | Property type | Description | Formula | Required Parameters |
|----------|---------------|-------------|---------|---------------------|
| `average` | bulk | Weighted average of particle field values | see Equation 1 | `field`, `phi` (optional), `threshold` (optional), `includeMask` (optional), `divideByVolume` (optional), `fluctuation2` (optional) |
| `sum` | bulk | Weighted sum of particle field values | see Equation 2 | `field`, `phi` (optional),`threshold` (optional), `includeMask` (optional), `divideByVolume` (optional) |
Equation 1:
$$\text{mean} = \frac{\sum_j w_j \cdot \phi_j \cdot \text{field}_j}{\sum_i w_i \cdot \phi_i}$$
Equation 2:
$$\text{sum} = \sum_j w_j \cdot \phi_j \cdot \text{field}_j$$
where:
- $j$ is the index of the particle in the region that also satisfies the `includeMask`
- $i$ is the index of the particle in the region
- $w_j$ is the weight of particle $j$ based on the selected processing method
- $\phi_j$ is the value of the `phi` field for particle $j$ (default is 1)
- $field_j$ is the value of the specified field for particle $j$
### 6.2. About fluctuation2 in average function
Fluctuation2 is an optional parameter that can be used to account for fluctuations in the particle field values with respect to mean value of the field.
It is used in the `average` function to calculate the fluctuation of the field values around the mean. The formula for fluctuation2 is:
$$\text{fluctuation}^2 = \frac{\sum_j w_j \cdot \phi_j \cdot (\text{field}_j - \text{mean})^2}{\sum_i w_i \cdot \phi_i}$$
where:
- `mean`: is the average value of the field in the region.
- `field`: The field to be processed (e.g., `velocity`, `mass`, etc.)
- `fluctuation2`: Optional parameter to account for fluctuations in the particle field values.
### 6.3. Derived Functions
In addition to the above basic functions, some derived functions are available for specific calculations:
| Function | Property type | Description | Formula | Required Parameters |
|----------|---------------|-------------|---------|---------------------|
|`avMassVelocity` | bulk | Average velocity weighted by mass | $\frac{\sum_{i \in \text{region}} w_i \cdot m_i \cdot v_i}{\sum_{i \in \text{region}} w_i \cdot m_i}$ | - |
### 6.4. Available Fields
All the pointFields in the simulation database (for in-simulation processing), or the ones stored in the time folders (for post-simulation processing) can be referenced in the operations. In addition to them, some extra fields are available for use in the operations. The following fields are available for use in the operations:
1. Extra fileds to be used in post-processing operations:
| Field | Field Type | Description | Default Value |
|-------|------------|-------------|---------------|
| `position` | `realx3` | Particle positions | - |
| `one` | `real` | Value 1 for each particle | 1 |
| `mass` | `real` | Particle mass | - |
| `density` | `real` | Particle density | - |
| `volume` | `real` | Particle volume | - |
| `diameter` | `real` | Particle diameter | - |
| `I` | `real` | Moment of inertia | - |
2. Common fields which are available in the simulation database/time folders:
| Field | Field Type | Description |
|-------|------------|-------------|
| `velocity` | `realx3` | Particle velocity |
| `rVelocity` | `realx3` | Particle rotational velocity |
| `acceleration` | `realx3` | Particle acceleration |
| `rAcceleration` | `realx3` | Particle rotational acceleration |
| `contactForce` | `realx3` | Particle contact force |
| `contactTorque` | `realx3` | Particle contact torque |
| `id` | `integer` | Particle ID |
| `shapeIndex` | `integer` | Particle shape index |
The above fields may vary from one type of simulation to other. Pleas note that this is only a tentative list.
### 6.5. Optional Parameters
| Parameter | Description | Default | Options |
|-----------|-------------|---------|---------|
| `divideByVolume` | Divide result by region volume | `no` | `yes` or `no` |
| `threshold` | Exclude regions with fewer particles | 1 | Integer value |
| `includeMask` | Filter particles based on a field value | `all` | `all`, `lessThan`, `greaterThan`, `between`, `lessThanOrEq`, `greaterThanOrEq`, `betweenEq` |
|`fluctuation2` (in average only)| Calculate fluctuation of field values | `no` | `yes` or `no` |
| `phi` | Field to be used for weighted averaging | `one` | Any valid field name |
## 7. Examples
### 7.1. Example 1: Probing Individual Particles
```cpp
velocityProb
{
processMethod particleProbe;
processRegion centerPoints;
selector id;
field component(position,y);
ids (0 10 100);
timeControl default;
}
```
This example extracts the y-component of the position for particles with IDs 0, 10, and 100.
### 7.2. Example 2: Processing in a Spherical Region
```cpp
on_single_sphere
{
processMethod arithmetic;
processRegion sphere;
sphereInfo
{
radius 0.01;
center (-0.08 -0.08 0.015);
}
timeControl default;
operations
(
averageVel
{
function average;
field mag(velocity);
divideByVolume no;
fluctuation2 yes;
threshold 3;
includeMask all;
}
par1Fraction
{
function average;
field one;
phi one;
divideByVolume no;
includeMask lessThan;
lessThanInfo
{
field diameter;
value 0.0031;
}
}
numberDensity
{
function sum;
field one;
phi one;
divideByVolume yes;
}
);
}
```
This example defines a sphere region and performs three operations:
1. Calculate the average of velocity magnitude of particles
2. Calculate the fraction of particles with diameter less than 0.0031
3. Calculate the number density by summing and dividing by volume
### 7.3. Example 3: Processing Along a Line
In this example, a line region is defined. The `lineInfo` section specifies the start and end points of the line, the number of spheres to create along the line, and the radius of each point. Bulk properties are calculated in each sphere, based on the properties of particles contained in each sphere.
```cpp
along_a_line
{
processMethod arithmetic;
processRegion line;
timeControl simulationTime;
startTime 1.0;
endTime 3.0;
executionInterval 0.1;
lineInfo
{
p1 (0 0 0);
p2 (0 0.15 0.15);
nSpheres 10;
radius 0.01;
}
operations
(
bulkDensity
{
function sum;
field mass;
phi one;
divideByVolume yes;
}
volumeDensity
{
function sum;
field volume;
divideByVolume yes;
}
);
}
```
This example creates 10 spherical regions along a line from (0,0,0) to (0,0.15,0.15) and calculates the bulk density and volume density in each region.
## 8. Advanced Features
### 8.1. Special functions applied on fields
You can access specific components of vector fields (`realx3`) using the `component` function:
```cpp
field component(position,y); // Access the y-component of position
```
Here is a complete list of these special functions:
| Function Name | Valid field Type | Example |
|-----------------|------------|---------|
| `component` | `realx3` | `component(velocity,x)` |
| `abs` | `real` | `abs(s)` |
| `square` | `real` | `square(I)` |
| `cube` | `real` | `cube(diameter)` |
| `squre root` | `real` | `sqrt(mass)` |
| `magnitude` | `realx3` | `mag(contactForce)` |
| `magnitude square` | `realx3` | `magSquare(velocity)` |
| `magnitude cube` | `realx3` | `magCube(velocity)` |
| `magnitude square root` | `realx3` | `magSqrt(acceleration)` |
### 8.2. Particle Filtering with includeMask
The `includeMask` parameter allows you to filter particles based on field values:
```cpp
includeMask lessThan;
lessThanInfo
{
field diameter;
value 0.0031;
}
```
Supported masks:
- `all`: Include all particles (default)
- `lessThan`: Include particles where field < value
- `greaterThan`: Include particles where field > value
- `between`: Include particles where value1 < field < value2
- `lessThanOrEq`: Include particles where field value
- `greaterThanOrEq`: Include particles where field value
- `betweenEq`: Include particles where value1 field value2
### 8.3. Implementation Notes
- The postprocessing system can work both during simulation (`runTimeActive yes`) or after simulation completion.
- When using post-simulation mode, you must specify the correct `shapeType` to properly initialize the shape objects.
- Results are written to output files in the case directory with timestamps.
- The `threshold` parameter helps eliminate statistical noise in regions with few particles.
- Setting `divideByVolume` to `yes` normalizes results by the volume of the region, useful for calculating densities.
## 9. Mathematical Formulations
For weighted `bulk` properties calculation, we have these two general formulations:
- For weighted averaging:
$$ \text{average} = \frac{\sum_j w_j \cdot \phi_j \cdot \text{field}_j}{\sum_i w_i \cdot \phi_i} $$
- For weighted summing:
$$ \text{sum} = \sum_j w_j \cdot \phi_j \cdot \text{field}_j $$
If `divideByVolume` is set to `yes`, the result is divided by the volume of the region:
$$ \text{volumetric result} = \frac{\text{result}}{V_{\text{region}}} $$
## 10. A complete dictionary file (postprocessDataDict)
```C++
/* -------------------------------*- C++ -*--------------------------------- *\
| phasicFlow File |
| copyright: www.cemf.ir |
\* ------------------------------------------------------------------------- */
objectName postprocessDataDict;
objectType dictionary;;
fileFormat ASCII;
/*---------------------------------------------------------------------------*/
// Yes: postprocessing is active during the simulation
// No: postprocessing is not active during the simulation
// and it can be done after simulation
runTimeActive yes;
// shapeType: defines the type of the shape that is used in the simulation
// (for example: sphere, grain, etc).
// shapeType is only used when postprocessing is done after simulation
// to initialize the shape object for post processing operatoins
shapeType sphere;
// default time control to be used in the postprocessing components
defaultTimeControl
{
timeControl timeStep; // timeStep, simulationTime are the options here
startTime 0;
endTime 1000;
executionInterval 150;
}
// list of postprocessing components
components
(
// probing particles for their state variables, like velocity, position, etc
velocityProb
{
processMethod particleProbe;
processRegion centerPoints;
selector id;
field component(position,y);
ids (0 10 100);
timeControl default; // other options are settings, timeStep, simulationTime
// settings: uses parameters from settingsDict file
// timeStep: uses the time step of the simulation controlling the execution of postprocessing
// simulationTime: uses the simulation time of the simulation controlling the execution of postprocessing
// default: uses the default time control (defined in defaultTimeControl).
// default behavior: if you do not specify it, parameters in defaultTimeControl is used.
}
on_single_sphere
{
// method of performing the sum (arithmetic, uniformDistribution, GaussianDistribution)
processMethod arithmetic;
// Postprocessing is done on particles whose centers are inside this spehre
processRegion sphere;
sphereInfo
{
radius 0.01; // radius of sphere
center (-0.08 -0.08 0.015); // center of sphere
}
timeControl default;
/// all the postprocess operations to be done on sphere region
operations
(
// computes the arithmetic mean of particle velocity
averageVel
{
function average;
field velocity;
fluctuation2 yes;
divideByVolume no; // default is no
threshold 3; // default is 1
includeMask all; // default is all
}
// - function: average, sum, and other derived ones from sum and average
// - field: names of the fields in the simulation. Some special fields
// are: mass, density, volume, position, one, I.
// - divideByVolume: whether the result is divided by the volume of the region
// - threshold: exclude regions that contains particles less than threshold
// - includeMask: all, lessThan, greaterThan, between, lessThanOrEq, greaterThanEq, betweenEq
// computes the fraction of par1 in the region
par1Fraction
{
function average;
field one; // default
phi one; // default
divideByVolume no;
includeMask lessThan;
// diameter of par1 is 0.003, so these settings
// will select only particles of type par1
lessThanInfo
{
field diameter;
value 0.0031;
}
}
numberDensity
{
function sum;
field one;
phi one;
divideByVolume yes;
}
);
}
along_a_line
{
processMethod arithmetic;
processRegion line;
// the time interval for executing the post-processing
// other options: timeStep, default, and settings
timeControl simulationTime;
startTime 1.0;
endTime 3.0;
executionInterval 0.1;
// 10 spheres with radius 0.01 along the straight line defined by p1 and p2
lineInfo
{
p1 (0 0 0);
p2 (0 0.15 0.15);
nSpheres 10;
radius 0.01;
}
operations
(
// computes the arithmetic mean of particle velocity
numberDensity
{
function sum;
field one;
divideByVolume yes; //default is no
}
volumeDensity
{
function sum;
field volume; //
divideByVolume yes; //default is no
}
);
}
);
```

View File

@ -25,7 +25,7 @@ Licence:
#include "regionPoints.hpp" #include "regionPoints.hpp"
#include "Field.hpp" #include "Field.hpp"
namespace pFlow namespace pFlow::postprocessData
{ {
template<typename T> template<typename T>
@ -119,7 +119,7 @@ public:
}; };
} // namespace pFlow } // namespace pFlow::postprocessData
#include "regionFieldTemplate.cpp" #include "regionFieldTemplate.cpp"

View File

@ -1,6 +1,8 @@
namespace pFlow::postprocessData
{
template<typename T> template<typename T>
pFlow::regionField<T>::regionField( regionField<T>::regionField(
const word& name, const word& name,
const regionPoints& rPoints, const regionPoints& rPoints,
const T defaultVal) const T defaultVal)
@ -8,3 +10,5 @@ pFlow::regionField<T>::regionField(
field_(name, "regionFieldValue", rPoints.size(), rPoints.size(), defaultVal), field_(name, "regionFieldValue", rPoints.size(), rPoints.size(), defaultVal),
regionPoints_(rPoints) regionPoints_(rPoints)
{} {}
} // End namespace pFlow::postprocessData

View File

@ -3,7 +3,10 @@
#include "Set.hpp" #include "Set.hpp"
#include "pStructSelector.hpp" #include "pStructSelector.hpp"
bool pFlow::centerPointsRegionPoints::selectIds() namespace pFlow::postprocessData
{
bool centerPointsRegionPoints::selectIds()
{ {
if(!firstTimeUpdate_) return true; if(!firstTimeUpdate_) return true;
firstTimeUpdate_ = false; firstTimeUpdate_ = false;
@ -42,7 +45,7 @@ bool pFlow::centerPointsRegionPoints::selectIds()
return true; return true;
} }
pFlow::centerPointsRegionPoints::centerPointsRegionPoints( centerPointsRegionPoints::centerPointsRegionPoints(
const dictionary &dict, const dictionary &dict,
fieldsDataBase &fieldsDataBase) fieldsDataBase &fieldsDataBase)
: regionPoints(dict, fieldsDataBase), : regionPoints(dict, fieldsDataBase),
@ -50,7 +53,7 @@ pFlow::centerPointsRegionPoints::centerPointsRegionPoints(
probDict_(dict) probDict_(dict)
{} {}
bool pFlow::centerPointsRegionPoints::update() bool centerPointsRegionPoints::update()
{ {
if(!selectIds()) return false; if(!selectIds()) return false;
@ -74,7 +77,7 @@ bool pFlow::centerPointsRegionPoints::update()
return true; return true;
} }
bool pFlow::centerPointsRegionPoints::write(iOstream &os) const bool centerPointsRegionPoints::write(iOstream &os) const
{ {
if(firstTimeUpdate_) if(firstTimeUpdate_)
{ {
@ -95,3 +98,5 @@ bool pFlow::centerPointsRegionPoints::write(iOstream &os) const
return true; return true;
} }
} // End namespace pFlow::postprocessData

View File

@ -23,7 +23,7 @@ Licence:
#include "regionPoints.hpp" #include "regionPoints.hpp"
namespace pFlow namespace pFlow::postprocessData
{ {
/** /**
@ -163,7 +163,7 @@ public:
}; // class centerPointsRegionPoints }; // class centerPointsRegionPoints
} // namespace pFlow } // namespace pFlow::postprocessData

View File

@ -1,7 +1,10 @@
#include "lineRegionPoints.hpp" #include "lineRegionPoints.hpp"
#include "fieldsDataBase.hpp" #include "fieldsDataBase.hpp"
pFlow::lineRegionPoints::lineRegionPoints namespace pFlow::postprocessData
{
lineRegionPoints::lineRegionPoints
( (
const dictionary &dict, const dictionary &dict,
fieldsDataBase &fieldsDataBase fieldsDataBase &fieldsDataBase
@ -14,7 +17,7 @@ pFlow::lineRegionPoints::lineRegionPoints
selectedPoints_("selectedPoints") selectedPoints_("selectedPoints")
{ {
const auto& lDict = dict.subDict("lineInfo"); const auto& lDict = dict.subDict("lineInfo");
uint32 nPoints = lDict.getValMax<uint32>("numPoints",2); uint32 nSpheres = lDict.getValMax<uint32>("nSpheres",2);
realList raddi; realList raddi;
if( lDict.containsDataEntry("radii")) if( lDict.containsDataEntry("radii"))
@ -24,24 +27,24 @@ pFlow::lineRegionPoints::lineRegionPoints
else else
{ {
auto r = lDict.getVal<real>("radius"); auto r = lDict.getVal<real>("radius");
raddi = realList(nPoints, r); raddi = realList(nSpheres, r);
} }
if(raddi.size() != nPoints) if(raddi.size() != nSpheres)
{ {
fatalErrorInFunction fatalErrorInFunction
<< "The number elements in of radii list should be equal to the " << "The number of elements in the radii list should be equal to the "
<< "number of points"<<endl; << "nSpheres"<<endl;
fatalExit; fatalExit;
} }
sphereRegions_.resize(nPoints, sphere(realx3(0,0,0),1)); sphereRegions_.resize(nSpheres, sphere(realx3(0,0,0),1));
centerPoints_.resize(nPoints); centerPoints_.resize(nSpheres);
volumes_.resize(nPoints); volumes_.resize(nSpheres);
diameters_.resize(nPoints); diameters_.resize(nSpheres);
selectedPoints_.resize(nPoints); selectedPoints_.resize(nSpheres);
real dt = 1.0/(nPoints-1); real dt = 1.0/(nSpheres-1);
for(uint32 i = 0; i < nPoints; ++i) for(uint32 i = 0; i < nSpheres; ++i)
{ {
centerPoints_[i] = line_.point(i*dt); centerPoints_[i] = line_.point(i*dt);
sphereRegions_[i] = pFlow::sphere(centerPoints_[i], raddi[i]); sphereRegions_[i] = pFlow::sphere(centerPoints_[i], raddi[i]);
@ -50,7 +53,7 @@ pFlow::lineRegionPoints::lineRegionPoints
} }
} }
pFlow::span<const pFlow::uint32> pFlow::lineRegionPoints::indices(uint32 elem) const pFlow::span<const pFlow::uint32> lineRegionPoints::indices(uint32 elem) const
{ {
if(elem >= size()) if(elem >= size())
{ {
@ -65,7 +68,7 @@ pFlow::span<const pFlow::uint32> pFlow::lineRegionPoints::indices(uint32 elem) c
selectedPoints_[elem].size()); selectedPoints_[elem].size());
} }
pFlow::span<pFlow::uint32> pFlow::lineRegionPoints::indices(uint32 elem) pFlow::span<pFlow::uint32> lineRegionPoints::indices(uint32 elem)
{ {
if(elem >= size()) if(elem >= size())
{ {
@ -80,7 +83,7 @@ pFlow::span<pFlow::uint32> pFlow::lineRegionPoints::indices(uint32 elem)
selectedPoints_[elem].size()); selectedPoints_[elem].size());
} }
bool pFlow::lineRegionPoints::update() bool lineRegionPoints::update()
{ {
const auto points = database().updatePoints(); const auto points = database().updatePoints();
for(auto& elem : selectedPoints_) for(auto& elem : selectedPoints_)
@ -101,7 +104,7 @@ bool pFlow::lineRegionPoints::update()
return true; return true;
} }
bool pFlow::lineRegionPoints::write(iOstream &os) const bool lineRegionPoints::write(iOstream &os) const
{ {
os << "# Spheres along a straight line \n"; os << "# Spheres along a straight line \n";
os << "# No." << tab << "centerPoint" << tab << "diameter" << endl; os << "# No." << tab << "centerPoint" << tab << "diameter" << endl;
@ -118,3 +121,5 @@ bool pFlow::lineRegionPoints::write(iOstream &os) const
os << endl; os << endl;
return true; return true;
} }
} // End namespace pFlow::postprocessData

View File

@ -54,7 +54,7 @@ Licence:
#include "Vectors.hpp" #include "Vectors.hpp"
namespace pFlow namespace pFlow::postprocessData
{ {
class lineRegionPoints class lineRegionPoints

View File

@ -1,7 +1,10 @@
#include "multipleSpheresRegionPoints.hpp" #include "multipleSpheresRegionPoints.hpp"
#include "fieldsDataBase.hpp" #include "fieldsDataBase.hpp"
pFlow::multipleSpheresRegionPoints::multipleSpheresRegionPoints namespace pFlow::postprocessData
{
multipleSpheresRegionPoints::multipleSpheresRegionPoints
( (
const dictionary &dict, const dictionary &dict,
fieldsDataBase &fieldsDataBase fieldsDataBase &fieldsDataBase
@ -46,7 +49,7 @@ pFlow::multipleSpheresRegionPoints::multipleSpheresRegionPoints
} }
} }
pFlow::span<const pFlow::uint32> pFlow::multipleSpheresRegionPoints::indices(uint32 elem) const pFlow::span<const pFlow::uint32> multipleSpheresRegionPoints::indices(uint32 elem) const
{ {
if (elem >= size()) if (elem >= size())
{ {
@ -59,7 +62,7 @@ pFlow::span<const pFlow::uint32> pFlow::multipleSpheresRegionPoints::indices(uin
return span<const uint32>(selectedPoints_[elem].data(), selectedPoints_[elem].size()); return span<const uint32>(selectedPoints_[elem].data(), selectedPoints_[elem].size());
} }
pFlow::span<pFlow::uint32> pFlow::multipleSpheresRegionPoints::indices(uint32 elem) pFlow::span<pFlow::uint32> multipleSpheresRegionPoints::indices(uint32 elem)
{ {
if (elem >= size()) if (elem >= size())
{ {
@ -73,7 +76,7 @@ pFlow::span<pFlow::uint32> pFlow::multipleSpheresRegionPoints::indices(uint32 el
} }
bool pFlow::multipleSpheresRegionPoints::update() bool multipleSpheresRegionPoints::update()
{ {
const auto points = database().updatePoints(); const auto points = database().updatePoints();
for (auto& elem : selectedPoints_) for (auto& elem : selectedPoints_)
@ -94,7 +97,7 @@ bool pFlow::multipleSpheresRegionPoints::update()
return true; return true;
} }
bool pFlow::multipleSpheresRegionPoints::write(iOstream &os) const bool multipleSpheresRegionPoints::write(iOstream &os) const
{ {
os << "# Multiple spheres region points\n"; os << "# Multiple spheres region points\n";
os << "# No." << tab << "centerPoint" << tab << "diameter" << endl; os << "# No." << tab << "centerPoint" << tab << "diameter" << endl;
@ -110,3 +113,5 @@ bool pFlow::multipleSpheresRegionPoints::write(iOstream &os) const
os << endl; os << endl;
return true; return true;
} }
} // End namespace pFlow::postprocessData

View File

@ -51,7 +51,7 @@ Licence:
#include "sphere.hpp" #include "sphere.hpp"
#include "Vectors.hpp" #include "Vectors.hpp"
namespace pFlow namespace pFlow::postprocessData
{ {
class multipleSpheresRegionPoints class multipleSpheresRegionPoints

View File

@ -2,7 +2,10 @@
#include "fieldsDataBase.hpp" #include "fieldsDataBase.hpp"
#include "Time.hpp" #include "Time.hpp"
pFlow::regionPoints::regionPoints namespace pFlow::postprocessData
{
regionPoints::regionPoints
( (
const dictionary &dict, const dictionary &dict,
fieldsDataBase &fieldsDataBase fieldsDataBase &fieldsDataBase
@ -11,18 +14,20 @@ pFlow::regionPoints::regionPoints
fieldsDataBase_(fieldsDataBase) fieldsDataBase_(fieldsDataBase)
{} {}
const pFlow::Time& pFlow::regionPoints::time() const const Time& regionPoints::time() const
{ {
return fieldsDataBase_.time(); return fieldsDataBase_.time();
} }
const pFlow::fieldsDataBase & pFlow::regionPoints::database() const const fieldsDataBase & regionPoints::database() const
{ {
return fieldsDataBase_; return fieldsDataBase_;
} }
pFlow::fieldsDataBase& pFlow::regionPoints::database() fieldsDataBase& regionPoints::database()
{ {
return fieldsDataBase_; return fieldsDataBase_;
} }
} // namespace pFlow::postprocessData

View File

@ -25,12 +25,16 @@ Licence:
#include "dictionary.hpp" #include "dictionary.hpp"
#include "pointStructure.hpp" #include "pointStructure.hpp"
namespace pFlow namespace pFlow
{
class Time;
}
namespace pFlow::postprocessData
{ {
class fieldsDataBase; class fieldsDataBase;
class Time;
/** /**
* @class regionPoints * @class regionPoints

View File

@ -1,7 +1,10 @@
#include "sphereRegionPoints.hpp" #include "sphereRegionPoints.hpp"
#include "fieldsDataBase.hpp" #include "fieldsDataBase.hpp"
pFlow::sphereRegionPoints::sphereRegionPoints namespace pFlow::postprocessData
{
sphereRegionPoints::sphereRegionPoints
( (
const dictionary &dict, const dictionary &dict,
fieldsDataBase &fieldsDataBase fieldsDataBase &fieldsDataBase
@ -15,7 +18,7 @@ pFlow::sphereRegionPoints::sphereRegionPoints
{ {
} }
bool pFlow::sphereRegionPoints::update() bool sphereRegionPoints::update()
{ {
const auto points = database().updatePoints(); const auto points = database().updatePoints();
selectedPoints_.clear(); selectedPoints_.clear();
@ -30,7 +33,7 @@ bool pFlow::sphereRegionPoints::update()
return true; return true;
} }
bool pFlow::sphereRegionPoints::write(iOstream &os) const bool sphereRegionPoints::write(iOstream &os) const
{ {
os <<"# Single sphere\n"; os <<"# Single sphere\n";
os <<"# center point: "<<sphereRegion_.center()<<endl; os <<"# center point: "<<sphereRegion_.center()<<endl;
@ -39,3 +42,5 @@ bool pFlow::sphereRegionPoints::write(iOstream &os) const
return true; return true;
} }
} // End namespace pFlow::postprocessData

View File

@ -38,7 +38,7 @@ Licence:
#include "sphere.hpp" #include "sphere.hpp"
#include "Vectors.hpp" #include "Vectors.hpp"
namespace pFlow namespace pFlow::postprocessData
{ {
class sphereRegionPoints class sphereRegionPoints

View File

@ -7,18 +7,30 @@ objectType dictionary;;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
// Yes: postprocessing is active during the simulation
// No: postprocessing is not active during the simulation
// and it can be done after simulation
runTimeActive yes; runTimeActive yes;
// shapeType: defines the type of the shape that is used in the simulation
// (for example: sphere, grain, etc).
// shapeType is only used when postprocessing is done after simulation
// to initialize the shape object for post processing operatoins
shapeType sphere;
// default time control to be used in the postprocessing components
defaultTimeControl defaultTimeControl
{ {
timeControl timeStep; timeControl timeStep; // timeStep, simulationTime are the options here
startTime 0; startTime 0;
endTime 1000; endTime 1000;
executionInterval 150; executionInterval 150;
} }
// list of postprocessing components
components components
( (
// probing particles for their state variables, like velocity, position, etc
velocityProb velocityProb
{ {
processMethod particleProbe; processMethod particleProbe;
@ -26,23 +38,31 @@ components
selector id; selector id;
field component(position,y); field component(position,y);
ids (0 10 100); ids (0 10 100);
timeControl default; // other options are settings, timeStep, simulationTime
// settings: uses parameters from settingsDict file
// timeStep: uses the time step of the simulation controlling the execution of postprocessing
// simulationTime: uses the simulation time of the simulation controlling the execution of postprocessing
// default: uses the default time control (defined in defaultTimeControl).
// default behavior: if you do not specify it, parameters in defaultTimeControl is used.
} }
onSingleSphere on_single_sphere
{ {
// method of performing the sum (arithmetic, uniformDistribution, GaussianDistribution) // method of performing the sum (arithmetic, uniformDistribution, GaussianDistribution)
processMethod arithmetic; processMethod arithmetic;
processRegion sphere; // type of region on which processing is performed
// Postprocessing is done on particles whose centers are inside this spehre
processRegion sphere;
sphereInfo sphereInfo
{ {
radius 0.01; radius 0.01; // radius of sphere
center (-0.08 -0.08 0.015); center (-0.08 -0.08 0.015); // center of sphere
} }
timeControl default; // settings, timeStep, simulationTime timeControl default;
/// all the post process operations to be done /// all the postprocess operations to be done on sphere region
operations operations
( (
// computes the arithmetic mean of particle velocity // computes the arithmetic mean of particle velocity
@ -50,16 +70,24 @@ components
{ {
function average; function average;
field velocity; field velocity;
divideByVolume no; //default fluctuation2 yes;
threshold 3; //default is 1; divideByVolume no; // default is no
includeMask all; threshold 3; // default is 1
includeMask all; // default is all
} }
// - function: average, sum, and other derived ones from sum and average
// - field: names of the fields in the simulation. Some special fields
// are: mass, density, volume, position, one, I.
// - divideByVolume: whether the result is divided by the volume of the region
// - threshold: exclude regions that contains particles less than threshold
// - includeMask: all, lessThan, greaterThan, between, lessThanOrEq, greaterThanEq, betweenEq
// computes the fraction of par1 in the region // computes the fraction of par1 in the region
par1Fraction par1Fraction
{ {
function average; function average;
field one; field one; // default
phi one; // default phi one; // default
divideByVolume no; divideByVolume no;
includeMask lessThan; includeMask lessThan;
@ -69,7 +97,6 @@ components
lessThanInfo lessThanInfo
{ {
field diameter; field diameter;
value 0.0031; value 0.0031;
} }
} }
@ -78,16 +105,17 @@ components
{ {
function sum; function sum;
field one; field one;
phi one; // default phi one;
divideByVolume yes; divideByVolume yes;
} }
); );
} }
alongALine along_a_line
{ {
processMethod arithmetic; processMethod arithmetic;
processRegion line; processRegion line;
// the time interval for executing the post-processing // the time interval for executing the post-processing
@ -103,7 +131,7 @@ components
{ {
p1 (0 0 0); p1 (0 0 0);
p2 (0 0.15 0.15); p2 (0 0.15 0.15);
numPoints 10; nSpheres 10;
radius 0.01; radius 0.01;
} }
@ -120,7 +148,7 @@ components
volumeDensity volumeDensity
{ {
function sum; function sum;
field cube(diameter); // d^3, although it differs by pi/6 field volume; //
divideByVolume yes; //default is no divideByVolume yes; //default is no
} }
); );

40
tutorials/README.md Normal file
View File

@ -0,0 +1,40 @@
# phasicFlow Tutorials
This directory contains various tutorial examples to help you learn how to use phasicFlow for different particle simulation scenarios. Each tutorial provides a complete working example with configuration files and instructions.
## 1. Sphere DEM Simulations (`sphereGranFlow`)
The most comprehensive collection of tutorials using spherical particles for DEM simulations:
- [Rotating Drum (Small)](./sphereGranFlow/rotatingDrumSmall/) - Simple rotating drum simulation with 30,000 spherical particles (4 mm diameter)
- [Rotating Drum (Medium)](./sphereGranFlow/rotatingDrumMedium/) - Medium-sized rotating drum simulation
- [Rotating Drum with Baffles](./sphereGranFlow/RotatingDrumWithBaffles/) - Rotating drum with internal baffles and binary particle mixture
- [Rotating Drum with Periodic Boundaries](./sphereGranFlow/drum-PeriodicBoundary/) - Simulates an "infinite length" drum using periodic boundaries
- [V-blender](./sphereGranFlow/V-blender/) - V-shaped blender simulation for particle mixing
- [Tote Blender](./sphereGranFlow/toteBlender/) - Double pedestal tote blender simulation with 24,000 particles
- [Binary System of Particles](./sphereGranFlow/binarySystemOfParticles/) - Demonstrates particle segregation in a rotating drum with two particle sizes
- [Screw Conveyor](./sphereGranFlow/screwConveyor/) - Simulates particle transport using a screw conveyor
- [Conveyor Belt](./sphereGranFlow/conveyorBelt/) - Simulates particles on a moving conveyor belt
- [Rotary Air Lock Valve](./sphereGranFlow/RotaryAirLockValve/) - Simulates a rotary air lock valve with particle insertion
- [Layered Silo Filling](./sphereGranFlow/layeredSiloFilling/) - Demonstrates filling a silo with layers of particles
- [Homogenization Silo (Periodic Boundaries)](./sphereGranFlow/homogenizationSilo-PeriodicBoundary/) - Simulates homogenization in a silo with periodic boundaries
## 2. Course-grained (Grain) DEM Simulations (`grainGranFlow`)
Tutorials for simulations with non-spherical (grain-shaped) particles:
- [Rotating Drum](./grainGranFlow/rotatingDrum/) - Demonstrates non-spherical grain particles in a rotating drum
## 3. Geometry Iteration (`iterateGeometry`)
Tutorials focused on geometry handling and visualization:
- [Inclined Screw Conveyor](./iterateGeometry/inclinedScrewConveyor/) - Visualizes the geometry of an inclined screw conveyor without particles
## 4. Post-processing (`postprocessPhasicFlow`)
Tutorials focused on post-processing and analysis:
- [Segregation Analysis](./postprocessPhasicFlow/segregation/) - Demonstrates how to analyze particle segregation in simulation results

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,5 @@
# Problem Definition (v-1.0) # Problem Definition (v-1.0)
The problem is to simulate a rotating drum with a diameter of 0.24 m, a length of 0.1 m and 6 baffles rotating at 15 rpm. This drum is filled with 20000 particles, the integration time step is 0.00001 s. There are 2 types of particles in this drum, each of which is inserted during the simulation to fill the drum. The problem is to simulate a rotating drum with a diameter of 0.24 m, a length of 0.1 m and 6 baffles rotating at 15 rpm. This drum is filled with 20000 particles, the integration time step is 0.00001 s. There are 2 types of particles in this drum, each of which is inserted during the simulation to fill the drum.
* **12500** Particles with **4 mm** diameter, at the rate of 12500 particles/s for 1 sec. * **12500** Particles with **4 mm** diameter, at the rate of 12500 particles/s for 1 sec.
* **7500** Particles with **5mm** diameter, at the rate of 7500 particles/s for 1 sec. * **7500** Particles with **5mm** diameter, at the rate of 7500 particles/s for 1 sec.
@ -15,10 +16,13 @@ The problem is to simulate a rotating drum with a diameter of 0.24 m, a length o
</html> </html>
# Setting up the Case # Setting up the Case
As it has been explained in the previous cases, the simulation case setup is based on text-based scripts. Here, the simulation case setup are sorted in three folders: `caseSetup`, `setting` and `stl`. As it has been explained in the previous cases, the simulation case setup is based on text-based scripts. Here, the simulation case setup are sorted in three folders: `caseSetup`, `setting` and `stl`.
## Defining small and large particles ## Defining small and large particles
Then in the `caseSetup/shapes` the diameter and the material name of the particles are defined. Two sizes are defined: 4 and 5 mm. Then in the `caseSetup/shapes` the diameter and the material name of the particles are defined. Two sizes are defined: 4 and 5 mm.
```C++ ```C++
// names of shapes // names of shapes
names (smallSphere largeSphere); names (smallSphere largeSphere);
@ -28,8 +32,8 @@ diameters (0.004 0.005);
materials (lightMat heavyMat); materials (lightMat heavyMat);
``` ```
## Particle Insertion ## Particle Insertion
In this case we have two regions for inserting the particles. In both regions we define the insertion rate, the start and end time of the insertion, information about the volume of space through which the particles are inserted. The insertion phase in the simulation is performed between times 0 and 1 second. In this case we have two regions for inserting the particles. In both regions we define the insertion rate, the start and end time of the insertion, information about the volume of space through which the particles are inserted. The insertion phase in the simulation is performed between times 0 and 1 second.
For example, for the insertion region for inserting light particles is shown below. For example, for the insertion region for inserting light particles is shown below.
@ -39,31 +43,44 @@ in <b>caseSetup/particleInsertion</b> file
```C++ ```C++
// Right Layer Region // Right Region
layerrightregion right_region
{ {
// type of insertion region // type of insertion region
timeControl simulationTime;
regionType cylinder; regionType cylinder;
// insertion rate (particles/s) // insertion rate (particles/s)
rate 12500; rate 12500;
// Start time of LightParticles insertion (s)
timeControl simulationTime;
// Start time of insertion (s)
startTime 0; startTime 0;
// End time of LightParticles insertion (s) // End time of insertion (s)
endTime 1; endTime 1;
// Time Interval of LightParticles insertion (s) // Time Interval of insertion (s)
insertionInterval 0.025; insertionInterval 0.025;
cylinderInfo cylinderInfo
{ {
// Coordinates of cylinderRegion (m,m,m) // Coordinates of cylinderRegion (m,m,m)
p2 (-0.15 0.25 0.05); p2 (-0.15 0.25 0.05);
p1 (-0.15 0.24 0.05); p1 (-0.15 0.24 0.05);
// radius of cylinder (m) // radius of cylinder (m)
radius 0.035; radius 0.035;
} }
setFields
{
velocity realx3 (0.0 -0.6 0.0); // initial velocity of inserted particles
}
mixture
{
smallSphere 1; // mixture composition of inserted particles
}
} }
``` ```
## Interaction between particles and walls ## Interaction between particles and walls
The `caseSetup/interaction` file defines the material names and properties as well as the interaction parameters: the interaction between the particles and the shell of the rotating drum. Since we define 3 materials for simulation, the interaction matrix is 3x3, while we only need to enter upper triangle elements (interactions are symmetric). The `caseSetup/interaction` file defines the material names and properties as well as the interaction parameters: the interaction between the particles and the shell of the rotating drum. Since we define 3 materials for simulation, the interaction matrix is 3x3, while we only need to enter upper triangle elements (interactions are symmetric).
@ -78,31 +95,32 @@ densities (1000 1500 2500);
heavyMat-heavyMat heavyMat-wallMat heavyMat-heavyMat heavyMat-wallMat
wallMat-wallMat ); wallMat-wallMat );
*/ */
// Young modulus [Pa] // Young modulus [Pa]
Yeff (1.0e6 1.0e6 1.0e6 Yeff (1.0e6 1.0e6 1.0e6
1.0e6 1.0e6 1.0e6 1.0e6
1.0e6); 1.0e6);
// Shear modulus [Pa] // Shear modulus [Pa]
Geff (0.8e6 0.8e6 0.8e6 Geff (0.8e6 0.8e6 0.8e6
0.8e6 0.8e6 0.8e6 0.8e6
0.8e6); 0.8e6);
// Poisson's ratio [-] // Poisson's ratio [-]
nu (0.25 0.25 0.25 nu (0.25 0.25 0.25
0.25 0.25 0.25 0.25
0.25); 0.25);
// coefficient of normal restitution // coefficient of normal restitution
en (0.97 0.97 0.85 en (0.97 0.97 0.85
0.97 0.85 0.97 0.85
1.00); 1.00);
// dynamic friction // dynamic friction
mu (0.65 0.65 0.35 mu (0.65 0.65 0.35
0.65 0.35 0.65 0.35
0.35); 0.35);
// rolling friction // rolling friction
mur (0.1 0.1 0.1 mur (0.1 0.1 0.1
0.1 0.1 0.1 0.1
0.1); 0.1);
``` ```
## Settings ## Settings
### Geometry ### Geometry
In the `settings/geometryDict` file, the geometry and axis of rotation is defined for the drum. The geometry is composed of a body, front and rear ends. In the `settings/geometryDict` file, the geometry and axis of rotation is defined for the drum. The geometry is composed of a body, front and rear ends.
@ -163,7 +181,9 @@ surfaces
In this part of `geometryDict` the information of rotating axis and speed of rotation are defined. The start of rotation is at 2 s. The first 2 seconds of simulation is for allowing particles to settle donw in the drum. In this part of `geometryDict` the information of rotating axis and speed of rotation are defined. The start of rotation is at 2 s. The first 2 seconds of simulation is for allowing particles to settle donw in the drum.
```C++ ```C++
motionModel rotatingAxis; motionModel rotatingAxis;
rotatingAxisInfo rotatingAxisInfo
{ {
rotAxis rotAxis
@ -181,7 +201,9 @@ rotatingAxisInfo
} }
} }
``` ```
## Performing Simulation ## Performing Simulation
To run simulations, type the following commands in the terminal one at a time. To run simulations, type the following commands in the terminal one at a time.
Enter `particlesPhasicFlow` command to create the initial fields for particles. Enter `particlesPhasicFlow` command to create the initial fields for particles.

View File

@ -6,6 +6,7 @@ objectName interaction;
objectType dicrionary; objectType dicrionary;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
materials (lightMat heavyMat wallMat); // a list of materials names materials (lightMat heavyMat wallMat); // a list of materials names
densities (1000 1500 2500); // density of materials [kg/m3] densities (1000 1500 2500); // density of materials [kg/m3]
@ -14,7 +15,7 @@ contactListType sortedContactList;
contactSearch contactSearch
{ {
method NBS; // method for broad search method NBS;
updateInterval 10; updateInterval 10;

View File

@ -6,14 +6,14 @@ objectName particleInsertion;
objectType dicrionary; objectType dicrionary;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
active Yes; // is insertion active -> Yes or No active Yes; // is insertion active -> Yes or No
/* /*
Two layers of particles are packed one-by-one using 1 insertion steps Two layers of particles are packed one-by-one using 1 insertion steps
*/ */
right_region
layerrightregion // Right Layer Region
{ {
timeControl simulationTime; timeControl simulationTime;
@ -21,11 +21,11 @@ layerrightregion // Right Layer Region
rate 12500; // Right Region Particles Insertion Rate (particles/s) rate 12500; // Right Region Particles Insertion Rate (particles/s)
startTime 0; // Start time of LightParticles insertion (s) startTime 0; // Start time of insertion (s)
endTime 1; // End time of LightParticles insertion (s) endTime 1; // End time of insertion (s)
insertionInterval 0.025; // Time Interval of LightParticles insertion (s) insertionInterval 0.025; // Time Interval of particles insertion (s)
cylinderInfo cylinderInfo
{ {
@ -47,7 +47,7 @@ layerrightregion // Right Layer Region
} }
} }
layerleftregion // Left Layer Region left_region
{ {
timeControl simulationTime; timeControl simulationTime;
@ -55,11 +55,11 @@ layerleftregion // Left Layer Region
rate 7500; // Left Region Particles Insertion Rate (particles/s) rate 7500; // Left Region Particles Insertion Rate (particles/s)
startTime 0; // Start time of LightParticles insertion (s) startTime 0; // Start time of insertion (s)
endTime 1; // End time of LightParticles insertion (s) endTime 1; // End time of insertion (s)
insertionInterval 0.025; // Time Interval of LightParticles insertion (s) insertionInterval 0.025; // Time Interval of insertion (s)
cylinderInfo cylinderInfo
{ {

View File

@ -6,6 +6,7 @@ objectName sphereDict;
objectType sphereShape; objectType sphereShape;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
names (smallSphere largeSphere); // names of shapes names (smallSphere largeSphere); // names of shapes
diameters (0.004 0.005); // diameter of shapes (m) diameters (0.004 0.005); // diameter of shapes (m)

View File

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

View File

@ -6,6 +6,7 @@ objectName geometryDict;
objectType dictionary; objectType dictionary;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
motionModel rotatingAxis; motionModel rotatingAxis;
rotatingAxisInfo rotatingAxisInfo

View File

@ -10,9 +10,7 @@ setFields
{ {
/* /*
Default value for fields defined for particles Default value for fields defined for particles
These fields should always be defined for simulations with These fields should always be defined for simulations with
spherical particles. spherical particles.
*/ */
@ -29,30 +27,13 @@ setFields
selectors selectors
{ {
shapeAssigne
{
selector stridedRange; // other options: box, cylinder, sphere, randomPoints
stridedRangeInfo
{
begin 0; // begin index of points
end 20000; // 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
{ {
method empty; // other options: random and ordered method empty; // other options: random, file and ordered
} }

View File

@ -20,14 +20,16 @@ timePrecision 6; // maximum number of digits for time
g (0 -9.8 0); // gravity vector (m/s2) g (0 -9.8 0); // gravity vector (m/s2)
// save necessary (i.e., required) data on disk // save necessary 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 ();
integrationMethod AdamsBashforth2; // integration method integrationMethod AdamsBashforth2; // integration method
integrationHistory off; // to sace space on disk
writeFormat ascii; // data writting format (ascii or binary) writeFormat ascii; // data writting format (ascii or binary)
timersReport Yes; // report timers (Yes or No) timersReport Yes; // report timers (Yes or No)

View File

@ -0,0 +1,251 @@
# V-blender Simulation (phasicFlow v-1.0)
This tutorial demonstrates the simulation of a V-blender, a common mixing device used in pharmaceutical and powder processing industries. The V-blender consists of a V-shaped vessel that rotates around a horizontal axis, allowing for efficient mixing of particulate materials.
<div align ="center">
<img src="./v-blender.png" style="width: 400px;">
</div>
<div align ="center">
<b>
V-blender simulation with two layers of particles
</b>
</div>
## Problem Definition
The simulation represents a V-blender with the following characteristics:
- The blender is initially empty and is filled with two different particle types in sequence
- First layer: Small particles (10 mm diameter) are inserted from the right side
- Second layer: Slightly larger particles (10.1 mm diameter) are inserted from the left side
- The blender begins rotation at t = 3.0 s and continues until t = 10.0 s
- The rotation speed is set to 3.14 rad/s (approximately 0.5 Hz or 30 RPM)
- The simulation runs for a total of 10 seconds
## Case Setup
The simulation case setup files are organized in the `settings/` and `caseSetup/` folders.
### Particles Definition
Two particle types are defined in the `caseSetup/shapes` file:
```C++
names (smallSphere largeSphere); // names of particles
diameters (0.01 0.0101); // diameter of particles (m)
materials (lightMat lightMat); // material names for particles
```
Both particle types share the same material properties but differ slightly in size to allow for visual distinction during mixing.
### Particle Insertion
Particles are inserted in two sequential phases, as defined in `caseSetup/particleInsertion`:
```C++
active Yes; // is insertion active -> Yes or No
rightregion
{
timeControl simulationTime; // Controls insertion based on simulation time
regionType cylinder; // Defines a cylindrical insertion region
rate 10000; // Inserts 10,000 particles per second
startTime 0.0; // Starts inserting at t = 0s (beginning of simulation)
endTime 1.0; // Stops inserting at t = 1s
insertionInterval 0.025; // Inserts particles every 0.025s
// (40 insertion events during the 1s period)
cylinderInfo {
// Defines cylinder endpoints and radius
p1 (0.0950615 0.12 0.5011585); // First endpoint coordinates (x,y,z) in meters
p2 (0.1150615 0.12 0.4811585); // Second endpoint coordinates (x,y,z) in meters
radius 0.1; // Cylinder radius in meters
}
setFields {
// Initial properties for inserted particles
velocity realx3 (1.2 0.0 -1.2); // Initial velocity vector (x,y,z) in m/s
// Particles move to the right and downward
}
mixture {
// Particle type distribution
smallSphere 1; // 100% of inserted particles are "smallSphere" type
}
}
leftregion
{
timeControl simulationTime; // Controls insertion based on simulation time
regionType cylinder; // Defines a cylindrical insertion region
rate 10000; // Inserts 10,000 particles per second
startTime 1.5; // Starts inserting at t = 1.5s
// (after the first insertion phase)
endTime 2.5; // Stops inserting at t = 2.5s
insertionInterval 0.025; // Inserts particles every 0.025s
// (40 insertion events during the 1s period)
cylinderInfo {
// Defines cylinder endpoints and radius
p1 (0.7562545 0.12 0.50079); // First endpoint coordinates (x,y,z) in meters
p2 (0.7362545 0.12 0.48079); // Second endpoint coordinates (x,y,z) in meters
radius 0.1; // Cylinder radius in meters
}
setFields {
// Initial properties for inserted particles
velocity realx3 (-1.2 0.0 -1.2); // Initial velocity vector (x,y,z) in m/s
// Particles move to the left and downward
}
mixture {
// Particle type distribution
largeSphere 1; // 100% of inserted particles are "largeSphere" type
}
}
```
#### Detailed Explanation of Insertion Parameters
1. **`rightregion` Dictionary**:
- Creates a cylindrical insertion region on the right side of the V-blender
- Active during t=0s to t=1s at the beginning of the simulation
- Particles are inserted from randomly generated positions within the cylinder
- Inserts "smallSphere" particles with 10mm diameter
- Initial velocity (1.2, 0.0, -1.2) m/s directs particles toward the center and bottom of the blender
- 40 insertion events occur (every 0.025s), each adding approximately 250 particles
2. **`leftregion` Dictionary**:
- Creates a symmetrical cylindrical insertion region on the left side of the V-blender
- Active during t=1.5s to t=2.5s, after the first batch of particles has settled
- Inserts "largeSphere" particles with 10.1mm diameter
- Initial velocity (-1.2, 0.0, -1.2) m/s directs particles toward the center and bottom of the blender
- Mirror image of the first insertion but with slightly larger particles
3. **Insertion Region Selection**:
- Cylindrical insertion regions are positioned above each arm of the V-blender
- This arrangement ensures particles fall naturally into the V-blender without initial overlap
4. **Timing Strategy**:
- Sequential insertion with a 0.5s gap between phases allows the first batch to settle
- All particles settle for 0.5s after the second insertion (t=2.5s to t=3.0s)
- Blender rotation begins after all particles have settled (t=3.0s)
### Geometry and Motion
The V-blender geometry is defined in `settings/geometryDict` using an STL file:
```C++
motionModel rotatingAxis; // motion model: rotating object around an axis
rotatingAxisInfo // information for rotatingAxis motion model
{
rotAxis
{
p1 (0.128228 0.116446 0.297901); // first point for the axis of rotation
p2 (0.722596 0.116459 0.297901); // second point for the axis of rotation
omega 3.14; // rotation speed (rad/s)
startTime 3; // start time of rotation
endTime 10; // end time of rotation
}
}
```
The blender starts rotating at t = 3.0 s, after both particle types have been inserted and allowed to settle.
### Simulation Domain and Boundaries
The simulation domain is defined in `settings/domainDict`:
```C++
globalBox
{
min (-0.1 -0.4 0); // lower corner point of the box
max (0.86 0.6 0.6); // upper corner point of the box
}
```
All boundaries are set to "exit" type, meaning particles that go outside the domain will be deleted.
### Particle Interaction Properties
Material properties and interaction parameters are defined in `caseSetup/interaction`:
```C++
materials (wallMat lightMat); // a list of materials names
densities (1000 1000); // density of materials [kg/m3]
// Contact force models
model
{
contactForceModel nonLinearNonLimited;
rollingFrictionModel normal;
// Material properties
Yeff (1.0e6 1.0e6
1.0e6); // Young modulus [Pa]
Geff (0.8e6 0.8e6
0.8e6); // Shear modulus [Pa]
nu (0.25 0.25
0.25); // Poisson's ratio [-]
en (0.97 0.85
0.97); // coefficient of normal restitution
mu (0.65 0.35
0.65); // dynamic friction
mur (0.1 0.1
0.1); // rolling friction
}
```
## Running the Simulation
To run this simulation, execute the following commands in sequence:
1. First, create the geometry:
```
geometryPhasicFlow
```
2. Next, initialize the particle system (note: starts with zero particles):
```
particlesPhasicFlow
```
3. Finally, run the simulation:
```
sphereGranFlow
```
The simulation will automatically insert particles according to the defined schedule and begin rotating the V-blender at the specified time.
## Visualizing Results
After the simulation completes, you can convert the results to VTK format for visualization:
```
pFlowToVTK --binary
```
The VTK files will be stored in a new directory called `./VTK` and can be visualized using tools like ParaView or VisIt.
## Expected Behavior
During the simulation, you should observe:
1. Initial filling with small particles from the right side (0-1s)
2. A brief settling period (1-1.5s)
3. Filling with large particles from the left side (1.5-2.5s)
4. Another settling period (2.5-3s)
5. Rotation of the V-blender causing mixing of the two particle types (3-10s)

View File

@ -6,6 +6,7 @@ objectName interaction;
objectType dicrionary; objectType dicrionary;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
materials (wallMat lightMat); // a list of materials names materials (wallMat lightMat); // a list of materials names
densities (1000 1000); // density of materials [kg/m3] densities (1000 1000); // density of materials [kg/m3]
@ -14,7 +15,7 @@ contactListType sortedContactList;
contactSearch contactSearch
{ {
method NBS; // method for broad search method NBS;
updateInterval 10; updateInterval 10;

View File

@ -6,9 +6,10 @@ objectName particleInsertion;
objectType dicrionary; objectType dicrionary;
fileFormat ASCII; fileFormat ASCII;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
active Yes; // is insertion active -> Yes or No active Yes; // is insertion active -> Yes or No
checkForCollision Yes; // is checked -> Yes or No
/* /*
Two layers of particles are packed one-by-one using tho insertion steps Two layers of particles are packed one-by-one using tho insertion steps
@ -69,12 +70,11 @@ leftregion
{ {
/* coordinates of center of both ends of the insertion /* coordinates of center of both ends of the insertion
cylinder on the left side of the V-blender (m,m,m) */ cylinder on the left side of the V-blender (m,m,m) */
p1 ( 0.7562545 0.12 0.50079); p1 ( 0.7562545 0.12 0.50079);
p2 ( 0.7362545 0.12 0.48079); p2 ( 0.7362545 0.12 0.48079);
radius 0.1; // radius of cylinder (m) radius 0.1;
} }
setFields setFields

View File

@ -25,26 +25,26 @@ boundaries
right right
{ {
type exit; // other options: periodict, reflective type exit; // other options: periodic, reflective
} }
bottom bottom
{ {
type exit; // other options: periodict, reflective type exit; // other options: periodic, reflective
} }
top top
{ {
type exit; // other options: periodict, reflective type exit; // other options: periodic, reflective
} }
rear rear
{ {
type exit; // other options: periodict, reflective type exit; // other options: periodic, reflective
} }
front front
{ {
type exit; // other options: periodict, reflective type exit; // other options: periodic, reflective
} }
} }

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

View File

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

View File

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

Some files were not shown because too many files have changed in this diff Show More