From 8f5997bb6aa31f72d23cc1c1627becf5c3fd07c9 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 19 Nov 2015 09:35:20 +0000 Subject: [PATCH] ENH: displacementMotionSolver: additional hierarchy - shm: have displacementMotionSolver as alternative mesh shrinker (instead of medialAxis). - updated iglooWithFridges tutorial to use displacementLaplacian - selectable interpolation from cells to points in the motion solvers using the 'interpolation' keyword: interpolation volPointInterpolation; // default or interpolation patchCorrected (lowerWall upperWall); - wrapped up mesh shrinkers (see above) for use as a displacementMotionSolver (i.e. the opposite of the displacementMotionSolver mesh shrinker) --- .../snappyHexMesh/snappyHexMeshDict | 26 +- src/Allwmake | 2 +- src/dynamicMesh/Make/files | 1 + src/fvMotionSolver/Make/files | 5 + ...lacementComponentLaplacianFvMotionSolver.C | 14 +- ...lacementComponentLaplacianFvMotionSolver.H | 8 +- ...velocityComponentLaplacianFvMotionSolver.C | 14 +- ...velocityComponentLaplacianFvMotionSolver.H | 8 +- .../displacementSBRStressFvMotionSolver.C | 65 ++- .../displacementSBRStressFvMotionSolver.H | 17 +- .../displacementInterpolationMotionSolver.C | 61 ++- .../displacementInterpolationMotionSolver.H | 16 +- .../displacementLaplacianFvMotionSolver.C | 111 ++++- .../displacementLaplacianFvMotionSolver.H | 17 +- .../displacementLayeredMotionMotionSolver.C | 24 +- .../displacementLayeredMotionMotionSolver.H | 14 +- .../surfaceAlignedSBRStressFvMotionSolver.C | 422 ++++++++++++++++++ .../surfaceAlignedSBRStressFvMotionSolver.H | 188 ++++++++ .../velocityLaplacianFvMotionSolver.C | 21 +- .../velocityLaplacianFvMotionSolver.H | 8 +- .../motionInterpolation/motionInterpolation.C | 132 ++++++ .../motionInterpolation/motionInterpolation.H | 147 ++++++ .../patchCorrectedInterpolation.C | 124 +++++ .../patchCorrectedInterpolation.H | 165 +++++++ .../patchCorrectedInterpolationTemplates.C | 223 +++++++++ .../patchTransformedInterpolation.C | 220 +++++++++ .../patchTransformedInterpolation.H | 132 ++++++ .../displacementMotionSolverMeshMover.C | 5 +- .../displacementMotionSolverMeshMover.H | 2 +- .../iglooWithFridges/system/fvSchemes | 1 + .../iglooWithFridges/system/fvSolution | 6 + .../iglooWithFridges/system/snappyHexMeshDict | 29 +- 32 files changed, 2146 insertions(+), 82 deletions(-) create mode 100644 src/fvMotionSolver/fvMotionSolvers/displacement/surfaceAlignedSBRStress/surfaceAlignedSBRStressFvMotionSolver.C create mode 100644 src/fvMotionSolver/fvMotionSolvers/displacement/surfaceAlignedSBRStress/surfaceAlignedSBRStressFvMotionSolver.H create mode 100644 src/fvMotionSolver/motionInterpolation/motionInterpolation/motionInterpolation.C create mode 100644 src/fvMotionSolver/motionInterpolation/motionInterpolation/motionInterpolation.H create mode 100644 src/fvMotionSolver/motionInterpolation/patchCorrected/patchCorrectedInterpolation.C create mode 100644 src/fvMotionSolver/motionInterpolation/patchCorrected/patchCorrectedInterpolation.H create mode 100644 src/fvMotionSolver/motionInterpolation/patchCorrected/patchCorrectedInterpolationTemplates.C create mode 100644 src/fvMotionSolver/motionInterpolation/patchTransformed/patchTransformedInterpolation.C create mode 100644 src/fvMotionSolver/motionInterpolation/patchTransformed/patchTransformedInterpolation.H diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict index 6b40b2ab5e..e197b68888 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict @@ -524,7 +524,25 @@ addLayersControls - // Medial axis analysis + // Choice of mesh shrinking algorithm + + // Optional mesh shrinking algorithm (default is displacementMedialAxis) + // The displacementMotionSolver is a wrapper around the displacement + // motion solvers. It needs specification of the solver to use and + // its control dictionary. + //meshShrinker displacementMotionSolver; + //solver displacementLaplacian; + //displacementLaplacianCoeffs + //{ + // diffusivity quadratic inverseDistance + // ( + // sphere.stl_firstSolid + // maxY + // ); + //} + + + // Medial axis analysis (for use with default displacementMedialAxis) // Angle used to pick up medial axis points // Note: changed(corrected) w.r.t 17x! 90 degrees corresponds to 130 @@ -552,9 +570,6 @@ addLayersControls // Default is false. //detectExtrusionIsland true; - - // Mesh shrinking - // Optional: at non-patched sides allow mesh to slip if extrusion // direction makes angle larger than slipFeatureAngle. Default is // 0.5*featureAngle. @@ -564,6 +579,9 @@ addLayersControls // before upon reaching a correct mesh. nRelaxIter 5; + + // Mesh shrinking + // Create buffer region for new layer terminations, i.e. gradually // step down number of layers. Set to <0 to terminate layer in one go. nBufferCellsNoExtrude 0; diff --git a/src/Allwmake b/src/Allwmake index 35819399ec..5b2a4fdfbc 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -47,10 +47,10 @@ wmake $targetType lagrangian/distributionModels wmake $targetType genericPatchFields wmake $targetType conversion -wmake $targetType sampling wmake $targetType mesh/extrudeModel wmake $targetType dynamicMesh wmake $targetType dynamicFvMesh +wmake $targetType sampling wmake $targetType topoChangerFvMesh # Compile scotchDecomp, metisDecomp etc. diff --git a/src/dynamicMesh/Make/files b/src/dynamicMesh/Make/files index 96b80d6e32..ec2ec3418e 100644 --- a/src/dynamicMesh/Make/files +++ b/src/dynamicMesh/Make/files @@ -103,6 +103,7 @@ motionSolver/motionSolver/motionSolver.C motionSolver/displacement/displacementMotionSolver.C motionSolver/componentDisplacement/componentDisplacementMotionSolver.C motionSolver/velocity/velocityMotionSolver.C +motionSolver/velocityDisplacement/velocityDisplacementMotionSolver.C motionSolver/componentVelocity/componentVelocityMotionSolver.C createShellMesh/createShellMesh.C diff --git a/src/fvMotionSolver/Make/files b/src/fvMotionSolver/Make/files index 13204042af..19475e258b 100644 --- a/src/fvMotionSolver/Make/files +++ b/src/fvMotionSolver/Make/files @@ -4,6 +4,7 @@ fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.C fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C fvMotionSolvers/displacement/layeredSolver/pointEdgeStructuredWalk.C +fvMotionSolvers/displacement/surfaceAlignedSBRStress/surfaceAlignedSBRStressFvMotionSolver.C fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C @@ -22,6 +23,10 @@ motionDiffusivity/file/fileDiffusivity.C motionDiffusivity/manipulators/quadratic/quadraticDiffusivity.C motionDiffusivity/manipulators/exponential/exponentialDiffusivity.C +motionInterpolation/motionInterpolation/motionInterpolation.C +motionInterpolation/patchCorrected/patchCorrectedInterpolation.C +motionInterpolation/patchTransformed/patchTransformedInterpolation.C + fvPatchFields/derived/cellMotion/cellMotionFvPatchFields.C fvPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementFvPatchFields.C diff --git a/src/fvMotionSolver/fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C index 8f90cb8444..e8d3d4eb93 100644 --- a/src/fvMotionSolver/fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C @@ -2,8 +2,8 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -24,11 +24,11 @@ License \*---------------------------------------------------------------------------*/ #include "displacementComponentLaplacianFvMotionSolver.H" +#include "motionInterpolation.H" #include "motionDiffusivity.H" #include "fvmLaplacian.H" #include "addToRunTimeSelectionTable.H" #include "mapPolyMesh.H" -#include "volPointInterpolation.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -76,6 +76,12 @@ displacementComponentLaplacianFvMotionSolver cellMotionBoundaryTypes(pointDisplacement_.boundaryField()) ), pointLocation_(NULL), + interpolationPtr_ + ( + coeffDict().found("interpolation") + ? motionInterpolation::New(fvMesh_, coeffDict().lookup("interpolation")) + : motionInterpolation::New(fvMesh_) + ), diffusivityPtr_ ( motionDiffusivity::New(fvMesh_, coeffDict().lookup("diffusivity")) @@ -140,7 +146,7 @@ Foam::displacementComponentLaplacianFvMotionSolver:: Foam::tmp Foam::displacementComponentLaplacianFvMotionSolver::curPoints() const { - volPointInterpolation::New(fvMesh_).interpolate + interpolationPtr_->interpolate ( cellDisplacement_, pointDisplacement_ diff --git a/src/fvMotionSolver/fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.H index 56a6f932dd..91575ae99d 100644 --- a/src/fvMotionSolver/fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.H +++ b/src/fvMotionSolver/fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.H @@ -2,8 +2,8 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -45,6 +45,7 @@ namespace Foam { // Forward class declarations +class motionInterpolation; class motionDiffusivity; /*---------------------------------------------------------------------------*\ @@ -65,6 +66,9 @@ class displacementComponentLaplacianFvMotionSolver // boundary conditions. mutable autoPtr pointLocation_; + //- Interpolation used to transfer cell displacement to the points + autoPtr interpolationPtr_; + //- Diffusivity used to control the motion autoPtr diffusivityPtr_; diff --git a/src/fvMotionSolver/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.C index 124a679e15..aab69c3d85 100644 --- a/src/fvMotionSolver/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.C @@ -2,8 +2,8 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -24,10 +24,10 @@ License \*---------------------------------------------------------------------------*/ #include "velocityComponentLaplacianFvMotionSolver.H" +#include "motionInterpolation.H" #include "motionDiffusivity.H" #include "fvmLaplacian.H" #include "addToRunTimeSelectionTable.H" -#include "volPointInterpolation.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -74,6 +74,12 @@ velocityComponentLaplacianFvMotionSolver ), cellMotionBoundaryTypes(pointMotionU_.boundaryField()) ), + interpolationPtr_ + ( + coeffDict().found("interpolation") + ? motionInterpolation::New(fvMesh_, coeffDict().lookup("interpolation")) + : motionInterpolation::New(fvMesh_) + ), diffusivityPtr_ ( motionDiffusivity::New(fvMesh_, coeffDict().lookup("diffusivity")) @@ -93,7 +99,7 @@ Foam::velocityComponentLaplacianFvMotionSolver:: Foam::tmp Foam::velocityComponentLaplacianFvMotionSolver::curPoints() const { - volPointInterpolation::New(fvMesh_).interpolate + interpolationPtr_->interpolate ( cellMotionU_, pointMotionU_ diff --git a/src/fvMotionSolver/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.H index 1f58ddf414..aee616cb21 100644 --- a/src/fvMotionSolver/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.H +++ b/src/fvMotionSolver/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.H @@ -2,8 +2,8 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -45,6 +45,7 @@ namespace Foam { // Forward class declarations +class motionInterpolation; class motionDiffusivity; /*---------------------------------------------------------------------------*\ @@ -61,6 +62,9 @@ class velocityComponentLaplacianFvMotionSolver //- Cell-centre motion field mutable volScalarField cellMotionU_; + //- Interpolation used to transfer cell displacement to the points + autoPtr interpolationPtr_; + //- Diffusivity used to control the motion autoPtr diffusivityPtr_; diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C index 7aafefc0c5..508c5b3be1 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "displacementSBRStressFvMotionSolver.H" +#include "motionInterpolation.H" #include "motionDiffusivity.H" #include "fvmLaplacian.H" #include "addToRunTimeSelectionTable.H" @@ -32,7 +33,6 @@ License #include "surfaceInterpolate.H" #include "fvcLaplacian.H" #include "mapPolyMesh.H" -#include "volPointInterpolation.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -46,6 +46,13 @@ namespace Foam displacementSBRStressFvMotionSolver, dictionary ); + + addToRunTimeSelectionTable + ( + displacementMotionSolver, + displacementSBRStressFvMotionSolver, + displacement + ); } @@ -78,6 +85,58 @@ Foam::displacementSBRStressFvMotionSolver::displacementSBRStressFvMotionSolver ), cellMotionBoundaryTypes(pointDisplacement().boundaryField()) ), + interpolationPtr_ + ( + coeffDict().found("interpolation") + ? motionInterpolation::New(fvMesh_, coeffDict().lookup("interpolation")) + : motionInterpolation::New(fvMesh_) + ), + diffusivityPtr_ + ( + motionDiffusivity::New(fvMesh_, coeffDict().lookup("diffusivity")) + ) +{} + + +Foam::displacementSBRStressFvMotionSolver:: +displacementSBRStressFvMotionSolver +( + const polyMesh& mesh, + const IOdictionary& dict, + const pointVectorField& pointDisplacement, + const pointIOField& points0 +) +: + displacementMotionSolver(mesh, dict, pointDisplacement, points0, typeName), + fvMotionSolverCore(mesh), + cellDisplacement_ + ( + IOobject + ( + "cellDisplacement", + mesh.time().timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + fvMesh_, + dimensionedVector + ( + "cellDisplacement", + displacementMotionSolver::pointDisplacement().dimensions(), + vector::zero + ), + cellMotionBoundaryTypes + ( + displacementMotionSolver::pointDisplacement().boundaryField() + ) + ), + interpolationPtr_ + ( + coeffDict().found("interpolation") + ? motionInterpolation::New(fvMesh_, coeffDict().lookup("interpolation")) + : motionInterpolation::New(fvMesh_) + ), diffusivityPtr_ ( motionDiffusivity::New(fvMesh_, coeffDict().lookup("diffusivity")) @@ -97,7 +156,7 @@ Foam::displacementSBRStressFvMotionSolver:: Foam::tmp Foam::displacementSBRStressFvMotionSolver::curPoints() const { - volPointInterpolation::New(fvMesh_).interpolate + interpolationPtr_->interpolate ( cellDisplacement_, pointDisplacement_ diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.H index 566a98686b..cb7de0c6d3 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.H +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.H @@ -2,8 +2,8 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation - \\/ M anipulation | + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -45,6 +45,7 @@ namespace Foam { // Forward class declarations +class motionInterpolation; class motionDiffusivity; /*---------------------------------------------------------------------------*\ @@ -61,6 +62,9 @@ class displacementSBRStressFvMotionSolver //- Cell-centre motion field mutable volVectorField cellDisplacement_; + //- Interpolation used to transfer cell displacement to the points + autoPtr interpolationPtr_; + //- Diffusivity used to control the motion autoPtr diffusivityPtr_; @@ -92,6 +96,15 @@ public: const IOdictionary& ); + //- Construct from components + displacementSBRStressFvMotionSolver + ( + const polyMesh& mesh, + const IOdictionary& dict, + const pointVectorField& pointDisplacement, + const pointIOField& points0 + ); + //- Destructor ~displacementSBRStressFvMotionSolver(); diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.C index 6029c8383f..349c5d406e 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.C @@ -2,8 +2,8 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation - \\/ M anipulation | + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -44,6 +44,13 @@ namespace Foam dictionary ); + addToRunTimeSelectionTable + ( + displacementMotionSolver, + displacementInterpolationMotionSolver, + displacement + ); + template<> const word IOList >::typeName("scalarVectorTable"); } @@ -51,26 +58,20 @@ namespace Foam // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::displacementInterpolationMotionSolver:: -displacementInterpolationMotionSolver +void Foam::displacementInterpolationMotionSolver::read ( - const polyMesh& mesh, - const IOdictionary& dict + const dictionary& coeffDict ) -: - displacementMotionSolver(mesh, dict, typeName) { // Get zones and their interpolation tables for displacement // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ List > faceZoneToTable ( - coeffDict().lookup("interpolationTables") + coeffDict.lookup("interpolationTables") ); - const faceZoneMesh& fZones = mesh.faceZones(); + const faceZoneMesh& fZones = mesh().faceZones(); times_.setSize(fZones.size()); displacements_.setSize(fZones.size()); @@ -88,7 +89,7 @@ displacementInterpolationMotionSolver "displacementInterpolationMotionSolver(const polyMesh&," "Istream&)" ) << "Cannot find zone " << zoneName << endl - << "Valid zones are " << mesh.faceZones().names() + << "Valid zones are " << mesh().faceZones().names() << exit(FatalError); } @@ -99,9 +100,9 @@ displacementInterpolationMotionSolver IOobject ( tableName, - mesh.time().constant(), + mesh().time().constant(), "tables", - mesh, + mesh(), IOobject::MUST_READ, IOobject::NO_WRITE, false @@ -299,6 +300,36 @@ displacementInterpolationMotionSolver } +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::displacementInterpolationMotionSolver:: +displacementInterpolationMotionSolver +( + const polyMesh& mesh, + const IOdictionary& dict +) +: + displacementMotionSolver(mesh, dict, typeName) +{ + read(coeffDict()); +} + + +Foam::displacementInterpolationMotionSolver:: +displacementInterpolationMotionSolver +( + const polyMesh& mesh, + const IOdictionary& dict, + const pointVectorField& pointDisplacement, + const pointIOField& points0 +) +: + displacementMotionSolver(mesh, dict, pointDisplacement, points0, typeName) +{ + read(coeffDict()); +} + + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::displacementInterpolationMotionSolver:: diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.H index b5da0b5b3b..4748cc553d 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.H +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.H @@ -2,8 +2,8 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation - \\/ M anipulation | + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -86,6 +86,9 @@ class displacementInterpolationMotionSolver // Private Member Functions + //- Read settings + void read(const dictionary& coeffDict); + //- Disallow default bitwise copy construct displacementInterpolationMotionSolver ( @@ -111,6 +114,15 @@ public: const IOdictionary& dict ); + //- Construct from components + displacementInterpolationMotionSolver + ( + const polyMesh& mesh, + const IOdictionary& dict, + const pointVectorField& pointDisplacement, + const pointIOField& points0 + ); + //- Destructor ~displacementInterpolationMotionSolver(); diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C index d4a3ca5a0a..15e1a4cf8d 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C @@ -2,8 +2,8 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation - \\/ M anipulation | + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -24,13 +24,13 @@ License \*---------------------------------------------------------------------------*/ #include "displacementLaplacianFvMotionSolver.H" +#include "motionInterpolation.H" #include "motionDiffusivity.H" #include "fvmLaplacian.H" #include "addToRunTimeSelectionTable.H" #include "OFstream.H" #include "meshTools.H" #include "mapPolyMesh.H" -#include "volPointInterpolation.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -44,6 +44,13 @@ namespace Foam displacementLaplacianFvMotionSolver, dictionary ); + + addToRunTimeSelectionTable + ( + displacementMotionSolver, + displacementLaplacianFvMotionSolver, + displacement + ); } @@ -77,6 +84,102 @@ Foam::displacementLaplacianFvMotionSolver::displacementLaplacianFvMotionSolver cellMotionBoundaryTypes(pointDisplacement_.boundaryField()) ), pointLocation_(NULL), + interpolationPtr_ + ( + coeffDict().found("interpolation") + ? motionInterpolation::New(fvMesh_, coeffDict().lookup("interpolation")) + : motionInterpolation::New(fvMesh_) + ), + diffusivityPtr_ + ( + motionDiffusivity::New(fvMesh_, coeffDict().lookup("diffusivity")) + ), + frozenPointsZone_ + ( + coeffDict().found("frozenPointsZone") + ? fvMesh_.pointZones().findZoneID(coeffDict().lookup("frozenPointsZone")) + : -1 + ) +{ + IOobject io + ( + "pointLocation", + fvMesh_.time().timeName(), + fvMesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ); + + if (debug) + { + Info<< "displacementLaplacianFvMotionSolver:" << nl + << " diffusivity : " << diffusivityPtr_().type() << nl + << " frozenPoints zone : " << frozenPointsZone_ << endl; + } + + + if (io.headerOk()) + { + pointLocation_.reset + ( + new pointVectorField + ( + io, + pointMesh::New(fvMesh_) + ) + ); + + if (debug) + { + Info<< "displacementLaplacianFvMotionSolver :" + << " Read pointVectorField " + << io.name() + << " to be used for boundary conditions on points." + << nl + << "Boundary conditions:" + << pointLocation_().boundaryField().types() << endl; + } + } +} + + +Foam::displacementLaplacianFvMotionSolver:: +displacementLaplacianFvMotionSolver +( + const polyMesh& mesh, + const IOdictionary& dict, + const pointVectorField& pointDisplacement, + const pointIOField& points0 +) +: + displacementMotionSolver(mesh, dict, pointDisplacement, points0, typeName), + fvMotionSolverCore(mesh), + cellDisplacement_ + ( + IOobject + ( + "cellDisplacement", + mesh.time().timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + fvMesh_, + dimensionedVector + ( + "cellDisplacement", + pointDisplacement_.dimensions(), + vector::zero + ), + cellMotionBoundaryTypes(pointDisplacement_.boundaryField()) + ), + pointLocation_(NULL), + interpolationPtr_ + ( + coeffDict().found("interpolation") + ? motionInterpolation::New(fvMesh_, coeffDict().lookup("interpolation")) + : motionInterpolation::New(fvMesh_) + ), diffusivityPtr_ ( motionDiffusivity::New(fvMesh_, coeffDict().lookup("diffusivity")) @@ -157,7 +260,7 @@ Foam::displacementLaplacianFvMotionSolver::diffusivity() Foam::tmp Foam::displacementLaplacianFvMotionSolver::curPoints() const { - volPointInterpolation::New(fvMesh_).interpolate + interpolationPtr_->interpolate ( cellDisplacement_, pointDisplacement_ diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.H index 47ad2c672c..bcaa96e166 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.H +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.H @@ -2,8 +2,8 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation - \\/ M anipulation | + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -45,6 +45,7 @@ namespace Foam { // Forward class declarations +class motionInterpolation; class motionDiffusivity; /*---------------------------------------------------------------------------*\ @@ -65,6 +66,9 @@ class displacementLaplacianFvMotionSolver // boundary conditions. mutable autoPtr pointLocation_; + //- Interpolation used to transfer cell displacement to the points + autoPtr interpolationPtr_; + //- Diffusivity used to control the motion autoPtr diffusivityPtr_; @@ -100,6 +104,15 @@ public: const IOdictionary& ); + //- Construct from components + displacementLaplacianFvMotionSolver + ( + const polyMesh& mesh, + const IOdictionary& dict, + const pointVectorField& pointDisplacement, + const pointIOField& points0 + ); + //- Destructor ~displacementLaplacianFvMotionSolver(); diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C index 137283c1ba..c31b956d34 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C @@ -2,8 +2,8 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation - \\/ M anipulation | + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -45,6 +45,13 @@ namespace Foam displacementLayeredMotionMotionSolver, dictionary ); + + addToRunTimeSelectionTable + ( + displacementMotionSolver, + displacementLayeredMotionMotionSolver, + displacement + ); } @@ -531,6 +538,19 @@ displacementLayeredMotionMotionSolver {} +Foam::displacementLayeredMotionMotionSolver:: +displacementLayeredMotionMotionSolver +( + const polyMesh& mesh, + const IOdictionary& dict, + const pointVectorField& pointDisplacement, + const pointIOField& points0 +) +: + displacementMotionSolver(mesh, dict, pointDisplacement, points0, typeName) +{} + + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::displacementLayeredMotionMotionSolver:: diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.H index 1aa7884f52..6b77a8aa60 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.H +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.H @@ -2,8 +2,8 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation - \\/ M anipulation | + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -136,6 +136,16 @@ public: const IOdictionary& ); + //- Construct from polyMesh, IOdictionary and displacement and + // zero-time fields + displacementLayeredMotionMotionSolver + ( + const polyMesh&, + const IOdictionary&, + const pointVectorField&, + const pointIOField& + ); + //- Destructor ~displacementLayeredMotionMotionSolver(); diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/surfaceAlignedSBRStress/surfaceAlignedSBRStressFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/displacement/surfaceAlignedSBRStress/surfaceAlignedSBRStressFvMotionSolver.C new file mode 100644 index 0000000000..7af99613e4 --- /dev/null +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/surfaceAlignedSBRStress/surfaceAlignedSBRStressFvMotionSolver.C @@ -0,0 +1,422 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "surfaceAlignedSBRStressFvMotionSolver.H" +#include "addToRunTimeSelectionTable.H" +#include "pointIndexHit.H" +#include "fvmLaplacian.H" +#include "fvcDiv.H" +#include "surfaceInterpolate.H" +#include "unitConversion.H" +#include "motionDiffusivity.H" +#include "fvcSmooth.H" +#include "pointMVCWeight.H" +#include "dimensionedSymmTensor.H" +#include "quaternion.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(surfaceAlignedSBRStressFvMotionSolver, 0); + + addToRunTimeSelectionTable + ( + motionSolver, + surfaceAlignedSBRStressFvMotionSolver, + dictionary + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::surfaceAlignedSBRStressFvMotionSolver:: +surfaceAlignedSBRStressFvMotionSolver +( + const polyMesh& mesh, + const IOdictionary& dict +) +: + displacementSBRStressFvMotionSolver(mesh, dict), + surfaceNames_(coeffDict().lookup("surfaces")), + surfaceMesh_(surfaceNames_.size()), + cellRot_ + ( + IOobject + ( + "cellRot", + fvMesh_.time().timeName(), + fvMesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + fvMesh_, + dimensionedVector("zero", dimless, vector::zero) + ), + maxAng_(coeffDict().lookupOrDefault("maxAng", 80.0)), + minAng_(coeffDict().lookupOrDefault("minAng", 20.0)), + accFactor_(coeffDict().lookupOrDefault("accFactor", 1.0)), + smoothFactor_(coeffDict().lookupOrDefault("smoothFactor", 0.9)), + nNonOrthogonalCorr_(readLabel(coeffDict().lookup("nNonOrthogonalCorr"))), + pointDisplacement_(pointDisplacement()), + sigmaD_ + ( + IOobject + ( + "sigmaD", + fvMesh_.time().timeName(), + fvMesh_, + IOobject::READ_IF_PRESENT, + IOobject::NO_WRITE + ), + fvMesh_, + dimensionedSymmTensor("zero", dimless, symmTensor::zero) + ), + minSigmaDiff_(coeffDict().lookupOrDefault("minSigmaDiff", 1e-4)) +{ + forAll (surfaceNames_, i) + { + surfaceMesh_.set + ( + i, + new triSurfaceMesh + ( + IOobject + ( + surfaceNames_[i], + mesh.time().constant(), + "triSurface", + mesh.time(), + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ) + ); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::surfaceAlignedSBRStressFvMotionSolver:: +~surfaceAlignedSBRStressFvMotionSolver() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + + +void Foam::surfaceAlignedSBRStressFvMotionSolver::calculateCellRot() +{ + cellRot_.internalField() = vector::zero; + pointDisplacement_.internalField() = vector::zero; + + // Find intersections + pointField start(fvMesh_.nInternalFaces()); + pointField end(start.size()); + + for (label faceI = 0; faceI < fvMesh_.nInternalFaces(); faceI++) + { + start[faceI] = fvMesh_.cellCentres()[fvMesh_.faceOwner()[faceI]]; + end[faceI] = fvMesh_.cellCentres()[fvMesh_.faceNeighbour()[faceI]]; + } + + DynamicList