36 namespace functionObjects
46 void Foam::functionObjects::mapFields::createInterpolation
48 const dictionary&
dict 51 const fvMesh& meshTarget =
mesh_;
52 const word mapRegionName(
dict.get<word>(
"mapRegion"));
55 <<
" Reading mesh " << mapRegionName <<
endl;
64 meshTarget.time().constant(),
71 const fvMesh& mapRegion = mapRegionPtr_();
72 const word mapMethodName(
dict.get<word>(
"mapMethod"));
76 <<
type() <<
" " <<
name() <<
": unknown map method " 77 << mapMethodName <<
nl 78 <<
"Available methods include: " 92 if (
dict.readIfPresent(
"patchMapMethod", patchMapMethodName))
94 Info<<
" Patch mapping method: " << patchMapMethodName <<
endl;
97 Info<<
" Creating mesh to mesh interpolation" <<
endl;
99 if (
dict.get<
bool>(
"consistent"))
114 HashTable<word> patchMap;
116 bool createPatchMap =
dict.getOrDefault<
bool>(
"createPatchMap",
false);
118 const entry* ePtr =
dict.findEntry(
"patchMap");
120 if (createPatchMap && ePtr)
123 <<
"Requested 'createPatchMap' but 'patchMap' entry provided. " 124 <<
"Please remove one of these entries" 128 if (!createPatchMap && !ePtr)
131 <<
"Either the 'createPatchMap' or 'patchMap' entry must be " 132 <<
"provided when not using the 'consistent' mapping option" 137 const polyBoundaryMesh& pbmT = mapRegion.boundaryMesh();
138 DynamicList<label> cuttingIndices;
142 Info<<
" Creating patchMap and cuttingPatches" <<
endl;
144 if (
dict.found(
"cuttingPatches"))
147 <<
"Ignoring user supplied cuttingPatches when " 148 <<
"createPatchMap option is active" 154 const polyPatch& ppT = pbmT[patchiT];
158 const word& patchNameT = ppT.name();
159 const label patchi =
pbm.findPatchID(patchNameT);
163 Info<<
" Adding to cuttingPatches: " 164 << ppT.name() <<
endl;
166 cuttingIndices.push_back(ppT.index());
172 Info<<
" Adding to patchMap: " << ppT.name()
175 patchMap.set(patchNameT, patchNameT);
184 patchMap = HashTable<word>(ePtr->stream());
187 const wordRes cuttingPatchRes =
dict.get<wordRes>(
"cuttingPatches");
188 cuttingIndices.push_back(pbmT.indices(cuttingPatchRes));
191 const wordList cuttingPatches(pbmT.names(), cuttingIndices);
198 for (
const auto& ppT : pbmT)
203 && !patchMap.found(ppT.name())
207 unknownPatchNames.
insert(ppT.name());
211 for (
const label patchiT : cuttingIndices)
213 const word& patchName = pbmT[patchiT].name();
215 unknownPatchNames.erase(patchName);
217 if (patchMap.found(patchName))
219 Info<<
" Removing cutting patch from patchMap: " 220 << patchName <<
endl;
222 patchMap.erase(patchName);
226 if (unknownPatchNames.size())
229 <<
"Patches not present in source mesh. " 230 <<
"Add to cuttingPatches? Patches: " 276 dict.readEntry(
"fields", fieldNames_);
277 createInterpolation(
dict);
292 ok = mapFieldType<scalar>() || ok;
293 ok = mapFieldType<vector>() || ok;
294 ok = mapFieldType<sphericalTensor>() || ok;
295 ok = mapFieldType<symmTensor>() || ok;
296 ok = mapFieldType<tensor>() || ok;
317 ok = writeFieldType<scalar>() || ok;
318 ok = writeFieldType<vector>() || ok;
319 ok = writeFieldType<sphericalTensor>() || ok;
320 ok = writeFieldType<symmTensor>() || ok;
321 ok = writeFieldType<tensor>() || ok;
const polyBoundaryMesh & pbm
defineTypeNameAndDebug(ObukhovLength, 0)
dimensionedScalar log(const dimensionedScalar &ds)
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...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static const Enum< interpolationMethod > interpolationMethodNames_
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
mapFields(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Macros for easy insertion into run-time selection tables.
const word & name() const noexcept
Return the name of this functionObject.
bool read(const char *buf, int32_t &val)
Same as readInt32.
#define forAll(list, i)
Loop across all elements in list.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
virtual bool read(const dictionary &)
Read the mapFields data.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
A class for handling words, derived from Foam::string.
virtual const word & type() const =0
Runtime type information.
virtual bool write()
Calculate the mapFields and write.
HashSet< word, Hash< word > > wordHashSet
A HashSet of words, uses string hasher.
static word interpolationMethodAMI(const interpolationMethod method)
Conversion between mesh and patch interpolation methods.
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
List< word > wordList
List of word.
static bool constraintType(const word &patchType)
Return true if the given type is a constraint type.
#define WarningInFunction
Report a warning using Foam::Warning.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
messageStream Info
Information stream (stdout output on master, null elsewhere)
virtual bool read(const dictionary &dict)
Read optional controls.
virtual bool execute()
Execute, currently does nothing.
interpolationMethod
Enumeration specifying interpolation method.
const fvMesh & mesh_
Reference to the fvMesh.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...