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 "PressureGradientForce.H"
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 template<class CloudType>
32 Foam::PressureGradientForce<CloudType>::PressureGradientForce
36 const dictionary& dict
39 ParticleForce<CloudType>(owner, mesh, dict, typeName, true),
40 UName_(this->coeffs().lookup("U")),
45 template<class CloudType>
46 Foam::PressureGradientForce<CloudType>::PressureGradientForce
48 const PressureGradientForce& pgf
51 ParticleForce<CloudType>(pgf),
57 // * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
59 template<class CloudType>
60 Foam::PressureGradientForce<CloudType>::~PressureGradientForce()
64 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
66 template<class CloudType>
67 void Foam::PressureGradientForce<CloudType>::cacheFields(const bool store)
71 const volVectorField& U = this->mesh().template
72 lookupObject<volVectorField>(UName_);
73 gradUPtr_ = fvc::grad(U).ptr();
86 template<class CloudType>
87 Foam::forceSuSp Foam::PressureGradientForce<CloudType>::calcCoupled
89 const typename CloudType::parcelType& p,
96 forceSuSp value(vector::zero, 0.0);
98 const volTensorField& gradU = *gradUPtr_;
99 value.Su() = mass*p.rhoc()/p.rho()*(p.U() & gradU[p.cell()]);
105 // ************************************************************************* //