DenseDragForce.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2019-2021 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "DenseDragForce.H"
28 #include "volFields.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
32 template<class CloudType>
34 (
35  CloudType& owner,
36  const fvMesh& mesh,
37  const dictionary& dict,
38  const word& typeName
39 )
40 :
41  ParticleForce<CloudType>(owner, mesh, dict, typeName, true),
42  alphacName_(this->coeffs().lookup("alphac")),
43  alphacPtr_(nullptr),
44  alphacInterpPtr_(nullptr)
45 {}
46 
47 
48 template<class CloudType>
50 (
52 )
53 :
55  alphacName_(df.alphacName_),
56  alphacPtr_(nullptr),
57  alphacInterpPtr_(nullptr)
58 {}
59 
60 
61 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
62 
63 template<class CloudType>
65 {}
66 
67 
68 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
69 
70 template<class CloudType>
73 {
74  if (!alphacInterpPtr_.valid())
75  {
77  << "Carrier phase volume-fraction interpolation object not set"
78  << abort(FatalError);
79  }
80 
81  return alphacInterpPtr_();
82 }
83 
84 
85 template<class CloudType>
87 {
88  if (store)
89  {
90  if (!this->mesh().template foundObject<volScalarField>(alphacName_))
91  {
92  alphacPtr_.reset
93  (
94  new volScalarField(alphacName_, 1 - this->owner().theta())
95  );
96  }
97 
98  const volScalarField& alphac =
99  this->mesh().template lookupObject<volScalarField>(alphacName_);
100 
101  alphacInterpPtr_.reset
102  (
104  (
105  this->owner().solution().interpolationSchemes(),
106  alphac
107  ).ptr()
108  );
109  }
110  else
111  {
112  alphacInterpPtr_.clear();
113  alphacPtr_.clear();
114  }
115 }
116 
117 
118 // ************************************************************************* //
dictionary dict
virtual void cacheFields(const bool store)
Cache fields.
error FatalError
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:306
Abstract base class for particle forces.
Definition: ParticleForce.H:53
fvMesh & mesh
DenseDragForce(CloudType &owner, const fvMesh &mesh, const dictionary &dict, const word &typeName)
Construct from mesh.
const word alphacName_
Name of the carrier volume fraction field.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:58
A class for handling words, derived from string.
Definition: word.H:59
errorManip< error > abort(error &err)
Definition: errorManip.H:131
const interpolation< scalar > & alphacInterp() const
Return the volume fraction interpolation.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:95
Abstract base class for interpolation.
virtual ~DenseDragForce()
Destructor.
Selector class for relaxation factors, solver type and solution.
Definition: solution.H:48
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:75