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 -------------------------------------------------------------------------------
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 
32 
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 
40 defineTypeNameAndDebug(displacementMethoddisplacementLaplacian, 1);
42 (
43  displacementMethod,
44  displacementMethoddisplacementLaplacian,
45  dictionary
46 );
47 
48 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
49 
50 displacementMethoddisplacementLaplacian::displacementMethoddisplacementLaplacian
51 (
52  fvMesh& mesh,
53  const labelList& patchIDs
54 )
55 :
56  displacementMethod(mesh, patchIDs),
57  pointDisplacement_
58  (
59  refCast<displacementLaplacianFvMotionSolver>
60  (
61  motionPtr_()
62  ).pointDisplacement()
63  ),
64  cellDisplacement_
65  (
66  refCast<displacementLaplacianFvMotionSolver>
67  (
68  motionPtr_()
69  ).cellDisplacement()
70  ),
71  /*
72  // Getting a reference from the database is dangerous since multiple
73  // fields with the same name might be registered
74  pointDisplacement_
75  (
76  const_cast<pointVectorField&>
77  (
78  mesh_.lookupObject<pointVectorField>("pointDisplacement")
79  )
80  ),
81  cellDisplacement_
82  (
83  const_cast<volVectorField&>
84  (
85  mesh_.lookupObject<volVectorField>("cellDisplacement")
86  )
87  ),
88  */
89  resetFields_
90  (
92  (
93  IOobject
94  (
95  "dynamicMeshDict",
96  mesh.time().constant(),
97  mesh,
100  false
101  )
102  ).subDict("displacementLaplacianCoeffs").getOrDefault<bool>
103  (
104  "resetFields",
105  true
106  )
107  )
108 {}
109 
110 
111 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
112 
114 (
115  const pointVectorField& pointMovement
116 )
117 {
118  Info<< "Resetting mesh motion fields to zero " << endl;
119 
120  if (resetFields_)
121  {
122  pointDisplacement_.primitiveFieldRef() = vector::zero;
123  cellDisplacement_.primitiveFieldRef() = vector::zero;
124  cellDisplacement_.correctBoundaryConditions();
125  }
126 
127  // Set boundary mesh movement and calculate
128  // max current boundary displacement
129  for (label patchI : patchIDs_)
130  {
131  // Set boundary field. Needed for the motionSolver class
132  pointDisplacement_.boundaryFieldRef()[patchI] ==
133  pointMovement.boundaryField()[patchI].patchInternalField()();
134 
135  // Set boundary field values as seen from the internalField!
136  // Needed for determining the max displacement
137  pointDisplacement_.boundaryFieldRef()[patchI].setInInternalField
138  (
139  pointDisplacement_.primitiveFieldRef(),
140  pointMovement.boundaryField()[patchI].patchInternalField()()
141  );
142 
143  // Find max value
144  maxDisplacement_ =
145  max
146  (
147  maxDisplacement_,
148  gMax
149  (
150  mag
151  (
152  pointDisplacement_.boundaryField()[patchI].
153  patchInternalField()
154  )
155  )
156  );
157  }
158 }
159 
160 
162 (
163  const volVectorField& cellMovement
164 )
165 {
167 }
168 
169 
171 (
172  const vectorField& controlField
173 )
174 {
176 }
177 
178 
180 (
181  const scalarField& controlField
182 )
183 {
185 }
186 
187 
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
190 } // End namespace Foam
191 
192 // ************************************************************************* //
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:104
displacementMethoddisplacementLaplacian.H
Foam::IOobject::AUTO_WRITE
Definition: IOobject.H:129
Foam::displacementMethod
Abstract base class for displacement methods, which are a set or wrapper classes allowing to change t...
Definition: displacementMethod.H:59
Foam::displacementMethoddisplacementLaplacian::setControlField
void setControlField(const vectorField &controlField)
Definition: displacementMethoddisplacementLaplacian.C:171
displacementLaplacianFvMotionSolver.H
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:350
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:445
Foam::Field< vector >
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
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:528
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
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:83
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::List< label >
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Foam::IOobject::MUST_READ_IF_MODIFIED
Definition: IOobject.H:121
Foam::displacementMethoddisplacementLaplacian::setMotionField
void setMotionField(const pointVectorField &pointMovement)
Set motion filed related to model based on given motion.
Definition: displacementMethoddisplacementLaplacian.C:114
Foam::fvMesh::time
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:275
Foam::VectorSpace< Vector< Cmpt >, Cmpt, 3 >::zero
static const Vector< Cmpt > zero
Definition: VectorSpace.H:115
Foam::TimePaths::constant
const word & constant() const
Return constant name.
Definition: TimePathsI.H:88
Foam::dictionary::getOrDefault
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:122
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