From 43cc5a9ecd6cd9a912b7b28b9c0bbbb62920465e Mon Sep 17 00:00:00 2001 From: danielque Date: Tue, 22 Mar 2022 17:20:30 +0100 Subject: [PATCH] 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 --- .../subModels/IOModel/IOModel/IOModel.C | 12 +++++++++--- .../subModels/IOModel/IOModel/IOModel.H | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/lagrangian/cfdemParticle/subModels/IOModel/IOModel/IOModel.C b/src/lagrangian/cfdemParticle/subModels/IOModel/IOModel/IOModel.C index d0396774..daf4e617 100644 --- a/src/lagrangian/cfdemParticle/subModels/IOModel/IOModel/IOModel.C +++ b/src/lagrangian/cfdemParticle/subModels/IOModel/IOModel/IOModel.C @@ -126,7 +126,7 @@ void IOModel::streamDataToPath(const fileName& path, const double* const* array, return; } #if OPENFOAM_VERSION_MAJOR > 4 - else if (type == "position") + else if (barycentricOutput_ && type == "position") { // Force construction of face-diagonal decomposition before construction // of particle which uses parallel transfers. @@ -148,7 +148,7 @@ void IOModel::streamDataToPath(const fileName& path, const double* const* array, else if (type == "position") { #if OPENFOAM_VERSION_MAJOR > 4 - if (true) + if (barycentricOutput_) { particle part ( @@ -192,7 +192,8 @@ IOModel::IOModel dict_(dict), particleCloud_(sm), time_(sm.mesh().time()), - parOutput_(true) + parOutput_(true), + barycentricOutput_(true) { if ( particleCloud_.dataExchangeM().type()=="oneWayVTK" || @@ -202,6 +203,11 @@ IOModel::IOModel parOutput_ = false; Warning << "IO model is in serial write mode, only data on proc 0 is written" << endl; } + + if (dict_.found("cartesianOutput")) + { + barycentricOutput_ = false; + } } diff --git a/src/lagrangian/cfdemParticle/subModels/IOModel/IOModel/IOModel.H b/src/lagrangian/cfdemParticle/subModels/IOModel/IOModel/IOModel.H index 4785882b..01349a3d 100644 --- a/src/lagrangian/cfdemParticle/subModels/IOModel/IOModel/IOModel.H +++ b/src/lagrangian/cfdemParticle/subModels/IOModel/IOModel/IOModel.H @@ -65,6 +65,8 @@ protected: bool parOutput_; + bool barycentricOutput_; + public: //- Runtime type information