Merge pull request #210 from PhasicFlow/postProcessing

Post processing readme.md
This commit is contained in:
PhasicFlow 2025-04-24 23:32:46 +03:30 committed by GitHub
commit 8c543e1649
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
50 changed files with 727 additions and 349 deletions

View File

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

View File

@ -26,20 +26,24 @@ Licence:
#include "fieldFunctions.hpp" #include "fieldFunctions.hpp"
#include "dictionary.hpp" #include "dictionary.hpp"
namespace pFlow namespace pFlow::postprocessData
{ {
bool pointFieldGetType(const word& TYPENAME, word& fieldType, word& fieldSpace); bool pointFieldGetType(const word& TYPENAME, word& fieldType, word& fieldSpace);
} }
bool pFlow::fieldsDataBase::loadPointStructureToTime() bool pFlow::postprocessData::fieldsDataBase::loadPointStructureToTime()
{ {
return false; return false;
} }
bool pFlow::fieldsDataBase::checkForUpdate(const word &compoundName, bool forceUpdate) bool pFlow::postprocessData::fieldsDataBase::checkForUpdate
(
const word &compoundName,
bool forceUpdate
)
{ {
auto t = currentTime(); auto t = currentTime();
bool shouldUpdate = false; bool shouldUpdate = false;
@ -58,7 +62,10 @@ bool pFlow::fieldsDataBase::checkForUpdate(const word &compoundName, bool forceU
return shouldUpdate; return shouldUpdate;
} }
pFlow::span<pFlow::real> pFlow::fieldsDataBase::createOrGetRealField(const word &name) pFlow::span<pFlow::real> pFlow::postprocessData::fieldsDataBase::createOrGetRealField
(
const word &name
)
{ {
bool shouldUpdate = checkForUpdate(name); bool shouldUpdate = checkForUpdate(name);
@ -83,7 +90,10 @@ pFlow::span<pFlow::real> pFlow::fieldsDataBase::createOrGetRealField(const word
field.size()); field.size());
} }
pFlow::span<pFlow::real> pFlow::fieldsDataBase::createOrGetVolume(bool forceUpdate) pFlow::span<pFlow::real> pFlow::postprocessData::fieldsDataBase::createOrGetVolume
(
bool forceUpdate
)
{ {
const word fName = "volume"; const word fName = "volume";
bool shouldUpdate = checkForUpdate(fName, forceUpdate); bool shouldUpdate = checkForUpdate(fName, forceUpdate);
@ -119,7 +129,7 @@ pFlow::span<pFlow::real> pFlow::fieldsDataBase::createOrGetVolume(bool forceUpda
} }
pFlow::span<pFlow::real> pFlow::fieldsDataBase::createOrGetDensity(bool forceUpdate) pFlow::span<pFlow::real> pFlow::postprocessData::fieldsDataBase::createOrGetDensity(bool forceUpdate)
{ {
const word fName = "density"; const word fName = "density";
@ -155,7 +165,7 @@ pFlow::span<pFlow::real> pFlow::fieldsDataBase::createOrGetDensity(bool forceUpd
field.size()); field.size());
} }
pFlow::span<pFlow::real> pFlow::fieldsDataBase::createOrGetOne(bool forceUpdate) pFlow::span<pFlow::real> pFlow::postprocessData::fieldsDataBase::createOrGetOne(bool forceUpdate)
{ {
const word fName = "one"; const word fName = "one";
@ -182,7 +192,7 @@ pFlow::span<pFlow::real> pFlow::fieldsDataBase::createOrGetOne(bool forceUpdate)
field.size()); field.size());
} }
pFlow::span<pFlow::real> pFlow::fieldsDataBase::createOrGetMass(bool forceUpdate) pFlow::span<pFlow::real> pFlow::postprocessData::fieldsDataBase::createOrGetMass(bool forceUpdate)
{ {
const word fName = "mass"; const word fName = "mass";
@ -218,7 +228,7 @@ pFlow::span<pFlow::real> pFlow::fieldsDataBase::createOrGetMass(bool forceUpdate
field.size()); field.size());
} }
pFlow::span<pFlow::real> pFlow::fieldsDataBase::createOrGetI(bool forceUpdate) pFlow::span<pFlow::real> pFlow::postprocessData::fieldsDataBase::createOrGetI(bool forceUpdate)
{ {
const word fName = "I"; const word fName = "I";
@ -254,7 +264,7 @@ pFlow::span<pFlow::real> pFlow::fieldsDataBase::createOrGetI(bool forceUpdate)
field.size()); field.size());
} }
bool pFlow::fieldsDataBase::findFunction( bool pFlow::postprocessData::fieldsDataBase::findFunction(
const word &compoundFieldName, const word &compoundFieldName,
word &fieldName, word &fieldName,
fieldsDataBase::Functions &func) fieldsDataBase::Functions &func)
@ -360,7 +370,7 @@ bool pFlow::fieldsDataBase::findFunction(
return false; // No match return false; // No match
} }
bool pFlow::fieldsDataBase::inputOutputType bool pFlow::postprocessData::fieldsDataBase::inputOutputType
( (
fieldsDataBase::Functions func, fieldsDataBase::Functions func,
const word &inputType, const word &inputType,
@ -458,7 +468,7 @@ bool pFlow::fieldsDataBase::inputOutputType
return false; return false;
} }
pFlow::fieldsDataBase::fieldsDataBase pFlow::postprocessData::fieldsDataBase::fieldsDataBase
( (
systemControl& control, systemControl& control,
const dictionary& postDict, const dictionary& postDict,
@ -488,12 +498,12 @@ pFlow::fieldsDataBase::fieldsDataBase
} }
} }
pFlow::timeValue pFlow::fieldsDataBase::currentTime() const pFlow::timeValue pFlow::postprocessData::fieldsDataBase::currentTime() const
{ {
return time_.currentTime(); return time_.currentTime();
} }
bool pFlow::fieldsDataBase::getFieldTypeNameFunction bool pFlow::postprocessData::fieldsDataBase::getFieldTypeNameFunction
( (
const word& compoundName, const word& compoundName,
word& pointFieldName, word& pointFieldName,
@ -543,7 +553,7 @@ bool pFlow::fieldsDataBase::getFieldTypeNameFunction
return true; return true;
} }
bool pFlow::fieldsDataBase::getFieldType bool pFlow::postprocessData::fieldsDataBase::getFieldType
( (
const word& compoundName, const word& compoundName,
word& originalType, word& originalType,
@ -559,7 +569,7 @@ bool pFlow::fieldsDataBase::getFieldType
return true; return true;
} }
bool pFlow::fieldsDataBase::getFieldType bool pFlow::postprocessData::fieldsDataBase::getFieldType
( (
const word &compoundName, const word &compoundName,
word &typeAfterFunction word &typeAfterFunction
@ -575,7 +585,7 @@ bool pFlow::fieldsDataBase::getFieldType
return true; return true;
} }
pFlow::span<pFlow::realx3> pFlow::fieldsDataBase::updatePoints(bool forceUpdate) pFlow::span<pFlow::realx3> pFlow::postprocessData::fieldsDataBase::updatePoints(bool forceUpdate)
{ {
const word fName = "position"; const word fName = "position";
bool shouldUpdate = checkForUpdate(fName, forceUpdate); bool shouldUpdate = checkForUpdate(fName, forceUpdate);
@ -604,7 +614,7 @@ pFlow::span<pFlow::realx3> pFlow::fieldsDataBase::updatePoints(bool forceUpdate)
} }
pFlow::span<pFlow::realx3> pFlow::fieldsDataBase::updateFieldRealx3 pFlow::span<pFlow::realx3> pFlow::postprocessData::fieldsDataBase::updateFieldRealx3
( (
const word &compoundName, const word &compoundName,
bool forceUpdate bool forceUpdate
@ -640,7 +650,7 @@ pFlow::span<pFlow::realx3> pFlow::fieldsDataBase::updateFieldRealx3
} }
pFlow::span<pFlow::realx4> pFlow::fieldsDataBase::updateFieldRealx4 pFlow::span<pFlow::realx4> pFlow::postprocessData::fieldsDataBase::updateFieldRealx4
( (
const word &compoundName, const word &compoundName,
bool forceUpdate bool forceUpdate
@ -676,7 +686,7 @@ pFlow::span<pFlow::realx4> pFlow::fieldsDataBase::updateFieldRealx4
} }
pFlow::span<pFlow::real> pFlow::fieldsDataBase::updateFieldReal pFlow::span<pFlow::real> pFlow::postprocessData::fieldsDataBase::updateFieldReal
( (
const word &compoundName, const word &compoundName,
bool forceUpdate bool forceUpdate
@ -843,7 +853,7 @@ pFlow::span<pFlow::real> pFlow::fieldsDataBase::updateFieldReal
return span<real>(nullptr, 0); return span<real>(nullptr, 0);
} }
pFlow::span<pFlow::uint32> pFlow::fieldsDataBase::updateFieldUint32 pFlow::span<pFlow::uint32> pFlow::postprocessData::fieldsDataBase::updateFieldUint32
( (
const word& name, const word& name,
bool forceUpdate bool forceUpdate
@ -852,7 +862,7 @@ pFlow::span<pFlow::uint32> pFlow::fieldsDataBase::updateFieldUint32
return updateField<uint32>(name, forceUpdate); return updateField<uint32>(name, forceUpdate);
} }
pFlow::allPointFieldTypes pFlow::fieldsDataBase::updateFieldAll pFlow::postprocessData::allPointFieldTypes pFlow::postprocessData::fieldsDataBase::updateFieldAll
( (
const word &compoundName, const word &compoundName,
bool forceUpdate bool forceUpdate
@ -890,8 +900,8 @@ pFlow::allPointFieldTypes pFlow::fieldsDataBase::updateFieldAll
pFlow::uniquePtr<pFlow::fieldsDataBase> pFlow::uniquePtr<pFlow::postprocessData::fieldsDataBase>
pFlow::fieldsDataBase::create pFlow::postprocessData::fieldsDataBase::create
( (
systemControl& control, systemControl& control,
const dictionary& postDict, const dictionary& postDict,
@ -931,7 +941,12 @@ pFlow::uniquePtr<pFlow::fieldsDataBase>
return nullptr; return nullptr;
} }
bool pFlow::pointFieldGetType(const word& TYPENAME, word& fieldType, word& fieldSpace) bool pFlow::postprocessData::pointFieldGetType
(
const word& TYPENAME,
word& fieldType,
word& fieldSpace
)
{ {
std::regex match("pointField\\<([A-Za-z1-9_]*)\\,([A-Za-z1-9_]*)\\>"); std::regex match("pointField\\<([A-Za-z1-9_]*)\\,([A-Za-z1-9_]*)\\>");
std::smatch search; std::smatch search;

View File

@ -29,13 +29,15 @@ Licence:
#include "Map.hpp" #include "Map.hpp"
#include "shape.hpp" #include "shape.hpp"
namespace pFlow namespace pFlow
{ {
class dictionary;
class systemControl;
class Time;
}
class dictionary; namespace pFlow::postprocessData
class systemControl; {
class Time;
class fieldsDataBase class fieldsDataBase
@ -311,7 +313,7 @@ public:
timeValue startTime); timeValue startTime);
}; };
} // namespace pFlow } // namespace pFlow::postprocessData
#include "fieldsDataBaseTemplates.cpp" #include "fieldsDataBaseTemplates.cpp"

View File

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

View File

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

View File

@ -8,29 +8,32 @@ namespace pFlow
bool pointFieldGetType(const word& TYPENAME, word& fieldType, word& fieldSpace); bool pointFieldGetType(const word& TYPENAME, word& fieldType, word& fieldSpace);
} }
bool pFlow::simulationFieldsDataBase::pointFieldNameExists(const word &name) const bool pFlow::postprocessData::simulationFieldsDataBase::pointFieldNameExists(const word &name) const
{ {
return time().lookupObjectName(name); return time().lookupObjectName(name);
} }
bool pFlow::simulationFieldsDataBase::loadPointFieldToTime(const word &name) bool pFlow::postprocessData::simulationFieldsDataBase::loadPointFieldToTime(const word &name)
{ {
return time().lookupObjectName(name); return time().lookupObjectName(name);
} }
bool pFlow::simulationFieldsDataBase::loadPointStructureToTime() bool pFlow::postprocessData::simulationFieldsDataBase::loadPointStructureToTime()
{ {
// it is already in the Time object // it is already in the Time object
return time().lookupObjectName(pointStructureFile__); return time().lookupObjectName(pointStructureFile__);
} }
const pFlow::shape& pFlow::simulationFieldsDataBase::getShape() const const pFlow::shape& pFlow::postprocessData::simulationFieldsDataBase::getShape() const
{ {
return shape_; return shape_;
} }
pFlow::word pFlow::simulationFieldsDataBase::getPointFieldType(const word &name) const pFlow::word pFlow::postprocessData::simulationFieldsDataBase::getPointFieldType
(
const word &name
) const
{ {
word pfType = time().lookupObjectTypeName(name); word pfType = time().lookupObjectTypeName(name);
word type, space; word type, space;
@ -44,7 +47,7 @@ pFlow::word pFlow::simulationFieldsDataBase::getPointFieldType(const word &name)
return type; return type;
} }
pFlow::simulationFieldsDataBase::simulationFieldsDataBase pFlow::postprocessData::simulationFieldsDataBase::simulationFieldsDataBase
( (
systemControl &control, systemControl &control,
const dictionary& postDict, const dictionary& postDict,
@ -60,7 +63,7 @@ pFlow::simulationFieldsDataBase::simulationFieldsDataBase
{ {
} }
const pFlow::pointStructure &pFlow::simulationFieldsDataBase::pStruct() const const pFlow::pointStructure &pFlow::postprocessData::simulationFieldsDataBase::pStruct() const
{ {
return return
static_cast<const pointStructure&> static_cast<const pointStructure&>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,100 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __postprocessOperationFunctions_hpp__
#define __postprocessOperationFunctions_hpp__
#include <variant>
#include "types.hpp"
#include "iOstream.hpp"
#include "regionField.hpp"
namespace pFlow::postprocessData
{
/// Type alias for processed region field types.
/// Only regionField<real>, regionField<realx3>, and regionField<realx4> are supported
/// in the postprocessOperation class.
using processedRegFieldType = std::variant
<
regionField<real>,
regionField<realx3>,
regionField<realx4>
>;
template<typename T>
inline
bool writeField
(
iOstream& os,
timeValue t,
const regionField<T> field,
uint32 threshold,
const T& defValue=T{}
)
{
const auto& regPoints = field.regPoints();
const uint32 n = field.size();
os<<t<<tab;
for(uint32 i=0; i<n; i++)
{
auto numPar = regPoints.indices(i).size();
if(numPar >= threshold)
{
if constexpr(std::is_same_v<T,realx3>)
{
os<<field[i].x()<<' '<<field[i].y()<<' '<<field[i].z()<<tab;
}
else if constexpr( std::is_same_v<T,realx4>)
{
os << field[i].x() << ' ' << field[i].y() << ' ' << field[i].z() << ' ' << field[i].w() << tab;
}
else
{
os<<field[i]<<tab;
}
}
else
{
if constexpr(std::is_same_v<T,realx3>)
{
os<<defValue.x()<<' '<<defValue.y()<<' '<<defValue.z()<<tab;
}
else if constexpr( std::is_same_v<T,realx4>)
{
os << defValue.x() << ' ' << defValue.y() << ' ' << defValue.z() << ' ' << defValue.w() << tab;
}
else
{
os<<defValue<<tab;
}
}
}
os<<endl;
return true;
}
} // namespace pFlow::postprocessData
#endif //__postprocessOperationFunctions_hpp__

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,27 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#include "particleProbePostprocessComponent.hpp" #include "particleProbePostprocessComponent.hpp"
#include "Time.hpp" #include "Time.hpp"
namespace pFlow namespace pFlow::postprocessData
{ {
template<typename T> template<typename T>
@ -62,7 +82,7 @@ inline bool writeField
} }
pFlow::particleProbePostprocessComponent::particleProbePostprocessComponent pFlow::postprocessData::particleProbePostprocessComponent::particleProbePostprocessComponent
( (
const dictionary &dict, const dictionary &dict,
fieldsDataBase &fieldsDB, fieldsDataBase &fieldsDB,
@ -81,7 +101,7 @@ pFlow::particleProbePostprocessComponent::particleProbePostprocessComponent
name_(dict.name()) name_(dict.name())
{} {}
bool pFlow::particleProbePostprocessComponent::execute bool pFlow::postprocessData::particleProbePostprocessComponent::execute
( (
const timeInfo &ti, const timeInfo &ti,
bool forceExecute bool forceExecute
@ -126,7 +146,7 @@ bool pFlow::particleProbePostprocessComponent::execute
} }
bool pFlow::particleProbePostprocessComponent::write(const fileSystem& parDir)const bool pFlow::postprocessData::particleProbePostprocessComponent::write(const fileSystem& parDir)const
{ {
if(! executed_ ) return true; if(! executed_ ) return true;

View File

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

View File

@ -1,9 +1,29 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#include "postprocessComponent.hpp" #include "postprocessComponent.hpp"
#include "fieldsDataBase.hpp" #include "fieldsDataBase.hpp"
#include "Time.hpp" #include "Time.hpp"
pFlow::postprocessComponent::postprocessComponent pFlow::postprocessData::postprocessComponent::postprocessComponent
( (
const dictionary &dict, const dictionary &dict,
fieldsDataBase &fieldsDB, fieldsDataBase &fieldsDB,
@ -23,7 +43,7 @@ pFlow::postprocessComponent::postprocessComponent
} }
pFlow::uniquePtr<pFlow::postprocessComponent> pFlow::postprocessComponent::create pFlow::uniquePtr<pFlow::postprocessData::postprocessComponent> pFlow::postprocessData::postprocessComponent::create
( (
const dictionary& dict, const dictionary& dict,
fieldsDataBase& fieldsDB, fieldsDataBase& fieldsDB,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,10 @@
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. 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.
## Overview - 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: Postprocessing in phasicFlow allows you to:
@ -12,11 +15,36 @@ Postprocessing in phasicFlow allows you to:
- Apply different weighing methods when calculating statistics - Apply different weighing methods when calculating statistics
- Perform postprocessing at specific time intervals - Perform postprocessing at specific time intervals
## Setting Up Postprocessing ## 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. 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.
### Basic Configuration ### 2.1. Basic Configuration
The input dictionary, **settings/postprocessDataDict**, may look like this: The input dictionary, **settings/postprocessDataDict**, may look like this:
@ -46,7 +74,8 @@ components
); );
``` ```
If you want to activate in-simulaiton postprocessing, you need to add these lines to the `settings/settingsDict` file:
If you want to activate in-simulation postprocessing, you need to add these lines to the `settings/settingsDict` file:
```cpp ```cpp
libs ("libPostprocessData.so"); libs ("libPostprocessData.so");
@ -56,7 +85,7 @@ 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. 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.
## Time Control Options ## 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: Each postprocessing component can either use the default time control settings or define its own. There are three main options for time control:
@ -69,7 +98,7 @@ Each postprocessing component can either use the default time control settings o
If no time control is specified, the `default` option is used automatically. If no time control is specified, the `default` option is used automatically.
## Processing Methods ## 4. Processing Methods
The postprocessing module provides several methods for processing particle data. They are categorized into two main groups: bulk and individual methods. The postprocessing module provides several methods for processing particle data. They are categorized into two main groups: bulk and individual methods.
@ -83,7 +112,7 @@ The postprocessing module provides several methods for processing particle data.
| `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}$ | | `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 | | `particleProbe` | individual | Extracts values from specific particles | Direct access to particle properties |
## Region Types ## 5. Region Types
Regions define where in the domain the postprocessing operations are applied: Regions define where in the domain the postprocessing operations are applied:
@ -94,24 +123,24 @@ Regions define where in the domain the postprocessing operations are applied:
| `line` | Spheres along a line with specified radius | `p1`, `p2`, `nSpheres`, `radius` | bulk | | `line` | Spheres along a line with specified radius | `p1`, `p2`, `nSpheres`, `radius` | bulk |
| `centerPoints` | Specific particles selected by ID | `ids` | individual | | `centerPoints` | Specific particles selected by ID | `ids` | individual |
## Processing Operations ## 6. Processing Operations
Within each processing region of type `bulk`, you can define multiple operations to be performed: Within each processing region of type `bulk`, you can define multiple operations to be performed:
### Available Functions ### 6.1. Available Functions in average
| Function | Property type | Description | Formula | Required Parameters | | 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) | | `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) | | `sum` | bulk | Weighted sum of particle field values | see Equation 2 | `field`, `phi` (optional),`threshold` (optional), `includeMask` (optional), `divideByVolume` (optional) |
Equation 1: Equation 1:
$$\text{result} = \frac{\sum_j w_j \cdot \phi_j \cdot \text{field}_j}{\sum_i w_i \cdot \phi_i}$$ $$\text{mean} = \frac{\sum_j w_j \cdot \phi_j \cdot \text{field}_j}{\sum_i w_i \cdot \phi_i}$$
Equation 2: Equation 2:
$$\text{result} = \sum_j w_j \cdot \phi_j \cdot \text{field}_j$$ $$\text{sum} = \sum_j w_j \cdot \phi_j \cdot \text{field}_j$$
where: where:
@ -121,16 +150,28 @@ where:
- $\phi_j$ is the value of the `phi` field for particle $j$ (default is 1) - $\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$ - $field_j$ is the value of the specified field for particle $j$
### 6.2. About fluctuation2 in average function
### Derived Functions 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: In addition to the above basic functions, some derived functions are available for specific calculations:
| Function | Property type | Description | Formula | Required Parameters | | Function | Property type | Description | Formula | Required Parameters |
|----------|---------------|-------------|---------|---------------------| |----------|---------------|-------------|---------|---------------------|
|`avMassVelocity` | bulk | Average velocity weighted by mass | $\frac{\sum_{i \in \text{region}} m_i \cdot v_i}{\sum_{i \in \text{region}} m_i}$ | - | |`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}$ | - |
### Available Fields ### 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: 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:
@ -161,17 +202,19 @@ All the pointFields in the simulation database (for in-simulation processing), o
The above fields may vary from one type of simulation to other. Pleas note that this is only a tentative list. The above fields may vary from one type of simulation to other. Pleas note that this is only a tentative list.
### Optional Parameters ### 6.5. Optional Parameters
| Parameter | Description | Default | Options | | Parameter | Description | Default | Options |
|-----------|-------------|---------|---------| |-----------|-------------|---------|---------|
| `divideByVolume` | Divide result by region volume | `no` | `yes`, `no` | | `divideByVolume` | Divide result by region volume | `no` | `yes` or `no` |
| `threshold` | Exclude regions with fewer particles | 1 | Integer value | | `threshold` | Exclude regions with fewer particles | 1 | Integer value |
| `includeMask` | Filter particles based on a field value | `all` | `all`, `lessThan`, `greaterThan`, `between`, `lessThanOrEq`, `greaterThanEq`, `betweenEq` | | `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 |
## Examples ## 7. Examples
### Example 1: Probing Individual Particles ### 7.1. Example 1: Probing Individual Particles
```cpp ```cpp
velocityProb velocityProb
@ -187,7 +230,7 @@ velocityProb
This example extracts the y-component of the position for particles with IDs 0, 10, and 100. This example extracts the y-component of the position for particles with IDs 0, 10, and 100.
### Example 2: Processing in a Spherical Region ### 7.2. Example 2: Processing in a Spherical Region
```cpp ```cpp
on_single_sphere on_single_sphere
@ -210,6 +253,7 @@ on_single_sphere
function average; function average;
field mag(velocity); field mag(velocity);
divideByVolume no; divideByVolume no;
fluctuation2 yes;
threshold 3; threshold 3;
includeMask all; includeMask all;
} }
@ -246,7 +290,7 @@ This example defines a sphere region and performs three operations:
2. Calculate the fraction of particles with diameter less than 0.0031 2. Calculate the fraction of particles with diameter less than 0.0031
3. Calculate the number density by summing and dividing by volume 3. Calculate the number density by summing and dividing by volume
### Example 3: Processing Along a Line ### 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. 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.
@ -291,9 +335,9 @@ along_a_line
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. 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.
## Advanced Features ## 8. Advanced Features
### Special functions applied on fields ### 8.1. Special functions applied on fields
You can access specific components of vector fields (`realx3`) using the `component` function: You can access specific components of vector fields (`realx3`) using the `component` function:
@ -315,8 +359,7 @@ Here is a complete list of these special functions:
| `magnitude cube` | `realx3` | `magCube(velocity)` | | `magnitude cube` | `realx3` | `magCube(velocity)` |
| `magnitude square root` | `realx3` | `magSqrt(acceleration)` | | `magnitude square root` | `realx3` | `magSqrt(acceleration)` |
### 8.2. Particle Filtering with includeMask
### Particle Filtering with includeMask
The `includeMask` parameter allows you to filter particles based on field values: The `includeMask` parameter allows you to filter particles based on field values:
@ -339,7 +382,7 @@ Supported masks:
- `greaterThanOrEq`: Include particles where field ≥ value - `greaterThanOrEq`: Include particles where field ≥ value
- `betweenEq`: Include particles where value1 ≤ field ≤ value2 - `betweenEq`: Include particles where value1 ≤ field ≤ value2
## Implementation Notes ### 8.3. Implementation Notes
- The postprocessing system can work both during simulation (`runTimeActive yes`) or after simulation completion. - 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. - When using post-simulation mode, you must specify the correct `shapeType` to properly initialize the shape objects.
@ -347,17 +390,180 @@ Supported masks:
- The `threshold` parameter helps eliminate statistical noise in regions with few particles. - 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. - Setting `divideByVolume` to `yes` normalizes results by the volume of the region, useful for calculating densities.
## Mathematical Formulations ## 9. Mathematical Formulations
For weighted `bulk` properties calculation: For weighted `bulk` properties calculation, we have these two general formulations:
$$ \text{average} = \frac{\sum_{i \in \text{region and includeMask}} w_i \cdot \phi_i \cdot \text{field}_i}{\sum_{i \in \text{region}} w_i \cdot \phi_i} $$ - For weighted averaging:
For weighted summing: $$ \text{average} = \frac{\sum_j w_j \cdot \phi_j \cdot \text{field}_j}{\sum_i w_i \cdot \phi_i} $$
$$ \text{sum} = \sum_{i \in \text{region and includeMask}} w_i \cdot \phi_i \cdot \text{field}_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: 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}}} $$ $$ \text{volumetric result} = \frac{\text{result}}{V_{\text{region}}} $$
## 10. A complete dictionary file (postprocessDataDict)
```C++
/* -------------------------------*- C++ -*--------------------------------- *\
| phasicFlow File |
| copyright: www.cemf.ir |
\* ------------------------------------------------------------------------- */
objectName postprocessDataDict;
objectType dictionary;;
fileFormat ASCII;
/*---------------------------------------------------------------------------*/
// Yes: postprocessing is active during the simulation
// No: postprocessing is not active during the simulation
// and it can be done after simulation
runTimeActive yes;
// shapeType: defines the type of the shape that is used in the simulation
// (for example: sphere, grain, etc).
// shapeType is only used when postprocessing is done after simulation
// to initialize the shape object for post processing operatoins
shapeType sphere;
// default time control to be used in the postprocessing components
defaultTimeControl
{
timeControl timeStep; // timeStep, simulationTime are the options here
startTime 0;
endTime 1000;
executionInterval 150;
}
// list of postprocessing components
components
(
// probing particles for their state variables, like velocity, position, etc
velocityProb
{
processMethod particleProbe;
processRegion centerPoints;
selector id;
field component(position,y);
ids (0 10 100);
timeControl default; // other options are settings, timeStep, simulationTime
// settings: uses parameters from settingsDict file
// timeStep: uses the time step of the simulation controlling the execution of postprocessing
// simulationTime: uses the simulation time of the simulation controlling the execution of postprocessing
// default: uses the default time control (defined in defaultTimeControl).
// default behavior: if you do not specify it, parameters in defaultTimeControl is used.
}
on_single_sphere
{
// method of performing the sum (arithmetic, uniformDistribution, GaussianDistribution)
processMethod arithmetic;
// Postprocessing is done on particles whose centers are inside this spehre
processRegion sphere;
sphereInfo
{
radius 0.01; // radius of sphere
center (-0.08 -0.08 0.015); // center of sphere
}
timeControl default;
/// all the postprocess operations to be done on sphere region
operations
(
// computes the arithmetic mean of particle velocity
averageVel
{
function average;
field velocity;
fluctuation2 yes;
divideByVolume no; // default is no
threshold 3; // default is 1
includeMask all; // default is all
}
// - function: average, sum, and other derived ones from sum and average
// - field: names of the fields in the simulation. Some special fields
// are: mass, density, volume, position, one, I.
// - divideByVolume: whether the result is divided by the volume of the region
// - threshold: exclude regions that contains particles less than threshold
// - includeMask: all, lessThan, greaterThan, between, lessThanOrEq, greaterThanEq, betweenEq
// computes the fraction of par1 in the region
par1Fraction
{
function average;
field one; // default
phi one; // default
divideByVolume no;
includeMask lessThan;
// diameter of par1 is 0.003, so these settings
// will select only particles of type par1
lessThanInfo
{
field diameter;
value 0.0031;
}
}
numberDensity
{
function sum;
field one;
phi one;
divideByVolume yes;
}
);
}
along_a_line
{
processMethod arithmetic;
processRegion line;
// the time interval for executing the post-processing
// other options: timeStep, default, and settings
timeControl simulationTime;
startTime 1.0;
endTime 3.0;
executionInterval 0.1;
// 10 spheres with radius 0.01 along the straight line defined by p1 and p2
lineInfo
{
p1 (0 0 0);
p2 (0 0.15 0.15);
nSpheres 10;
radius 0.01;
}
operations
(
// computes the arithmetic mean of particle velocity
numberDensity
{
function sum;
field one;
divideByVolume yes; //default is no
}
volumeDensity
{
function sum;
field volume; //
divideByVolume yes; //default is no
}
);
}
);
```

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,10 @@
#include "lineRegionPoints.hpp" #include "lineRegionPoints.hpp"
#include "fieldsDataBase.hpp" #include "fieldsDataBase.hpp"
pFlow::lineRegionPoints::lineRegionPoints namespace pFlow::postprocessData
{
lineRegionPoints::lineRegionPoints
( (
const dictionary &dict, const dictionary &dict,
fieldsDataBase &fieldsDataBase fieldsDataBase &fieldsDataBase
@ -50,7 +53,7 @@ pFlow::lineRegionPoints::lineRegionPoints
} }
} }
pFlow::span<const pFlow::uint32> pFlow::lineRegionPoints::indices(uint32 elem) const pFlow::span<const pFlow::uint32> lineRegionPoints::indices(uint32 elem) const
{ {
if(elem >= size()) if(elem >= size())
{ {
@ -65,7 +68,7 @@ pFlow::span<const pFlow::uint32> pFlow::lineRegionPoints::indices(uint32 elem) c
selectedPoints_[elem].size()); selectedPoints_[elem].size());
} }
pFlow::span<pFlow::uint32> pFlow::lineRegionPoints::indices(uint32 elem) pFlow::span<pFlow::uint32> lineRegionPoints::indices(uint32 elem)
{ {
if(elem >= size()) if(elem >= size())
{ {
@ -80,7 +83,7 @@ pFlow::span<pFlow::uint32> pFlow::lineRegionPoints::indices(uint32 elem)
selectedPoints_[elem].size()); selectedPoints_[elem].size());
} }
bool pFlow::lineRegionPoints::update() bool lineRegionPoints::update()
{ {
const auto points = database().updatePoints(); const auto points = database().updatePoints();
for(auto& elem : selectedPoints_) for(auto& elem : selectedPoints_)
@ -101,7 +104,7 @@ bool pFlow::lineRegionPoints::update()
return true; return true;
} }
bool pFlow::lineRegionPoints::write(iOstream &os) const bool lineRegionPoints::write(iOstream &os) const
{ {
os << "# Spheres along a straight line \n"; os << "# Spheres along a straight line \n";
os << "# No." << tab << "centerPoint" << tab << "diameter" << endl; os << "# No." << tab << "centerPoint" << tab << "diameter" << endl;
@ -118,3 +121,5 @@ bool pFlow::lineRegionPoints::write(iOstream &os) const
os << endl; os << endl;
return true; return true;
} }
} // End namespace pFlow::postprocessData

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -70,6 +70,7 @@ components
{ {
function average; function average;
field velocity; field velocity;
fluctuation2 yes;
divideByVolume no; // default is no divideByVolume no; // default is no
threshold 3; // default is 1 threshold 3; // default is 1
includeMask all; // default is all includeMask all; // default is all
@ -113,91 +114,44 @@ components
along_a_line along_a_line
{ {
processMethod arithmetic; processMethod arithmetic;
processRegion line; processRegion line;
// the time interval for executing the post-processing // the time interval for executing the post-processing
// other options: timeStep, default, and settings // other options: timeStep, default, and settings
timeControl simulationTime; timeControl simulationTime;
startTime 1.0; startTime 1.0;
endTime 3.0; endTime 3.0;
executionInterval 0.1; executionInterval 0.1;
// 10 spheres with radius 0.01 along the straight line defined by p1 and p2 // 10 spheres with radius 0.01 along the straight line defined by p1 and p2
lineInfo lineInfo
{ {
p1 (0 0 0); p1 (0 0 0);
p2 (0 0.15 0.15); p2 (0 0.15 0.15);
nSpheres 10; nSpheres 10;
radius 0.01; radius 0.01;
} }
operations operations
( (
// computes the arithmetic mean of particle velocity // computes the arithmetic mean of particle velocity
numberDensity numberDensity
{ {
function sum; function sum;
field one; field one;
divideByVolume yes; //default is no divideByVolume yes; //default is no
} }
volumeDensity volumeDensity
{ {
function sum; function sum;
field volume; // field volume; //
divideByVolume yes; //default is no divideByVolume yes; //default is no
} }
); );
} }
); );
/*
About processMethod
This defines the type of the processing method to be done.
The processing is done either on a collection of selected particles (the first three ones)
or individual particles (particleProbe).
Options are:
- arithmetic
- uniformDistribution
- GaussianDistribution
- particleProbe (only used with centerPoints)
When you use the first three optoins, then you can either perform two types of processing is possible
- sum
\f[
\text{result} = \sum_{i \in \text{processRegion and includeMask}} w_i \cdot \phi_i \cdot \text{field}_i
\f]
- average
\f[
\text{result} = \frac{1}{V_{\text{region}}} \frac{\sum_{j \in \text{includeMask}} w_j \cdot \phi_j \cdot \text{field}_j}
{\sum_{i \in \text{processRegion}} w_i \cdot \phi_i}
\f]
*/
/*
About processRegion
processRegion, defines processing regions on which postprocess operation are performed. Particles
whose centers are inside the regions are selected for post processing operation. Note that
you are allowed to use a correct combination of processRegion and processMethod.
For example centerPoints only works with particleProbe.
Options are:
- sphere
- multipleSpheres
- line
- centerPoints (only works with particleProbe)
- rectMesh: Not implemented yet
- generalMesh: not implemented yet
*/