diff --git a/applications/utilities/mesh/manipulation/attachMesh/Make/files b/applications/utilities/mesh/manipulation/attachMesh/Make/files deleted file mode 100644 index 3527e5e449..0000000000 --- a/applications/utilities/mesh/manipulation/attachMesh/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -attachMesh.C - -EXE = $(FOAM_APPBIN)/attachMesh diff --git a/applications/utilities/mesh/manipulation/attachMesh/Make/options b/applications/utilities/mesh/manipulation/attachMesh/Make/options deleted file mode 100644 index 68a72f1195..0000000000 --- a/applications/utilities/mesh/manipulation/attachMesh/Make/options +++ /dev/null @@ -1,7 +0,0 @@ -EXE_INC = \ - -I$(LIB_SRC)/dynamicMesh/lnInclude - -EXE_LIBS = \ - -ldynamicMesh \ - -lgenericPatches \ - -lmeshTools diff --git a/applications/utilities/mesh/manipulation/attachMesh/attachMesh.C b/applications/utilities/mesh/manipulation/attachMesh/attachMesh.C deleted file mode 100644 index 73f120ab2c..0000000000 --- a/applications/utilities/mesh/manipulation/attachMesh/attachMesh.C +++ /dev/null @@ -1,75 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2023 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 . - -Application - attachMesh - -Description - Attach topologically detached mesh using prescribed mesh modifiers. - -\*---------------------------------------------------------------------------*/ - -#include "argList.H" -#include "polyMesh.H" -#include "Time.H" -#include "attachPolyTopoChanger.H" - -using namespace Foam; - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -int main(int argc, char *argv[]) -{ - #include "addOverwriteOption.H" - argList::noParallel(); - - #include "setRootCase.H" - #include "createTimeNoFunctionObjects.H" - #include "createPolyMesh.H" - const word oldInstance = mesh.pointsInstance(); - - const bool overwrite = args.optionFound("overwrite"); - - if (!overwrite) - { - runTime++; - } - - Info<< "Time = " << runTime.userTimeName() << nl - << "Attaching sliding interface" << endl; - - attachPolyTopoChanger(mesh).attach(); - - if (overwrite) - { - mesh.setInstance(oldInstance); - } - mesh.write(); - - Info<< "End\n" << endl; - - return 0; -} - - -// ************************************************************************* // diff --git a/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C b/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C index 96f2196e9d..928a8ecd75 100644 --- a/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C +++ b/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C @@ -455,8 +455,6 @@ int main(int argc, char *argv[]) if (overwrite) { mesh.setInstance(oldInstance); - stitcher.instance() = oldInstance; - stitcher.writeOpt() = IOobject::NO_WRITE; } Info<< nl << "Writing polyMesh to time " << runTime.name() << endl; diff --git a/etc/config.sh/bash_completion b/etc/config.sh/bash_completion index 01d4de128a..be976b37ff 100644 --- a/etc/config.sh/bash_completion +++ b/etc/config.sh/bash_completion @@ -161,31 +161,6 @@ _applyBoundaryLayer_ () } complete -o filenames -o nospace -F _applyBoundaryLayer_ applyBoundaryLayer -_attachMesh_ () -{ - local cur="${COMP_WORDS[COMP_CWORD]}" - local prev="${COMP_WORDS[COMP_CWORD-1]}" - local line=${COMP_LINE} - local used=$(echo "$line" | grep -oE "\-[a-zA-Z]+ ") - - opts="-case -doc -fileHandler -help -libs -noFunctionObjects -overwrite -srcDoc" - for o in $used ; do opts="${opts/$o/}" ; done - extra="" - - [ "$COMP_CWORD" = 1 ] || \ - case "$prev" in - -case) - opts="" ; extra="-d" ;; - -fileHandler) - opts="uncollated collated masterUncollated" ; extra="" ;; - -libs) - opts="" ; extra="" ;; - *) ;; - esac - COMPREPLY=( $(compgen -W "${opts}" $extra -- ${cur}) ) -} -complete -o filenames -o nospace -F _attachMesh_ attachMesh - _autoPatch_ () { local cur="${COMP_WORDS[COMP_CWORD]}" diff --git a/src/dynamicMesh/polyTopoChanger/attachPolyTopoChanger/attachPolyTopoChanger.C b/src/dynamicMesh/polyTopoChanger/attachPolyTopoChanger/attachPolyTopoChanger.C index 6b209d9e55..f5a931160d 100644 --- a/src/dynamicMesh/polyTopoChanger/attachPolyTopoChanger/attachPolyTopoChanger.C +++ b/src/dynamicMesh/polyTopoChanger/attachPolyTopoChanger/attachPolyTopoChanger.C @@ -29,16 +29,6 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::attachPolyTopoChanger::attachPolyTopoChanger -( - const IOobject& io, - polyMesh& mesh -) -: - polyTopoChanger(io, mesh) -{} - - Foam::attachPolyTopoChanger::attachPolyTopoChanger ( polyMesh& mesh diff --git a/src/dynamicMesh/polyTopoChanger/attachPolyTopoChanger/attachPolyTopoChanger.H b/src/dynamicMesh/polyTopoChanger/attachPolyTopoChanger/attachPolyTopoChanger.H index 00a6fe7293..6d29ae31fa 100644 --- a/src/dynamicMesh/polyTopoChanger/attachPolyTopoChanger/attachPolyTopoChanger.H +++ b/src/dynamicMesh/polyTopoChanger/attachPolyTopoChanger/attachPolyTopoChanger.H @@ -65,9 +65,6 @@ public: // Constructors - //- Read constructor from IOobject and a polyMesh - attachPolyTopoChanger(const IOobject& io, polyMesh&); - //- Read constructor for given polyMesh explicit attachPolyTopoChanger(polyMesh&); diff --git a/src/dynamicMesh/polyTopoChanger/polyTopoChanger/polyTopoChanger.C b/src/dynamicMesh/polyTopoChanger/polyTopoChanger/polyTopoChanger.C index 5492dd9d95..8640f3d8da 100644 --- a/src/dynamicMesh/polyTopoChanger/polyTopoChanger/polyTopoChanger.C +++ b/src/dynamicMesh/polyTopoChanger/polyTopoChanger/polyTopoChanger.C @@ -38,123 +38,11 @@ namespace Foam // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -void Foam::polyTopoChanger::readModifiers() -{ - if - ( - readOpt() == IOobject::MUST_READ - || readOpt() == IOobject::MUST_READ_IF_MODIFIED - || (readOpt() == IOobject::READ_IF_PRESENT && headerOk()) - ) - { - if (readOpt() == IOobject::MUST_READ_IF_MODIFIED) - { - WarningInFunction - << "Specified IOobject::MUST_READ_IF_MODIFIED but class" - << " does not support automatic re-reading." - << endl; - } - - - PtrList& modifiers = *this; - - // Read modifiers - Istream& is = readStream(typeName); - - PtrList patchEntries(is); - modifiers.setSize(patchEntries.size()); - - forAll(modifiers, modifierI) - { - modifiers.set - ( - modifierI, - polyMeshModifier::New - ( - patchEntries[modifierI].keyword(), - patchEntries[modifierI].dict(), - modifierI, - *this - ) - ); - } - - // Check state of IOstream - is.check("polyTopoChanger::readModifiers()"); - - close(); - } -} - - -Foam::polyTopoChanger::polyTopoChanger -( - const IOobject& io, - polyMesh& mesh -) -: - PtrList(), - regIOobject(io), - mesh_(mesh) -{ - readModifiers(); -} - - Foam::polyTopoChanger::polyTopoChanger(polyMesh& mesh) : PtrList(), - regIOobject - ( - IOobject - ( - "meshModifiers", - mesh.time().findInstance - ( - mesh.meshDir(), - "meshModifiers", - IOobject::READ_IF_PRESENT - ), - mesh.meshSubDir, - mesh, - IOobject::READ_IF_PRESENT, - IOobject::NO_WRITE - ) - ), mesh_(mesh) -{ - readModifiers(); -} - - -Foam::wordList Foam::polyTopoChanger::types() const -{ - const PtrList& modifiers = *this; - - wordList t(modifiers.size()); - - forAll(modifiers, modifierI) - { - t[modifierI] = modifiers[modifierI].type(); - } - - return t; -} - - -Foam::wordList Foam::polyTopoChanger::names() const -{ - const PtrList& modifiers = *this; - - wordList t(modifiers.size()); - - forAll(modifiers, modifierI) - { - t[modifierI] = modifiers[modifierI].name(); - } - - return t; -} +{} bool Foam::polyTopoChanger::changeTopology() const @@ -223,20 +111,6 @@ Foam::polyTopoChanger::topoChangeRequest() const } -void Foam::polyTopoChanger::modifyMotionPoints(pointField& p) const -{ - const PtrList& topoChanges = *this; - - forAll(topoChanges, morphI) - { - if (topoChanges[morphI].active()) - { - topoChanges[morphI].modifyMotionPoints(p); - } - } -} - - void Foam::polyTopoChanger::update(const polyTopoChangeMap& m) { // Go through all mesh modifiers and accumulate the morphing information @@ -246,12 +120,6 @@ void Foam::polyTopoChanger::update(const polyTopoChangeMap& m) { topoChanges[morphI].topoChange(m); } - - // Force the mesh modifiers to auto-write. This allows us to - // preserve the current state of modifiers corresponding with - // the mesh. - writeOpt() = IOobject::AUTO_WRITE; - instance() = mesh_.time().name(); } @@ -287,92 +155,4 @@ Foam::autoPtr Foam::polyTopoChanger::changeMesh } -void Foam::polyTopoChanger::addTopologyModifiers -( - const List& tm -) -{ - setSize(tm.size()); - - // Copy the patch pointers - forAll(tm, tmI) - { - if (tm[tmI]->topoChanger() != *this) - { - FatalErrorInFunction - << "Mesh modifier created with different mesh reference." - << abort(FatalError); - } - set(tmI, tm[tmI]); - } - - writeOpt() = IOobject::AUTO_WRITE; -} - - -Foam::label Foam::polyTopoChanger::findModifierID -( - const word& modName -) const -{ - const PtrList& topoChanges = *this; - - forAll(topoChanges, morphI) - { - if (topoChanges[morphI].name() == modName) - { - return morphI; - } - } - - // Modifier not found - if (debug) - { - WarningInFunction - << "List of available modifier names: " << names() << endl; - } - - // Not found, return -1 - return -1; -} - - -bool Foam::polyTopoChanger::writeData(Ostream& os) const -{ - os << *this; - return os.good(); -} - - -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - -bool Foam::polyTopoChanger::operator!=(const polyTopoChanger& me) const -{ - return &me != this; -} - - -bool Foam::polyTopoChanger::operator==(const polyTopoChanger& me) const -{ - return &me == this; -} - - -// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // - -Foam::Ostream& Foam::operator<<(Ostream& os, const polyTopoChanger& mme) -{ - os << mme.size() << nl << token::BEGIN_LIST; - - forAll(mme, mmeI) - { - mme[mmeI].writeDict(os); - } - - os << token::END_LIST; - - return os; -} - - // ************************************************************************* // diff --git a/src/dynamicMesh/polyTopoChanger/polyTopoChanger/polyTopoChanger.H b/src/dynamicMesh/polyTopoChanger/polyTopoChanger/polyTopoChanger.H index f9b256cad4..d14af976a7 100644 --- a/src/dynamicMesh/polyTopoChanger/polyTopoChanger/polyTopoChanger.H +++ b/src/dynamicMesh/polyTopoChanger/polyTopoChanger/polyTopoChanger.H @@ -25,7 +25,7 @@ Class Foam::polyTopoChanger Description - List of mesh modifiers defining the mesh dynamics. + List of mesh modifiers SourceFiles polyTopoChanger.C @@ -35,9 +35,8 @@ SourceFiles #ifndef polyTopoChanger_H #define polyTopoChanger_H -#include "regIOobject.H" -#include "PtrList.H" #include "polyMeshModifier.H" +#include "PtrList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -51,34 +50,34 @@ class polyTopoChangeMap; class polyBoundaryMesh; -// Forward declaration of friend functions and operators - -class polyTopoChanger; - -Ostream& operator<<(Ostream&, const polyTopoChanger&); - - /*---------------------------------------------------------------------------*\ Class polyTopoChanger Declaration \*---------------------------------------------------------------------------*/ class polyTopoChanger : - public PtrList, - public regIOobject + public PtrList { - // Private Member Functions + // Private member functions - void readModifiers(); + //- Is topology change required + bool changeTopology() const; + + //- Return topology change request + autoPtr topoChangeRequest() const; + + //- Force recalculation of locally stored data on topological change + void update(const polyTopoChangeMap& m); protected: - // Protected data + // Protected member data //- Reference to mesh polyMesh& mesh_; + public: //- Runtime type information @@ -87,9 +86,6 @@ public: // Constructors - //- Read constructor given IOobject and a polyMesh - polyTopoChanger(const IOobject&, polyMesh&); - //- Read constructor for given polyMesh explicit polyTopoChanger(polyMesh&); @@ -110,21 +106,6 @@ public: return mesh_; } - //- Return a list of patch types - wordList types() const; - - //- Return a list of patch names - wordList names() const; - - //- Is topology change required - bool changeTopology() const; - - //- Return topology change request - autoPtr topoChangeRequest() const; - - //- Modify point motion - void modifyMotionPoints(pointField&) const; - autoPtr changeMesh ( const bool inflate, @@ -133,32 +114,11 @@ public: const bool orderPoints = false ); - //- Force recalculation of locally stored data on topological change - void update(const polyTopoChangeMap& m); - - //- Add given set of topology modifiers to the topoChanger - void addTopologyModifiers(const List& tm); - - //- Find modifier given a name - label findModifierID(const word& modName) const; - - - //- writeData member function required by regIOobject - bool writeData(Ostream&) const; - // Member Operators //- Disallow default bitwise assignment void operator=(const polyTopoChanger&) = delete; - - bool operator!=(const polyTopoChanger&) const; - bool operator==(const polyTopoChanger&) const; - - - // Ostream operator - - friend Ostream& operator<<(Ostream&, const polyTopoChanger&); }; diff --git a/src/fvMeshTopoChangers/Make/files b/src/fvMeshTopoChangers/Make/files index bab2e82fe2..8526bbddf2 100644 --- a/src/fvMeshTopoChangers/Make/files +++ b/src/fvMeshTopoChangers/Make/files @@ -1,4 +1,3 @@ refiner/fvMeshTopoChangersRefiner.C -movingCone/fvMeshTopoChangersMovingCone.C LIB = $(FOAM_LIBBIN)/libfvMeshTopoChangers diff --git a/src/fvMeshTopoChangers/movingCone/fvMeshTopoChangersMovingCone.C b/src/fvMeshTopoChangers/movingCone/fvMeshTopoChangersMovingCone.C deleted file mode 100644 index 274f9e49eb..0000000000 --- a/src/fvMeshTopoChangers/movingCone/fvMeshTopoChangersMovingCone.C +++ /dev/null @@ -1,412 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 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 "fvMeshTopoChangersMovingCone.H" -#include "Time.H" -#include "polyTopoChangeMap.H" -#include "layerAdditionRemoval.H" -#include "meshTools.H" -#include "OFstream.H" -#include "mathematicalConstants.H" -#include "addToRunTimeSelectionTable.H" - -using namespace Foam::constant::mathematical; - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ -namespace fvMeshTopoChangers -{ - defineTypeNameAndDebug(movingCone, 0); - addToRunTimeSelectionTable(fvMeshTopoChanger, movingCone, fvMesh); -} -} - - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -Foam::tmp Foam::fvMeshTopoChangers::movingCone::vertexMarkup -( - const pointField& p, - const scalar curLeft, - const scalar curRight -) const -{ - Info<< "Updating vertex markup. curLeft: " - << curLeft << " curRight: " << curRight << endl; - - tmp tvertexMarkup(new scalarField(p.size())); - scalarField& vertexMarkup = tvertexMarkup.ref(); - - forAll(p, pI) - { - if (p[pI].x() < curLeft - small) - { - vertexMarkup[pI] = -1; - } - else if (p[pI].x() > curRight + small) - { - vertexMarkup[pI] = 1; - } - else - { - vertexMarkup[pI] = 0; - } - } - - return tvertexMarkup; -} - - -void Foam::fvMeshTopoChangers::movingCone::addZonesAndModifiers() -{ - // Add zones and modifiers for motion action - - if - ( - mesh().pointZones().size() - || mesh().faceZones().size() - || mesh().cellZones().size() - || topoChanger_.size() - ) - { - InfoInFunction - << "Zones and modifiers already present. Skipping." - << endl; - - return; - } - - Info<< "Time = " << mesh().time().name() << endl - << "Adding zones and modifiers to the mesh" << endl; - - const vectorField& fc = mesh().faceCentres(); - const vectorField& fa = mesh().faceAreas(); - - labelList zone1(fc.size()); - boolList flipZone1(fc.size(), false); - label nZoneFaces1 = 0; - - labelList zone2(fc.size()); - boolList flipZone2(fc.size(), false); - label nZoneFaces2 = 0; - - forAll(fc, facei) - { - if - ( - fc[facei].x() > -0.003501 - && fc[facei].x() < -0.003499 - ) - { - if ((fa[facei] & vector(1, 0, 0)) < 0) - { - flipZone1[nZoneFaces1] = true; - } - - zone1[nZoneFaces1] = facei; - Info<< "face " << facei << " for zone 1. Flip: " - << flipZone1[nZoneFaces1] << endl; - nZoneFaces1++; - } - else if - ( - fc[facei].x() > -0.00701 - && fc[facei].x() < -0.00699 - ) - { - zone2[nZoneFaces2] = facei; - - if ((fa[facei] & vector(1, 0, 0)) > 0) - { - flipZone2[nZoneFaces2] = true; - } - - Info<< "face " << facei << " for zone 2. Flip: " - << flipZone2[nZoneFaces2] << endl; - nZoneFaces2++; - } - } - - zone1.setSize(nZoneFaces1); - flipZone1.setSize(nZoneFaces1); - - zone2.setSize(nZoneFaces2); - flipZone2.setSize(nZoneFaces2); - - Info<< "zone: " << zone1 << endl; - Info<< "zone: " << zone2 << endl; - - List pz(0); - List fz(2); - List cz(0); - - label nFz = 0; - - fz[nFz] = - new faceZone - ( - "rightExtrusionFaces", - zone1, - flipZone1, - nFz, - mesh().faceZones() - ); - nFz++; - - fz[nFz] = - new faceZone - ( - "leftExtrusionFaces", - zone2, - flipZone2, - nFz, - mesh().faceZones() - ); - nFz++; - - fz.setSize(nFz); - - Info<< "Adding mesh zones." << endl; - mesh().addZones(pz, fz, cz); - - - // Add layer addition/removal interfaces - - List tm(2); - label nMods = 0; - - tm[nMods] = - new layerAdditionRemoval - ( - "right", - nMods, - topoChanger_, - "rightExtrusionFaces", - motionDict_.subDict("right").lookup("minThickness"), - motionDict_.subDict("right").lookup("maxThickness") - ); - nMods++; - - tm[nMods] = new layerAdditionRemoval - ( - "left", - nMods, - topoChanger_, - "leftExtrusionFaces", - motionDict_.subDict("left").lookup("minThickness"), - motionDict_.subDict("left").lookup("maxThickness") - ); - nMods++; - tm.setSize(nMods); - - Info<< "Adding " << nMods << " mesh modifiers" << endl; - topoChanger_.addTopologyModifiers(tm); - - write(); -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::fvMeshTopoChangers::movingCone::movingCone -( - fvMesh& mesh, - const dictionary& dict -) -: - fvMeshTopoChanger(mesh), - topoChanger_(mesh), - motionDict_(dict), - motionVelAmplitude_(motionDict_.lookup("motionVelAmplitude")), - motionVelPeriod_(motionDict_.lookup("motionVelPeriod")), - curMotionVel_ - ( - motionVelAmplitude_*sin(mesh.time().value()*pi/motionVelPeriod_) - ), - leftEdge_(motionDict_.lookup("leftEdge")), - curLeft_(motionDict_.lookup("leftObstacleEdge")), - curRight_(motionDict_.lookup("rightObstacleEdge")) -{ - Pout<< "Initial time:" << mesh.time().value() - << " Initial curMotionVel_:" << curMotionVel_ - << endl; - - addZonesAndModifiers(); - - curLeft_ = average - ( - mesh.faceZones() - [ - mesh.faceZones().findZoneID("leftExtrusionFaces") - ]().localPoints() - ).x() - small; - - curRight_ = average - ( - mesh.faceZones() - [ - mesh.faceZones().findZoneID("rightExtrusionFaces") - ]().localPoints() - ).x() + small; - - motionMask_ = vertexMarkup - ( - mesh.points(), - curLeft_, - curRight_ - ); -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::fvMeshTopoChangers::movingCone::~movingCone() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -bool Foam::fvMeshTopoChangers::movingCone::update() -{ - // Do mesh changes (use inflation - put new points in topoChangeMap) - autoPtr topoChangeMap = topoChanger_.changeMesh(true); - - // Calculate the new point positions depending on whether the - // topological change has happened or not - pointField newPoints; - - vector curMotionVel_ = - motionVelAmplitude_*sin(mesh().time().value()*pi/motionVelPeriod_); - - Pout<< "time:" << mesh().time().value() - << " curMotionVel_:" << curMotionVel_ - << " curLeft:" << curLeft_ - << " curRight:" << curRight_ - << endl; - - if (topoChangeMap.valid()) - { - Info<< "Topology change. Calculating motion points" << endl; - - if (topoChangeMap().hasMotionPoints()) - { - Info<< "Topology change. Has premotion points" << endl; - - motionMask_ = - vertexMarkup - ( - topoChangeMap().preMotionPoints(), - curLeft_, - curRight_ - ); - - // Move points inside the motionMask - newPoints = - topoChangeMap().preMotionPoints() - + ( - pos0(0.5 - mag(motionMask_)) // cells above the body - )*curMotionVel_*mesh().time().deltaT().value(); - } - else - { - Info<< "Topology change. Already set mesh points" << endl; - - motionMask_ = - vertexMarkup - ( - mesh().points(), - curLeft_, - curRight_ - ); - - // Move points inside the motionMask - newPoints = - mesh().points() - + ( - pos0(0.5 - mag(motionMask_)) // cells above the body - )*curMotionVel_*mesh().time().deltaT().value(); - } - } - else - { - Info<< "No topology change" << endl; - // Set the mesh motion - newPoints = - mesh().points() - + ( - pos0(0.5 - mag(motionMask_)) // cells above the body - )*curMotionVel_*mesh().time().deltaT().value(); - } - - // The mesh now contains the cells with zero volume - Info << "Executing mesh motion" << endl; - mesh().movePoints(newPoints); - - // The mesh now has got non-zero volume cells - - curLeft_ = average - ( - mesh().faceZones() - [ - mesh().faceZones().findZoneID("leftExtrusionFaces") - ]().localPoints() - ).x() - small; - - curRight_ = average - ( - mesh().faceZones() - [ - mesh().faceZones().findZoneID("rightExtrusionFaces") - ]().localPoints() - ).x() + small; - - return true; -} - - -void Foam::fvMeshTopoChangers::movingCone::topoChange -( - const polyTopoChangeMap& map -) -{} - - -void Foam::fvMeshTopoChangers::movingCone::mapMesh -( - const polyMeshMap& map -) -{} - - -void Foam::fvMeshTopoChangers::movingCone::distribute -( - const polyDistributionMap& map -) -{} - - -// ************************************************************************* // diff --git a/src/fvMeshTopoChangers/movingCone/fvMeshTopoChangersMovingCone.H b/src/fvMeshTopoChangers/movingCone/fvMeshTopoChangersMovingCone.H deleted file mode 100644 index c114d3ba03..0000000000 --- a/src/fvMeshTopoChangers/movingCone/fvMeshTopoChangersMovingCone.H +++ /dev/null @@ -1,150 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 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 . - -Class - Foam::fvMeshTopoChangers::movingCone - -Description - Sample fvMeshTopoChanger that moves an object in x direction and - introduces/removes layers. - -SourceFiles - fvMeshTopoChangersMovingCone.C - -\*---------------------------------------------------------------------------*/ - -#ifndef fvMeshTopoChangersMovingCone_H -#define fvMeshTopoChangersMovingCone_H - -#include "fvMeshTopoChanger.H" -#include "polyTopoChanger.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace fvMeshTopoChangers -{ - -/*---------------------------------------------------------------------------*\ - Class movingCone Declaration -\*---------------------------------------------------------------------------*/ - -class movingCone -: - public fvMeshTopoChanger -{ - // Private Data - - polyTopoChanger topoChanger_; - - //- Motion dictionary - dictionary motionDict_; - - //- Motion velocity amplitude - vector motionVelAmplitude_; - - //- Motion velocity period - scalar motionVelPeriod_; - - //- Motion velocity period - vector curMotionVel_; - - //- Left edge - scalar leftEdge_; - - //- Current left obstacle position - scalar curLeft_; - - //- Current right obstacle position - scalar curRight_; - - //- Vertex motion mask - scalarField motionMask_; - - - // Private Member Functions - - //- Add mixer zones and modifiers - void addZonesAndModifiers(); - - //- Markup motion vertices - tmp vertexMarkup - ( - const pointField& p, - const scalar curLeft, - const scalar curRight - ) const; - - -public: - - //- Runtime type information - TypeName("movingCone"); - - - // Constructors - - //- Construct from fvMesh and dictionary - movingCone(fvMesh& mesh, const dictionary& dict); - - //- Disallow default bitwise copy construction - movingCone(const movingCone&) = delete; - - - //- Destructor - virtual ~movingCone(); - - - // Member Functions - - //- Update the mesh for both mesh motion and topology change - virtual bool update(); - - //- Update corresponding to the given map - virtual void topoChange(const polyTopoChangeMap&); - - //- Update from another mesh using the given map - virtual void mapMesh(const polyMeshMap&); - - //- Update corresponding to the given distribution map - virtual void distribute(const polyDistributionMap&); - - - // Member Operators - - //- Disallow default bitwise assignment - void operator=(const movingCone&) = delete; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace fvMeshTopoChangers -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* //