36 #include "mapMeshes.H" 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;
A class for handling file names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
wordList addProcessorPatches(const fvMesh &meshTarget, const wordList &cuttingPatches)
const fileName & globalCaseName() const
Return case name.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void mapSubMesh(const fvMesh &meshSource, const fvMesh &meshTarget, const HashTable< word > &patchMap, const wordList &cuttingPatches, const meshToMesh0::order &mapOrder)
const fileName & rootPath() const
Return root path.
static word defaultRegion
Return the default region name.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool optionFound(const word &opt) const
Return true if the named option is found.
order
Enumeration specifying required accuracy.
static void noParallel()
Remove the parallel options.
static SLList< string > validArgs
A list of valid (mandatory) arguments.
A bounding box defined in terms of the points at its extremities.
Time runTimeTarget(Time::controlDictName, args)
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
void exit(const int errNo=1)
Exit : can be called for any error to exit program.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Time runTimeSource(Time::controlDictName, argsSrc)
static word timeName(const scalar, const int precision=curPrecision_)
Return time name of given scalar time.
A class for handling words, derived from string.
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.
word name() const
Return file name (part beyond last /)
An STL-conforming hash table.
static word controlDictName
The default control dictionary name (normally "controlDict")
static dictionary decomposeParDict(const Time &time)
Read and return the decomposeParDict.
const word & system() const
Return system name.
fileName & toAbsolute()
Convert from relative to absolute.
word name(const complex &)
Return a string representation of a complex.
void mapConsistentMesh(const fvMesh &meshSource, const fvMesh &meshTarget, const meshToMesh0::order &mapOrder)
Mesh data needed to do the Finite Volume discretisation.
bool check(bool checkArgs=true, bool checkOpts=true) const
Check argument list.
fileName path() const
Return directory path name (part before last /)
void mapConsistentSubMesh(const fvMesh &meshSource, const fvMesh &meshTarget, const meshToMesh0::order &mapOrder)
static void addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
static void addNote(const string &)
Add extra notes for the usage information.
Foam::argList args(argc, argv)
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...