diff --git a/src/PostprocessData/fieldsDataBase/fieldFunctions.hpp b/src/PostprocessData/fieldsDataBase/fieldFunctions.hpp index ea5b7110..7454188d 100644 --- a/src/PostprocessData/fieldsDataBase/fieldFunctions.hpp +++ b/src/PostprocessData/fieldsDataBase/fieldFunctions.hpp @@ -24,7 +24,7 @@ Licence: #include "types.hpp" #include "span.hpp" -namespace pFlow +namespace pFlow::postprocessData { template diff --git a/src/PostprocessData/fieldsDataBase/fieldsDataBase.cpp b/src/PostprocessData/fieldsDataBase/fieldsDataBase.cpp index 51a533b4..731e0881 100644 --- a/src/PostprocessData/fieldsDataBase/fieldsDataBase.cpp +++ b/src/PostprocessData/fieldsDataBase/fieldsDataBase.cpp @@ -26,20 +26,18 @@ Licence: #include "fieldFunctions.hpp" #include "dictionary.hpp" -namespace pFlow -{ -bool pointFieldGetType(const word& TYPENAME, word& fieldType, word& fieldSpace); - -} - -bool pFlow::fieldsDataBase::loadPointStructureToTime() +bool pFlow::postprocessData::fieldsDataBase::loadPointStructureToTime() { return false; } -bool pFlow::fieldsDataBase::checkForUpdate(const word &compoundName, bool forceUpdate) +bool pFlow::postprocessData::fieldsDataBase::checkForUpdate +( + const word &compoundName, + bool forceUpdate +) { auto t = currentTime(); bool shouldUpdate = false; @@ -58,7 +56,10 @@ bool pFlow::fieldsDataBase::checkForUpdate(const word &compoundName, bool forceU return shouldUpdate; } -pFlow::span pFlow::fieldsDataBase::createOrGetRealField(const word &name) +pFlow::span pFlow::postprocessData::fieldsDataBase::createOrGetRealField +( + const word &name +) { bool shouldUpdate = checkForUpdate(name); @@ -83,7 +84,10 @@ pFlow::span pFlow::fieldsDataBase::createOrGetRealField(const word field.size()); } -pFlow::span pFlow::fieldsDataBase::createOrGetVolume(bool forceUpdate) +pFlow::span pFlow::postprocessData::fieldsDataBase::createOrGetVolume +( + bool forceUpdate +) { const word fName = "volume"; bool shouldUpdate = checkForUpdate(fName, forceUpdate); @@ -119,7 +123,7 @@ pFlow::span pFlow::fieldsDataBase::createOrGetVolume(bool forceUpda } -pFlow::span pFlow::fieldsDataBase::createOrGetDensity(bool forceUpdate) +pFlow::span pFlow::postprocessData::fieldsDataBase::createOrGetDensity(bool forceUpdate) { const word fName = "density"; @@ -155,7 +159,7 @@ pFlow::span pFlow::fieldsDataBase::createOrGetDensity(bool forceUpd field.size()); } -pFlow::span pFlow::fieldsDataBase::createOrGetOne(bool forceUpdate) +pFlow::span pFlow::postprocessData::fieldsDataBase::createOrGetOne(bool forceUpdate) { const word fName = "one"; @@ -182,7 +186,7 @@ pFlow::span pFlow::fieldsDataBase::createOrGetOne(bool forceUpdate) field.size()); } -pFlow::span pFlow::fieldsDataBase::createOrGetMass(bool forceUpdate) +pFlow::span pFlow::postprocessData::fieldsDataBase::createOrGetMass(bool forceUpdate) { const word fName = "mass"; @@ -218,7 +222,7 @@ pFlow::span pFlow::fieldsDataBase::createOrGetMass(bool forceUpdate field.size()); } -pFlow::span pFlow::fieldsDataBase::createOrGetI(bool forceUpdate) +pFlow::span pFlow::postprocessData::fieldsDataBase::createOrGetI(bool forceUpdate) { const word fName = "I"; @@ -254,7 +258,7 @@ pFlow::span pFlow::fieldsDataBase::createOrGetI(bool forceUpdate) field.size()); } -bool pFlow::fieldsDataBase::findFunction( +bool pFlow::postprocessData::fieldsDataBase::findFunction( const word &compoundFieldName, word &fieldName, fieldsDataBase::Functions &func) @@ -360,7 +364,7 @@ bool pFlow::fieldsDataBase::findFunction( return false; // No match } -bool pFlow::fieldsDataBase::inputOutputType +bool pFlow::postprocessData::fieldsDataBase::inputOutputType ( fieldsDataBase::Functions func, const word &inputType, @@ -458,7 +462,7 @@ bool pFlow::fieldsDataBase::inputOutputType return false; } -pFlow::fieldsDataBase::fieldsDataBase +pFlow::postprocessData::fieldsDataBase::fieldsDataBase ( systemControl& control, 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(); } -bool pFlow::fieldsDataBase::getFieldTypeNameFunction +bool pFlow::postprocessData::fieldsDataBase::getFieldTypeNameFunction ( const word& compoundName, word& pointFieldName, @@ -543,7 +547,7 @@ bool pFlow::fieldsDataBase::getFieldTypeNameFunction return true; } -bool pFlow::fieldsDataBase::getFieldType +bool pFlow::postprocessData::fieldsDataBase::getFieldType ( const word& compoundName, word& originalType, @@ -559,7 +563,7 @@ bool pFlow::fieldsDataBase::getFieldType return true; } -bool pFlow::fieldsDataBase::getFieldType +bool pFlow::postprocessData::fieldsDataBase::getFieldType ( const word &compoundName, word &typeAfterFunction @@ -575,7 +579,7 @@ bool pFlow::fieldsDataBase::getFieldType return true; } -pFlow::span pFlow::fieldsDataBase::updatePoints(bool forceUpdate) +pFlow::span pFlow::postprocessData::fieldsDataBase::updatePoints(bool forceUpdate) { const word fName = "position"; bool shouldUpdate = checkForUpdate(fName, forceUpdate); @@ -604,7 +608,7 @@ pFlow::span pFlow::fieldsDataBase::updatePoints(bool forceUpdate) } -pFlow::span pFlow::fieldsDataBase::updateFieldRealx3 +pFlow::span pFlow::postprocessData::fieldsDataBase::updateFieldRealx3 ( const word &compoundName, bool forceUpdate @@ -640,7 +644,7 @@ pFlow::span pFlow::fieldsDataBase::updateFieldRealx3 } -pFlow::span pFlow::fieldsDataBase::updateFieldRealx4 +pFlow::span pFlow::postprocessData::fieldsDataBase::updateFieldRealx4 ( const word &compoundName, bool forceUpdate @@ -676,7 +680,7 @@ pFlow::span pFlow::fieldsDataBase::updateFieldRealx4 } -pFlow::span pFlow::fieldsDataBase::updateFieldReal +pFlow::span pFlow::postprocessData::fieldsDataBase::updateFieldReal ( const word &compoundName, bool forceUpdate @@ -843,7 +847,7 @@ pFlow::span pFlow::fieldsDataBase::updateFieldReal return span(nullptr, 0); } -pFlow::span pFlow::fieldsDataBase::updateFieldUint32 +pFlow::span pFlow::postprocessData::fieldsDataBase::updateFieldUint32 ( const word& name, bool forceUpdate @@ -852,7 +856,7 @@ pFlow::span pFlow::fieldsDataBase::updateFieldUint32 return updateField(name, forceUpdate); } -pFlow::allPointFieldTypes pFlow::fieldsDataBase::updateFieldAll +pFlow::postprocessData::allPointFieldTypes pFlow::postprocessData::fieldsDataBase::updateFieldAll ( const word &compoundName, 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::fieldsDataBase::create +pFlow::uniquePtr + pFlow::postprocessData::fieldsDataBase::create ( systemControl& control, const dictionary& postDict, @@ -931,14 +949,5 @@ pFlow::uniquePtr 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; -} + diff --git a/src/PostprocessData/fieldsDataBase/fieldsDataBase.hpp b/src/PostprocessData/fieldsDataBase/fieldsDataBase.hpp index 6af3f2f9..fb707b1e 100644 --- a/src/PostprocessData/fieldsDataBase/fieldsDataBase.hpp +++ b/src/PostprocessData/fieldsDataBase/fieldsDataBase.hpp @@ -29,13 +29,15 @@ Licence: #include "Map.hpp" #include "shape.hpp" - namespace pFlow { + class dictionary; + class systemControl; + class Time; +} -class dictionary; -class systemControl; -class Time; +namespace pFlow::postprocessData +{ class fieldsDataBase @@ -302,6 +304,12 @@ public: { return -1.0; } + + static + bool pointFieldGetType( + const word& TYPENAME, + word& fieldType, + word& fieldSpace); static uniquePtr create( @@ -311,7 +319,7 @@ public: timeValue startTime); }; -} // namespace pFlow +} // namespace pFlow::postprocessData #include "fieldsDataBaseTemplates.cpp" diff --git a/src/PostprocessData/fieldsDataBase/fieldsDataBaseDclr.hpp b/src/PostprocessData/fieldsDataBase/fieldsDataBaseDclr.hpp index 283b5e7b..e5d483c0 100644 --- a/src/PostprocessData/fieldsDataBase/fieldsDataBaseDclr.hpp +++ b/src/PostprocessData/fieldsDataBase/fieldsDataBaseDclr.hpp @@ -9,7 +9,7 @@ #include "types.hpp" #include "span.hpp" -namespace pFlow +namespace pFlow::postprocessData { diff --git a/src/PostprocessData/fieldsDataBase/fieldsDataBaseTemplates.cpp b/src/PostprocessData/fieldsDataBase/fieldsDataBaseTemplates.cpp index b473e8c8..33cb0d87 100644 --- a/src/PostprocessData/fieldsDataBase/fieldsDataBaseTemplates.cpp +++ b/src/PostprocessData/fieldsDataBase/fieldsDataBaseTemplates.cpp @@ -23,9 +23,9 @@ Licence: #include "fieldsDataBase.hpp" -template +template inline -pFlow::span pFlow::fieldsDataBase::updateField(const word& name, bool forceUpdate) +pFlow::span pFlow::postprocessData::fieldsDataBase::updateField(const word& name, bool forceUpdate) { bool shouldUpdate = checkForUpdate(name, forceUpdate); @@ -40,8 +40,8 @@ pFlow::span pFlow::fieldsDataBase::updateField(const word& name, bool forceUp { if( loadPointFieldToTime(name) ) { - const auto& pField = time_.lookupObject>(name); - allFields_.emplaceBackOrReplace>( + const auto& pField = time_.template lookupObject>(name); + allFields_.template emplaceBackOrReplace>( name, pField.activeValuesHost()); } @@ -63,9 +63,9 @@ pFlow::span pFlow::fieldsDataBase::updateField(const word& name, bool forceUp } -template +template inline -pFlow::span pFlow::fieldsDataBase::updateReservedField +pFlow::span pFlow::postprocessData::fieldsDataBase::updateReservedField ( const word& name, bool forceUpdate diff --git a/src/PostprocessData/fieldsDataBase/simulationFieldsDataBase.cpp b/src/PostprocessData/fieldsDataBase/simulationFieldsDataBase.cpp index 9348037a..b4e19f6a 100644 --- a/src/PostprocessData/fieldsDataBase/simulationFieldsDataBase.cpp +++ b/src/PostprocessData/fieldsDataBase/simulationFieldsDataBase.cpp @@ -3,38 +3,38 @@ #include "dynamicPointStructure.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); } -bool pFlow::simulationFieldsDataBase::loadPointFieldToTime(const word &name) +bool pFlow::postprocessData::simulationFieldsDataBase::loadPointFieldToTime(const word &name) { return time().lookupObjectName(name); } -bool pFlow::simulationFieldsDataBase::loadPointStructureToTime() +bool pFlow::postprocessData::simulationFieldsDataBase::loadPointStructureToTime() { // it is already in the Time object return time().lookupObjectName(pointStructureFile__); } -const pFlow::shape& pFlow::simulationFieldsDataBase::getShape() const +const pFlow::shape& pFlow::postprocessData::simulationFieldsDataBase::getShape() const { 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 type, space; - if(!pointFieldGetType(pfType, type, space)) + if(!fieldsDataBase::pointFieldGetType(pfType, type, space)) { fatalErrorInFunction <<"Error in retriving the type of pointField " @@ -44,7 +44,7 @@ pFlow::word pFlow::simulationFieldsDataBase::getPointFieldType(const word &name) return type; } -pFlow::simulationFieldsDataBase::simulationFieldsDataBase +pFlow::postprocessData::simulationFieldsDataBase::simulationFieldsDataBase ( systemControl &control, 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 static_cast diff --git a/src/PostprocessData/fieldsDataBase/simulationFieldsDataBase.hpp b/src/PostprocessData/fieldsDataBase/simulationFieldsDataBase.hpp index de1d5b51..298a4957 100644 --- a/src/PostprocessData/fieldsDataBase/simulationFieldsDataBase.hpp +++ b/src/PostprocessData/fieldsDataBase/simulationFieldsDataBase.hpp @@ -23,7 +23,7 @@ Licence: #include "fieldsDataBase.hpp" -namespace pFlow +namespace pFlow::postprocessData { class simulationFieldsDataBase diff --git a/src/PostprocessData/operation/PostprocessOperation/PostprocessOperationAvMassVelocity.cpp b/src/PostprocessData/operation/PostprocessOperation/PostprocessOperationAvMassVelocity.cpp index 580d5ae0..b64ba902 100644 --- a/src/PostprocessData/operation/PostprocessOperation/PostprocessOperationAvMassVelocity.cpp +++ b/src/PostprocessData/operation/PostprocessOperation/PostprocessOperationAvMassVelocity.cpp @@ -1,6 +1,9 @@ #include "PostprocessOperationAvMassVelocity.hpp" -pFlow::PostprocessOperationAvMassVelocity::PostprocessOperationAvMassVelocity +namespace pFlow::postprocessData +{ + +PostprocessOperationAvMassVelocity::PostprocessOperationAvMassVelocity ( const dictionary &opDict, const regionPoints ®Points, @@ -17,4 +20,6 @@ pFlow::PostprocessOperationAvMassVelocity::PostprocessOperationAvMassVelocity fieldsDB ) { +} + } \ No newline at end of file diff --git a/src/PostprocessData/operation/PostprocessOperation/PostprocessOperationAvMassVelocity.hpp b/src/PostprocessData/operation/PostprocessOperation/PostprocessOperationAvMassVelocity.hpp index 5c0f164e..4cbdf5a2 100644 --- a/src/PostprocessData/operation/PostprocessOperation/PostprocessOperationAvMassVelocity.hpp +++ b/src/PostprocessData/operation/PostprocessOperation/PostprocessOperationAvMassVelocity.hpp @@ -132,7 +132,7 @@ Licence: #include "regionField.hpp" #include "includeMask.hpp" -namespace pFlow +namespace pFlow::postprocessData { @@ -168,6 +168,6 @@ public: }; -} +} // namespace pFlow::postprocessData #endif //__PostprocessOperationAvMassVelocity_hpp__ \ No newline at end of file diff --git a/src/PostprocessData/operation/PostprocessOperation/PostprocessOperationAverage.cpp b/src/PostprocessData/operation/PostprocessOperation/PostprocessOperationAverage.cpp index 3ffbd5b8..07a4411e 100644 --- a/src/PostprocessData/operation/PostprocessOperation/PostprocessOperationAverage.cpp +++ b/src/PostprocessData/operation/PostprocessOperation/PostprocessOperationAverage.cpp @@ -3,8 +3,11 @@ #include "fieldsDataBase.hpp" #include "operationFunctions.hpp" +namespace pFlow::postprocessData +{ + /// Constructs average processor and initializes result field based on input field type -pFlow::PostprocessOperationAverage::PostprocessOperationAverage +PostprocessOperationAverage::PostprocessOperationAverage ( const dictionary &opDict, const regionPoints ®Points, @@ -39,7 +42,7 @@ pFlow::PostprocessOperationAverage::PostprocessOperationAverage } } -pFlow::PostprocessOperationAverage::PostprocessOperationAverage +PostprocessOperationAverage::PostprocessOperationAverage ( const dictionary &opDict, const word &fieldName, @@ -77,8 +80,9 @@ pFlow::PostprocessOperationAverage::PostprocessOperationAverage } } + /// Performs weighted average of field values within each region -bool pFlow::PostprocessOperationAverage::execute +bool PostprocessOperationAverage::execute ( const std::vector>& weights, const regionField& volFactor @@ -109,7 +113,7 @@ bool pFlow::PostprocessOperationAverage::execute allField) ); - if(calculateFluctuation2_) + if(calculateFluctuation2_()) { auto& processedRegField = processedRegFieldPtr_(); fluctuation2FieldPtr_ = makeUnique @@ -137,4 +141,41 @@ bool pFlow::PostprocessOperationAverage::execute return true; -} \ No newline at end of file +} + +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(path); + + regPoints().write(os2Ptr_()); + } + + + std::visit + ( + [&](auto&& arg)->bool + { + return writeField(os2Ptr_(), ti.t(), arg, threshold()); + }, + fluctuation2FieldPtr_() + ); + + return true; +} + +} // namespace pFlow::postprocessData \ No newline at end of file diff --git a/src/PostprocessData/operation/PostprocessOperation/PostprocessOperationAverage.hpp b/src/PostprocessData/operation/PostprocessOperation/PostprocessOperationAverage.hpp index 6620d588..1840c0c4 100644 --- a/src/PostprocessData/operation/PostprocessOperation/PostprocessOperationAverage.hpp +++ b/src/PostprocessData/operation/PostprocessOperation/PostprocessOperationAverage.hpp @@ -132,10 +132,9 @@ Licence: #include "regionField.hpp" #include "includeMask.hpp" -namespace pFlow +namespace pFlow::postprocessData { - class PostprocessOperationAverage : public postprocessOperation @@ -150,6 +149,9 @@ private: uniquePtr fluctuation2FieldPtr_ = nullptr; + /// Pointer to the output stream for writing fluctuation2 results + mutable uniquePtr os2Ptr_ = nullptr; + public: TypeInfo("PostprocessOperation"); @@ -190,6 +192,10 @@ public: return processedRegFieldPtr_(); } + /// write to os stream + bool write(const fileSystem &parDir)const override; + + /// @brief Execute average operation on field values /// @param weights Weight factors for particles /// @return True if successful @@ -200,6 +206,6 @@ public: }; -} +} // namespace pFlow::postprocessData #endif //__PostprocessOperationAverage_hpp__ \ No newline at end of file diff --git a/src/PostprocessData/operation/PostprocessOperation/PostprocessOperationSum.cpp b/src/PostprocessData/operation/PostprocessOperation/PostprocessOperationSum.cpp index c10315d7..1eec581f 100644 --- a/src/PostprocessData/operation/PostprocessOperation/PostprocessOperationSum.cpp +++ b/src/PostprocessData/operation/PostprocessOperation/PostprocessOperationSum.cpp @@ -3,8 +3,11 @@ #include "fieldsDataBase.hpp" #include "operationFunctions.hpp" +namespace pFlow::postprocessData +{ + /// Constructs sum processor and initializes result field based on input field type -pFlow::PostprocessOperationSum::PostprocessOperationSum +PostprocessOperationSum::PostprocessOperationSum ( const dictionary &opDict, const regionPoints ®Points, @@ -39,7 +42,7 @@ pFlow::PostprocessOperationSum::PostprocessOperationSum } /// Performs weighted sum of field values within each region -bool pFlow::PostprocessOperationSum::execute +bool PostprocessOperationSum::execute ( const std::vector>& weights, const regionField& volFactor @@ -72,3 +75,6 @@ bool pFlow::PostprocessOperationSum::execute return true; } + + +} \ No newline at end of file diff --git a/src/PostprocessData/operation/PostprocessOperation/PostprocessOperationSum.hpp b/src/PostprocessData/operation/PostprocessOperation/PostprocessOperationSum.hpp index b811e89b..4452be0e 100644 --- a/src/PostprocessData/operation/PostprocessOperation/PostprocessOperationSum.hpp +++ b/src/PostprocessData/operation/PostprocessOperation/PostprocessOperationSum.hpp @@ -129,7 +129,7 @@ Licence: #include "regionField.hpp" #include "includeMask.hpp" -namespace pFlow +namespace pFlow::postprocessData { @@ -182,6 +182,6 @@ public: }; -} +} // namespace pFlow::postprocessData #endif //__PostprocessOperationSum_hpp__ \ No newline at end of file diff --git a/src/PostprocessData/operation/PostprocessOperation/operationFunctions.hpp b/src/PostprocessData/operation/PostprocessOperation/operationFunctions.hpp index 8dbe643b..d9c23552 100644 --- a/src/PostprocessData/operation/PostprocessOperation/operationFunctions.hpp +++ b/src/PostprocessData/operation/PostprocessOperation/operationFunctions.hpp @@ -28,7 +28,7 @@ Licence: #include "regionField.hpp" #include "includeMask.hpp" -namespace pFlow +namespace pFlow::postprocessData { template @@ -190,6 +190,6 @@ regionField executeFluctuation2Operation return processedField; } -} // namespace pFlow +} // namespace pFlow::postprocessData #endif //__operationFunctions_hpp__ diff --git a/src/PostprocessData/operation/includeMask/IncludeMask.hpp b/src/PostprocessData/operation/includeMask/IncludeMask.hpp index 34ae4dfb..3689f22c 100644 --- a/src/PostprocessData/operation/includeMask/IncludeMask.hpp +++ b/src/PostprocessData/operation/includeMask/IncludeMask.hpp @@ -61,7 +61,7 @@ Licence: #include "Time.hpp" -namespace pFlow +namespace pFlow::postprocessData { template @@ -270,7 +270,7 @@ public: }; -} // pFlow +} // pFlow::postprocessData #endif //__IncludeMask_hpp__ diff --git a/src/PostprocessData/operation/includeMask/IncludeMasks.cpp b/src/PostprocessData/operation/includeMask/IncludeMasks.cpp index 8fd6cd3e..7e8e687c 100644 --- a/src/PostprocessData/operation/includeMask/IncludeMasks.cpp +++ b/src/PostprocessData/operation/includeMask/IncludeMasks.cpp @@ -20,31 +20,34 @@ Licence: #include "IncludeMask.hpp" +namespace pFlow::postprocessData +{ + // real -template class pFlow::IncludeMask >; -template class pFlow::IncludeMask >; +template class IncludeMask >; +template class IncludeMask >; -template class pFlow::IncludeMask >; -template class pFlow::IncludeMask >; +template class IncludeMask >; +template class IncludeMask >; -template class pFlow::IncludeMask >; +template class IncludeMask >; -template class pFlow::IncludeMask >; -template class pFlow::IncludeMask >; +template class IncludeMask >; +template class IncludeMask >; -template class pFlow::IncludeMask>; +template class IncludeMask>; // realx3 -template class pFlow::IncludeMask >; -template class pFlow::IncludeMask >; +template class IncludeMask >; +template class IncludeMask >; -template class pFlow::IncludeMask >; -template class pFlow::IncludeMask >; +template class IncludeMask >; +template class IncludeMask >; -template class pFlow::IncludeMask >; +template class IncludeMask >; -template class pFlow::IncludeMask >; -template class pFlow::IncludeMask >; +template class IncludeMask >; +template class IncludeMask >; -// realx4 +} // postprocessData diff --git a/src/PostprocessData/operation/includeMask/includeMask.cpp b/src/PostprocessData/operation/includeMask/includeMask.cpp index 209391be..6ba84aa8 100644 --- a/src/PostprocessData/operation/includeMask/includeMask.cpp +++ b/src/PostprocessData/operation/includeMask/includeMask.cpp @@ -24,7 +24,10 @@ Licence: #include "fieldsDataBase.hpp" -pFlow::includeMask::includeMask +namespace pFlow::postprocessData +{ + +includeMask::includeMask ( const dictionary& dict, fieldsDataBase& fieldDB @@ -33,7 +36,7 @@ pFlow::includeMask::includeMask database_(fieldDB) {} -pFlow::includeMask::includeMask +includeMask::includeMask ( const word &type, const dictionary &opDict, @@ -44,7 +47,7 @@ pFlow::includeMask::includeMask { } -pFlow::uniquePtr pFlow::includeMask::create +uniquePtr includeMask::create ( const dictionary& opDict, fieldsDataBase& fieldsDB @@ -97,8 +100,7 @@ pFlow::uniquePtr pFlow::includeMask::create return nullptr; } -pFlow::uniquePtr - pFlow::includeMask::create +uniquePtr includeMask::create ( const word &type, const dictionary &opDict, @@ -150,3 +152,5 @@ pFlow::uniquePtr } return nullptr; } + +} \ No newline at end of file diff --git a/src/PostprocessData/operation/includeMask/includeMask.hpp b/src/PostprocessData/operation/includeMask/includeMask.hpp index 928822b8..1f58a31a 100644 --- a/src/PostprocessData/operation/includeMask/includeMask.hpp +++ b/src/PostprocessData/operation/includeMask/includeMask.hpp @@ -47,11 +47,15 @@ Licence: #include "virtualConstructor.hpp" namespace pFlow +{ + class dictionary; +} + +namespace pFlow::postprocessData { // forward declaration class fieldsDataBase; -class dictionary; class includeMask @@ -188,7 +192,7 @@ public: -} // pFlow +} // pFlow::postprocessData #endif //__IncludeMask_hpp__ diff --git a/src/PostprocessData/operation/includeMask/maskOperations.hpp b/src/PostprocessData/operation/includeMask/maskOperations.hpp index 63bb5665..054ea240 100644 --- a/src/PostprocessData/operation/includeMask/maskOperations.hpp +++ b/src/PostprocessData/operation/includeMask/maskOperations.hpp @@ -24,7 +24,7 @@ Licence: #include "types.hpp" #include "dictionary.hpp" -namespace pFlow +namespace pFlow::postprocessData { template @@ -176,6 +176,6 @@ public: } }; -} +} // namespace pFlow::postprocessData #endif //__maskOperation_hpp__ \ No newline at end of file diff --git a/src/PostprocessData/operation/postprocessOperation/postprocessOperation.cpp b/src/PostprocessData/operation/postprocessOperation/postprocessOperation.cpp index e752f359..b123f0af 100644 --- a/src/PostprocessData/operation/postprocessOperation/postprocessOperation.cpp +++ b/src/PostprocessData/operation/postprocessOperation/postprocessOperation.cpp @@ -23,66 +23,11 @@ Licence: #include "regionPoints.hpp" #include "fieldsDataBase.hpp" -namespace pFlow + +namespace pFlow::postprocessData { -template -inline -bool writeField -( - iOstream& os, - timeValue t, - const regionField field, - uint32 threshold, - const T& defValue=T{} -) -{ - const auto& regPoints = field.regPoints(); - const uint32 n = field.size(); - os<= threshold) - { - if constexpr(std::is_same_v) - { - os<) - { - os << field[i].x() << ' ' << field[i].y() << ' ' << field[i].z() << ' ' << field[i].w() << tab; - } - else - { - os<) - { - os<) - { - os << defValue.x() << ' ' << defValue.y() << ' ' << defValue.z() << ' ' << defValue.w() << tab; - } - else - { - os< -pFlow::postprocessOperation::create( +uniquePtr postprocessOperation::create +( const dictionary &opDict, const regionPoints ®Points, - fieldsDataBase &fieldsDB) + fieldsDataBase &fieldsDB +) { word func = opDict.getVal("function"); word method = angleBracketsNames("PostprocessOperation", func); @@ -209,3 +155,5 @@ pFlow::postprocessOperation::create( return nullptr; } } + +} \ No newline at end of file diff --git a/src/PostprocessData/operation/postprocessOperation/postprocessOperation.hpp b/src/PostprocessData/operation/postprocessOperation/postprocessOperation.hpp index 285a7b7e..73aa3112 100644 --- a/src/PostprocessData/operation/postprocessOperation/postprocessOperation.hpp +++ b/src/PostprocessData/operation/postprocessOperation/postprocessOperation.hpp @@ -76,23 +76,19 @@ Licence: #include "oFstream.hpp" #include "regionField.hpp" #include "includeMask.hpp" +#include "postprocessOperationFunctions.hpp" namespace pFlow { + class Time; +} -/// Type alias for processed region field types. -/// Only regionField, regionField, and regionField are supported -/// in the postprocessOperation class. -using processedRegFieldType = std::variant - < - regionField, - regionField, - regionField - >; +namespace pFlow::postprocessData +{ /// - forward declaration class fieldsDataBase; -class Time; + class postprocessOperation { @@ -103,7 +99,7 @@ public: private: /// Dictionary containing operation-specific parameters. - dictionary operationDict_; + pFlow::dictionary operationDict_; /// This Threshold is used to exclude the regions which contain /// fewer than this value. @@ -273,6 +269,6 @@ public: }; -} +} // namespace pFlow::postprocessData #endif //__postprocessOperation_hpp__ \ No newline at end of file diff --git a/src/PostprocessData/operation/postprocessOperation/postprocessOperationFunctions.hpp b/src/PostprocessData/operation/postprocessOperation/postprocessOperationFunctions.hpp new file mode 100644 index 00000000..5356cf84 --- /dev/null +++ b/src/PostprocessData/operation/postprocessOperation/postprocessOperationFunctions.hpp @@ -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 + +#include "types.hpp" +#include "iOstream.hpp" +#include "regionField.hpp" + +namespace pFlow::postprocessData +{ + +/// Type alias for processed region field types. +/// Only regionField, regionField, and regionField are supported +/// in the postprocessOperation class. +using processedRegFieldType = std::variant +< + regionField, + regionField, + regionField +>; + + +template +inline +bool writeField +( + iOstream& os, + timeValue t, + const regionField field, + uint32 threshold, + const T& defValue=T{} +) +{ + const auto& regPoints = field.regPoints(); + const uint32 n = field.size(); + os<= threshold) + { + if constexpr(std::is_same_v) + { + os<) + { + os << field[i].x() << ' ' << field[i].y() << ' ' << field[i].z() << ' ' << field[i].w() << tab; + } + else + { + os<) + { + os<) + { + os << defValue.x() << ' ' << defValue.y() << ' ' << defValue.z() << ' ' << defValue.w() << tab; + } + else + { + os< -pFlow::PostprocessComponent::PostprocessComponent +pFlow::postprocessData::PostprocessComponent::PostprocessComponent ( const dictionary& dict, fieldsDataBase& fieldsDB, @@ -61,7 +61,7 @@ pFlow::PostprocessComponent::PostprocessComponent template -bool pFlow::PostprocessComponent::execute +bool pFlow::postprocessData::PostprocessComponent::execute ( const timeInfo &ti, bool forceUpdate @@ -129,7 +129,7 @@ bool pFlow::PostprocessComponent::execute template inline -bool pFlow::PostprocessComponent::write +bool pFlow::postprocessData::PostprocessComponent::write ( const fileSystem &parDir ) const diff --git a/src/PostprocessData/postprocessComponent/PostprocessComponent/PostprocessComponent.hpp b/src/PostprocessData/postprocessComponent/PostprocessComponent/PostprocessComponent.hpp index 996467a1..cc6ead75 100644 --- a/src/PostprocessData/postprocessComponent/PostprocessComponent/PostprocessComponent.hpp +++ b/src/PostprocessData/postprocessComponent/PostprocessComponent/PostprocessComponent.hpp @@ -32,7 +32,7 @@ Licence: #include "regionPoints.hpp" #include "regionField.hpp" -namespace pFlow +namespace pFlow::postprocessData { template diff --git a/src/PostprocessData/postprocessComponent/PostprocessComponent/PostprocessComponentArithmetic.hpp b/src/PostprocessData/postprocessComponent/PostprocessComponent/PostprocessComponentArithmetic.hpp index 7b9a37c3..aa335dd6 100644 --- a/src/PostprocessData/postprocessComponent/PostprocessComponent/PostprocessComponentArithmetic.hpp +++ b/src/PostprocessData/postprocessComponent/PostprocessComponent/PostprocessComponentArithmetic.hpp @@ -24,7 +24,7 @@ Licence: #include "PostprocessComponent.hpp" #include "arithmetic.hpp" -namespace pFlow +namespace pFlow::postprocessData { template diff --git a/src/PostprocessData/postprocessComponent/PostprocessComponent/PostprocessComponentGaussian.hpp b/src/PostprocessData/postprocessComponent/PostprocessComponent/PostprocessComponentGaussian.hpp index 0fb00163..2f5cbd3e 100644 --- a/src/PostprocessData/postprocessComponent/PostprocessComponent/PostprocessComponentGaussian.hpp +++ b/src/PostprocessData/postprocessComponent/PostprocessComponent/PostprocessComponentGaussian.hpp @@ -25,7 +25,7 @@ Licence: #include "GaussianDistribution.hpp" #include "numericConstants.hpp" -namespace pFlow +namespace pFlow::postprocessData { template diff --git a/src/PostprocessData/postprocessComponent/PostprocessComponent/PostprocessComponentUniform.hpp b/src/PostprocessData/postprocessComponent/PostprocessComponent/PostprocessComponentUniform.hpp index 5a181474..93f0d9d2 100644 --- a/src/PostprocessData/postprocessComponent/PostprocessComponent/PostprocessComponentUniform.hpp +++ b/src/PostprocessData/postprocessComponent/PostprocessComponent/PostprocessComponentUniform.hpp @@ -24,7 +24,7 @@ Licence: #include "PostprocessComponent.hpp" #include "uniformDistribution.hpp" -namespace pFlow +namespace pFlow::postprocessData { template diff --git a/src/PostprocessData/postprocessComponent/PostprocessComponent/PostprocessComponents.cpp b/src/PostprocessData/postprocessComponent/PostprocessComponent/PostprocessComponents.cpp index 2a6245a5..5556e342 100644 --- a/src/PostprocessData/postprocessComponent/PostprocessComponent/PostprocessComponents.cpp +++ b/src/PostprocessData/postprocessComponent/PostprocessComponent/PostprocessComponents.cpp @@ -27,16 +27,18 @@ Licence: #include "lineRegionPoints.hpp" #include "multipleSpheresRegionPoints.hpp" +namespace pFlow::postprocessData +{ +template class PostprocessComponentGaussian; +template class PostprocessComponentUniform; +template class PostprocessComponentArithmetic; -template class pFlow::PostprocessComponentGaussian; -template class pFlow::PostprocessComponentUniform; -template class pFlow::PostprocessComponentArithmetic; +template class PostprocessComponentGaussian; +template class PostprocessComponentUniform; +template class PostprocessComponentArithmetic; -template class pFlow::PostprocessComponentGaussian; -template class pFlow::PostprocessComponentUniform; -template class pFlow::PostprocessComponentArithmetic; - -template class pFlow::PostprocessComponentGaussian; -template class pFlow::PostprocessComponentUniform; -template class pFlow::PostprocessComponentArithmetic; +template class PostprocessComponentGaussian; +template class PostprocessComponentUniform; +template class PostprocessComponentArithmetic; +} \ No newline at end of file diff --git a/src/PostprocessData/postprocessComponent/particleProbePostprocessComponent/particleProbePostprocessComponent.cpp b/src/PostprocessData/postprocessComponent/particleProbePostprocessComponent/particleProbePostprocessComponent.cpp index 7588e602..3c390cc9 100644 --- a/src/PostprocessData/postprocessComponent/particleProbePostprocessComponent/particleProbePostprocessComponent.cpp +++ b/src/PostprocessData/postprocessComponent/particleProbePostprocessComponent/particleProbePostprocessComponent.cpp @@ -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 "Time.hpp" -namespace pFlow +namespace pFlow::postprocessData { template @@ -62,7 +82,7 @@ inline bool writeField } -pFlow::particleProbePostprocessComponent::particleProbePostprocessComponent +pFlow::postprocessData::particleProbePostprocessComponent::particleProbePostprocessComponent ( const dictionary &dict, fieldsDataBase &fieldsDB, @@ -81,7 +101,7 @@ pFlow::particleProbePostprocessComponent::particleProbePostprocessComponent name_(dict.name()) {} -bool pFlow::particleProbePostprocessComponent::execute +bool pFlow::postprocessData::particleProbePostprocessComponent::execute ( const timeInfo &ti, 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; diff --git a/src/PostprocessData/postprocessComponent/particleProbePostprocessComponent/particleProbePostprocessComponent.hpp b/src/PostprocessData/postprocessComponent/particleProbePostprocessComponent/particleProbePostprocessComponent.hpp index 5069e291..808e6615 100644 --- a/src/PostprocessData/postprocessComponent/particleProbePostprocessComponent/particleProbePostprocessComponent.hpp +++ b/src/PostprocessData/postprocessComponent/particleProbePostprocessComponent/particleProbePostprocessComponent.hpp @@ -27,7 +27,7 @@ Licence: #include "regionField.hpp" #include "oFstream.hpp" -namespace pFlow +namespace pFlow::postprocessData { diff --git a/src/PostprocessData/postprocessComponent/postprocessComponent/postprocessComponent.cpp b/src/PostprocessData/postprocessComponent/postprocessComponent/postprocessComponent.cpp index ed2e3b6c..d7882334 100644 --- a/src/PostprocessData/postprocessComponent/postprocessComponent/postprocessComponent.cpp +++ b/src/PostprocessData/postprocessComponent/postprocessComponent/postprocessComponent.cpp @@ -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 "fieldsDataBase.hpp" #include "Time.hpp" -pFlow::postprocessComponent::postprocessComponent +pFlow::postprocessData::postprocessComponent::postprocessComponent ( const dictionary &dict, fieldsDataBase &fieldsDB, @@ -23,7 +43,7 @@ pFlow::postprocessComponent::postprocessComponent } -pFlow::uniquePtr pFlow::postprocessComponent::create +pFlow::uniquePtr pFlow::postprocessData::postprocessComponent::create ( const dictionary& dict, fieldsDataBase& fieldsDB, diff --git a/src/PostprocessData/postprocessComponent/postprocessComponent/postprocessComponent.hpp b/src/PostprocessData/postprocessComponent/postprocessComponent/postprocessComponent.hpp index 70db2153..1f6c633f 100644 --- a/src/PostprocessData/postprocessComponent/postprocessComponent/postprocessComponent.hpp +++ b/src/PostprocessData/postprocessComponent/postprocessComponent/postprocessComponent.hpp @@ -25,12 +25,17 @@ Licence: #include "dictionary.hpp" #include "virtualConstructor.hpp" -namespace pFlow +namespace +{ + class dictionary; +} + +namespace pFlow::postprocessData { -class fieldsDataBase; + class regionPoints; -class dictionary; +class fieldsDataBase; class postprocessComponent { @@ -112,6 +117,6 @@ public: }; -} // namespace pFlow +} // namespace pFlow::postprocessData #endif // __postprocessComponent_hpp__ \ No newline at end of file diff --git a/src/PostprocessData/postprocessData/postprocessData.cpp b/src/PostprocessData/postprocessData/postprocessData.cpp index 02afc48e..967bcfda 100644 --- a/src/PostprocessData/postprocessData/postprocessData.cpp +++ b/src/PostprocessData/postprocessData/postprocessData.cpp @@ -1,4 +1,3 @@ - /*------------------------------- phasicFlow --------------------------------- O C enter of O O E ngineering and @@ -25,7 +24,7 @@ Licence: #include "postprocessGlobals.hpp" #include "postprocessComponent.hpp" -pFlow::postprocessData::postprocessData +pFlow::postprocessData::postprocessData::postprocessData ( const systemControl &control, 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( !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(); for(auto& component:postprocesses_) @@ -116,8 +117,10 @@ bool pFlow::postprocessData::execute() return true; } -bool pFlow::postprocessData::write() const +bool pFlow::postprocessData::postprocessData::write() const { + if( inSimulation_ && !activeInSimulation_() ) return true; + for(auto& component:postprocesses_) { if(!component->executed()) @@ -125,7 +128,7 @@ bool pFlow::postprocessData::write() const continue; } - if(!component->write(postProcessGlobals::defaultDir__/component->name())) + if(!component->write(defaultDir__/component->name())) { fatalErrorInFunction <<"Error occured in writing postprocess component: " @@ -136,7 +139,7 @@ bool pFlow::postprocessData::write() const return true; } -void pFlow::postprocessData::setOutputDirectory(const fileSystem &path) const +void pFlow::postprocessData::postprocessData::setOutputDirectory(const fileSystem &path) const { - postProcessGlobals::defaultDir__ = path; + defaultDir__ = path; } diff --git a/src/PostprocessData/postprocessData/postprocessData.hpp b/src/PostprocessData/postprocessData/postprocessData.hpp index 04ae6188..553c3d22 100644 --- a/src/PostprocessData/postprocessData/postprocessData.hpp +++ b/src/PostprocessData/postprocessData/postprocessData.hpp @@ -28,14 +28,18 @@ Licence: #include "fieldsDataBase.hpp" #include "postprocessComponent.hpp" - -namespace pFlow +namespace pFlow { class systemControl; class Time; class timeInfo; +} + +namespace pFlow::postprocessData +{ + /** * @class postprocessData @@ -109,6 +113,6 @@ public: void setOutputDirectory(const fileSystem& path)const; }; -} // namespace pFlow +} // namespace pFlow::postprocessData #endif // __postprocessData_hpp__ \ No newline at end of file diff --git a/src/PostprocessData/postprocessData/postprocessGlobals.hpp b/src/PostprocessData/postprocessData/postprocessGlobals.hpp index 335bc267..f7ba18ec 100644 --- a/src/PostprocessData/postprocessData/postprocessGlobals.hpp +++ b/src/PostprocessData/postprocessData/postprocessGlobals.hpp @@ -23,7 +23,7 @@ Licence: #include "fileSystem.hpp" -namespace pFlow::postProcessGlobals +namespace pFlow::postprocessData { static fileSystem defaultDir__; diff --git a/src/PostprocessData/postprocessData/postprocessTimeControl.hpp b/src/PostprocessData/postprocessData/postprocessTimeControl.hpp index f70cfd2a..1d2689ea 100644 --- a/src/PostprocessData/postprocessData/postprocessTimeControl.hpp +++ b/src/PostprocessData/postprocessData/postprocessTimeControl.hpp @@ -22,9 +22,11 @@ Licence: #define __postprocessTimeControl_hpp__ #include "baseTimeControl.hpp" +#include "dictionary.hpp" -namespace pFlow +namespace pFlow::postprocessData { + class postprocessTimeControl : public baseTimeControl @@ -60,6 +62,6 @@ postprocessTimeControl( // Additional methods and members can be added here }; -} // namespace pFlow +} // namespace pFlow::postprocessData #endif // __postprocessTimeControl_hpp__ \ No newline at end of file diff --git a/src/PostprocessData/processMethod/GaussianDistribution.hpp b/src/PostprocessData/processMethod/GaussianDistribution.hpp index 6248bfa0..06809cf4 100644 --- a/src/PostprocessData/processMethod/GaussianDistribution.hpp +++ b/src/PostprocessData/processMethod/GaussianDistribution.hpp @@ -28,7 +28,7 @@ Licence: #include "span.hpp" #include "numericConstants.hpp" -namespace pFlow +namespace pFlow::postprocessData { class GaussianDistribution diff --git a/src/PostprocessData/processMethod/arithmetic.hpp b/src/PostprocessData/processMethod/arithmetic.hpp index 67a7fd30..bcd36267 100644 --- a/src/PostprocessData/processMethod/arithmetic.hpp +++ b/src/PostprocessData/processMethod/arithmetic.hpp @@ -32,6 +32,9 @@ namespace pFlow class dictionary; +namespace postprocessData +{ + class arithmetic { private: @@ -86,6 +89,8 @@ public: }; -} +} // namespace postprocessData + +} // namespace pFlow #endif //__arithmetic_hpp__ \ No newline at end of file diff --git a/src/PostprocessData/processMethod/uniformDistribution.hpp b/src/PostprocessData/processMethod/uniformDistribution.hpp index d0445615..02f40d15 100644 --- a/src/PostprocessData/processMethod/uniformDistribution.hpp +++ b/src/PostprocessData/processMethod/uniformDistribution.hpp @@ -32,6 +32,9 @@ namespace pFlow class dictionary; +namespace postprocessData +{ + class uniformDistribution { private: @@ -86,6 +89,8 @@ public: }; -} +} // namespace postprocessData + +} // namespace pFlow #endif //__uniformDistribution_hpp__ \ No newline at end of file diff --git a/src/PostprocessData/readme.md b/src/PostprocessData/readme.md new file mode 100644 index 00000000..ee1431ca --- /dev/null +++ b/src/PostprocessData/readme.md @@ -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 + } + ); + } + +); + +``` diff --git a/src/PostprocessData/region/regionFields/regionField.hpp b/src/PostprocessData/region/regionFields/regionField.hpp index 1996fed1..9094cd34 100644 --- a/src/PostprocessData/region/regionFields/regionField.hpp +++ b/src/PostprocessData/region/regionFields/regionField.hpp @@ -25,7 +25,7 @@ Licence: #include "regionPoints.hpp" #include "Field.hpp" -namespace pFlow +namespace pFlow::postprocessData { template @@ -119,7 +119,7 @@ public: }; -} // namespace pFlow +} // namespace pFlow::postprocessData #include "regionFieldTemplate.cpp" diff --git a/src/PostprocessData/region/regionFields/regionFieldTemplate.cpp b/src/PostprocessData/region/regionFields/regionFieldTemplate.cpp index 65112474..408107c6 100644 --- a/src/PostprocessData/region/regionFields/regionFieldTemplate.cpp +++ b/src/PostprocessData/region/regionFields/regionFieldTemplate.cpp @@ -1,10 +1,14 @@ +namespace pFlow::postprocessData +{ template -pFlow::regionField::regionField( +regionField::regionField( const word& name, const regionPoints& rPoints, const T defaultVal) : field_(name, "regionFieldValue", rPoints.size(), rPoints.size(), defaultVal), regionPoints_(rPoints) -{} \ No newline at end of file +{} + +} // End namespace pFlow::postprocessData \ No newline at end of file diff --git a/src/PostprocessData/region/regionPoints/centerPointsRegionPoints/centerPointsRegionPoints.cpp b/src/PostprocessData/region/regionPoints/centerPointsRegionPoints/centerPointsRegionPoints.cpp index b5ffb730..73aaf7f2 100644 --- a/src/PostprocessData/region/regionPoints/centerPointsRegionPoints/centerPointsRegionPoints.cpp +++ b/src/PostprocessData/region/regionPoints/centerPointsRegionPoints/centerPointsRegionPoints.cpp @@ -3,7 +3,10 @@ #include "Set.hpp" #include "pStructSelector.hpp" -bool pFlow::centerPointsRegionPoints::selectIds() +namespace pFlow::postprocessData +{ + +bool centerPointsRegionPoints::selectIds() { if(!firstTimeUpdate_) return true; firstTimeUpdate_ = false; @@ -42,7 +45,7 @@ bool pFlow::centerPointsRegionPoints::selectIds() return true; } -pFlow::centerPointsRegionPoints::centerPointsRegionPoints( +centerPointsRegionPoints::centerPointsRegionPoints( const dictionary &dict, fieldsDataBase &fieldsDataBase) : regionPoints(dict, fieldsDataBase), @@ -50,7 +53,7 @@ pFlow::centerPointsRegionPoints::centerPointsRegionPoints( probDict_(dict) {} -bool pFlow::centerPointsRegionPoints::update() +bool centerPointsRegionPoints::update() { if(!selectIds()) return false; @@ -74,7 +77,7 @@ bool pFlow::centerPointsRegionPoints::update() return true; } -bool pFlow::centerPointsRegionPoints::write(iOstream &os) const +bool centerPointsRegionPoints::write(iOstream &os) const { if(firstTimeUpdate_) { @@ -95,3 +98,5 @@ bool pFlow::centerPointsRegionPoints::write(iOstream &os) const return true; } + +} // End namespace pFlow::postprocessData diff --git a/src/PostprocessData/region/regionPoints/centerPointsRegionPoints/centerPointsRegionPoints.hpp b/src/PostprocessData/region/regionPoints/centerPointsRegionPoints/centerPointsRegionPoints.hpp index 1da7cc4f..979018fc 100644 --- a/src/PostprocessData/region/regionPoints/centerPointsRegionPoints/centerPointsRegionPoints.hpp +++ b/src/PostprocessData/region/regionPoints/centerPointsRegionPoints/centerPointsRegionPoints.hpp @@ -23,7 +23,7 @@ Licence: #include "regionPoints.hpp" -namespace pFlow +namespace pFlow::postprocessData { /** @@ -163,7 +163,7 @@ public: }; // class centerPointsRegionPoints -} // namespace pFlow +} // namespace pFlow::postprocessData diff --git a/src/PostprocessData/region/regionPoints/lineRegionPoints/lineRegionPoints.cpp b/src/PostprocessData/region/regionPoints/lineRegionPoints/lineRegionPoints.cpp index 979a51a6..c313321c 100644 --- a/src/PostprocessData/region/regionPoints/lineRegionPoints/lineRegionPoints.cpp +++ b/src/PostprocessData/region/regionPoints/lineRegionPoints/lineRegionPoints.cpp @@ -1,7 +1,10 @@ #include "lineRegionPoints.hpp" #include "fieldsDataBase.hpp" -pFlow::lineRegionPoints::lineRegionPoints +namespace pFlow::postprocessData +{ + +lineRegionPoints::lineRegionPoints ( const dictionary &dict, fieldsDataBase &fieldsDataBase @@ -14,7 +17,7 @@ pFlow::lineRegionPoints::lineRegionPoints selectedPoints_("selectedPoints") { const auto& lDict = dict.subDict("lineInfo"); - uint32 nPoints = lDict.getValMax("numPoints",2); + uint32 nSpheres = lDict.getValMax("nSpheres",2); realList raddi; if( lDict.containsDataEntry("radii")) @@ -24,24 +27,24 @@ pFlow::lineRegionPoints::lineRegionPoints else { auto r = lDict.getVal("radius"); - raddi = realList(nPoints, r); + raddi = realList(nSpheres, r); } - if(raddi.size() != nPoints) + if(raddi.size() != nSpheres) { fatalErrorInFunction - << "The number elements in of radii list should be equal to the " - << "number of points"< pFlow::lineRegionPoints::indices(uint32 elem) const +pFlow::span lineRegionPoints::indices(uint32 elem) const { if(elem >= size()) { @@ -65,7 +68,7 @@ pFlow::span pFlow::lineRegionPoints::indices(uint32 elem) c selectedPoints_[elem].size()); } -pFlow::span pFlow::lineRegionPoints::indices(uint32 elem) +pFlow::span lineRegionPoints::indices(uint32 elem) { if(elem >= size()) { @@ -80,7 +83,7 @@ pFlow::span pFlow::lineRegionPoints::indices(uint32 elem) selectedPoints_[elem].size()); } -bool pFlow::lineRegionPoints::update() +bool lineRegionPoints::update() { const auto points = database().updatePoints(); for(auto& elem : selectedPoints_) @@ -101,7 +104,7 @@ bool pFlow::lineRegionPoints::update() return true; } -bool pFlow::lineRegionPoints::write(iOstream &os) const +bool lineRegionPoints::write(iOstream &os) const { os << "# Spheres along a straight line \n"; os << "# No." << tab << "centerPoint" << tab << "diameter" << endl; @@ -118,3 +121,5 @@ bool pFlow::lineRegionPoints::write(iOstream &os) const os << endl; return true; } + +} // End namespace pFlow::postprocessData diff --git a/src/PostprocessData/region/regionPoints/lineRegionPoints/lineRegionPoints.hpp b/src/PostprocessData/region/regionPoints/lineRegionPoints/lineRegionPoints.hpp index 58989aab..8271d917 100644 --- a/src/PostprocessData/region/regionPoints/lineRegionPoints/lineRegionPoints.hpp +++ b/src/PostprocessData/region/regionPoints/lineRegionPoints/lineRegionPoints.hpp @@ -54,7 +54,7 @@ Licence: #include "Vectors.hpp" -namespace pFlow +namespace pFlow::postprocessData { class lineRegionPoints diff --git a/src/PostprocessData/region/regionPoints/multipleSpheresRegionPoints/multipleSpheresRegionPoints.cpp b/src/PostprocessData/region/regionPoints/multipleSpheresRegionPoints/multipleSpheresRegionPoints.cpp index e983c602..8dae8757 100644 --- a/src/PostprocessData/region/regionPoints/multipleSpheresRegionPoints/multipleSpheresRegionPoints.cpp +++ b/src/PostprocessData/region/regionPoints/multipleSpheresRegionPoints/multipleSpheresRegionPoints.cpp @@ -1,7 +1,10 @@ #include "multipleSpheresRegionPoints.hpp" #include "fieldsDataBase.hpp" -pFlow::multipleSpheresRegionPoints::multipleSpheresRegionPoints +namespace pFlow::postprocessData +{ + +multipleSpheresRegionPoints::multipleSpheresRegionPoints ( const dictionary &dict, fieldsDataBase &fieldsDataBase @@ -46,7 +49,7 @@ pFlow::multipleSpheresRegionPoints::multipleSpheresRegionPoints } } -pFlow::span pFlow::multipleSpheresRegionPoints::indices(uint32 elem) const +pFlow::span multipleSpheresRegionPoints::indices(uint32 elem) const { if (elem >= size()) { @@ -59,7 +62,7 @@ pFlow::span pFlow::multipleSpheresRegionPoints::indices(uin return span(selectedPoints_[elem].data(), selectedPoints_[elem].size()); } -pFlow::span pFlow::multipleSpheresRegionPoints::indices(uint32 elem) +pFlow::span multipleSpheresRegionPoints::indices(uint32 elem) { if (elem >= size()) { @@ -73,7 +76,7 @@ pFlow::span pFlow::multipleSpheresRegionPoints::indices(uint32 el } -bool pFlow::multipleSpheresRegionPoints::update() +bool multipleSpheresRegionPoints::update() { const auto points = database().updatePoints(); for (auto& elem : selectedPoints_) @@ -94,7 +97,7 @@ bool pFlow::multipleSpheresRegionPoints::update() return true; } -bool pFlow::multipleSpheresRegionPoints::write(iOstream &os) const +bool multipleSpheresRegionPoints::write(iOstream &os) const { os << "# Multiple spheres region points\n"; os << "# No." << tab << "centerPoint" << tab << "diameter" << endl; @@ -110,3 +113,5 @@ bool pFlow::multipleSpheresRegionPoints::write(iOstream &os) const os << endl; return true; } + +} // End namespace pFlow::postprocessData diff --git a/src/PostprocessData/region/regionPoints/multipleSpheresRegionPoints/multipleSpheresRegionPoints.hpp b/src/PostprocessData/region/regionPoints/multipleSpheresRegionPoints/multipleSpheresRegionPoints.hpp index e01da658..8a67549c 100644 --- a/src/PostprocessData/region/regionPoints/multipleSpheresRegionPoints/multipleSpheresRegionPoints.hpp +++ b/src/PostprocessData/region/regionPoints/multipleSpheresRegionPoints/multipleSpheresRegionPoints.hpp @@ -51,7 +51,7 @@ Licence: #include "sphere.hpp" #include "Vectors.hpp" -namespace pFlow +namespace pFlow::postprocessData { class multipleSpheresRegionPoints diff --git a/src/PostprocessData/region/regionPoints/regionPoints/regionPoints.cpp b/src/PostprocessData/region/regionPoints/regionPoints/regionPoints.cpp index 20599503..696c33a4 100644 --- a/src/PostprocessData/region/regionPoints/regionPoints/regionPoints.cpp +++ b/src/PostprocessData/region/regionPoints/regionPoints/regionPoints.cpp @@ -2,7 +2,10 @@ #include "fieldsDataBase.hpp" #include "Time.hpp" -pFlow::regionPoints::regionPoints +namespace pFlow::postprocessData +{ + +regionPoints::regionPoints ( const dictionary &dict, fieldsDataBase &fieldsDataBase @@ -11,18 +14,20 @@ pFlow::regionPoints::regionPoints fieldsDataBase_(fieldsDataBase) {} -const pFlow::Time& pFlow::regionPoints::time() const +const Time& regionPoints::time() const { return fieldsDataBase_.time(); } -const pFlow::fieldsDataBase & pFlow::regionPoints::database() const +const fieldsDataBase & regionPoints::database() const { return fieldsDataBase_; } -pFlow::fieldsDataBase& pFlow::regionPoints::database() +fieldsDataBase& regionPoints::database() { return fieldsDataBase_; } +} // namespace pFlow::postprocessData + diff --git a/src/PostprocessData/region/regionPoints/regionPoints/regionPoints.hpp b/src/PostprocessData/region/regionPoints/regionPoints/regionPoints.hpp index 0931175f..54cca825 100644 --- a/src/PostprocessData/region/regionPoints/regionPoints/regionPoints.hpp +++ b/src/PostprocessData/region/regionPoints/regionPoints/regionPoints.hpp @@ -25,12 +25,16 @@ Licence: #include "dictionary.hpp" #include "pointStructure.hpp" - namespace pFlow +{ + class Time; +} + +namespace pFlow::postprocessData { class fieldsDataBase; -class Time; + /** * @class regionPoints diff --git a/src/PostprocessData/region/regionPoints/sphereRegionPoints/sphereRegionPoints.cpp b/src/PostprocessData/region/regionPoints/sphereRegionPoints/sphereRegionPoints.cpp index 4022c00e..b647560b 100644 --- a/src/PostprocessData/region/regionPoints/sphereRegionPoints/sphereRegionPoints.cpp +++ b/src/PostprocessData/region/regionPoints/sphereRegionPoints/sphereRegionPoints.cpp @@ -1,7 +1,10 @@ #include "sphereRegionPoints.hpp" #include "fieldsDataBase.hpp" -pFlow::sphereRegionPoints::sphereRegionPoints +namespace pFlow::postprocessData +{ + +sphereRegionPoints::sphereRegionPoints ( const dictionary &dict, fieldsDataBase &fieldsDataBase @@ -15,7 +18,7 @@ pFlow::sphereRegionPoints::sphereRegionPoints { } -bool pFlow::sphereRegionPoints::update() +bool sphereRegionPoints::update() { const auto points = database().updatePoints(); selectedPoints_.clear(); @@ -30,7 +33,7 @@ bool pFlow::sphereRegionPoints::update() return true; } -bool pFlow::sphereRegionPoints::write(iOstream &os) const +bool sphereRegionPoints::write(iOstream &os) const { os <<"# Single sphere\n"; os <<"# center point: "<" +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 + + + + +#------------------------------------------------------------------------------ diff --git a/tutorials/sphereGranFlow/RotaryAirLockValve/settings/domainDict b/tutorials/sphereGranFlow/RotaryAirLockValve/settings/domainDict index 818757f4..d2fe503a 100755 --- a/tutorials/sphereGranFlow/RotaryAirLockValve/settings/domainDict +++ b/tutorials/sphereGranFlow/RotaryAirLockValve/settings/domainDict @@ -2,46 +2,48 @@ | phasicFlow File | | copyright: www.cemf.ir | \* ------------------------------------------------------------------------- */ -objectName domainDict; -objectType dictionary; +objectName domainDict; +objectType dictionary; 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); - - max (0.725537 0.600214 0.06); + min (0.397538 0.178212 0.00); + + max (0.725537 0.600214 0.06); } boundaries { - left - { - type exit; // other options: periodict, reflective - } + left + { + type exit; // other options: periodict, reflective + } - right - { - type exit; // other options: periodict, reflective - } + right + { + type exit; // other options: periodict, reflective + } - bottom - { - type exit; // other options: periodict, reflective - } + bottom + { + type exit; // other options: periodict, reflective + } - top - { - type exit; // other options: periodict, reflective - } + top + { + type exit; // other options: periodict, reflective + } - rear - { - type exit; // other options: periodict, reflective - } + rear + { + type exit; // other options: periodict, reflective + } - front - { - type exit; // other options: periodict, reflective - } + front + { + type exit; // other options: periodict, reflective + } } diff --git a/tutorials/sphereGranFlow/RotaryAirLockValve/settings/geometryDict b/tutorials/sphereGranFlow/RotaryAirLockValve/settings/geometryDict index f4b737c3..7852401a 100644 --- a/tutorials/sphereGranFlow/RotaryAirLockValve/settings/geometryDict +++ b/tutorials/sphereGranFlow/RotaryAirLockValve/settings/geometryDict @@ -2,50 +2,50 @@ | phasicFlow File | | copyright: www.cemf.ir | \* ------------------------------------------------------------------------- */ -objectName geometryDict; -objectType dictionary; +objectName geometryDict; +objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ motionModel rotatingAxis; // motion model: rotating object around an axis rotatingAxisInfo // information for rotatingAxisMotion motion model { - rotAxis - { - p1 (0.561547 0.372714 0.000); // first point for the axis of rotation - - p2 (0.561547 0.372714 0.010); // second point for the axis of rotation + rotAxis + { + p1 (0.561547 0.372714 0.000); // first point for the axis of rotation + + p2 (0.561547 0.372714 0.010); // second point for the axis of rotation - omega 2.1; // rotation speed (rad/s) + omega 2.1; // rotation speed (rad/s) - startTime 1.25; // Start time of Geometry Rotating (s) - - endTime 7; // End time of Geometry Rotating (s) - } + startTime 1.25; // Start time of Geometry Rotating (s) + + endTime 7; // End time of Geometry Rotating (s) + } } surfaces { - gear - { - type stlWall; // type of the wall + gear + { + type stlWall; // type of the wall - file gear.stl; // file name in stl folder + file gear.stl; // file name in stl folder - material wallMat; // material name of this wall + material wallMat; // material name of this wall - motion rotAxis; // motion component name - } + motion rotAxis; // motion component name + } surfaces - { - type stlWall; // type of the wall + { + type stlWall; // type of the wall - file surfaces.stl; // file name in stl folder + file surfaces.stl; // file name in stl folder - material wallMat; // material name of this wall + material wallMat; // material name of this wall - motion none; // motion component name - } + motion none; // motion component name + } } diff --git a/tutorials/sphereGranFlow/RotaryAirLockValve/settings/particlesDict b/tutorials/sphereGranFlow/RotaryAirLockValve/settings/particlesDict index f5d5de63..8c2e2c92 100644 --- a/tutorials/sphereGranFlow/RotaryAirLockValve/settings/particlesDict +++ b/tutorials/sphereGranFlow/RotaryAirLockValve/settings/particlesDict @@ -2,8 +2,8 @@ | phasicFlow File | | copyright: www.cemf.ir | \* ------------------------------------------------------------------------- */ -objectName particlesDict; -objectType dictionary; +objectName particlesDict; +objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ diff --git a/tutorials/sphereGranFlow/RotaryAirLockValve/settings/settingsDict b/tutorials/sphereGranFlow/RotaryAirLockValve/settings/settingsDict index c65cc4c8..20471dfc 100644 --- a/tutorials/sphereGranFlow/RotaryAirLockValve/settings/settingsDict +++ b/tutorials/sphereGranFlow/RotaryAirLockValve/settings/settingsDict @@ -2,8 +2,8 @@ | phasicFlow File | | copyright: www.cemf.ir | \* ------------------------------------------------------------------------- */ -objectName geometryDict; -objectType dictionary; +objectName geometryDict; +objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ @@ -25,10 +25,12 @@ g (0 -9.8 0); // gravity vector (m/s2) includeObjects (diameter mass); // exclude unnecessary data from saving on disk -excludeObjects (rVelocity.dy1 pStructPosition.dy1 pStructVelocity.dy1); +excludeObjects (); integrationMethod AdamsBashforth2; +integrationHistory off; + writeFormat ascii; // data writting format (ascii or binary) timersReport Yes; // report timers: Yes or No diff --git a/tutorials/sphereGranFlow/RotatingDrumWithBaffles/ReadMe.md b/tutorials/sphereGranFlow/RotatingDrumWithBaffles/ReadMe.md index 8ea62191..2b177b81 100644 --- a/tutorials/sphereGranFlow/RotatingDrumWithBaffles/ReadMe.md +++ b/tutorials/sphereGranFlow/RotatingDrumWithBaffles/ReadMe.md @@ -1,4 +1,5 @@ # 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. * **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. @@ -15,10 +16,13 @@ The problem is to simulate a rotating drum with a diameter of 0.24 m, a length o # 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 -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++ // names of shapes names (smallSphere largeSphere); @@ -28,8 +32,8 @@ diameters (0.004 0.005); materials (lightMat heavyMat); ``` - ## 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. For example, for the insertion region for inserting light particles is shown below. @@ -39,31 +43,44 @@ in caseSetup/particleInsertion file ```C++ -// Right Layer Region -layerrightregion +// Right Region +right_region { -// type of insertion region - timeControl simulationTime; - regionType cylinder; -// insertion rate (particles/s) + // type of insertion region + regionType cylinder; + // insertion rate (particles/s) rate 12500; -// Start time of LightParticles insertion (s) + + timeControl simulationTime; + // Start time of insertion (s) startTime 0; -// End time of LightParticles insertion (s) + // End time of insertion (s) endTime 1; -// Time Interval of LightParticles insertion (s) + // Time Interval of insertion (s) insertionInterval 0.025; cylinderInfo { -// Coordinates of cylinderRegion (m,m,m) - p2 (-0.15 0.25 0.05); - p1 (-0.15 0.24 0.05); -// radius of cylinder (m) - radius 0.035; + // Coordinates of cylinderRegion (m,m,m) + p2 (-0.15 0.25 0.05); + p1 (-0.15 0.24 0.05); + // radius of cylinder (m) + 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 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). @@ -73,36 +90,37 @@ materials (lightMat heavyMat wallMat); // density of materials [kg/m3] densities (1000 1500 2500); - /* + /* Property (lightMat-lightMat lightMat-heavyMat lightMat-wallMat heavyMat-heavyMat heavyMat-wallMat wallMat-wallMat ); - */ -// Young modulus [Pa] + */ + // Young modulus [Pa] Yeff (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 0.8e6 0.8e6 0.8e6); -// Poisson's ratio [-] + // Poisson's ratio [-] nu (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 0.97 0.85 1.00); -// dynamic friction + // dynamic friction mu (0.65 0.65 0.35 0.65 0.35 0.35); -// rolling friction + // rolling friction mur (0.1 0.1 0.1 0.1 0.1 0.1); ``` + ## Settings ### 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. @@ -163,28 +181,32 @@ 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. ```C++ -motionModel rotatingAxis; + +motionModel rotatingAxis; + rotatingAxisInfo { rotAxis { // first point for the axis of rotation - p1 (-0.1974 0.2269 0); - // second point for the axis of rotation - p2 (-0.1974 0.2269 0.1); - // rotation speed (rad/s) => 15 rpm - omega 2.38733; - // Start time of Geometry Rotating - startTime 2; - // End time of Geometry Rotating - endTime 9.5; + p1 (-0.1974 0.2269 0); + // second point for the axis of rotation + p2 (-0.1974 0.2269 0.1); + // rotation speed (rad/s) => 15 rpm + omega 2.38733; + // Start time of Geometry Rotating + startTime 2; + // End time of Geometry Rotating + endTime 9.5; } } ``` + ## Performing Simulation + 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 `geometryPhasicFlow` command to create the Geometry. At last, enter `sphereGranFlow` command to start the simulation. -After finishing the simulation, you can use `pFlowtoVTK` to convert the results into vtk format stored in ./VTK folder. \ No newline at end of file +After finishing the simulation, you can use `pFlowtoVTK` to convert the results into vtk format stored in ./VTK folder. \ No newline at end of file diff --git a/tutorials/sphereGranFlow/RotatingDrumWithBaffles/caseSetup/interaction b/tutorials/sphereGranFlow/RotatingDrumWithBaffles/caseSetup/interaction index 7572adb9..b0009cda 100644 --- a/tutorials/sphereGranFlow/RotatingDrumWithBaffles/caseSetup/interaction +++ b/tutorials/sphereGranFlow/RotatingDrumWithBaffles/caseSetup/interaction @@ -6,6 +6,7 @@ objectName interaction; objectType dicrionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ + materials (lightMat heavyMat wallMat); // a list of materials names densities (1000 1500 2500); // density of materials [kg/m3] @@ -14,7 +15,7 @@ contactListType sortedContactList; contactSearch { - method NBS; // method for broad search + method NBS; updateInterval 10; diff --git a/tutorials/sphereGranFlow/RotatingDrumWithBaffles/caseSetup/particleInsertion b/tutorials/sphereGranFlow/RotatingDrumWithBaffles/caseSetup/particleInsertion index 6ba98b98..fd20ef9b 100644 --- a/tutorials/sphereGranFlow/RotatingDrumWithBaffles/caseSetup/particleInsertion +++ b/tutorials/sphereGranFlow/RotatingDrumWithBaffles/caseSetup/particleInsertion @@ -6,78 +6,78 @@ objectName particleInsertion; objectType dicrionary; 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 */ - -layerrightregion // Right Layer Region +right_region { timeControl simulationTime; - regionType cylinder; // type of insertion region + regionType cylinder; // type of insertion 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 { - p2 (-0.15 0.25 0.05); // Top of cylinderRegion (m,m,m) + p2 (-0.15 0.25 0.05); // Top of cylinderRegion (m,m,m) - p1 (-0.15 0.24 0.05); // Bottom of cylinderRegion (m,m,m) + p1 (-0.15 0.24 0.05); // Bottom of cylinderRegion (m,m,m) - radius 0.035; // radius of cylinder (m) + radius 0.035; // radius of cylinder (m) } setFields { - velocity realx3 (0.0 -0.6 0.0); // initial velocity of inserted particles + velocity realx3 (0.0 -0.6 0.0); // initial velocity of inserted particles } mixture { - smallSphere 1; // mixture composition of inserted particles + smallSphere 1; // mixture composition of inserted particles } } -layerleftregion // Left Layer Region +left_region { timeControl simulationTime; - regionType cylinder; // type of insertion region + regionType cylinder; // type of insertion 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 { - p2 (-0.23 0.25 0.05); // Top of cylinderRegion (m,m,m) + p2 (-0.23 0.25 0.05); // Top of cylinderRegion (m,m,m) - p1 (-0.23 0.24 0.05); // Bottom of cylinderRegion (m,m,m) + p1 (-0.23 0.24 0.05); // Bottom of cylinderRegion (m,m,m) - radius 0.035; // radius of cylinder (m) + radius 0.035; // radius of cylinder (m) } setFields { - velocity realx3 (0.0 -0.6 0.0); // initial velocity of inserted particles + velocity realx3 (0.0 -0.6 0.0); // initial velocity of inserted particles } mixture { - largeSphere 1; // only heavySphere + largeSphere 1; // only heavySphere } } diff --git a/tutorials/sphereGranFlow/RotatingDrumWithBaffles/caseSetup/shapes b/tutorials/sphereGranFlow/RotatingDrumWithBaffles/caseSetup/shapes index 95d438e4..c894548b 100644 --- a/tutorials/sphereGranFlow/RotatingDrumWithBaffles/caseSetup/shapes +++ b/tutorials/sphereGranFlow/RotatingDrumWithBaffles/caseSetup/shapes @@ -2,12 +2,13 @@ | phasicFlow File | | copyright: www.cemf.ir | \* ------------------------------------------------------------------------- */ -objectName sphereDict; -objectType sphereShape; +objectName sphereDict; +objectType sphereShape; fileFormat ASCII; /*---------------------------------------------------------------------------*/ -names (smallSphere largeSphere); // names of shapes - -diameters (0.004 0.005); // diameter of shapes (m) - -materials (lightMat heavyMat); // material names for shapes + +names (smallSphere largeSphere); // names of shapes + +diameters (0.004 0.005); // diameter of shapes (m) + +materials (lightMat heavyMat); // material names for shapes diff --git a/tutorials/sphereGranFlow/RotatingDrumWithBaffles/settings/domainDict b/tutorials/sphereGranFlow/RotatingDrumWithBaffles/settings/domainDict index 74c86ad3..f6a3f02e 100755 --- a/tutorials/sphereGranFlow/RotatingDrumWithBaffles/settings/domainDict +++ b/tutorials/sphereGranFlow/RotatingDrumWithBaffles/settings/domainDict @@ -6,42 +6,44 @@ objectName domainDict; objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ -globalBox // Simulation domain: every particles that goes outside this domain will be deleted -{ - min (-0.328 0.095 -0.025); // lower corner point of the box - max (-0.068 0.355 0.125); // upper corner point of the box +// 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 + + max (-0.068 0.355 0.125); // upper corner point of the box } boundaries { left { - type exit; // other options: periodic, reflective + type exit; // other options: periodic, reflective } right { - type exit; // other options: periodict, reflective + type exit; // other options: periodic, reflective } bottom { - type exit; // other options: periodict, reflective + type exit; // other options: periodic, reflective } top { - type exit; // other options: periodict, reflective + type exit; // other options: periodic, reflective } rear { - type exit; // other options: periodict, reflective + type exit; // other options: periodic, reflective } front { - type exit; // other options: periodict, reflective + type exit; // other options: periodic, reflective } } diff --git a/tutorials/sphereGranFlow/RotatingDrumWithBaffles/settings/geometryDict b/tutorials/sphereGranFlow/RotatingDrumWithBaffles/settings/geometryDict index a7502d1c..d46b854b 100644 --- a/tutorials/sphereGranFlow/RotatingDrumWithBaffles/settings/geometryDict +++ b/tutorials/sphereGranFlow/RotatingDrumWithBaffles/settings/geometryDict @@ -2,80 +2,81 @@ | phasicFlow File | | copyright: www.cemf.ir | \* ------------------------------------------------------------------------- */ -objectName geometryDict; -objectType dictionary; +objectName geometryDict; +objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ + motionModel rotatingAxis; rotatingAxisInfo { rotAxis - { - p1 (-0.1974 0.2269 0); // first point for the axis of rotation - - p2 (-0.1974 0.2269 0.1); // second point for the axis of rotation - - omega 2.38733; // rotation speed (rad/s) => 15 rpm - - startTime 2; // Start time of Geometry Rotating - - endTime 9.5; // End time of Geometry Rotating - } + { + p1 (-0.1974 0.2269 0); // first point for the axis of rotation + + p2 (-0.1974 0.2269 0.1); // second point for the axis of rotation + + omega 2.38733; // rotation speed (rad/s) => 15 rpm + + startTime 2; // Start time of Geometry Rotating + + endTime 9.5; // End time of Geometry Rotating + } } surfaces { - body - { - type stlWall; // type of the wall - - file Body.stl; // file name in stl folder - - material wallMat; // material name of this wall - - motion rotAxis; // motion component name - } + body + { + type stlWall; // type of the wall + + file Body.stl; // file name in stl folder + + material wallMat; // material name of this wall + + motion rotAxis; // motion component name + } - /* - This is a Cylinder Wall at the rear of cylinder - */ + /* + This is a Cylinder Wall at the rear of cylinder + */ - rearEnd - { - type cylinderWall; // type of the wall - - p1 (-0.1974 0.2269 -0.001); // first point for the axis of rotation - - p2 (-0.1974 0.2269 0.0); // second point for the axis of rotation - - radius1 0.0001; // Radius of p1 - - radius2 0.12; // Radius of p2 - - material wallMat; // material name of the wall - - motion rotAxis; // motion component name - } + rearEnd + { + type cylinderWall; // type of the wall + + p1 (-0.1974 0.2269 -0.001); // first point for the axis of rotation + + p2 (-0.1974 0.2269 0.0); // second point for the axis of rotation + + radius1 0.0001; // Radius of p1 + + radius2 0.12; // Radius of p2 + + material wallMat; // material name of the wall + + motion rotAxis; // motion component name + } - /* - This a cylinder Wall at the front of Cylinder - */ + /* + This a cylinder Wall at the front of Cylinder + */ - frontEnd - { - type cylinderWall; // type of the wall - - p1 (-0.1974 0.2269 0.0989); // first point for the axis of rotation - - p2 (-0.1974 0.2269 0.0990); // second point for the axis of rotation - - radius1 0.0001; // Radius of p1 - - radius2 0.12; // Radius of p2 - - material wallMat; // material name of the wall - - motion rotAxis; // motion component name - } + frontEnd + { + type cylinderWall; // type of the wall + + p1 (-0.1974 0.2269 0.0989); // first point for the axis of rotation + + p2 (-0.1974 0.2269 0.0990); // second point for the axis of rotation + + radius1 0.0001; // Radius of p1 + + radius2 0.12; // Radius of p2 + + material wallMat; // material name of the wall + + motion rotAxis; // motion component name + } } diff --git a/tutorials/sphereGranFlow/RotatingDrumWithBaffles/settings/particlesDict b/tutorials/sphereGranFlow/RotatingDrumWithBaffles/settings/particlesDict index b4d5bf80..31f3c913 100644 --- a/tutorials/sphereGranFlow/RotatingDrumWithBaffles/settings/particlesDict +++ b/tutorials/sphereGranFlow/RotatingDrumWithBaffles/settings/particlesDict @@ -10,9 +10,7 @@ setFields { /* Default value for fields defined for particles - These fields should always be defined for simulations with - spherical particles. */ @@ -29,30 +27,13 @@ setFields 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 } diff --git a/tutorials/sphereGranFlow/RotatingDrumWithBaffles/settings/settingsDict b/tutorials/sphereGranFlow/RotatingDrumWithBaffles/settings/settingsDict index b64a6a85..f4af181a 100644 --- a/tutorials/sphereGranFlow/RotatingDrumWithBaffles/settings/settingsDict +++ b/tutorials/sphereGranFlow/RotatingDrumWithBaffles/settings/settingsDict @@ -2,34 +2,36 @@ | phasicFlow File | | copyright: www.cemf.ir | \* ------------------------------------------------------------------------- */ -objectName settingsDict; -objectType dictionary; +objectName settingsDict; +objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ -run RotatingDrumwithBaffles; +run RotatingDrumwithBaffles; -dt 0.00001; // time step for integration (s) +dt 0.00001; // time step for integration (s) -startTime 0; // start time for simulation +startTime 0; // start time for simulation -endTime 10; // end time for simulation +endTime 10; // end time for simulation -saveInterval 0.05; // time interval for saving the simulation +saveInterval 0.05; // time interval for saving the simulation -timePrecision 6; // maximum number of digits for time folder +timePrecision 6; // maximum number of digits for time folder -g (0 -9.8 0); // gravity vector (m/s2) +g (0 -9.8 0); // gravity vector (m/s2) -// save necessary (i.e., required) data on disk +// save necessary data on disk includeObjects (diameter); // exclude unnecessary data from saving on disk -excludeObjects (rVelocity.dy1 pStructPosition.dy1 pStructVelocity.dy1); +excludeObjects (); -integrationMethod AdamsBashforth2; // integration method +integrationMethod AdamsBashforth2; // integration method -writeFormat ascii; // data writting format (ascii or binary) +integrationHistory off; // to sace space on disk -timersReport Yes; // report timers (Yes or No) +writeFormat ascii; // data writting format (ascii or binary) -timersReportInterval 0.1; // time interval for reporting timers +timersReport Yes; // report timers (Yes or No) + +timersReportInterval 0.1; // time interval for reporting timers diff --git a/tutorials/sphereGranFlow/V-blender/README.md b/tutorials/sphereGranFlow/V-blender/README.md new file mode 100644 index 00000000..f9c02f08 --- /dev/null +++ b/tutorials/sphereGranFlow/V-blender/README.md @@ -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. + + +
+ +
+
+ + V-blender simulation with two layers of particles + +
+ +## 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) diff --git a/tutorials/sphereGranFlow/V-blender/caseSetup/interaction b/tutorials/sphereGranFlow/V-blender/caseSetup/interaction index 0c2ef656..437e98bf 100644 --- a/tutorials/sphereGranFlow/V-blender/caseSetup/interaction +++ b/tutorials/sphereGranFlow/V-blender/caseSetup/interaction @@ -6,15 +6,16 @@ objectName interaction; objectType dicrionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ -materials (wallMat lightMat); // a list of materials names -densities (1000 1000); // density of materials [kg/m3] +materials (wallMat lightMat); // a list of materials names + +densities (1000 1000); // density of materials [kg/m3] contactListType sortedContactList; contactSearch { - method NBS; // method for broad search + method NBS; updateInterval 10; @@ -33,22 +34,22 @@ model Yeff (1.0e6 1.0e6 - 1.0e6); // Young modulus [Pa] + 1.0e6); // Young modulus [Pa] Geff (0.8e6 0.8e6 - 0.8e6); // Shear modulus [Pa] + 0.8e6); // Shear modulus [Pa] nu (0.25 0.25 - 0.25); // Poisson's ratio [-] + 0.25); // Poisson's ratio [-] en (0.97 0.85 - 0.97); // coefficient of normal restitution + 0.97); // coefficient of normal restitution mu (0.65 0.35 - 0.65); // dynamic friction + 0.65); // dynamic friction mur (0.1 0.1 - 0.1); // rolling friction + 0.1); // rolling friction } diff --git a/tutorials/sphereGranFlow/V-blender/caseSetup/particleInsertion b/tutorials/sphereGranFlow/V-blender/caseSetup/particleInsertion index 5d9a104e..320a29c8 100644 --- a/tutorials/sphereGranFlow/V-blender/caseSetup/particleInsertion +++ b/tutorials/sphereGranFlow/V-blender/caseSetup/particleInsertion @@ -6,9 +6,10 @@ objectName particleInsertion; objectType dicrionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ -active Yes; // is insertion active -> Yes or No -checkForCollision Yes; // is checked -> Yes or No + +active Yes; // is insertion active -> Yes or No + /* Two layers of particles are packed one-by-one using tho insertion steps @@ -18,15 +19,15 @@ rightregion { timeControl simulationTime; - regionType cylinder; // type of insertion region + regionType cylinder; // type of insertion region - rate 10000; // Particles Insertion Rate (particles/s) + rate 10000; // Particles Insertion Rate (particles/s) - startTime 0.0; // start time of small particles insertion (s) + startTime 0.0; // start time of small particles insertion (s) - endTime 1; // end time of small particles insertion (s) + endTime 1; // end time of small particles insertion (s) - insertionInterval 0.025; // time interval of small particles insertion (s) + insertionInterval 0.025; // time interval of small particles insertion (s) cylinderInfo { @@ -37,17 +38,17 @@ rightregion p2 (0.1150615 0.12 0.4811585); - radius 0.1; // radius of cylinder (m) + radius 0.1; // radius of cylinder (m) } setFields { - velocity realx3 (1.2 0.0 -1.2); // initial velocity of inserted particles + velocity realx3 (1.2 0.0 -1.2); // initial velocity of inserted particles } mixture { - smallSphere 1; // first layer of inserted particles + smallSphere 1; // first layer of inserted particles } } @@ -55,35 +56,34 @@ leftregion { timeControl simulationTime; - regionType cylinder; // type of insertion region + regionType cylinder; // type of insertion region - rate 10000; // Particles Insertion Rate (particles/s) + rate 10000; // Particles Insertion Rate (particles/s) - startTime 1.5; // start time of large particles insertion (s) + startTime 1.5; // start time of large particles insertion (s) - endTime 2.5; // end time of large particles insertion (s) + endTime 2.5; // end time of large particles insertion (s) - insertionInterval 0.025; // time interval of large particles insertion (s) + insertionInterval 0.025; // time interval of large particles insertion (s) cylinderInfo { /* coordinates of center of both ends of the insertion cylinder on the left side of the V-blender (m,m,m) */ - p1 ( 0.7562545 0.12 0.50079); p2 ( 0.7362545 0.12 0.48079); - radius 0.1; // radius of cylinder (m) + radius 0.1; } setFields { - velocity realx3 (-1.2 0.0 -1.2); // initial velocity of inserted particles + velocity realx3 (-1.2 0.0 -1.2); // initial velocity of inserted particles } mixture { - largeSphere 1; // second layer of inserted particles + largeSphere 1; // second layer of inserted particles } } diff --git a/tutorials/sphereGranFlow/V-blender/caseSetup/shapes b/tutorials/sphereGranFlow/V-blender/caseSetup/shapes index d7008679..820578c8 100644 --- a/tutorials/sphereGranFlow/V-blender/caseSetup/shapes +++ b/tutorials/sphereGranFlow/V-blender/caseSetup/shapes @@ -7,8 +7,8 @@ objectType sphereShape; fileFormat ASCII; /*---------------------------------------------------------------------------*/ -names (smallSphere largeSphere); // names of particles +names (smallSphere largeSphere); // names of particles -diameters (0.01 0.0101); // diameter of particles +diameters (0.01 0.0101); // diameter of particles -materials (lightMat lightMat); // material names for particles +materials (lightMat lightMat); // material names for particles diff --git a/tutorials/sphereGranFlow/V-blender/settings/domainDict b/tutorials/sphereGranFlow/V-blender/settings/domainDict index 68aa66b9..7ee51605 100755 --- a/tutorials/sphereGranFlow/V-blender/settings/domainDict +++ b/tutorials/sphereGranFlow/V-blender/settings/domainDict @@ -10,9 +10,9 @@ fileFormat ASCII; // Simulation domain: every particles that goes outside this domain will be deleted globalBox { - min (-0.1 -0.4 0); // lower corner point of the box + 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 + max (0.86 0.6 0.6); // upper corner point of the box } boundaries @@ -20,31 +20,31 @@ boundaries left { - type exit; // other options: periodic, reflective + type exit; // other options: periodic, reflective } right { - type exit; // other options: periodict, reflective + type exit; // other options: periodic, reflective } bottom { - type exit; // other options: periodict, reflective + type exit; // other options: periodic, reflective } top { - type exit; // other options: periodict, reflective + type exit; // other options: periodic, reflective } rear { - type exit; // other options: periodict, reflective + type exit; // other options: periodic, reflective } front { - type exit; // other options: periodict, reflective + type exit; // other options: periodic, reflective } } diff --git a/tutorials/sphereGranFlow/V-blender/settings/geometryDict b/tutorials/sphereGranFlow/V-blender/settings/geometryDict index 005cf07d..0c302482 100644 --- a/tutorials/sphereGranFlow/V-blender/settings/geometryDict +++ b/tutorials/sphereGranFlow/V-blender/settings/geometryDict @@ -6,6 +6,7 @@ objectName geometryDict; objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ + motionModel rotatingAxis; // motion model: rotating object around an axis rotatingAxisInfo // information for rotatingAxis motion model diff --git a/tutorials/sphereGranFlow/V-blender/settings/particlesDict b/tutorials/sphereGranFlow/V-blender/settings/particlesDict index a61bf692..46c2288b 100644 --- a/tutorials/sphereGranFlow/V-blender/settings/particlesDict +++ b/tutorials/sphereGranFlow/V-blender/settings/particlesDict @@ -2,38 +2,38 @@ | phasicFlow File | | copyright: www.cemf.ir | \* ------------------------------------------------------------------------- */ -objectName particlesDict; -objectType dictionary; -fileFormat ASCII; +objectName particlesDict; +objectType dictionary; +fileFormat ASCII; /*---------------------------------------------------------------------------*/ setFields { /* - Default value for fields defined for particles - These fields should always be defined for simulations with - spherical particles. + Default value for fields defined for particles + These fields should always be defined for simulations with + spherical particles. */ defaultValue { - velocity realx3 (0 0 0); // linear velocity (m/s) + 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) - rVelocity 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 } selectors - {} + {} } positionParticles { - - method empty; // no particle at the start of simulation + + method empty; // no particle at the start of simulation - mortonSorting Yes; // perform initial sorting based on morton code? + mortonSorting Yes; // perform initial sorting based on morton code? } diff --git a/tutorials/sphereGranFlow/V-blender/settings/settingsDict b/tutorials/sphereGranFlow/V-blender/settings/settingsDict index 05e34f47..dad5bcd6 100644 --- a/tutorials/sphereGranFlow/V-blender/settings/settingsDict +++ b/tutorials/sphereGranFlow/V-blender/settings/settingsDict @@ -2,23 +2,23 @@ | phasicFlow File | | copyright: www.cemf.ir | \* ------------------------------------------------------------------------- */ -objectName settingsDict; -objectType dictionary; +objectName settingsDict; +objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ -run rotatingVblender; +run rotatingVblender; -dt 0.00001; // time step for integration (s) +dt 0.00001; // time step for integration (s) -startTime 0; // start time for simulation +startTime 0; // start time for simulation -endTime 10; // end time for simulation +endTime 10; // end time for simulation -saveInterval 0.05; // time interval for saving the simulation +saveInterval 0.05; // time interval for saving the simulation -timePrecision 6; // maximum number of digits for time folder +timePrecision 6; // maximum number of digits for time folder -g (0 0 -9.8); // gravity vector (m/s2) +g (0 0 -9.8); // gravity vector (m/s2) includeObjects (diameter); // save necessary (i.e., required) data on disk @@ -28,12 +28,12 @@ excludeObjects (); // include the objects to be saved in the time folders includeObject (); -integrationMethod AdamsBashforth2; // integration method +integrationMethod AdamsBashforth2; // integration method -integrationHistory off; // Do not save integration history on the disk +integrationHistory off; // Do not save integration history on the 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) -timersReportInterval 0.05; // time interval for reporting timers +timersReportInterval 0.05; // time interval for reporting timers diff --git a/tutorials/sphereGranFlow/V-blender/v-blender.png b/tutorials/sphereGranFlow/V-blender/v-blender.png new file mode 100644 index 00000000..1c99ebe7 Binary files /dev/null and b/tutorials/sphereGranFlow/V-blender/v-blender.png differ diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/README.md b/tutorials/sphereGranFlow/binarySystemOfParticles/README.md index 041923d7..c1276f13 100644 --- a/tutorials/sphereGranFlow/binarySystemOfParticles/README.md +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/README.md @@ -47,9 +47,9 @@ positionParticles method ordered; // other options: random or empty orderedInfo { - diameter 0.005; // minimum space between centers of particles - numPoints 30000; // number of particles in the simulation - axisOrder (z x y); // axis order for filling the space with particles + distance 0.005; // minimum space between centers of particles + numPoints 30000; // number of particles in the simulation + axisOrder (z x y); // axis order for filling the space with particles } regionType cylinder; // other options: box and sphere diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/cleanThisCase b/tutorials/sphereGranFlow/binarySystemOfParticles/cleanThisCase old mode 100644 new mode 100755 diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/domainDict b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/domainDict index 32064d51..b4ab383c 100755 --- a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/domainDict +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/domainDict @@ -1,49 +1,49 @@ /* -------------------------------*- C++ -*--------------------------------- *\ -| phasicFlow File | -| copyright: www.cemf.ir | +| phasicFlow File | +| copyright: www.cemf.ir | \* ------------------------------------------------------------------------- */ -objectName domainDict; -objectType dictionary; +objectName domainDict; +objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ + // 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); - max (0.12 0.12 0.1); + max (0.12 0.12 0.1); } boundaries { - left - { - type exit; // other options: periodic, reflective - } + left + { + type exit; // other options: periodic, reflective + } - right - { - type exit; // other options: periodic, reflective - } + right + { + type exit; // other options: periodic, reflective + } - bottom - { - type exit; // other options: periodic, reflective - } + bottom + { + type exit; // other options: periodic, reflective + } - top - { - type exit; // other options: periodic, reflective - } + top + { + type exit; // other options: periodic, reflective + } - rear - { - type exit; // other options: periodic, reflective - } + rear + { + type exit; // other options: periodic, reflective + } - front - { - type exit; // other options: periodic, reflective - } + front + { + type exit; // other options: periodic, reflective + } } diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/geometryDict b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/geometryDict index 3ec50c1a..b4992c6e 100755 --- a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/geometryDict +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/geometryDict @@ -2,84 +2,82 @@ | phasicFlow File | | copyright: www.cemf.ir | \* ------------------------------------------------------------------------- */ -objectName geometryDict; -objectType dictionary; +objectName geometryDict; +objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ motionModel rotatingAxis; // motion model can be rotatingAxis or stationary or vibrating rotatingAxisInfo // information for rotatingAxis motion model { - rotAxis - { - p1 (0.0 0.0 0.0); // first point for the axis of rotation + rotAxis + { + p1 (0.0 0.0 0.0); // first point for the axis of rotation - p2 (0.0 0.0 1.0); // second point for the axis of rotation - - omega 1.214; // rotation speed (rad/s) - } + p2 (0.0 0.0 1.0); // second point for the axis of rotation + + omega 1.214; // rotation speed (rad/s) + } } surfaces { - cylinder - { - type cylinderWall; // other options: cuboidWall and planeWall + cylinder + { + type cylinderWall; // other options: cuboidWall and planeWall - p1 (0.0 0.0 0.0); // begin point of cylinder axis + p1 (0.0 0.0 0.0); // begin point of cylinder axis - p2 (0.0 0.0 0.1); // end point of cylinder axis + p2 (0.0 0.0 0.1); // end point of cylinder axis - radius1 0.12; // radius at p1 + radius1 0.12; // radius at p1 - radius2 0.12; // radius at p2 + radius2 0.12; // radius at p2 - resolution 24; // number of divisions + resolution 24; // number of divisions - material prop1; // material name of this wall + material prop1; // material name of this wall - motion rotAxis; // motion component name - } + motion rotAxis; // motion component name + } - /* - This is a plane wall at the rear end of cylinder - */ + /* + This is a plane wall at the rear end of cylinder + */ + wall1 + { + type planeWall; // other options: cuboidWall and cylinderWall - wall1 - { - type planeWall; // other options: cuboidWall and cylinderWall + p1 (-0.12 -0.12 0.0); // first point of the wall - p1 (-0.12 -0.12 0.0); // first point of the wall + p2 (0.12 -0.12 0.0); // second point of the wall - p2 (0.12 -0.12 0.0); // second point of the wall + p3 (0.12 0.12 0.0); // third point of the wall - p3 (0.12 0.12 0.0); // third point of the wall + p4 (-0.12 0.12 0.0); // fourth point of the wall - p4 (-0.12 0.12 0.0); // fourth point of the wall + material prop1; // material name of the wall - material prop1; // material name of the wall + motion rotAxis; // motion component name + } - motion rotAxis; // motion component name - } + /* + This is a plane wall at the front end of cylinder + */ + wall2 + { + type planeWall; // other options: cuboidWall and cylinderWall - /* - This is a plane wall at the front end of cylinder - */ + p1 (-0.12 -0.12 0.1); // first point of the wall - wall2 - { - type planeWall; // other options: cuboidWall and cylinderWall + p2 (0.12 -0.12 0.1); // second point of the wall - p1 (-0.12 -0.12 0.1); // first point of the wall + p3 (0.12 0.12 0.1); // third point of the wall - p2 (0.12 -0.12 0.1); // second point of the wall + p4 (-0.12 0.12 0.1); // fourth point of the wall - p3 (0.12 0.12 0.1); // third point of the wall + material prop1; // material name of the wall - p4 (-0.12 0.12 0.1); // fourth point of the wall - - material prop1; // material name of the wall - - motion rotAxis; // motion component name - } + motion rotAxis; // motion component name + } } diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/particlesDict b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/particlesDict index b29ebbed..57702104 100755 --- a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/particlesDict +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/particlesDict @@ -2,73 +2,74 @@ | phasicFlow File | | copyright: www.cemf.ir | \* ------------------------------------------------------------------------- */ -objectName particlesDict; -objectType dictionary; +objectName particlesDict; +objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ + setFields { - /* - Default value for fields defined for particles: + /* + Default value for fields defined for particles: - These fields should always be defined for simulations with spherical particles - */ + These fields should always be defined for simulations with spherical particles + */ - defaultValue - { - velocity realx3 (0 0 0); // linear velocity (m/s) + defaultValue + { + 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) - rVelocity 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 + } - selectors - { - shapeAssigne - { - selector stridedRange; // other options: box, cylinder, sphere, randomPoints + selectors + { + shapeAssigne + { + selector stridedRange; // other options: box, cylinder, sphere, randomPoints - stridedRangeInfo - { - begin 0; // begin index of points + stridedRangeInfo + { + begin 0; // begin index of points - end 30000; // end index of points + end 30000; // end index of points - stride 3; // stride for selector - } + stride 3; // stride for selector + } - fieldValue // fields that the selector is applied to - { - shapeName word largeSphere; // sets shapeName of the selected points to largeSphere - } - } - } + fieldValue // fields that the selector is applied to + { + shapeName word largeSphere; // sets shapeName of the selected points to largeSphere + } + } + } } -positionParticles // positions particles +positionParticles // positions particles { - method ordered; // other options: random and empty + method ordered; // other options: random and empty - orderedInfo - { - diameter 0.005; // diameter of particles + orderedInfo + { + 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 - } - - regionType cylinder; // other options: box and sphere + axisOrder (z x y); // axis order for filling the space with particles + } + + regionType cylinder; // other options: box and sphere - cylinderInfo // cylinder information for positioning particles - { - p1 (0.0 0.0 0.003); // begin point of cylinder axis + cylinderInfo // cylinder information for positioning particles + { + p1 (0.0 0.0 0.003); // begin point of cylinder axis - p2 (0.0 0.0 0.097); // end point of cylinder axis + p2 (0.0 0.0 0.097); // end point of cylinder axis - radius 0.117; // radius of cylinder - } + radius 0.117; // radius of cylinder + } } diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/settingsDict b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/settingsDict index 3b341e60..34a6ce39 100755 --- a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/settingsDict +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/settingsDict @@ -2,37 +2,37 @@ | phasicFlow File | | copyright: www.cemf.ir | \* ------------------------------------------------------------------------- */ -objectName settingsDict; -objectType dictionary; +objectName settingsDict; +objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ run binarySystemofParticles; -dt 0.00001; // time step for integration (seconds) +dt 0.00001; // time step for integration (seconds) -startTime 0.0; // start time for simulation +startTime 0.0; // start time for simulation -endTime 10.0; // end time for simulation +endTime 10.0; // end time for simulation -saveInterval 0.1; // time interval for saving the simulation +saveInterval 0.1; // time interval for saving the simulation -timePrecision 6; // maximum number of digits for time folder +timePrecision 6; // maximum number of digits for time folder -g (0 -9.8 0); // gravity vector (m/s2) +g (0 -9.8 0); // gravity vector (m/s2) // save necessary (i.e., required) data on disk - includeObjects (diameter); // 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 -timersReportInterval 0.1; // time interval for reporting timers +timersReportInterval 0.1; // time interval for reporting timers \ No newline at end of file diff --git a/tutorials/sphereGranFlow/conveyorBelt/caseSetup/particleInsertion b/tutorials/sphereGranFlow/conveyorBelt/caseSetup/particleInsertion index 195f27df..22e0b06b 100755 --- a/tutorials/sphereGranFlow/conveyorBelt/caseSetup/particleInsertion +++ b/tutorials/sphereGranFlow/conveyorBelt/caseSetup/particleInsertion @@ -6,46 +6,46 @@ objectName particleInsertion; objectType dicrionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ -active Yes; // is insertion active -> yes or no -checkForCollision No; // is checked -> yes or no +active Yes; // is insertion active -> yes or no + +checkForCollision No; // is checked -> yes or no /* - one layers of particles are packed + one layer of particles are packed */ - layer0 { - timeControl simulationTime; + timeControl simulationTime; - regionType cylinder; // type of insertion region + regionType cylinder; // type of insertion region - rate 15000; // insertion rate (particles/s) + rate 15000; // insertion rate (particles/s) - startTime 0; // (s) + startTime 0; // (s) - endTime 0.5; // (s) + endTime 0.5; // (s) - insertionInterval 0.025; // s + insertionInterval 0.025; // s - cylinderInfo - { - radius 0.09; // radius of cylinder (m) + cylinderInfo + { + radius 0.09; // radius of cylinder (m) - p1 ( 0.0 0.0 0.1 ); // (m,m,m) + p1 ( 0.0 0.0 0.1 ); // (m,m,m) - p2 ( 0.0 0.0 0.11); // (m,m,m) - } - - setFields - { - velocity realx3 (0.0 0.0 -0.6); // initial velocity of inserted particles - } - - mixture - { - lightSphere 1; // mixture composition of inserted particles - } + p2 ( 0.0 0.0 0.11); // (m,m,m) + } + + setFields + { + velocity realx3 (0.0 0.0 -0.6); // initial velocity of inserted particles + } + + mixture + { + lightSphere 1; // mixture composition of inserted particles + } } diff --git a/tutorials/sphereGranFlow/conveyorBelt/caseSetup/shapes b/tutorials/sphereGranFlow/conveyorBelt/caseSetup/shapes index 603c28cb..cc84242f 100755 --- a/tutorials/sphereGranFlow/conveyorBelt/caseSetup/shapes +++ b/tutorials/sphereGranFlow/conveyorBelt/caseSetup/shapes @@ -2,14 +2,15 @@ | phasicFlow File | | copyright: www.cemf.ir | \* ------------------------------------------------------------------------- */ -objectName sphereDict; -objectType sphereShape; +objectName sphereDict; +objectType sphereShape; fileFormat ASCII; /*---------------------------------------------------------------------------*/ -names (lightSphere heavySphere); // names of shapes -diameters (0.007 0.007); // diameter of shapes +names (lightSphere heavySphere); // names of shapes -materials (lightMat heavyMat); // material names for shapes +diameters (0.007 0.007); // diameter of shapes + +materials (lightMat heavyMat); // material names for shapes diff --git a/tutorials/sphereGranFlow/conveyorBelt/settings/domainDict b/tutorials/sphereGranFlow/conveyorBelt/settings/domainDict index 159c33e5..1ae5faa4 100755 --- a/tutorials/sphereGranFlow/conveyorBelt/settings/domainDict +++ b/tutorials/sphereGranFlow/conveyorBelt/settings/domainDict @@ -2,64 +2,62 @@ | phasicFlow File | | copyright: www.cemf.ir | \* ------------------------------------------------------------------------- */ -objectName domainDict; -objectType dictionary; +objectName domainDict; +objectType dictionary; 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); - - max ( 0.33 0.11 0.41); + min (-0.11 -0.11 -0.41); + + max ( 0.33 0.11 0.41); } 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 + // of all boundaries in the simulation domain - // rebuild the list of particles in the neighbor list + neighborListUpdateInterval 30; + + // Determines how often do you want to update the new changes in the boundary + updateInterval 10; - // of all boundaries in the simulation domain + // The distance from the boundary plane within which particles are marked to be in the boundary list + neighborLength 0.004; - neighborListUpdateInterval 30; - - // Determines how often do you want to update the new changes in the boundary + left + { + type exit; // other options: periodict, reflective + } - updateInterval 10; + right + { + type exit; // other options: periodict, reflective + } - // The distance from the boundary plane within which particles are marked to be in the boundary list + bottom + { + type exit; // other options: periodict, reflective + } - neighborLength 0.004; + top + { + type exit; // other options: periodict, reflective + } - left - { - type exit; // other options: periodict, reflective - } + rear + { + type exit; // other options: periodict, reflective + } - right - { - type exit; // other options: periodict, reflective - } - - bottom - { - type exit; // other options: periodict, reflective - } - - top - { - type exit; // other options: periodict, reflective - } - - rear - { - type exit; // other options: periodict, reflective - } - - front - { - type exit; // other options: periodict, reflective - } + front + { + type exit; // other options: periodict, reflective + } } diff --git a/tutorials/sphereGranFlow/conveyorBelt/settings/geometryDict b/tutorials/sphereGranFlow/conveyorBelt/settings/geometryDict index 73f24386..251e94b7 100755 --- a/tutorials/sphereGranFlow/conveyorBelt/settings/geometryDict +++ b/tutorials/sphereGranFlow/conveyorBelt/settings/geometryDict @@ -2,11 +2,13 @@ | phasicFlow File | | copyright: www.cemf.ir | \* ------------------------------------------------------------------------- */ -objectName geometryDict; -objectType dictionary; +objectName geometryDict; +objectType dictionary; 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 { @@ -18,63 +20,58 @@ conveyorBeltInfo surfaces { - cylinderShell - { - type cylinderWall; // other options: cuboidWall and planeWall + cylinderShell + { + type cylinderWall; // other options: cuboidWall and planeWall - p1 (0.0 0.0 0.0); // begin point of cylinder axis + p1 (0.0 0.0 0.0); // begin point of cylinder axis - p2 (0.0 0.0 0.4); // end point of cylinder axis + p2 (0.0 0.0 0.4); // end point of cylinder axis - radius1 0.1; // radius at p1 + radius1 0.1; // radius at p1 - radius2 0.1; // radius at p2 + radius2 0.1; // radius at p2 - resolution 36; // number of divisions + resolution 36; // number of divisions - material wallMat; // material name of this wall - } + material wallMat; // material name of this wall + } - coneShell - { - type cylinderWall; // other options: cuboidWall and planeWall + coneShell + { + type cylinderWall; // other options: cuboidWall and planeWall - p1 (0.0 0.0 -0.1); // begin point of cylinder axis + p1 (0.0 0.0 -0.1); // begin point of cylinder axis - p2 (0.0 0.0 0.0); // end point of cylinder axis + p2 (0.0 0.0 0.0); // end point of cylinder axis - radius1 0.02; // radius at p1 + radius1 0.02; // radius at p1 - radius2 0.1; // radius at p2 + radius2 0.1; // radius at p2 - resolution 36; // number of divisions + resolution 36; // number of divisions - material wallMat; // material name of this wall - } + material wallMat; // material name of this wall + } - belt - { - type stlWall; // type of the wall + belt + { + type stlWall; // type of the wall - file belt.stl; // file name in stl folder + file belt.stl; // file name in stl folder - material wallMat; // material name of this wall + material wallMat; // material name of this wall - motion conveyorBelt1; // motion component name - } + motion conveyorBelt1; // motion component name + } - box - { - type stlWall; // type of the wall + box + { + type stlWall; // type of the wall - file box.stl; // file name in stl folder + file box.stl; // file name in stl folder - material wallMat; // material name of this wall - } + material wallMat; // material name of this wall + } } - - - - - diff --git a/tutorials/sphereGranFlow/conveyorBelt/settings/particlesDict b/tutorials/sphereGranFlow/conveyorBelt/settings/particlesDict index 4df47975..397b29e8 100755 --- a/tutorials/sphereGranFlow/conveyorBelt/settings/particlesDict +++ b/tutorials/sphereGranFlow/conveyorBelt/settings/particlesDict @@ -6,16 +6,14 @@ objectName particlesDict; objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ + setFields { /* Default value for fields defined for particles - These fields should always be defined for simulations with - spherical particles. */ - defaultValue { velocity realx3 (0 0 0); // linear velocity (m/s) @@ -31,17 +29,8 @@ setFields {} } -positionParticles // positions particles +positionParticles { - method empty; // other options: 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 - } + method empty; // other options: file, ordered and random } diff --git a/tutorials/sphereGranFlow/conveyorBelt/settings/settingsDict b/tutorials/sphereGranFlow/conveyorBelt/settings/settingsDict index c5b6650d..3d3f5658 100755 --- a/tutorials/sphereGranFlow/conveyorBelt/settings/settingsDict +++ b/tutorials/sphereGranFlow/conveyorBelt/settings/settingsDict @@ -2,41 +2,39 @@ | phasicFlow File | | copyright: www.cemf.ir | \* ------------------------------------------------------------------------- */ -objectName settingsDict; -objectType dictionary; +objectName settingsDict; +objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ -run layerdSiloFilling; -dt 0.00005; // time step for integration (s) +run conveyorBelt; -startTime 0.0; // start time for simulation +dt 0.00005; // time step for integration (s) -endTime 5.0; // end time for simulation +startTime 0.0; // start time for simulation -saveInterval 0.05; // time interval for saving the simulation +endTime 5.0; // end time for simulation -timePrecision 6; // maximum number of digits for time folder +saveInterval 0.05; // time interval for saving the simulation -g (0 0 -9.8); // gravity vector (m/s2) +timePrecision 6; // maximum number of digits for time folder + +g (0 0 -9.8); // gravity vector (m/s2) // save data objects that are not automatically saved on disk. - // overrides the default behavior - includeObjects (diameter); // exclude unnecessary data from saving on disk - excludeObjects (rVelocity.dy1 pStructPosition.dy1 pStructVelocity.dy1); -integrationMethod AdamsBashforth2; // integration method +integrationMethod AdamsBashforth2; // integration method -writeFormat ascii; // data writting format (ascii or binary) +writeFormat ascii; // data writting format (ascii or binary) -timersReport Yes; // report timers +timersReport Yes; // report timers -timersReportInterval 0.01; // time interval for reporting timers +timersReportInterval 0.01; // time interval for reporting timers diff --git a/tutorials/sphereGranFlow/drum-PeriodicBoundary/README.md b/tutorials/sphereGranFlow/drum-PeriodicBoundary/README.md index 48296411..558ac7c8 100644 --- a/tutorials/sphereGranFlow/drum-PeriodicBoundary/README.md +++ b/tutorials/sphereGranFlow/drum-PeriodicBoundary/README.md @@ -72,7 +72,7 @@ boundaries ## Running the Case The solver for this simulation is `sphereGranFlow`. Enter the following commands in the terminal. Depending on the computational power, it may take a few minutes to a few hours to complete. -```sh +``` geometryPhasicFlow particlesPhasicFlow sphereGranFlow @@ -81,6 +81,6 @@ sphereGranFlow ## Post Processing After finishing the simulation, you can render the results in ParaView. To convert the results to VTK format, just enter the following command in the terminal. This will convert all the results (particles and geometry) to VTK format and store them in the `VTK/` folder. -```sh +``` pFlowToVTK --binary ``` diff --git a/tutorials/sphereGranFlow/drum-PeriodicBoundary/caseSetup/shapes b/tutorials/sphereGranFlow/drum-PeriodicBoundary/caseSetup/shapes index 7b563b12..2bcfddd7 100755 --- a/tutorials/sphereGranFlow/drum-PeriodicBoundary/caseSetup/shapes +++ b/tutorials/sphereGranFlow/drum-PeriodicBoundary/caseSetup/shapes @@ -2,12 +2,12 @@ | phasicFlow File | | copyright: www.cemf.ir | \* ------------------------------------------------------------------------- */ -objectName sphereDict; -objectType sphereShape; +objectName sphereDict; +objectType sphereShape; fileFormat ASCII; /*---------------------------------------------------------------------------*/ -names (sphere1); // names of shapes +names (sphere1); // names of shapes -diameters (0.004); // diameter of shapes +diameters (0.004); // diameter of shapes -materials (prop1); // material names for shapes +materials (prop1); // material names for shapes diff --git a/tutorials/sphereGranFlow/drum-PeriodicBoundary/settings/geometryDict b/tutorials/sphereGranFlow/drum-PeriodicBoundary/settings/geometryDict index e87cbc6a..341d412d 100644 --- a/tutorials/sphereGranFlow/drum-PeriodicBoundary/settings/geometryDict +++ b/tutorials/sphereGranFlow/drum-PeriodicBoundary/settings/geometryDict @@ -2,8 +2,8 @@ | phasicFlow File | | copyright: www.cemf.ir | \* ------------------------------------------------------------------------- */ -objectName geometryDict; -objectType dictionary; +objectName geometryDict; +objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ diff --git a/tutorials/sphereGranFlow/drum-PeriodicBoundary/settings/particlesDict b/tutorials/sphereGranFlow/drum-PeriodicBoundary/settings/particlesDict index d1d24bb6..dfd0ec90 100644 --- a/tutorials/sphereGranFlow/drum-PeriodicBoundary/settings/particlesDict +++ b/tutorials/sphereGranFlow/drum-PeriodicBoundary/settings/particlesDict @@ -2,33 +2,33 @@ | phasicFlow File | | copyright: www.cemf.ir | \* ------------------------------------------------------------------------- */ -objectName particlesDict; -objectType dictionary; +objectName particlesDict; +objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ setFields { - /* - Default value for fields defined for particles - These fields should always be defined for simulations with - spherical particles. - */ - defaultValue - { - velocity realx3 (0 0 0); // linear velocity (m/s) + /* + Default value for fields defined for particles + These fields should always be defined for simulations with + spherical particles. + */ + defaultValue + { + velocity realx3 (0 0 0); // linear velocity (m/s) - acceleration realx3 (0 0 0); // linear acceleration (m/s2) + acceleration realx3 (0 0 0); // linear acceleration (m/s2) - rVelocity realx3 (0 0 0); // rotational velocity (rad/s) + rVelocity realx3 (0 0 0); // rotational velocity (rad/s) - shapeName word sphere1; // name of the particle shape - } + shapeName word sphere1; // name of the particle shape + } - selectors - {} + selectors + {} } positionParticles { - method empty; // no particle at the start of simulation + method empty; // no particle at the start of simulation } diff --git a/tutorials/sphereGranFlow/drum-PeriodicBoundary/settings/settingsDict b/tutorials/sphereGranFlow/drum-PeriodicBoundary/settings/settingsDict index 6dbfc53a..b7f92697 100644 --- a/tutorials/sphereGranFlow/drum-PeriodicBoundary/settings/settingsDict +++ b/tutorials/sphereGranFlow/drum-PeriodicBoundary/settings/settingsDict @@ -24,17 +24,11 @@ g (0 -9.8 0); // gravity vector (m/s2) includeObjects (diameter); // save necessary (i.e., required) data on disk // exclude unnecessary data from saving on disk -excludeObjects (rVelocity.dy1 - rVelocity.dy2 - rVelocity.dy3 - pStructPosition.dy1 - pStructPosition.dy2 - pStructPosition.dy3 - pStructVelocity.dy1 - pStructVelocity.dy2 - pStructVelocity.dy3); +excludeObjects (); -integrationMethod AdamsBashforth4; // integration method +integrationMethod AdamsBashforth4; // integration method + +integrationHistory off; // to save space on disk writeFormat ascii; // data writting format (ascii or binary) diff --git a/tutorials/sphereGranFlow/homogenizationSilo-PeriodicBoundary/README.md b/tutorials/sphereGranFlow/homogenizationSilo-PeriodicBoundary/README.md index b1e41664..3e670c4c 100644 --- a/tutorials/sphereGranFlow/homogenizationSilo-PeriodicBoundary/README.md +++ b/tutorials/sphereGranFlow/homogenizationSilo-PeriodicBoundary/README.md @@ -3,7 +3,7 @@ ## 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`). -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).
diff --git a/tutorials/sphereGranFlow/homogenizationSilo-PeriodicBoundary/caseSetup/interaction b/tutorials/sphereGranFlow/homogenizationSilo-PeriodicBoundary/caseSetup/interaction index f5fc4f23..75f65ec4 100755 --- a/tutorials/sphereGranFlow/homogenizationSilo-PeriodicBoundary/caseSetup/interaction +++ b/tutorials/sphereGranFlow/homogenizationSilo-PeriodicBoundary/caseSetup/interaction @@ -37,7 +37,6 @@ model heavyMat-heavyMat heavyMat-wallMat wallMat-wallMat ); */ - Yeff (1.0e6 1.0e6 1.0e6 // Young modulus [Pa] 1.0e6 1.0e6 1.0e6); diff --git a/tutorials/sphereGranFlow/homogenizationSilo-PeriodicBoundary/caseSetup/particleInsertion b/tutorials/sphereGranFlow/homogenizationSilo-PeriodicBoundary/caseSetup/particleInsertion index 2dc7bea7..bb44dcb6 100755 --- a/tutorials/sphereGranFlow/homogenizationSilo-PeriodicBoundary/caseSetup/particleInsertion +++ b/tutorials/sphereGranFlow/homogenizationSilo-PeriodicBoundary/caseSetup/particleInsertion @@ -26,189 +26,185 @@ layer0 insertionInterval 0.025; // s - cylinderInfo - { - radius 0.09; // radius of cylinder (m) + cylinderInfo + { + radius 0.09; // radius of cylinder (m) - p1 (0.0 0.0 0.1); // (m,m,m) + p1 (0.0 0.0 0.1); // (m,m,m) - p2 (0.0 0.0 0.11); // (m,m,m) - } - - setFields - { - velocity realx3 (0.0 0.0 -0.6); // initial velocity of inserted particles - } - - mixture - { - parType1 1; // mixture composition of inserted particles - } + p2 (0.0 0.0 0.11); // (m,m,m) + } + + setFields + { + velocity realx3 (0.0 0.0 -0.6); // initial velocity of inserted particles + } + + mixture + { + parType1 1; // mixture composition of inserted particles + } } layer1 { - timeControl simulationTime; + timeControl simulationTime; - regionType cylinder; // type of insertion region + regionType cylinder; // type of insertion region - rate 5100; // insertion rate (particles/s) + rate 5100; // insertion rate (particles/s) - startTime 0.7; // (s) + startTime 0.7; // (s) - endTime 1.2; // (s) + endTime 1.2; // (s) - insertionInterval 0.025; // s + insertionInterval 0.025; // s - - cylinderInfo - { - radius 0.09; - p1 (0.0 0.0 0.16 ); // (m,m,m) - p2 (0.0 0.0 0.17); // (m,m,m) - } - - setFields - { - velocity realx3 (0.0 0.0 -0.6); - } - - mixture - { - parType2 1; // only parType2 - - } + + cylinderInfo + { + radius 0.09; + p1 (0.0 0.0 0.16 ); // (m,m,m) + p2 (0.0 0.0 0.17); // (m,m,m) + } + + setFields + { + velocity realx3 (0.0 0.0 -0.6); + } + + mixture + { + parType2 1; // only parType2 + + } } layer2 { - timeControl simulationTime; + timeControl simulationTime; - regionType cylinder; // type of insertion region + regionType cylinder; // type of insertion region - rate 5100; // insertion rate (particles/s) + rate 5100; // insertion rate (particles/s) - startTime 1.4; // (s) + startTime 1.4; // (s) - endTime 1.9; // (s) + endTime 1.9; // (s) - insertionInterval 0.025; // s + insertionInterval 0.025; // s - cylinderInfo - { - radius 0.09; - p1 ( 0.0 0.0 0.2 ); // (m,m,m) - p2 ( 0.0 0.0 0.21); // (m,m,m) - } - - setFields - { - velocity realx3 (0.0 0.0 -0.6); - } - - mixture - { - parType1 1; // only parType1 - - } + cylinderInfo + { + radius 0.09; + p1 ( 0.0 0.0 0.2 ); // (m,m,m) + p2 ( 0.0 0.0 0.21); // (m,m,m) + } + + setFields + { + velocity realx3 (0.0 0.0 -0.6); + } + + mixture + { + parType1 1; // only parType1 + } } layer3 { - timeControl simulationTime; + timeControl simulationTime; - regionType cylinder; // type of insertion region + regionType cylinder; // type of insertion region - rate 5100; // insertion rate (particles/s) + rate 5100; // insertion rate (particles/s) - startTime 2.1; // (s) + startTime 2.1; // (s) - endTime 2.6; // (s) + endTime 2.6; // (s) - insertionInterval 0.025; // s - + insertionInterval 0.025; // s - cylinderInfo - { - radius 0.09; - p1 ( 0.0 0.0 0.28 ); // (m,m,m) - p2 ( 0.0 0.0 0.29); // (m,m,m) - } - - setFields - { - velocity realx3 (0.0 0.0 -0.6); - } - - mixture - { - parType2 1; - - } + + cylinderInfo + { + radius 0.09; + p1 ( 0.0 0.0 0.28 ); // (m,m,m) + p2 ( 0.0 0.0 0.29); // (m,m,m) + } + + setFields + { + velocity realx3 (0.0 0.0 -0.6); + } + + mixture + { + parType2 1; + } } layer4 { - timeControl simulationTime; + timeControl simulationTime; - regionType cylinder; // type of insertion region + regionType cylinder; // type of insertion region - rate 5100; // insertion rate (particles/s) + rate 5100; // insertion rate (particles/s) - startTime 2.8; // (s) + startTime 2.8; // (s) - endTime 3.3; // (s) + endTime 3.3; // (s) - insertionInterval 0.025; // s + insertionInterval 0.025; // s - cylinderInfo - { - radius 0.09; - p1 ( 0.0 0.0 0.37 ); // (m,m,m) - p2 ( 0.0 0.0 0.38); // (m,m,m) - } - - setFields - { - velocity realx3 (0.0 0.0 -0.6); - } - - mixture - { - parType1 1; - - } + cylinderInfo + { + radius 0.09; + p1 ( 0.0 0.0 0.37 ); // (m,m,m) + p2 ( 0.0 0.0 0.38); // (m,m,m) + } + + setFields + { + velocity realx3 (0.0 0.0 -0.6); + } + + mixture + { + parType1 1; + } } layer5 { - timeControl simulationTime; + timeControl simulationTime; - regionType cylinder; // type of insertion region + regionType cylinder; // type of insertion region - rate 5100; // insertion rate (particles/s) + rate 5100; // insertion rate (particles/s) - startTime 3.4; // (s) + startTime 3.4; // (s) - endTime 3.9; // (s) + endTime 3.9; // (s) - insertionInterval 0.025; // s + insertionInterval 0.025; // s - cylinderInfo - { - radius 0.09; - p1 ( 0.0 0.0 0.38 ); // (m,m,m) - p2 ( 0.0 0.0 0.39); // (m,m,m) - } - - setFields - { - velocity realx3 (0.0 0.0 -0.6); - } - - mixture - { - parType2 1; - - } + cylinderInfo + { + radius 0.09; + p1 ( 0.0 0.0 0.38 ); // (m,m,m) + p2 ( 0.0 0.0 0.39); // (m,m,m) + } + + setFields + { + velocity realx3 (0.0 0.0 -0.6); + } + + mixture + { + parType2 1; + } } \ No newline at end of file diff --git a/tutorials/sphereGranFlow/homogenizationSilo-PeriodicBoundary/settings/domainDict b/tutorials/sphereGranFlow/homogenizationSilo-PeriodicBoundary/settings/domainDict index 606db9b1..c0d515c0 100755 --- a/tutorials/sphereGranFlow/homogenizationSilo-PeriodicBoundary/settings/domainDict +++ b/tutorials/sphereGranFlow/homogenizationSilo-PeriodicBoundary/settings/domainDict @@ -2,51 +2,51 @@ | phasicFlow File | | copyright: www.cemf.ir | \* ------------------------------------------------------------------------- */ -objectName domainDict; -objectType dictionary; +objectName domainDict; +objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ // Simulation domain: every particles that goes outside this domain will be deleted globalBox { - min (-0.11 -0.11 -0.15); - - max ( 0.11 0.11 0.4); + min (-0.11 -0.11 -0.15); + + max ( 0.11 0.11 0.4); } boundaries { - - left - { - type exit; - } + + left + { + type exit; + } - right - { - type exit; - } + right + { + type exit; + } - bottom - { - type exit; - } + bottom + { + type exit; + } - top - { - type exit; - } + top + { + type exit; + } - rear - { - type periodic; - } + rear // z- + { + type periodic; + } - front - { - type periodic; - } + front // z+ + { + type periodic; + } } diff --git a/tutorials/sphereGranFlow/homogenizationSilo-PeriodicBoundary/settings/geometryDict b/tutorials/sphereGranFlow/homogenizationSilo-PeriodicBoundary/settings/geometryDict index b72f1c07..13d93a19 100755 --- a/tutorials/sphereGranFlow/homogenizationSilo-PeriodicBoundary/settings/geometryDict +++ b/tutorials/sphereGranFlow/homogenizationSilo-PeriodicBoundary/settings/geometryDict @@ -2,8 +2,8 @@ | phasicFlow File | | copyright: www.cemf.ir | \* ------------------------------------------------------------------------- */ -objectName geometryDict; -objectType dictionary; +objectName geometryDict; +objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ @@ -11,73 +11,72 @@ motionModel rotatingAxis; rotatingAxisInfo { - // for opening the gate of silo between time 4.1 and 5.1 s - gateMotion - { - p1 (-0.04 -0.04 -0.1); - p2 (-0.04 -0.04 0.0); - omega 3.14; - startTime 4.1; - endTime 5.1; - } + // for opening the gate of silo between time 4.1 and 5.1 s + gateMotion + { + p1 (-0.04 -0.04 -0.1); + p2 (-0.04 -0.04 0.0); + omega 3.14; + startTime 4.1; + endTime 5.1; + } } surfaces { - cylinderShell - { - type cylinderWall; // other options: cuboidWall and planeWall + cylinderShell + { + type cylinderWall; // other options: cuboidWall and planeWall - p1 (0.0 0.0 0.0); // begin point of cylinder axis + p1 (0.0 0.0 0.0); // begin point of cylinder axis - p2 (0.0 0.0 0.4); // end point of cylinder axis + p2 (0.0 0.0 0.4); // end point of cylinder axis - radius1 0.1; // radius at p1 + radius1 0.1; // radius at p1 - radius2 0.1; // radius at p2 + radius2 0.1; // radius at p2 - resolution 36; // number of divisions + resolution 36; // number of divisions - material wallMat; // material name of this wall - } + material wallMat; // material name of this wall + } - coneShell - { - type cylinderWall; // other options: cuboidWall and planeWall + coneShell + { + type cylinderWall; // other options: cuboidWall and planeWall - p1 (0.0 0.0 -0.1); // begin point of cylinder axis + p1 (0.0 0.0 -0.1); // begin point of cylinder axis - p2 (0.0 0.0 0.0); // end point of cylinder axis + p2 (0.0 0.0 0.0); // end point of cylinder axis - radius1 0.04; // radius at p1 + radius1 0.04; // radius at p1 - radius2 0.1; // radius at p2 + radius2 0.1; // radius at p2 - resolution 36; // number of divisions + resolution 36; // number of divisions - material wallMat; // material name of this wall - } + material wallMat; // material name of this wall + } - /* - This is a plane wall at the exit of silo - */ + /* + This is a plane wall at the exit of silo + */ + exitGate + { + type planeWall; // other options: cuboidWall and cylinderWall - exitGate - { - type planeWall; // other options: cuboidWall and cylinderWall + p1 (-0.04 -0.04 -0.1); // first point of the wall - p1 (-0.04 -0.04 -0.1); // first point of the wall + p2 ( 0.04 -0.04 -0.1); // second point of the wall - p2 ( 0.04 -0.04 -0.1); // second point of the wall + p3 ( 0.04 0.04 -0.1); // third point of the wall - p3 ( 0.04 0.04 -0.1); // third point of the wall + p4 (-0.04 0.04 -0.1); // fourth point of the wall + + material wallMat; // material name of the wall - p4 (-0.04 0.04 -0.1); // fourth point of the wall - - material wallMat; // material name of the wall - - motion gateMotion; - } + motion gateMotion; + } } diff --git a/tutorials/sphereGranFlow/homogenizationSilo-PeriodicBoundary/settings/particlesDict b/tutorials/sphereGranFlow/homogenizationSilo-PeriodicBoundary/settings/particlesDict index a01a553e..7805806f 100755 --- a/tutorials/sphereGranFlow/homogenizationSilo-PeriodicBoundary/settings/particlesDict +++ b/tutorials/sphereGranFlow/homogenizationSilo-PeriodicBoundary/settings/particlesDict @@ -2,35 +2,34 @@ | phasicFlow File | | copyright: www.cemf.ir | \* ------------------------------------------------------------------------- */ -objectName particlesDict; -objectType dictionary; +objectName particlesDict; +objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ setFields { - /* - Default value for fields defined for particles - These fields should always be defined for simulations with - spherical particles. - */ + /* + Default value for fields defined for particles + These fields should always be defined for simulations with + spherical particles. + */ + defaultValue + { + velocity realx3 (0 0 0); // linear velocity (m/s) - defaultValue - { - 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) + rVelocity realx3 (0 0 0); // rotational velocity (rad/s) - rVelocity realx3 (0 0 0); // rotational velocity (rad/s) + shapeName word parType1; // name of the particle shape + } - shapeName word parType1; // name of the particle shape - } - - selectors - {} + selectors + {} } positionParticles { - method empty; // empty simulation + method empty; // empty simulation } diff --git a/tutorials/sphereGranFlow/homogenizationSilo-PeriodicBoundary/settings/settingsDict b/tutorials/sphereGranFlow/homogenizationSilo-PeriodicBoundary/settings/settingsDict index 0f119f33..774e1c9c 100755 --- a/tutorials/sphereGranFlow/homogenizationSilo-PeriodicBoundary/settings/settingsDict +++ b/tutorials/sphereGranFlow/homogenizationSilo-PeriodicBoundary/settings/settingsDict @@ -2,40 +2,40 @@ | phasicFlow File | | copyright: www.cemf.ir | \* ------------------------------------------------------------------------- */ -objectName settingsDict; -objectType dictionary; +objectName settingsDict; +objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ run homogenizationSilo; -dt 0.00001; // time step for integration (s) +dt 0.00001; // time step for integration (s) -startTime 0.0; // start time for simulation +startTime 0.0; // start time for simulation -endTime 20; // end time for simulation +endTime 20; // end time for simulation -saveInterval 0.05; // time interval for saving the simulation +saveInterval 0.05; // time interval for saving the simulation -timePrecision 4; // maximum number of digits for time folder +timePrecision 4; // maximum number of digits for time folder -g (0 0 -9.8); // gravity vector (m/s2) +g (0 0 -9.8); // gravity vector (m/s2) // overrides the default behavior includeObjects (diameter); // exclude unnecessary data from saving on disk -excludeObjects (rVelocity.dy1 rVelocity.dy2 rVelocity.dy3 - pStructPosition.dy1 pStructPosition.dy2 pStructPosition.dy3 - pStructVelocity.dy1 pStructVelocity.dy2 pStructVelocity.dy3); +excludeObjects (); -integrationMethod AdamsBashforth4; // integration method +integrationMethod AdamsBashforth4; // integration method -writeFormat binary; // data writting format (ascii or binary) +integrationHistory off; // to save space on disk -timersReport Yes; // report timers +writeFormat binary; // data writting format (ascii or binary) -timersReportInterval 0.1; // time interval for reporting timers +timersReport Yes; // report timers + +timersReportInterval 0.1; // time interval for reporting timers diff --git a/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/shapes b/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/shapes index 354e3d53..76ed5ee5 100755 --- a/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/shapes +++ b/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/shapes @@ -2,14 +2,14 @@ | phasicFlow File | | copyright: www.cemf.ir | \* ------------------------------------------------------------------------- */ -objectName sphereDict; -objectType sphereShape; +objectName sphereDict; +objectType sphereShape; 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 -materials (lightMat heavyMat); // material names for shapes +materials (lightMat heavyMat); // material names for shapes diff --git a/tutorials/sphereGranFlow/layeredSiloFilling/settings/particlesDict b/tutorials/sphereGranFlow/layeredSiloFilling/settings/particlesDict index 66bc9ec0..8db9229c 100755 --- a/tutorials/sphereGranFlow/layeredSiloFilling/settings/particlesDict +++ b/tutorials/sphereGranFlow/layeredSiloFilling/settings/particlesDict @@ -13,7 +13,6 @@ setFields These fields should always be defined for simulations with spherical particles. */ - defaultValue { velocity realx3 (0 0 0); // linear velocity (m/s) diff --git a/tutorials/sphereGranFlow/layeredSiloFilling/settings/settingsDict b/tutorials/sphereGranFlow/layeredSiloFilling/settings/settingsDict index 1beb6649..27047265 100755 --- a/tutorials/sphereGranFlow/layeredSiloFilling/settings/settingsDict +++ b/tutorials/sphereGranFlow/layeredSiloFilling/settings/settingsDict @@ -25,10 +25,12 @@ g (0 0 -9.8); // gravity vector (m/s^2) includeObjects (diameter mass); // exclude unnecessary data from saving on disk -excludeObjects (rVelocity.dy1 pStructPosition.dy1 pStructVelocity.dy1); +excludeObjects (); integrationMethod AdamsBashforth2; // integration method +integrationHistory off; + writeFormat ascii; // data writing format (ascii or binary) timersReport Yes; // report timers diff --git a/tutorials/sphereGranFlow/rotatingDrumMedium/README.md b/tutorials/sphereGranFlow/rotatingDrumMedium/README.md new file mode 100644 index 00000000..42c580c3 --- /dev/null +++ b/tutorials/sphereGranFlow/rotatingDrumMedium/README.md @@ -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. + +
+ +A view of the rotating drum simulation + +
+ +*** + +## 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. diff --git a/tutorials/sphereGranFlow/rotatingDrumMedium/caseSetup/interaction b/tutorials/sphereGranFlow/rotatingDrumMedium/caseSetup/interaction index 3abd0790..57691172 100755 --- a/tutorials/sphereGranFlow/rotatingDrumMedium/caseSetup/interaction +++ b/tutorials/sphereGranFlow/rotatingDrumMedium/caseSetup/interaction @@ -6,6 +6,7 @@ objectName interaction; objectType dicrionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ + materials (glassMat wallMat); // a list of materials names densities (2500.0 2500); // density of materials [kg/m3] diff --git a/tutorials/sphereGranFlow/rotatingDrumMedium/caseSetup/particleInsertion b/tutorials/sphereGranFlow/rotatingDrumMedium/caseSetup/particleInsertion deleted file mode 100755 index c4fd4f25..00000000 --- a/tutorials/sphereGranFlow/rotatingDrumMedium/caseSetup/particleInsertion +++ /dev/null @@ -1,10 +0,0 @@ -/* -------------------------------*- C++ -*--------------------------------- *\ -| phasicFlow File | -| copyright: www.cemf.ir | -\* ------------------------------------------------------------------------- */ -objectName particleInsertion; -objectType dicrionary; -fileFormat ASCII; -/*---------------------------------------------------------------------------*/ -active No; // is checked -> Yes or No - diff --git a/tutorials/sphereGranFlow/rotatingDrumMedium/settings/domainDict b/tutorials/sphereGranFlow/rotatingDrumMedium/settings/domainDict index 5c0faa6f..edf8509a 100755 --- a/tutorials/sphereGranFlow/rotatingDrumMedium/settings/domainDict +++ b/tutorials/sphereGranFlow/rotatingDrumMedium/settings/domainDict @@ -6,7 +6,9 @@ objectName domainDict; objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ -globalBox // Simulation domain: every particles that goes outside this domain will be deleted + +// Simulation domain: every particles that goes outside this domain will be deleted +globalBox { min (-0.12 -0.12 0); diff --git a/tutorials/sphereGranFlow/rotatingDrumMedium/settings/geometryDict b/tutorials/sphereGranFlow/rotatingDrumMedium/settings/geometryDict index b1cf7ee0..7e9605b4 100644 --- a/tutorials/sphereGranFlow/rotatingDrumMedium/settings/geometryDict +++ b/tutorials/sphereGranFlow/rotatingDrumMedium/settings/geometryDict @@ -6,6 +6,7 @@ objectName geometryDict; objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ + motionModel rotatingAxis; // motion model: rotating object around an axis diff --git a/tutorials/sphereGranFlow/rotatingDrumMedium/settings/particlesDict b/tutorials/sphereGranFlow/rotatingDrumMedium/settings/particlesDict index 61796a4f..07b12d2c 100644 --- a/tutorials/sphereGranFlow/rotatingDrumMedium/settings/particlesDict +++ b/tutorials/sphereGranFlow/rotatingDrumMedium/settings/particlesDict @@ -36,7 +36,7 @@ positionParticles // positions particles orderedInfo { - diameter 0.003; // minimum space between centers of particles + distance 0.003; // minimum distance between particles centers numPoints 250000; // number of particles in the simulation diff --git a/tutorials/sphereGranFlow/rotatingDrumMedium/settings/settingsDict b/tutorials/sphereGranFlow/rotatingDrumMedium/settings/settingsDict index b6270b50..7281076f 100644 --- a/tutorials/sphereGranFlow/rotatingDrumMedium/settings/settingsDict +++ b/tutorials/sphereGranFlow/rotatingDrumMedium/settings/settingsDict @@ -23,7 +23,7 @@ g (0 -9.8 0); // gravity vector (m/s2) includeObjects (diameter); // save necessary (i.e., required) data on disk // exclude unnecessary data from saving on disk -excludeObjects (rVelocity.dy1 pStructPosition.dy1 pStructVelocity.dy1); +excludeObjects (); integrationMethod AdamsBashforth2; // integration method diff --git a/tutorials/sphereGranFlow/rotatingDrumSmall/README.md b/tutorials/sphereGranFlow/rotatingDrumSmall/README.md index d8955de3..e1d18e44 100644 --- a/tutorials/sphereGranFlow/rotatingDrumSmall/README.md +++ b/tutorials/sphereGranFlow/rotatingDrumSmall/README.md @@ -1,60 +1,62 @@ -# Simularing a rotating drum (v-1.0) -## Problem definition -The problem is to simulate a rotating drum with the diameter 0.24 m and the length 0.1 m rotating at 11.6 rpm. It is filled with 30,000 4-mm spherical particles. The timestep for integration is 0.00001 s. +# Simulating a Rotating Drum (v-1.0) + +## Problem Definition + +The problem is to simulate a rotating drum with a diameter of 0.24 m and a length of 0.1 m, rotating at 11.6 rpm. It is filled with 30,000 spherical particles, each with a diameter of 4 mm. The timestep for integration is 0.00001 s. This tutorial demonstrates the basic setup for creating a rotation-based simulation using built-in geometry in PhasicFlow. +
- -A view of rotating drum +A view of the rotating drum - - -![](https://github.com/PhasicFlow/phasicFlow/blob/media/media/rotating-drum-s.png) - -
+
+ +
+
*** -## Setting up the case -PhasicFlow simulation case setup is based on the text-based scripts that we provide in two folders located in the simulation case folder: `settings` and `caseSetup` (You can find the case setup files in the above folders. -All the commands should be entered in the terminal while the current working directory is the simulation case folder (at the top of the `caseSetup` and `settings`). +## 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 (at the top level of `caseSetup` and `settings`). -### Creating particles +### Creating Particles -Open the file `settings/particlesDict`. Two dictionaries, `positionParticles` and `setFields` position particles and set the field values for the particles. -In dictionary `positionParticles`, the positioning `method` is `ordered`, which position particles in order in the space defined by `box`. `box` space is defined by two corner points `min` and `max`. In dictionary `orderedInfo`, `numPoints` defines number of particles; `diameter`, the distance between two adjacent particles, and `axisOrder` defines the axis order for filling the space by particles. +In the file `settings/particlesDict`, two dictionaries, `positionParticles` and `setFields`, position particles and set the field values for the particles. + +The `positionParticles` dictionary uses the `ordered` method to position particles in a space defined by `box`. The box space is defined by two corner points: `min` and `max`. In the `orderedInfo` sub-dictionary, `numPoints` defines the number of particles (30,000), `distance` defines the spacing between adjacent particles (4 mm), and `axisOrder` defines the axis order for filling the space with particles.
in settings/particlesDict file
```C++ -positionParticles // positions particles -{ - method ordered; // other options: random and empty +positionParticles +{ + method ordered; // other options: random and empty - mortonSorting Yes; // perform initial sorting based on morton code? + mortonSorting Yes; // perform initial sorting based on morton code? orderedInfo { - diameter 0.004; // minimum space between centers of particles + distance 0.004; // minimum space between centers of particles - numPoints 30000; // number of particles in the simulation + numPoints 30000; // number of particles in the simulation - axisOrder (z y x); // axis order for filling the space with particles + axisOrder (z y x); // axis order for filling the space with particles } - regionType box; // other options: cylinder and sphere + regionType box; // other options: cylinder and sphere - boxInfo // box information for positioning particles + boxInfo // box information for positioning particles { - min (-0.08 -0.08 0.015); // lower corner point of the box + 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 + max ( 0.08 0.08 0.098); // upper corner point of the box } } ``` -In dictionary `setFields`, dictionary `defaultValue` defines the initial value for particle fields (here, `velocity`, `acceleration`, `rotVelocity`, and `shapeName`). Note that `shapeName` field should be consistent with the name of shape that you later set for shapes (here one shape with name `sphere1`). + +In the `setFields` dictionary, the `defaultValue` sub-dictionary defines the initial values for particle fields (velocity, acceleration, rotational velocity, and shape name). The shape name field should be consistent with the name defined in the shapes file (here, "sphere1").
in settings/particlesDict file @@ -76,17 +78,20 @@ setFields selectors { - + // Selectors can be used to modify properties for specific particle groups } } ``` -Enter the following command in the terminal to create the particles and store them in `0` folder. +To create the particles and store them in the `0` folder, enter the following command: -`> particlesPhasicFlow` +``` +particlesPhasicFlow +``` -### Creating geometry -In file `settings/geometryDict` , you can provide information for creating geometry. Each simulation should have a `motionModel` that defines a model for moving the surfaces in the simulation. `rotatingAxis` model defines a fixed axis which rotates around itself. The dictionary `rotAxis` defines an motion component with `p1` and `p2` as the end points of the axis and `omega` as the rotation speed in rad/s. You can define more than one motion component in a simulation. +### Creating Geometry + +In the file `settings/geometryDict`, you define the motion model and geometry for the simulation. The `rotatingAxis` motion model defines a fixed axis which rotates around itself. The `rotAxis` dictionary specifies the axis endpoints and rotation speed.
in settings/geometryDict file @@ -95,19 +100,23 @@ in settings/geometryDict file ```C++ motionModel rotatingAxis; -rotatingAxisInfo // information for rotatingAxisMotion motion model +rotatingAxisInfo { rotAxis { - p1 (0.0 0.0 0.0); // first point for the axis of rotation + p1 (0.0 0.0 0.0); // first point for the axis of rotation - p2 (0.0 0.0 1.0); // second point for the axis of rotation + p2 (0.0 0.0 1.0); // second point for the axis of rotation - omega 1.214; // rotation speed (rad/s) + omega 1.214; // rotation speed (rad/s) } } ``` -In the dictionary `surfaces` you can define all the surfaces (walls) in the simulation. Two main options are available: built-in geometries in PhasicFlow, and providing surfaces with stl file. Here we use built-in geometries. In `cylinder` dictionary, a cylindrical shell with end radii, `radius1` and `radius2`, axis end points `p1` and `p2`, `material` name `prop1`, `motion` component `rotAxis` is defined. `resolution` sets number of division for the cylinder shell. `wall1` and `wall2` define two plane walls at two ends of cylindrical shell with coplanar corner points `p1`, `p2`, `p3`, and `p4`, `material` name `prop1` and `motion` component `rotAxis`. + +The `surfaces` dictionary defines all the walls in the simulation. This tutorial uses built-in geometries provided by PhasicFlow. The geometry consists of: + +1. A `cylinder` dictionary defining a cylindrical shell with end radii (`radius1` and `radius2`), axis endpoints (`p1` and `p2`), material name (`prop1`), and motion component (`rotAxis`). +2. Two plane walls (`wall1` and `wall2`) at the ends of the cylindrical shell, each defined with four coplanar corner points, the same material name, and the same motion component.
in settings/geometryDict file @@ -119,114 +128,119 @@ surfaces /* A cylinder with begin and end radii 0.12 m and axis points at (0 0 0) and (0 0 0.1) */ - cylinder { - type cylinderWall; // type of the wall + type cylinderWall; // type of the wall - p1 (0.0 0.0 0.0); // begin point of cylinder axis + p1 (0.0 0.0 0.0); // begin point of cylinder axis - p2 (0.0 0.0 0.1); // end point of cylinder axis + p2 (0.0 0.0 0.1); // end point of cylinder axis - radius1 0.12; // radius at p1 + radius1 0.12; // radius at p1 - radius2 0.12; // radius at p2 + radius2 0.12; // radius at p2 - resolution 24; // number of divisions + resolution 24; // number of divisions - material prop1; // material name of this wall + material prop1; // material name of this wall - motion rotAxis; // motion component name + motion rotAxis; // motion component name } /* This is a plane wall at the rear end of cylinder */ - wall1 { - type planeWall; // type of the wall + type planeWall; // type of the wall - p1 (-0.12 -0.12 0.0); // first point of the wall + p1 (-0.12 -0.12 0.0); // first point of the wall - p2 ( 0.12 -0.12 0.0); // second point + p2 ( 0.12 -0.12 0.0); // second point - p3 ( 0.12 0.12 0.0); // third point + p3 ( 0.12 0.12 0.0); // third point - p4 (-0.12 0.12 0.0); // fourth point + p4 (-0.12 0.12 0.0); // fourth point - material prop1; // material name of the wall + material prop1; // material name of the wall - motion rotAxis; // motion component name + motion rotAxis; // motion component name } /* This is a plane wall at the front end of cylinder */ - wall2 { - type planeWall; // type of the wall + type planeWall; // type of the wall - p1 (-0.12 -0.12 0.1); // first point of the wall + p1 (-0.12 -0.12 0.1); // first point of the wall - p2 ( 0.12 -0.12 0.1); // second point + p2 ( 0.12 -0.12 0.1); // second point - p3 ( 0.12 0.12 0.1); // third point + p3 ( 0.12 0.12 0.1); // third point - p4 (-0.12 0.12 0.1); // fourth point + p4 (-0.12 0.12 0.1); // fourth point - material prop1; // material name of the wall + material prop1; // material name of the wall - motion rotAxis; // motion component name + motion rotAxis; // motion component name } } ``` -Enter the following command in the terminal to create the geometry and store it in `0/geometry` folder. -`> geometryPhasicFlow` +To create the geometry and store it in the `0/geometry` folder, enter: -### Defining properties and interactions -In the file `caseSetup/interaction` , you find properties of materials. `materials` defines a list of material names in the simulation and `densities` sets the corresponding density of each material name. model dictionary defines the interaction model for particle-particle and particle-wall interactions. `contactForceModel` selects the model for mechanical contacts (here nonlinear model with limited tangential displacement) and `rollingFrictionModel` selects the model for calculating rolling friction. Other required prosperities should be defined in this dictionary. +``` +geometryPhasicFlow +``` + +### Defining Properties and Interactions + +In the file `caseSetup/interaction`, you define properties of materials and their interactions. The `materials` entry lists material names, and `densities` sets the corresponding densities. The `model` dictionary defines the contact force and rolling friction models, along with other required properties.
in caseSetup/interaction file
```C++ -materials (prop1); // a list of materials names -densities (1000.0); // density of materials [kg/m3] -. -. -. +materials (prop1); // a list of materials names + +densities (1000.0); // density of materials [kg/m3] + +contactListType sortedContactList; + model { - contactForceModel nonLinearNonLimited; - rollingFrictionModel normal; + contactForceModel nonLinearNonLimited; - Yeff (1.0e6); // Young modulus [Pa] - Geff (0.8e6); // Shear modulus [Pa] - nu (0.25); // Poisson's ratio [-] - en (0.7); // coefficient of normal restitution - mu (0.3); // dynamic friction - mur (0.1); // rolling friction + rollingFrictionModel normal; + + Yeff (1.0e6); // Young modulus [Pa] + + Geff (0.8e6); // Shear modulus [Pa] + + nu (0.25); // Poisson's ratio [-] + + en (0.7); // coefficient of normal restitution + + mu (0.3); // dynamic friction + + mur (0.1); // rolling friction } ``` -Dictionary `contactSearch` sets the methods for particle-particle and particle-wall contact search. `method` specifies the algorithm for finding neighbor list for particle-particle contacts. `updateInterval` sets the number of iterations between each occurance of updating neighbor list and `sizeRatio` sets the size of enlarged cells (with respect to particle diameter) for finding neighbor list. Larger `sizeRatio` include more particles in the neighbor list and you require to update it less frequent. +The `contactSearch` dictionary specifies the algorithm and parameters for finding particle-particle contacts. The `method` determines the broad search algorithm, `updateInterval` sets how often to update the neighbor list, and `sizeRatio` controls the enlarged cell size for finding neighbors.
in caseSetup/interaction file
```C++ -contactListType sortedContactList; - contactSearch { - - method NBS; // method for broad search - + method NBS; + updateInterval 10; sizeRatio 1.1; @@ -235,57 +249,25 @@ contactSearch adjustableBox Yes; } - ``` -In the file `caseSetup/shape`, you can define a list of `names` for shapes (`shapeName` in particle field), a list of diameters for shapes and their `properties` names. +In the file `caseSetup/shapes`, you define particle shapes, including their names, diameters, and material properties:
-in caseSetup/shape file +in caseSetup/shapes file
```C++ -names (sphere1); // names of shapes -diameters (0.004); // diameter of shapes -materials (prop1); // material names for shapes +names (sphere1); // names of shapes + +diameters (0.004); // diameter of shapes + +materials (prop1); // material names for shapes ``` -Other settings for the simulation can be set in file `settings/settingsDict`. +### Simulation Domain and Boundaries -
-in settings/settingsDict file -
- -```C++ -run rotatingDrumSmall; - -dt 0.00001; // time step for integration (s) - -startTime 0; // start time for simulation - -endTime 10; // end time for simulation - -saveInterval 0.1; // time interval for saving the simulation - -timePrecision 6; // maximum number of digits for time folder - -g (0 -9.8 0); // gravity vector (m/s2) - -includeObjects (diameter); // save necessary (i.e., required) data on disk - -// exclude unnecessary data from saving on disk -excludeObjects (rVelocity.dy1 pStructPosition.dy1 pStructVelocity.dy1); - -integrationMethod AdamsBashforth2; // integration method - -writeFormat ascii; // data writting format (ascii or binary) - -timersReport Yes; // report timers (Yes or No) - -timersReportInterval 0.01; // time interval for reporting timers -``` - -The dictionary `settings/domainDict` defines the a rectangular bounding box with two corner points for the simulation. Each particle that gets out of this box, will be deleted automatically. +The file `settings/domainDict` defines a rectangular bounding box with boundaries. Particles that exit this box are automatically deleted.
in settings/domainDict file @@ -295,52 +277,116 @@ in settings/domainDict file // Simulation domain: every particles that goes outside this domain will be deleted globalBox { - min (-0.12 -0.12 0.00); // lower corner point of the box + min (-0.12 -0.12 0.00); // lower corner point of the box - max (0.12 0.12 0.11); // upper corner point of the box + max (0.12 0.12 0.11); // upper corner point of the box } boundaries { left { - type exit; // other options: periodic, reflective + type exit; // other options: periodic, reflective } right { - type exit; // other options: periodic, reflective + type exit; // other options: periodic, reflective } bottom { - type exit; // other options: periodic, reflective + type exit; // other options: periodic, reflective } top { - type exit; // other options: periodic, reflective + type exit; // other options: periodic, reflective } rear { - type exit; // other options: periodic, reflective + type exit; // other options: periodic, reflective } front { - type exit; // other options: periodic, reflective + type exit; // other options: periodic, reflective } } ``` +### Other Settings -## Running the case -The solver for this simulation is `sphereGranFlow`. Enter the following command in the terminal. Depending on the computational power, it may take a few minutes to a few hours to complete. +Additional parameters for the simulation are set in `settings/settingsDict`, including timestep, start and end times, saving intervals, and gravity: -`> sphereGranFlow` +
+in settings/settingsDict file +
-## Post processing -After finishing the simulation, you can render the results in Paraview. To convert the results to VTK format, just enter the following command in the terminal. This will converts all the results (particles and geometry) to VTK format and store them in folder `VTK/`. +```C++ +dt 0.00001; // time step for integration (s) -`> pFlowToVTK --binary` +startTime 0; // start time for simulation + +endTime 10; // end time for simulation + +saveInterval 0.1; // time interval for saving the simulation + +timePrecision 6; // maximum number of digits for time folder + +g (0 -9.8 0); // gravity vector (m/s2) + +includeObjects (diameter); // save necessary (i.e., required) data on disk + +// exclude unnecessary data from saving on disk +excludeObjects (); + +integrationMethod AdamsBashforth2; // integration method + +integrationHistory off; // to save space on disk + +writeFormat ascii; // data writing format (ascii or binary) + +timersReport Yes; // report timers (Yes or No) +``` + +## Running the Case + +To execute the simulation, follow these steps in order: + +1. Create the geometry: + +``` +geometryPhasicFlow +``` + +2. Create the initial particle fields: + +``` +particlesPhasicFlow +``` + +3. Run the simulation: + +``` +sphereGranFlow +``` + +Depending on your computational resources, the simulation may take from a few minutes to several hours to complete. + +## Post Processing + +After the simulation completes, you can visualize the results in ParaView by converting them to VTK format: + +``` +pFlowToVTK --binary +``` + +This command converts all simulation results (particles and geometry) to VTK format and stores them in a `VTK/` folder. You can then open these files in ParaView for detailed analysis and visualization. + +For more specific field output, you can specify fields: + +``` +pFlowToVTK --binary --fields diameter velocity id +``` diff --git a/tutorials/sphereGranFlow/rotatingDrumSmall/caseSetup/interaction b/tutorials/sphereGranFlow/rotatingDrumSmall/caseSetup/interaction index 2713ed01..1adca27f 100755 --- a/tutorials/sphereGranFlow/rotatingDrumSmall/caseSetup/interaction +++ b/tutorials/sphereGranFlow/rotatingDrumSmall/caseSetup/interaction @@ -6,6 +6,7 @@ objectName interaction; objectType dicrionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ + materials (prop1); // a list of materials names densities (1000.0); // density of materials [kg/m3] @@ -15,33 +16,33 @@ contactListType sortedContactList; contactSearch { - method NBS; // method for broad search - - updateInterval 10; + method NBS; // method for broad search - sizeRatio 1.1; + updateInterval 10; - cellExtent 0.55; + sizeRatio 1.1; - adjustableBox Yes; + cellExtent 0.55; + + adjustableBox Yes; } model { - contactForceModel nonLinearNonLimited; + contactForceModel nonLinearNonLimited; - rollingFrictionModel normal; + rollingFrictionModel normal; - Yeff (1.0e6); // Young modulus [Pa] + Yeff (1.0e6); // Young modulus [Pa] - Geff (0.8e6); // Shear modulus [Pa] + Geff (0.8e6); // Shear modulus [Pa] - nu (0.25); // Poisson's ratio [-] + nu (0.25); // Poisson's ratio [-] - en (0.7); // coefficient of normal restitution + en (0.7); // coefficient of normal restitution - mu (0.3); // dynamic friction + mu (0.3); // dynamic friction - mur (0.1); // rolling friction + mur (0.1); // rolling friction } diff --git a/tutorials/sphereGranFlow/rotatingDrumSmall/caseSetup/particleInsertion b/tutorials/sphereGranFlow/rotatingDrumSmall/caseSetup/particleInsertion deleted file mode 100755 index cabe23da..00000000 --- a/tutorials/sphereGranFlow/rotatingDrumSmall/caseSetup/particleInsertion +++ /dev/null @@ -1,13 +0,0 @@ -/* -------------------------------*- C++ -*--------------------------------- *\ -| phasicFlow File | -| copyright: www.cemf.ir | -\* ------------------------------------------------------------------------- */ -objectName particleInsertion; -objectType dicrionary; -fileFormat ASCII; -/*---------------------------------------------------------------------------*/ -active No; // is insertion active -> Yes or No - -collisionCheck No; // is checked -> Yes or No - - diff --git a/tutorials/sphereGranFlow/rotatingDrumSmall/caseSetup/shapes b/tutorials/sphereGranFlow/rotatingDrumSmall/caseSetup/shapes index 30ddfb1c..25d23a36 100755 --- a/tutorials/sphereGranFlow/rotatingDrumSmall/caseSetup/shapes +++ b/tutorials/sphereGranFlow/rotatingDrumSmall/caseSetup/shapes @@ -2,12 +2,12 @@ | phasicFlow File | | copyright: www.cemf.ir | \* ------------------------------------------------------------------------- */ -objectName sphereDict; -objectType sphereShape; +objectName sphereDict; +objectType sphereShape; fileFormat ASCII; /*---------------------------------------------------------------------------*/ -names (sphere1); // names of shapes +names (sphere1); // names of shapes -diameters (0.004); // diameter of shapes +diameters (0.004); // diameter of shapes -materials (prop1); // material names for shapes +materials (prop1); // material names for shapes diff --git a/tutorials/sphereGranFlow/rotatingDrumSmall/settings/domainDict b/tutorials/sphereGranFlow/rotatingDrumSmall/settings/domainDict index 730402bc..563cd80d 100755 --- a/tutorials/sphereGranFlow/rotatingDrumSmall/settings/domainDict +++ b/tutorials/sphereGranFlow/rotatingDrumSmall/settings/domainDict @@ -2,46 +2,48 @@ | phasicFlow File | | copyright: www.cemf.ir | \* ------------------------------------------------------------------------- */ -objectName domainDict; -objectType dictionary; +objectName domainDict; +objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ -globalBox // Simulation domain: every particles that goes outside this domain will be deleted -{ - min (-0.12 -0.12 0.00); // lower corner point of the box - max (0.12 0.12 0.11); // upper corner point of the box +// Simulation domain: every particles that goes outside this domain will be deleted +globalBox +{ + min (-0.12 -0.12 0.00); // lower corner point of the box + + max (0.12 0.12 0.11); // upper corner point of the box } boundaries { - left - { - type exit; // other options: periodict, reflective - } + left + { + type exit; // other options: periodic, reflective + } - right - { - type exit; // other options: periodict, reflective - } + right + { + type exit; // other options: periodic, reflective + } - bottom - { - type exit; // other options: periodict, reflective - } + bottom + { + type exit; // other options: periodic, reflective + } - top - { - type exit; // other options: periodict, reflective - } + top + { + type exit; // other options: periodic, reflective + } - rear - { - type exit; // other options: periodict, reflective - } + rear + { + type exit; // other options: periodic, reflective + } - front - { - type exit; // other options: periodict, reflective - } + front + { + type exit; // other options: periodic, reflective + } } diff --git a/tutorials/sphereGranFlow/rotatingDrumSmall/settings/geometryDict b/tutorials/sphereGranFlow/rotatingDrumSmall/settings/geometryDict index d1a55c1f..763a56be 100644 --- a/tutorials/sphereGranFlow/rotatingDrumSmall/settings/geometryDict +++ b/tutorials/sphereGranFlow/rotatingDrumSmall/settings/geometryDict @@ -6,6 +6,7 @@ objectName geometryDict; objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ + motionModel rotatingAxis; rotatingAxisInfo // information for rotatingAxisMotion motion model @@ -25,7 +26,6 @@ surfaces /* A cylinder with begin and end radii 0.12 m and axis points at (0 0 0) and (0 0 0.1) */ - cylinder { type cylinderWall; // type of the wall @@ -48,7 +48,6 @@ surfaces /* This is a plane wall at the rear end of cylinder */ - wall1 { type planeWall; // type of the wall @@ -69,7 +68,6 @@ surfaces /* This is a plane wall at the front end of cylinder */ - wall2 { type planeWall; // type of the wall diff --git a/tutorials/sphereGranFlow/rotatingDrumSmall/settings/particlesDict b/tutorials/sphereGranFlow/rotatingDrumSmall/settings/particlesDict index 23d4af07..f9cb7773 100644 --- a/tutorials/sphereGranFlow/rotatingDrumSmall/settings/particlesDict +++ b/tutorials/sphereGranFlow/rotatingDrumSmall/settings/particlesDict @@ -2,58 +2,55 @@ | phasicFlow File | | copyright: www.cemf.ir | \* ------------------------------------------------------------------------- */ -objectName particlesDict; -objectType dictionary; +objectName particlesDict; +objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ setFields { - /* - Default value for fields defined for particles + /* + Default value for fields defined for particles + These fields should always be defined for simulations with + spherical particles. + */ + defaultValue + { + velocity realx3 (0 0 0); // linear velocity (m/s) - These fields should always be defined for simulations with + acceleration realx3 (0 0 0); // linear acceleration (m/s2) - spherical particles. - */ + rVelocity realx3 (0 0 0); // rotational velocity (rad/s) - defaultValue - { - velocity realx3 (0 0 0); // linear velocity (m/s) + shapeName word sphere1; // name of the particle shape + } - acceleration realx3 (0 0 0); // linear acceleration (m/s2) + selectors + { - rVelocity realx3 (0 0 0); // rotational velocity (rad/s) - - shapeName word sphere1; // name of the particle shape - } - - selectors - { - - } + } } positionParticles // positions particles { - method ordered; // other options: random and empty + method ordered; // other options: random and empty - mortonSorting Yes; // perform initial sorting based on morton code? + mortonSorting Yes; // perform initial sorting based on morton code? - orderedInfo - { - diameter 0.004; // minimum space between centers of particles + orderedInfo + { + distance 0.004; // minimum distance between particles centers - numPoints 30000; // number of particles in the simulation + numPoints 30000; // number of particles in the simulation - axisOrder (z y x); // axis order for filling the space with particles - } + axisOrder (z y x); // axis order for filling the space with particles + } - regionType box; // other options: cylinder and sphere + regionType box; // other options: cylinder and sphere - boxInfo // box information for positioning particles - { - min (-0.08 -0.08 0.015); // lower corner point of the box + boxInfo // box information 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 - } + max ( 0.08 0.08 0.098); // upper corner point of the box + } } diff --git a/tutorials/sphereGranFlow/rotatingDrumSmall/settings/settingsDict b/tutorials/sphereGranFlow/rotatingDrumSmall/settings/settingsDict index 796e1a1a..226a918d 100644 --- a/tutorials/sphereGranFlow/rotatingDrumSmall/settings/settingsDict +++ b/tutorials/sphereGranFlow/rotatingDrumSmall/settings/settingsDict @@ -2,33 +2,36 @@ | phasicFlow File | | copyright: www.cemf.ir | \* ------------------------------------------------------------------------- */ -objectName settingsDict; -objectType dictionary; +objectName settingsDict; +objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ + run rotatingDrumSmall; -dt 0.00001; // time step for integration (s) +dt 0.00001; // time step for integration (s) -startTime 0; // start time for simulation +startTime 0; // start time for simulation -endTime 10; // end time for simulation +endTime 10; // end time for simulation -saveInterval 0.1; // time interval for saving the simulation +saveInterval 0.1; // time interval for saving the simulation -timePrecision 6; // maximum number of digits for time folder +timePrecision 6; // maximum number of digits for time folder -g (0 -9.8 0); // gravity vector (m/s2) +g (0 -9.8 0); // gravity vector (m/s2) includeObjects (diameter); // save necessary (i.e., required) data on disk // exclude unnecessary data from saving on disk excludeObjects (rVelocity.dy1 pStructPosition.dy1 pStructVelocity.dy1); -integrationMethod AdamsBashforth2; // integration method +integrationMethod AdamsBashforth2; // integration method -writeFormat ascii; // data writting format (ascii or binary) +integrationHistory off; -timersReport Yes; // report timers (Yes or No) +writeFormat ascii; // data writting format (ascii or binary) -timersReportInterval 0.01; // time interval for reporting timers +timersReport Yes; // report timers (Yes or No) + +timersReportInterval 0.01; // time interval for reporting timers diff --git a/tutorials/sphereGranFlow/screwConveyor/caseSetup/particleInsertion b/tutorials/sphereGranFlow/screwConveyor/caseSetup/particleInsertion index 7a5a5c3f..61285cb0 100755 --- a/tutorials/sphereGranFlow/screwConveyor/caseSetup/particleInsertion +++ b/tutorials/sphereGranFlow/screwConveyor/caseSetup/particleInsertion @@ -4,45 +4,44 @@ \* ------------------------------------------------------------------------- */ objectName particleInsertion; objectType dicrionary; -fileFormat ASCII; +fileFormat ASCII; /*---------------------------------------------------------------------------*/ -active yes; // is insertion active? +active yes; // is insertion active? feeder { - rate 2800; // insertion rate (particles/s) - - timeControl simulationTime; + rate 2800; // insertion rate (particles/s) - startTime 0; - - endTime 100; - - insertionInterval 0.04; //s - - regionType box; + timeControl simulationTime; - boxInfo - { + startTime 0; - min ( -0.15 0.34 0.01); // (m,m,m) - max ( 0.15 0.36 0.15); // (m,m,m) - } - - // initial velocity of inserted particles - setFields - { - velocity realx3 (0.0 -0.65 0); - } - - // mixture composition of inserted particles - mixture - { - sphere1 2; - sphere2 1; - } + endTime 100; + + insertionInterval 0.04; //s + + regionType box; + + boxInfo + { + min ( -0.15 0.34 0.01); // (m,m,m) + max ( 0.15 0.36 0.15); // (m,m,m) + } + + // initial velocity of inserted particles + setFields + { + velocity realx3 (0.0 -0.65 0); + } + + // mixture composition of inserted particles + mixture + { + sphere1 2; + sphere2 1; + } } diff --git a/tutorials/sphereGranFlow/screwConveyor/settings/geometryDict b/tutorials/sphereGranFlow/screwConveyor/settings/geometryDict index 7bd905b4..5399819e 100644 --- a/tutorials/sphereGranFlow/screwConveyor/settings/geometryDict +++ b/tutorials/sphereGranFlow/screwConveyor/settings/geometryDict @@ -40,7 +40,6 @@ surfaces material prop1; // material name of this wall motion none; // this surface is not moving ==> none } - } diff --git a/tutorials/sphereGranFlow/screwConveyor/settings/particlesDict b/tutorials/sphereGranFlow/screwConveyor/settings/particlesDict index 4b419d77..79e3655a 100644 --- a/tutorials/sphereGranFlow/screwConveyor/settings/particlesDict +++ b/tutorials/sphereGranFlow/screwConveyor/settings/particlesDict @@ -13,8 +13,6 @@ positionParticles { // A list of options are: ordered, random method empty; // creates the required fields with zero particles (empty). - - mortonSorting Yes; // perform initial sorting based on morton } setFields diff --git a/tutorials/sphereGranFlow/screwConveyor/settings/settingsDict b/tutorials/sphereGranFlow/screwConveyor/settings/settingsDict index 12c55d37..8e7bcfbe 100644 --- a/tutorials/sphereGranFlow/screwConveyor/settings/settingsDict +++ b/tutorials/sphereGranFlow/screwConveyor/settings/settingsDict @@ -2,41 +2,39 @@ | phasicFlow File | | copyright: www.cemf.ir | \* ------------------------------------------------------------------------- */ -objectName settingsDict; -objectType dictionary; -fileFormat ASCII; +objectName settingsDict; +objectType dictionary; +fileFormat ASCII; /*---------------------------------------------------------------------------*/ -run screwConveyor; +run screwConveyor; -dt 0.00002; // time step for integration (s) +dt 0.00002; // time step for integration (s) -startTime 0; // start time for simulation +startTime 0; // start time for simulation -endTime 20; // end time for simulation +endTime 20; // end time for simulation -saveInterval 0.025; // time interval for saving the simulation +saveInterval 0.025; // time interval for saving the simulation -timePrecision 4; // maximum number of digits for time folder +timePrecision 4; // maximum number of digits for time folder -g (0 -9.8 0); // gravity vector (m/s2) +g (0 -9.8 0); // gravity vector (m/s2) -writeFormat binary; // field files will be saved in binary format +writeFormat binary; // field files will be saved in binary format // A list of options: AB2, AB3, AB4, AB5 -integrationMethod AdamsBashforth4; // integration method +integrationMethod AdamsBashforth4; // integration method + +integrationHistory off; // overrides the default behavior includeObjects (diameter); - - // exclude unnecessary data from saving on disk -excludeObjects (rVelocity.dy1 rVelocity.dy2 rVelocity.dy3 - pStructPosition.dy1 pStructPosition.dy2 pStructPosition.dy3 - pStructVelocity.dy1 pStructVelocity.dy2 pStructVelocity.dy3); - +excludeObjects (); + -timersReport Yes; // report timers? +timersReport Yes; // report timers? -timersReportInterval 0.1; // time interval for reporting timers +timersReportInterval 0.1; // time interval for reporting timers diff --git a/tutorials/sphereGranFlow/toteBlender/ReadMe.md b/tutorials/sphereGranFlow/toteBlender/ReadMe.md index de1a367c..dd6e0322 100644 --- a/tutorials/sphereGranFlow/toteBlender/ReadMe.md +++ b/tutorials/sphereGranFlow/toteBlender/ReadMe.md @@ -244,7 +244,7 @@ positionParticles positionOrderedInfo { // minimum space between centers of particles - diameter 0.005; + distance 0.005; // number of particles in the simulation numPoints 24000; diff --git a/tutorials/sphereGranFlow/toteBlender/settings/particlesDict b/tutorials/sphereGranFlow/toteBlender/settings/particlesDict index ebb66d3d..7a80fe95 100644 --- a/tutorials/sphereGranFlow/toteBlender/settings/particlesDict +++ b/tutorials/sphereGranFlow/toteBlender/settings/particlesDict @@ -38,7 +38,7 @@ positionParticles orderedInfo { - diameter 0.005; // minimum space between centers of particles + distance 0.005; // minimum distance between particles centers numPoints 24000; // number of particles in the simulation diff --git a/tutorials/sphereGranFlow/toteBlender/settings/settingsDict b/tutorials/sphereGranFlow/toteBlender/settings/settingsDict index 46a7218b..a0015cee 100644 --- a/tutorials/sphereGranFlow/toteBlender/settings/settingsDict +++ b/tutorials/sphereGranFlow/toteBlender/settings/settingsDict @@ -24,10 +24,12 @@ g (0 0 -9.8); // gravity vector (m/s2) // include/exclude fields for saving on disk includeObjects (diameter); -excludeObjects (rVelocity.dy1 pStructPosition.dy1 pStructVelocity.dy1); +excludeObjects (); integrationMethod AdamsBashforth2; +integrationHistory off; + writeFormat ascii; timersReport Yes; diff --git a/utilities/pFlowToVTK/README.md b/utilities/pFlowToVTK/README.md new file mode 100644 index 00000000..789f7e5e --- /dev/null +++ b/utilities/pFlowToVTK/README.md @@ -0,0 +1,110 @@ +# pFlowToVTK Utility + +## Overview + +pFlowToVTK is a utility for converting phasicFlow simulation data into VTK (Visualization Toolkit) file format. This enables visualization of simulation results in applications like ParaView. The utility handles two primary types of data: + +1. **Particle Data** (pointField) - Converts particle properties such as position, velocity, forces, etc. +2. **Geometry Data** (triSurfaceField) - Converts surface geometries and their properties + +## Basic Usage + +```bash +pFlowToVTK [OPTIONS] +``` + +After simulation is complete, run this command from the case directory to convert all simulation data to VTK format, which will be stored in the `./VTK/` folder. + +## Command Line Options + +| Option | Description | +|--------|-------------| +| `--no-geometry` | Skip conversion of geometry data to VTK format | +| `--no-particles` | Skip conversion of particle data to VTK format | +| `-b, --binary` | Write VTK files in binary format (default is ASCII). Using binary format accelerates conversion (5-10x) and visualization in ParaView | +| `-o, --out-folder ` | Specify the output directory path (default: `./VTK/`) | +| `-s, --separate-surfaces` | Create separate files for each sub-surface in geometry | +| `-f, --fields ...` | Specify which particle fields to convert (space-separated list). If not specified, all fields are converted | +| `-t, --time ` | Process only specific time folders. Accepts multiple formats:
- Space-separated list of times (e.g., `0.1 0.2 0.3`)
- Strided range with format `::` (e.g., `0.1:0.1:0.5`)
- Interval with format `:` (e.g., `0.1:0.5`) | +| `-h, --help` | Display help message with all available options | + +## Examples + +Convert all data with default settings: + +```bash +pFlowToVTK +``` + +Convert only geometry data: + +```bash +pFlowToVTK --no-particles +``` + +Convert only particle data in binary format: + +```bash +pFlowToVTK --no-geometry --binary +``` + +Convert specific fields for particles: + +```bash +pFlowToVTK -f velocity diameter contactForce +``` + +Convert data for specific time steps: + +```bash +pFlowToVTK -t 0.1 0.2 0.3 +``` + +Convert data for a range of time steps: + +```bash +pFlowToVTK -t 0.1:0.1:1.0 +``` + +Write output to a custom directory: + +```bash +pFlowToVTK -o /path/to/custom/output +``` + +## Output Structure + +The utility creates the following directory structure: +``` +simulationCase/ +├── 0/ # Contains the initial time step data +├── 0.1/ # time-folder for simulation data at 0.1 s +├── 0.2/ # time-folder for simulation data at 0.2 s +├── caseSetup/ # Contains the case setup files +├── settings/ # Contains the settings files +└── VTK/ + ├── geometry/ # Contains VTK files for geometry + │ └── surface-*.vtk # Geometry at different time steps + └── particles/ # Contains VTK files for particles + └── particles-*.vtk # Particle data at different time steps +``` + +Additionally, the utility generates `.vtk.series` files in the VTK root folder, which can be used by ParaView for loading time series data automatically: +``` +VTK/ +├── particles.vtk.series +└── surface.vtk.series # (and possibly other surface names if --separate-surfaces is used) +``` + +## Recommendations + +- Use binary format (`-b` flag) for large simulations to significantly improve conversion speed and reduce file size +- For complex geometries with multiple sub-surfaces, consider using `-s` flag to keep surfaces in separate files for better visualization +- When working with large datasets, use the `-t` option to convert only the time steps you need to visualize + +## See Also +## Related Utilities +- [`tutorials`](../../tutorials): Contains example cases and step-by-step guides for using phasicFlow +- [`particlesPhasicFlow`](../particlesPhasicFlow): Creates the initial fields for particles +- [`geometryPhasicFlow`](../geometryPhasicFlow): Creates the geometry +- [`postprocessPhasicFlow`](../postprocessPhasicFlow): Tool for performing various cell-based averaging on fields diff --git a/utilities/particlesPhasicFlow/README.md b/utilities/particlesPhasicFlow/README.md new file mode 100644 index 00000000..439377bc --- /dev/null +++ b/utilities/particlesPhasicFlow/README.md @@ -0,0 +1,369 @@ +# particlesPhasicFlow Utility + +## 1. Overview + +`particlesPhasicFlow` is a pre-processing utility for Discrete Element Method (DEM) simulations in phasicFlow. It is used to: + +1. Position particles in the simulation domain using different methods +2. Set initial field values (such as velocity, acceleration, shape) for particles +3. Apply field values to selected subsets of particles + +The utility reads its configuration from `settings/particlesDict` in your simulation case directory. + +## Table of Contents + +- [1. Overview](#1-overview) +- [2. Command Line Options](#2-command-line-options) +- [3. The particlesDict File Structure](#3-the-particlesdict-file-structure) + - [3.1. positionParticles Sub-dictionary](#31-positionparticles-sub-dictionary) + - [3.1.1. Positioning Methods](#311-positioning-methods) + - [3.1.2. Region Types](#312-region-types) + - [3.2. setFields Dictionary](#32-setfields-dictionary) + - [3.2.1. Selector Types](#321-selector-types) +- [4. Usage Examples](#4-usage-examples) + - [4.1. Example 1: Positioning Particles in an Ordered Pattern](#41-example-1-positioning-particles-in-an-ordered-pattern) + - [4.2. Example 2: Setting Field Values for a Binary Mixture of Particles](#42-example-2-setting-field-values-for-a-binary-mixture-of-particles) + - [4.3. Example 3: Empty Initial Particle System (for Insertion Later)](#43-example-3-empty-initial-particle-system-for-insertion-later) +- [5. Workflow Tips](#5-workflow-tips) +- [6. Common Field Types](#6-common-field-types) +- [7. Shape Handling](#7-shape-handling) +- [8. See Also](#8-see-also) + +## 2. Command Line Options + +The utility can be run with the following command line options: + +``` +particlesPhasicFlow [OPTIONS] +``` + +Where `[OPTIONS]` can include: + +- `--positionParticles-only`: Execute only the positioning part and store the created pointStructure. +- `--setFields-only`: Execute only the field setting part, reading an existing pointStructure file from the time folder. +- `-c, --coupling`: Specify if this is a fluid-particle coupling simulation. + +## 3. The particlesDict File Structure + +The `particlesDict` file consists of two main sections: + +1. `positionParticles`: Defines how particles are positioned in the domain. +2. `setFields`: Defines initial field values for particles and selective field assignments. + +### 3.1. positionParticles Sub-dictionary + +This section defines how particles are positioned in the simulation domain: + +```C++ +positionParticles +{ + method ; // Options: ordered, random, file, empty + + regionType ; // Options: box, cylinder, sphere, domain + + // Method-specific settings + Info + { + // Parameters for the selected method + } + + // Region-specific settings + Info + { + // Parameters for the selected region + } +} +``` + +#### 3.1.1. Positioning Methods + +1. **ordered**: Positions particles in an ordered pattern along specified axes + + ```C++ + orderedInfo + { + distance ; // Minimum space between centers of particles + numPoints ; // Number of particles to position + axisOrder ( ); // Order of axes for filling (x, y, z) + } + ``` + +2. **random**: Positions particles randomly in the specified region + + ```C++ + randomInfo + { + distance ; // Minimum distance between particle centers + numPoints ; // Number of particles to position + maxIterations ; // Maximum iterations for random positioning (default: 10) + } + ``` + +3. **file**: Reads particle positions from a file + + ```C++ + fileInfo + { + fileName ; // Path to file containing positions + commaSeparated Yes/No; // Whether file is comma-separated + } + ``` + +4. **empty**: Creates an empty pointStructure with no particles. No additional sub-dictionary is required. + +#### 3.1.2. Region Types + +1. **box**: Rectangular region + + ```C++ + boxInfo + { + min ( ); // Lower corner point coordinates + max ( ); // Upper corner point coordinates + } + ``` + +2. **cylinder**: Cylindrical region + + ```C++ + cylinderInfo + { + p1 ( ); // Begin point of cylinder axis + p2 ( ); // End point of cylinder axis + radius ; // Radius of cylinder + } + ``` + +3. **sphere**: Spherical region + + ```C++ + sphereInfo + { + center ( ); // Center of sphere + radius ; // Radius of sphere + } + ``` + +4. **domain**: Uses the global domain defined in the simulation (in file `settings/domainDict`) + + ```C++ + // No additional information needed when using domain + ``` + +### 3.2. setFields Dictionary + +This section defines the initial field values for particles and allows selective field assignments: + +```C++ +setFields +{ + defaultValue + { + // Default field values for all particles + velocity realx3 ( ); // Initial linear velocity (m/s) + acceleration realx3 ( ); // Initial linear acceleration (m/s²) + rVelocity realx3 ( ); // Initial rotational velocity (rad/s) + shapeName word ; // Particle shape name + // Additional fields as required + } + + selectors + { + + { + selector ; // Type of selector + + Info + { + // Parameters specific to the selector type + } + + fieldValue + { + // Field values to set for selected particles + ; + // Additional fields as required + } + } + // Additional selectors as required + } +} +``` + +#### 3.2.1. Selector Types + +1. **stridedRange**: Selects particles based on index ranges + + ```C++ + stridedRangeInfo + { + begin ; // Beginning index + end ; // Ending index + stride ; // Step size (default: 1) + } + ``` + +2. **box**: Selects particles within a box region + + ```C++ + boxInfo + { + min ( ); // Lower corner point coordinates + max ( ); // Upper corner point coordinates + } + ``` + +3. **cylinder**: Selects particles within a cylindrical region + + ```C++ + cylinderInfo + { + p1 ( ); // Begin point of cylinder axis + p2 ( ); // End point of cylinder axis + radius ; // Radius of cylinder + } + ``` + +4. **sphere**: Selects particles within a spherical region + + ```C++ + sphereInfo + { + center ( ); // Center of sphere + radius ; // Radius of sphere + } + ``` + +5. **randomPoints**: Selects a random subset of particles + + ```C++ + randomPointsInfo + { + begin ; // Beginning index + end ; // Ending index + number ; // Number of random points to select + } + ``` + +## 4. Usage Examples + +### 4.1. Example 1: Positioning Particles in an Ordered Pattern + +```C++ +positionParticles +{ + method ordered; + mortonSorting Yes; + + orderedInfo + { + distance 0.005; + numPoints 30000; + axisOrder (z x y); + } + + regionType cylinder; + + cylinderInfo + { + p1 (0.0 0.0 0.003); + p2 (0.0 0.0 0.097); + radius 0.117; + } +} +``` + +### 4.2. Example 2: Setting Field Values for a Binary Mixture of Particles + +```C++ +setFields +{ + defaultValue + { + velocity realx3 (0 0 0); + acceleration realx3 (0 0 0); + rVelocity realx3 (0 0 0); + shapeName word smallSphere; + } + + selectors + { + shapeAssigne + { + selector stridedRange; + + stridedRangeInfo + { + begin 0; + end 30000; + stride 3; + } + + fieldValue + { + shapeName word largeSphere; + } + } + } +} +``` + +### 4.3. Example 3: Empty Initial Particle System (for Insertion Later) + +```C++ +positionParticles +{ + method empty; +} +``` + +## 5. Workflow Tips + +1. To create particles at the beginning of a simulation: + + ``` + particlesPhasicFlow + ``` + +2. To only position particles without setting fields: + + ``` + particlesPhasicFlow --positionParticles-only + ``` + +3. To modify fields on existing particles (e.g., at a later time step): + + ``` + particlesPhasicFlow --setFields-only + ``` + +4. For fluid-particle coupling simulations: + + ``` + particlesPhasicFlow -c + ``` + +5. To change particle properties at a later time step in a simulation: + - Change `startTime` in the settings dictionary to the desired time + - Run `particlesPhasicFlow --setFields-only` + - Restart the simulation from that time step + +## 6. Common Field Types + +- `realx3`: 3D vector of real values, e.g., `(0 0 0)` +- `real`: Single real value +- `word`: Text string +- `uint32`: Unsigned 32-bit integer + +## 7. Shape Handling + +When using the `shapeName` field, ensure that the shapes are defined in the `shape` file in the `caseSetup` directory. The utility will automatically convert shape names to shape indices and hashes for the simulation. + +For any further assistance, please refer to the tutorial examples in the phasicFlow distribution. + +## 8. See Also + +- [Tutorials](../../tutorials) - Example cases demonstrating phasicFlow capabilities and more about particlesPhasicFlow +- [geometryPhasicFlow](../geometryPhasicFlow) - Utility for geometry creation and manipulation in phasicFlow +- [pFlowToVTK](../pFlowToVTK) - Utility for converting phasicFlow data to VTK format for visualization +- [postprocessPhasicFlow](../postprocessPhasicFlow) - Utility for post-processing simulation results \ No newline at end of file diff --git a/utilities/particlesPhasicFlow/empty/empty.hpp b/utilities/particlesPhasicFlow/empty/empty.hpp index 9b296893..4b8bdeac 100755 --- a/utilities/particlesPhasicFlow/empty/empty.hpp +++ b/utilities/particlesPhasicFlow/empty/empty.hpp @@ -64,7 +64,7 @@ public: return 0; } - real maxDiameter() const final + real distance() const final { return 1.0; } diff --git a/utilities/particlesPhasicFlow/positionFile/positionFile.hpp b/utilities/particlesPhasicFlow/positionFile/positionFile.hpp index e2df0841..aa46a456 100755 --- a/utilities/particlesPhasicFlow/positionFile/positionFile.hpp +++ b/utilities/particlesPhasicFlow/positionFile/positionFile.hpp @@ -74,9 +74,9 @@ public: return static_cast(position_.size()); } - real maxDiameter() const final + real distance() const final { - return 0; + return 1.0; } // bool commaSeparated()const diff --git a/utilities/particlesPhasicFlow/positionOrdered/positionOrdered.cpp b/utilities/particlesPhasicFlow/positionOrdered/positionOrdered.cpp index eb1c94d4..b655a8c5 100755 --- a/utilities/particlesPhasicFlow/positionOrdered/positionOrdered.cpp +++ b/utilities/particlesPhasicFlow/positionOrdered/positionOrdered.cpp @@ -79,7 +79,7 @@ bool pFlow::positionOrdered::positionPointsOrdered() { position_.clear(); - realx3 dl(diameter_); + realx3 dl(distance_); const auto& region = pRegion(); auto minP = region.minPoint(); auto maxP = region.maxPoint(); @@ -131,9 +131,9 @@ pFlow::positionOrdered::positionOrdered ( dict.subDict("orderedInfo") ), - diameter_ + distance_ ( - poDict_.getVal("diameter") + poDict_.getVal("distance") ), numPoints_ ( diff --git a/utilities/particlesPhasicFlow/positionOrdered/positionOrdered.hpp b/utilities/particlesPhasicFlow/positionOrdered/positionOrdered.hpp index caf711dd..744554c8 100755 --- a/utilities/particlesPhasicFlow/positionOrdered/positionOrdered.hpp +++ b/utilities/particlesPhasicFlow/positionOrdered/positionOrdered.hpp @@ -35,7 +35,8 @@ private: dictionary poDict_; - real diameter_; + /// Minimum distance between centers of particles + real distance_; uint32 numPoints_; @@ -86,9 +87,10 @@ public: return static_cast(position_.size()); } - real maxDiameter() const final + /// Minimum distance between centers of particles + real distance() const final { - return diameter_; + return distance_; } // - const access to position diff --git a/utilities/particlesPhasicFlow/positionParticles/positionParticles.hpp b/utilities/particlesPhasicFlow/positionParticles/positionParticles.hpp index 749ba7c3..e62ef575 100755 --- a/utilities/particlesPhasicFlow/positionParticles/positionParticles.hpp +++ b/utilities/particlesPhasicFlow/positionParticles/positionParticles.hpp @@ -83,7 +83,8 @@ public: virtual uint32 size()const = 0; - virtual real maxDiameter() const = 0; + /// Minimum distance between centers of particles + virtual real distance() const = 0; // - const access to position virtual const realx3Vector& position()const = 0; diff --git a/utilities/particlesPhasicFlow/positionRandom/positionRandom.cpp b/utilities/particlesPhasicFlow/positionRandom/positionRandom.cpp index d67f9df4..9717cf66 100755 --- a/utilities/particlesPhasicFlow/positionRandom/positionRandom.cpp +++ b/utilities/particlesPhasicFlow/positionRandom/positionRandom.cpp @@ -35,10 +35,10 @@ bool pFlow::positionRandom::positionOnePass(collisionCheck& collCheck) { realx3 p = region.peek(); - if( collCheck.checkPoint(p, diameter_) ) + if( collCheck.checkPoint(p, distance_) ) { position_.push_back(p); - diameters_.push_back(diameter_); + diameters_.push_back(distance_); if(!collCheck.mapLastAddedParticle()) { @@ -64,7 +64,7 @@ bool pFlow::positionRandom::positionPointsRandom() uint32 pass = 0; collisionCheck collCheck( box(pRegion().minPoint(), pRegion().maxPoint()), - diameter_, + distance_, position_, diameters_); @@ -107,9 +107,9 @@ pFlow::positionRandom::positionRandom ( dict.subDict("randomInfo") ), - diameter_ + distance_ ( - prDict_.getVal("diameter") + prDict_.getVal("distance") ), numPoints_ ( diff --git a/utilities/particlesPhasicFlow/positionRandom/positionRandom.hpp b/utilities/particlesPhasicFlow/positionRandom/positionRandom.hpp index 6faa81d9..e676c476 100755 --- a/utilities/particlesPhasicFlow/positionRandom/positionRandom.hpp +++ b/utilities/particlesPhasicFlow/positionRandom/positionRandom.hpp @@ -32,23 +32,25 @@ class positionRandom : public positionParticles { private: - dictionary prDict_; + dictionary prDict_; - real diameter_; + real distance_; - uint32 numPoints_; + uint32 numPoints_; - uint32 maxIterations_; + uint32 maxIterations_; + + uint32 reportInterval_ = 100; realx3Vector position_; + // still keeping this variable name as diameters_ since it stores + // the collection of distance values realVector diameters_; - uint32 reportInterval_; + bool positionOnePass(collisionCheck& collCheck); - bool positionOnePass(collisionCheck& collCheck); - - bool positionPointsRandom(); + bool positionPointsRandom(); public: @@ -79,9 +81,9 @@ public: return position_.size(); } - real maxDiameter() const override + real distance() const override { - return diameter_; + return distance_; } // - const access to position diff --git a/utilities/postprocessPhasicFlow/postSimulationFieldsDataBase/postSimulationFieldsDataBase.cpp b/utilities/postprocessPhasicFlow/postSimulationFieldsDataBase/postSimulationFieldsDataBase.cpp index 97bd8d4d..624a3444 100644 --- a/utilities/postprocessPhasicFlow/postSimulationFieldsDataBase/postSimulationFieldsDataBase.cpp +++ b/utilities/postprocessPhasicFlow/postSimulationFieldsDataBase/postSimulationFieldsDataBase.cpp @@ -1,26 +1,19 @@ #include "postSimulationFieldsDataBase.hpp" #include "vocabs.hpp" -namespace pFlow +namespace pFlow::postprocessData { -bool pointFieldGetType -( - const word& objectType, - word& fieldType, - word& fieldSpace -); -} -bool pFlow::postSimulationFieldsDataBase::pointFieldNameExists(const word& name) const +bool postSimulationFieldsDataBase::pointFieldNameExists(const word& name) const { if(currentFileFields_.contains(name)) return true; if(time().lookupObjectName(name)) return true; return false; } -bool pFlow::postSimulationFieldsDataBase::loadPointFieldToTime(const word &name) +bool postSimulationFieldsDataBase::loadPointFieldToTime(const word &name) { if(time().lookupObjectName(name)) return true; if(auto [iter, success]=currentFileFields_.findIf(name); success) @@ -116,7 +109,7 @@ bool pFlow::postSimulationFieldsDataBase::loadPointFieldToTime(const word &name) return true; } -bool pFlow::postSimulationFieldsDataBase::loadPointStructureToTime() +bool postSimulationFieldsDataBase::loadPointStructureToTime() { if(!pStructPtr_) { @@ -126,7 +119,7 @@ bool pFlow::postSimulationFieldsDataBase::loadPointStructureToTime() return true; } -const pFlow::shape &pFlow::postSimulationFieldsDataBase::getShape() const +const shape &postSimulationFieldsDataBase::getShape() const { if(!shapePtr_) { @@ -143,7 +136,7 @@ const pFlow::shape &pFlow::postSimulationFieldsDataBase::getShape() const return shapePtr_(); } -pFlow::word pFlow::postSimulationFieldsDataBase::getPointFieldType(const word &name) const +word postSimulationFieldsDataBase::getPointFieldType(const word &name) const { if(auto [iter, success]=currentFileFields_.findIf(name); success) { @@ -159,7 +152,7 @@ pFlow::word pFlow::postSimulationFieldsDataBase::getPointFieldType(const word &n return ""; } -bool pFlow::postSimulationFieldsDataBase::setToCurrentFolder() +bool postSimulationFieldsDataBase::setToCurrentFolder() { allPointFields_.clear(); pStructPtr_.reset(nullptr); @@ -184,7 +177,7 @@ bool pFlow::postSimulationFieldsDataBase::setToCurrentFolder() word type, space; for(auto& [name, objectType]: files) { - if(pointFieldGetType(objectType, type, space)) + if(fieldsDataBase::pointFieldGetType(objectType, type, space)) { if(name == pointStructureFile__) continue; currentFileFields_.insertIf(name, type); @@ -194,7 +187,7 @@ bool pFlow::postSimulationFieldsDataBase::setToCurrentFolder() return true; } -pFlow::postSimulationFieldsDataBase::postSimulationFieldsDataBase +postSimulationFieldsDataBase::postSimulationFieldsDataBase ( systemControl &control, const dictionary& postDict, @@ -233,17 +226,17 @@ pFlow::postSimulationFieldsDataBase::postSimulationFieldsDataBase } } -const pFlow::pointStructure& pFlow::postSimulationFieldsDataBase::pStruct()const +const pointStructure& postSimulationFieldsDataBase::pStruct()const { return pStructPtr_(); } -pFlow::timeValue pFlow::postSimulationFieldsDataBase::getNextTimeFolder() const +timeValue postSimulationFieldsDataBase::getNextTimeFolder() const { return allValidFolders_.nextTime(); } -pFlow::timeValue pFlow::postSimulationFieldsDataBase::setToNextTimeFolder() +timeValue postSimulationFieldsDataBase::setToNextTimeFolder() { timeValue nextTime = allValidFolders_.nextTime(); if(nextTime < 0.0) return nextTime; @@ -261,7 +254,7 @@ pFlow::timeValue pFlow::postSimulationFieldsDataBase::setToNextTimeFolder() return nextTime; } -pFlow::timeValue pFlow::postSimulationFieldsDataBase::skipNextTimeFolder() +timeValue postSimulationFieldsDataBase::skipNextTimeFolder() { timeValue nextTime = allValidFolders_.nextTime(); if(nextTime < 0.0) return nextTime; @@ -269,3 +262,5 @@ pFlow::timeValue pFlow::postSimulationFieldsDataBase::skipNextTimeFolder() allValidFolders_++; return nextTime; } + +} // namespace pFlow::postprocessData \ No newline at end of file diff --git a/utilities/postprocessPhasicFlow/postSimulationFieldsDataBase/postSimulationFieldsDataBase.hpp b/utilities/postprocessPhasicFlow/postSimulationFieldsDataBase/postSimulationFieldsDataBase.hpp index ee24a691..e0afd59c 100644 --- a/utilities/postprocessPhasicFlow/postSimulationFieldsDataBase/postSimulationFieldsDataBase.hpp +++ b/utilities/postprocessPhasicFlow/postSimulationFieldsDataBase/postSimulationFieldsDataBase.hpp @@ -27,12 +27,12 @@ Licence: #include "ListPtr.hpp" #include "property.hpp" -namespace pFlow +namespace pFlow::postprocessData { class postSimulationFieldsDataBase : - public fieldsDataBase + public postprocessData::fieldsDataBase { systemControl& control_; diff --git a/utilities/postprocessPhasicFlow/postprocessPhasicFlow.cpp b/utilities/postprocessPhasicFlow/postprocessPhasicFlow.cpp index 792876f2..aeaace52 100644 --- a/utilities/postprocessPhasicFlow/postprocessPhasicFlow.cpp +++ b/utilities/postprocessPhasicFlow/postprocessPhasicFlow.cpp @@ -30,7 +30,7 @@ Licence: int main(int argc, char** argv ) { - pFlow::word outFolder = (pFlow::CWD()/pFlow::postProcessGlobals::defaultRelDir__).wordPath(); + pFlow::word outFolder = (pFlow::CWD()/pFlow::postprocessData::defaultRelDir__).wordPath(); pFlow::commandLine cmds( "postprocessPhasicFlow", @@ -40,7 +40,7 @@ int main(int argc, char** argv ) pFlow::wordVector times; pFlow::word description = "path to output folder of postprocess data: ./" - + pFlow::postProcessGlobals::defaultRelDir__; + + pFlow::postprocessData::defaultRelDir__; cmds.addOption("-o,--out-folder", outFolder, @@ -50,7 +50,7 @@ int main(int argc, char** argv ) cmds.addOption( "-t,--time", times.vectorField(), - "a SPACE separated lits of time folders, " + "a SPACE separated list of time folders, " "or a strided range ::, or an interval :", " "); @@ -99,7 +99,7 @@ int main(int argc, char** argv ) fatalExit; } - pFlow::postprocessData postprocess(Control, nextTime); + pFlow::postprocessData::postprocessData postprocess(Control, nextTime); postprocess.setOutputDirectory(pFlow::fileSystem(outFolder+"/").absolute()); bool folderSkipped = false; diff --git a/utilities/postprocessPhasicFlow/readme.md b/utilities/postprocessPhasicFlow/readme.md new file mode 100644 index 00000000..04e1a7a1 --- /dev/null +++ b/utilities/postprocessPhasicFlow/readme.md @@ -0,0 +1,234 @@ +# postprocessPhasicFlow Utility + +This is a documentation for the `postprocessPhasicFlow` utility. This utility is designed to perform post-simulation processing on completed simulation data. + +## Table of Contents + +- [1. Overview](#1-overview) +- [2. When to Use postprocessPhasicFlow](#2-when-to-use-postprocessphasicflow) +- [3. Basic Usage](#3-basic-usage) +- [4. Command Line Options](#4-command-line-options) + - [4.1. Available Options](#41-available-options) + - [4.2. Examples](#42-examples) +- [5. Configuration](#5-configuration) + - [5.1. Important Configuration Parameters for Post-Simulation Processing](#51-important-configuration-parameters-for-post-simulation-processing) +- [6. Difference Between In-Simulation and Post-Simulation Processing](#6-difference-between-in-simulation-and-post-simulation-processing) +- [7. File Structure](#7-file-structure) +- [8. Advanced Features](#8-advanced-features) +- [9. Example Configuration](#9-example-configuration) +- [10. Troubleshooting](#10-troubleshooting) +- [11. See Also](#11-see-also) + +## 1. Overview + +`postprocessPhasicFlow` is a utility for performing postprocessing analysis on completed simulation data. It allows you to extract statistical information, track specific particles, and analyze regional particle behavior without needing to re-run your simulations. This utility leverages the functionality provided by phasicFlow's `PostprocessData` module to analyze data stored in time folders. + +## 2. When to Use postprocessPhasicFlow + +You should use this utility when: + +1. Your simulation has completed and you want to analyze the results +2. You want to try different postprocessing configurations on the same simulation data +3. You need to extract additional information that wasn't included in real-time processing +4. You want to focus on specific time periods or regions of your simulation domain + +## 3. Basic Usage + +To use the `postprocessPhasicFlow` utility, navigate to your simulation case directory and run: + +```bash +postprocessPhasicFlow +``` + +This will read the `postprocessDataDict` file from your case's `settings` directory and perform the configured postprocessing operations on all available time folders. + +## 4. Command Line Options + +The `postprocessPhasicFlow` utility supports several command line options that allow you to customize its behavior: + +```bash +postprocessPhasicFlow [OPTIONS] +``` + +### 4.1. Available Options + +| Option | Description | +|--------|-------------| +| `-o, --out-folder ` | Specify the output directory path where postprocessing results will be written. Default is `./postprocessData/` | +| `-t, --time ` | Process only specific time folders. Accepts multiple formats:
- Space-separated list of times (e.g., `0.1 0.2 0.3`)
- Strided range with format `::` (e.g., `0.1:0.1:0.5`)
- Interval with format `:` (e.g., `0.1:0.5`) | +| `-z, --zeroFolder` | Include the zero folder (initial state) in the processing. By default, the zero folder is not processed. | +| `-h, --help` | Display help message with all available options | + +### 4.2. Examples + +Process all available time folders (except zero folder): + +```bash +postprocessPhasicFlow +``` + +Process only specific time steps: + +```bash +postprocessPhasicFlow -t 0.1 0.2 0.5 +``` + +Process a range of time steps from 0.1 to 1.0 with 0.1 increments: + +```bash +postprocessPhasicFlow -t 0.1:0.1:1.0 +``` + +Process all time steps including the initial state (zero folder): + +```bash +postprocessPhasicFlow -z +``` + +Write output to a custom directory: + +```bash +postprocessPhasicFlow -o /path/to/custom/output +``` + + +## 5. Configuration + +The `postprocessPhasicFlow` utility is configured through the same `postprocessDataDict` file used for in-simulation postprocessing. This file should be placed in the `settings` directory of your case. + +### 5.1. Important Configuration Parameters for Post-Simulation Processing + +When using `postprocessPhasicFlow` for post-simulation processing, pay special attention to these settings: + +```cpp +// For post-simulation, runTimeActive should be set to "no" +// This indicates that you're doing post-simulation processing +runTimeActive no; + +// Specify the correct shape type used in your simulation +// This is essential for post-simulation processing +shapeType sphere; // Options: sphere, grain, etc. +``` + +The `shapeType` parameter is particularly crucial for post-simulation processing as it tells the utility what kind of particles were used in the simulation, allowing it to correctly interpret the stored data. + +## 6. Difference Between In-Simulation and Post-Simulation Processing + +| Feature | In-Simulation Processing | Post-Simulation Processing with postprocessPhasicFlow | +|---------|--------------------------|--------------------------------------------------------| +| When it runs | During simulation execution | After simulation is complete | +| How to activate | Set `runTimeActive yes` in postprocessDataDict, set `auxFunctions postprocessData` in settingsDict and add library | Run the `postprocessPhasicFlow` utility | +| Data access | Direct access to simulation data in memory | Reads data from time folders | +| Performance impact | May slow down simulation | No impact on simulation performance | +| Iterations | Can only run once per simulation step | Can be run multiple times with different settings | + +## 7. File Structure + +The results of the postprocessing will be written to files in your case directory (by default, under `postprocessData` folder), with timestamps and naming that matches your configured components and operations. These files can then be used for further analysis or visualization. + +## 8. Advanced Features + +`postprocessPhasicFlow` supports all the features of the PostprocessData module, including: + +- Different processing methods (arithmetic, uniformDistribution, GaussianDistribution) +- Various region types (sphere, multipleSpheres, line, centerPoints) +- Multiple operation types (average, sum, avMassVelocity) +- Special field functions (component, abs, square, magnitude, etc.) +- Particle filtering with includeMask + +but it disables/ignores the effect of all `timeControl` settings in postprocess components. + +For detailed information about these features, refer to the [PostprocessData module documentation](../../src/PostprocessData/readme.md). + +## 9. Example Configuration + +Here's a simple example of a `postprocessDataDict` file configured for post-simulation processing: + +```cpp +/* -------------------------------*- C++ -*--------------------------------- *\ +| phasicFlow File | +| copyright: www.cemf.ir | +\* ------------------------------------------------------------------------- */ +objectName postprocessDataDict; +objectType dictionary;; +fileFormat ASCII; +/*---------------------------------------------------------------------------*/ + +// Set to "no" for post-simulation processing +runTimeActive no; + +// Required for post-simulation processing - specify the shape type used in the simulation +shapeType sphere; + +// Default time control settings +defaultTimeControl +{ + timeControl timeStep; + startTime 0; + endTime 1000; + executionInterval 20; +} + +// List of postprocessing components +components +( + // Track specific particles by ID + particleTracker + { + processMethod particleProbe; + processRegion centerPoints; + selector id; + field velocity; + ids (10 42 87); + timeControl default; + } + + // Analyze particle behavior in a spherical region + centerRegionAnalysis + { + processMethod arithmetic; + processRegion sphere; + + sphereInfo + { + radius 0.05; + center (0 0 0.1); + } + + timeControl default; + + operations + ( + velocityMagnitude + { + function average; + field mag(velocity); + threshold 5; + divideByVolume no; + fluctuation2 yes; + } + + particleDensity + { + function sum; + field mass; + divideByVolume yes; + } + ); + } +); +``` + +## 10. Troubleshooting + +If you encounter issues with the `postprocessPhasicFlow` utility, check the following: + +1. Make sure your `postprocessDataDict` file specifies the correct `shapeType` +2. Verify that the time folders contain all the required field data +3. Check that field names referenced in your configuration exist in the simulation data +4. Ensure that the simulation case structure is intact and not modified + +## 11. See Also + +- [PostprocessData module documentation](../../src/PostprocessData/readme.md) +- [phasicFlow simulation tutorials](../../tutorials/) \ No newline at end of file