1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "attachDetachFvMesh.H"
28 #include "attachDetach.H"
29 #include "mapPolyMesh.H"
30 #include "polyTopoChange.H"
32 #include "addToRunTimeSelectionTable.H"
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
38 defineTypeNameAndDebug(attachDetachFvMesh, 0);
40 addToRunTimeSelectionTable
49 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
51 void Foam::attachDetachFvMesh::addZonesAndModifiers()
53 Info<< "Time = " << time().timeName() << endl
54 << "Adding zones and modifiers to the mesh" << endl;
56 // Add a topology modifier
57 Info << "Adding topology modifiers" << endl;
59 PtrList<entry> entries(motionDict_.lookup("modifiers"));
61 topoChanger_.setSize(entries.size());
73 word(entries[i].dict().lookup("faceZone")),
74 word(entries[i].dict().lookup("topPatch")),
75 word(entries[i].dict().lookup("bottomPatch")),
76 scalarField(entries[i].dict().lookup("triggerTimes"))
81 // Write mesh and modifiers
82 topoChanger_.writeOpt() = IOobject::AUTO_WRITE;
88 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
90 // Construct from components
91 Foam::attachDetachFvMesh::attachDetachFvMesh(const IOobject& io)
93 topoChangerFvMesh(io),
106 ).subDict(typeName + "Coeffs")
109 addZonesAndModifiers();
113 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
115 Foam::attachDetachFvMesh::~attachDetachFvMesh()
119 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
121 bool Foam::attachDetachFvMesh::update()
123 autoPtr<mapPolyMesh> topoChangeMap = topoChanger_.changeMesh();
125 return topoChangeMap->morphing();
129 // ************************************************************************* //