1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "particleForces.H"
28 #include "volFields.H"
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 Foam::particleForces::particleForces
36 const dictionary& dict,
41 dict_(dict.subDict("particleForces")),
44 gravity_(dict_.lookup("gravity")),
45 virtualMass_(dict_.lookup("virtualMass")),
47 pressureGradient_(dict_.lookup("pressureGradient")),
48 UName_(dict_.lookupOrDefault<word>("U", "U"))
52 dict_.lookup("Cvm") >> Cvm_;
57 Foam::particleForces::particleForces(const particleForces& f)
62 gradUPtr_(f.gradUPtr_),
64 virtualMass_(f.virtualMass_),
66 pressureGradient_(f.pressureGradient_),
71 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
73 Foam::particleForces::~particleForces()
79 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
81 const Foam::dictionary& Foam::particleForces::dict() const
87 const Foam::vector& Foam::particleForces::g() const
93 Foam::Switch Foam::particleForces::gravity() const
99 Foam::Switch Foam::particleForces::virtualMass() const
105 Foam::Switch Foam::particleForces::pressureGradient() const
107 return pressureGradient_;
111 const Foam::word& Foam::particleForces::UName() const
117 void Foam::particleForces::cacheFields(const bool store)
119 if (store && pressureGradient_)
121 const volVectorField U = mesh_.lookupObject<volVectorField>(UName_);
122 gradUPtr_ = fvc::grad(U).ptr();
135 Foam::vector Foam::particleForces::calcCoupled
145 vector Ftot = vector::zero;
147 // Virtual mass force
152 "Foam::particleForces::calcCoupled(...) - virtual mass force"
154 // Ftot += Cvm_*rhoc/rho*d(Uc - U)/dt;
157 // Pressure gradient force
158 if (pressureGradient_)
160 const volTensorField& gradU = *gradUPtr_;
161 Ftot += rhoc/rho*(U & gradU[cellI]);
168 Foam::vector Foam::particleForces::calcNonCoupled
178 vector Ftot = vector::zero;
183 Ftot += g_*(1.0 - rhoc/rho);
190 // ************************************************************************* //