Loading...
Searching...
No Matches
displacementMethodpLaplacianMotionSolver.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) 2021 PCOpt/NTUA
9 Copyright (C) 2021 FOSS GP
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
32// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34namespace Foam
35{
36
37// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38
41(
42 displacementMethod,
43 displacementMethodpLaplacianMotionSolver,
45);
46
47// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
48
49displacementMethodpLaplacianMotionSolver::
50displacementMethodpLaplacianMotionSolver
51(
52 fvMesh& mesh,
53 const labelList& patchIDs
54)
55:
56 displacementMethod(mesh, patchIDs),
60 (
62 (
64 (
65 "dynamicMeshDict",
66 mesh.time().constant(),
67 mesh,
68 IOobject::MUST_READ,
69 IOobject::NO_WRITE,
70 IOobject::NO_REGISTER
71 )
72 ).subDict("pLaplacianMotionSolverCoeffs").getOrDefault<bool>
73 (
74 "resetFields",
75 true
76 )
77 )
78{}
79
80
81// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
84{
85 return false;
86}
87
88
90(
91 const pointVectorField& pointMovement
92)
93{
94 if (resetFields_)
95 {
99 }
100
101 maxDisplacement_ = SMALL;
102
103 // Set boundary mesh movement and calculate
104 // max current boundary displacement
105 for (label patchI : patchIDs_)
106 {
107 // Set boundary field. Needed for the motionSolver class
109 pointMovement.boundaryField()[patchI].patchInternalField()();
110
111 // Set boundary field values as seen from the internalField!
112 // Needed for determining the max displacement
113 pointMotionU_.boundaryFieldRef()[patchI].setInInternalField
114 (
116 pointMovement.boundaryField()[patchI].patchInternalField()()
117 );
118
119 // Find max value
121 max
122 (
124 gMax
125 (
126 mag
127 (
129 patchInternalField()
130 )
131 )
132 );
133 }
134 // Transfer movement to cellMotionU
135 refCast<pLaplacianMotionSolver>(motionPtr_()).setBoundaryConditions();
136}
137
138
140(
141 const volVectorField& cellMovement
142)
143{
144 if (resetFields_)
145 {
149 }
150
151 auto& cellMotionUbf = cellMotionU_.boundaryFieldRef();
152 // Set boundary mesh movement and calculate max current boundary
153 // displacement
154 for (const label patchI : patchIDs_)
155 {
156 cellMotionUbf[patchI] == cellMovement.boundaryField()[patchI];
157
158 // Find max value
160 max
161 (
163 gMax(mag(cellMotionUbf[patchI]))
164 );
165 }
166}
167
168
170(
171 const vectorField& controlField
172)
173{
175}
176
177
179(
180 const scalarField& controlField
181)
182{
184}
185
186
187// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188
189} // End namespace Foam
190
191// ************************************************************************* //
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
labelList patchIDs
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field values.
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
void correctBoundaryConditions()
Correct boundary field.
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Abstract base class for displacement methods, which are a set or wrapper classes allowing to change t...
autoPtr< motionSolver > motionPtr_
labelList patchIDs_
IDs of the patches to be moved.
virtual bool preferPointField() const
Whether the motion solver prefers a point of a vol field as input.
void setMotionField(const pointVectorField &pointMovement)
Set motion filed related to model based on given motion.
void setControlField(const vectorField &controlField)
Set control field as a vectorField. For methods working with parameters (RBF etc).
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
Similar to velocityLaplacian but with a variable diffusivity, based on the gradient of the displaceme...
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
dynamicFvMesh & mesh
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition error.H:688
Different types of constants.
Namespace for OpenFOAM.
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
Definition typeInfo.H:172
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition hashSets.C:40
GeometricField< vector, fvPatchField, volMesh > volVectorField
List< label > labelList
A List of labels.
Definition List.H:62
GeometricField< vector, pointPatchField, pointMesh > pointVectorField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Field< vector > vectorField
Specialisation of Field<T> for vector.
static constexpr const zero Zero
Global zero (0).
Definition zero.H:127
Type gMax(const FieldField< Field, Type > &f)