Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
d3b48fea
Commit
d3b48fea
authored
Feb 24, 2011
by
andy
Browse files
ENH: Re-worked lagrangian/solidParticle
parent
84314bfd
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/lagrangian/solidParticle/solidParticle.C
View file @
d3b48fea
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-201
0
OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-201
1
OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -29,15 +29,14 @@ License
bool
Foam
::
solidParticle
::
move
(
solidParticle
::
trackData
&
td
,
track
ing
Data
&
td
,
const
scalar
trackTime
)
{
td
.
switchProcessor
=
false
;
td
.
keepParticle
=
true
;
const
polyMesh
&
mesh
=
cloud
().
pMesh
();
const
polyBoundaryMesh
&
pbMesh
=
mesh
.
boundaryMesh
();
const
polyBoundaryMesh
&
pbMesh
=
mesh_
.
boundaryMesh
();
scalar
tEnd
=
(
1
.
0
-
stepFraction
())
*
trackTime
;
scalar
dtMax
=
tEnd
;
...
...
@@ -46,7 +45,7 @@ bool Foam::solidParticle::move
{
if
(
debug
)
{
Info
<<
"Time = "
<<
mesh
.
time
().
timeName
()
Info
<<
"Time = "
<<
mesh
_
.
time
().
timeName
()
<<
" trackTime = "
<<
trackTime
<<
" tEnd = "
<<
tEnd
<<
" steptFraction() = "
<<
stepFraction
()
<<
endl
;
...
...
@@ -64,12 +63,12 @@ bool Foam::solidParticle::move
tEnd
-=
dt
;
stepFraction
()
=
1
.
0
-
tEnd
/
trackTime
;
cellPointWeight
cpw
(
mesh
,
position
(),
cellI
,
face
());
cellPointWeight
cpw
(
mesh
_
,
position
(),
cellI
,
face
());
scalar
rhoc
=
td
.
rhoInterp
().
interpolate
(
cpw
);
vector
Uc
=
td
.
UInterp
().
interpolate
(
cpw
);
scalar
nuc
=
td
.
nuInterp
().
interpolate
(
cpw
);
scalar
rhop
=
td
.
spc
().
rhop
();
scalar
rhop
=
td
.
cloud
().
rhop
();
scalar
magUr
=
mag
(
Uc
-
U_
);
scalar
ReFunc
=
1
.
0
;
...
...
@@ -100,20 +99,7 @@ bool Foam::solidParticle::move
bool
Foam
::
solidParticle
::
hitPatch
(
const
polyPatch
&
,
solidParticle
::
trackData
&
,
const
label
,
const
scalar
,
const
tetIndices
&
)
{
return
false
;
}
bool
Foam
::
solidParticle
::
hitPatch
(
const
polyPatch
&
,
int
&
,
trackingData
&
,
const
label
,
const
scalar
,
const
tetIndices
&
...
...
@@ -126,29 +112,21 @@ bool Foam::solidParticle::hitPatch
void
Foam
::
solidParticle
::
hitProcessorPatch
(
const
processorPolyPatch
&
,
solidParticle
::
trackData
&
td
track
ing
Data
&
td
)
{
td
.
switchProcessor
=
true
;
}
void
Foam
::
solidParticle
::
hitProcessorPatch
(
const
processorPolyPatch
&
,
int
&
)
{}
void
Foam
::
solidParticle
::
hitWallPatch
(
const
wallPolyPatch
&
wpp
,
solidParticle
::
trackData
&
td
,
track
ing
Data
&
td
,
const
tetIndices
&
tetIs
)
{
vector
nw
=
tetIs
.
faceTri
(
cloud
().
pM
esh
()
).
normal
();
vector
nw
=
tetIs
.
faceTri
(
m
esh
_
).
normal
();
nw
/=
mag
(
nw
);
scalar
Un
=
U_
&
nw
;
...
...
@@ -156,50 +134,33 @@ void Foam::solidParticle::hitWallPatch
if
(
Un
>
0
)
{
U_
-=
(
1
.
0
+
td
.
spc
().
e
())
*
Un
*
nw
;
U_
-=
(
1
.
0
+
td
.
cloud
().
e
())
*
Un
*
nw
;
}
U_
-=
td
.
spc
().
mu
()
*
Ut
;
U_
-=
td
.
cloud
().
mu
()
*
Ut
;
}
void
Foam
::
solidParticle
::
hitWallPatch
(
const
wallPolyPatch
&
,
int
&
,
const
tetIndices
&
)
{}
void
Foam
::
solidParticle
::
hitPatch
(
const
polyPatch
&
,
solidParticle
::
trackData
&
td
track
ing
Data
&
td
)
{
td
.
keepParticle
=
false
;
}
void
Foam
::
solidParticle
::
hitPatch
(
const
polyPatch
&
,
int
&
)
{}
void
Foam
::
solidParticle
::
transformProperties
(
const
tensor
&
T
)
{
P
article
<
solidParticle
>
::
transformProperties
(
T
);
p
article
::
transformProperties
(
T
);
U_
=
transform
(
T
,
U_
);
}
void
Foam
::
solidParticle
::
transformProperties
(
const
vector
&
separation
)
{
P
article
<
solidParticle
>
::
transformProperties
(
separation
);
p
article
::
transformProperties
(
separation
);
}
...
...
src/lagrangian/solidParticle/solidParticle.H
View file @
d3b48fea
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-201
0
OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-201
1
OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -38,7 +38,7 @@ SourceFiles
#ifndef solidParticle_H
#define solidParticle_H
#include
"
P
article.H"
#include
"
p
article.H"
#include
"IOstream.H"
#include
"autoPtr.H"
#include
"interpolationCellPoint.H"
...
...
@@ -57,7 +57,7 @@ class solidParticleCloud;
class
solidParticle
:
public
P
article
<
solidParticle
>
public
p
article
{
// Private member data
...
...
@@ -73,11 +73,10 @@ public:
friend
class
Cloud
<
solidParticle
>
;
//- Class used to pass tracking data to the trackToFace function
class
trackData
class
trackingData
:
public
particle
::
TrackingData
<
solidParticleCloud
>
{
//- Reference to the cloud containing this particle
solidParticleCloud
&
spc_
;
// Interpolators for continuous phase fields
const
interpolationCellPoint
<
scalar
>&
rhoInterp_
;
...
...
@@ -90,13 +89,9 @@ public:
public:
bool
switchProcessor
;
bool
keepParticle
;
// Constructors
inline
trackData
inline
track
ing
Data
(
solidParticleCloud
&
spc
,
const
interpolationCellPoint
<
scalar
>&
rhoInterp
,
...
...
@@ -108,8 +103,6 @@ public:
// Member functions
inline
solidParticleCloud
&
spc
();
inline
const
interpolationCellPoint
<
scalar
>&
rhoInterp
()
const
;
inline
const
interpolationCellPoint
<
vector
>&
UInterp
()
const
;
...
...
@@ -125,7 +118,7 @@ public:
//- Construct from components
inline
solidParticle
(
const
Cloud
<
solidParticle
>&
c
,
const
polyMesh
&
mesh
,
const
vector
&
position
,
const
label
cellI
,
const
label
tetFaceI
,
...
...
@@ -137,17 +130,39 @@ public:
//- Construct from Istream
solidParticle
(
const
Cloud
<
solidParticle
>&
c
,
const
polyMesh
&
mesh
,
Istream
&
is
,
bool
readFields
=
true
);
//- Construct and return a clone
virtual
autoPtr
<
Particle
<
solidP
article
>
>
clone
()
const
virtual
autoPtr
<
p
article
>
clone
()
const
{
return
autoPtr
<
Particle
<
solidP
article
>
>
(
new
solidParticle
(
*
this
));
return
autoPtr
<
p
article
>
(
new
solidParticle
(
*
this
));
}
//- Factory class to read-construct particles used for
// parallel transfer
class
iNew
{
const
polyMesh
&
mesh_
;
public:
iNew
(
const
polyMesh
&
mesh
)
:
mesh_
(
mesh
)
{}
autoPtr
<
solidParticle
>
operator
()(
Istream
&
is
)
const
{
return
autoPtr
<
solidParticle
>
(
new
solidParticle
(
mesh_
,
is
,
true
)
);
}
};
// Member Functions
...
...
@@ -167,7 +182,7 @@ public:
// Tracking
//- Move
bool
move
(
trackData
&
,
const
scalar
);
bool
move
(
track
ing
Data
&
,
const
scalar
);
// Patch interactions
...
...
@@ -177,18 +192,7 @@ public:
bool
hitPatch
(
const
polyPatch
&
,
solidParticle
::
trackData
&
td
,
const
label
patchI
,
const
scalar
trackFraction
,
const
tetIndices
&
tetIs
);
//- Overridable function to handle the particle hitting a patch
// Executed before other patch-hitting functions without trackData
bool
hitPatch
(
const
polyPatch
&
p
,
int
&
td
,
trackingData
&
td
,
const
label
patchI
,
const
scalar
trackFraction
,
const
tetIndices
&
tetIs
...
...
@@ -199,31 +203,14 @@ public:
void
hitProcessorPatch
(
const
processorPolyPatch
&
,
solidParticle
::
trackData
&
td
);
//- Overridable function to handle the particle hitting a
// processorPatch without trackData
void
hitProcessorPatch
(
const
processorPolyPatch
&
,
int
&
);
//- Overridable function to handle the particle hitting a wallPatch
void
hitWallPatch
(
const
wallPolyPatch
&
,
solidParticle
::
trackData
&
td
,
const
tetIndices
&
trackingData
&
td
);
//- Overridable function to handle the particle hitting a wallPatch
//- without trackData
void
hitWallPatch
(
const
wallPolyPatch
&
,
int
&
,
trackingData
&
td
,
const
tetIndices
&
);
...
...
@@ -231,15 +218,7 @@ public:
void
hitPatch
(
const
polyPatch
&
,
solidParticle
::
trackData
&
td
);
//- Overridable function to handle the particle hitting a polyPatch
//- without trackData
void
hitPatch
(
const
polyPatch
&
,
int
&
trackingData
&
td
);
//- Transform the physical properties of the particle
...
...
src/lagrangian/solidParticle/solidParticleCloud.C
View file @
d3b48fea
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-201
0
OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-201
1
OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -32,8 +32,8 @@ License
namespace
Foam
{
defineParticleTypeNameAndDebug
(
solidParticle
,
0
);
defineTemplateTypeNameAndDebug
(
Cloud
<
solidParticle
>
,
0
);
//
defineParticleTypeNameAndDebug(solidParticle, 0);
//
defineTemplateTypeNameAndDebug(Cloud<solidParticle>, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
...
...
@@ -81,7 +81,8 @@ void Foam::solidParticleCloud::move(const dimensionedVector& g)
interpolationCellPoint
<
vector
>
UInterp
(
U
);
interpolationCellPoint
<
scalar
>
nuInterp
(
nu
);
solidParticle
::
trackData
td
(
*
this
,
rhoInterp
,
UInterp
,
nuInterp
,
g
.
value
());
solidParticle
::
trackingData
td
(
*
this
,
rhoInterp
,
UInterp
,
nuInterp
,
g
.
value
());
Cloud
<
solidParticle
>::
move
(
td
,
mesh_
.
time
().
deltaTValue
());
}
...
...
src/lagrangian/solidParticle/solidParticleI.H
View file @
d3b48fea
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-201
0
OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-201
1
OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -25,7 +25,7 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
inline
Foam
::
solidParticle
::
trackData
::
trackData
inline
Foam
::
solidParticle
::
track
ing
Data
::
track
ing
Data
(
solidParticleCloud
&
spc
,
const
interpolationCellPoint
<
scalar
>&
rhoInterp
,
...
...
@@ -34,7 +34,7 @@ inline Foam::solidParticle::trackData::trackData
const
vector
&
g
)
:
spc_
(
spc
),
particle
::
TrackingData
<
solidParticleCloud
>
(
spc
),
rhoInterp_
(
rhoInterp
),
UInterp_
(
UInterp
),
nuInterp_
(
nuInterp
),
...
...
@@ -44,7 +44,7 @@ inline Foam::solidParticle::trackData::trackData
inline
Foam
::
solidParticle
::
solidParticle
(
const
Cloud
<
solidParticle
>&
c
,
const
polyMesh
&
mesh
,
const
vector
&
position
,
const
label
cellI
,
const
label
tetFaceI
,
...
...
@@ -53,7 +53,7 @@ inline Foam::solidParticle::solidParticle
const
vector
&
U
)
:
Particle
<
solidP
article
>
(
c
,
position
,
cellI
,
tetFaceI
,
tetPtI
),
p
article
(
mesh
,
position
,
cellI
,
tetFaceI
,
tetPtI
),
d_
(
d
),
U_
(
U
)
{}
...
...
@@ -61,33 +61,27 @@ inline Foam::solidParticle::solidParticle
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline
Foam
::
solidParticleCloud
&
Foam
::
solidParticle
::
trackData
::
spc
()
{
return
spc_
;
}
inline
const
Foam
::
interpolationCellPoint
<
Foam
::
scalar
>&
Foam
::
solidParticle
::
trackData
::
rhoInterp
()
const
Foam
::
solidParticle
::
track
ing
Data
::
rhoInterp
()
const
{
return
rhoInterp_
;
}
inline
const
Foam
::
interpolationCellPoint
<
Foam
::
vector
>&
Foam
::
solidParticle
::
trackData
::
UInterp
()
const
Foam
::
solidParticle
::
track
ing
Data
::
UInterp
()
const
{
return
UInterp_
;
}
inline
const
Foam
::
interpolationCellPoint
<
Foam
::
scalar
>&
Foam
::
solidParticle
::
trackData
::
nuInterp
()
const
Foam
::
solidParticle
::
track
ing
Data
::
nuInterp
()
const
{
return
nuInterp_
;
}
inline
const
Foam
::
vector
&
Foam
::
solidParticle
::
trackData
::
g
()
const
inline
const
Foam
::
vector
&
Foam
::
solidParticle
::
track
ing
Data
::
g
()
const
{
return
g_
;
}
...
...
src/lagrangian/solidParticle/solidParticleIO.C
View file @
d3b48fea
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-201
0
OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-201
1
OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -30,12 +30,12 @@ License
Foam
::
solidParticle
::
solidParticle
(
const
Cloud
<
solidParticle
>&
cloud
,
const
polyMesh
&
mesh
,
Istream
&
is
,
bool
readFields
)
:
Particle
<
solidParticle
>
(
cloud
,
is
,
readFields
)
particle
(
mesh
,
is
,
readFields
)
{
if
(
readFields
)
{
...
...
@@ -65,6 +65,9 @@ void Foam::solidParticle::readFields(Cloud<solidParticle>& c)
{
return
;
}
particle
::
readFields
(
c
);
IOField
<
scalar
>
d
(
c
.
fieldIOobject
(
"d"
,
IOobject
::
MUST_READ
));
c
.
checkFieldIOobject
(
c
,
d
);
...
...
@@ -85,7 +88,7 @@ void Foam::solidParticle::readFields(Cloud<solidParticle>& c)
void
Foam
::
solidParticle
::
writeFields
(
const
Cloud
<
solidParticle
>&
c
)
{
P
article
<
solidParticle
>
::
writeFields
(
c
);
p
article
::
writeFields
(
c
);
label
np
=
c
.
size
();
...
...
@@ -113,13 +116,13 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const solidParticle& p)
{
if
(
os
.
format
()
==
IOstream
::
ASCII
)
{
os
<<
static_cast
<
const
P
article
<
solidParticle
>
&>
(
p
)
os
<<
static_cast
<
const
p
article
&>
(
p
)
<<
token
::
SPACE
<<
p
.
d_
<<
token
::
SPACE
<<
p
.
U_
;
}
else
{
os
<<
static_cast
<
const
P
article
<
solidParticle
>
&>
(
p
);
os
<<
static_cast
<
const
p
article
&>
(
p
);
os
.
write
(
reinterpret_cast
<
const
char
*>
(
&
p
.
d_
),
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment