OpenFOAM: API Guide
v2006
The open source CFD toolbox
createExternalCoupledPatchGeometry.C
Go to the documentation of this file.
1
/*---------------------------------------------------------------------------*\
2
========= |
3
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4
\\ / O peration |
5
\\ / A nd | www.openfoam.com
6
\\/ M anipulation |
7
-------------------------------------------------------------------------------
8
Copyright (C) 2013-2015 OpenFOAM Foundation
9
Copyright (C) 2016 OpenCFD Ltd.
10
-------------------------------------------------------------------------------
11
License
12
This file is part of OpenFOAM.
13
14
OpenFOAM is free software: you can redistribute it and/or modify it
15
under the terms of the GNU General Public License as published by
16
the Free Software Foundation, either version 3 of the License, or
17
(at your option) any later version.
18
19
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22
for more details.
23
24
You should have received a copy of the GNU General Public License
25
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27
Application
28
createExternalCoupledPatchGeometry.
29
30
Group
31
grpPreProcessingUtilities
32
33
Description
34
Generate the patch geometry (points and faces) for use
35
with the externalCoupled functionObject.
36
37
Usage
38
\verbatim
39
createExternalCoupledPatchGeometry <patchGroup> [OPTION]
40
\endverbatim
41
42
\param -commsDir <commsDir> \n
43
Specify an alternative communications directory (default is comms
44
in the case directory)
45
46
\param -region <name> \n
47
Specify an alternative mesh region.
48
49
\param -regions (<name1> <name2> .. <namen>) \n
50
Specify alternative mesh regions. The region names will be sorted
51
alphabetically and a single composite name will be created
52
<nameX>_<nameY>.._<nameZ>
53
54
On execution, the combined patch geometry (points and faces) are output
55
to the communications directory.
56
57
Note:
58
The addressing is patch-local, i.e. point indices for each patch point
59
used for face addressing starts at index 0.
60
61
See also
62
functionObjects::externalCoupled
63
64
\*---------------------------------------------------------------------------*/
65
66
#include "
fvCFD.H
"
67
#include "
externalCoupled.H
"
68
#include "
IOobjectList.H
"
69
70
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
71
72
int
main(
int
argc,
char
*argv[])
73
{
74
argList::addNote
75
(
76
"Generate the patch geometry (points and faces) for use"
77
" with the externalCoupled functionObject."
78
);
79
80
#include "
addRegionOption.H
"
81
#include "
addRegionsOption.H
"
82
argList::addArgument(
"patchGroup"
);
83
argList::addOption
84
(
85
"commsDir"
,
86
"dir"
,
87
"Specify communications directory (default is 'comms')"
88
);
89
#include "
setRootCase.H
"
90
#include "
createTime.H
"
91
92
wordList
regionNames(1, fvMesh::defaultRegion);
93
if
(!
args
.
readIfPresent
(
"region"
, regionNames.first()))
94
{
95
args
.
readIfPresent
(
"regions"
, regionNames);
96
}
97
98
const
wordRe patchGroup(
args
.
get
<wordRe>(1));
99
100
fileName commsDir(
runTime
.path()/
"comms"
);
101
args
.
readIfPresent
(
"commsDir"
, commsDir);
102
103
104
// Make sure region names are in canonical order
105
stableSort
(regionNames);
106
107
108
PtrList<const fvMesh>
meshes
(regionNames.size());
109
forAll
(regionNames, i)
110
{
111
Info
<<
"Create mesh "
<< regionNames[i] <<
" for time = "
112
<<
runTime
.timeName() <<
nl
<<
endl
;
113
114
meshes
.set
115
(
116
i,
117
new
fvMesh
118
(
119
Foam::IOobject
120
(
121
regionNames[i],
122
runTime
.timeName(),
123
runTime
,
124
Foam::IOobject::MUST_READ
125
)
126
)
127
);
128
}
129
130
131
functionObjects::externalCoupled::writeGeometry
132
(
133
UPtrList<const fvMesh>(
meshes
),
134
commsDir,
135
patchGroup
136
);
137
138
Info
<<
"\nEnd\n"
<<
endl
;
139
140
return
0;
141
}
142
143
144
// ************************************************************************* //
runTime
engineTime & runTime
Definition:
createEngineTime.H:13
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition:
IOobject.H:104
IOobjectList.H
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition:
Ostream.H:350
Foam::argList::get
T get(const label index) const
Get a value from the argument at index.
Definition:
argListI.H:257
Foam::argList::readIfPresent
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
Definition:
argListI.H:302
externalCoupled.H
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition:
stdFoam.H:296
Foam::stableSort
void stableSort(UList< T > &a)
Definition:
UList.C:268
addRegionsOption.H
Foam::wordList
List< word > wordList
A List of words.
Definition:
fileName.H:59
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
addRegionOption.H
meshes
PtrList< fvMesh > meshes(regionNames.size())
setRootCase.H
Foam::nl
constexpr char nl
Definition:
Ostream.H:385
createTime.H
fvCFD.H
args
Foam::argList args(argc, argv)
Foam::IOobject::MUST_READ
Definition:
IOobject.H:120
applications
utilities
preProcessing
createExternalCoupledPatchGeometry
createExternalCoupledPatchGeometry.C
Generated by
1.8.17
OPENFOAM® is a registered
trademark
of OpenCFD Ltd.