movingImmersedBoundary.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | foam-extend: Open Source CFD
4  \\ / O peration |
5  \\ / A nd | For copyright notice see file Copyright
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of foam-extend.
10 
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.
15 
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.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "movingImmersedBoundary.H"
28 #include "transformField.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
33 (
34  const word& name,
35  const fvMesh& mesh,
36  const dictionary& dict
37 )
38 :
39  name_(name),
40  mesh_(mesh),
41  sbmfPtr_(solidBodyMotionFunction::New(dict, mesh.time())),
42  refIbSurface_
43  (
44  IOobject
45  (
46  name + ".ftr",
47  mesh.time().constant(), // instance
48  "triSurface", // local
49  mesh, // registry
50  IOobject::MUST_READ,
51  IOobject::NO_WRITE
52  )
53  )
54 {}
55 
56 
57 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
58 
60 {}
61 
62 
63 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
64 
66 {
67  // Get ibMesh from patch
68  const label patchID = mesh().boundaryMesh().findPatchID(name());
69 
70  if (patchID < 0)
71  {
73  (
74  "void movingImmersedBoundary::movePoints() const"
75  ) << "Patch " << name() << " not found. Available patch names: "
76  << mesh().boundaryMesh().names()
77  << abort(FatalError);
78  }
79 
80  // Get non-const reference to velocity field
81  volVectorField& U = const_cast<volVectorField&>
82  (
84  );
85 
86  // Get non-const reference to patch field
87  immersedBoundaryFvPatchVectorField& ibPatchField =
88  refCast<immersedBoundaryFvPatchVectorField>
89  (
90  U.boundaryField()[patchID]
91  );
92 
93 
94  const immersedBoundaryPolyPatch& cibPatch =
95  refCast<const immersedBoundaryPolyPatch>
96  (
97  mesh().boundaryMesh()[patchID]
98  );
99 
100  // Get non-const reference to patch
101  immersedBoundaryPolyPatch& ibPatch =
102  const_cast<immersedBoundaryPolyPatch&>(cibPatch);
103 
104  const vectorField oldIbPoints = ibPatch.ibMesh().coordinates();
105 
106  // Move points
107  ibPatch.moveTriSurfacePoints
108  (
109  transform(sbmfPtr_->transformation(), refIbSurface_.points())
110  );
111 
112  // Set refValue_ to moving boundary velocity
113  ibPatchField.refValue() =
114  (ibPatch.ibMesh().coordinates() - oldIbPoints)/
115  mesh().time().deltaT().value();
116 }
117 
118 
119 // ************************************************************************* //
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Foam::movingImmersedBoundary::~movingImmersedBoundary
~movingImmersedBoundary()
Destructor.
Definition: movingImmersedBoundary.C:59
Foam::polyBoundaryMesh::findPatchID
label findPatchID(const word &patchName) const
Find patch index given a name.
Definition: polyBoundaryMesh.C:678
Foam::movingImmersedBoundary::movingImmersedBoundary
movingImmersedBoundary(const movingImmersedBoundary &)
Disallow default bitwise copy construct.
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::compressible::New
autoPtr< BasicCompressibleTurbulenceModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const typename BasicCompressibleTurbulenceModel::transportModel &transport, const word &propertiesName)
Definition: turbulentFluidThermoModel.C:36
Foam::TimeState::deltaT
dimensionedScalar deltaT() const
Return time step.
Definition: TimeState.C:79
Foam::immersedBoundaryPolyPatch
Immersed boundary patch.
Definition: immersedBoundaryPolyPatch.H:56
Foam::polyMesh::boundaryMesh
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Definition: polyMesh.H:421
Foam::dimensioned::value
const Type & value() const
Return const reference to value.
Definition: dimensionedType.C:261
transformField.H
Spatial transformation functions for primitive fields.
Foam::polyBoundaryMesh::names
wordList names() const
Return a list of patch names.
Definition: polyBoundaryMesh.C:527
Foam::transform
dimensionSet transform(const dimensionSet &)
Definition: dimensionSet.C:465
U
U
Definition: pEqn.H:46
movingImmersedBoundary.H
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
immersedBoundaryPolyPatch.H
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam::triSurfaceMesh::coordinates
virtual tmp< pointField > coordinates() const
Get representative set of element coordinates.
Definition: triSurfaceMesh.C:389
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:131
Foam::immersedBoundaryPolyPatch::ibMesh
const triSurfaceMesh & ibMesh() const
Return immersed boundary surface mesh.
Definition: immersedBoundaryPolyPatch.H:192
Foam::movingImmersedBoundary::movePoints
void movePoints() const
Move immersed boundary patch points.
Definition: movingImmersedBoundary.C:65
Foam::immersedBoundaryPolyPatch::moveTriSurfacePoints
void moveTriSurfacePoints(const pointField &p)
Correct patches after moving points.
Definition: immersedBoundaryPolyPatch.C:240
Foam::fvMesh::time
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:243
Foam::boundaryMesh
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
Definition: boundaryMesh.H:59
FatalErrorIn
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Definition: error.H:313
Foam::objectRegistry::lookupObject
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type.
Definition: objectRegistryTemplates.C:165
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::name
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47