mirror of
https://github.com/PhasicFlow/phasicFlow.git
synced 2025-06-12 16:26:23 +00:00
postprocessPhasicFlow is now updated with new postprocessData auxFunction. It now uses postprocessDataDict.
This commit is contained in:
@ -24,7 +24,7 @@ Licence:
|
|||||||
#include "systemControl.hpp"
|
#include "systemControl.hpp"
|
||||||
#include "fieldsDataBase.hpp"
|
#include "fieldsDataBase.hpp"
|
||||||
#include "fieldFunctions.hpp"
|
#include "fieldFunctions.hpp"
|
||||||
|
#include "dictionary.hpp"
|
||||||
|
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
{
|
{
|
||||||
@ -38,19 +38,6 @@ bool pFlow::fieldsDataBase::loadPointStructureToTime()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
pFlow::word pFlow::fieldsDataBase::getPointFieldType(const word &name) const
|
|
||||||
{
|
|
||||||
word pfType = time_.lookupObjectTypeName(name);
|
|
||||||
word type, space;
|
|
||||||
if(!pointFieldGetType(pfType, type, space))
|
|
||||||
{
|
|
||||||
fatalErrorInFunction
|
|
||||||
<<"Error in retriving the type of pointField "
|
|
||||||
<< pfType<<endl;
|
|
||||||
fatalExit;
|
|
||||||
}
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool pFlow::fieldsDataBase::checkForUpdate(const word &compoundName, bool forceUpdate)
|
bool pFlow::fieldsDataBase::checkForUpdate(const word &compoundName, bool forceUpdate)
|
||||||
{
|
{
|
||||||
@ -195,6 +182,78 @@ pFlow::span<pFlow::real> pFlow::fieldsDataBase::createOrGetOne(bool forceUpdate)
|
|||||||
field.size());
|
field.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pFlow::span<pFlow::real> pFlow::fieldsDataBase::createOrGetMass(bool forceUpdate)
|
||||||
|
{
|
||||||
|
const word fName = "mass";
|
||||||
|
|
||||||
|
bool shouldUpdate = checkForUpdate(fName, forceUpdate);
|
||||||
|
|
||||||
|
if(shouldUpdate)
|
||||||
|
{
|
||||||
|
const auto index = updateFieldUint32("shapeIndex", true);
|
||||||
|
const auto ms = getShape().mass();
|
||||||
|
|
||||||
|
FieldTypeHost<real> massField
|
||||||
|
(
|
||||||
|
fName,
|
||||||
|
"value",
|
||||||
|
pointFieldSize()
|
||||||
|
);
|
||||||
|
|
||||||
|
for(uint32 i=0; i< massField.size(); i++)
|
||||||
|
{
|
||||||
|
massField[i] = ms[index[i]];
|
||||||
|
}
|
||||||
|
|
||||||
|
allFields_.emplaceBackOrReplace<FieldTypeHost<real>>
|
||||||
|
(
|
||||||
|
fName,
|
||||||
|
std::move(massField)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto& field = allFields_.getObject<FieldTypeHost<real>>(fName);
|
||||||
|
return span<real>(
|
||||||
|
field.data(),
|
||||||
|
field.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
pFlow::span<pFlow::real> pFlow::fieldsDataBase::createOrGetI(bool forceUpdate)
|
||||||
|
{
|
||||||
|
const word fName = "I";
|
||||||
|
|
||||||
|
bool shouldUpdate = checkForUpdate(fName, forceUpdate);
|
||||||
|
|
||||||
|
if(shouldUpdate)
|
||||||
|
{
|
||||||
|
const auto index = updateFieldUint32("shapeIndex", true);
|
||||||
|
const auto Is = getShape().Inertia();
|
||||||
|
|
||||||
|
FieldTypeHost<real> IField
|
||||||
|
(
|
||||||
|
fName,
|
||||||
|
"value",
|
||||||
|
pointFieldSize()
|
||||||
|
);
|
||||||
|
|
||||||
|
for(uint32 i=0; i< IField.size(); i++)
|
||||||
|
{
|
||||||
|
IField[i] = Is[index[i]];
|
||||||
|
}
|
||||||
|
|
||||||
|
allFields_.emplaceBackOrReplace<FieldTypeHost<real>>
|
||||||
|
(
|
||||||
|
fName,
|
||||||
|
std::move(IField)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto& field = allFields_.getObject<FieldTypeHost<real>>(fName);
|
||||||
|
return span<real>(
|
||||||
|
field.data(),
|
||||||
|
field.size());
|
||||||
|
}
|
||||||
|
|
||||||
bool pFlow::fieldsDataBase::findFunction(
|
bool pFlow::fieldsDataBase::findFunction(
|
||||||
const word &compoundFieldName,
|
const word &compoundFieldName,
|
||||||
word &fieldName,
|
word &fieldName,
|
||||||
@ -399,11 +458,35 @@ bool pFlow::fieldsDataBase::inputOutputType
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
pFlow::fieldsDataBase::fieldsDataBase(systemControl& control, bool inSimulation)
|
pFlow::fieldsDataBase::fieldsDataBase
|
||||||
|
(
|
||||||
|
systemControl& control,
|
||||||
|
const dictionary& postDict,
|
||||||
|
bool inSimulation,
|
||||||
|
timeValue startTime
|
||||||
|
)
|
||||||
:
|
:
|
||||||
time_(control.time()),
|
time_(control.time()),
|
||||||
inSimulation_(inSimulation)
|
inSimulation_(inSimulation)
|
||||||
{}
|
{
|
||||||
|
if(!inSimulation_)
|
||||||
|
{
|
||||||
|
shapeType_ = postDict.getValOrSet<word>("shapeType", "");
|
||||||
|
|
||||||
|
if(shapeType_.empty())
|
||||||
|
{
|
||||||
|
WARNING
|
||||||
|
<< "shapeType is not set in dictionary: "
|
||||||
|
<< postDict.globalName()
|
||||||
|
<< " and you may need to set for some postprocess operations"<<END_WARNING;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// this is not required for execution during simulation
|
||||||
|
shapeType_ = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pFlow::timeValue pFlow::fieldsDataBase::currentTime() const
|
pFlow::timeValue pFlow::fieldsDataBase::currentTime() const
|
||||||
{
|
{
|
||||||
@ -808,7 +891,13 @@ pFlow::allPointFieldTypes pFlow::fieldsDataBase::updateFieldAll
|
|||||||
|
|
||||||
|
|
||||||
pFlow::uniquePtr<pFlow::fieldsDataBase>
|
pFlow::uniquePtr<pFlow::fieldsDataBase>
|
||||||
pFlow::fieldsDataBase::create(systemControl& control, bool inSimulation)
|
pFlow::fieldsDataBase::create
|
||||||
|
(
|
||||||
|
systemControl& control,
|
||||||
|
const dictionary& postDict,
|
||||||
|
bool inSimulation,
|
||||||
|
timeValue startTime
|
||||||
|
)
|
||||||
{
|
{
|
||||||
word dbType;
|
word dbType;
|
||||||
if(inSimulation)
|
if(inSimulation)
|
||||||
@ -823,7 +912,7 @@ pFlow::uniquePtr<pFlow::fieldsDataBase>
|
|||||||
if( boolvCtorSelector_.search(dbType) )
|
if( boolvCtorSelector_.search(dbType) )
|
||||||
{
|
{
|
||||||
auto objPtr =
|
auto objPtr =
|
||||||
boolvCtorSelector_[dbType](control, inSimulation);
|
boolvCtorSelector_[dbType](control, postDict, inSimulation, startTime);
|
||||||
return objPtr;
|
return objPtr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -33,6 +33,7 @@ Licence:
|
|||||||
namespace pFlow
|
namespace pFlow
|
||||||
{
|
{
|
||||||
|
|
||||||
|
class dictionary;
|
||||||
class systemControl;
|
class systemControl;
|
||||||
class Time;
|
class Time;
|
||||||
|
|
||||||
@ -83,16 +84,9 @@ private:
|
|||||||
/// Flag indicating if we're in simulation mode
|
/// Flag indicating if we're in simulation mode
|
||||||
bool inSimulation_ = false;
|
bool inSimulation_ = false;
|
||||||
|
|
||||||
protected:
|
word shapeType_;
|
||||||
|
|
||||||
/// Map of reserved field names with their corresponding types
|
protected:
|
||||||
static const inline std::map<word, word> reservedFieldNames_
|
|
||||||
{
|
|
||||||
{"position", "realx3"},
|
|
||||||
{"one", "real"},
|
|
||||||
{"volume", "real"},
|
|
||||||
{"density", "real"}
|
|
||||||
};
|
|
||||||
|
|
||||||
/// check if pointField name exists in Time or time folder
|
/// check if pointField name exists in Time or time folder
|
||||||
virtual
|
virtual
|
||||||
@ -104,12 +98,28 @@ protected:
|
|||||||
|
|
||||||
virtual
|
virtual
|
||||||
bool loadPointStructureToTime()=0;
|
bool loadPointStructureToTime()=0;
|
||||||
|
|
||||||
|
virtual
|
||||||
|
const shape& getShape() const= 0;
|
||||||
|
|
||||||
|
const word& shapeTypeName()const
|
||||||
|
{
|
||||||
|
return shapeType_;
|
||||||
|
}
|
||||||
|
|
||||||
/// get the type name of the pointField in the Time object
|
/// get the type name of the pointField in the Time object
|
||||||
word getPointFieldType(const word& name)const;
|
virtual
|
||||||
|
word getPointFieldType(const word& name)const = 0;
|
||||||
|
|
||||||
/// Checks if a field needs to be updated based on capture time
|
/// Checks if a field needs to be updated based on capture time
|
||||||
bool checkForUpdate(const word& compoundName, bool forceUpdate = false);
|
bool checkForUpdate(const word& compoundName, bool forceUpdate = false);
|
||||||
|
|
||||||
|
/// @brief return the size of pointStructure
|
||||||
|
uint32 pointFieldSize()
|
||||||
|
{
|
||||||
|
auto s = updatePoints();
|
||||||
|
return s.size();
|
||||||
|
}
|
||||||
|
|
||||||
template<ValidFieldType T>
|
template<ValidFieldType T>
|
||||||
span<T> updateField(const word& name, bool forceUpdate = false);
|
span<T> updateField(const word& name, bool forceUpdate = false);
|
||||||
@ -125,6 +135,21 @@ protected:
|
|||||||
|
|
||||||
span<real> createOrGetOne(bool forceUpdate=false);
|
span<real> createOrGetOne(bool forceUpdate=false);
|
||||||
|
|
||||||
|
span<real> createOrGetMass(bool forceUpdate=false);
|
||||||
|
|
||||||
|
span<real> createOrGetI(bool forceUpdate=false);
|
||||||
|
|
||||||
|
/// Map of reserved field names with their corresponding types
|
||||||
|
static const inline std::map<word, word> reservedFieldNames_
|
||||||
|
{
|
||||||
|
{"position", "realx3"},
|
||||||
|
{"one", "real"},
|
||||||
|
{"volume", "real"},
|
||||||
|
{"density", "real"},
|
||||||
|
{"mass", "real"},
|
||||||
|
{"I", "real"}
|
||||||
|
};
|
||||||
|
|
||||||
static
|
static
|
||||||
bool findFunction(
|
bool findFunction(
|
||||||
const word& compoundFieldName,
|
const word& compoundFieldName,
|
||||||
@ -137,25 +162,7 @@ protected:
|
|||||||
const word& inputType,
|
const word& inputType,
|
||||||
word& outputType);
|
word& outputType);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
// - protected member functions
|
|
||||||
|
|
||||||
|
|
||||||
virtual
|
|
||||||
bool checkTimeFolder(const word& fieldName) const = 0;
|
|
||||||
|
|
||||||
virtual
|
|
||||||
const shape& getShape() const= 0;
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief return the size of pointStructure
|
|
||||||
uint32 pointFieldSize()
|
|
||||||
{
|
|
||||||
auto s = updatePoints();
|
|
||||||
return s.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -165,7 +172,11 @@ public:
|
|||||||
|
|
||||||
// - constructors
|
// - constructors
|
||||||
|
|
||||||
fieldsDataBase(systemControl& control, bool inSimulation);
|
fieldsDataBase(
|
||||||
|
systemControl& control,
|
||||||
|
const dictionary& postDict,
|
||||||
|
bool inSimulation,
|
||||||
|
timeValue startTime);
|
||||||
|
|
||||||
/// no copy constructor
|
/// no copy constructor
|
||||||
fieldsDataBase(const fieldsDataBase&) = delete;
|
fieldsDataBase(const fieldsDataBase&) = delete;
|
||||||
@ -186,8 +197,13 @@ public:
|
|||||||
(
|
(
|
||||||
fieldsDataBase,
|
fieldsDataBase,
|
||||||
bool,
|
bool,
|
||||||
(systemControl& control, bool inSimulation),
|
(
|
||||||
(control, inSimulation)
|
systemControl& control,
|
||||||
|
const dictionary& postDict,
|
||||||
|
bool inSimulation,
|
||||||
|
timeValue startTime
|
||||||
|
),
|
||||||
|
(control, postDict, inSimulation, startTime)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -260,14 +276,39 @@ public:
|
|||||||
|
|
||||||
virtual
|
virtual
|
||||||
const pointStructure& pStruct()const = 0;
|
const pointStructure& pStruct()const = 0;
|
||||||
|
|
||||||
|
/// Get the next avaiable time folder after the current time folder
|
||||||
|
/// This is only used for post-simulation processing
|
||||||
|
virtual
|
||||||
|
timeValue getNextTimeFolder()const
|
||||||
|
{
|
||||||
|
return -1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Sets the current folder to the next time folder.
|
||||||
|
/// This is used only for post-simulation processing
|
||||||
|
/// @returns the time value of the next folder.
|
||||||
virtual
|
virtual
|
||||||
void resetTimeFolder() = 0;
|
timeValue setToNextTimeFolder()
|
||||||
|
{
|
||||||
|
return -1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Skips the next time folder.
|
||||||
|
/// This is used only for post-simulation processing
|
||||||
|
/// @returns the time value of the skipped folder
|
||||||
|
virtual
|
||||||
|
timeValue skipNextTimeFolder()
|
||||||
|
{
|
||||||
|
return -1.0;
|
||||||
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
uniquePtr<fieldsDataBase> create(
|
uniquePtr<fieldsDataBase> create(
|
||||||
systemControl& control,
|
systemControl& control,
|
||||||
bool inSimulation);
|
const dictionary& postDict,
|
||||||
|
bool inSimulation,
|
||||||
|
timeValue startTime);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace pFlow
|
} // namespace pFlow
|
||||||
|
@ -116,6 +116,36 @@ pFlow::span<T> pFlow::fieldsDataBase::updateReservedField
|
|||||||
fatalExit;
|
fatalExit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if( name == "mass")
|
||||||
|
{
|
||||||
|
if constexpr( std::same_as<T,real>)
|
||||||
|
{
|
||||||
|
return createOrGetMass(forceUpdate);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fatalErrorInFunction
|
||||||
|
<< "This type: "
|
||||||
|
<< getTypeName<T>()
|
||||||
|
<<" is not supported for field mass."<<endl;
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( name == "I")
|
||||||
|
{
|
||||||
|
if constexpr( std::same_as<T,real>)
|
||||||
|
{
|
||||||
|
return createOrGetI(forceUpdate);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fatalErrorInFunction
|
||||||
|
<< "This type: "
|
||||||
|
<< getTypeName<T>()
|
||||||
|
<<" is not supported for field I."<<endl;
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
}
|
||||||
else if( name == "position")
|
else if( name == "position")
|
||||||
{
|
{
|
||||||
if constexpr( std::same_as<T, realx3>)
|
if constexpr( std::same_as<T, realx3>)
|
||||||
|
@ -24,23 +24,35 @@ bool pFlow::simulationFieldsDataBase::loadPointStructureToTime()
|
|||||||
return time().lookupObjectName(pointStructureFile__);
|
return time().lookupObjectName(pointStructureFile__);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pFlow::simulationFieldsDataBase::checkTimeFolder(const word &fieldName) const
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const pFlow::shape& pFlow::simulationFieldsDataBase::getShape() const
|
const pFlow::shape& pFlow::simulationFieldsDataBase::getShape() const
|
||||||
{
|
{
|
||||||
return shape_;
|
return shape_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pFlow::word pFlow::simulationFieldsDataBase::getPointFieldType(const word &name) const
|
||||||
|
{
|
||||||
|
word pfType = time().lookupObjectTypeName(name);
|
||||||
|
word type, space;
|
||||||
|
if(!pointFieldGetType(pfType, type, space))
|
||||||
|
{
|
||||||
|
fatalErrorInFunction
|
||||||
|
<<"Error in retriving the type of pointField "
|
||||||
|
<< pfType<<endl;
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
pFlow::simulationFieldsDataBase::simulationFieldsDataBase
|
pFlow::simulationFieldsDataBase::simulationFieldsDataBase
|
||||||
(
|
(
|
||||||
systemControl &control,
|
systemControl &control,
|
||||||
bool inSimulation
|
const dictionary& postDict,
|
||||||
|
bool inSimulation,
|
||||||
|
timeValue startTime
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fieldsDataBase(control, inSimulation),
|
fieldsDataBase(control, postDict, inSimulation, startTime),
|
||||||
shape_
|
shape_
|
||||||
(
|
(
|
||||||
dynamic_cast<const shape&>(*control.caseSetup().lookupObjectPtr(shapeFile__))
|
dynamic_cast<const shape&>(*control.caseSetup().lookupObjectPtr(shapeFile__))
|
||||||
@ -57,6 +69,3 @@ const pFlow::pointStructure &pFlow::simulationFieldsDataBase::pStruct() const
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void pFlow::simulationFieldsDataBase::resetTimeFolder()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
@ -38,6 +38,7 @@ protected:
|
|||||||
|
|
||||||
/// check if pointField name exists in Time or time folder
|
/// check if pointField name exists in Time or time folder
|
||||||
bool pointFieldNameExists(const word& name)const override;
|
bool pointFieldNameExists(const word& name)const override;
|
||||||
|
|
||||||
|
|
||||||
/// Loads a pointField with a given name to the Time object.
|
/// Loads a pointField with a given name to the Time object.
|
||||||
/// For simulation, it just checks if the name exists
|
/// For simulation, it just checks if the name exists
|
||||||
@ -47,15 +48,19 @@ protected:
|
|||||||
/// For simulation, it just checks if the name exists
|
/// For simulation, it just checks if the name exists
|
||||||
bool loadPointStructureToTime() override;
|
bool loadPointStructureToTime() override;
|
||||||
|
|
||||||
bool checkTimeFolder(const word& fieldName) const override;
|
|
||||||
|
|
||||||
const shape& getShape() const override;
|
const shape& getShape() const override;
|
||||||
|
|
||||||
|
word getPointFieldType(const word& name)const override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TypeInfo("fieldsDataBase<simulation>");
|
TypeInfo("fieldsDataBase<simulation>");
|
||||||
|
|
||||||
simulationFieldsDataBase(systemControl& control, bool inSimulation);
|
simulationFieldsDataBase(
|
||||||
|
systemControl& control,
|
||||||
|
const dictionary& postDict,
|
||||||
|
bool inSimulation,
|
||||||
|
timeValue startTime);
|
||||||
|
|
||||||
~simulationFieldsDataBase() override = default;
|
~simulationFieldsDataBase() override = default;
|
||||||
|
|
||||||
@ -68,8 +73,6 @@ public:
|
|||||||
|
|
||||||
const pointStructure& pStruct()const override;
|
const pointStructure& pStruct()const override;
|
||||||
|
|
||||||
void resetTimeFolder() override;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,22 +22,18 @@ Licence:
|
|||||||
#include "List.hpp"
|
#include "List.hpp"
|
||||||
#include "systemControl.hpp"
|
#include "systemControl.hpp"
|
||||||
#include "postprocessData.hpp"
|
#include "postprocessData.hpp"
|
||||||
#include "fileDictionary.hpp"
|
|
||||||
#include "postprocessGlobals.hpp"
|
#include "postprocessGlobals.hpp"
|
||||||
#include "postprocessComponent.hpp"
|
#include "postprocessComponent.hpp"
|
||||||
|
|
||||||
pFlow::postprocessData::postprocessData(const systemControl &control)
|
pFlow::postprocessData::postprocessData
|
||||||
|
(
|
||||||
|
const systemControl &control,
|
||||||
|
timeValue startTime
|
||||||
|
)
|
||||||
:
|
:
|
||||||
auxFunctions(control),
|
auxFunctions(control),
|
||||||
|
inSimulation_(startTime<0.0?true:false),
|
||||||
time_(control.time()),
|
time_(control.time()),
|
||||||
fieldsDataBasePtr_
|
|
||||||
(
|
|
||||||
fieldsDataBase::create
|
|
||||||
(
|
|
||||||
const_cast<systemControl&>(control),
|
|
||||||
true
|
|
||||||
)
|
|
||||||
),
|
|
||||||
dict_
|
dict_
|
||||||
(
|
(
|
||||||
objectFile
|
objectFile
|
||||||
@ -59,6 +55,15 @@ pFlow::postprocessData::postprocessData(const systemControl &control)
|
|||||||
<<" This feature is disabled in the current run."<<END_WARNING;
|
<<" This feature is disabled in the current run."<<END_WARNING;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fieldsDataBasePtr_= fieldsDataBase::create
|
||||||
|
(
|
||||||
|
const_cast<systemControl&>(control),
|
||||||
|
dict_,
|
||||||
|
inSimulation_,
|
||||||
|
startTime
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
activeInSimulation_ = dict_.getValOrSet<Logical>(
|
activeInSimulation_ = dict_.getValOrSet<Logical>(
|
||||||
"activeInSimulation",
|
"activeInSimulation",
|
||||||
@ -80,12 +85,6 @@ pFlow::postprocessData::postprocessData(const systemControl &control)
|
|||||||
control.time().saveInterval(),
|
control.time().saveInterval(),
|
||||||
"execution");
|
"execution");
|
||||||
}
|
}
|
||||||
|
|
||||||
shapeType_ = dict_.getValOrSet<word>
|
|
||||||
(
|
|
||||||
"shapeType",
|
|
||||||
word("sphere")
|
|
||||||
);
|
|
||||||
|
|
||||||
componentsDictsPtr_ = makeUnique<dictionaryList>(readDictList("components", dict_));
|
componentsDictsPtr_ = makeUnique<dictionaryList>(readDictList("components", dict_));
|
||||||
|
|
||||||
@ -105,10 +104,10 @@ bool pFlow::postprocessData::execute()
|
|||||||
|
|
||||||
for(auto& component:postprocesses_)
|
for(auto& component:postprocesses_)
|
||||||
{
|
{
|
||||||
if(!component->execute(ti))
|
if(!component->execute(ti, !inSimulation_) )
|
||||||
{
|
{
|
||||||
fatalErrorInFunction
|
fatalErrorInFunction
|
||||||
<<"Error occured in executing postprocess component: "
|
<<"Error occurred in executing postprocess component: "
|
||||||
<<component->name()<<endl;
|
<<component->name()<<endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -125,6 +124,7 @@ bool pFlow::postprocessData::write() const
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!component->write(postProcessGlobals::defaultDir__/component->name()))
|
if(!component->write(postProcessGlobals::defaultDir__/component->name()))
|
||||||
{
|
{
|
||||||
fatalErrorInFunction
|
fatalErrorInFunction
|
||||||
@ -135,3 +135,8 @@ bool pFlow::postprocessData::write() const
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pFlow::postprocessData::setOutputDirectory(const fileSystem &path) const
|
||||||
|
{
|
||||||
|
postProcessGlobals::defaultDir__ = path;
|
||||||
|
}
|
||||||
|
@ -20,14 +20,14 @@ Licence:
|
|||||||
#ifndef __postprocessData_hpp__
|
#ifndef __postprocessData_hpp__
|
||||||
#define __postprocessData_hpp__
|
#define __postprocessData_hpp__
|
||||||
|
|
||||||
#include "auxFunctions.hpp"
|
|
||||||
#include "Logical.hpp"
|
#include "Logical.hpp"
|
||||||
#include "ListPtr.hpp"
|
#include "ListPtr.hpp"
|
||||||
#include "fileDictionary.hpp"
|
#include "fileDictionary.hpp"
|
||||||
#include "baseTimeControl.hpp"
|
#include "dictionaryList.hpp"
|
||||||
|
#include "auxFunctions.hpp"
|
||||||
#include "fieldsDataBase.hpp"
|
#include "fieldsDataBase.hpp"
|
||||||
#include "postprocessComponent.hpp"
|
#include "postprocessComponent.hpp"
|
||||||
#include "dictionaryList.hpp"
|
|
||||||
|
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
{
|
{
|
||||||
@ -36,6 +36,7 @@ class systemControl;
|
|||||||
class Time;
|
class Time;
|
||||||
class timeInfo;
|
class timeInfo;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class postprocessData
|
* @class postprocessData
|
||||||
* @brief An interface class for handling post-processing of simulation data.
|
* @brief An interface class for handling post-processing of simulation data.
|
||||||
@ -47,7 +48,11 @@ class postprocessData
|
|||||||
:
|
:
|
||||||
public auxFunctions
|
public auxFunctions
|
||||||
{
|
{
|
||||||
/// Indicates if a post-processing is active during simulatoin
|
/// Indicates if this is post-processing during simulation or
|
||||||
|
/// post-simulation
|
||||||
|
bool inSimulation_;
|
||||||
|
|
||||||
|
/// Indicates if a post-processing is active during simulation
|
||||||
Logical activeInSimulation_{false};
|
Logical activeInSimulation_{false};
|
||||||
|
|
||||||
/// a list of active post-process components
|
/// a list of active post-process components
|
||||||
@ -62,9 +67,6 @@ class postprocessData
|
|||||||
/// file dictionary that is constructed from the file (postProcessDataDict)
|
/// file dictionary that is constructed from the file (postProcessDataDict)
|
||||||
fileDictionary dict_;
|
fileDictionary dict_;
|
||||||
|
|
||||||
/// name of the shape for use in the time of postprocess after simulation
|
|
||||||
word shapeType_;
|
|
||||||
|
|
||||||
/// list of dictionaries for postprocess components
|
/// list of dictionaries for postprocess components
|
||||||
uniquePtr<dictionaryList> componentsDictsPtr_ = nullptr;
|
uniquePtr<dictionaryList> componentsDictsPtr_ = nullptr;
|
||||||
|
|
||||||
@ -79,7 +81,7 @@ public:
|
|||||||
/// this constructor is used when postprocesing is active
|
/// this constructor is used when postprocesing is active
|
||||||
/// during simulation.
|
/// during simulation.
|
||||||
/// @param control const reference to systemControl
|
/// @param control const reference to systemControl
|
||||||
postprocessData(const systemControl& control);
|
postprocessData(const systemControl& control, timeValue startTime = -1.0);
|
||||||
|
|
||||||
~postprocessData()override = default;
|
~postprocessData()override = default;
|
||||||
|
|
||||||
@ -92,11 +94,19 @@ public:
|
|||||||
|
|
||||||
bool execute() override;
|
bool execute() override;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool write()const override;
|
bool write()const override;
|
||||||
|
|
||||||
|
fieldsDataBase& database()
|
||||||
|
{
|
||||||
|
return fieldsDataBasePtr_();
|
||||||
|
}
|
||||||
|
|
||||||
|
const fieldsDataBase& database()const
|
||||||
|
{
|
||||||
|
return fieldsDataBasePtr_();
|
||||||
|
}
|
||||||
|
|
||||||
|
void setOutputDirectory(const fileSystem& path)const;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace pFlow
|
} // namespace pFlow
|
||||||
|
@ -49,6 +49,7 @@ repository/Time/baseTimeControl.cpp
|
|||||||
repository/systemControl/systemControl.cpp
|
repository/systemControl/systemControl.cpp
|
||||||
repository/systemControl/auxFunctions/auxFunctions.cpp
|
repository/systemControl/auxFunctions/auxFunctions.cpp
|
||||||
repository/systemControl/dynamicLinkLibs.cpp
|
repository/systemControl/dynamicLinkLibs.cpp
|
||||||
|
repository/systemControl/timeFolder.cpp
|
||||||
|
|
||||||
commandLine/commandLine.cpp
|
commandLine/commandLine.cpp
|
||||||
|
|
||||||
|
@ -128,6 +128,42 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
T minVal()const
|
||||||
|
{
|
||||||
|
T m = largestPositive<T>();
|
||||||
|
for(const auto& sr:sRanges_)
|
||||||
|
{
|
||||||
|
m = min(m, sr.begin());
|
||||||
|
}
|
||||||
|
for(const auto& iR:iRanges_)
|
||||||
|
{
|
||||||
|
m = min(m, iR.begin());
|
||||||
|
}
|
||||||
|
for(const auto& i:individuals_)
|
||||||
|
{
|
||||||
|
m = min(m, i);
|
||||||
|
}
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
T maxVal()const
|
||||||
|
{
|
||||||
|
T m = largestNegative<T>();
|
||||||
|
for(const auto& sr:sRanges_)
|
||||||
|
{
|
||||||
|
m = max(m, sr.begin());
|
||||||
|
}
|
||||||
|
for(const auto& iR:iRanges_)
|
||||||
|
{
|
||||||
|
m = max(m, iR.begin());
|
||||||
|
}
|
||||||
|
for(const auto& i:individuals_)
|
||||||
|
{
|
||||||
|
m = max(m, i);
|
||||||
|
}
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
bool isMember(T val)const
|
bool isMember(T val)const
|
||||||
{
|
{
|
||||||
for(auto& sR:sRanges_)
|
for(auto& sR:sRanges_)
|
||||||
|
@ -68,6 +68,15 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
T begin()const
|
||||||
|
{
|
||||||
|
return begin_;
|
||||||
|
}
|
||||||
|
|
||||||
|
T end()const
|
||||||
|
{
|
||||||
|
return end_;
|
||||||
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
bool isMember(T val)const
|
bool isMember(T val)const
|
||||||
|
@ -30,6 +30,25 @@ Licence:
|
|||||||
namespace pFlow
|
namespace pFlow
|
||||||
{
|
{
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
constexpr T getEpsilon()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
constexpr float getEpsilon<float>()
|
||||||
|
{
|
||||||
|
return 10*std::numeric_limits<float>::epsilon();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
constexpr double getEpsilon<double>()
|
||||||
|
{
|
||||||
|
return 10*std::numeric_limits<double>::epsilon();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class
|
class
|
||||||
stridedRange
|
stridedRange
|
||||||
@ -107,7 +126,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
bool isMember(T val, T epsilon = 0)const
|
bool isMember(T val, T epsilon = getEpsilon<T>())const
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!isInRange(val)) return false;
|
if(!isInRange(val)) return false;
|
||||||
@ -151,7 +170,7 @@ public:
|
|||||||
|
|
||||||
template<>
|
template<>
|
||||||
inline
|
inline
|
||||||
bool stridedRange<float>::isMember(float val, float epsilon)const
|
bool stridedRange<float>::isMember(float val, float epsilon )const
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!isInRange(val)) return false;
|
if(!isInRange(val)) return false;
|
||||||
@ -171,7 +190,7 @@ bool stridedRange<float>::isMember(float val, float epsilon)const
|
|||||||
|
|
||||||
template<>
|
template<>
|
||||||
inline
|
inline
|
||||||
bool stridedRange<double>::isMember(double val, double epsilon)const
|
bool stridedRange<double>::isMember(double val, double epsilon )const
|
||||||
{
|
{
|
||||||
/*if(!isInRange(val)) return false;
|
/*if(!isInRange(val)) return false;
|
||||||
if(const double dist = val-begin_; abs(remainder(dist,stride_)<= epsilon)) return true;
|
if(const double dist = val-begin_; abs(remainder(dist,stride_)<= epsilon)) return true;
|
||||||
|
131
src/phasicFlow/repository/systemControl/timeFolder.cpp
Normal file
131
src/phasicFlow/repository/systemControl/timeFolder.cpp
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
/*------------------------------- 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 "timeFolder.hpp"
|
||||||
|
#include "vocabs.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
bool pFlow::timeFolder::validateForPointStructure()
|
||||||
|
{
|
||||||
|
std::erase_if
|
||||||
|
(
|
||||||
|
folders_,
|
||||||
|
[this](const auto& folder)
|
||||||
|
{
|
||||||
|
return !containsPointStructure(folder.second);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pFlow::timeFolder::validFieldFile(const fileSystem &filePath) const
|
||||||
|
{
|
||||||
|
IOfileHeader fieldHeader(
|
||||||
|
objectFile(
|
||||||
|
filePath.fileName(),
|
||||||
|
filePath.dirPath(),
|
||||||
|
objectFile::READ_ALWAYS,
|
||||||
|
objectFile::WRITE_NEVER)
|
||||||
|
);
|
||||||
|
return fieldHeader.headerOk(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pFlow::timeFolder::validFieldFile
|
||||||
|
(
|
||||||
|
const fileSystem &filePath,
|
||||||
|
word &fieldName,
|
||||||
|
word &objectType
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
IOfileHeader fieldHeader(
|
||||||
|
objectFile(
|
||||||
|
filePath.fileName(),
|
||||||
|
filePath.dirPath(),
|
||||||
|
objectFile::READ_ALWAYS,
|
||||||
|
objectFile::WRITE_NEVER)
|
||||||
|
);
|
||||||
|
|
||||||
|
if(!fieldHeader.headerOk(true))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fieldName = fieldHeader.objectName();
|
||||||
|
objectType = fieldHeader.objectType();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pFlow::timeFolder::timeFolder
|
||||||
|
(
|
||||||
|
const systemControl& control,
|
||||||
|
bool pointStructureOnly
|
||||||
|
)
|
||||||
|
:
|
||||||
|
timeFolder(control.path(), pointStructureOnly)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
pFlow::timeFolder::timeFolder
|
||||||
|
(
|
||||||
|
const fileSystem& path,
|
||||||
|
bool pointStructureOnly
|
||||||
|
)
|
||||||
|
:
|
||||||
|
folders_(getTimeFolders(path)),
|
||||||
|
currentFolder_(folders_.begin())
|
||||||
|
{
|
||||||
|
if(pointStructureOnly)
|
||||||
|
{
|
||||||
|
validateForPointStructure();
|
||||||
|
}
|
||||||
|
currentFolder_ = folders_.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pFlow::timeFolder::containsPointStructure(const fileSystem &dirPath) const
|
||||||
|
{
|
||||||
|
auto files = containingFiles(dirPath);
|
||||||
|
for (const auto &file : files)
|
||||||
|
{
|
||||||
|
if (file.fileName() == pointStructureFile__)
|
||||||
|
{
|
||||||
|
return validFieldFile(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
pFlow::Map<pFlow::word, pFlow::word> pFlow::timeFolder::currentFolderFiles() const
|
||||||
|
{
|
||||||
|
Map<word,word> fileList;
|
||||||
|
if( folders_.empty()) return fileList;
|
||||||
|
|
||||||
|
auto files = containingFiles(folder());
|
||||||
|
word name, objectType;
|
||||||
|
for (const auto &file : files)
|
||||||
|
{
|
||||||
|
if(validFieldFile(file, name, objectType))
|
||||||
|
{
|
||||||
|
fileList.insertIf(name, objectType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fileList;
|
||||||
|
}
|
@ -27,38 +27,55 @@ Licence:
|
|||||||
namespace pFlow
|
namespace pFlow
|
||||||
{
|
{
|
||||||
|
|
||||||
Map<real, fileSystem> getTimeFolders(const fileSystem& path);
|
Map<timeValue, fileSystem> getTimeFolders(const fileSystem& path);
|
||||||
|
|
||||||
class timeFolder
|
class timeFolder
|
||||||
{
|
{
|
||||||
using timeList = Map<real, fileSystem>;
|
using timeList = Map<timeValue, fileSystem>;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
timeList folders_;
|
timeList folders_;
|
||||||
|
|
||||||
timeList::iterator currentFolder_;
|
timeList::iterator currentFolder_;
|
||||||
|
|
||||||
|
bool validateForPointStructure();
|
||||||
|
|
||||||
|
bool validFieldFile(const fileSystem& filePath)const;
|
||||||
|
|
||||||
|
bool validFieldFile(
|
||||||
|
const fileSystem& filePath,
|
||||||
|
word& fieldName,
|
||||||
|
word& objectType)const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
timeFolder(const systemControl& control )
|
timeFolder(const systemControl& control, bool pointStructureOnly = false );
|
||||||
:
|
|
||||||
timeFolder(control.path())
|
timeFolder(const fileSystem& path, bool pointStructureOnly = false);
|
||||||
{}
|
|
||||||
|
inline
|
||||||
timeFolder(const fileSystem& path)
|
bool empty()const
|
||||||
:
|
|
||||||
folders_(getTimeFolders(path)),
|
|
||||||
currentFolder_(folders_.begin())
|
|
||||||
{
|
{
|
||||||
|
return folders_.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
real time()const
|
inline
|
||||||
|
timeValue currentTime()const
|
||||||
{
|
{
|
||||||
|
if(folders_.empty()) return -1;
|
||||||
return currentFolder_->first;
|
return currentFolder_->first;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
timeValue nextTime()const
|
||||||
|
{
|
||||||
|
auto next = currentFolder_;
|
||||||
|
next++;
|
||||||
|
if(next == folders_.end()) return -1;
|
||||||
|
return next->first;
|
||||||
|
}
|
||||||
|
|
||||||
fileSystem folder()const
|
fileSystem folder()const
|
||||||
{
|
{
|
||||||
return currentFolder_->second;
|
return currentFolder_->second;
|
||||||
@ -81,6 +98,27 @@ public:
|
|||||||
return !finished();
|
return !finished();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool setTime(timeValue upto)
|
||||||
|
{
|
||||||
|
timeList::iterator orgFolder = currentFolder_;
|
||||||
|
|
||||||
|
rewind();
|
||||||
|
|
||||||
|
while(!finished())
|
||||||
|
{
|
||||||
|
auto t = currentTime();
|
||||||
|
if( equal(upto, t) || t>upto)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
(*this)++;
|
||||||
|
}
|
||||||
|
|
||||||
|
currentFolder_ = orgFolder;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
explicit operator bool()const
|
explicit operator bool()const
|
||||||
{
|
{
|
||||||
return !finished();
|
return !finished();
|
||||||
@ -102,30 +140,38 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
real startTime()const
|
timeValue startTime()const
|
||||||
{
|
{
|
||||||
|
if(folders_.empty()) return -1;
|
||||||
auto [t,f] = *folders_.begin();
|
auto [t,f] = *folders_.begin();
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
real endTime()const
|
timeValue endTime()const
|
||||||
{
|
{
|
||||||
|
if(folders_.empty()) return -1;
|
||||||
auto [t,f] = *(--folders_.end());
|
auto [t,f] = *(--folders_.end());
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool containsPointStructure(const fileSystem& dirPath)const;
|
||||||
|
|
||||||
|
/// Get the list of files in the current folder
|
||||||
|
/// the first element is file name and the second is the objectType
|
||||||
|
Map<word, word> currentFolderFiles()const;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline
|
inline
|
||||||
Map<real, fileSystem> getTimeFolders(const fileSystem& path)
|
Map<timeValue, fileSystem> getTimeFolders(const fileSystem& path)
|
||||||
{
|
{
|
||||||
Map<real, fileSystem> tFolders;
|
Map<timeValue, fileSystem> tFolders;
|
||||||
|
|
||||||
auto subDirs = subDirectories(path);
|
auto subDirs = subDirectories(path);
|
||||||
|
|
||||||
for(auto& subD: subDirs)
|
for(auto& subD: subDirs)
|
||||||
{
|
{
|
||||||
auto timeName = tailName(subD.wordPath(), '/');
|
auto timeName = tailName(subD.wordPath(), '/');
|
||||||
real TIME;
|
timeValue TIME;
|
||||||
if( auto success = readReal(timeName, TIME); success)
|
if( auto success = readReal(timeName, TIME); success)
|
||||||
{
|
{
|
||||||
if(!tFolders.insertIf(TIME, subD))
|
if(!tFolders.insertIf(TIME, subD))
|
||||||
|
@ -149,10 +149,10 @@ int main(int argc, char** argv )
|
|||||||
pFlow::wordList surfNames;
|
pFlow::wordList surfNames;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
Control.time().setTime(folders.time());
|
Control.time().setTime(folders.currentTime());
|
||||||
if( !validRange.isMember( folders.time() ) )continue;
|
if( !validRange.isMember( folders.currentTime() ) )continue;
|
||||||
|
|
||||||
pFlow::output<< "time: " << Cyan_Text( folders.time() )<<" s" <<pFlow::endl;
|
pFlow::output<< "time: " << Cyan_Text( folders.currentTime() )<<" s" <<pFlow::endl;
|
||||||
if(!noGoem)
|
if(!noGoem)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ int main(int argc, char** argv )
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
timeSeries.addTimeFile(surfNames, folders.time(), geomFileNames);
|
timeSeries.addTimeFile(surfNames, folders.currentTime(), geomFileNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!noParticle)
|
if(!noParticle)
|
||||||
@ -188,7 +188,7 @@ int main(int argc, char** argv )
|
|||||||
destFolderField,
|
destFolderField,
|
||||||
"particles",
|
"particles",
|
||||||
fields,
|
fields,
|
||||||
!pFlow::equal(folders.time(),static_cast<pFlow::real>(0.0)),
|
!pFlow::equal(folders.currentTime(),static_cast<pFlow::real>(0.0)),
|
||||||
fileName
|
fileName
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -197,7 +197,7 @@ int main(int argc, char** argv )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
timeSeries.addTimeFile("particles", folders.time(), fileName);
|
timeSeries.addTimeFile("particles", folders.currentTime(), fileName);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,16 +1,9 @@
|
|||||||
|
|
||||||
set(source_files
|
set(source_files
|
||||||
cellMapper.cpp
|
|
||||||
rectangleMesh.cpp
|
postprocessPhasicFlow.cpp
|
||||||
countField.cpp
|
postSimulationFieldsDataBase/postSimulationFieldsDataBase.cpp
|
||||||
countFields.cpp
|
|
||||||
postprocess.cpp
|
|
||||||
processField.cpp
|
|
||||||
ProcessFields.cpp
|
|
||||||
includeMask.cpp
|
|
||||||
IncludeMasks.cpp
|
|
||||||
postprocessPhasicFlow.cpp
|
|
||||||
)
|
)
|
||||||
set(link_lib phasicFlow Interaction Kokkos::kokkos Utilities)
|
set(link_lib phasicFlow PostprocessData Kokkos::kokkos Utilities)
|
||||||
|
|
||||||
pFlow_make_executable_install(postprocessPhasicFlow source_files link_lib)
|
pFlow_make_executable_install(postprocessPhasicFlow source_files link_lib)
|
||||||
|
@ -1,263 +0,0 @@
|
|||||||
/*------------------------------- phasicFlow ---------------------------------
|
|
||||||
O C enter of
|
|
||||||
O O E ngineering and
|
|
||||||
O O M ultiscale modeling of
|
|
||||||
OOOOOOO F luid flow
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Copyright (C): www.cemf.ir
|
|
||||||
email: hamid.r.norouzi AT gmail.com
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Licence:
|
|
||||||
This file is part of phasicFlow code. It is a free software for simulating
|
|
||||||
granular and multiphase flows. You can redistribute it and/or modify it under
|
|
||||||
the terms of GNU General Public License v3 or any other later versions.
|
|
||||||
|
|
||||||
phasicFlow is distributed to help others in their research in the field of
|
|
||||||
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
|
||||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef __IncludeMask_hpp__
|
|
||||||
#define __IncludeMask_hpp__
|
|
||||||
|
|
||||||
|
|
||||||
#include "includeMask.hpp"
|
|
||||||
|
|
||||||
namespace pFlow
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
struct greaterThanOp
|
|
||||||
{
|
|
||||||
TypeInfoNV("greaterThan");
|
|
||||||
|
|
||||||
inline
|
|
||||||
bool operator()(const T &compVal, const T &val) const {
|
|
||||||
return val > compVal; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
struct greaterThanEqOp
|
|
||||||
{
|
|
||||||
TypeInfoNV("greaterThanEq");
|
|
||||||
|
|
||||||
inline
|
|
||||||
bool operator()(const T &compVal, const T &val) const {
|
|
||||||
return val >= compVal; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
struct lessThanOp
|
|
||||||
{
|
|
||||||
TypeInfoNV("lessThan");
|
|
||||||
|
|
||||||
inline
|
|
||||||
bool operator()(const T &compVal, const T &val) const {
|
|
||||||
return val < compVal; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
struct lessThanEqOp
|
|
||||||
{
|
|
||||||
TypeInfoNV("lessThanEq");
|
|
||||||
|
|
||||||
inline
|
|
||||||
bool operator()(const T &compVal, const T &val) const {
|
|
||||||
return val <= compVal; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
struct equalOp
|
|
||||||
{
|
|
||||||
TypeInfoNV("equal");
|
|
||||||
|
|
||||||
inline
|
|
||||||
bool operator()(const T &compVal, const T &val) const {
|
|
||||||
return equal(val , compVal); }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
struct betweenOp
|
|
||||||
{
|
|
||||||
TypeInfoNV("between");
|
|
||||||
|
|
||||||
inline
|
|
||||||
bool operator()(const T &compVal1, const T &compVal2 ,const T &val) const {
|
|
||||||
return val>compVal1 && val<compVal2; }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
struct betweenEqOp
|
|
||||||
{
|
|
||||||
TypeInfoNV("betweenEq");
|
|
||||||
|
|
||||||
inline
|
|
||||||
bool operator()(const T &compVal1, const T &compVal2 ,const T &val) const {
|
|
||||||
return val>=compVal1 && val<=compVal2; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
struct allOp
|
|
||||||
{
|
|
||||||
TypeInfoNV("all");
|
|
||||||
|
|
||||||
inline
|
|
||||||
bool operator()() const {return true; }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<typename T, template<class> class Operator>
|
|
||||||
class compareOne
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
using opertorType = Operator<T>;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
T compValue_{};
|
|
||||||
opertorType operator_{};
|
|
||||||
public:
|
|
||||||
|
|
||||||
TypeInfoNV(Operator<T>::TYPENAME());
|
|
||||||
|
|
||||||
compareOne(const dictionary& dict)
|
|
||||||
:
|
|
||||||
compValue_(dict.getVal<T>("value"))
|
|
||||||
{}
|
|
||||||
|
|
||||||
bool operator()(const T& value)const
|
|
||||||
{
|
|
||||||
return operator_(compValue_, value);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T, template<class> class Operator>
|
|
||||||
class compareTwo
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
using opertorType = Operator<T>;
|
|
||||||
protected:
|
|
||||||
T compValue1_;
|
|
||||||
T compValue2_;
|
|
||||||
opertorType operator_{};
|
|
||||||
public:
|
|
||||||
|
|
||||||
TypeInfoNV(opertorType::TYPENAME());
|
|
||||||
|
|
||||||
compareTwo(const dictionary& dict)
|
|
||||||
:
|
|
||||||
compValue1_(dict.getVal<T>("value1")),
|
|
||||||
compValue2_(dict.getVal<T>("value2"))
|
|
||||||
{}
|
|
||||||
|
|
||||||
bool operator()(const T& value)const
|
|
||||||
{
|
|
||||||
return operator_(compValue1_, compValue2_, value);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T, typename Operator>
|
|
||||||
class compareZero
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
Operator operator_{};
|
|
||||||
public:
|
|
||||||
|
|
||||||
TypeInfoNV(Operator::TYPENAME());
|
|
||||||
compareZero(const dictionary& dict);
|
|
||||||
|
|
||||||
bool operator()(const T& value) const
|
|
||||||
{
|
|
||||||
return operator_();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T, typename Operator>
|
|
||||||
class IncludeMask
|
|
||||||
:
|
|
||||||
public includeMask
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
|
|
||||||
Operator operator_;
|
|
||||||
|
|
||||||
uniquePtr<pointField_H<T>> fieldPtr_;
|
|
||||||
|
|
||||||
hostViewType1D<T> field_;
|
|
||||||
public:
|
|
||||||
|
|
||||||
TypeInfoTemplate12("IncludeMask", T, Operator);
|
|
||||||
|
|
||||||
IncludeMask(
|
|
||||||
const dictionary& dict,
|
|
||||||
const word& opType,
|
|
||||||
readFromTimeFolder& timeFolder)
|
|
||||||
:
|
|
||||||
includeMask(dict, opType, timeFolder),
|
|
||||||
operator_(dict),
|
|
||||||
fieldPtr_(timeFolder.readPointField_H<T>(this->fieldName())),
|
|
||||||
field_(fieldPtr_().hostView())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
add_vCtor(
|
|
||||||
includeMask,
|
|
||||||
IncludeMask,
|
|
||||||
dictionary);
|
|
||||||
|
|
||||||
bool isIncluded(int32 n)const override
|
|
||||||
{
|
|
||||||
return operator_(field_[n]);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 size()const override
|
|
||||||
{
|
|
||||||
return field_.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
class IncludeMask<T,allOp<T>>
|
|
||||||
:
|
|
||||||
public includeMask
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
TypeInfoTemplate12("IncludeMask", T, allOp<int8>);
|
|
||||||
|
|
||||||
IncludeMask(
|
|
||||||
const dictionary& dict,
|
|
||||||
const word& opType,
|
|
||||||
readFromTimeFolder& timeFolder)
|
|
||||||
:
|
|
||||||
includeMask(dict, opType, timeFolder)
|
|
||||||
{}
|
|
||||||
|
|
||||||
add_vCtor(
|
|
||||||
includeMask,
|
|
||||||
IncludeMask,
|
|
||||||
dictionary);
|
|
||||||
|
|
||||||
bool isIncluded(int32 n)const override
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 size()const override
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} // pFlow
|
|
||||||
|
|
||||||
#endif //__IncludeMask_hpp__
|
|
||||||
|
|
||||||
|
|
@ -1,80 +0,0 @@
|
|||||||
/*------------------------------- phasicFlow ---------------------------------
|
|
||||||
O C enter of
|
|
||||||
O O E ngineering and
|
|
||||||
O O M ultiscale modeling of
|
|
||||||
OOOOOOO F luid flow
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Copyright (C): www.cemf.ir
|
|
||||||
email: hamid.r.norouzi AT gmail.com
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Licence:
|
|
||||||
This file is part of phasicFlow code. It is a free software for simulating
|
|
||||||
granular and multiphase flows. You can redistribute it and/or modify it under
|
|
||||||
the terms of GNU General Public License v3 or any other later versions.
|
|
||||||
|
|
||||||
phasicFlow is distributed to help others in their research in the field of
|
|
||||||
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
|
||||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "IncludeMask.hpp"
|
|
||||||
|
|
||||||
// real
|
|
||||||
template class pFlow::IncludeMask<pFlow::real, pFlow::compareOne<pFlow::real, pFlow::lessThanOp> >;
|
|
||||||
template class pFlow::IncludeMask<pFlow::real, pFlow::compareOne<pFlow::real, pFlow::lessThanEqOp> >;
|
|
||||||
|
|
||||||
template class pFlow::IncludeMask<pFlow::real, pFlow::compareOne<pFlow::real, pFlow::greaterThanOp> >;
|
|
||||||
template class pFlow::IncludeMask<pFlow::real, pFlow::compareOne<pFlow::real, pFlow::greaterThanEqOp> >;
|
|
||||||
|
|
||||||
template class pFlow::IncludeMask<pFlow::real, pFlow::compareOne<pFlow::real, pFlow::equalOp> >;
|
|
||||||
|
|
||||||
template class pFlow::IncludeMask<pFlow::real, pFlow::compareTwo<pFlow::real, pFlow::betweenOp> >;
|
|
||||||
template class pFlow::IncludeMask<pFlow::real, pFlow::compareTwo<pFlow::real, pFlow::betweenEqOp> >;
|
|
||||||
|
|
||||||
template class pFlow::IncludeMask<pFlow::real, pFlow::allOp<pFlow::real>>;
|
|
||||||
|
|
||||||
// realx3
|
|
||||||
template class pFlow::IncludeMask<pFlow::realx3, pFlow::compareOne<pFlow::realx3, pFlow::lessThanOp> >;
|
|
||||||
template class pFlow::IncludeMask<pFlow::realx3, pFlow::compareOne<pFlow::realx3, pFlow::lessThanEqOp> >;
|
|
||||||
|
|
||||||
template class pFlow::IncludeMask<pFlow::realx3, pFlow::compareOne<pFlow::realx3, pFlow::greaterThanOp> >;
|
|
||||||
template class pFlow::IncludeMask<pFlow::realx3, pFlow::compareOne<pFlow::realx3, pFlow::greaterThanEqOp> >;
|
|
||||||
|
|
||||||
template class pFlow::IncludeMask<pFlow::realx3, pFlow::compareOne<pFlow::realx3, pFlow::equalOp> >;
|
|
||||||
|
|
||||||
template class pFlow::IncludeMask<pFlow::realx3, pFlow::compareTwo<pFlow::realx3, pFlow::betweenOp> >;
|
|
||||||
template class pFlow::IncludeMask<pFlow::realx3, pFlow::compareTwo<pFlow::realx3, pFlow::betweenEqOp> >;
|
|
||||||
|
|
||||||
template class pFlow::IncludeMask<pFlow::realx3, pFlow::allOp<pFlow::realx3>>;
|
|
||||||
|
|
||||||
// int32
|
|
||||||
template class pFlow::IncludeMask<pFlow::int32, pFlow::compareOne<pFlow::int32, pFlow::lessThanOp> >;
|
|
||||||
template class pFlow::IncludeMask<pFlow::int32, pFlow::compareOne<pFlow::int32, pFlow::lessThanEqOp> >;
|
|
||||||
|
|
||||||
template class pFlow::IncludeMask<pFlow::int32, pFlow::compareOne<pFlow::int32, pFlow::greaterThanOp> >;
|
|
||||||
template class pFlow::IncludeMask<pFlow::int32, pFlow::compareOne<pFlow::int32, pFlow::greaterThanEqOp> >;
|
|
||||||
|
|
||||||
template class pFlow::IncludeMask<pFlow::int32, pFlow::compareOne<pFlow::int32, pFlow::equalOp> >;
|
|
||||||
|
|
||||||
template class pFlow::IncludeMask<pFlow::int32, pFlow::compareTwo<pFlow::int32, pFlow::betweenOp> >;
|
|
||||||
template class pFlow::IncludeMask<pFlow::int32, pFlow::compareTwo<pFlow::int32, pFlow::betweenEqOp> >;
|
|
||||||
|
|
||||||
template class pFlow::IncludeMask<pFlow::int32, pFlow::allOp<pFlow::int32>>;
|
|
||||||
|
|
||||||
// in64
|
|
||||||
template class pFlow::IncludeMask<pFlow::int64, pFlow::compareOne<pFlow::int64, pFlow::lessThanOp> >;
|
|
||||||
template class pFlow::IncludeMask<pFlow::int64, pFlow::compareOne<pFlow::int64, pFlow::lessThanEqOp> >;
|
|
||||||
|
|
||||||
template class pFlow::IncludeMask<pFlow::int64, pFlow::compareOne<pFlow::int64, pFlow::greaterThanOp> >;
|
|
||||||
template class pFlow::IncludeMask<pFlow::int64, pFlow::compareOne<pFlow::int64, pFlow::greaterThanEqOp> >;
|
|
||||||
|
|
||||||
template class pFlow::IncludeMask<pFlow::int64, pFlow::compareOne<pFlow::int64, pFlow::equalOp> >;
|
|
||||||
|
|
||||||
template class pFlow::IncludeMask<pFlow::int64, pFlow::compareTwo<pFlow::int64, pFlow::betweenOp> >;
|
|
||||||
template class pFlow::IncludeMask<pFlow::int64, pFlow::compareTwo<pFlow::int64, pFlow::betweenEqOp> >;
|
|
||||||
|
|
||||||
template class pFlow::IncludeMask<pFlow::int64, pFlow::allOp<pFlow::int64>>;
|
|
||||||
|
|
||||||
|
|
||||||
template class pFlow::IncludeMask<pFlow::int8, pFlow::allOp<pFlow::int8>>;
|
|
@ -1,179 +0,0 @@
|
|||||||
/*------------------------------- phasicFlow ---------------------------------
|
|
||||||
O C enter of
|
|
||||||
O O E ngineering and
|
|
||||||
O O M ultiscale modeling of
|
|
||||||
OOOOOOO F luid flow
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Copyright (C): www.cemf.ir
|
|
||||||
email: hamid.r.norouzi AT gmail.com
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Licence:
|
|
||||||
This file is part of phasicFlow code. It is a free software for simulating
|
|
||||||
granular and multiphase flows. You can redistribute it and/or modify it under
|
|
||||||
the terms of GNU General Public License v3 or any other later versions.
|
|
||||||
|
|
||||||
phasicFlow is distributed to help others in their research in the field of
|
|
||||||
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
|
||||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef __ProcessField_hpp__
|
|
||||||
#define __ProcessField_hpp__
|
|
||||||
|
|
||||||
|
|
||||||
#include "processField.hpp"
|
|
||||||
#include "rectMeshFields.hpp"
|
|
||||||
#include "twoPartEntry.hpp"
|
|
||||||
#include "fieldOperations.hpp"
|
|
||||||
#include "rectMeshFieldToVTK.hpp"
|
|
||||||
|
|
||||||
namespace pFlow
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
class ProcessField
|
|
||||||
:
|
|
||||||
public processField
|
|
||||||
{
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
uniquePtr<pointField_H<T>> field_;
|
|
||||||
|
|
||||||
|
|
||||||
rectMeshField_H<T> processedField_;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
TypeInfoTemplate11("ProcessField", T);
|
|
||||||
|
|
||||||
ProcessField(
|
|
||||||
const dictionary& dict,
|
|
||||||
pointRectCell& pToCell,
|
|
||||||
repository& rep)
|
|
||||||
:
|
|
||||||
processField(dict, pToCell, rep),
|
|
||||||
field_(
|
|
||||||
this->isUniform()?
|
|
||||||
timeFolder().createUniformPointField_H(this->fieldName(), getUniformValue(), false ):
|
|
||||||
timeFolder().readPointField_H<T>(this->fieldName())
|
|
||||||
),
|
|
||||||
processedField_
|
|
||||||
(
|
|
||||||
mesh(),
|
|
||||||
processedFieldName(),
|
|
||||||
T{}
|
|
||||||
)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
add_vCtor(
|
|
||||||
processField,
|
|
||||||
ProcessField,
|
|
||||||
dictionary);
|
|
||||||
|
|
||||||
|
|
||||||
T getUniformValue()const
|
|
||||||
{
|
|
||||||
const dataEntry& entry = dict().dataEntryRef("field");
|
|
||||||
twoPartEntry tpEntry(entry);
|
|
||||||
return tpEntry.secondPartVal<T>();
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool process() override
|
|
||||||
{
|
|
||||||
|
|
||||||
const includeMask& incMask = includeMask_();
|
|
||||||
|
|
||||||
auto numeratorPtr = sumMaksOp( field_() , this->pointToCell(), incMask);
|
|
||||||
uniquePtr<rectMeshField_H<real>> denomeratorPtr;
|
|
||||||
|
|
||||||
if(operation() == "sum")
|
|
||||||
{
|
|
||||||
denomeratorPtr = makeUnique<rectMeshField_H<real>>(this->mesh(), static_cast<real>(1.0));
|
|
||||||
|
|
||||||
}else if(operation() == "average")
|
|
||||||
{
|
|
||||||
|
|
||||||
pointField_H<real> oneFld(
|
|
||||||
objectFile
|
|
||||||
(
|
|
||||||
"oneField",
|
|
||||||
"",
|
|
||||||
objectFile::READ_NEVER,
|
|
||||||
objectFile::WRITE_NEVER
|
|
||||||
),
|
|
||||||
const_cast<pointStructure&>(field_().pStruct()),
|
|
||||||
static_cast<real>(1.0),
|
|
||||||
static_cast<real>(1.0)
|
|
||||||
);
|
|
||||||
|
|
||||||
denomeratorPtr = sumOp(oneFld, this->pointToCell());
|
|
||||||
|
|
||||||
}else if(operation() == "averageMask")
|
|
||||||
{
|
|
||||||
//pointField_H<real> oneFld(field_().pStruct(), static_cast<real>(1.0), static_cast<real>(1.0));
|
|
||||||
pointField_H<real> oneFld(
|
|
||||||
objectFile
|
|
||||||
(
|
|
||||||
"oneField",
|
|
||||||
"",
|
|
||||||
objectFile::READ_NEVER,
|
|
||||||
objectFile::WRITE_NEVER
|
|
||||||
),
|
|
||||||
const_cast<pointStructure&>(field_().pStruct()),
|
|
||||||
static_cast<real>(1.0),
|
|
||||||
static_cast<real>(1.0)
|
|
||||||
);
|
|
||||||
|
|
||||||
denomeratorPtr = sumMaksOp(oneFld, this->pointToCell(), incMask);
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fatalErrorInFunction<<"operation is not known: "<< operation()<<endl;
|
|
||||||
fatalExit;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto& numerator = numeratorPtr();
|
|
||||||
auto& denomerator = denomeratorPtr();
|
|
||||||
|
|
||||||
for(int32 i=0; i<this->mesh().nx(); i++ )
|
|
||||||
{
|
|
||||||
for(int32 j=0; j<this->mesh().ny(); j++ )
|
|
||||||
{
|
|
||||||
for(int32 k=0; k<this->mesh().nz(); k++ )
|
|
||||||
{
|
|
||||||
if( pointToCell().nPointInCell(i,j,k)>= threshold() )
|
|
||||||
{
|
|
||||||
processedField_(i,j,k) = numerator(i,j,k)/denomerator(i,j,k);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
processedField_(i,j,k) = T{};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool writeToVTK(iOstream& os)const override
|
|
||||||
{
|
|
||||||
return convertRectMeshField(os, processedField_);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} // pFlow
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif //__ProcessField_hpp__
|
|
@ -1,33 +0,0 @@
|
|||||||
/*------------------------------- phasicFlow ---------------------------------
|
|
||||||
O C enter of
|
|
||||||
O O E ngineering and
|
|
||||||
O O M ultiscale modeling of
|
|
||||||
OOOOOOO F luid flow
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Copyright (C): www.cemf.ir
|
|
||||||
email: hamid.r.norouzi AT gmail.com
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Licence:
|
|
||||||
This file is part of phasicFlow code. It is a free software for simulating
|
|
||||||
granular and multiphase flows. You can redistribute it and/or modify it under
|
|
||||||
the terms of GNU General Public License v3 or any other later versions.
|
|
||||||
|
|
||||||
phasicFlow is distributed to help others in their research in the field of
|
|
||||||
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
|
||||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "ProcessField.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
template class pFlow::ProcessField<pFlow::int8>;
|
|
||||||
|
|
||||||
template class pFlow::ProcessField<pFlow::int32>;
|
|
||||||
|
|
||||||
template class pFlow::ProcessField<pFlow::int64>;
|
|
||||||
|
|
||||||
template class pFlow::ProcessField<pFlow::real>;
|
|
||||||
|
|
||||||
template class pFlow::ProcessField<pFlow::realx3>;
|
|
||||||
|
|
@ -1,91 +0,0 @@
|
|||||||
/*------------------------------- phasicFlow ---------------------------------
|
|
||||||
O C enter of
|
|
||||||
O O E ngineering and
|
|
||||||
O O M ultiscale modeling of
|
|
||||||
OOOOOOO F luid flow
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Copyright (C): www.cemf.ir
|
|
||||||
email: hamid.r.norouzi AT gmail.com
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Licence:
|
|
||||||
This file is part of phasicFlow code. It is a free software for simulating
|
|
||||||
granular and multiphase flows. You can redistribute it and/or modify it under
|
|
||||||
the terms of GNU General Public License v3 or any other later versions.
|
|
||||||
|
|
||||||
phasicFlow is distributed to help others in their research in the field of
|
|
||||||
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
|
||||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "cellMapper.hpp"
|
|
||||||
//#include "cellMapperKernels.hpp"
|
|
||||||
#include "streams.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
void pFlow::cellMapper::allocateArrays(rangeU32 nextRng)
|
|
||||||
{
|
|
||||||
checkAllocateNext(nextRng);
|
|
||||||
nullifyNext(nextRng);
|
|
||||||
reallocFill(head_, domainCells_.nx(), domainCells_.ny(), domainCells_.nz(), NoPos);
|
|
||||||
}
|
|
||||||
|
|
||||||
void pFlow::cellMapper::checkAllocateNext(rangeU32 nextRng)
|
|
||||||
{
|
|
||||||
|
|
||||||
auto newCap = nextRng.end();
|
|
||||||
|
|
||||||
if( nextCapacity_ < newCap)
|
|
||||||
{
|
|
||||||
nextCapacity_ = newCap;
|
|
||||||
reallocNoInit(next_, nextCapacity_);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void pFlow::cellMapper::nullifyHead()
|
|
||||||
{
|
|
||||||
fill(head_, NoPos);
|
|
||||||
}
|
|
||||||
|
|
||||||
void pFlow::cellMapper::nullifyNext(rangeU32 nextRng)
|
|
||||||
{
|
|
||||||
fill(next_, nextRng, NoPos);
|
|
||||||
}
|
|
||||||
|
|
||||||
pFlow::cellMapper::cellMapper(
|
|
||||||
const rectangleMesh& rectMesh,
|
|
||||||
const hostViewType1D<realx3>& pointPos,
|
|
||||||
const pFlagTypeHost& flags
|
|
||||||
)
|
|
||||||
:
|
|
||||||
domainCells_(rectMesh)
|
|
||||||
{
|
|
||||||
|
|
||||||
allocateArrays(flags.activeRange());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool pFlow::cellMapper::build
|
|
||||||
(
|
|
||||||
const hostViewType1D<realx3>& pointPos,
|
|
||||||
const pFlagTypeHost & flags
|
|
||||||
)
|
|
||||||
{
|
|
||||||
auto aRange = flags.activeRange();
|
|
||||||
|
|
||||||
checkAllocateNext(aRange);
|
|
||||||
nullifyHead();
|
|
||||||
nullifyNext(aRange);
|
|
||||||
int32x3 ind;
|
|
||||||
for(uint32 i=aRange.start(); i<aRange.end(); i++)
|
|
||||||
{
|
|
||||||
if( domainCells_.isInsideIndex(pointPos[i], ind) )
|
|
||||||
{
|
|
||||||
next_[i] = head_(ind.x(), ind.y(), ind.z());
|
|
||||||
head_(ind.x(), ind.y(), ind.z()) = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,137 +0,0 @@
|
|||||||
/*------------------------------- phasicFlow ---------------------------------
|
|
||||||
O C enter of
|
|
||||||
O O E ngineering and
|
|
||||||
O O M ultiscale modeling of
|
|
||||||
OOOOOOO F luid flow
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Copyright (C): www.cemf.ir
|
|
||||||
email: hamid.r.norouzi AT gmail.com
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Licence:
|
|
||||||
This file is part of phasicFlow code. It is a free software for simulating
|
|
||||||
granular and multiphase flows. You can redistribute it and/or modify it under
|
|
||||||
the terms of GNU General Public License v3 or any other later versions.
|
|
||||||
|
|
||||||
phasicFlow is distributed to help others in their research in the field of
|
|
||||||
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
|
||||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef __cellMapper_hpp__
|
|
||||||
#define __cellMapper_hpp__
|
|
||||||
|
|
||||||
#include "phasicFlowKokkos.hpp"
|
|
||||||
#include "pointFlag.hpp"
|
|
||||||
#include "rectangleMesh.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
namespace pFlow
|
|
||||||
{
|
|
||||||
|
|
||||||
class cellMapper
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
using HeadType = hostViewType3D<uint32>;
|
|
||||||
|
|
||||||
using NextType = hostViewType1D<uint32>;
|
|
||||||
|
|
||||||
|
|
||||||
static constexpr uint32 NoPos = 0xFFFFFFFF;
|
|
||||||
|
|
||||||
class CellIterator
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
HeadType head_;
|
|
||||||
|
|
||||||
NextType next_;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
CellIterator(const HeadType& head, const NextType& next)
|
|
||||||
:
|
|
||||||
head_(head),
|
|
||||||
next_(next)
|
|
||||||
{}
|
|
||||||
|
|
||||||
static constexpr uint32 NoPos = 0xFFFFFFFF;
|
|
||||||
|
|
||||||
INLINE_FUNCTION_H
|
|
||||||
int32x3 numCells()const {
|
|
||||||
return int32x3(head_.extent(0), head_.extent(1), head_.extent(2));}
|
|
||||||
|
|
||||||
INLINE_FUNCTION_H
|
|
||||||
uint32 start(int32 i, int32 j, int32 k)const {
|
|
||||||
return head_(i,j,k); }
|
|
||||||
|
|
||||||
INLINE_FUNCTION_H
|
|
||||||
uint32 getNext(uint32 n)const {
|
|
||||||
if(n == NoPos ) return NoPos;
|
|
||||||
return next_(n); }
|
|
||||||
|
|
||||||
INLINE_FUNCTION_H
|
|
||||||
uint32 next(uint32 n)const{
|
|
||||||
return next_(n);}
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
const rectangleMesh& domainCells_;
|
|
||||||
|
|
||||||
HeadType head_{"NBS::head",1,1,1};
|
|
||||||
|
|
||||||
NextType next_{"NBS::next", 1};
|
|
||||||
|
|
||||||
uint32 nextCapacity_ = 0;
|
|
||||||
|
|
||||||
void allocateArrays(rangeU32 nextRng);
|
|
||||||
|
|
||||||
void checkAllocateNext(rangeU32 nextRng);
|
|
||||||
|
|
||||||
void nullifyHead();
|
|
||||||
|
|
||||||
void nullifyNext(rangeU32 nextRng);
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
TypeInfoNV("cellMapper");
|
|
||||||
|
|
||||||
|
|
||||||
cellMapper(
|
|
||||||
const rectangleMesh& rectMesh,
|
|
||||||
const hostViewType1D<realx3>& pointPos,
|
|
||||||
const pFlagTypeHost& flags);
|
|
||||||
|
|
||||||
INLINE_FUNCTION_HD
|
|
||||||
cellMapper(const cellMapper&) = default;
|
|
||||||
|
|
||||||
INLINE_FUNCTION_HD
|
|
||||||
cellMapper(cellMapper&&) = default;
|
|
||||||
|
|
||||||
INLINE_FUNCTION_HD
|
|
||||||
cellMapper& operator = (const cellMapper&) = default;
|
|
||||||
|
|
||||||
INLINE_FUNCTION_HD
|
|
||||||
cellMapper& operator = (cellMapper&&) = default;
|
|
||||||
|
|
||||||
INLINE_FUNCTION_HD
|
|
||||||
~cellMapper()=default;
|
|
||||||
|
|
||||||
//// - Methods
|
|
||||||
|
|
||||||
auto getCellIterator()const
|
|
||||||
{
|
|
||||||
return CellIterator(head_, next_);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool build(
|
|
||||||
const hostViewType1D<realx3>& pointPos,
|
|
||||||
const pFlagTypeHost& flags);
|
|
||||||
};
|
|
||||||
|
|
||||||
} // pFlow
|
|
||||||
|
|
||||||
#endif // __cellMapper_hpp__
|
|
@ -1,94 +0,0 @@
|
|||||||
/*------------------------------- phasicFlow ---------------------------------
|
|
||||||
O C enter of
|
|
||||||
O O E ngineering and
|
|
||||||
O O M ultiscale modeling of
|
|
||||||
OOOOOOO F luid flow
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Copyright (C): www.cemf.ir
|
|
||||||
email: hamid.r.norouzi AT gmail.com
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Licence:
|
|
||||||
This file is part of phasicFlow code. It is a free software for simulating
|
|
||||||
granular and multiphase flows. You can redistribute it and/or modify it under
|
|
||||||
the terms of GNU General Public License v3 or any other later versions.
|
|
||||||
|
|
||||||
phasicFlow is distributed to help others in their research in the field of
|
|
||||||
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
|
||||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "countField.hpp"
|
|
||||||
#include "repository.hpp"
|
|
||||||
#include "twoPartEntry.hpp"
|
|
||||||
|
|
||||||
bool pFlow::countField::getFieldType(
|
|
||||||
const dictionary& dict,
|
|
||||||
readFromTimeFolder& timeFolder,
|
|
||||||
word& fieldName,
|
|
||||||
word& fieldType)
|
|
||||||
{
|
|
||||||
if(dict.containsDataEntry("field"))
|
|
||||||
{
|
|
||||||
const dataEntry& entry = dict.dataEntryRef("field");
|
|
||||||
|
|
||||||
if( isTwoPartEntry(entry))
|
|
||||||
{
|
|
||||||
twoPartEntry tpEntry(entry);
|
|
||||||
fieldName = "uniformField";
|
|
||||||
fieldType = tpEntry.firstPart();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fieldName = dict.getVal<word>("field");
|
|
||||||
if( !timeFolder.pointFieldFileGetType(fieldName, fieldType) )
|
|
||||||
{
|
|
||||||
fatalErrorInFunction<<"error in reading field type from file "<< fieldName<<
|
|
||||||
"in folder "<< timeFolder.path()<<endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fatalErrorInFunction<< "dictionary "<< dict.globalName()<<
|
|
||||||
"does not contain field keyword"<<endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
pFlow::countField::countField(const dictionary& dict, repository& rep)
|
|
||||||
:
|
|
||||||
dict_(dict),
|
|
||||||
timeFolder_(rep)
|
|
||||||
{
|
|
||||||
|
|
||||||
word includeMaskType = dict_.getVal<word>("includeMask");
|
|
||||||
|
|
||||||
auto& incDict = dict_.subDictOrCreate(includeMaskType+"Info");
|
|
||||||
|
|
||||||
includeMask_ = includeMask::create(incDict, includeMaskType, timeFolder_);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool pFlow::countField::process(uint32& countedValue)
|
|
||||||
{
|
|
||||||
auto& incMask = includeMask_();
|
|
||||||
|
|
||||||
countedValue = 0;
|
|
||||||
uint32 n = incMask.size();
|
|
||||||
|
|
||||||
for(uint32 i=0; i<n; i++)
|
|
||||||
{
|
|
||||||
if( incMask(i) )
|
|
||||||
{
|
|
||||||
countedValue++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
@ -1,102 +0,0 @@
|
|||||||
/*------------------------------- phasicFlow ---------------------------------
|
|
||||||
O C enter of
|
|
||||||
O O E ngineering and
|
|
||||||
O O M ultiscale modeling of
|
|
||||||
OOOOOOO F luid flow
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Copyright (C): www.cemf.ir
|
|
||||||
email: hamid.r.norouzi AT gmail.com
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Licence:
|
|
||||||
This file is part of phasicFlow code. It is a free software for simulating
|
|
||||||
granular and multiphase flows. You can redistribute it and/or modify it under
|
|
||||||
the terms of GNU General Public License v3 or any other later versions.
|
|
||||||
|
|
||||||
phasicFlow is distributed to help others in their research in the field of
|
|
||||||
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
|
||||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
#ifndef __countField_hpp__
|
|
||||||
#define __countField_hpp__
|
|
||||||
|
|
||||||
|
|
||||||
#include "virtualConstructor.hpp"
|
|
||||||
#include "dictionary.hpp"
|
|
||||||
#include "readFromTimeFolder.hpp"
|
|
||||||
#include "includeMask.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
namespace pFlow
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
class repository;
|
|
||||||
|
|
||||||
class countField
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
|
|
||||||
dictionary dict_;
|
|
||||||
|
|
||||||
mutable readFromTimeFolder timeFolder_;
|
|
||||||
|
|
||||||
uniquePtr<includeMask> includeMask_ = nullptr;
|
|
||||||
|
|
||||||
bool static getFieldType(
|
|
||||||
const dictionary& dict,
|
|
||||||
readFromTimeFolder& timeFolder,
|
|
||||||
word& fieldName,
|
|
||||||
word& fieldType);
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
TypeInfo("countField");
|
|
||||||
|
|
||||||
countField(const dictionary& dict, repository& rep);
|
|
||||||
|
|
||||||
|
|
||||||
auto& dict()
|
|
||||||
{
|
|
||||||
return dict_;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto& dict()const
|
|
||||||
{
|
|
||||||
return dict_;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto& timeFolderRepository()
|
|
||||||
{
|
|
||||||
return timeFolder_.db();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
auto& timeFolder()
|
|
||||||
{
|
|
||||||
return timeFolder_;
|
|
||||||
}
|
|
||||||
|
|
||||||
word variableName()const
|
|
||||||
{
|
|
||||||
return dict_.name();
|
|
||||||
}
|
|
||||||
|
|
||||||
// requires a class to read pointField from timefolder
|
|
||||||
bool process(uint32& countedValue);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//virtual bool writeToFile(iOstream& is) const = 0;
|
|
||||||
|
|
||||||
/*static
|
|
||||||
uniquePtr<countField> create(
|
|
||||||
const dictionary& dict,
|
|
||||||
repository& rep);*/
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif //__countField_hpp__
|
|
@ -1,53 +0,0 @@
|
|||||||
/*------------------------------- phasicFlow ---------------------------------
|
|
||||||
O C enter of
|
|
||||||
O O E ngineering and
|
|
||||||
O O M ultiscale modeling of
|
|
||||||
OOOOOOO F luid flow
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Copyright (C): www.cemf.ir
|
|
||||||
email: hamid.r.norouzi AT gmail.com
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Licence:
|
|
||||||
This file is part of phasicFlow code. It is a free software for simulating
|
|
||||||
granular and multiphase flows. You can redistribute it and/or modify it under
|
|
||||||
the terms of GNU General Public License v3 or any other later versions.
|
|
||||||
|
|
||||||
phasicFlow is distributed to help others in their research in the field of
|
|
||||||
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
|
||||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "countFields.hpp"
|
|
||||||
#include "countField.hpp"
|
|
||||||
#include "repository.hpp"
|
|
||||||
#include "includeMask.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
pFlow::countFields::countFields(const dictionary& dict)
|
|
||||||
:
|
|
||||||
dict_(dict),
|
|
||||||
variableNames_(dict.dictionaryKeywords()),
|
|
||||||
countedValues_(variableNames_.size(), 0u)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool pFlow::countFields::process(repository& rep)
|
|
||||||
{
|
|
||||||
uint32List counted;
|
|
||||||
|
|
||||||
for(const auto& name: variableNames_)
|
|
||||||
{
|
|
||||||
const dictionary& varDict = dict_.subDict(name);
|
|
||||||
uint32 count;
|
|
||||||
countField cField(varDict, rep);
|
|
||||||
cField.process(count);
|
|
||||||
counted.push_back(count);
|
|
||||||
}
|
|
||||||
|
|
||||||
countedValues_ = counted;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
@ -1,77 +0,0 @@
|
|||||||
/*------------------------------- phasicFlow ---------------------------------
|
|
||||||
O C enter of
|
|
||||||
O O E ngineering and
|
|
||||||
O O M ultiscale modeling of
|
|
||||||
OOOOOOO F luid flow
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Copyright (C): www.cemf.ir
|
|
||||||
email: hamid.r.norouzi AT gmail.com
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Licence:
|
|
||||||
This file is part of phasicFlow code. It is a free software for simulating
|
|
||||||
granular and multiphase flows. You can redistribute it and/or modify it under
|
|
||||||
the terms of GNU General Public License v3 or any other later versions.
|
|
||||||
|
|
||||||
phasicFlow is distributed to help others in their research in the field of
|
|
||||||
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
|
||||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
#ifndef __countFields_hpp__
|
|
||||||
#define __countFields_hpp__
|
|
||||||
|
|
||||||
|
|
||||||
#include "dictionary.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
namespace pFlow
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
class repository;
|
|
||||||
|
|
||||||
class countFields
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
|
|
||||||
dictionary dict_;
|
|
||||||
|
|
||||||
wordList variableNames_;
|
|
||||||
|
|
||||||
uint32List countedValues_;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
TypeInfo("countFields");
|
|
||||||
|
|
||||||
countFields(const dictionary& dict);
|
|
||||||
|
|
||||||
auto& dict()
|
|
||||||
{
|
|
||||||
return dict_;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto& dict()const
|
|
||||||
{
|
|
||||||
return dict_;
|
|
||||||
}
|
|
||||||
|
|
||||||
const wordList& variableNames()const
|
|
||||||
{
|
|
||||||
return variableNames_;
|
|
||||||
}
|
|
||||||
const uint32List& countedValues()const
|
|
||||||
{
|
|
||||||
return countedValues_;
|
|
||||||
}
|
|
||||||
|
|
||||||
// requires a class to read pointField from timefolder
|
|
||||||
bool process(repository& rep);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif //__countFields_hpp__
|
|
@ -1,112 +0,0 @@
|
|||||||
/*------------------------------- phasicFlow ---------------------------------
|
|
||||||
O C enter of
|
|
||||||
O O E ngineering and
|
|
||||||
O O M ultiscale modeling of
|
|
||||||
OOOOOOO F luid flow
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Copyright (C): www.cemf.ir
|
|
||||||
email: hamid.r.norouzi AT gmail.com
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Licence:
|
|
||||||
This file is part of phasicFlow code. It is a free software for simulating
|
|
||||||
granular and multiphase flows. You can redistribute it and/or modify it under
|
|
||||||
the terms of GNU General Public License v3 or any other later versions.
|
|
||||||
|
|
||||||
phasicFlow is distributed to help others in their research in the field of
|
|
||||||
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
|
||||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef __fieldOperations_hpp__
|
|
||||||
#define __fieldOperations_hpp__
|
|
||||||
|
|
||||||
#include "rectMeshFields.hpp"
|
|
||||||
#include "pointFields.hpp"
|
|
||||||
#include "pointRectCell.hpp"
|
|
||||||
#include "includeMask.hpp"
|
|
||||||
|
|
||||||
namespace pFlow
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
uniquePtr<rectMeshField_H<T>> sumOp( pointField_H<T>& field, pointRectCell& pointToCell)
|
|
||||||
{
|
|
||||||
// create field
|
|
||||||
auto& mesh = pointToCell.mesh();
|
|
||||||
auto iterator = pointToCell.getCellIterator();
|
|
||||||
auto f = field.deviceView();
|
|
||||||
|
|
||||||
auto resultsPtr = makeUnique<rectMeshField_H<T>>(mesh, T(0));
|
|
||||||
auto& results = resultsPtr();
|
|
||||||
for(int32 i=0; i<mesh.nx(); i++)
|
|
||||||
{
|
|
||||||
for(int32 j=0; j<mesh.ny(); j++)
|
|
||||||
{
|
|
||||||
for(int32 k=0; k<mesh.nz(); k++)
|
|
||||||
{
|
|
||||||
uint32 n = iterator.start(i,j,k);
|
|
||||||
T res (0);
|
|
||||||
while(n != cellMapper::NoPos)
|
|
||||||
{
|
|
||||||
res += f[n];
|
|
||||||
n = iterator.getNext(n);
|
|
||||||
}
|
|
||||||
|
|
||||||
results(i,j,k) = res;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return resultsPtr;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T, typename incMask>
|
|
||||||
uniquePtr<rectMeshField_H<T>> sumMaksOp( pointField_H<T>& field, pointRectCell& pointToCell, const incMask& mask)
|
|
||||||
{
|
|
||||||
// create field
|
|
||||||
auto& mesh = pointToCell.mesh();
|
|
||||||
auto iterator = pointToCell.getCellIterator();
|
|
||||||
auto f = field.deviceView();
|
|
||||||
|
|
||||||
auto resultsPtr = makeUnique<rectMeshField_H<T>>(mesh, T(0));
|
|
||||||
auto& results = resultsPtr();
|
|
||||||
|
|
||||||
for(int32 i=0; i<mesh.nx(); i++)
|
|
||||||
{
|
|
||||||
for(int32 j=0; j<mesh.ny(); j++)
|
|
||||||
{
|
|
||||||
for(int32 k=0; k<mesh.nz(); k++)
|
|
||||||
{
|
|
||||||
//auto [loop, n] = pointToCell.startLoop(i,j,k);
|
|
||||||
uint32 n = iterator.start(i,j,k);
|
|
||||||
T res (0);
|
|
||||||
|
|
||||||
while(n!= cellMapper::NoPos)
|
|
||||||
{
|
|
||||||
|
|
||||||
if(mask(n))
|
|
||||||
{
|
|
||||||
res += f[n];
|
|
||||||
}
|
|
||||||
|
|
||||||
n = iterator.getNext(n);
|
|
||||||
}
|
|
||||||
|
|
||||||
results(i,j,k) = res;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return resultsPtr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif //__fieldOperations_hpp__
|
|
||||||
|
|
@ -1,108 +0,0 @@
|
|||||||
/*------------------------------- phasicFlow ---------------------------------
|
|
||||||
O C enter of
|
|
||||||
O O E ngineering and
|
|
||||||
O O M ultiscale modeling of
|
|
||||||
OOOOOOO F luid flow
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Copyright (C): www.cemf.ir
|
|
||||||
email: hamid.r.norouzi AT gmail.com
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Licence:
|
|
||||||
This file is part of phasicFlow code. It is a free software for simulating
|
|
||||||
granular and multiphase flows. You can redistribute it and/or modify it under
|
|
||||||
the terms of GNU General Public License v3 or any other later versions.
|
|
||||||
|
|
||||||
phasicFlow is distributed to help others in their research in the field of
|
|
||||||
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
|
||||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "includeMask.hpp"
|
|
||||||
|
|
||||||
pFlow::includeMask::includeMask(
|
|
||||||
const dictionary& dict,
|
|
||||||
const word& opType,
|
|
||||||
readFromTimeFolder& timeFolder)
|
|
||||||
:
|
|
||||||
operatorType_(opType),
|
|
||||||
timeFolder_(timeFolder)
|
|
||||||
{
|
|
||||||
if(!getFieldType(dict, timeFolder, fieldName_, fieldType_))
|
|
||||||
{
|
|
||||||
fatalExit;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool pFlow::includeMask::getFieldType(
|
|
||||||
const dictionary& dict,
|
|
||||||
readFromTimeFolder& timeFolder,
|
|
||||||
word& fName,
|
|
||||||
word& fType)
|
|
||||||
{
|
|
||||||
|
|
||||||
fName = dict.getValOrSet<word>("field", "none");
|
|
||||||
|
|
||||||
if(fName == "none")
|
|
||||||
{
|
|
||||||
fType = "int8";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( !timeFolder.pointFieldFileGetType(fName, fType) )
|
|
||||||
{
|
|
||||||
fatalErrorInFunction<<"error in reading field type from file "<< fName<<
|
|
||||||
"in folder "<< timeFolder.path()<<endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
pFlow::uniquePtr<pFlow::includeMask> pFlow::includeMask::create(
|
|
||||||
const dictionary& dict,
|
|
||||||
const word& opType,
|
|
||||||
readFromTimeFolder& timeFolder)
|
|
||||||
{
|
|
||||||
|
|
||||||
word fType, fName;
|
|
||||||
if(!getFieldType(dict, timeFolder, fName, fType))
|
|
||||||
{
|
|
||||||
fatalExit;
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
word method = angleBracketsNames2("IncludeMask", fType, opType);
|
|
||||||
|
|
||||||
if( dictionaryvCtorSelector_.search(method) )
|
|
||||||
{
|
|
||||||
auto objPtr =
|
|
||||||
dictionaryvCtorSelector_[method]
|
|
||||||
(dict, opType, timeFolder);
|
|
||||||
REPORT(2)<< dict.name()<< " with model "<<Green_Text(method)<<" is processed."<<END_REPORT;
|
|
||||||
return objPtr;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printKeys
|
|
||||||
(
|
|
||||||
fatalError << "Ctor Selector "<<
|
|
||||||
method << " dose not exist. \n"
|
|
||||||
<<"Avaiable ones are: \n\n"
|
|
||||||
,
|
|
||||||
dictionaryvCtorSelector_
|
|
||||||
);
|
|
||||||
fatalExit;
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,109 +0,0 @@
|
|||||||
/*------------------------------- phasicFlow ---------------------------------
|
|
||||||
O C enter of
|
|
||||||
O O E ngineering and
|
|
||||||
O O M ultiscale modeling of
|
|
||||||
OOOOOOO F luid flow
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Copyright (C): www.cemf.ir
|
|
||||||
email: hamid.r.norouzi AT gmail.com
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Licence:
|
|
||||||
This file is part of phasicFlow code. It is a free software for simulating
|
|
||||||
granular and multiphase flows. You can redistribute it and/or modify it under
|
|
||||||
the terms of GNU General Public License v3 or any other later versions.
|
|
||||||
|
|
||||||
phasicFlow is distributed to help others in their research in the field of
|
|
||||||
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
|
||||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef __includeMask_hpp__
|
|
||||||
#define __includeMask_hpp__
|
|
||||||
|
|
||||||
#include "virtualConstructor.hpp"
|
|
||||||
#include "readFromTimeFolder.hpp"
|
|
||||||
#include "dictionary.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
namespace pFlow
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
class includeMask
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
word fieldName_;
|
|
||||||
|
|
||||||
word fieldType_;
|
|
||||||
|
|
||||||
word operatorType_;
|
|
||||||
|
|
||||||
readFromTimeFolder& timeFolder_;
|
|
||||||
|
|
||||||
static
|
|
||||||
bool getFieldType(const dictionary& dict, readFromTimeFolder& timeFolder, word& fName, word& fType);
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
TypeInfo("includeMask");
|
|
||||||
|
|
||||||
includeMask(const dictionary& dict, const word& opType, readFromTimeFolder& timeFolder);
|
|
||||||
|
|
||||||
virtual ~includeMask() = default;
|
|
||||||
|
|
||||||
create_vCtor(
|
|
||||||
includeMask,
|
|
||||||
dictionary,
|
|
||||||
(
|
|
||||||
const dictionary& dict,
|
|
||||||
const word& opType,
|
|
||||||
readFromTimeFolder& timeFolder
|
|
||||||
),
|
|
||||||
(dict, opType, timeFolder)
|
|
||||||
);
|
|
||||||
|
|
||||||
word fieldName()const
|
|
||||||
{
|
|
||||||
return fieldName_;
|
|
||||||
}
|
|
||||||
|
|
||||||
word fieldType()const
|
|
||||||
{
|
|
||||||
return fieldType_;
|
|
||||||
}
|
|
||||||
|
|
||||||
word operatorType()const
|
|
||||||
{
|
|
||||||
return operatorType_;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto& timeFolder()
|
|
||||||
{
|
|
||||||
return timeFolder_;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool isIncluded(int32 n) const = 0;
|
|
||||||
|
|
||||||
virtual uint32 size()const = 0;
|
|
||||||
|
|
||||||
bool operator()(int32 n) const
|
|
||||||
{
|
|
||||||
return isIncluded(n);
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
uniquePtr<includeMask> create(
|
|
||||||
const dictionary& dict,
|
|
||||||
const word& opType,
|
|
||||||
readFromTimeFolder& timeFolder);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // pFlow
|
|
||||||
|
|
||||||
#endif //__IncludeMask_hpp__
|
|
||||||
|
|
||||||
|
|
@ -1,142 +0,0 @@
|
|||||||
/*------------------------------- phasicFlow ---------------------------------
|
|
||||||
O C enter of
|
|
||||||
O O E ngineering and
|
|
||||||
O O M ultiscale modeling of
|
|
||||||
OOOOOOO F luid flow
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Copyright (C): www.cemf.ir
|
|
||||||
email: hamid.r.norouzi AT gmail.com
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Licence:
|
|
||||||
This file is part of phasicFlow code. It is a free software for simulating
|
|
||||||
granular and multiphase flows. You can redistribute it and/or modify it under
|
|
||||||
the terms of GNU General Public License v3 or any other later versions.
|
|
||||||
|
|
||||||
phasicFlow is distributed to help others in their research in the field of
|
|
||||||
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
|
||||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef __pointRectCell_hpp__
|
|
||||||
#define __pointRectCell_hpp__
|
|
||||||
|
|
||||||
#include "cellMapper.hpp"
|
|
||||||
#include "rectMeshFields.hpp"
|
|
||||||
#include "pointStructure.hpp"
|
|
||||||
|
|
||||||
namespace pFlow
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
class pointRectCell
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
using mapType = cellMapper;
|
|
||||||
|
|
||||||
//using memory_space = typename mapType::memory_space;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
repository& processedRepository_;
|
|
||||||
|
|
||||||
rectangleMesh mesh_;
|
|
||||||
|
|
||||||
const pointStructure& pStruct_;
|
|
||||||
|
|
||||||
hostViewType1D<realx3> pointPosition_;
|
|
||||||
|
|
||||||
mapType map_;
|
|
||||||
|
|
||||||
int32RectMeshField_H nPointInCell_;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
pointRectCell(
|
|
||||||
const dictionary& dictMesh,
|
|
||||||
const pointStructure& pStruct,
|
|
||||||
repository& rep)
|
|
||||||
:
|
|
||||||
processedRepository_(rep),
|
|
||||||
mesh_
|
|
||||||
(
|
|
||||||
dictMesh,
|
|
||||||
&rep
|
|
||||||
),
|
|
||||||
pStruct_(pStruct),
|
|
||||||
pointPosition_(pStruct_.pointPosition().hostViewAll()),
|
|
||||||
map_
|
|
||||||
(
|
|
||||||
mesh_,
|
|
||||||
pointPosition_,
|
|
||||||
pStruct_.activePointsMaskHost()
|
|
||||||
),
|
|
||||||
nPointInCell_(mesh_,"nPointInCell", 0)
|
|
||||||
{
|
|
||||||
|
|
||||||
mapPOints();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto& mesh()
|
|
||||||
{
|
|
||||||
return mesh_;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto& mesh()const
|
|
||||||
{
|
|
||||||
return mesh_;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto& processedRepository()
|
|
||||||
{
|
|
||||||
return processedRepository_;
|
|
||||||
}
|
|
||||||
|
|
||||||
void mapPOints()
|
|
||||||
{
|
|
||||||
auto points = pStruct_.pointPositionHost();
|
|
||||||
auto activeMask = pStruct_.activePointsMaskHost();
|
|
||||||
|
|
||||||
map_.build(points, activeMask);
|
|
||||||
|
|
||||||
auto iterator = map_.getCellIterator();
|
|
||||||
|
|
||||||
for(int32 i=0; i<mesh_.nx(); i++)
|
|
||||||
{
|
|
||||||
for(int32 j=0; j<mesh_.ny(); j++)
|
|
||||||
{
|
|
||||||
for(int32 k=0; k<mesh_.nz(); k++)
|
|
||||||
{
|
|
||||||
|
|
||||||
int32 res = 0;
|
|
||||||
uint32 n = iterator.start(i,j,k);
|
|
||||||
while( n!= cellMapper::NoPos)
|
|
||||||
{
|
|
||||||
res+=1;
|
|
||||||
n = iterator.getNext(n);
|
|
||||||
}
|
|
||||||
nPointInCell_(i,j,k) = res;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
auto getCellIterator()const
|
|
||||||
{
|
|
||||||
return map_.getCellIterator();
|
|
||||||
}
|
|
||||||
|
|
||||||
int32 nPointInCell(int32 i, int32 j, int32 k)const
|
|
||||||
{
|
|
||||||
return nPointInCell_(i,j,k);
|
|
||||||
}
|
|
||||||
|
|
||||||
//auto
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // __pointRectCell_hpp__
|
|
@ -0,0 +1,271 @@
|
|||||||
|
#include "postSimulationFieldsDataBase.hpp"
|
||||||
|
#include "vocabs.hpp"
|
||||||
|
|
||||||
|
namespace pFlow
|
||||||
|
{
|
||||||
|
|
||||||
|
bool pointFieldGetType
|
||||||
|
(
|
||||||
|
const word& objectType,
|
||||||
|
word& fieldType,
|
||||||
|
word& fieldSpace
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pFlow::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)
|
||||||
|
{
|
||||||
|
if(time().lookupObjectName(name)) return true;
|
||||||
|
if(auto [iter, success]=currentFileFields_.findIf(name); success)
|
||||||
|
{
|
||||||
|
if(iter->second == "real")
|
||||||
|
{
|
||||||
|
allPointFields_.push_back
|
||||||
|
(
|
||||||
|
makeUnique<pointField_H<real>>
|
||||||
|
(
|
||||||
|
objectFile
|
||||||
|
(
|
||||||
|
name,
|
||||||
|
allValidFolders_.folder(),
|
||||||
|
objectFile::READ_ALWAYS,
|
||||||
|
objectFile::WRITE_NEVER
|
||||||
|
),
|
||||||
|
pStructPtr_(),
|
||||||
|
0.0
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if(iter->second=="realx3")
|
||||||
|
{
|
||||||
|
allPointFields_.push_back
|
||||||
|
(
|
||||||
|
makeUnique<pointField_H<realx3>>
|
||||||
|
(
|
||||||
|
objectFile
|
||||||
|
(
|
||||||
|
name,
|
||||||
|
allValidFolders_.folder(),
|
||||||
|
objectFile::READ_ALWAYS,
|
||||||
|
objectFile::WRITE_NEVER
|
||||||
|
),
|
||||||
|
pStructPtr_(),
|
||||||
|
0.0
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if(iter->second=="realx4")
|
||||||
|
{
|
||||||
|
allPointFields_.push_back
|
||||||
|
(
|
||||||
|
makeUnique<pointField_H<realx4>>
|
||||||
|
(
|
||||||
|
objectFile
|
||||||
|
(
|
||||||
|
name,
|
||||||
|
allValidFolders_.folder(),
|
||||||
|
objectFile::READ_ALWAYS,
|
||||||
|
objectFile::WRITE_NEVER
|
||||||
|
),
|
||||||
|
pStructPtr_(),
|
||||||
|
0.0
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if(iter->second == "uint32")
|
||||||
|
{
|
||||||
|
allPointFields_.push_back
|
||||||
|
(
|
||||||
|
makeUnique<pointField_H<uint32>>
|
||||||
|
(
|
||||||
|
objectFile
|
||||||
|
(
|
||||||
|
name,
|
||||||
|
allValidFolders_.folder(),
|
||||||
|
objectFile::READ_ALWAYS,
|
||||||
|
objectFile::WRITE_NEVER
|
||||||
|
),
|
||||||
|
pStructPtr_(),
|
||||||
|
0u
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fatalErrorInFunction
|
||||||
|
<<"Field "<<name<<" has an invalid type: "
|
||||||
|
<< iter->second<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fatalErrorInFunction
|
||||||
|
<<"Filed "<<name<<" not found in the current time folder: "
|
||||||
|
<< allValidFolders_.folder()<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pFlow::postSimulationFieldsDataBase::loadPointStructureToTime()
|
||||||
|
{
|
||||||
|
if(!pStructPtr_)
|
||||||
|
{
|
||||||
|
// create pointStructure
|
||||||
|
pStructPtr_ = makeUnique<pointStructure>(control_, 0.0005);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const pFlow::shape &pFlow::postSimulationFieldsDataBase::getShape() const
|
||||||
|
{
|
||||||
|
if(!shapePtr_)
|
||||||
|
{
|
||||||
|
word shapeType = shapeTypeName();
|
||||||
|
if(shapeType.empty())
|
||||||
|
{
|
||||||
|
fatalErrorInFunction
|
||||||
|
<< "shapeType is not set in the postprocess dictionary"<<endl;
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
propertyPtr_ = makeUnique<property>(pFlow::propertyFile__, control_.caseSetup().path());
|
||||||
|
shapePtr_ = shape::create(shapeType, pFlow::shapeFile__, &control_.caseSetup(), propertyPtr_());
|
||||||
|
}
|
||||||
|
return shapePtr_();
|
||||||
|
}
|
||||||
|
|
||||||
|
pFlow::word pFlow::postSimulationFieldsDataBase::getPointFieldType(const word &name) const
|
||||||
|
{
|
||||||
|
if(auto [iter, success]=currentFileFields_.findIf(name); success)
|
||||||
|
{
|
||||||
|
return iter->second;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fatalErrorInFunction
|
||||||
|
<<"Field "<<name<<" not found in the current time folder: "
|
||||||
|
<< allValidFolders_.folder()<<endl;
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pFlow::postSimulationFieldsDataBase::setToCurrentFolder()
|
||||||
|
{
|
||||||
|
allPointFields_.clear();
|
||||||
|
pStructPtr_.reset(nullptr);
|
||||||
|
|
||||||
|
|
||||||
|
if( !allValidFolders_.containsPointStructure(allValidFolders_.folder()) )
|
||||||
|
{
|
||||||
|
fatalErrorInFunction
|
||||||
|
<<"Folder "<<allValidFolders_.folder()
|
||||||
|
<<" does not contain a valid point structure file."<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
time().setTime(allValidFolders_.currentTime());
|
||||||
|
|
||||||
|
loadPointStructureToTime();
|
||||||
|
|
||||||
|
auto files = allValidFolders_.currentFolderFiles();
|
||||||
|
|
||||||
|
currentFileFields_.clear();
|
||||||
|
|
||||||
|
word type, space;
|
||||||
|
for(auto& [name, objectType]: files)
|
||||||
|
{
|
||||||
|
if(pointFieldGetType(objectType, type, space))
|
||||||
|
{
|
||||||
|
if(name == pointStructureFile__) continue;
|
||||||
|
currentFileFields_.insertIf(name, type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
pFlow::postSimulationFieldsDataBase::postSimulationFieldsDataBase
|
||||||
|
(
|
||||||
|
systemControl &control,
|
||||||
|
const dictionary& postDict,
|
||||||
|
bool inSimulation,
|
||||||
|
timeValue startTime
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fieldsDataBase(control, postDict, inSimulation, startTime),
|
||||||
|
control_(control),
|
||||||
|
allValidFolders_(control, true)
|
||||||
|
{
|
||||||
|
if(allValidFolders_.empty())
|
||||||
|
{
|
||||||
|
fatalErrorInFunction
|
||||||
|
<< "No time folders found in the path: " << control.path()
|
||||||
|
<< " or no time folder with valid file content found in the path."
|
||||||
|
<< endl;
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
if( ! allValidFolders_.setTime(startTime))
|
||||||
|
{
|
||||||
|
fatalErrorInFunction
|
||||||
|
<<"The start time: "
|
||||||
|
<< startTime<<" for postprocessing is not valid."<<endl
|
||||||
|
<<" valid range is ["<< allValidFolders_.startTime()
|
||||||
|
<<","<<allValidFolders_.endTime()<<"]"<<endl;
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!setToCurrentFolder())
|
||||||
|
{
|
||||||
|
fatalErrorInFunction
|
||||||
|
<<"Error in setting the current folder to: "
|
||||||
|
<< allValidFolders_.folder()<<endl;
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const pFlow::pointStructure& pFlow::postSimulationFieldsDataBase::pStruct()const
|
||||||
|
{
|
||||||
|
return pStructPtr_();
|
||||||
|
}
|
||||||
|
|
||||||
|
pFlow::timeValue pFlow::postSimulationFieldsDataBase::getNextTimeFolder() const
|
||||||
|
{
|
||||||
|
return allValidFolders_.nextTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
pFlow::timeValue pFlow::postSimulationFieldsDataBase::setToNextTimeFolder()
|
||||||
|
{
|
||||||
|
timeValue nextTime = allValidFolders_.nextTime();
|
||||||
|
if(nextTime < 0.0) return nextTime;
|
||||||
|
|
||||||
|
allValidFolders_++;
|
||||||
|
|
||||||
|
if(!setToCurrentFolder())
|
||||||
|
{
|
||||||
|
fatalErrorInFunction
|
||||||
|
<<"Error in setting the current folder to the next time folder."<<endl;
|
||||||
|
fatalExit;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nextTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
pFlow::timeValue pFlow::postSimulationFieldsDataBase::skipNextTimeFolder()
|
||||||
|
{
|
||||||
|
timeValue nextTime = allValidFolders_.nextTime();
|
||||||
|
if(nextTime < 0.0) return nextTime;
|
||||||
|
|
||||||
|
allValidFolders_++;
|
||||||
|
return nextTime;
|
||||||
|
}
|
@ -0,0 +1,97 @@
|
|||||||
|
/*------------------------------- 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 __postSimulationFieldsDataBase_hpp__
|
||||||
|
#define __postSimulationFieldsDataBase_hpp__
|
||||||
|
|
||||||
|
#include "fieldsDataBase.hpp"
|
||||||
|
#include "timeFolder.hpp"
|
||||||
|
#include "pointStructure.hpp"
|
||||||
|
#include "ListPtr.hpp"
|
||||||
|
#include "property.hpp"
|
||||||
|
|
||||||
|
namespace pFlow
|
||||||
|
{
|
||||||
|
|
||||||
|
class postSimulationFieldsDataBase
|
||||||
|
:
|
||||||
|
public fieldsDataBase
|
||||||
|
{
|
||||||
|
|
||||||
|
systemControl& control_;
|
||||||
|
|
||||||
|
timeFolder allValidFolders_;
|
||||||
|
|
||||||
|
Map<word,word> currentFileFields_;
|
||||||
|
|
||||||
|
uniquePtr<pointStructure> pStructPtr_ = nullptr;
|
||||||
|
|
||||||
|
ListPtr<IOobject> allPointFields_;
|
||||||
|
|
||||||
|
mutable uniquePtr<shape> shapePtr_ = nullptr;
|
||||||
|
|
||||||
|
mutable uniquePtr<property> propertyPtr_ = nullptr;
|
||||||
|
|
||||||
|
bool setToCurrentFolder();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
bool pointFieldNameExists(const word& name)const override;
|
||||||
|
|
||||||
|
bool loadPointFieldToTime(const word& name) override;
|
||||||
|
|
||||||
|
bool loadPointStructureToTime();
|
||||||
|
|
||||||
|
const shape& getShape() const override;
|
||||||
|
|
||||||
|
word getPointFieldType(const word& name)const override;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
TypeInfo("fieldsDataBase<postSimulation>");
|
||||||
|
|
||||||
|
postSimulationFieldsDataBase(
|
||||||
|
systemControl& control,
|
||||||
|
const dictionary& postDict,
|
||||||
|
bool inSimulation,
|
||||||
|
timeValue startTime);
|
||||||
|
|
||||||
|
~postSimulationFieldsDataBase() override = default;
|
||||||
|
|
||||||
|
add_vCtor
|
||||||
|
(
|
||||||
|
fieldsDataBase,
|
||||||
|
postSimulationFieldsDataBase,
|
||||||
|
bool
|
||||||
|
);
|
||||||
|
|
||||||
|
const pointStructure& pStruct()const override;
|
||||||
|
|
||||||
|
timeValue getNextTimeFolder()const override;
|
||||||
|
|
||||||
|
timeValue setToNextTimeFolder() override;
|
||||||
|
|
||||||
|
timeValue skipNextTimeFolder() override;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace pFlow
|
||||||
|
|
||||||
|
#endif // __postSimulationFieldsDataBase_hpp__
|
@ -1,156 +0,0 @@
|
|||||||
/*------------------------------- phasicFlow ---------------------------------
|
|
||||||
O C enter of
|
|
||||||
O O E ngineering and
|
|
||||||
O O M ultiscale modeling of
|
|
||||||
OOOOOOO F luid flow
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Copyright (C): www.cemf.ir
|
|
||||||
email: hamid.r.norouzi AT gmail.com
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Licence:
|
|
||||||
This file is part of phasicFlow code. It is a free software for simulating
|
|
||||||
granular and multiphase flows. You can redistribute it and/or modify it under
|
|
||||||
the terms of GNU General Public License v3 or any other later versions.
|
|
||||||
|
|
||||||
phasicFlow is distributed to help others in their research in the field of
|
|
||||||
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
|
||||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "postprocess.hpp"
|
|
||||||
#include "timeFolder.hpp"
|
|
||||||
#include "pointStructure.hpp"
|
|
||||||
#include "countFields.hpp"
|
|
||||||
#include "vocabs.hpp"
|
|
||||||
#include "vtkFile.hpp"
|
|
||||||
|
|
||||||
pFlow::postprocess::postprocess(systemControl& control)
|
|
||||||
:
|
|
||||||
control_(control),
|
|
||||||
dict_(postprocessFile__, control_.settings().path()+postprocessFile__)
|
|
||||||
{
|
|
||||||
REPORT(1)<<"Reading numberBased dictionary ..."<<END_REPORT;
|
|
||||||
auto nbDict = dict_.subDictOrCreate("numberBased");
|
|
||||||
|
|
||||||
numberBasedDictNames_ = dict_.subDictOrCreate("numberBased").dictionaryKeywords();
|
|
||||||
if(!numberBasedDictNames_.empty())
|
|
||||||
{
|
|
||||||
REPORT(1)<< "numberBased dictionary contains " << Yellow_Text(numberBasedDictNames_)<<END_REPORT<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
weightBasedDictNames_ = dict_.subDictOrCreate("weightBased").dictionaryKeywords();
|
|
||||||
if(!weightBasedDictNames_.empty())
|
|
||||||
{
|
|
||||||
REPORT(1)<< "numberBased dictionary contains " << Yellow_Text(weightBasedDictNames_)<<END_REPORT<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
countDictNames_ = dict_.subDictOrCreate("counting").dictionaryKeywords();
|
|
||||||
if(!countDictNames_.empty())
|
|
||||||
{
|
|
||||||
REPORT(1)<< "counting dictionary contains " << Yellow_Text(countDictNames_)<<END_REPORT<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool pFlow::postprocess::processTimeFolder(real time, const word& tName, const fileSystem& localFolder)
|
|
||||||
{
|
|
||||||
|
|
||||||
time_ = time;
|
|
||||||
|
|
||||||
REPORT(0)<<"Working on time folder "<< Cyan_Text(time)<<END_REPORT;
|
|
||||||
|
|
||||||
control_.time().setTime(time);
|
|
||||||
|
|
||||||
REPORT(1)<<"Reading pointStructure"<<END_REPORT;
|
|
||||||
pointStructure pStruct(control_, 0.0005);
|
|
||||||
|
|
||||||
// first delete the object to remove fields from repository
|
|
||||||
pointToCell_.reset(nullptr);
|
|
||||||
|
|
||||||
REPORT(1)<<"Creating mesh and point to cell mapper"<<END_REPORT;
|
|
||||||
pointToCell_ = makeUnique<pointRectCell>(
|
|
||||||
dict_.subDict("rectMesh"),
|
|
||||||
pStruct,
|
|
||||||
control_.time());
|
|
||||||
|
|
||||||
// first numberbased dict
|
|
||||||
|
|
||||||
processedFields_.clear();
|
|
||||||
for(word& dictName:numberBasedDictNames_)
|
|
||||||
{
|
|
||||||
auto fieldDict = dict_.subDict("numberBased").subDict(dictName);
|
|
||||||
auto ppFieldPtr = processField::create(
|
|
||||||
fieldDict,
|
|
||||||
pointToCell_(),
|
|
||||||
control_.time());
|
|
||||||
|
|
||||||
if(!ppFieldPtr->process())
|
|
||||||
{
|
|
||||||
fatalExit;
|
|
||||||
}
|
|
||||||
|
|
||||||
processedFields_.push_back( ppFieldPtr.release() );
|
|
||||||
output<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
countedVariableNamesList_.clear();
|
|
||||||
countedVairablesLists_.clear();
|
|
||||||
|
|
||||||
for(const auto& countDictName:countDictNames_)
|
|
||||||
{
|
|
||||||
REPORT(1)<<"Processing "<< Yellow_Text("counting."<<countDictName)<<END_REPORT;
|
|
||||||
const dictionary& countDict = dict_.subDict("counting").subDict(countDictName);
|
|
||||||
|
|
||||||
countFields cFields(countDict);
|
|
||||||
|
|
||||||
cFields.process(timeFolderReposiory());
|
|
||||||
|
|
||||||
countedVariableNamesList_.push_back(
|
|
||||||
cFields.variableNames());
|
|
||||||
|
|
||||||
countedVairablesLists_.push_back(cFields.countedValues());
|
|
||||||
|
|
||||||
}
|
|
||||||
output<<"\n";
|
|
||||||
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool pFlow::postprocess::processTimeFolder(const timeFolder& tFolder)
|
|
||||||
{
|
|
||||||
return processTimeFolder(
|
|
||||||
tFolder.time(),
|
|
||||||
tFolder.timeName(),
|
|
||||||
tFolder.localFolder() );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool pFlow::postprocess::writeToVTK(fileSystem destPath, word bName)const
|
|
||||||
{
|
|
||||||
vtkFile vtk(destPath, bName, time_, false);
|
|
||||||
|
|
||||||
if(!vtk) return false;
|
|
||||||
|
|
||||||
REPORT(1)<<"Writing processed fields to vtk file..."<<END_REPORT;
|
|
||||||
// mesh
|
|
||||||
pointToCell_->mesh().writeToVtk(vtk());
|
|
||||||
|
|
||||||
ForAll( i, processedFields_)
|
|
||||||
{
|
|
||||||
|
|
||||||
if( !processedFields_[i].writeToVTK(vtk()))
|
|
||||||
{
|
|
||||||
|
|
||||||
fatalErrorInFunction<<"error in writing "<< processedFields_[i].processedFieldName()<<
|
|
||||||
"to vtk file\n";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
@ -1,100 +0,0 @@
|
|||||||
/*------------------------------- phasicFlow ---------------------------------
|
|
||||||
O C enter of
|
|
||||||
O O E ngineering and
|
|
||||||
O O M ultiscale modeling of
|
|
||||||
OOOOOOO F luid flow
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Copyright (C): www.cemf.ir
|
|
||||||
email: hamid.r.norouzi AT gmail.com
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Licence:
|
|
||||||
This file is part of phasicFlow code. It is a free software for simulating
|
|
||||||
granular and multiphase flows. You can redistribute it and/or modify it under
|
|
||||||
the terms of GNU General Public License v3 or any other later versions.
|
|
||||||
|
|
||||||
phasicFlow is distributed to help others in their research in the field of
|
|
||||||
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
|
||||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef __postprocess_hpp__
|
|
||||||
#define __postprocess_hpp__
|
|
||||||
|
|
||||||
|
|
||||||
#include "MapPtr.hpp"
|
|
||||||
#include "systemControl.hpp"
|
|
||||||
#include "pointRectCell.hpp"
|
|
||||||
#include "processField.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
namespace pFlow
|
|
||||||
{
|
|
||||||
|
|
||||||
class timeFolder;
|
|
||||||
|
|
||||||
|
|
||||||
class postprocess
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
|
|
||||||
systemControl& control_;
|
|
||||||
|
|
||||||
dictionary dict_;
|
|
||||||
|
|
||||||
wordList numberBasedDictNames_;
|
|
||||||
|
|
||||||
wordList weightBasedDictNames_;
|
|
||||||
|
|
||||||
wordList countDictNames_;
|
|
||||||
|
|
||||||
List<wordList> countedVariableNamesList_;
|
|
||||||
|
|
||||||
List<uint32List> countedVairablesLists_;
|
|
||||||
|
|
||||||
uniquePtr<repository> timeFolderReposiory_ {nullptr};
|
|
||||||
|
|
||||||
uniquePtr<pointRectCell> pointToCell_ {nullptr};
|
|
||||||
|
|
||||||
//uniquePtr<repository> processedRepository_ {nullptr};
|
|
||||||
|
|
||||||
ListPtr<processField> processedFields_;
|
|
||||||
|
|
||||||
real time_=0.0;
|
|
||||||
|
|
||||||
//orderedMapPtr<real, repository> timeFolderRepositories_;
|
|
||||||
|
|
||||||
|
|
||||||
Logical saveTimes{"No"};
|
|
||||||
|
|
||||||
Logical saveTimeFolders{"No"};
|
|
||||||
|
|
||||||
|
|
||||||
auto& timeFolderReposiory()
|
|
||||||
{
|
|
||||||
return timeFolderReposiory_();
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
postprocess(systemControl& control);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool processTimeFolder(real time, const word& tName, const fileSystem& localFolder);
|
|
||||||
|
|
||||||
bool processTimeFolder(const timeFolder& tFolder);
|
|
||||||
|
|
||||||
|
|
||||||
bool writeToVTK(fileSystem path, word bName)const;
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif //__postprocess_hpp__
|
|
@ -18,103 +18,130 @@ Licence:
|
|||||||
|
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "KokkosUtilities.hpp"
|
|
||||||
#include "systemControl.hpp"
|
#include "systemControl.hpp"
|
||||||
#include "timeFolder.hpp"
|
#include "Vectors.hpp"
|
||||||
#include "commandLine.hpp"
|
#include "commandLine.hpp"
|
||||||
#include "ranges.hpp"
|
|
||||||
#include "readControlDict.hpp"
|
#include "readControlDict.hpp"
|
||||||
|
|
||||||
#include "postprocess.hpp"
|
#include "postprocessData.hpp"
|
||||||
|
#include "postprocessGlobals.hpp"
|
||||||
using pFlow::word;
|
|
||||||
using pFlow::wordVector;
|
|
||||||
using pFlow::wordList;
|
|
||||||
using pFlow::commandLine;
|
|
||||||
using pFlow::timeFolder;
|
|
||||||
using pFlow::output;
|
|
||||||
using pFlow::endl;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char** argv )
|
int main(int argc, char** argv )
|
||||||
{
|
{
|
||||||
|
|
||||||
word outFolder = (pFlow::CWD()/word("VTK/postprocess")).wordPath();
|
pFlow::word outFolder = (pFlow::CWD()/pFlow::postProcessGlobals::defaultRelDir__).wordPath();
|
||||||
|
|
||||||
commandLine cmds(
|
pFlow::commandLine cmds(
|
||||||
"postprocessPhasicFlow",
|
"postprocessPhasicFlow",
|
||||||
"post-process fields in time folders based on the input file "
|
"post-process fields in time folders based on the input file "
|
||||||
"settings/postprocessDict and convetes the results into vtk file format.");
|
"settings/postprocessDataDict.");
|
||||||
|
|
||||||
|
pFlow::wordVector times;
|
||||||
|
|
||||||
|
pFlow::word description = "path to output folder of postprocess data: ./"
|
||||||
|
+ pFlow::postProcessGlobals::defaultRelDir__;
|
||||||
|
|
||||||
wordVector times;
|
|
||||||
|
|
||||||
cmds.addOption("-o,--out-folder",
|
cmds.addOption("-o,--out-folder",
|
||||||
outFolder,
|
outFolder,
|
||||||
"path to output folder of VTK/postprocess",
|
description,
|
||||||
"path");
|
"path");
|
||||||
|
|
||||||
cmds.addOption(
|
cmds.addOption(
|
||||||
"-t,--time",
|
"-t,--time",
|
||||||
times.vectorField(),
|
times.vectorField(),
|
||||||
"a space separated lits of time folders, or a strided range begin:stride:end, or an interval begin:end",
|
"a SPACE separated lits of time folders, "
|
||||||
|
"or a strided range <begin>:<stride>:<end>, or an interval <begin>:<end>",
|
||||||
" ");
|
" ");
|
||||||
|
|
||||||
bool withZeroFolder = false;
|
bool withZeroFolder = false;
|
||||||
cmds.addOption(
|
cmds.add_flag(
|
||||||
"-z, --zeroFolder",
|
"-z, --zeroFolder",
|
||||||
withZeroFolder,
|
withZeroFolder,
|
||||||
"Do NOT exclude zero folder from processing time folders");
|
"include zero folder into processing time folders");
|
||||||
|
|
||||||
bool isCoupling = false;
|
bool isCoupling = false;
|
||||||
|
|
||||||
if(!cmds.parse(argc, argv)) return 0;
|
if(!cmds.parse(argc, argv)) return 0;
|
||||||
|
|
||||||
#include "initialize_Control.hpp"
|
#include "initialize_Control.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// time folders in case
|
|
||||||
timeFolder folders(Control);
|
|
||||||
|
|
||||||
// time in command line
|
// time in command line
|
||||||
pFlow::realCombinedRange validRange;
|
pFlow::combinedRange<pFlow::timeValue> validRange;
|
||||||
|
|
||||||
if( cmds.count("--time") )
|
if( cmds.count("--time") )
|
||||||
{
|
{
|
||||||
if(!validRange.addRanges(times)){
|
if(!validRange.addRanges(times))
|
||||||
fatalExit; }
|
{
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
if(withZeroFolder)
|
||||||
|
validRange.addIndividual(0.0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
validRange.addIntervalRange(folders.startTime(), folders.endTime());
|
if(withZeroFolder)
|
||||||
|
validRange.addIntervalRange(0.0, 1.0e+15);
|
||||||
|
else
|
||||||
|
validRange.addIntervalRange(1.0e-7, 1.0e+15);
|
||||||
}
|
}
|
||||||
|
|
||||||
pFlow::fileSystem destFolder = pFlow::fileSystem(outFolder);
|
pFlow::timeValue nextTime = validRange.minVal();
|
||||||
|
|
||||||
pFlow::postprocess post(Control);
|
if(nextTime <0.0)
|
||||||
|
{
|
||||||
|
fatalError
|
||||||
|
<<"Invalid time range in the command line. "
|
||||||
|
<<"your input range is: "
|
||||||
|
<<times
|
||||||
|
<<" which resulted to start time "
|
||||||
|
<< nextTime<<pFlow::endl;
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
|
||||||
do
|
pFlow::postprocessData postprocess(Control, nextTime);
|
||||||
|
postprocess.setOutputDirectory(pFlow::fileSystem(outFolder+"/").absolute());
|
||||||
|
|
||||||
|
bool folderSkipped = false;
|
||||||
|
pFlow::output<<"\n"<<pFlow::endl;
|
||||||
|
while(nextTime>=0.0)
|
||||||
{
|
{
|
||||||
|
|
||||||
if( !validRange.isMember( folders.time() ) )
|
if( !folderSkipped )
|
||||||
{
|
{
|
||||||
continue;
|
if(!postprocess.execute())
|
||||||
}
|
{
|
||||||
|
fatalError
|
||||||
if( !withZeroFolder && pFlow::equal(folders.time() , pFlow::zero))continue;
|
<<"Error occured in executing postprocessing...."<<pFlow::endl;
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
|
||||||
post.processTimeFolder(folders);
|
if(!postprocess.write())
|
||||||
|
{
|
||||||
|
fatalError
|
||||||
|
<<"Error occured in writing postprocess results..."<<pFlow::endl;
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
|
||||||
if(!post.writeToVTK(destFolder, "processed"))
|
pFlow::output<<"\n"<<pFlow::endl;
|
||||||
{
|
|
||||||
fatalExit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nextTime = postprocess.database().getNextTimeFolder();
|
||||||
|
|
||||||
}while (folders++);
|
if(nextTime <0.0) break;
|
||||||
|
|
||||||
|
if(validRange.isMember(nextTime))
|
||||||
|
{
|
||||||
|
postprocess.database().setToNextTimeFolder();
|
||||||
|
folderSkipped = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
postprocess.database().skipNextTimeFolder();
|
||||||
|
folderSkipped = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#include "finalize.hpp"
|
#include "finalize.hpp"
|
||||||
|
|
||||||
|
@ -1,132 +0,0 @@
|
|||||||
/*------------------------------- phasicFlow ---------------------------------
|
|
||||||
O C enter of
|
|
||||||
O O E ngineering and
|
|
||||||
O O M ultiscale modeling of
|
|
||||||
OOOOOOO F luid flow
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Copyright (C): www.cemf.ir
|
|
||||||
email: hamid.r.norouzi AT gmail.com
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Licence:
|
|
||||||
This file is part of phasicFlow code. It is a free software for simulating
|
|
||||||
granular and multiphase flows. You can redistribute it and/or modify it under
|
|
||||||
the terms of GNU General Public License v3 or any other later versions.
|
|
||||||
|
|
||||||
phasicFlow is distributed to help others in their research in the field of
|
|
||||||
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
|
||||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "processField.hpp"
|
|
||||||
#include "pointRectCell.hpp"
|
|
||||||
#include "repository.hpp"
|
|
||||||
#include "twoPartEntry.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
pFlow::processField::processField(
|
|
||||||
const dictionary& dict,
|
|
||||||
pointRectCell& pToCell,
|
|
||||||
repository& rep)
|
|
||||||
:
|
|
||||||
dict_(dict),
|
|
||||||
pointToCell_(pToCell),
|
|
||||||
timeFolder_(rep),
|
|
||||||
processedFieldName_(dict.name()),
|
|
||||||
operation_(dict.getVal<word>("operation")),
|
|
||||||
includeMaskType_(dict.getVal<word>("includeMask")),
|
|
||||||
threshold_(dict.getValOrSetMax<int32>("threshold", 1))
|
|
||||||
{
|
|
||||||
|
|
||||||
if(!processField::getFieldType(
|
|
||||||
dict_,
|
|
||||||
timeFolder_,
|
|
||||||
fieldName_,
|
|
||||||
fieldType_) )
|
|
||||||
{
|
|
||||||
fatalExit;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto& incDict = dict_.subDictOrCreate(includeMaskType_+"Info");
|
|
||||||
|
|
||||||
includeMask_ = includeMask::create(incDict, includeMaskType_, timeFolder_);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bool pFlow::processField::getFieldType(
|
|
||||||
const dictionary& dict,
|
|
||||||
readFromTimeFolder& timeFolder,
|
|
||||||
word& fieldName,
|
|
||||||
word& fieldType)
|
|
||||||
{
|
|
||||||
if(dict.containsDataEntry("field"))
|
|
||||||
{
|
|
||||||
const dataEntry& entry = dict.dataEntryRef("field");
|
|
||||||
|
|
||||||
if( isTwoPartEntry(entry))
|
|
||||||
{
|
|
||||||
twoPartEntry tpEntry(entry);
|
|
||||||
fieldName = "uniformField";
|
|
||||||
fieldType = tpEntry.firstPart();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fieldName = dict.getVal<word>("field");
|
|
||||||
if( !timeFolder.pointFieldFileGetType(fieldName, fieldType) )
|
|
||||||
{
|
|
||||||
fatalErrorInFunction<<"error in reading field type from file "<< fieldName<<
|
|
||||||
"in folder "<< timeFolder.path()<<endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fatalErrorInFunction<< "dictionary "<< dict.globalName()<<
|
|
||||||
"does not contain field keyword"<<endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
pFlow::uniquePtr<pFlow::processField>
|
|
||||||
pFlow::processField::create(
|
|
||||||
const dictionary& dict,
|
|
||||||
pointRectCell& pToCell,
|
|
||||||
repository& rep)
|
|
||||||
{
|
|
||||||
|
|
||||||
word fName, fType;
|
|
||||||
readFromTimeFolder timeFolder(rep);
|
|
||||||
if(!getFieldType(dict, timeFolder, fName, fType))
|
|
||||||
{
|
|
||||||
fatalExit;
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto method = angleBracketsNames("ProcessField", fType);
|
|
||||||
|
|
||||||
if( dictionaryvCtorSelector_.search(method) )
|
|
||||||
{
|
|
||||||
auto objPtr =
|
|
||||||
dictionaryvCtorSelector_[method]
|
|
||||||
(dict, pToCell, rep);
|
|
||||||
REPORT(2)<<"Processing/creating " << Yellow_Text(dict.name())<< " with model "<<Green_Text(method)<<"."<<END_REPORT;
|
|
||||||
return objPtr;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printKeys
|
|
||||||
(
|
|
||||||
fatalError << "Ctor Selector "<<
|
|
||||||
method << " dose not exist. \n"
|
|
||||||
<<"Avaiable ones are: \n\n"
|
|
||||||
,
|
|
||||||
dictionaryvCtorSelector_
|
|
||||||
);
|
|
||||||
fatalExit;
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,180 +0,0 @@
|
|||||||
/*------------------------------- phasicFlow ---------------------------------
|
|
||||||
O C enter of
|
|
||||||
O O E ngineering and
|
|
||||||
O O M ultiscale modeling of
|
|
||||||
OOOOOOO F luid flow
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Copyright (C): www.cemf.ir
|
|
||||||
email: hamid.r.norouzi AT gmail.com
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Licence:
|
|
||||||
This file is part of phasicFlow code. It is a free software for simulating
|
|
||||||
granular and multiphase flows. You can redistribute it and/or modify it under
|
|
||||||
the terms of GNU General Public License v3 or any other later versions.
|
|
||||||
|
|
||||||
phasicFlow is distributed to help others in their research in the field of
|
|
||||||
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
|
||||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef __processField_hpp__
|
|
||||||
#define __processField_hpp__
|
|
||||||
|
|
||||||
|
|
||||||
#include "virtualConstructor.hpp"
|
|
||||||
#include "dictionary.hpp"
|
|
||||||
#include "readFromTimeFolder.hpp"
|
|
||||||
#include "includeMask.hpp"
|
|
||||||
#include "pointRectCell.hpp"
|
|
||||||
|
|
||||||
namespace pFlow
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
class repository;
|
|
||||||
|
|
||||||
class processField
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
|
|
||||||
dictionary dict_;
|
|
||||||
|
|
||||||
pointRectCell& pointToCell_;
|
|
||||||
|
|
||||||
mutable readFromTimeFolder timeFolder_;
|
|
||||||
|
|
||||||
word processedFieldName_;
|
|
||||||
|
|
||||||
word fieldName_;
|
|
||||||
|
|
||||||
word fieldType_;
|
|
||||||
|
|
||||||
word operation_;
|
|
||||||
|
|
||||||
word includeMaskType_;
|
|
||||||
|
|
||||||
int32 threshold_ = 1;
|
|
||||||
|
|
||||||
uniquePtr<includeMask> includeMask_ = nullptr;
|
|
||||||
|
|
||||||
bool static getFieldType(
|
|
||||||
const dictionary& dict,
|
|
||||||
readFromTimeFolder& timeFolder,
|
|
||||||
word& fieldName,
|
|
||||||
word& fieldType);
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
TypeInfo("processField");
|
|
||||||
|
|
||||||
processField(const dictionary& dict, pointRectCell& pToCell, repository& rep);
|
|
||||||
|
|
||||||
virtual ~processField() = default;
|
|
||||||
|
|
||||||
create_vCtor(
|
|
||||||
processField,
|
|
||||||
dictionary,
|
|
||||||
(const dictionary& dict,
|
|
||||||
pointRectCell& pToCell,
|
|
||||||
repository& rep),
|
|
||||||
(dict, pToCell, rep) );
|
|
||||||
|
|
||||||
|
|
||||||
const auto& mesh()const
|
|
||||||
{
|
|
||||||
return pointToCell_.mesh();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto& mesh()
|
|
||||||
{
|
|
||||||
return pointToCell_.mesh();
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto& pointToCell()const
|
|
||||||
{
|
|
||||||
return pointToCell_;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto& pointToCell()
|
|
||||||
{
|
|
||||||
return pointToCell_;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto& dict()
|
|
||||||
{
|
|
||||||
return dict_;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto& dict()const
|
|
||||||
{
|
|
||||||
return dict_;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto& timeFolderRepository()
|
|
||||||
{
|
|
||||||
return timeFolder_.db();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto& processedRepository()
|
|
||||||
{
|
|
||||||
return pointToCell_.processedRepository();
|
|
||||||
}
|
|
||||||
|
|
||||||
const word& fieldType()const
|
|
||||||
{
|
|
||||||
return fieldType_;
|
|
||||||
}
|
|
||||||
|
|
||||||
const word& fieldName()const
|
|
||||||
{
|
|
||||||
return fieldName_;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isUniform()const
|
|
||||||
{
|
|
||||||
return fieldName_ == "uniformField";
|
|
||||||
}
|
|
||||||
|
|
||||||
const word& operation()const
|
|
||||||
{
|
|
||||||
return operation_;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto& timeFolder()
|
|
||||||
{
|
|
||||||
return timeFolder_;
|
|
||||||
}
|
|
||||||
|
|
||||||
const word& includeMaskType()const
|
|
||||||
{
|
|
||||||
return includeMaskType_;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto threshold()const
|
|
||||||
{
|
|
||||||
return threshold_;
|
|
||||||
}
|
|
||||||
|
|
||||||
const word& processedFieldName()const
|
|
||||||
{
|
|
||||||
return processedFieldName_;
|
|
||||||
}
|
|
||||||
|
|
||||||
// requires a class to read pointField from timefolder
|
|
||||||
virtual bool process() = 0;
|
|
||||||
|
|
||||||
virtual bool writeToVTK(iOstream& is) const = 0;
|
|
||||||
|
|
||||||
static
|
|
||||||
uniquePtr<processField> create(
|
|
||||||
const dictionary& dict,
|
|
||||||
pointRectCell& pToCell,
|
|
||||||
repository& rep);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif //__processField_hpp__
|
|
@ -1,212 +0,0 @@
|
|||||||
/*------------------------------- phasicFlow ---------------------------------
|
|
||||||
O C enter of
|
|
||||||
O O E ngineering and
|
|
||||||
O O M ultiscale modeling of
|
|
||||||
OOOOOOO F luid flow
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Copyright (C): www.cemf.ir
|
|
||||||
email: hamid.r.norouzi AT gmail.com
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Licence:
|
|
||||||
This file is part of phasicFlow code. It is a free software for simulating
|
|
||||||
granular and multiphase flows. You can redistribute it and/or modify it under
|
|
||||||
the terms of GNU General Public License v3 or any other later versions.
|
|
||||||
|
|
||||||
phasicFlow is distributed to help others in their research in the field of
|
|
||||||
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
|
||||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef __rectMeshField_hpp__
|
|
||||||
#define __rectMeshField_hpp__
|
|
||||||
|
|
||||||
#include "rectangleMesh.hpp"
|
|
||||||
#include "ViewAlgorithms.hpp"
|
|
||||||
|
|
||||||
namespace pFlow
|
|
||||||
{
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
class rectMeshField
|
|
||||||
:
|
|
||||||
public IOobject
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
using viewType = ViewType3D<T,HostSpace>;
|
|
||||||
|
|
||||||
using memory_space = typename viewType::memory_space;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
const rectangleMesh* mesh_;
|
|
||||||
|
|
||||||
word name_="noName";
|
|
||||||
|
|
||||||
viewType field_;
|
|
||||||
|
|
||||||
T defaultValue_{};
|
|
||||||
|
|
||||||
constexpr static inline const char* memoerySpaceName()
|
|
||||||
{
|
|
||||||
return memory_space::name();
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
|
|
||||||
TypeInfoTemplateNV111("rectMeshField", T, memoerySpaceName());
|
|
||||||
|
|
||||||
rectMeshField(rectangleMesh& mesh, const word& name ,const T& defVal)
|
|
||||||
:
|
|
||||||
IOobject(
|
|
||||||
objectFile
|
|
||||||
(
|
|
||||||
name,
|
|
||||||
"",
|
|
||||||
objectFile::READ_NEVER,
|
|
||||||
objectFile::WRITE_NEVER
|
|
||||||
),
|
|
||||||
IOPattern::MasterProcessorOnly,
|
|
||||||
nullptr
|
|
||||||
),
|
|
||||||
mesh_(&mesh),
|
|
||||||
name_(name),
|
|
||||||
field_("reactMeshField."+name, mesh_->nx(), mesh_->ny(), mesh_->nz()),
|
|
||||||
defaultValue_(defVal)
|
|
||||||
{
|
|
||||||
this->fill(defaultValue_);
|
|
||||||
}
|
|
||||||
|
|
||||||
rectMeshField(rectangleMesh& mesh, const T& defVal)
|
|
||||||
:
|
|
||||||
IOobject(
|
|
||||||
objectFile
|
|
||||||
(
|
|
||||||
"noName",
|
|
||||||
"",
|
|
||||||
objectFile::READ_NEVER,
|
|
||||||
objectFile::WRITE_NEVER
|
|
||||||
),
|
|
||||||
IOPattern::MasterProcessorOnly,
|
|
||||||
nullptr
|
|
||||||
),
|
|
||||||
mesh_(&mesh),
|
|
||||||
name_("noName"),
|
|
||||||
field_("reactMeshField.noName", mesh_->nx(), mesh_->ny(), mesh_->nz()),
|
|
||||||
defaultValue_(defVal)
|
|
||||||
{
|
|
||||||
this->fill(defaultValue_);
|
|
||||||
}
|
|
||||||
|
|
||||||
rectMeshField(const rectMeshField&) = default;
|
|
||||||
|
|
||||||
rectMeshField& operator = (const rectMeshField&) = default;
|
|
||||||
|
|
||||||
rectMeshField(rectMeshField&&) = default;
|
|
||||||
|
|
||||||
rectMeshField& operator =(rectMeshField&&) = default;
|
|
||||||
|
|
||||||
|
|
||||||
inline uniquePtr<rectMeshField> clone() const
|
|
||||||
{
|
|
||||||
return makeUnique<rectMeshField>(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline rectMeshField* clonePtr()const
|
|
||||||
{
|
|
||||||
return new rectMeshField(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
INLINE_FUNCTION_H
|
|
||||||
const word& name()const
|
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
INLINE_FUNCTION_HD
|
|
||||||
int64 size()const
|
|
||||||
{
|
|
||||||
return mesh_->size();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto nx()const
|
|
||||||
{
|
|
||||||
return mesh_->nx();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto ny()const
|
|
||||||
{
|
|
||||||
return mesh_->ny();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto nz()const
|
|
||||||
{
|
|
||||||
return mesh_->nz();
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto& mesh()
|
|
||||||
{
|
|
||||||
return *mesh_;
|
|
||||||
}
|
|
||||||
|
|
||||||
INLINE_FUNCTION_HD
|
|
||||||
real cellVol()const
|
|
||||||
{
|
|
||||||
return mesh_->cellVol();
|
|
||||||
}
|
|
||||||
|
|
||||||
INLINE_FUNCTION_HD
|
|
||||||
T& operator()(int32 i, int32 j, int32 k)
|
|
||||||
{
|
|
||||||
return field_(i,j,k);
|
|
||||||
}
|
|
||||||
|
|
||||||
INLINE_FUNCTION_HD
|
|
||||||
const T& operator()(int32 i, int32 j, int32 k)const
|
|
||||||
{
|
|
||||||
return field_(i,j,k);
|
|
||||||
}
|
|
||||||
|
|
||||||
void fill(T val)
|
|
||||||
{
|
|
||||||
pFlow::fill(
|
|
||||||
field_,
|
|
||||||
val
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool write(iOstream& is, const IOPattern& iop)const override
|
|
||||||
{
|
|
||||||
notImplementedFunction;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool read(iIstream& is, const IOPattern& iop) override
|
|
||||||
{
|
|
||||||
notImplementedFunction;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool read(iIstream& is)
|
|
||||||
{
|
|
||||||
notImplementedFunction;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool write(iOstream& os)const
|
|
||||||
{
|
|
||||||
notImplementedFunction;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif // __rectMeshField_hpp__
|
|
@ -1,98 +0,0 @@
|
|||||||
/*------------------------------- phasicFlow ---------------------------------
|
|
||||||
O C enter of
|
|
||||||
O O E ngineering and
|
|
||||||
O O M ultiscale modeling of
|
|
||||||
OOOOOOO F luid flow
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Copyright (C): www.cemf.ir
|
|
||||||
email: hamid.r.norouzi AT gmail.com
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Licence:
|
|
||||||
This file is part of phasicFlow code. It is a free software for simulating
|
|
||||||
granular and multiphase flows. You can redistribute it and/or modify it under
|
|
||||||
the terms of GNU General Public License v3 or any other later versions.
|
|
||||||
|
|
||||||
phasicFlow is distributed to help others in their research in the field of
|
|
||||||
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
|
||||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef __rectMeshFieldToVTK_hpp__
|
|
||||||
#define __rectMeshFieldToVTK_hpp__
|
|
||||||
|
|
||||||
|
|
||||||
namespace pFlow
|
|
||||||
{
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
bool convertRectMeshField(iOstream& os, const rectMeshField_H<T>& field)
|
|
||||||
{
|
|
||||||
fatalErrorInFunction<< "this type is not supported "<<
|
|
||||||
field.typeName()<<endl;
|
|
||||||
fatalExit;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<>
|
|
||||||
bool convertRectMeshField(iOstream& os, const rectMeshField_H<real>& field)
|
|
||||||
{
|
|
||||||
|
|
||||||
os<<"FIELD FieldData 1 " << field.name() << " 1 "<< field.size() << " float\n";
|
|
||||||
for(int32 k=0; k<field.nz(); k++)
|
|
||||||
{
|
|
||||||
for(int32 j=0; j<field.ny(); j++)
|
|
||||||
{
|
|
||||||
for(int32 i=0; i<field.nx(); i++)
|
|
||||||
{
|
|
||||||
os<< field(i,j,k)<<"\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
os<<endl;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<>
|
|
||||||
bool convertRectMeshField(iOstream& os, const rectMeshField_H<realx3>& field)
|
|
||||||
{
|
|
||||||
|
|
||||||
os<<"FIELD FieldData 1 " << field.name() << " 3 "<< field.size() << " float\n";
|
|
||||||
for(int32 k=0; k<field.nz(); k++)
|
|
||||||
{
|
|
||||||
for(int32 j=0; j<field.ny(); j++)
|
|
||||||
{
|
|
||||||
for(int32 i=0; i<field.nx(); i++)
|
|
||||||
{
|
|
||||||
os<< field(i,j,k).x()<<" "<<field(i,j,k).y()<<" "<<field(i,j,k).z()<<"\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
os<<endl;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<>
|
|
||||||
bool convertRectMeshField(iOstream& os, const rectMeshField_H<int32>& field)
|
|
||||||
{
|
|
||||||
|
|
||||||
os<<"FIELD FieldData 1 " << field.name() << " 1 "<< field.size() << " int\n";
|
|
||||||
for(int32 k=0; k<field.nz(); k++)
|
|
||||||
{
|
|
||||||
for(int32 j=0; j<field.ny(); j++)
|
|
||||||
{
|
|
||||||
for(int32 i=0; i<field.nx(); i++)
|
|
||||||
{
|
|
||||||
os<< field(i,j,k)<<"\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
os<<endl;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,45 +0,0 @@
|
|||||||
/*------------------------------- phasicFlow ---------------------------------
|
|
||||||
O C enter of
|
|
||||||
O O E ngineering and
|
|
||||||
O O M ultiscale modeling of
|
|
||||||
OOOOOOO F luid flow
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Copyright (C): www.cemf.ir
|
|
||||||
email: hamid.r.norouzi AT gmail.com
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Licence:
|
|
||||||
This file is part of phasicFlow code. It is a free software for simulating
|
|
||||||
granular and multiphase flows. You can redistribute it and/or modify it under
|
|
||||||
the terms of GNU General Public License v3 or any other later versions.
|
|
||||||
|
|
||||||
phasicFlow is distributed to help others in their research in the field of
|
|
||||||
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
|
||||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef __rectMeshFields_hpp__
|
|
||||||
#define __rectMeshFields_hpp__
|
|
||||||
|
|
||||||
#include "rectMeshField.hpp"
|
|
||||||
|
|
||||||
namespace pFlow
|
|
||||||
{
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
using rectMeshField_H = rectMeshField<T>;
|
|
||||||
|
|
||||||
using int8RectMeshField_H = rectMeshField<int8>;
|
|
||||||
|
|
||||||
using int32RectMeshField_H = rectMeshField<int32>;
|
|
||||||
|
|
||||||
using int64RectMeshField_H = rectMeshField<int64>;
|
|
||||||
|
|
||||||
using realRectMeshField_H = rectMeshField<real>;
|
|
||||||
|
|
||||||
using realx3RectMeshField_H = rectMeshField<realx3>;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif // __rectMeshFields_hpp__
|
|
@ -1,52 +0,0 @@
|
|||||||
#include "rectangleMesh.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
pFlow::rectangleMesh::rectangleMesh
|
|
||||||
(
|
|
||||||
const box& mshBox,
|
|
||||||
int32 nx,
|
|
||||||
int32 ny,
|
|
||||||
int32 nz,
|
|
||||||
repository* rep
|
|
||||||
)
|
|
||||||
:
|
|
||||||
IOobject(
|
|
||||||
objectFile
|
|
||||||
(
|
|
||||||
"rectMesh",
|
|
||||||
"",
|
|
||||||
objectFile::READ_NEVER,
|
|
||||||
objectFile::WRITE_NEVER
|
|
||||||
),
|
|
||||||
IOPattern::MasterProcessorOnly,
|
|
||||||
rep
|
|
||||||
),
|
|
||||||
meshBox_(mshBox),
|
|
||||||
numCells_(nx, ny, nz)
|
|
||||||
{
|
|
||||||
if(mshBox.minPoint()>= mshBox.maxPoint())
|
|
||||||
{
|
|
||||||
fatalErrorInFunction<<"Lower corner point of mesh "<<mshBox.minPoint()<<
|
|
||||||
" confilicts with upper corner point of mesh "<<mshBox.maxPoint()<<endl;
|
|
||||||
fatalExit;
|
|
||||||
}
|
|
||||||
|
|
||||||
numCells_ = max( numCells_ , int32x3(1) );
|
|
||||||
|
|
||||||
dx_ = (mshBox.maxPoint() - mshBox.minPoint())/
|
|
||||||
realx3(numCells_.x_, numCells_.y_, numCells_.z_);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
pFlow::rectangleMesh::rectangleMesh(const dictionary &dict, repository* rep)
|
|
||||||
:
|
|
||||||
rectangleMesh(
|
|
||||||
box(dict),
|
|
||||||
dict.getVal<int32>("nx"),
|
|
||||||
dict.getVal<int32>("ny"),
|
|
||||||
dict.getVal<int32>("nz"),
|
|
||||||
rep
|
|
||||||
)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
@ -1,174 +0,0 @@
|
|||||||
/*------------------------------- phasicFlow ---------------------------------
|
|
||||||
O C enter of
|
|
||||||
O O E ngineering and
|
|
||||||
O O M ultiscale modeling of
|
|
||||||
OOOOOOO F luid flow
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Copyright (C): www.cemf.ir
|
|
||||||
email: hamid.r.norouzi AT gmail.com
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
Licence:
|
|
||||||
This file is part of phasicFlow code. It is a free software for simulating
|
|
||||||
granular and multiphase flows. You can redistribute it and/or modify it under
|
|
||||||
the terms of GNU General Public License v3 or any other later versions.
|
|
||||||
|
|
||||||
phasicFlow is distributed to help others in their research in the field of
|
|
||||||
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
|
||||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef __rectangleMesh_hpp__
|
|
||||||
#define __rectangleMesh_hpp__
|
|
||||||
|
|
||||||
#include "types.hpp"
|
|
||||||
#include "error.hpp"
|
|
||||||
#include "box.hpp"
|
|
||||||
#include "IOobject.hpp"
|
|
||||||
|
|
||||||
class repository;
|
|
||||||
|
|
||||||
namespace pFlow
|
|
||||||
{
|
|
||||||
|
|
||||||
class rectangleMesh
|
|
||||||
:
|
|
||||||
public IOobject
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
|
|
||||||
box meshBox_;
|
|
||||||
|
|
||||||
int32x3 numCells_;
|
|
||||||
|
|
||||||
realx3 dx_;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
TypeInfo("rectangleMesh");
|
|
||||||
|
|
||||||
rectangleMesh(
|
|
||||||
const box& mshBox,
|
|
||||||
int32 nx,
|
|
||||||
int32 ny,
|
|
||||||
int32 nz,
|
|
||||||
repository* rep);
|
|
||||||
|
|
||||||
rectangleMesh(const dictionary & dict, repository* rep);
|
|
||||||
|
|
||||||
|
|
||||||
rectangleMesh(const rectangleMesh&) = default;
|
|
||||||
|
|
||||||
|
|
||||||
rectangleMesh& operator = (const rectangleMesh&) = default;
|
|
||||||
|
|
||||||
rectangleMesh(rectangleMesh&&) = default;
|
|
||||||
|
|
||||||
|
|
||||||
rectangleMesh& operator = (rectangleMesh&&) = default;
|
|
||||||
|
|
||||||
~rectangleMesh() override = default;
|
|
||||||
|
|
||||||
int64 size()const
|
|
||||||
{
|
|
||||||
return numCells_.x_*numCells_.y_*numCells_.z_;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32 nx()const
|
|
||||||
{
|
|
||||||
return numCells_.x();
|
|
||||||
}
|
|
||||||
|
|
||||||
int32 ny()const
|
|
||||||
{
|
|
||||||
return numCells_.y();
|
|
||||||
}
|
|
||||||
|
|
||||||
int32 nz()const
|
|
||||||
{
|
|
||||||
return numCells_.z();
|
|
||||||
}
|
|
||||||
|
|
||||||
real cellVol()const
|
|
||||||
{
|
|
||||||
return dx_.x_*dx_.y_*dx_.z_;
|
|
||||||
}
|
|
||||||
|
|
||||||
realx3 minPoint()const
|
|
||||||
{
|
|
||||||
return meshBox_.minPoint();
|
|
||||||
}
|
|
||||||
|
|
||||||
realx3 maxPoint()const
|
|
||||||
{
|
|
||||||
return meshBox_.maxPoint();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
bool isInsideIndex(const realx3 p, int32x3 & ind )const
|
|
||||||
{
|
|
||||||
if(meshBox_.isInside(p))
|
|
||||||
{
|
|
||||||
ind = (p - meshBox_.minPoint())/dx_ ;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool write(iOstream& is, const IOPattern& iop)const override
|
|
||||||
{
|
|
||||||
notImplementedFunction;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool read(iIstream& is, const IOPattern& iop) override
|
|
||||||
{
|
|
||||||
notImplementedFunction;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool writeToVtk(iOstream& os)const
|
|
||||||
{
|
|
||||||
os<<"DATASET RECTILINEAR_GRID"<<endl;
|
|
||||||
os<<"DIMENSIONS "<<nx()+1<<" "<< ny()+1 << " "<< nz()+1 <<endl;
|
|
||||||
|
|
||||||
auto [x, y , z] = this->minPoint();
|
|
||||||
auto [dx, dy, dz] = dx_;
|
|
||||||
|
|
||||||
os<<"X_COORDINATES "<< nx()+1 <<" float\n";
|
|
||||||
for(int32 i=0; i<nx()+1; i++)
|
|
||||||
{
|
|
||||||
os<< x<<"\n";
|
|
||||||
x+= dx;
|
|
||||||
}
|
|
||||||
|
|
||||||
os<<"Y_COORDINATES "<< ny()+1 <<" float\n";
|
|
||||||
for(int32 j=0; j<ny()+1; j++)
|
|
||||||
{
|
|
||||||
os<< y <<"\n";
|
|
||||||
y+= dy;
|
|
||||||
}
|
|
||||||
|
|
||||||
os<<"Z_COORDINATES "<< nz()+1 <<" float\n";
|
|
||||||
for(int32 j=0; j<nz()+1; j++)
|
|
||||||
{
|
|
||||||
os<< z <<"\n";
|
|
||||||
z+= dz;
|
|
||||||
}
|
|
||||||
|
|
||||||
os<<"CELL_DATA "<< nx()*ny()*nz()<<endl;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif // __rectangleMesh_hpp__
|
|
Reference in New Issue
Block a user