diff --git a/applications/utilities/postProcessing/lumped/lumpedPointForces/lumpedPointForces.C b/applications/utilities/postProcessing/lumped/lumpedPointForces/lumpedPointForces.C index 8e7423557a..0ba2b9a0b3 100644 --- a/applications/utilities/postProcessing/lumped/lumpedPointForces/lumpedPointForces.C +++ b/applications/utilities/postProcessing/lumped/lumpedPointForces/lumpedPointForces.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2016-2017 OpenCFD Ltd. + Copyright (C) 2016-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,8 +27,8 @@ Application lumpedPointForces Description - Extract force/moment information from existing calculations based - on the segmentation of the pressure integration zones. + Extract force/moment information from simulation results that + use the lumped points movement description. \*---------------------------------------------------------------------------*/ @@ -37,7 +37,7 @@ Description #include "timeSelector.H" #include "volFields.H" #include "IOobjectList.H" - +#include "foamVtkSeriesWriter.H" #include "lumpedPointTools.H" #include "lumpedPointIOMovement.H" @@ -83,8 +83,8 @@ int main(int argc, char *argv[]) { argList::addNote ( - "Extract force/moment information from existing calculations based" - " on the lumpedPoints pressure zones." + "Extract force/moment information from simulation results that" + " use the lumped points movement description." ); argList::addBoolOption @@ -102,31 +102,33 @@ int main(int argc, char *argv[]) const bool withVTK = args.found("vtk"); #include "createTime.H" + instantList timeDirs = timeSelector::select0(runTime, args); #include "createNamedMesh.H" - autoPtr movement = lumpedPointIOMovement::New - ( - runTime - ); + autoPtr movement = lumpedPointIOMovement::New(mesh); - if (!movement.valid()) + if (!movement) { - Info<< "no valid movement given" << endl; + Info<< "No valid movement found" << endl; return 1; } - const labelList patchLst = lumpedPointTools::lumpedPointPatchList(mesh); - if (patchLst.empty()) + const label nPatches = lumpedPointTools::setPatchControls(mesh); + if (!nPatches) { - Info<< "no patch list found" << endl; + Info<< "No point patches with lumped movement found" << endl; return 2; } - movement().setMapping(mesh, patchLst, lumpedPointTools::points0Field(mesh)); + Info<<"Lumped point patch controls set on " << nPatches + << " patches" << nl; + + vtk::seriesWriter forceSeries; List forces, moments; + forAll(timeDirs, timei) { runTime.setTime(timeDirs[timei], timei); @@ -164,11 +166,21 @@ int main(int argc, char *argv[]) forces, moments ); + + forceSeries.append(runTime.timeIndex(), outputName); } } } - Info<< "End\n" << endl; + + // Create file series + + if (forceSeries.size()) + { + forceSeries.write("forces.vtp"); + } + + Info<< "\nEnd\n" << endl; return 0; } diff --git a/applications/utilities/postProcessing/lumped/lumpedPointMovement/lumpedPointMovement.C b/applications/utilities/postProcessing/lumped/lumpedPointMovement/lumpedPointMovement.C index a6ca67f851..1925d5d569 100644 --- a/applications/utilities/postProcessing/lumped/lumpedPointMovement/lumpedPointMovement.C +++ b/applications/utilities/postProcessing/lumped/lumpedPointMovement/lumpedPointMovement.C @@ -40,15 +40,50 @@ Description #include "argList.H" #include "Time.H" -#include "timeSelector.H" - #include "OFstream.H" - +#include "foamVtkSeriesWriter.H" #include "lumpedPointTools.H" #include "lumpedPointIOMovement.H" using namespace Foam; + +inline List getResponseTable +( + const fileName& file, + const lumpedPointState& state0 +) +{ + return lumpedPointTools::lumpedPointStates + ( + file, + state0.rotationOrder(), + state0.degrees() + ); +} + + +void echoTableLimits +( + const List& tbl, + const label span, + const label maxOut +) +{ + Info<< "Using response table with " << tbl.size() << " entries" << nl; + + if (span) + { + Info<< "Increment input by " << span << nl; + } + + if (maxOut) + { + Info<< "Stopping after " << maxOut << " outputs" << nl; + } +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // int main(int argc, char *argv[]) @@ -59,7 +94,6 @@ int main(int argc, char *argv[]) " for diagnostic purposes." ); - argList::noParallel(); argList::noFunctionObjects(); // Never use function objects argList::addOption ( @@ -71,7 +105,7 @@ int main(int argc, char *argv[]) ( "span", "N", - "Increment each input by factor N (default: 1)" + "Increment each input by N (default: 1)" ); argList::addOption ( @@ -79,6 +113,17 @@ int main(int argc, char *argv[]) "factor", "Relaxation/scaling factor for movement (default: 1)" ); + argList::addOption + ( + "visual-length", + "len", + "Visualization length for planes (visualized as triangles)" + ); + argList::addBoolOption + ( + "dry-run", + "Test movement without a mesh" + ); argList::addBoolOption ( "removeLock", @@ -96,45 +141,70 @@ int main(int argc, char *argv[]) const label maxOut = Foam::max(0, args.getOrDefault