solidParticle.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) 2011-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 "solidParticleCloud.H"
29
30// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31
32namespace Foam
33{
35}
36
37// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
38
40(
42 trackingData& td,
43 const scalar trackTime
44)
45{
46 td.switchProcessor = false;
47 td.keepParticle = true;
48
49 while (td.keepParticle && !td.switchProcessor && stepFraction() < 1)
50 {
51 if (debug)
52 {
53 Pout<< "Time = " << mesh().time().timeName()
54 << " trackTime = " << trackTime
55 << " steptFraction() = " << stepFraction() << endl;
56 }
57
58
59 const scalar sfrac = stepFraction();
60
61 const scalar f = 1 - stepFraction();
62 trackToAndHitFace(f*trackTime*U_, f, cloud, td);
63
64 const scalar dt = (stepFraction() - sfrac)*trackTime;
65
66 const tetIndices tetIs = this->currentTetIndices();
67 scalar rhoc = td.rhoInterp().interpolate(this->coordinates(), tetIs);
68 vector Uc = td.UInterp().interpolate(this->coordinates(), tetIs);
69 scalar nuc = td.nuInterp().interpolate(this->coordinates(), tetIs);
70
71 scalar rhop = cloud.rhop();
72 scalar magUr = mag(Uc - U_);
73
74 scalar ReFunc = 1.0;
75 scalar Re = magUr*d_/nuc;
76
77 if (Re > 0.01)
78 {
79 ReFunc += 0.15*pow(Re, 0.687);
80 }
81
82 scalar Dc = (24.0*nuc/d_)*ReFunc*(3.0/4.0)*(rhoc/(d_*rhop));
83
84 U_ = (U_ + dt*(Dc*Uc + (1.0 - rhoc/rhop)*td.g()))/(1.0 + dt*Dc);
85 }
86
87 return td.keepParticle;
88}
89
90
92{
93 return false;
94}
95
96
98(
100 trackingData& td
101)
102{
103 td.switchProcessor = true;
104}
105
106
108{
109 const vector nw = normal();
110
111 scalar Un = U_ & nw;
112 vector Ut = U_ - Un*nw;
113
114 if (Un > 0)
115 {
116 U_ -= (1.0 + cloud.e())*Un*nw;
117 }
118
119 U_ -= cloud.mu()*Ut;
120}
121
122
124{
126 U_ = transform(T, U_);
127}
128
129
131{
133}
134
135
136// ************************************************************************* //
Base cloud calls templated on particle type.
Definition: Cloud.H:68
static word timeName(const scalar t, const int precision=precision_)
Definition: Time.C:780
A cloud is a registry collection of lagrangian particles.
Definition: cloud.H:60
virtual void move()=0
Type interpolate(const cellPointWeight &cpw) const
Interpolate field for the given cellPointWeight.
const Time & time() const noexcept
Return time registry.
bool switchProcessor
Flag to switch processor.
Definition: particle.H:102
bool keepParticle
Flag to indicate whether to keep particle (false = delete)
Definition: particle.H:105
virtual void transformProperties(const tensor &T)
Transform the physical properties of the particle.
Definition: particle.C:1072
tetIndices currentTetIndices() const noexcept
Return indices of the current tet that the particle occupies.
Definition: particleI.H:265
const polyMesh & mesh() const noexcept
Return the mesh database.
Definition: particleI.H:137
const barycentric & coordinates() const noexcept
Return current particle coordinates.
Definition: particleI.H:143
scalar stepFraction() const noexcept
Return the fraction of time-step completed.
Definition: particleI.H:197
void trackToAndHitFace(const vector &direction, const scalar fraction, TrackCloudType &cloud, trackingData &td)
Convenience function. Combines trackToFace and hitFace.
A Cloud of solid particles.
Class used to pass tracking data to the trackToFace function.
Definition: solidParticle.H:86
const interpolationCellPoint< scalar > & rhoInterp() const
const interpolationCellPoint< vector > & UInterp() const
const interpolationCellPoint< scalar > & nuInterp() const
virtual void transformProperties(const tensor &T)
Transform the physical properties of the particle.
void hitWallPatch(solidParticleCloud &cloud, trackingData &td)
Overridable function to handle the particle hitting a wallPatch.
bool hitPatch(solidParticleCloud &cloud, trackingData &td)
Overridable function to handle the particle hitting a patch.
Definition: solidParticle.C:91
void hitProcessorPatch(solidParticleCloud &cloud, trackingData &td)
Overridable function to handle the particle hitting a.
Definition: solidParticle.C:98
Storage and named access for the indices of a tet which is part of the decomposition of a cell.
Definition: tetIndices.H:84
#define defineTemplateTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information for templates, useful.
Definition: className.H:132
const volScalarField & T
Namespace for OpenFOAM.
scalarField Re(const UList< complex > &cf)
Extract real component.
Definition: complexField.C:159
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Definition: dimensionSet.C:536
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
labelList f(nPoints)