Relaxation.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2013-2017 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
27
28#include "Relaxation.H"
29
30// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31
32template<class CloudType>
34(
35 const dictionary& dict,
36 CloudType& owner
37)
38:
39 DampingModel<CloudType>(dict, owner, typeName),
40 uAverage_(nullptr),
41 oneByTimeScaleAverage_(nullptr)
42{}
43
44
45template<class CloudType>
47(
48 const Relaxation<CloudType>& cm
49)
50:
52 uAverage_(nullptr),
53 oneByTimeScaleAverage_(cm.oneByTimeScaleAverage_->clone())
54{}
55
56
57// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
58
59template<class CloudType>
62{}
63
64
65// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
66
67template<class CloudType>
69{
70 if (store)
71 {
72 const fvMesh& mesh = this->owner().mesh();
73 const word& cloudName = this->owner().name();
74
75 const AveragingMethod<scalar>& volumeAverage =
76 mesh.lookupObject<AveragingMethod<scalar>>
77 (
78 cloudName + ":volumeAverage"
79 );
80 const AveragingMethod<scalar>& radiusAverage =
81 mesh.lookupObject<AveragingMethod<scalar>>
82 (
83 cloudName + ":radiusAverage"
84 );
85 const AveragingMethod<vector>& uAverage =
86 mesh.lookupObject<AveragingMethod<vector>>
87 (
88 cloudName + ":uAverage"
89 );
90 const AveragingMethod<scalar>& uSqrAverage =
91 mesh.lookupObject<AveragingMethod<scalar>>
92 (
93 cloudName + ":uSqrAverage"
94 );
95 const AveragingMethod<scalar>& frequencyAverage =
96 mesh.lookupObject<AveragingMethod<scalar>>
97 (
98 cloudName + ":frequencyAverage"
99 );
100
101 uAverage_ = &uAverage;
102
103 oneByTimeScaleAverage_.reset
104 (
106 (
108 (
109 cloudName + ":oneByTimeScaleAverage",
110 this->owner().db().time().timeName(),
111 mesh
112 ),
113 this->owner().solution().dict(),
114 mesh
115 ).ptr()
116 );
117
118 oneByTimeScaleAverage_() =
119 (
120 this->timeScaleModel_->oneByTau
121 (
122 volumeAverage,
123 radiusAverage,
124 uSqrAverage,
125 frequencyAverage
126 )
127 )();
128 }
129 else
130 {
131 uAverage_ = nullptr;
132 oneByTimeScaleAverage_.clear();
133 }
134}
135
136
137template<class CloudType>
139(
140 typename CloudType::parcelType& p,
141 const scalar deltaT
142) const
143{
144 const tetIndices tetIs(p.currentTetIndices());
145
146 const scalar x =
147 deltaT*oneByTimeScaleAverage_->interpolate(p.coordinates(), tetIs);
148
149 const vector u = uAverage_->interpolate(p.coordinates(), tetIs);
150
151 return (u - p.U())*x/(x + 2.0);
152}
153
154
155// ************************************************************************* //
Base class for lagrangian averaging methods.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:75
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220
Base class for collisional damping models.
Definition: DampingModel.H:66
Relaxation collisional damping model.
Definition: Relaxation.H:71
virtual void cacheFields(const bool store)
Member Functions.
Definition: Relaxation.C:68
virtual vector velocityCorrection(typename CloudType::parcelType &p, const scalar deltaT) const
Calculate the velocity correction.
Definition: Relaxation.C:139
virtual ~Relaxation()
Destructor.
Definition: Relaxation.C:61
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
void clear()
Clear the PtrList. Delete allocated entries and set size to zero.
Definition: PtrListI.H:97
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
Storage and named access for the indices of a tet which is part of the decomposition of a cell.
Definition: tetIndices.H:84
A class for handling words, derived from Foam::string.
Definition: word.H:68
volScalarField & p
dynamicFvMesh & mesh
dictionary dict
const word cloudName(propsDict.get< word >("cloud"))