add option to enforce cartesian coordinates in lagrangian position output

add the option 'cartesianOutput' for the couplingProperties dict to
output particle positions as cartesian coordinates + cell index instead
of barycentric coordinates + cell index + tet face index + tet point
index in  OF > 4
this format does not require parafoam but works fine with paraview, plus
it avoids the temporary creation of OF particles for writing the output
This commit is contained in:
danielque
2022-03-22 17:20:30 +01:00
parent 6fdda583c2
commit 43cc5a9ecd
2 changed files with 11 additions and 3 deletions

View File

@ -126,7 +126,7 @@ void IOModel::streamDataToPath(const fileName& path, const double* const* array,
return; return;
} }
#if OPENFOAM_VERSION_MAJOR > 4 #if OPENFOAM_VERSION_MAJOR > 4
else if (type == "position") else if (barycentricOutput_ && type == "position")
{ {
// Force construction of face-diagonal decomposition before construction // Force construction of face-diagonal decomposition before construction
// of particle which uses parallel transfers. // of particle which uses parallel transfers.
@ -148,7 +148,7 @@ void IOModel::streamDataToPath(const fileName& path, const double* const* array,
else if (type == "position") else if (type == "position")
{ {
#if OPENFOAM_VERSION_MAJOR > 4 #if OPENFOAM_VERSION_MAJOR > 4
if (true) if (barycentricOutput_)
{ {
particle part particle part
( (
@ -192,7 +192,8 @@ IOModel::IOModel
dict_(dict), dict_(dict),
particleCloud_(sm), particleCloud_(sm),
time_(sm.mesh().time()), time_(sm.mesh().time()),
parOutput_(true) parOutput_(true),
barycentricOutput_(true)
{ {
if ( if (
particleCloud_.dataExchangeM().type()=="oneWayVTK" || particleCloud_.dataExchangeM().type()=="oneWayVTK" ||
@ -202,6 +203,11 @@ IOModel::IOModel
parOutput_ = false; parOutput_ = false;
Warning << "IO model is in serial write mode, only data on proc 0 is written" << endl; Warning << "IO model is in serial write mode, only data on proc 0 is written" << endl;
} }
if (dict_.found("cartesianOutput"))
{
barycentricOutput_ = false;
}
} }

View File

@ -65,6 +65,8 @@ protected:
bool parOutput_; bool parOutput_;
bool barycentricOutput_;
public: public:
//- Runtime type information //- Runtime type information