diff --git a/applications/solvers/multiphase/interFoam/overInterDyMFoam/pEqn.H b/applications/solvers/multiphase/interFoam/overInterDyMFoam/pEqn.H index 8b36eb2347..921b4f673b 100644 --- a/applications/solvers/multiphase/interFoam/overInterDyMFoam/pEqn.H +++ b/applications/solvers/multiphase/interFoam/overInterDyMFoam/pEqn.H @@ -17,13 +17,6 @@ #include "interpolatedFaces.H" } - if (runTime.outputTime()) - { - H.write(); - rAU.write(); - HbyA.write(); - } - surfaceScalarField phiHbyA("phiHbyA", fvc::flux(HbyA)); if (ddtCorr) diff --git a/src/dynamicFvMesh/dynamicMotionSolverListFvMesh/dynamicMotionSolverListFvMesh.C b/src/dynamicFvMesh/dynamicMotionSolverListFvMesh/dynamicMotionSolverListFvMesh.C index a0992f3b8f..234df96a24 100644 --- a/src/dynamicFvMesh/dynamicMotionSolverListFvMesh/dynamicMotionSolverListFvMesh.C +++ b/src/dynamicFvMesh/dynamicMotionSolverListFvMesh/dynamicMotionSolverListFvMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2016 OpenFOAM Foundation @@ -53,22 +53,57 @@ Foam::dynamicMotionSolverListFvMesh::dynamicMotionSolverListFvMesh ) : dynamicFvMesh(io), - motionSolvers_ + motionSolvers_() +{ + IOobject ioDict ( - IOdictionary - ( - IOobject - ( - "dynamicMeshDict", - time().constant(), - *this, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::AUTO_WRITE - ) - ).lookup("solvers"), - motionSolver::iNew(*this) - ) -{} + "dynamicMeshDict", + time().constant(), + *this, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ); + + IOdictionary dict(ioDict); + + label i = 0; + if (dict.found("solvers")) + { + const dictionary& solvertDict = dict.subDict("solvers"); + + motionSolvers_.setSize(solvertDict.size()); + + for (const entry& dEntry : solvertDict) + { + if (dEntry.isDict()) + { + IOobject io(ioDict); + io.readOpt() = IOobject::NO_READ; + io.writeOpt() = IOobject::AUTO_WRITE; + io.rename(dEntry.dict().dictName()); + + IOdictionary IOsolverDict + ( + io, + dEntry.dict() + ); + + motionSolvers_.set + ( + i++, + motionSolver::New(*this, IOsolverDict) + ); + } + } + motionSolvers_.setSize(i); + } + else + { + motionSolvers_.setSize(1); + motionSolvers_.set(i++, motionSolver::New(*this)); + } +} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // diff --git a/src/dynamicFvMesh/dynamicMotionSolverListFvMesh/dynamicMotionSolverListFvMesh.H b/src/dynamicFvMesh/dynamicMotionSolverListFvMesh/dynamicMotionSolverListFvMesh.H index 938146974e..f2bf72d244 100644 --- a/src/dynamicFvMesh/dynamicMotionSolverListFvMesh/dynamicMotionSolverListFvMesh.H +++ b/src/dynamicFvMesh/dynamicMotionSolverListFvMesh/dynamicMotionSolverListFvMesh.H @@ -27,7 +27,9 @@ Class Foam::dynamicMotionSolverListFvMesh Description - Foam::dynamicMotionSolverListFvMesh + Dynamic mesh able to handle multiple motion solvers. + NOTE: If the word entry "solvers" is not found it falls back to a single + motion solver behavior. SourceFiles dynamicMotionSolverListFvMesh.C diff --git a/src/dynamicMesh/Make/files b/src/dynamicMesh/Make/files index cc322d3890..a5f08432e1 100644 --- a/src/dynamicMesh/Make/files +++ b/src/dynamicMesh/Make/files @@ -102,6 +102,7 @@ motionSmoother/badQualityToFace/badQualityToFace.C motionSolvers/motionSolver/motionSolver.C motionSolvers/displacement/points0/points0MotionSolver.C +motionSolvers/displacement/displacement/zoneMotion.C motionSolvers/displacement/displacement/displacementMotionSolver.C motionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.C motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C @@ -120,6 +121,7 @@ $(solidBodyMotionFunctions)/solidBodyMotionFunction/solidBodyMotionFunctionNew.C $(solidBodyMotionFunctions)/SDA/SDA.C $(solidBodyMotionFunctions)/tabulated6DoFMotion/tabulated6DoFMotion.C $(solidBodyMotionFunctions)/linearMotion/linearMotion.C +$(solidBodyMotionFunctions)/drivenLinearMotion/drivenLinearMotion.C $(solidBodyMotionFunctions)/rotatingMotion/rotatingMotion.C $(solidBodyMotionFunctions)/axisRotationMotion/axisRotationMotion.C $(solidBodyMotionFunctions)/multiMotion/multiMotion.C diff --git a/src/dynamicMesh/motionSolvers/displacement/displacement/zoneMotion.C b/src/dynamicMesh/motionSolvers/displacement/displacement/zoneMotion.C new file mode 100644 index 0000000000..524c685919 --- /dev/null +++ b/src/dynamicMesh/motionSolvers/displacement/displacement/zoneMotion.C @@ -0,0 +1,149 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +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 "zoneMotion.H" +#include "syncTools.H" +#include "cellZoneMesh.H" +#include "cellSet.H" +#include "boolList.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + + +Foam::zoneMotion::zoneMotion +( + const dictionary& dict, + const polyMesh& mesh +) +: + pointIDs_(), + moveAllCells_(false) +{ + word cellZoneName = + dict.lookupOrDefault("cellZone", "none"); + + word cellSetName = + dict.lookupOrDefault("cellSet", "none"); + + if ((cellZoneName != "none") && (cellSetName != "none")) + { + FatalIOErrorInFunction(dict) + << "Either cellZone OR cellSet can be supplied, but not both. " + << "If neither is supplied, all cells will be included" + << exit(FatalIOError); + } + + labelList cellIDs; + if (cellZoneName != "none") + { + Info<< "Applying solid body motion to cellZone " << cellZoneName + << endl; + + label zoneID = mesh.cellZones().findZoneID(cellZoneName); + + if (zoneID == -1) + { + FatalErrorInFunction + << "Unable to find cellZone " << cellZoneName + << ". Valid cellZones are:" + << mesh.cellZones().names() + << exit(FatalError); + } + + cellIDs = mesh.cellZones()[zoneID]; + } + + if (cellSetName != "none") + { + Info<< "Applying solid body motion to cellSet " << cellSetName + << endl; + + cellSet set(mesh, cellSetName); + + cellIDs = set.toc(); + } + + label nCells = returnReduce(cellIDs.size(), sumOp