mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Added support for DimensionedField<Type, volMesh> to reconstructPar
This commit is contained in:
@ -40,7 +40,8 @@ Foam::fvFieldReconstructor::fvFieldReconstructor
|
||||
procMeshes_(procMeshes),
|
||||
faceProcAddressing_(faceProcAddressing),
|
||||
cellProcAddressing_(cellProcAddressing),
|
||||
boundaryProcAddressing_(boundaryProcAddressing)
|
||||
boundaryProcAddressing_(boundaryProcAddressing),
|
||||
nReconstructed_(0)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -71,6 +71,9 @@ class fvFieldReconstructor
|
||||
//- List of processor boundary addressing lists
|
||||
const PtrList<labelIOList>& boundaryProcAddressing_;
|
||||
|
||||
//- Number of fields reconstructed
|
||||
label nReconstructed_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
@ -134,20 +137,33 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return number of fields reconstructed
|
||||
label nReconstructed() const
|
||||
{
|
||||
return nReconstructed_;
|
||||
}
|
||||
|
||||
//- Reconstruct volume internal field
|
||||
template<class Type>
|
||||
tmp<DimensionedField<Type, volMesh> >
|
||||
reconstructFvVolumeInternalField(const IOobject& fieldIoObject);
|
||||
|
||||
//- Reconstruct volume field
|
||||
template<class Type>
|
||||
tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||
reconstructFvVolumeField
|
||||
(
|
||||
const IOobject& fieldIoObject
|
||||
);
|
||||
reconstructFvVolumeField(const IOobject& fieldIoObject);
|
||||
|
||||
//- Reconstruct surface field
|
||||
template<class Type>
|
||||
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
|
||||
reconstructFvSurfaceField
|
||||
reconstructFvSurfaceField(const IOobject& fieldIoObject);
|
||||
|
||||
//- Reconstruct and write all/selected volume internal fields
|
||||
template<class Type>
|
||||
void reconstructFvVolumeInternalFields
|
||||
(
|
||||
const IOobject& fieldIoObject
|
||||
const IOobjectList& objects,
|
||||
const HashSet<word>& selectedFields
|
||||
);
|
||||
|
||||
//- Reconstruct and write all/selected volume fields
|
||||
@ -158,7 +174,7 @@ public:
|
||||
const HashSet<word>& selectedFields
|
||||
);
|
||||
|
||||
//- Reconstruct and write all/selected volume fields
|
||||
//- Reconstruct and write all/selected surface fields
|
||||
template<class Type>
|
||||
void reconstructFvSurfaceFields
|
||||
(
|
||||
|
||||
@ -33,6 +33,75 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::DimensionedField<Type, Foam::volMesh> >
|
||||
Foam::fvFieldReconstructor::reconstructFvVolumeInternalField
|
||||
(
|
||||
const IOobject& fieldIoObject
|
||||
)
|
||||
{
|
||||
// Read the field for all the processors
|
||||
PtrList<DimensionedField<Type, volMesh> > procFields
|
||||
(
|
||||
procMeshes_.size()
|
||||
);
|
||||
|
||||
forAll(procMeshes_, procI)
|
||||
{
|
||||
procFields.set
|
||||
(
|
||||
procI,
|
||||
new DimensionedField<Type, volMesh>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fieldIoObject.name(),
|
||||
procMeshes_[procI].time().timeName(),
|
||||
procMeshes_[procI],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
procMeshes_[procI]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Create the internalField
|
||||
Field<Type> internalField(mesh_.nCells());
|
||||
|
||||
forAll(procMeshes_, procI)
|
||||
{
|
||||
const DimensionedField<Type, volMesh>& procField = procFields[procI];
|
||||
|
||||
// Set the cell values in the reconstructed field
|
||||
internalField.rmap
|
||||
(
|
||||
procField.field(),
|
||||
cellProcAddressing_[procI]
|
||||
);
|
||||
}
|
||||
|
||||
return tmp<DimensionedField<Type, volMesh> >
|
||||
(
|
||||
new DimensionedField<Type, volMesh>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fieldIoObject.name(),
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
procFields[0].dimensions(),
|
||||
internalField
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
|
||||
Foam::fvFieldReconstructor::reconstructFvVolumeField
|
||||
@ -451,7 +520,41 @@ Foam::fvFieldReconstructor::reconstructFvSurfaceField
|
||||
}
|
||||
|
||||
|
||||
// Reconstruct and write all/selected volume fields
|
||||
template<class Type>
|
||||
void Foam::fvFieldReconstructor::reconstructFvVolumeInternalFields
|
||||
(
|
||||
const IOobjectList& objects,
|
||||
const HashSet<word>& selectedFields
|
||||
)
|
||||
{
|
||||
const word& fieldClassName = DimensionedField<Type, volMesh>::typeName;
|
||||
|
||||
IOobjectList fields = objects.lookupClass(fieldClassName);
|
||||
|
||||
if (fields.size())
|
||||
{
|
||||
Info<< " Reconstructing " << fieldClassName << "s\n" << endl;
|
||||
|
||||
forAllConstIter(IOobjectList, fields, fieldIter)
|
||||
{
|
||||
if
|
||||
(
|
||||
!selectedFields.size()
|
||||
|| selectedFields.found(fieldIter()->name())
|
||||
)
|
||||
{
|
||||
Info<< " " << fieldIter()->name() << endl;
|
||||
|
||||
reconstructFvVolumeInternalField<Type>(*fieldIter())().write();
|
||||
|
||||
nReconstructed_++;
|
||||
}
|
||||
}
|
||||
Info<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::fvFieldReconstructor::reconstructFvVolumeFields
|
||||
(
|
||||
@ -479,13 +582,15 @@ void Foam::fvFieldReconstructor::reconstructFvVolumeFields
|
||||
Info<< " " << fieldIter()->name() << endl;
|
||||
|
||||
reconstructFvVolumeField<Type>(*fieldIter())().write();
|
||||
|
||||
nReconstructed_++;
|
||||
}
|
||||
}
|
||||
Info<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Reconstruct and write all/selected surface fields
|
||||
|
||||
template<class Type>
|
||||
void Foam::fvFieldReconstructor::reconstructFvSurfaceFields
|
||||
(
|
||||
@ -513,6 +618,8 @@ void Foam::fvFieldReconstructor::reconstructFvSurfaceFields
|
||||
Info<< " " << fieldIter()->name() << endl;
|
||||
|
||||
reconstructFvSurfaceField<Type>(*fieldIter())().write();
|
||||
|
||||
nReconstructed_++;
|
||||
}
|
||||
}
|
||||
Info<< endl;
|
||||
|
||||
@ -39,7 +39,8 @@ Foam::pointFieldReconstructor::pointFieldReconstructor
|
||||
procMeshes_(procMeshes),
|
||||
pointProcAddressing_(pointProcAddressing),
|
||||
boundaryProcAddressing_(boundaryProcAddressing),
|
||||
patchPointAddressing_(procMeshes.size())
|
||||
patchPointAddressing_(procMeshes.size()),
|
||||
nReconstructed_(0)
|
||||
{
|
||||
// Inverse-addressing of the patch point labels.
|
||||
labelList pointMap(mesh_.size(), -1);
|
||||
|
||||
@ -68,6 +68,9 @@ class pointFieldReconstructor
|
||||
//- Point patch addressing
|
||||
labelListListList patchPointAddressing_;
|
||||
|
||||
//- Number of fields reconstructed
|
||||
label nReconstructed_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
@ -130,6 +133,12 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return number of fields reconstructed
|
||||
label nReconstructed() const
|
||||
{
|
||||
return nReconstructed_;
|
||||
}
|
||||
|
||||
//- Reconstruct field
|
||||
template<class Type>
|
||||
tmp<GeometricField<Type, pointPatchField, pointMesh> >
|
||||
|
||||
Reference in New Issue
Block a user