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
8222120f
Commit
8222120f
authored
Nov 12, 2013
by
mattijs
Browse files
ENH: mapped: allow coupling specification through coupleGroup
parent
1aeb9f4d
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
applications/utilities/mesh/manipulation/createBaffles/createBaffles.C
View file @
8222120f
This diff is collapsed.
Click to expand it.
applications/utilities/mesh/manipulation/createBaffles/createBafflesDict
View file @
8222120f
...
...
@@ -40,123 +40,47 @@ internalFacesOnly true;
// Baffles to create.
baffles
{
baffle
Faces
baffle
1
{
//- Use predefined faceZone to select faces and orientation.
type faceZone;
zoneName baffleFaces;
//- Use surface to select faces and orientation.
type searchableSurface;
surface triSurfaceMesh;
name baffle1D.stl;
//- Optional flip
//flip false;
patches
{
master
{
//- Master side patch
name baffles;
type wall;
//- Optional override of added patchfields. If not specified
// any added patchfields are of type calculated.
patchFields
{
epsilon
{
type epsilonWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value uniform 0;
}
k
{
type kqRWallFunction;
value uniform 0;
}
nut
{
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value uniform 0;
}
nuTilda
{
type zeroGradient;
}
p
{
type zeroGradient;
}
U
{
type fixedValue;
value uniform (0 0 0);
}
}
}
slave
// Generate patchGroup baffle1 with two patches:
// - baffle1_master
// - baffle1_slave
patchPairs
{
type wall;
//- Optional override of added patchfields. If not specified
// any added patchfields are of type calculated.
patchFields
{
//- Slave side patch
name baffles;
type wall;
patchFields
U
{
epsilon
{
type epsilonWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value uniform 0;
}
k
{
type kqRWallFunction;
value uniform 0;
}
nut
{
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value uniform 0;
}
nuTilda
{
type zeroGradient;
}
p
{
type zeroGradient;
}
U
{
type fixedValue;
value uniform (0 0 0);
}
type fixedValue;
value uniform (0 0 0);
}
}
}
}
cyclicFaces
{
//- Select faces and orientation through a searchableSurface
type searchableSurface;
surface searchablePlate;
//name sphere.stl; // name if surface=triSurfaceMesh
origin (0.099 -0.006 0.004);
span (0 0.012 0.012);
// Generate patches explicitly
patches
{
master
...
...
src/meshTools/Make/files
View file @
8222120f
...
...
@@ -199,6 +199,7 @@ mappedPatches/mappedPolyPatch/mappedPatchBase.C
mappedPatches/mappedPolyPatch/mappedPolyPatch.C
mappedPatches/mappedPolyPatch/mappedWallPolyPatch.C
mappedPatches/mappedPolyPatch/mappedVariableThicknessWallPolyPatch.C
mappedPatches/mappedPolyPatch/coupleGroupIdentifier.C
mappedPatches/mappedPointPatch/mappedPointPatch.C
mappedPatches/mappedPointPatch/mappedWallPointPatch.C
...
...
src/meshTools/mappedPatches/mappedPolyPatch/coupleGroupIdentifier.C
0 → 100644
View file @
8222120f
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 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/>.
\*---------------------------------------------------------------------------*/
#include
"coupleGroupIdentifier.H"
#include
"polyMesh.H"
#include
"Time.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam
::
label
Foam
::
coupleGroupIdentifier
::
findOtherPatchID
(
const
polyMesh
&
mesh
,
const
polyPatch
&
thisPatch
)
const
{
const
polyBoundaryMesh
&
pbm
=
mesh
.
boundaryMesh
();
if
(
!
valid
())
{
FatalErrorIn
(
"coupleGroupIdentifier::findOtherPatchID(const polyPatch&) const"
)
<<
"Invalid coupleGroup patch group"
<<
" on patch "
<<
thisPatch
.
name
()
<<
" in region "
<<
pbm
.
mesh
().
name
()
<<
exit
(
FatalError
);
}
HashTable
<
labelList
,
word
>::
const_iterator
fnd
=
pbm
.
groupPatchIDs
().
find
(
name
());
if
(
fnd
==
pbm
.
groupPatchIDs
().
end
())
{
if
(
&
mesh
==
&
thisPatch
.
boundaryMesh
().
mesh
())
{
// thisPatch should be in patchGroup
FatalErrorIn
(
"coupleGroupIdentifier::findOtherPatchID"
"(const polyMesh&, const polyPatch&) const"
)
<<
"Patch "
<<
thisPatch
.
name
()
<<
" should be in patchGroup "
<<
name
()
<<
" in region "
<<
pbm
.
mesh
().
name
()
<<
exit
(
FatalError
);
}
return
-
1
;
}
// Mesh has patch group
const
labelList
&
patchIDs
=
fnd
();
if
(
&
mesh
==
&
thisPatch
.
boundaryMesh
().
mesh
())
{
if
(
patchIDs
.
size
()
>
2
||
patchIDs
.
size
()
==
0
)
{
FatalErrorIn
(
"coupleGroupIdentifier::findOtherPatchID"
"(const polyMesh&, const polyPatch&) const"
)
<<
"Couple patchGroup "
<<
name
()
<<
" with contents "
<<
patchIDs
<<
" not of size < 2"
<<
" on patch "
<<
thisPatch
.
name
()
<<
" region "
<<
thisPatch
.
boundaryMesh
().
mesh
().
name
()
<<
exit
(
FatalError
);
return
-
1
;
}
label
index
=
findIndex
(
patchIDs
,
thisPatch
.
index
());
if
(
index
==
-
1
)
{
FatalErrorIn
(
"coupleGroupIdentifier::findOtherPatchID"
"(const polyMesh&, const polyPatch&) const"
)
<<
"Couple patchGroup "
<<
name
()
<<
" with contents "
<<
patchIDs
<<
" does not contain patch "
<<
thisPatch
.
name
()
<<
" in region "
<<
pbm
.
mesh
().
name
()
<<
exit
(
FatalError
);
return
-
1
;
}
if
(
patchIDs
.
size
()
==
2
)
{
// Return the other patch
return
patchIDs
[
1
-
index
];
}
else
// size == 1
{
return
-
1
;
}
}
else
{
if
(
patchIDs
.
size
()
!=
1
)
{
FatalErrorIn
(
"coupleGroupIdentifier::findOtherPatchID"
"(const polyMesh&, const polyPatch&) const"
)
<<
"Couple patchGroup "
<<
name
()
<<
" with contents "
<<
patchIDs
<<
" in region "
<<
mesh
.
name
()
<<
" should only contain a single patch"
<<
" when matching patch "
<<
thisPatch
.
name
()
<<
" in region "
<<
pbm
.
mesh
().
name
()
<<
exit
(
FatalError
);
}
return
patchIDs
[
0
];
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam
::
coupleGroupIdentifier
::
coupleGroupIdentifier
()
:
name_
()
{}
Foam
::
coupleGroupIdentifier
::
coupleGroupIdentifier
(
const
word
&
name
)
:
name_
(
name
)
{}
Foam
::
coupleGroupIdentifier
::
coupleGroupIdentifier
(
const
dictionary
&
dict
)
:
name_
(
dict
.
lookupOrDefault
<
word
>
(
"coupleGroup"
,
""
))
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam
::
label
Foam
::
coupleGroupIdentifier
::
findOtherPatchID
(
const
polyPatch
&
thisPatch
)
const
{
const
polyBoundaryMesh
&
pbm
=
thisPatch
.
boundaryMesh
();
return
findOtherPatchID
(
pbm
.
mesh
(),
thisPatch
);
}
Foam
::
label
Foam
::
coupleGroupIdentifier
::
findOtherPatchID
(
const
polyPatch
&
thisPatch
,
word
&
otherRegion
)
const
{
const
polyBoundaryMesh
&
pbm
=
thisPatch
.
boundaryMesh
();
const
polyMesh
&
thisMesh
=
pbm
.
mesh
();
const
Time
&
runTime
=
thisMesh
.
time
();
// Loop over all regions to find other patch in coupleGroup
HashTable
<
const
polyMesh
*>
meshSet
=
runTime
.
lookupClass
<
polyMesh
>
();
label
otherPatchID
=
-
1
;
forAllConstIter
(
HashTable
<
const
polyMesh
*>
,
meshSet
,
iter
)
{
const
polyMesh
&
mesh
=
*
iter
();
label
patchID
=
findOtherPatchID
(
mesh
,
thisPatch
);
if
(
patchID
!=
-
1
)
{
if
(
otherPatchID
!=
-
1
)
{
FatalErrorIn
(
"coupleGroupIdentifier::findOtherPatchID"
"(const polyPatch&, word&) const"
)
<<
"Couple patchGroup "
<<
name
()
<<
" should be present on only two patches"
<<
" in any of the meshes in "
<<
meshSet
.
sortedToc
()
<<
endl
<<
" It seems to be present on patch "
<<
thisPatch
.
name
()
<<
" in region "
<<
thisMesh
.
name
()
<<
", on patch "
<<
otherPatchID
<<
" in region "
<<
otherRegion
<<
" and on patch "
<<
patchID
<<
" in region "
<<
mesh
.
name
()
<<
exit
(
FatalError
);
}
otherPatchID
=
patchID
;
otherRegion
=
mesh
.
name
();
}
}
if
(
otherPatchID
==
-
1
)
{
FatalErrorIn
(
"coupleGroupIdentifier::findOtherPatchID"
"(const polyPatch&, word&) const"
)
<<
"Couple patchGroup "
<<
name
()
<<
" not found in any of the other meshes "
<<
meshSet
.
sortedToc
()
<<
" on patch "
<<
thisPatch
.
name
()
<<
" region "
<<
thisMesh
.
name
()
<<
exit
(
FatalError
);
}
return
otherPatchID
;
}
void
Foam
::
coupleGroupIdentifier
::
write
(
Ostream
&
os
)
const
{
if
(
valid
())
{
os
.
writeKeyword
(
"coupleGroup"
)
<<
name
()
<<
token
::
END_STATEMENT
<<
nl
;
}
}
// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
Foam
::
Ostream
&
Foam
::
operator
<<
(
Ostream
&
os
,
const
coupleGroupIdentifier
&
p
)
{
p
.
write
(
os
);
os
.
check
(
"Ostream& operator<<(Ostream& os, const coupleGroupIdentifier& p"
);
return
os
;
}
// ************************************************************************* //
src/meshTools/mappedPatches/mappedPolyPatch/coupleGroupIdentifier.H
0 → 100644
View file @
8222120f
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 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/>.
Class
Foam::coupleGroupIdentifier
Description
Encapsulates using patchGroups to specify coupled patch
SourceFiles
coupleGroupIdentifierI.H
coupleGroupIdentifier.C
coupleGroupIdentifierIO.C
\*---------------------------------------------------------------------------*/
#ifndef coupleGroupIdentifier_H
#define coupleGroupIdentifier_H
#include
"word.H"
#include
"label.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace
Foam
{
// Forward declaration of classes
class
dictionary
;
class
polyMesh
;
class
polyPatch
;
class
Ostream
;
// Forward declaration of friend functions and operators
class
coupleGroupIdentifier
;
Ostream
&
operator
<<
(
Ostream
&
,
const
coupleGroupIdentifier
&
);
/*---------------------------------------------------------------------------*\
Class coupleGroupIdentifier Declaration
\*---------------------------------------------------------------------------*/
class
coupleGroupIdentifier
{
// Private data
//- Name of patchGroup
word
name_
;
// Private Member Functions
//- Find other patch in specified mesh. Returns index of patch or -1.
label
findOtherPatchID
(
const
polyMesh
&
,
const
polyPatch
&
)
const
;
public:
// Constructors
//- Construct null
coupleGroupIdentifier
();
//- Construct from components
coupleGroupIdentifier
(
const
word
&
patchGroupName
);
//- Construct from dictionary
coupleGroupIdentifier
(
const
dictionary
&
);
// Member Functions
//- Name of patchGroup
inline
const
word
&
name
()
const
;
//- Is a valid patchGroup
inline
bool
valid
()
const
;
//- Find other patch in same region. Returns index of patch or -1.
label
findOtherPatchID
(
const
polyPatch
&
)
const
;
//- Find other patch and region. Returns index of patch and sets
// otherRegion to name of region. Fatal error if patch not found
label
findOtherPatchID
(
const
polyPatch
&
,
word
&
)
const
;
//- Write the data as a dictionary
void
write
(
Ostream
&
)
const
;
// IOstream Operators
friend
Ostream
&
operator
<<
(
Ostream
&
,
const
coupleGroupIdentifier
&
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
}
// End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include
"coupleGroupIdentifierI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
src/meshTools/mappedPatches/mappedPolyPatch/coupleGroupIdentifierI.H
0 → 100644
View file @
8222120f
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 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/>.
\*---------------------------------------------------------------------------*/
#include
"coupleGroupIdentifier.H"
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
const
Foam
::
word
&
Foam
::
coupleGroupIdentifier
::
name
()
const
{
return
name_
;
}
bool
Foam
::
coupleGroupIdentifier
::
valid
()
const
{
return
!
name_
.
empty
();
}
// ************************************************************************* //
src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C
View file @
8222120f
...
...
@@ -40,6 +40,7 @@ License
#include
"SubField.H"
#include
"triPointRef.H"
#include
"syncTools.H"
#include
"treeDataCell.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -202,7 +203,7 @@ void Foam::mappedPatchBase::findSamples
{
case
NEARESTCELL
:
{
if
(
samplePatch
_
.
size
()
&&
samplePatch
_
!=
"none"
)
if
(
samplePatch
()
.
size
()
&&
samplePatch
()
!=
"none"
)
{
FatalErrorIn
(
...
...
@@ -213,14 +214,13 @@ void Foam::mappedPatchBase::findSamples
}