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:
@ -179,23 +179,8 @@ int main(int argc, char *argv[])
|
||||
// Get list of objects from processor0 database
|
||||
IOobjectList objects(procMeshes.meshes()[0], databases[0].timeName());
|
||||
|
||||
|
||||
// If there are any FV fields, reconstruct them
|
||||
|
||||
if
|
||||
(
|
||||
objects.lookupClass(volScalarField::typeName).size()
|
||||
|| objects.lookupClass(volVectorField::typeName).size()
|
||||
|| objects.lookupClass(volSphericalTensorField::typeName).size()
|
||||
|| objects.lookupClass(volSymmTensorField::typeName).size()
|
||||
|| objects.lookupClass(volTensorField::typeName).size()
|
||||
|| objects.lookupClass(surfaceScalarField::typeName).size()
|
||||
|| objects.lookupClass(surfaceVectorField::typeName).size()
|
||||
|| objects.lookupClass(surfaceSphericalTensorField::typeName).size()
|
||||
|| objects.lookupClass(surfaceSymmTensorField::typeName).size()
|
||||
|| objects.lookupClass(surfaceTensorField::typeName).size()
|
||||
)
|
||||
{
|
||||
// If there are any FV fields, reconstruct them
|
||||
Info<< "Reconstructing FV fields" << nl << endl;
|
||||
|
||||
fvFieldReconstructor fvReconstructor
|
||||
@ -207,6 +192,32 @@ int main(int argc, char *argv[])
|
||||
procMeshes.boundaryProcAddressing()
|
||||
);
|
||||
|
||||
fvReconstructor.reconstructFvVolumeInternalFields<scalar>
|
||||
(
|
||||
objects,
|
||||
selectedFields
|
||||
);
|
||||
fvReconstructor.reconstructFvVolumeInternalFields<vector>
|
||||
(
|
||||
objects,
|
||||
selectedFields
|
||||
);
|
||||
fvReconstructor.reconstructFvVolumeInternalFields<sphericalTensor>
|
||||
(
|
||||
objects,
|
||||
selectedFields
|
||||
);
|
||||
fvReconstructor.reconstructFvVolumeInternalFields<symmTensor>
|
||||
(
|
||||
objects,
|
||||
selectedFields
|
||||
);
|
||||
fvReconstructor.reconstructFvVolumeInternalFields<tensor>
|
||||
(
|
||||
objects,
|
||||
selectedFields
|
||||
);
|
||||
|
||||
fvReconstructor.reconstructFvVolumeFields<scalar>
|
||||
(
|
||||
objects,
|
||||
@ -258,22 +269,13 @@ int main(int argc, char *argv[])
|
||||
objects,
|
||||
selectedFields
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "No FV fields" << nl << endl;
|
||||
|
||||
if (fvReconstructor.nReconstructed() == 0)
|
||||
{
|
||||
Info<< "No FV fields" << nl << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// If there are any point fields, reconstruct them
|
||||
if
|
||||
(
|
||||
objects.lookupClass(pointScalarField::typeName).size()
|
||||
|| objects.lookupClass(pointVectorField::typeName).size()
|
||||
|| objects.lookupClass(pointSphericalTensorField::typeName).size()
|
||||
|| objects.lookupClass(pointSymmTensorField::typeName).size()
|
||||
|| objects.lookupClass(pointTensorField::typeName).size()
|
||||
)
|
||||
{
|
||||
Info<< "Reconstructing point fields" << nl << endl;
|
||||
|
||||
@ -318,10 +320,11 @@ int main(int argc, char *argv[])
|
||||
objects,
|
||||
selectedFields
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "No point fields" << nl << endl;
|
||||
|
||||
if (pointReconstructor.nReconstructed() == 0)
|
||||
{
|
||||
Info<< "No point fields" << nl << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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