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
6c0ea9d1
Commit
6c0ea9d1
authored
Oct 20, 2011
by
andy
Browse files
Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
parents
fdcfe3bd
f1c79673
Changes
110
Expand all
Hide whitespace changes
Inline
Side-by-side
applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C
View file @
6c0ea9d1
...
...
@@ -66,6 +66,7 @@ Description
#include
"Switch.H"
#include
"bound.H"
#include
"dynamicRefineFvMesh.H"
#include
"pimpleControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -83,6 +84,8 @@ int main(int argc, char *argv[])
#include
"compressibleCourantNo.H"
#include
"setInitialDeltaT.H"
pimpleControl
pimple
(
mesh
);
scalar
StCoNum
=
0
.
0
;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -94,7 +97,6 @@ int main(int argc, char *argv[])
while
(
runTime
.
run
())
{
#include
"readTimeControls.H"
#include
"readPISOControls.H"
#include
"compressibleCourantNo.H"
#include
"setDeltaT.H"
...
...
@@ -163,26 +165,35 @@ int main(int argc, char *argv[])
#include
"rhoEqn.H"
#include
"UEqn.H"
// --- P
ISO
loop
for
(
int
corr
=
1
;
corr
<=
nCorr
;
corr
++
)
// --- P
ressure-velocity PIMPLE corrector
loop
for
(
pimple
.
start
();
pimple
.
loop
();
pimple
++
)
{
#include
"bEqn.H"
#include
"ftEqn.H"
#include
"huEqn.H"
#include
"hEqn.H"
#include
"UEqn.H"
if
(
!
ign
.
ignited
())
// --- PISO loop
for
(
int
corr
=
1
;
corr
<=
pimple
.
nCorr
();
corr
++
)
{
hu
==
h
;
#include
"bEqn.H"
#include
"ftEqn.H"
#include
"huEqn.H"
#include
"hEqn.H"
if
(
!
ign
.
ignited
())
{
hu
==
h
;
}
#include
"pEqn.H"
}
#include
"pEqn.H"
if
(
pimple
.
turbCorr
())
{
turbulence
->
correct
();
}
}
turbulence
->
correct
();
runTime
.
write
();
Info
<<
"
\n
ExecutionTime = "
...
...
applications/test/PatchEdgeFaceWave/Make/files
0 → 100644
View file @
6c0ea9d1
Test-PatchEdgeFaceWave.C
EXE = $(FOAM_USER_APPBIN)/Test-PatchEdgeFaceWave
applications/test/PatchEdgeFaceWave/Make/options
0 → 100644
View file @
6c0ea9d1
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools
applications/test/PatchEdgeFaceWave/Test-PatchEdgeFaceWave.C
0 → 100644
View file @
6c0ea9d1
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Test PatchEdgeFaceWave.
\*---------------------------------------------------------------------------*/
#include
"argList.H"
#include
"Time.H"
#include
"fvMesh.H"
#include
"volFields.H"
#include
"PatchEdgeFaceWave.H"
#include
"patchEdgeFaceInfo.H"
using
namespace
Foam
;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
validArgs
.
append
(
"patch"
);
# include "setRootCase.H"
# include "createTime.H"
# include "createMesh.H"
const
polyBoundaryMesh
&
patches
=
mesh
.
boundaryMesh
();
// Get name of patch
const
word
patchName
=
args
[
1
];
const
polyPatch
&
patch
=
patches
[
patchName
];
// Data on all edges and faces
List
<
patchEdgeFaceInfo
>
allEdgeInfo
(
patch
.
nEdges
());
List
<
patchEdgeFaceInfo
>
allFaceInfo
(
patch
.
size
());
// Initial seed
DynamicList
<
label
>
initialEdges
;
DynamicList
<
patchEdgeFaceInfo
>
initialEdgesInfo
;
// Just set an edge on the master
if
(
Pstream
::
master
())
{
label
edgeI
=
0
;
Info
<<
"Starting walk on edge "
<<
edgeI
<<
endl
;
initialEdges
.
append
(
edgeI
);
const
edge
&
e
=
patch
.
edges
()[
edgeI
];
initialEdgesInfo
.
append
(
patchEdgeFaceInfo
(
e
.
centre
(
patch
.
localPoints
()),
0
.
0
)
);
}
// Walk
PatchEdgeFaceWave
<
primitivePatch
,
patchEdgeFaceInfo
>
calc
(
mesh
,
patch
,
initialEdges
,
initialEdgesInfo
,
allEdgeInfo
,
allFaceInfo
,
returnReduce
(
patch
.
nEdges
(),
sumOp
<
label
>
())
);
// Extract as patchField
volScalarField
vsf
(
IOobject
(
"patchDist"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
mesh
,
dimensionedScalar
(
"patchDist"
,
dimLength
,
0
.
0
)
);
scalarField
pf
(
vsf
.
boundaryField
()[
patch
.
index
()].
size
());
forAll
(
pf
,
faceI
)
{
pf
[
faceI
]
=
Foam
::
sqrt
(
allFaceInfo
[
faceI
].
distSqr
());
}
vsf
.
boundaryField
()[
patch
.
index
()]
=
pf
;
Info
<<
"Writing patchDist volScalarField to "
<<
runTime
.
value
()
<<
endl
;
vsf
.
write
();
Info
<<
"
\n
End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/Make/files
View file @
6c0ea9d1
patchPointEdgeCirculator.C
createShellMesh.C
extrudeToRegionMesh.C
...
...
applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/createShellMesh.C
View file @
6c0ea9d1
...
...
@@ -31,130 +31,381 @@ License
#include
"polyAddFace.H"
#include
"polyModifyFace.H"
#include
"polyAddCell.H"
#include
"patchPointEdgeCirculator.H"
#include
"labelPair.H"
#include
"indirectPrimitivePatch.H"
#include
"mapDistribute.H"
#include
"globalMeshData.H"
#include
"PatchTools.H"
#include
"globalIndex.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug
(
Foam
::
createShellMesh
,
0
);
namespace
Foam
{
template
<>
class
minEqOp
<
labelPair
>
{
public:
void
operator
()(
labelPair
&
x
,
const
labelPair
&
y
)
const
{
x
[
0
]
=
min
(
x
[
0
],
y
[
0
]);
x
[
1
]
=
min
(
x
[
1
],
y
[
1
]);
}
};
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Synchronise edges
void
Foam
::
createShellMesh
::
syncEdges
(
const
globalMeshData
&
globalData
,
const
labelList
&
patchEdges
,
const
labelList
&
coupledEdges
,
const
PackedBoolList
&
sameEdgeOrientation
,
PackedBoolList
&
isChangedEdge
,
DynamicList
<
label
>&
changedEdges
,
labelPairList
&
allEdgeData
)
{
const
mapDistribute
&
map
=
globalData
.
globalEdgeSlavesMap
();
const
PackedBoolList
&
cppOrientation
=
globalData
.
globalEdgeOrientation
();
// Convert patch-edge data into cpp-edge data
labelPairList
cppEdgeData
(
map
.
constructSize
(),
labelPair
(
labelMax
,
labelMax
)
);
forAll
(
patchEdges
,
i
)
{
label
patchEdgeI
=
patchEdges
[
i
];
label
coupledEdgeI
=
coupledEdges
[
i
];
if
(
isChangedEdge
[
patchEdgeI
])
{
const
labelPair
&
data
=
allEdgeData
[
patchEdgeI
];
// Patch-edge data needs to be converted into coupled-edge data
// (optionally flipped) and consistent in orientation with
// other coupled edge (optionally flipped)
if
(
sameEdgeOrientation
[
i
]
==
cppOrientation
[
coupledEdgeI
])
{
cppEdgeData
[
coupledEdgeI
]
=
data
;
}
else
{
cppEdgeData
[
coupledEdgeI
]
=
labelPair
(
data
[
1
],
data
[
0
]);
}
}
}
// Synchronise
globalData
.
syncData
(
cppEdgeData
,
globalData
.
globalEdgeSlaves
(),
globalData
.
globalEdgeTransformedSlaves
(),
map
,
minEqOp
<
labelPair
>
()
);
// Back from cpp-edge to patch-edge data
forAll
(
patchEdges
,
i
)
{
label
patchEdgeI
=
patchEdges
[
i
];
label
coupledEdgeI
=
coupledEdges
[
i
];
if
(
cppEdgeData
[
coupledEdgeI
]
!=
labelPair
(
labelMax
,
labelMax
))
{
const
labelPair
&
data
=
cppEdgeData
[
coupledEdgeI
];
if
(
sameEdgeOrientation
[
i
]
==
cppOrientation
[
coupledEdgeI
])
{
allEdgeData
[
patchEdgeI
]
=
data
;
}
else
{
allEdgeData
[
patchEdgeI
]
=
labelPair
(
data
[
1
],
data
[
0
]);
}
if
(
!
isChangedEdge
[
patchEdgeI
])
{
changedEdges
.
append
(
patchEdgeI
);
isChangedEdge
[
patchEdgeI
]
=
true
;
}
}
}
}
void
Foam
::
createShellMesh
::
calcPointRegions
(
const
globalMeshData
&
globalData
,
const
primitiveFacePatch
&
patch
,
const
PackedBoolList
&
nonManifoldEdge
,
faceList
&
pointRegions
,
labelList
&
regionPoints
faceList
&
pointGlobalRegions
,
faceList
&
pointLocalRegions
,
labelList
&
localToGlobalRegion
)
{
pointRegions
.
setSize
(
patch
.
size
());
forAll
(
pointRegions
,
faceI
)
const
indirectPrimitivePatch
&
cpp
=
globalData
.
coupledPatch
();
// Calculate correspondence between patch and globalData.coupledPatch.
labelList
patchEdges
;
labelList
coupledEdges
;
PackedBoolList
sameEdgeOrientation
;
PatchTools
::
matchEdges
(
cpp
,
patch
,
coupledEdges
,
patchEdges
,
sameEdgeOrientation
);
// Initial unique regions
// ~~~~~~~~~~~~~~~~~~~~~~
// These get merged later on across connected edges.
// 1. Count
label
nMaxRegions
=
0
;
forAll
(
patch
.
localFaces
(),
faceI
)
{
const
face
&
f
=
patch
.
localFaces
()[
faceI
];
point
Regions
[
faceI
].
setSize
(
f
.
size
()
,
-
1
)
;
nMax
Regions
+=
f
.
size
();
}
const
globalIndex
globalRegions
(
nMaxRegions
);
// 2. Assign unique regions
label
nRegions
=
0
;
forAll
(
pointRegions
,
faceI
)
pointGlobalRegions
.
setSize
(
patch
.
size
());
forAll
(
pointGlobalRegions
,
faceI
)
{
const
face
&
f
=
patch
.
localFaces
()[
faceI
];
labelList
&
pRegions
=
pointGlobalRegions
[
faceI
];
pRegions
.
setSize
(
f
.
size
());
forAll
(
pRegions
,
fp
)
{
pRegions
[
fp
]
=
globalRegions
.
toGlobal
(
nRegions
++
);
}
}
forAll
(
f
,
fp
)
DynamicList
<
label
>
changedEdges
(
patch
.
nEdges
());
labelPairList
allEdgeData
(
patch
.
nEdges
(),
labelPair
(
labelMax
,
labelMax
));
PackedBoolList
isChangedEdge
(
patch
.
nEdges
());
// Fill initial seed
// ~~~~~~~~~~~~~~~~~
forAll
(
patch
.
edgeFaces
(),
edgeI
)
{
if
(
!
nonManifoldEdge
[
edgeI
])
{
// Take over value from one face only.
const
edge
&
e
=
patch
.
edges
()[
edgeI
];
label
faceI
=
patch
.
edgeFaces
()[
edgeI
][
0
];
const
face
&
f
=
patch
.
localFaces
()[
faceI
];
label
fp0
=
findIndex
(
f
,
e
[
0
]);
label
fp1
=
findIndex
(
f
,
e
[
1
]);
allEdgeData
[
edgeI
]
=
labelPair
(
pointGlobalRegions
[
faceI
][
fp0
],
pointGlobalRegions
[
faceI
][
fp1
]
);
if
(
!
isChangedEdge
[
edgeI
])
{
changedEdges
.
append
(
edgeI
);
isChangedEdge
[
edgeI
]
=
true
;
}
}
}
syncEdges
(
globalData
,
patchEdges
,
coupledEdges
,
sameEdgeOrientation
,
isChangedEdge
,
changedEdges
,
allEdgeData
);
// Edge-Face-Edge walk across patch
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Across edge minimum regions win
while
(
true
)
{
// From edge to face
// ~~~~~~~~~~~~~~~~~
DynamicList
<
label
>
changedFaces
(
patch
.
size
());
PackedBoolList
isChangedFace
(
patch
.
size
());
forAll
(
changedEdges
,
changedI
)
{
label
edgeI
=
changedEdges
[
changedI
];
const
labelPair
&
edgeData
=
allEdgeData
[
edgeI
];
const
edge
&
e
=
patch
.
edges
()[
edgeI
];
const
labelList
&
eFaces
=
patch
.
edgeFaces
()[
edgeI
];
forAll
(
eFaces
,
i
)
{
label
faceI
=
eFaces
[
i
];
const
face
&
f
=
patch
.
localFaces
()[
faceI
];
// Combine edgeData with face data
label
fp0
=
findIndex
(
f
,
e
[
0
]);
if
(
pointGlobalRegions
[
faceI
][
fp0
]
>
edgeData
[
0
])
{
pointGlobalRegions
[
faceI
][
fp0
]
=
edgeData
[
0
];
if
(
!
isChangedFace
[
faceI
])
{
isChangedFace
[
faceI
]
=
true
;
changedFaces
.
append
(
faceI
);
}
}
label
fp1
=
findIndex
(
f
,
e
[
1
]);
if
(
pointGlobalRegions
[
faceI
][
fp1
]
>
edgeData
[
1
])
{
pointGlobalRegions
[
faceI
][
fp1
]
=
edgeData
[
1
];
if
(
!
isChangedFace
[
faceI
])
{
isChangedFace
[
faceI
]
=
true
;
changedFaces
.
append
(
faceI
);
}
}
}
}
label
nChangedFaces
=
returnReduce
(
changedFaces
.
size
(),
sumOp
<
label
>
());
if
(
nChangedFaces
==
0
)
{
if
(
pointRegions
[
faceI
][
fp
]
==
-
1
)
break
;
}
// From face to edge
// ~~~~~~~~~~~~~~~~~
isChangedEdge
=
false
;
changedEdges
.
clear
();
forAll
(
changedFaces
,
i
)
{
label
faceI
=
changedFaces
[
i
];
const
face
&
f
=
patch
.
localFaces
()[
faceI
];
const
labelList
&
fEdges
=
patch
.
faceEdges
()[
faceI
];
forAll
(
fEdges
,
fp
)
{
// Found unassigned point. Distribute current region.
label
pointI
=
f
[
fp
];
label
edgeI
=
patch
.
faceEdges
()[
faceI
][
fp
];
patchPointEdgeCirculator
circ
(
patch
,
nonManifoldEdge
,
edgeI
,
findIndex
(
patch
.
edgeFaces
()[
edgeI
],
faceI
),
pointI
);
for
(
patchPointEdgeCirculator
iter
=
circ
.
begin
();
iter
!=
circ
.
end
();
++
iter
)
label
edgeI
=
fEdges
[
fp
];
if
(
!
nonManifoldEdge
[
edgeI
])
{
label
face2
=
iter
.
faceID
();
const
edge
&
e
=
patch
.
edges
()[
edgeI
];
label
fp0
=
findIndex
(
f
,
e
[
0
]);
label
region0
=
pointGlobalRegions
[
faceI
][
fp0
];
label
fp1
=
findIndex
(
f
,
e
[
1
]);
label
region1
=
pointGlobalRegions
[
faceI
][
fp1
];
if
(
face2
!=
-
1
)
if
(
(
allEdgeData
[
edgeI
][
0
]
>
region0
)
||
(
allEdgeData
[
edgeI
][
1
]
>
region1
)
)
{
const
face
&
f2
=
patch
.
localFaces
()[
face2
];
label
fp2
=
findIndex
(
f2
,
pointI
);
label
&
region
=
pointRegions
[
face2
][
fp2
];
if
(
region
!=
-
1
)
allEdgeData
[
edgeI
]
=
labelPair
(
region0
,
region1
);
if
(
!
isChangedEdge
[
edgeI
])
{
FatalErrorIn
(
"createShellMesh::calcPointRegions(..)"
)
<<
"On point "
<<
pointI
<<
" at:"
<<
patch
.
localPoints
()[
pointI
]
<<
" found region:"
<<
region
<<
abort
(
FatalError
);
changedEdges
.
append
(
edgeI
);
isChangedEdge
[
edgeI
]
=
true
;
}
region
=
nRegions
;
}
}
nRegions
++
;
}
}