1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
5 \\ / A nd | 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 "movingImmersedBoundary.H"
27 #include "immersedBoundaryPolyPatch.H"
28 #include "transformField.H"
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 Foam::movingImmersedBoundary::movingImmersedBoundary
36 const dictionary& dict
41 sbmfPtr_(solidBodyMotionFunction::New(dict, mesh.time())),
47 mesh.time().constant(), // instance
48 "triSurface", // local
57 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
59 Foam::movingImmersedBoundary::~movingImmersedBoundary()
63 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
65 void Foam::movingImmersedBoundary::movePoints() const
67 // Get ibMesh from patch
68 const label patchID = mesh().boundaryMesh().findPatchID(name());
74 "void movingImmersedBoundary::movePoints() const"
75 ) << "Patch " << name() << " not found. Available patch names: "
76 << mesh().boundaryMesh().names()
80 // Get non-const reference to velocity field
81 volVectorField& U = const_cast<volVectorField&>
83 mesh().lookupObject<volVectorField>("U")
86 // Get non-const reference to patch field
87 immersedBoundaryFvPatchVectorField& ibPatchField =
88 refCast<immersedBoundaryFvPatchVectorField>
90 U.boundaryField()[patchID]
94 const immersedBoundaryPolyPatch& cibPatch =
95 refCast<const immersedBoundaryPolyPatch>
97 mesh().boundaryMesh()[patchID]
100 // Get non-const reference to patch
101 immersedBoundaryPolyPatch& ibPatch =
102 const_cast<immersedBoundaryPolyPatch&>(cibPatch);
104 const vectorField oldIbPoints = ibPatch.ibMesh().coordinates();
107 ibPatch.moveTriSurfacePoints
109 transform(sbmfPtr_->transformation(), refIbSurface_.points())
112 // Set refValue_ to moving boundary velocity
113 ibPatchField.refValue() =
114 (ibPatch.ibMesh().coordinates() - oldIbPoints)/
115 mesh().time().deltaT().value();
119 // ************************************************************************* //