Loading...
Searching...
No Matches
displacementMeshMoverMotionSolver.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2013-2015 OpenFOAM Foundation
9 Copyright (C) 2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
31#include "localPointRegion.H"
33// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34
35namespace Foam
36{
38
40 (
44 );
45}
46
47
48// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
49
50Foam::displacementMeshMoverMotionSolver::displacementMeshMoverMotionSolver
51(
52 const polyMesh& mesh,
53 const IOdictionary& dict
54)
56 displacementMotionSolver(mesh, dict, typeName) // read pointDisplacement
57{}
58
59
60// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
61
64{}
65
66
67// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
68
69
72{
73 if (!meshMoverPtr_)
74 {
75 const word moverType(coeffDict().get<word>("meshMover"));
76
78 (
79 moverType,
80 coeffDict().optionalSubDict(moverType + "Coeffs"),
82 pointDisplacement_
83 );
84 }
85 return *meshMoverPtr_;
86}
87
88
92 // Return actual points. Cannot do a reference since complains about
93 // assignment to self in polyMesh::movePoints
95}
96
97
99{
100 // The points have moved so before calculation update
101 // the mesh and motionSolver accordingly
102 movePoints(mesh().points());
103
104 // Update any point motion bcs (e.g. timevarying)
105 pointDisplacement().boundaryFieldRef().updateCoeffs();
106
107 label nAllowableErrors = 0;
108 labelList checkFaces(identity(mesh().nFaces()));
109 meshMover().move
110 (
111 coeffDict().optionalSubDict(meshMover().type() + "Coeffs"),
112 nAllowableErrors,
113 checkFaces
114 );
115
116 // This will have updated the mesh and implicitly the pointDisplacement
117 pointDisplacement().correctBoundaryConditions();
118}
119
120
122{
124
125 // Update meshMover for new geometry
126 if (meshMoverPtr_)
127 {
128 meshMover().movePoints(p);
129 }
130}
131
132
134(
135 const mapPolyMesh& map
136)
137{
139
140 // Update meshMover for new topology
141 meshMoverPtr_.clear();
142}
143
144
145// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
const dictionary & optionalSubDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary, otherwise return this dictionary.
Definition dictionary.C:560
Mesh motion solver for an fvMesh. Uses externalDisplacementMeshMover to do the mesh motion.
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
externalDisplacementMeshMover & meshMover() const
virtual void movePoints(const pointField &)
Update local data for geometry changes.
virtual void updateMesh(const mapPolyMesh &)
Update topology.
pointVectorField & pointDisplacement() noexcept
Return reference to the point motion displacement field.
displacementMotionSolver(const displacementMotionSolver &)=delete
No copy construct.
pointVectorField pointDisplacement_
Point motion field.
Virtual base class for mesh movers with externally provided displacement field giving the boundary co...
static autoPtr< externalDisplacementMeshMover > New(const word &type, const dictionary &dict, const List< labelPair > &baffles, pointVectorField &pointDisplacement, const bool dryRun=false)
Return a reference to the selected meshMover model.
static labelPairList findDuplicateFacePairs(const polyMesh &)
Helper routine to find all baffles (two boundary faces.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Virtual base class for mesh motion solver.
const polyMesh & mesh() const
Return reference to mesh.
const dictionary & coeffDict() const
Const access to the coefficients dictionary.
virtual void movePoints(const pointField &)
Update local data for geometry changes.
virtual void updateMesh(const mapPolyMesh &)
Update local data for topology changes.
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
A class for managing temporary objects.
Definition tmp.H:75
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
Definition tmp.H:215
A class for handling words, derived from Foam::string.
Definition word.H:66
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
volScalarField & p
dynamicFvMesh & mesh
const pointField & points
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition List.H:62
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition POSIX.C:801
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
vectorField pointField
pointField is a vectorField.
dictionary dict