From b0136d835e032111a59cb7e2c4573b888038ac94 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 10 Jun 2020 01:10:27 +0200 Subject: [PATCH] ENH: lumped point motion using local linear basic functions (#1341) - the earlier implementation of externally controlled lumped point motion (see merge request !120 and OpenFOAM-v1706 release notes) was conceived for the motion of simple structures such as buildings or simple beams. The motion controller was simply defined in terms of an orientation axis and divisions along that axis. To include complex structures, multiple motion controllers are defined in terms of support points and connectivity. The points can have additional node Ids associated with them, which makes it easier to map to/from FEA models. OLD system/lumpedPointMovement specification -------------------------------------------- //- Reference axis for the locations axis (0 0 1); //- Locations of the lumped points locations (0 0.05 .. 0.5); NEW system/lumpedPointMovement specification -------------------------------------------- // Locations of the lumped points points ( (0 0 0.00) (0 0 0.05) ... (0 0 0.50) ); //- Connectivity for motion controllers controllers { vertical { pointLabels (0 1 2 3 4 5 6 7 8 9 10); } } And the controller(s) must be associated with the given pointDisplacement patch. Eg, somePatch { type lumpedPointDisplacement; value uniform (0 0 0); controllers ( vertical ); // <-- NEW } TUT: adjust building motion tutorial - use new controllor definitions - replace building response file with executable - add updateControl in dynamicMeshDict for slowly moving structure --- .../lumpedPointForces/lumpedPointForces.C | 46 +- .../lumpedPointMovement/lumpedPointMovement.C | 375 ++++-- .../lumped/lumpedPointZones/Make/options | 7 +- .../lumpedPointZones/lumpedPointZones.C | 100 +- src/lumpedPointMotion/Make/files | 2 + .../controller/lumpedPointController.C | 93 ++ .../controller/lumpedPointController.H | 140 ++- .../interpolation/lumpedPointInterpolator.H | 161 ++- .../interpolation/lumpedPointInterpolatorI.H | 190 +++ src/lumpedPointMotion/lumpedPointMovementDict | 74 +- .../movement/lumpedPointIOMovement.C | 12 +- .../movement/lumpedPointIOMovement.H | 43 +- .../movement/lumpedPointMovement.C | 1113 ++++++++++++----- .../movement/lumpedPointMovement.H | 309 ++--- .../movement/lumpedPointMovementI.H | 74 +- .../movement/lumpedPointMovementWriter.C | 332 ++--- ...edPointDisplacementPointPatchVectorField.C | 246 +++- ...edPointDisplacementPointPatchVectorField.H | 36 +- .../state/lumpedPointState.C | 174 ++- .../state/lumpedPointState.H | 125 +- .../state/lumpedPointStateI.H | 15 +- .../state/lumpedPointStateWriter.C | 279 +++-- .../tools/lumpedPointTools.C | 196 ++- .../tools/lumpedPointTools.H | 56 +- .../lumpedPointMotion/building/Allclean | 5 +- .../lumpedPointMotion/building/Allrun | 95 +- .../lumpedPointMotion/building/Allrun.move | 72 +- .../lumpedPointMotion/building/code/Allclean | 13 + .../building/code/Make/files | 3 + .../building/code/Make/options | 13 + .../building/code/building-motion.C | 682 ++++++++++ .../building/files/Allrun.moveMesh | 34 + .../building/files/Allrun.movement | 19 +- .../building/files/Allrun.transient | 20 +- .../building/files/RunFunctions | 147 +++ .../building/files/response.txt.gz | Bin 775169 -> 0 bytes .../building/steady/0.orig/pointDisplacement | 3 +- .../building/steady/Allclean | 3 + .../lumpedPointMotion/building/steady/Allrun | 1 - .../building/steady/Allrun.init | 11 + .../building/steady/Allrun.pre | 5 +- .../building/steady/constant/dynamicMeshDict | 8 +- .../steady/system/lumpedPointControllers | 44 + .../steady/system/lumpedPointMovement | 39 +- 44 files changed, 4059 insertions(+), 1356 deletions(-) create mode 100644 src/lumpedPointMotion/controller/lumpedPointController.C create mode 100644 src/lumpedPointMotion/interpolation/lumpedPointInterpolatorI.H create mode 100755 tutorials/incompressible/lumpedPointMotion/building/code/Allclean create mode 100644 tutorials/incompressible/lumpedPointMotion/building/code/Make/files create mode 100644 tutorials/incompressible/lumpedPointMotion/building/code/Make/options create mode 100644 tutorials/incompressible/lumpedPointMotion/building/code/building-motion.C create mode 100755 tutorials/incompressible/lumpedPointMotion/building/files/Allrun.moveMesh create mode 100644 tutorials/incompressible/lumpedPointMotion/building/files/RunFunctions delete mode 100644 tutorials/incompressible/lumpedPointMotion/building/files/response.txt.gz create mode 100755 tutorials/incompressible/lumpedPointMotion/building/steady/Allrun.init create mode 100644 tutorials/incompressible/lumpedPointMotion/building/steady/system/lumpedPointControllers 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