31 template<
class GeoField>
36 mesh.objectRegistry::lookupClass<GeoField>()
41 const GeoField&
fld = *iter();
43 Pout<<
"Field:" << iter.key() <<
" internal size:" <<
fld.size()
49 <<
' ' <<
fld.boundaryField()[
patchi].patch().name()
50 <<
' ' <<
fld.boundaryField()[
patchi].type()
51 <<
' ' <<
fld.boundaryField()[
patchi].size()
58 template<
class Type,
class Mesh>
59 void Foam::fvMeshDistribute::saveBoundaryFields
68 static_cast<const fvMesh&
>(mesh_)
72 bflds.setSize(flds.size());
80 bflds.set(i,
fld.boundaryField().clone().ptr());
87 template<
class Type,
class Mesh>
88 void Foam::fvMeshDistribute::mapBoundaryFields
90 const polyTopoChangeMap& map,
91 const PtrList<FieldField<fvsPatchField, Type>>& oldBflds
96 const labelList& oldPatchStarts = map.oldPatchStarts();
99 HashTable<SurfaceField<Type>*> flds
101 mesh_.objectRegistry::lookupClass<SurfaceField<Type>>()
104 if (flds.size() != oldBflds.size())
112 forAllIter(
typename HashTable<SurfaceField<Type>*>, flds, iter)
114 SurfaceField<Type>&
fld = *iter();
116 fld.boundaryFieldRef();
118 const FieldField<fvsPatchField, Type>& oldBfld = oldBflds[fieldi++];
124 fvsPatchField<Type>& patchFld = bfld[
patchi];
125 label facei = patchFld.patch().start();
132 forAll(oldPatchStarts, oldPatchi)
134 label oldLocalI = oldFacei - oldPatchStarts[oldPatchi];
136 if (oldLocalI >= 0 && oldLocalI < oldBfld[oldPatchi].size())
138 patchFld[i] = oldBfld[oldPatchi][oldLocalI];
148 void Foam::fvMeshDistribute::initMapExposedFaces
150 PtrList<Field<Type>>& iflds
153 HashTable<const SurfaceField<Type>*> flds
155 static_cast<const fvMesh&
>(mesh_).lookupClass<SurfaceField<Type>>()
158 iflds.setSize(flds.size());
162 forAllConstIter(
typename HashTable<
const SurfaceField<Type>*>, flds, iter)
164 iflds.set(fieldi, Field<Type>(mesh_.nFaces()));
166 const SurfaceField<Type>&
fld = *iter();
168 SubList<Type>(iflds[fieldi],
fld.primitiveField().size()) =
169 fld.primitiveField();
173 const fvsPatchField<Type>& pfld =
fld.boundaryField()[
patchi];
175 SubList<Type>(iflds[fieldi], pfld.size(), pfld.patch().start()) =
185 void Foam::fvMeshDistribute::mapExposedFaces
187 const polyTopoChangeMap& map,
188 const PtrList<Field<Type>>& oldFlds
191 HashTable<SurfaceField<Type>*> flds
193 mesh_.objectRegistry::lookupClass<SurfaceField<Type>>()
198 forAllIter(
typename HashTable<SurfaceField<Type>*>, flds, iter)
200 SurfaceField<Type>&
fld = *iter();
202 const Field<Type>& oldFld = oldFlds[fieldi];
204 const bool negateIfFlipped =
isFlux(
fld);
208 fvsPatchField<Type>& patchFld =
fld.boundaryFieldRef()[
patchi];
212 const label facei = patchFld.patch().start()+i;
213 const label oldFacei = map.faceMap()[facei];
215 if (oldFacei < map.nOldInternalFaces())
217 if (negateIfFlipped && map.flipFaceFlux().found(facei))
219 patchFld[i] = flipOp()(oldFld[oldFacei]);
223 patchFld[i] = oldFld[oldFacei];
228 patchFld[i] = oldFld[oldFacei];
238 template<
class GeoField>
239 void Foam::fvMeshDistribute::correctCoupledPatchFields()
241 HashTable<GeoField*> flds
243 mesh_.objectRegistry::lookupClass<GeoField>()
246 forAllIter(
typename HashTable<GeoField*>, flds, iter)
248 GeoField&
fld = *iter();
250 typename GeoField::Boundary& bfld =
fld.boundaryFieldRef();
262 if (bfld[
patchi].coupled())
280 if (bfld[
patchi].coupled())
289 mesh_.globalData().patchSchedule();
291 forAll(patchSchedule, patchEvali)
293 if (bfld[patchEvali].coupled())
295 if (patchSchedule[patchEvali].init)
297 bfld[patchSchedule[patchEvali].patch]
302 bfld[patchSchedule[patchEvali].patch]
312 template<
class GeoField>
313 void Foam::fvMeshDistribute::sendFields
317 const fvMeshSubset& subsetter,
346 <<
" for domain:" << domain <<
endl;
351 const GeoField&
fld =
352 subsetter.baseMesh().lookupObject<GeoField>(
fieldNames[i]);
354 tmp<GeoField> tsubfld = subsetter.interpolate(
fld);
365 template<
class GeoField>
366 void Foam::fvMeshDistribute::receiveFields
370 typename GeoField::Mesh& mesh,
371 PtrList<GeoField>&
fields,
372 const dictionary& fieldDicts
378 <<
" from domain:" << domain <<
endl;
388 <<
" from domain:" << domain <<
endl;
399 mesh.thisDb().time().name(),
#define forAll(list, i)
Loop across all elements in list.
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Generic GeometricField class.
GeometricBoundaryField< Type, PatchField, GeoMesh > Boundary
Type of the boundary field.
An STL-conforming hash table.
void size(const label)
Override size to be inconsistent with allocated storage.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
static label nRequests()
Get number of outstanding requests.
static void waitRequests(const label start=0)
Wait until all requests (from start onwards) have finished.
static bool & parRun()
Is this a parallel run?
static commsTypes defaultCommsType
Default commsType.
static void printFieldInfo(const fvMesh &)
Print some field info.
Mesh data needed to do the Finite Volume discretisation.
HashTable< const Type * > lookupClass(const bool strict=false) const
Lookup and return all objects of the given Type.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static List< word > fieldNames
gmvFile<< "tracers "<< particles.size()<< nl;{ pointField positions(particles.size());label particlei=0;forAllConstIter(Cloud< passiveParticle >, particles, iter) { positions[particlei++]=iter().position(mesh);} for(i=0;i< pTraits< point >::nComponents;i++) { forAll(positions, particlei) { gmvFile<< component(positions[particlei], i)<< ' ';} gmvFile<< nl;}}forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Info<< "Calculating turbulent flame speed field St\n"<< endl;volScalarField St(IOobject("St", runTime.name(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), flameWrinkling->Xi() *Su);multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
List< word > wordList
A List of words.
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
bool isFlux(const DimensionedField< Type, surfaceMesh > &df)
Check if surfaceField is a flux.
List< lduScheduleEntry > lduSchedule
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
prefixOSstream Pout(cout, "Pout")