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 meshTarget.postConstruct
208 Info<<
"Target mesh size: " << meshTarget.nCells() <<
endl;
210 for (
int proci=0; proci<nProcs; proci++)
212 Info<<
nl <<
"Source processor " << proci <<
endl;
221 #include "setTimeIndex.H"
234 meshSource.postConstruct
241 Info<<
"mesh size: " << meshSource.nCells() <<
endl;
265 else if (!parallelSource && parallelTarget)
275 Info<<
"Create source mesh\n" <<
endl;
277 #include "setTimeIndex.H"
290 meshSource.postConstruct
297 Info<<
"Source mesh size: " << meshSource.nCells() <<
endl;
299 for (
int proci=0; proci<nProcs; proci++)
301 Info<<
nl <<
"Target processor " << proci <<
endl;
321 meshTarget.postConstruct
328 Info<<
"mesh size: " << meshTarget.nCells() <<
endl;
352 else if (parallelSource && parallelTarget)
354 const int nProcsSource
362 const int nProcsTarget
373 for (
int procISource=0; procISource<nProcsSource; procISource++)
375 Info<<
nl <<
"Source processor " << procISource <<
endl;
384 #include "setTimeIndex.H"
397 meshSource.postConstruct
404 Info<<
"mesh size: " << meshSource.nCells() <<
endl;
406 boundBox bbSource(meshSource.bounds());
408 for (
int procITarget=0; procITarget<nProcsTarget; procITarget++)
412 !bbsTargetSet[procITarget]
414 bbsTargetSet[procITarget]
415 && bbsTarget[procITarget].overlaps(bbSource)
419 Info<<
nl <<
"Target processor " << procITarget <<
endl;
440 meshTarget.postConstruct
447 Info<<
"mesh size: " << meshTarget.nCells() <<
endl;
449 bbsTarget[procITarget] = meshTarget.bounds();
450 bbsTargetSet[procITarget] =
true;
452 if (bbsTarget[procITarget].overlaps(bbSource))
481 #include "setTimeIndex.H"
496 meshSource.postConstruct
514 meshTarget.postConstruct
521 Info<<
"Source mesh size: " << meshSource.nCells() <<
tab
522 <<
"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.
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)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
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)