42 #include "MapMeshes.H"
46 void mapConsistentMesh
48 const fvMesh& meshSource,
49 const fvMesh& meshTarget,
50 const word& mapMethod,
51 const word& AMIMapMethod,
52 const word& procMapMethod,
54 const wordRes& selectedFields,
55 const bool noLagrangian
58 Info<<
nl <<
"Consistently creating and mapping fields for time "
59 << meshSource.time().timeName() <<
nl <<
endl;
67 meshToMesh::procMapMethodNames_[procMapMethod]
93 const fvMesh& meshSource,
94 const fvMesh& meshTarget,
95 const HashTable<word>& patchMap,
97 const word& mapMethod,
98 const word& AMIMapMethod,
99 const word& procMapMethod,
101 const wordRes& selectedFields,
102 const bool noLagrangian
105 Info<<
nl <<
"Creating and mapping fields for time "
106 << meshSource.time().timeName() <<
nl <<
endl;
116 meshToMesh::procMapMethodNames_[procMapMethod]
142 int main(
int argc,
char *argv[])
146 "Map volume fields from one mesh to another"
149 argList::addArgument(
"sourceCase");
154 "scalar|'latestTime'",
155 "Specify the source time"
161 "Specify the source region"
167 "Specify the target region"
169 argList::addBoolOption
172 "Source and target geometry and boundary conditions identical"
178 "Specify the mapping method "
179 "(direct|mapNearest|cellVolumeWeight|correctedCellVolumeWeight)"
185 "Specify the patch mapping method (direct|mapNearest|faceAreaWeight)"
191 "Specify the processor distribution map method (AABB|LOD)"
193 argList::addBoolOption
196 "Subtract mapped source from target"
202 "Specify single or multiple fields to reconstruct (all by default)."
203 " Eg, 'T' or '(p T U \"alpha.*\")'"
206 argList::addBoolOption
209 "Skip mapping lagrangian positions and fields"
211 argList::addOptionCompat(
"no-lagrangian", {
"noLagrangian", 2106});
213 argList
args(argc, argv);
219 const auto casePath =
args.
get<fileName>(1);
220 const fileName rootDirSource = casePath.path();
221 const fileName caseDirSource = casePath.name();
223 Info<<
"Source: " << rootDirSource <<
" " << caseDirSource <<
endl;
224 word sourceRegion = polyMesh::defaultRegion;
227 Info<<
"Source region: " << sourceRegion <<
endl;
230 Info<<
"Target: " << rootDirTarget <<
" " << caseDirTarget <<
endl;
231 word targetRegion = polyMesh::defaultRegion;
234 Info<<
"Target region: " << targetRegion <<
endl;
237 const bool consistent =
args.
found(
"consistent");
240 word mapMethod = meshToMesh::interpolationMethodNames_
242 meshToMesh::interpolationMethod::imCellVolumeWeight
247 Info<<
"Mapping method: " << mapMethod <<
endl;
251 if (meshToMesh::interpolationMethodNames_.
found(mapMethod))
254 meshToMesh::interpolationMethod method =
255 meshToMesh::interpolationMethodNames_[mapMethod];
257 patchMapMethod = meshToMesh::interpolationMethodAMI(method);
261 meshToMesh::procMapMethodNames_
263 meshToMesh::procMapMethod::pmAABB
268 Info<<
"Processor map method: " << procMapMethod <<
endl;
275 Info<<
"Patch mapping method: " << patchMapMethod <<
endl;
279 if (patchMapMethod.empty())
282 <<
"No valid patchMapMethod for method " << mapMethod
283 <<
". Please supply one through the 'patchMapMethod' option"
290 Info<<
"Subtracting mapped source field from target" <<
endl;
294 const wordRes selectedFields(
args.
getList<wordRe>(
"fields",
false));
296 const bool noLagrangian =
args.
found(
"no-lagrangian");
298 #include "createTimes.H"
300 HashTable<word> patchMap;
305 IOdictionary mapFieldsDict
312 IOobject::MUST_READ_IF_MODIFIED,
318 mapFieldsDict.readEntry(
"patchMap", patchMap);
319 mapFieldsDict.readEntry(
"cuttingPatches", cuttingPatches);
322 #include "setTimeIndex.H"
346 Info<<
"Source mesh size: " << meshSource.globalData().nTotalCells() <<
tab
347 <<
"Target mesh size: " << meshTarget.globalData().nTotalCells()