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,
96 const wordList& cuttingPatches,
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]
142int 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);
216 fileName rootDirTarget(
args.rootPath());
217 fileName caseDirTarget(
args.globalCaseName());
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;
224 word sourceRegion(polyMesh::defaultRegion);
225 if (
args.readIfPresent(
"sourceRegion", sourceRegion))
227 Info<<
" (region " << sourceRegion <<
')';
231 Info<<
"Target: " << rootDirTarget <<
' ' << caseDirTarget;
232 word targetRegion(polyMesh::defaultRegion);
233 if (
args.readIfPresent(
"targetRegion", targetRegion))
235 Info<<
" (region " << targetRegion <<
')';
239 const bool consistent =
args.found(
"consistent");
242 word mapMethod = meshToMesh::interpolationMethodNames_
244 meshToMesh::interpolationMethod::imCellVolumeWeight
247 if (
args.readIfPresent(
"mapMethod", mapMethod))
249 Info<<
"Mapping method: " << mapMethod <<
endl;
253 if (meshToMesh::interpolationMethodNames_.
found(mapMethod))
256 meshToMesh::interpolationMethod method =
257 meshToMesh::interpolationMethodNames_[mapMethod];
259 patchMapMethod = meshToMesh::interpolationMethodAMI(method);
263 meshToMesh::procMapMethodNames_
265 meshToMesh::procMapMethod::pmAABB
268 if (
args.readIfPresent(
"procMapMethod", procMapMethod))
270 Info<<
"Processor map method: " << procMapMethod <<
endl;
275 if (
args.readIfPresent(
"patchMapMethod", patchMapMethod))
277 Info<<
"Patch mapping method: " << patchMapMethod <<
endl;
281 if (patchMapMethod.empty())
284 <<
"No valid patchMapMethod for method " << mapMethod
285 <<
". Please supply one through the 'patchMapMethod' option"
292 Info<<
"Subtracting mapped source field from target" <<
endl;
296 const wordRes selectedFields(
args.getList<wordRe>(
"fields",
false));
298 const bool noLagrangian =
args.found(
"no-lagrangian");
302 HashTable<word> patchMap;
307 IOdictionary mapFieldsDict
314 IOobject::MUST_READ_IF_MODIFIED,
316 IOobject::NO_REGISTER
320 mapFieldsDict.readEntry(
"patchMap", patchMap);
321 mapFieldsDict.readEntry(
"cuttingPatches", cuttingPatches);
348 Info<<
"Source mesh size: " << meshSource.globalData().nTotalCells() <<
tab
349 <<
"Target mesh size: " << meshTarget.globalData().nTotalCells()
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
List< word > wordList
List of word.
void subtract(DimensionedField< scalar, GeoMesh > &result, const dimensioned< scalar > &dt1, const DimensionedField< scalar, GeoMesh > &f2)
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).
constexpr char tab
The tab '\t' character(0x09).
Time runTimeSource(Time::controlDictName, argsSrc)
Time runTimeTarget(Time::controlDictName, args)
Foam::argList args(argc, argv)