1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "NonInertialFrameForce.H"
27 #include "uniformDimensionedFields.H"
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 template<class CloudType>
32 Foam::NonInertialFrameForce<CloudType>::NonInertialFrameForce
36 const dictionary& dict
39 ParticleForce<CloudType>(owner, mesh, dict, typeName, true),
42 this->coeffs().template lookupOrDefault<word>
44 "linearAccelerationName",
51 this->coeffs().template lookupOrDefault<word>
53 "angularVelocityName",
60 this->coeffs().template lookupOrDefault<word>
62 "angularAccelerationName",
66 omegaDot_(vector::zero),
69 this->coeffs().template lookupOrDefault<word>
71 "centreOfRotationName",
75 centreOfRotation_(vector::zero)
79 template<class CloudType>
80 Foam::NonInertialFrameForce<CloudType>::NonInertialFrameForce
82 const NonInertialFrameForce& niff
85 ParticleForce<CloudType>(niff),
88 omegaName_(niff.omegaName_),
90 omegaDotName_(niff.omegaDotName_),
91 omegaDot_(niff.omegaDot_),
92 centreOfRotationName_(niff.centreOfRotationName_),
93 centreOfRotation_(niff.centreOfRotation_)
97 // * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
99 template<class CloudType>
100 Foam::NonInertialFrameForce<CloudType>::~NonInertialFrameForce()
104 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
106 template<class CloudType>
107 void Foam::NonInertialFrameForce<CloudType>::cacheFields(const bool store)
110 omega_ = vector::zero;
111 omegaDot_ = vector::zero;
112 centreOfRotation_ = vector::zero;
118 this->mesh().template foundObject<uniformDimensionedVectorField>
124 uniformDimensionedVectorField W = this->mesh().template
125 lookupObject<uniformDimensionedVectorField>(WName_);
132 this->mesh().template foundObject<uniformDimensionedVectorField>
138 uniformDimensionedVectorField omega = this->mesh().template
139 lookupObject<uniformDimensionedVectorField>(omegaName_);
141 omega_ = omega.value();
146 this->mesh().template foundObject<uniformDimensionedVectorField>
152 uniformDimensionedVectorField omegaDot = this->mesh().template
153 lookupObject<uniformDimensionedVectorField>(omegaDotName_);
155 omegaDot_ = omegaDot.value();
160 this->mesh().template foundObject<uniformDimensionedVectorField>
162 centreOfRotationName_
166 uniformDimensionedVectorField centreOfRotation =
167 this->mesh().template
168 lookupObject<uniformDimensionedVectorField>
170 centreOfRotationName_
173 centreOfRotation_ = centreOfRotation.value();
179 template<class CloudType>
180 Foam::forceSuSp Foam::NonInertialFrameForce<CloudType>::calcNonCoupled
182 const typename CloudType::parcelType& p,
189 forceSuSp value(vector::zero, 0.0);
191 const vector r = p.position() - centreOfRotation_;
198 + 2.0*(p.U() ^ omega_)
199 + (omega_ ^ (r ^ omega_))
206 // ************************************************************************* //