mirror of
https://github.com/PhasicFlow/phasicFlow.git
synced 2025-08-07 03:37:02 +00:00
PostprocessData update
Modifications on fieldsDataBase to work both during simulation and post-simulation Some bug fixes and changes to the code based Correction for region volume
This commit is contained in:
@ -128,7 +128,7 @@ Licence:
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
#include "postprocessOperation.hpp"
|
||||
#include "PostprocessOperationAverage.hpp"
|
||||
#include "regionField.hpp"
|
||||
#include "includeMask.hpp"
|
||||
|
||||
@ -138,7 +138,7 @@ namespace pFlow
|
||||
|
||||
class PostprocessOperationAvMassVelocity
|
||||
:
|
||||
public postprocessOperation
|
||||
public PostprocessOperationAverage
|
||||
{
|
||||
|
||||
public:
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "PostprocessOperationAverage.hpp"
|
||||
#include "dictionary.hpp"
|
||||
#include "fieldsDataBase.hpp"
|
||||
#include "fieldFunctions.hpp"
|
||||
#include "operationFunctions.hpp"
|
||||
|
||||
/// Constructs average processor and initializes result field based on input field type
|
||||
pFlow::PostprocessOperationAverage::PostprocessOperationAverage
|
||||
@ -80,7 +80,8 @@ pFlow::PostprocessOperationAverage::PostprocessOperationAverage
|
||||
/// Performs weighted average of field values within each region
|
||||
bool pFlow::PostprocessOperationAverage::execute
|
||||
(
|
||||
const std::vector<span<real>>& weights
|
||||
const std::vector<span<real>>& weights,
|
||||
const regionField<real>& volFactor
|
||||
)
|
||||
{
|
||||
auto allField = database().updateFieldAll(fieldName());
|
||||
@ -99,7 +100,7 @@ bool pFlow::PostprocessOperationAverage::execute
|
||||
return executeAverageOperation(
|
||||
procName,
|
||||
field,
|
||||
regP,
|
||||
volFactor,
|
||||
dbVol,
|
||||
weights,
|
||||
phi,
|
||||
@ -124,6 +125,7 @@ bool pFlow::PostprocessOperationAverage::execute
|
||||
procName,
|
||||
field,
|
||||
std::get<regionField<T>>(processedRegField),
|
||||
volFactor,
|
||||
dbVol,
|
||||
weights,
|
||||
mask);
|
||||
|
@ -193,7 +193,9 @@ public:
|
||||
/// @brief Execute average operation on field values
|
||||
/// @param weights Weight factors for particles
|
||||
/// @return True if successful
|
||||
bool execute(const std::vector<span<real>>& weights) override;
|
||||
bool execute(
|
||||
const std::vector<span<real>>& weights,
|
||||
const regionField<real>& volFactor) override;
|
||||
|
||||
};
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "PostprocessOperationSum.hpp"
|
||||
#include "dictionary.hpp"
|
||||
#include "fieldsDataBase.hpp"
|
||||
#include "fieldFunctions.hpp"
|
||||
#include "operationFunctions.hpp"
|
||||
|
||||
/// Constructs sum processor and initializes result field based on input field type
|
||||
pFlow::PostprocessOperationSum::PostprocessOperationSum
|
||||
@ -41,7 +41,8 @@ pFlow::PostprocessOperationSum::PostprocessOperationSum
|
||||
/// Performs weighted sum of field values within each region
|
||||
bool pFlow::PostprocessOperationSum::execute
|
||||
(
|
||||
const std::vector<span<real>>& weights
|
||||
const std::vector<span<real>>& weights,
|
||||
const regionField<real>& volFactor
|
||||
)
|
||||
{
|
||||
auto allField = database().updateFieldAll(fieldName());
|
||||
@ -60,7 +61,7 @@ bool pFlow::PostprocessOperationSum::execute
|
||||
return executeSumOperation(
|
||||
procName,
|
||||
field,
|
||||
regP,
|
||||
volFactor,
|
||||
dbVol,
|
||||
weights,
|
||||
phi,
|
||||
|
@ -175,7 +175,9 @@ public:
|
||||
/// @brief Execute sum operation on field values
|
||||
/// @param weights Weight factors for particles
|
||||
/// @return True if successful
|
||||
bool execute(const std::vector<span<real>>& weights) override;
|
||||
bool execute(
|
||||
const std::vector<span<real>>& weights,
|
||||
const regionField<real>& volFactor) override;
|
||||
|
||||
};
|
||||
|
||||
|
@ -18,8 +18,8 @@ Licence:
|
||||
|
||||
-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __fieldFunctions_hpp__
|
||||
#define __fieldFunctions_hpp__
|
||||
#ifndef __operationFunctions_hpp__
|
||||
#define __operationFunctions_hpp__
|
||||
|
||||
#include <vector>
|
||||
|
||||
@ -36,13 +36,14 @@ regionField<T> executeSumOperation
|
||||
(
|
||||
const word& regFieldName,
|
||||
const span<T>& field,
|
||||
const regionPoints& regPoints,
|
||||
const regionField<real>& volFactor,
|
||||
const bool devideByVol,
|
||||
const std::vector<span<real>>& weights,
|
||||
const span<real>& phi,
|
||||
const includeMask::Mask& mask
|
||||
)
|
||||
{
|
||||
const auto& regPoints = volFactor.regPoints();
|
||||
regionField<T> processedField(regFieldName, regPoints, T{});
|
||||
auto vols = regPoints.volumes();
|
||||
|
||||
@ -63,7 +64,7 @@ regionField<T> executeSumOperation
|
||||
}
|
||||
if(devideByVol)
|
||||
{
|
||||
processedField[reg] = sum/vols[reg];
|
||||
processedField[reg] = sum/(volFactor[reg] * vols[reg]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -80,13 +81,15 @@ regionField<T> executeAverageOperation
|
||||
(
|
||||
const word& regFieldName,
|
||||
const span<T>& field,
|
||||
const regionPoints& regPoints,
|
||||
const bool devideByVol,
|
||||
const regionField<real>& volFactor,
|
||||
const bool devideByVol,
|
||||
const std::vector<span<real>>& weights,
|
||||
const span<real>& phi,
|
||||
const includeMask::Mask& mask
|
||||
)
|
||||
{
|
||||
|
||||
const auto& regPoints = volFactor.regPoints();
|
||||
regionField<T> processedField(regFieldName, regPoints, T{});
|
||||
auto vols = regPoints.volumes();
|
||||
|
||||
@ -113,7 +116,7 @@ regionField<T> executeAverageOperation
|
||||
|
||||
if(devideByVol)
|
||||
{
|
||||
processedField[reg] = sumNum / max(sumDen, smallValue) / vols[reg];
|
||||
processedField[reg] = sumNum / max(sumDen, smallValue) / (volFactor[reg] * vols[reg]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -131,7 +134,8 @@ regionField<T> executeFluctuation2Operation
|
||||
(
|
||||
const word& regFieldName,
|
||||
const span<T>& field,
|
||||
const regionField<T>& fieldAvg,
|
||||
const regionField<T>& fieldAvg,
|
||||
const regionField<real>& volFactor,
|
||||
const bool devideByVol,
|
||||
const std::vector<span<real>>& weights,
|
||||
const includeMask::Mask& mask
|
||||
@ -145,7 +149,7 @@ regionField<T> executeFluctuation2Operation
|
||||
{
|
||||
auto partIndices = regPoints.indices(reg);
|
||||
auto w = weights[reg];
|
||||
auto vol = vols[reg];
|
||||
auto vol = volFactor[reg] * vols[reg];
|
||||
T avField{};
|
||||
if(devideByVol)
|
||||
{
|
||||
@ -188,4 +192,4 @@ regionField<T> executeFluctuation2Operation
|
||||
|
||||
} // namespace pFlow
|
||||
|
||||
#endif //__fieldFunctions_hpp__
|
||||
#endif //__operationFunctions_hpp__
|
Reference in New Issue
Block a user