displacementMethodvelocityLaplacian.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 -------------------------------------------------------------------------------
12 License
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 
36 namespace Foam
37 {
38 
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 
41 defineTypeNameAndDebug(displacementMethodvelocityLaplacian, 1);
43 (
44  displacementMethod,
45  displacementMethodvelocityLaplacian,
46  dictionary
47 );
48 
49 
50 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
51 
52 displacementMethodvelocityLaplacian::displacementMethodvelocityLaplacian
53 (
54  fvMesh& mesh,
55  const labelList& patchIDs
56 )
57 :
58  displacementMethod(mesh, patchIDs),
59  pointMotionU_
60  (
61  refCast<velocityLaplacianFvMotionSolver>(motionPtr_()).pointMotionU()
62  ),
63  cellMotionU_
64  (
65  refCast<velocityLaplacianFvMotionSolver>(motionPtr_()).cellMotionU()
66  ),
67  /*
68  // Getting a reference from the database is dangerous since multiple
69  // fields with the same name might be registered
70  pointMotionU_
71  (
72  const_cast<pointVectorField&>
73  (
74  mesh_.lookupObject<pointVectorField>("pointMotionU")
75  )
76  ),
77  cellMotionU_
78  (
79  const_cast<volVectorField&>
80  (
81  mesh_.lookupObject<volVectorField>("cellMotionU")
82  )
83  ),
84  */
85  resetFields_
86  (
88  (
89  IOobject
90  (
91  "dynamicMeshDict",
92  mesh.time().constant(),
93  mesh,
96  false
97  )
98  ).subDict("velocityLaplacianCoeffs").getOrDefault<bool>
99  (
100  "resetFields",
101  true
102  )
103  )
104 {}
105 
106 
107 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
108 
110 (
111  const pointVectorField& pointMovement
112 )
113 {
114  if (resetFields_)
115  {
116  pointMotionU_.primitiveFieldRef() = vector::zero;
117  cellMotionU_.primitiveFieldRef() = vector::zero;
118  cellMotionU_.correctBoundaryConditions();
119  }
120 
121  // Set boundary mesh movement and calculate
122  // max current boundary displacement
123  for (label patchI : patchIDs_)
124  {
125  // Set boundary field. Needed for the motionSolver class
126  pointMotionU_.boundaryFieldRef()[patchI] ==
127  pointMovement.boundaryField()[patchI].patchInternalField()();
128 
129  // Set boundary field values as seen from the internalField!
130  // Needed for determining the max displacement
131  pointMotionU_.boundaryFieldRef()[patchI].setInInternalField
132  (
133  pointMotionU_.primitiveFieldRef(),
134  pointMovement.boundaryField()[patchI].patchInternalField()()
135  );
136 
137  // Find max value
138  maxDisplacement_ =
139  max
140  (
141  maxDisplacement_,
142  gMax
143  (
144  mag
145  (
146  pointMotionU_.boundaryField()[patchI].
147  patchInternalField()
148  )
149  )
150  );
151  }
152 }
153 
154 
156 (
157  const volVectorField& cellMovement
158 )
159 {
161 
162  /*
163  // Set boundary mesh movement and calculate max current boundary
164  // displacement
165  forAll(patchIDs_, pI)
166  {
167  label patchI = patchIDs_[pI];
168  cellMotionU_.boundaryField()[patchI] ==
169  cellMovement.boundaryField()[patchI];
170 
171  // Find max value
172  maxDisplacement_ =
173  max
174  (
175  maxDisplacement_,
176  gMax
177  (
178  mag(cellMovement.boundaryField()[patchI])
179  )
180  );
181  }
182  */
183 }
184 
185 
187 (
188  const vectorField& controlField
189 )
190 {
192 }
193 
194 
196 (
197  const scalarField& controlField
198 )
199 {
201 }
202 
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 } // End namespace Foam
207 
208 // ************************************************************************* //
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:54
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::IOobject::AUTO_WRITE
Definition: IOobject.H:194
Foam::displacementMethod
Abstract base class for displacement methods, which are a set or wrapper classes allowing to change t...
Definition: displacementMethod.H:59
displacementMethodvelocityLaplacian.H
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
velocityLaplacianFvMotionSolver.H
Foam::Field< vector >
Foam::dictionary::subDict
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
Definition: dictionary.C:460
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::displacementMethodvelocityLaplacian::setControlField
void setControlField(const vectorField &controlField)
Definition: displacementMethodvelocityLaplacian.C:187
Foam::displacementMethodvelocityLaplacian::setMotionField
void setMotionField(const pointVectorField &pointMovement)
Set motion filed related to model based on given motion.
Definition: displacementMethodvelocityLaplacian.C:110
Foam::List< label >
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Foam::IOobject::MUST_READ_IF_MODIFIED
Definition: IOobject.H:186
Foam::fvMesh::time
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:280
Foam::VectorSpace< Vector< scalar >, scalar, 3 >::zero
static const Vector< scalar > zero
Definition: VectorSpace.H:115
Foam::TimePaths::constant
const word & constant() const
Return constant name.
Definition: TimePathsI.H:96
Foam::dictionary::getOrDefault
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:148
Foam::GeometricField< vector, pointPatchField, pointMesh >
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::gMax
Type gMax(const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:592
Foam::GeometricField::boundaryField
const Boundary & boundaryField() const
Return const-reference to the boundary field.
Definition: GeometricFieldI.H:62