Skip to content
GitLab
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
c0460d30
Commit
c0460d30
authored
Oct 04, 2018
by
mattijs
Browse files
Merge remote-tracking branch 'Customer-VWG/wp3-directional-refinement' into develop
parents
66275158
8855fdeb
Changes
43
Hide whitespace changes
Inline
Side-by-side
applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict
View file @
c0460d30
...
...
@@ -306,6 +306,35 @@ castellatedMeshControls
// // - cellLevel will include any directional refinement
// // (i.e. it will be the maximum of all three directions)
//}
//wakeBox
//{
// mode inside;
// // Dummy base level
// levels ((10000 0));
//
// // Optional directional refinement (after all other refinement)
// // Directional refinement
// // for all cells according to 'mode' ('inside' or 'outside';
// // 'distance' not supported) and within certain range. E.g.
// // - for all cells with level 2-5
// // - do one split in x direction
// levelIncrement (2 5 (1 0 0));
//
// // Note
// // - ignores 'levels' and gap* settings.
// // - the cellLevel/pointLevels files are no longer consistent
// // with the mesh, the resulting mesh is no longer compatible
// // with e.g. dynamic refinement/unrefinement.
// // - cellLevel will include any directional refinement
// // (i.e. it will be the maximum of all three directions)
//
// // Optional directional expansion-ratio smoothing (after all
// // refinement). This will try to smooth out edge/cell size jumps
// // Specify smoothing direction and number of iterations
// nSmoothExpansion 100;
// smoothDirection (1 0 0);
//}
}
...
...
src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8.C
View file @
c0460d30
...
...
@@ -3148,7 +3148,6 @@ Foam::labelList Foam::hexRef8::consistentSlowRefinement2
bitSet
refineCell
(
mesh_
.
nCells
(),
newCellsToRefine
);
const
bitSet
savedRefineCell
(
refineCell
);
label
nChanged
=
faceConsistentRefinement
(
true
,
cellLevel_
,
refineCell
);
{
...
...
src/mesh/snappyHexMesh/meshRefinement/meshRefinement.H
View file @
c0460d30
...
...
@@ -1053,7 +1053,6 @@ public:
const
scalar
maxLoadUnbalance
);
//- Calculate list of cells to directionally refine
labelList
directionalRefineCandidates
(
...
...
src/mesh/snappyHexMesh/shellSurfaces/shellSurfaces.C
View file @
c0460d30
...
...
@@ -595,6 +595,9 @@ Foam::shellSurfaces::shellSurfaces
distances_
.
setSize
(
shellI
);
levels_
.
setSize
(
shellI
);
dirLevels_
.
setSize
(
shellI
);
smoothDirection_
.
setSize
(
shellI
);
nSmoothExpansion_
.
setSize
(
shellI
);
nSmoothPosition_
.
setSize
(
shellI
);
extendedGapLevel_
.
setSize
(
shellI
);
extendedGapMode_
.
setSize
(
shellI
);
...
...
@@ -671,6 +674,19 @@ Foam::shellSurfaces::shellSurfaces
}
}
// Directional smoothing
// ~~~~~~~~~~~~~~~~~~~~~
nSmoothExpansion_
[
shellI
]
=
0
;
nSmoothPosition_
[
shellI
]
=
0
;
smoothDirection_
[
shellI
]
=
dict
.
lookupOrDefault
(
"smoothDirection"
,
vector
::
zero
);
if
(
smoothDirection_
[
shellI
]
!=
vector
::
zero
)
{
dict
.
lookup
(
"nSmoothExpansion"
)
>>
nSmoothExpansion_
[
shellI
];
dict
.
lookup
(
"nSmoothPosition"
)
>>
nSmoothPosition_
[
shellI
];
}
// Gap specification
...
...
@@ -797,6 +813,24 @@ Foam::labelPairList Foam::shellSurfaces::directionalSelectLevel() const
}
const
Foam
::
labelList
&
Foam
::
shellSurfaces
::
nSmoothExpansion
()
const
{
return
nSmoothExpansion_
;
}
const
Foam
::
vectorField
&
Foam
::
shellSurfaces
::
smoothDirection
()
const
{
return
smoothDirection_
;
}
const
Foam
::
labelList
&
Foam
::
shellSurfaces
::
nSmoothPosition
()
const
{
return
nSmoothPosition_
;
}
void
Foam
::
shellSurfaces
::
findHigherLevel
(
const
pointField
&
pt
,
...
...
src/mesh/snappyHexMesh/shellSurfaces/shellSurfaces.H
View file @
c0460d30
...
...
@@ -86,8 +86,20 @@ private:
//- Per shell per distance the refinement level
labelListList
levels_
;
//- Per shell any additional directional refinement
List
<
Tuple2
<
labelPair
,
labelVector
>>
dirLevels_
;
// Directional
//- Per shell any additional directional refinement
List
<
Tuple2
<
labelPair
,
labelVector
>>
dirLevels_
;
//- Per shell the smoothing direction
vectorField
smoothDirection_
;
//- Per shell the directional smoothing iterations
labelList
nSmoothExpansion_
;
//- Per shell the positional smoothing iterations
labelList
nSmoothPosition_
;
// Gap level refinement
...
...
@@ -231,6 +243,15 @@ public:
const
direction
dir
,
labelList
&
shell
)
const
;
//- Per shell the smoothing direction
const
vectorField
&
smoothDirection
()
const
;
//- Per shell the directional smoothing iterations
const
labelList
&
nSmoothExpansion
()
const
;
//- Per shell the positional smoothing iterations
const
labelList
&
nSmoothPosition
()
const
;
};
...
...
src/mesh/snappyHexMesh/snappyHexMeshDriver/
p
ointData/
p
ointData.H
→
src/mesh/snappyHexMesh/snappyHexMeshDriver/
P
oint
Integrate
Data/
P
oint
Integrate
Data.H
View file @
c0460d30
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 201
1-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 201
8 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -22,87 +22,128 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::
p
ointData
Foam::
P
oint
Integrate
Data
Description
Variant of pointEdgePoint with some transported additional data.
WIP - should be templated on data like wallDistData.
Passive vector v_ is not a coordinate (so no enterDomain/leaveDomain
transformation needed)
Integrate along selected edges using PointEdgeWave.
SourceFiles
pointDataI.H
pointData.C
PointIntegrateDataI.H
\*---------------------------------------------------------------------------*/
#ifndef pointData_H
#define pointData_H
#include
"pointEdgePoint.H"
#ifndef PointIntegrateData_H
#define PointIntegrateData_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace
Foam
{
// Forward declaration of friend functions and operators
class
pointData
;
Istream
&
operator
>>
(
Istream
&
,
pointData
&
);
Ostream
&
operator
<<
(
Ostream
&
,
const
pointData
&
);
// Forward declaration of classes
class
Istream
;
class
Ostream
;
template
<
class
DataType
>
class
PointIntegrateData
;
// Forward declaration of friend functions and operators
template
<
class
DataType
>
Ostream
&
operator
<<
(
Ostream
&
,
const
PointIntegrateData
<
DataType
>&
);
template
<
class
DataType
>
Istream
&
operator
>>
(
Istream
&
,
PointIntegrateData
<
DataType
>&
);
/*---------------------------------------------------------------------------*\
Class
p
ointData
D
eclaration
Class
P
oint
Integrate
Data
d
eclaration
\*---------------------------------------------------------------------------*/
class
pointData
:
public
pointEdgePoint
template
<
class
DataType
>
class
PointIntegrateData
{
private:
// Private data
//- Additional information.
scalar
s_
;
//- Valid flag
bool
valid_
;
//- Integrated data
DataType
data_
;
//- Additional information.
vector
v_
;
public:
//- Class used to pass extra data
class
trackingData
{
public:
UList
<
DataType
>&
edgeData_
;
trackingData
(
UList
<
DataType
>&
edgeData
)
:
edgeData_
(
edgeData
)
{}
};
// Constructors
//- Construct null
inline
pointData
();
//- Construct from origin, distance
inline
pointData
(
const
point
&
origin
,
const
scalar
distSqr
,
const
scalar
s
,
const
vector
&
v
);
inline
PointIntegrateData
();
//- Construct
as copy
inline
p
ointData
(
const
pointData
&
);
//- Construct
from data
inline
P
oint
Integrate
Data
(
const
DataType
&
data
);
// Member Functions
// Access
inline
scalar
s
()
const
;
//- Const access the data
inline
const
DataType
&
data
()
const
{
return
data_
;
};
// Needed by PointEdgeWave
inline
const
vector
&
v
()
const
;
//- Check whether original (invalid) value.
template
<
class
TrackingData
>
inline
bool
valid
(
TrackingData
&
td
)
const
;
//- Check for identical geometrical data. Used for cyclics checking.
template
<
class
TrackingData
>
inline
bool
sameGeometry
(
const
PointIntegrateData
<
DataType
>&
,
const
scalar
tol
,
TrackingData
&
td
)
const
;
//- Convert origin to relative vector to leaving point
// (= point coordinate)
template
<
class
TrackingData
>
inline
void
leaveDomain
(
const
polyPatch
&
patch
,
const
label
patchPointi
,
const
point
&
pos
,
TrackingData
&
td
);
// Needed by meshWave
//- Convert relative origin to absolute by adding entering point
template
<
class
TrackingData
>
inline
void
enterDomain
(
const
polyPatch
&
patch
,
const
label
patchPointi
,
const
point
&
pos
,
TrackingData
&
td
);
//- Apply rotation matrix to
origin
//- Apply rotation matrix to
the data
template
<
class
TrackingData
>
inline
void
transform
(
...
...
@@ -115,9 +156,9 @@ public:
inline
bool
updatePoint
(
const
polyMesh
&
mesh
,
const
label
point
i
,
const
label
point
I
,
const
label
edgeI
,
const
p
oint
Data
&
edgeInfo
,
const
P
oint
IntegrateData
<
DataType
>
&
edgeInfo
,
const
scalar
tol
,
TrackingData
&
td
);
...
...
@@ -128,8 +169,8 @@ public:
inline
bool
updatePoint
(
const
polyMesh
&
mesh
,
const
label
point
i
,
const
p
oint
Data
&
newPointInfo
,
const
label
point
I
,
const
P
oint
IntegrateData
<
DataType
>
&
newPointInfo
,
const
scalar
tol
,
TrackingData
&
td
);
...
...
@@ -139,7 +180,7 @@ public:
template
<
class
TrackingData
>
inline
bool
updatePoint
(
const
p
oint
Data
&
newPointInfo
,
const
P
oint
IntegrateData
<
DataType
>
&
newPointInfo
,
const
scalar
tol
,
TrackingData
&
td
);
...
...
@@ -150,33 +191,57 @@ public:
(
const
polyMesh
&
mesh
,
const
label
edgeI
,
const
label
point
i
,
const
p
oint
Data
&
pointInfo
,
const
label
point
I
,
const
P
oint
IntegrateData
<
DataType
>
&
pointInfo
,
const
scalar
tol
,
TrackingData
&
td
);
//- Same (like operator==)
template
<
class
TrackingData
>
inline
bool
equal
(
const
PointIntegrateData
<
DataType
>&
,
TrackingData
&
td
)
const
;
// Member Operators
// Needed for List IO
inline
bool
operator
==
(
const
p
oint
Data
&
)
const
;
inline
bool
operator
!=
(
const
p
oint
Data
&
)
const
;
inline
bool
operator
==
(
const
P
oint
IntegrateData
<
DataType
>
&
)
const
;
inline
bool
operator
!=
(
const
P
oint
IntegrateData
<
DataType
>
&
)
const
;
// IOstream Operators
friend
Ostream
&
operator
<<
(
Ostream
&
,
const
pointData
&
);
friend
Istream
&
operator
>>
(
Istream
&
,
pointData
&
);
friend
Ostream
&
operator
<<
<
DataType
>
(
Ostream
&
,
const
PointIntegrateData
<
DataType
>&
);
friend
Istream
&
operator
>>
<
DataType
>
(
Istream
&
,
PointIntegrateData
<
DataType
>&
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Data associated with PointIntegrateData types is contiguous
//- Data associated with pointData as contiguous as pointEdgePoint
template
<
>
inline
bool
contiguous
<
p
oint
Data
>
()
inline
bool
contiguous
<
P
oint
IntegrateData
<
scalar
>
>
()
{
return
contiguous
<
pointEdgePoint
>
()
;
return
true
;
}
template
<
>
inline
bool
contiguous
<
PointIntegrateData
<
vector
>>
()
{
return
true
;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -184,7 +249,7 @@ inline bool contiguous<pointData>()
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include
"
p
ointDataI.H"
#include
"
P
oint
Integrate
DataI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
src/mesh/snappyHexMesh/snappyHexMeshDriver/
p
ointData/
p
ointDataI.H
→
src/mesh/snappyHexMesh/snappyHexMeshDriver/
P
oint
Integrate
Data/
P
oint
Integrate
DataI.H
View file @
c0460d30
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 201
1-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 201
8 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -28,92 +28,103 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Null constructor
inline
Foam
::
p
oint
Data
::
p
ointData
()
template
<
class
DataType
>
inline
Foam
::
P
oint
IntegrateData
<
DataType
>
::
P
oint
Integrate
Data
()
:
pointEdgePoint
(),
s_
(
GREAT
),
v_
(
point
::
max
)
valid_
(
false
)
{}
// Construct from origin, distance
inline
Foam
::
p
oint
Data
::
p
ointData
template
<
class
DataType
>
inline
Foam
::
P
oint
IntegrateData
<
DataType
>
::
P
oint
Integrate
Data
(
const
point
&
origin
,
const
scalar
distSqr
,
const
scalar
s
,
const
vector
&
v
const
DataType
&
data
)
:
pointEdgePoint
(
origin
,
distSqr
),
s_
(
s
),
v_
(
v
)
{}
// Construct as copy
inline
Foam
::
pointData
::
pointData
(
const
pointData
&
wpt
)
:
pointEdgePoint
(
wpt
),
s_
(
wpt
.
s
()),
v_
(
wpt
.
v
())
valid_
(
true
),
data_
(
data
)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline
Foam
::
scalar
Foam
::
pointData
::
s
()
const
template
<
class
DataType
>
template
<
class
TrackingData
>
inline
bool
Foam
::
PointIntegrateData
<
DataType
>::
valid
(
TrackingData
&
td
)
const
{
return
s
_
;
return
valid
_
;
}
inline
const
Foam
::
vector
&
Foam
::
pointData
::
v
()
const
template
<
class
DataType
>
template
<
class
TrackingData
>
inline
bool
Foam
::
PointIntegrateData
<
DataType
>::
sameGeometry
(
const
PointIntegrateData
<
DataType
>&
,
const
scalar
tol
,
TrackingData
&
td
)
const
{
return
v_
;
return
true
;
}
template
<
class
DataType
>
template
<
class
TrackingData
>
inline
void
Foam
::
PointIntegrateData
<
DataType
>::
leaveDomain
(
const
polyPatch
&
patch
,
const
label
patchPointi
,
const
point
&
pos
,
TrackingData
&
td
)
{}
template
<
class
DataType
>
template
<
class
TrackingData
>
inline
void
Foam
::
pointData
::
transform
inline
void
Foam
::
PointIntegrateData
<
DataType
>::
enterDomain
(
const
polyPatch
&
patch
,
const
label
patchPointi
,
const
point
&
pos
,
TrackingData
&
td
)
{}
template
<
class
DataType
>
template
<
class
TrackingData
>
inline
void
Foam
::
PointIntegrateData
<
DataType
>::
transform
(
const
tensor
&
rotTensor
,
TrackingData
&
td
)
{
pointEdgePoint
::
transform
(
rotTensor
,
td
);
v_
=
Foam
::
transform
(
rotTensor
,
v_
);
this
->
data_
=
Foam
::
transform
(
rotTensor
,
this
->
data_
);
}
// Update this with information from connected edge
template
<
class
DataType
>
template
<
class
TrackingData
>
inline
bool
Foam
::
p
oint
Data
::
updatePoint
inline
bool
Foam
::
P
oint
IntegrateData
<
DataType
>
::
updatePoint
(
const
polyMesh
&
mesh
,
const
label
point
i
,
const
label
point
I
,
const
label
edgeI
,
const
p
oint
Data
&
edgeInfo
,
const
P
oint
IntegrateData
<
DataType
>
&
edgeInfo
,
const
scalar
tol
,
TrackingData
&
td
)
{
if
(
pointEdgePoint
::
updatePoint
(
mesh
,
pointi
,
edgeI
,
edgeInfo
,
tol
,
td
)
)
// Update point from an edge
if
(
!
valid_
)
{
s_
=
edgeInfo
.
s_
;
v_
=
edgeInfo
.
v_
;
if
(
!
edgeInfo
.
valid_
)
{
FatalErrorInFunction
<<
"edgeInfo:"
<<
edgeInfo
<<
exit
(
FatalError
);
}
this
->
operator
=
(
edgeInfo
);
return
true
;
}
else
...
...
@@ -122,31 +133,27 @@ inline bool Foam::pointData::updatePoint
}