Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
2c08067a
Commit
2c08067a
authored
Nov 01, 2010
by
graham
Browse files
ENH: Auto and limited min cell size for densityWeightedStochastic.
parent
f8213e80
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/mesh/conformalVoronoiMesh/initialPointsMethod/densityWeightedStochastic/densityWeightedStochastic.C
View file @
2c08067a
...
...
@@ -51,9 +51,13 @@ densityWeightedStochastic::densityWeightedStochastic
:
initialPointsMethod
(
typeName
,
initialPointsDict
,
cvMesh
),
totalVolume_
(
readScalar
(
detailsDict
().
lookup
(
"totalVolume"
))),
m
axDensity
_
m
inCellSize
_
(
1
.
0
/
pow3
(
readScalar
(
detailsDict
().
lookup
(
"minCellSize"
)))
detailsDict
().
lookupOrDefault
<
scalar
>
(
"minCellSize"
,
GREAT
)
),
minCellSizeLimit_
(
detailsDict
().
lookupOrDefault
<
scalar
>
(
"minCellSizeLimit"
,
0
.
0
)
)
{}
...
...
@@ -76,6 +80,8 @@ std::vector<Vb::Point> densityWeightedStochastic::initialPoints() const
label
trialPoints
=
0
;
scalar
maxDensity
=
1
/
pow3
(
max
(
minCellSize_
,
SMALL
));
while
(
volumeAdded
<
totalVolume_
)
{
trialPoints
++
;
...
...
@@ -91,10 +97,19 @@ std::vector<Vb::Point> densityWeightedStochastic::initialPoints() const
scalar
localSize
=
cvMesh_
.
cellSizeControl
().
cellSize
(
p
);
if
(
localSize
<
minCellSize_
)
{
minCellSize_
=
max
(
localSize
,
minCellSizeLimit_
);
// 1/(minimum cell size)^3, gives the maximum permissible point
// density
maxDensity
=
1
/
pow3
(
max
(
minCellSize_
,
SMALL
));
}
scalar
localDensity
=
1
/
pow3
(
max
(
localSize
,
SMALL
));
// Accept possible placements proportional to the relative local density
if
(
localDensity
/
maxDensity
_
>
rndGen
.
scalar01
())
if
(
localDensity
/
maxDensity
>
rndGen
.
scalar01
())
{
// Determine if the point is "wellInside" the domain
if
...
...
@@ -116,7 +131,8 @@ std::vector<Vb::Point> densityWeightedStochastic::initialPoints() const
Info
<<
nl
<<
" "
<<
typeName
<<
" - "
<<
trialPoints
<<
" locations queried ("
<<
scalar
(
initialPoints
.
size
())
/
scalar
(
trialPoints
)
<<
" success rate)"
<<
endl
;
<<
" success rate). minCellSize "
<<
minCellSize_
<<
endl
;
return
initialPoints
;
}
...
...
src/mesh/conformalVoronoiMesh/initialPointsMethod/densityWeightedStochastic/densityWeightedStochastic.H
View file @
2c08067a
...
...
@@ -25,6 +25,8 @@ Class
Foam::densityWeightedStochastic
Description
Choose random points inside the domain and place them with a probability
proportional to the target density of points.
SourceFiles
densityWeightedStochastic.C
...
...
@@ -44,7 +46,7 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class densityWeightedStochastic Declaration
Class densityWeightedStochastic Declaration
\*---------------------------------------------------------------------------*/
class
densityWeightedStochastic
...
...
@@ -59,9 +61,13 @@ private:
//- The total volume to be filled
scalar
totalVolume_
;
//- 1/(minimum cell size)^3, gives the maximum permissible point
// density
scalar
maxDensity_
;
//- Working variable for minimum cell size, a starting value may be
// specified in the dictionary
mutable
scalar
minCellSize_
;
//- Smallest minimum cell size allowed, i.e. to avoid high initial
// population of areas of small size
scalar
minCellSizeLimit_
;
public:
...
...
Write
Preview
Markdown
is supported
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