36 #include "MapMeshes.H" 40 void mapConsistentMesh
42 const fvMesh& meshSource,
43 const fvMesh& meshTarget,
44 const meshToMesh::interpolationMethod& mapMethod,
46 const HashSet<word>& selectedFields,
47 const bool noLagrangian
50 Info<<
nl <<
"Consistently creating and mapping fields for time " 51 << meshSource.time().timeName() <<
nl <<
endl;
53 meshToMesh interp(meshSource, meshTarget, mapMethod);
78 const fvMesh& meshSource,
79 const fvMesh& meshTarget,
80 const HashTable<word>& patchMap,
82 const meshToMesh::interpolationMethod& mapMethod,
84 const HashSet<word>& selectedFields,
85 const bool noLagrangian
88 Info<<
nl <<
"Creating and mapping fields for time " 89 << meshSource.time().timeName() <<
nl <<
endl;
123 const fvMesh& meshTarget,
128 HashSet<word> cuttingPatchTable;
131 cuttingPatchTable.insert(cuttingPatches[i]);
134 const polyBoundaryMesh& pbm = meshTarget.boundaryMesh();
138 if (isA<processorPolyPatch>(pbm[patchi]))
140 const word& patchName = pbm[
patchi].name();
141 cuttingPatchTable.insert(patchName);
145 return cuttingPatchTable.toc();
151 int main(
int argc,
char *argv[])
155 "map volume fields from one mesh to another" 158 argList::validArgs.append(
"sourceCase");
163 "scalar|'latestTime'",
164 "specify the source time" 170 "specify the source region" 176 "specify the target region" 178 argList::addBoolOption
181 "source and target geometry and boundary conditions identical" 187 "specify the mapping method" 189 argList::addBoolOption
192 "subtract mapped source from target" 198 "specify a list of fields to be mapped. Eg, '(U T p)' - " 199 "regular expressions not currently supported" 201 argList::addBoolOption
204 "skip mapping lagrangian positions and fields" 207 argList
args(argc, argv);
212 const fileName casePath =
args[1];
213 const fileName rootDirSource = casePath.
path();
214 const fileName caseDirSource = casePath.
name();
216 Info<<
"Source: " << rootDirSource <<
" " << caseDirSource <<
endl;
217 word sourceRegion = fvMesh::defaultRegion;
220 sourceRegion =
args[
"sourceRegion"];
221 Info<<
"Source region: " << sourceRegion <<
endl;
224 Info<<
"Target: " << rootDirTarget <<
" " << caseDirTarget <<
endl;
225 word targetRegion = fvMesh::defaultRegion;
228 targetRegion =
args[
"targetRegion"];
229 Info<<
"Target region: " << targetRegion <<
endl;
234 meshToMesh::interpolationMethod mapMethod =
235 meshToMesh::imCellVolumeWeight;
239 mapMethod = meshToMesh::interpolationMethodNames_[
args[
"mapMethod"]];
241 Info<<
"Mapping method: " 242 << meshToMesh::interpolationMethodNames_[mapMethod] <<
endl;
248 Info<<
"Subtracting mapped source field from target" <<
endl;
251 HashSet<word> selectedFields;
259 #include "createTimes.H" 261 HashTable<word> patchMap;
266 IOdictionary mapFieldsDict
273 IOobject::MUST_READ_IF_MODIFIED,
279 mapFieldsDict.lookup(
"patchMap") >> patchMap;
280 mapFieldsDict.lookup(
"cuttingPatches") >> cuttingPatches;
283 #include "setTimeIndex.H" 307 Info<<
"Source mesh size: " << meshSource.nCells() <<
tab 308 <<
"Target mesh size: " << meshTarget.nCells() <<
nl <<
endl;
#define forAll(list, i)
Loop across all elements in list.
const fileName & globalCaseName() const
Return case name.
const fileName & rootPath() const
Return root path.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool optionFound(const word &opt) const
Return true if the named option is found.
Time runTimeTarget(Time::controlDictName, args)
Time runTimeSource(Time::controlDictName, argsSrc)
word name() const
Return file name (part beyond last /)
fileName path() const
Return the path to the caseName.
List< word > wordList
A List of words.
Foam::argList args(argc, argv)
IStringStream optionLookup(const word &opt) const
Return an IStringStream from the named option.