43 int main(
int argc,
char *argv[])
47 "map volume fields from one mesh to another"
55 "scalar|'latestTime'",
56 "specify the source time"
62 "specify the source region"
68 "specify the target region"
73 "the source is decomposed"
78 "the target is decomposed"
83 "source and target geometry and boundary conditions identical"
89 "specify the mapping method"
106 Info<<
"Source: " << rootDirSource <<
" " << caseDirSource <<
endl;
110 sourceRegion =
args[
"sourceRegion"];
111 Info<<
"Source region: " << sourceRegion <<
endl;
114 Info<<
"Target: " << rootDirTarget <<
" " << caseDirTarget <<
endl;
118 targetRegion =
args[
"targetRegion"];
119 Info<<
"Target region: " << targetRegion <<
endl;
129 const word mapMethod(
args[
"mapMethod"]);
130 if (mapMethod ==
"mapNearest")
134 else if (mapMethod ==
"interpolate")
138 else if (mapMethod ==
"cellPointInterpolate")
145 <<
"Unknown mapMethod " << mapMethod <<
". Valid options are: "
146 <<
"mapNearest, interpolate and cellPointInterpolate"
150 Info<<
"Mapping method: " << mapMethod <<
endl;
154 #include "createTimes.H"
174 mapFieldsDict.lookup(
"patchMap") >> patchMap;
175 mapFieldsDict.lookup(
"cuttingPatches") >> cuttingPatches;
178 if (parallelSource && !parallelTarget)
188 Info<<
"Create target mesh\n" <<
endl;
201 Info<<
"Target mesh size: " << meshTarget.nCells() <<
endl;
203 for (
int proci=0; proci<nProcs; proci++)
205 Info<<
nl <<
"Source processor " << proci <<
endl;
214 #include "setTimeIndex.H"
227 Info<<
"mesh size: " << meshSource.nCells() <<
endl;
251 else if (!parallelSource && parallelTarget)
261 Info<<
"Create source mesh\n" <<
endl;
263 #include "setTimeIndex.H"
276 Info<<
"Source mesh size: " << meshSource.nCells() <<
endl;
278 for (
int proci=0; proci<nProcs; proci++)
280 Info<<
nl <<
"Target processor " << proci <<
endl;
300 Info<<
"mesh size: " << meshTarget.nCells() <<
endl;
324 else if (parallelSource && parallelTarget)
326 const int nProcsSource
334 const int nProcsTarget
345 for (
int procISource=0; procISource<nProcsSource; procISource++)
347 Info<<
nl <<
"Source processor " << procISource <<
endl;
356 #include "setTimeIndex.H"
369 Info<<
"mesh size: " << meshSource.nCells() <<
endl;
371 boundBox bbSource(meshSource.bounds());
373 for (
int procITarget=0; procITarget<nProcsTarget; procITarget++)
377 !bbsTargetSet[procITarget]
379 bbsTargetSet[procITarget]
380 && bbsTarget[procITarget].overlaps(bbSource)
384 Info<<
nl <<
"Target processor " << procITarget <<
endl;
405 Info<<
"mesh size: " << meshTarget.nCells() <<
endl;
407 bbsTarget[procITarget] = meshTarget.bounds();
408 bbsTargetSet[procITarget] =
true;
410 if (bbsTarget[procITarget].overlaps(bbSource))
439 #include "setTimeIndex.H"
465 Info<<
"Source mesh size: " << meshSource.nCells() <<
tab
466 <<
"Target mesh size: " << meshTarget.nCells() <<
nl <<
endl;
An STL-conforming hash table.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
static const word & system()
Return system name.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static word controlDictName
The default control dictionary name (normally "controlDict")
Extract command arguments and options from the supplied argc and argv parameters.
static void addOption(const word &opt, const string ¶m="", const string &usage="")
Add to an option to validOptions with usage information.
static void addNote(const string &)
Add extra notes for the usage information.
const fileName & globalCaseName() const
Return case name.
static void addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
bool optionFound(const word &opt) const
Return true if the named option is found.
static void noParallel()
Remove the parallel options.
static SLList< string > validArgs
A list of valid (mandatory) arguments.
const fileName & rootPath() const
Return root path.
bool check(bool checkArgs=true, bool checkOpts=true) const
Check argument list.
A bounding box defined in terms of the points at its extremities.
static IOdictionary decomposeParDict(const Time &time)
Read and return the decomposeParDict.
const word & name() const
Return const reference to name.
void exit(const int errNo=1)
Exit : can be called for any error to exit program.
A class for handling file names.
word name() const
Return file name (part beyond last /)
fileName & toAbsolute()
Convert from relative to absolute.
fileName path() const
Return directory path name (part before last /)
Mesh data needed to do the Finite Volume discretisation.
order
Enumeration specifying required accuracy.
static word defaultRegion
Return the default region name.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
int main(int argc, char *argv[])
Time runTimeSource(Time::controlDictName, argsSrc)
Time runTimeTarget(Time::controlDictName, args)
errorManipArg< error, int > exit(error &err, const int errNo=1)
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const bool)
Return a word representation of a bool.
void mapSubMesh(const fvMesh &meshSource, const fvMesh &meshTarget, const HashTable< word > &patchMap, const wordList &cuttingPatches, const meshToMesh0::order &mapOrder)
void mapConsistentMesh(const fvMesh &meshSource, const fvMesh &meshTarget, const meshToMesh0::order &mapOrder)
wordList addProcessorPatches(const fvMesh &meshTarget, const wordList &cuttingPatches)
void mapConsistentSubMesh(const fvMesh &meshSource, const fvMesh &meshTarget, const meshToMesh0::order &mapOrder)
Foam::argList args(argc, argv)