BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / src / lagrangian / intermediate / submodels / Kinematic / ParticleForces / NonInertialFrame / NonInertialFrameForce.C
blobd0edd8a2283f8eecc52017f7f10d3ec5c8f23c0c
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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
34     CloudType& owner,
35     const fvMesh& mesh,
36     const dictionary& dict
39     ParticleForce<CloudType>(owner, mesh, dict, typeName, true),
40     WName_
41     (
42         this->coeffs().template lookupOrDefault<word>
43         (
44             "linearAccelerationName",
45             "linearAcceleration"
46         )
47     ),
48     W_(vector::zero),
49     omegaName_
50     (
51         this->coeffs().template lookupOrDefault<word>
52         (
53             "angularVelocityName",
54             "angularVelocity"
55         )
56     ),
57     omega_(vector::zero),
58     omegaDotName_
59     (
60         this->coeffs().template lookupOrDefault<word>
61         (
62             "angularAccelerationName",
63             "angularAcceleration"
64         )
65     ),
66     omegaDot_(vector::zero),
67     centreOfRotationName_
68     (
69         this->coeffs().template lookupOrDefault<word>
70         (
71             "centreOfRotationName",
72             "centreOfRotation"
73         )
74     ),
75     centreOfRotation_(vector::zero)
79 template<class CloudType>
80 Foam::NonInertialFrameForce<CloudType>::NonInertialFrameForce
82     const NonInertialFrameForce& niff
85     ParticleForce<CloudType>(niff),
86     WName_(niff.WName_),
87     W_(niff.W_),
88     omegaName_(niff.omegaName_),
89     omega_(niff.omega_),
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)
109     W_ = vector::zero;
110     omega_ = vector::zero;
111     omegaDot_ = vector::zero;
112     centreOfRotation_ = vector::zero;
114     if (store)
115     {
116         if
117         (
118             this->mesh().template foundObject<uniformDimensionedVectorField>
119             (
120                 WName_
121             )
122         )
123         {
124             uniformDimensionedVectorField W = this->mesh().template
125                 lookupObject<uniformDimensionedVectorField>(WName_);
127             W_ = W.value();
128         }
130         if
131         (
132             this->mesh().template foundObject<uniformDimensionedVectorField>
133             (
134                 omegaName_
135             )
136         )
137         {
138             uniformDimensionedVectorField omega = this->mesh().template
139                 lookupObject<uniformDimensionedVectorField>(omegaName_);
141             omega_ = omega.value();
142         }
144         if
145         (
146             this->mesh().template foundObject<uniformDimensionedVectorField>
147             (
148                 omegaDotName_
149             )
150         )
151         {
152             uniformDimensionedVectorField omegaDot = this->mesh().template
153                 lookupObject<uniformDimensionedVectorField>(omegaDotName_);
155             omegaDot_ = omegaDot.value();
156         }
158         if
159         (
160             this->mesh().template foundObject<uniformDimensionedVectorField>
161             (
162                 centreOfRotationName_
163             )
164         )
165         {
166             uniformDimensionedVectorField centreOfRotation =
167                 this->mesh().template
168                 lookupObject<uniformDimensionedVectorField>
169                 (
170                     centreOfRotationName_
171                 );
173             centreOfRotation_ = centreOfRotation.value();
174         }
175     }
179 template<class CloudType>
180 Foam::forceSuSp Foam::NonInertialFrameForce<CloudType>::calcNonCoupled
182     const typename CloudType::parcelType& p,
183     const scalar dt,
184     const scalar mass,
185     const scalar Re,
186     const scalar muc
187 ) const
189     forceSuSp value(vector::zero, 0.0);
191     const vector r = p.position() - centreOfRotation_;
193     value.Su() =
194         mass
195        *(
196            -W_
197           + (r ^ omegaDot_)
198           + 2.0*(p.U() ^ omega_)
199           + (omega_ ^ (r ^ omega_))
200         );
202     return value;
206 // ************************************************************************* //