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;
224 word sourceRegion(polyMesh::defaultRegion);
227 Info<<
" (region " << sourceRegion <<
')';
231 Info<<
"Target: " << rootDirTarget <<
' ' << caseDirTarget;
232 word targetRegion(polyMesh::defaultRegion);
235 Info<<
" (region " << targetRegion <<
')';
239 const bool consistent =
args.
found(
"consistent");
242 word mapMethod = meshToMesh::interpolationMethodNames_
244 meshToMesh::interpolationMethod::imCellVolumeWeight
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
270 Info<<
"Processor map method: " << procMapMethod <<
endl;
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");
300 #include "createTimes.H" 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);
324 #include "setTimeIndex.H" 348 Info<<
"Source mesh size: " << meshSource.globalData().nTotalCells() <<
tab 349 <<
"Target mesh size: " << meshTarget.globalData().nTotalCells()
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
List< T > getList(const label index) const
Get a List of values from the argument at index.
const fileName & globalCaseName() const noexcept
Return global case name.
constexpr char tab
The tab '\t' character(0x09)
void subtract(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Time runTimeTarget(Time::controlDictName, args)
Time runTimeSource(Time::controlDictName, argsSrc)
const fileName & rootPath() const noexcept
Return root path.
List< word > wordList
List of word.
T get(const label index) const
Get a value from the argument at index.
messageStream Info
Information stream (stdout output on master, null elsewhere)
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
Foam::argList args(argc, argv)
bool found(const word &optName) const
Return true if the named option is found.