displacementMethoddisplacementLaplacian.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) 2007-2019 PCOpt/NTUA
9 Copyright (C) 2013-2019 FOSS GP
10 Copyright (C) 2019-2020 OpenCFD Ltd.
11-------------------------------------------------------------------------------
12License
13 This file is part of OpenFOAM.
14
15 OpenFOAM is free software: you can redistribute it and/or modify it
16 under the terms of the GNU General Public License as published by
17 the Free Software Foundation, either version 3 of the License, or
18 (at your option) any later version.
19
20 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
21 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 for more details.
24
25 You should have received a copy of the GNU General Public License
26 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
27
28\*---------------------------------------------------------------------------*/
29
33
34// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35
36namespace Foam
37{
38
39// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40
43(
47);
48
49// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
50
52(
53 fvMesh& mesh,
54 const labelList& patchIDs
55)
56:
57 displacementMethod(mesh, patchIDs),
58 pointDisplacement_
59 (
61 (
62 motionPtr_()
63 ).pointDisplacement()
64 ),
65 cellDisplacement_
66 (
68 (
69 motionPtr_()
70 ).cellDisplacement()
71 ),
72 /*
73 // Getting a reference from the database is dangerous since multiple
74 // fields with the same name might be registered
75 pointDisplacement_
76 (
77 const_cast<pointVectorField&>
78 (
79 mesh_.lookupObject<pointVectorField>("pointDisplacement")
80 )
81 ),
82 cellDisplacement_
83 (
84 const_cast<volVectorField&>
85 (
86 mesh_.lookupObject<volVectorField>("cellDisplacement")
87 )
88 ),
89 */
90 resetFields_
91 (
93 (
95 (
96 "dynamicMeshDict",
97 mesh.time().constant(),
98 mesh,
99 IOobject::MUST_READ_IF_MODIFIED,
100 IOobject::AUTO_WRITE,
101 false
102 )
103 ).subDict("displacementLaplacianCoeffs").getOrDefault<bool>
104 (
105 "resetFields",
106 true
107 )
108 )
109{}
110
111
112// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
113
115(
116 const pointVectorField& pointMovement
117)
118{
119 Info<< "Resetting mesh motion fields to zero " << endl;
120
121 if (resetFields_)
122 {
126 }
127
128 // Set boundary mesh movement and calculate
129 // max current boundary displacement
130 for (label patchI : patchIDs_)
131 {
132 // Set boundary field. Needed for the motionSolver class
134 pointMovement.boundaryField()[patchI].patchInternalField()();
135
136 // Set boundary field values as seen from the internalField!
137 // Needed for determining the max displacement
138 pointDisplacement_.boundaryFieldRef()[patchI].setInInternalField
139 (
141 pointMovement.boundaryField()[patchI].patchInternalField()()
142 );
143
144 // Find max value
146 max
147 (
149 gMax
150 (
151 mag
152 (
154 patchInternalField()
155 )
156 )
157 );
158 }
159}
160
161
163(
164 const volVectorField& cellMovement
165)
166{
168}
169
170
172(
173 const vectorField& controlField
174)
175{
177}
178
179
181(
182 const scalarField& controlField
183)
184{
186}
187
188
189// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190
191} // End namespace Foam
192
193// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field.
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
void correctBoundaryConditions()
Correct boundary field.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:57
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Mesh motion solver for an fvMesh. Based on solving the cell-centre Laplacian for the motion displacem...
Abstract base class for displacement methods, which are a set or wrapper classes allowing to change t...
const labelList & patchIDs_
IDs of the patches to be moved.
Wrapper class for the displacementLaplacian motion solver.
void setMotionField(const pointVectorField &pointMovement)
Set motion filed related to model based on given motion.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
constant condensation/saturation model.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
bool
Definition: EEqn.H:20
dynamicFvMesh & mesh
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
Namespace for OpenFOAM.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
To & refCast(From &r)
Reference type cast template function.
Definition: typeInfo.H:131
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Type gMax(const FieldField< Field, Type > &f)
A non-counting (dummy) refCount.
Definition: refCount.H:59