ENH: Sliced: option to slice non-processor coupled patchFields

This commit is contained in:
mattijs
2012-11-09 16:43:21 +00:00
parent 7f903b7239
commit 37b873b051
3 changed files with 32 additions and 34 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "SlicedGeometricField.H" #include "SlicedGeometricField.H"
#include "processorFvPatch.H"
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * //
@ -40,7 +41,8 @@ slicedBoundaryField
( (
const Mesh& mesh, const Mesh& mesh,
const Field<Type>& completeField, const Field<Type>& completeField,
const bool preserveCouples const bool preserveCouples,
const bool preserveProcessorOnly
) )
{ {
tmp<FieldField<PatchField, Type> > tbf tmp<FieldField<PatchField, Type> > tbf
@ -52,7 +54,15 @@ slicedBoundaryField
forAll(mesh.boundary(), patchi) forAll(mesh.boundary(), patchi)
{ {
if (preserveCouples && mesh.boundary()[patchi].coupled()) if
(
preserveCouples
&& mesh.boundary()[patchi].coupled()
&& (
!preserveProcessorOnly
|| isA<processorFvPatch>(mesh.boundary()[patchi])
)
)
{ {
// For coupled patched construct the correct patch field type // For coupled patched construct the correct patch field type
bf.set bf.set
@ -243,7 +253,8 @@ SlicedGeometricField
const dimensionSet& ds, const dimensionSet& ds,
const Field<Type>& completeIField, const Field<Type>& completeIField,
const Field<Type>& completeBField, const Field<Type>& completeBField,
const bool preserveCouples const bool preserveCouples,
const bool preserveProcessorOnly
) )
: :
GeometricField<Type, PatchField, GeoMesh> GeometricField<Type, PatchField, GeoMesh>
@ -252,7 +263,13 @@ SlicedGeometricField
mesh, mesh,
ds, ds,
Field<Type>(), Field<Type>(),
slicedBoundaryField(mesh, completeBField, preserveCouples) slicedBoundaryField
(
mesh,
completeBField,
preserveCouples,
preserveProcessorOnly
)
) )
{ {
// Set the internalField to the slice of the complete field // Set the internalField to the slice of the complete field

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -83,7 +83,8 @@ private:
( (
const Mesh& mesh, const Mesh& mesh,
const Field<Type>& completeField, const Field<Type>& completeField,
const bool preserveCouples const bool preserveCouples,
const bool preserveProcessorOnly = false
); );
//- Slice the given field and a create a PtrList of SlicedPatchField //- Slice the given field and a create a PtrList of SlicedPatchField
@ -133,7 +134,8 @@ public:
const dimensionSet&, const dimensionSet&,
const Field<Type>& completeIField, const Field<Type>& completeIField,
const Field<Type>& completeBField, const Field<Type>& completeBField,
const bool preserveCouples=true const bool preserveCouples=true,
const bool preserveProcessorOnly = false
); );
//- Construct from GeometricField. Reuses full internal and //- Construct from GeometricField. Reuses full internal and

View File

@ -133,6 +133,8 @@ void fvMesh::makeC() const
<< abort(FatalError); << abort(FatalError);
} }
// Construct as slices. Only preserve processor (not e.g. cyclic)
CPtr_ = new slicedVolVectorField CPtr_ = new slicedVolVectorField
( (
IOobject IOobject
@ -148,33 +150,10 @@ void fvMesh::makeC() const
*this, *this,
dimLength, dimLength,
cellCentres(), cellCentres(),
faceCentres() faceCentres(),
true, //preserveCouples
true //preserveProcOnly
); );
// Need to correct for cyclics transformation since absolute quantity.
// Ok on processor patches since hold opposite cell centre (no
// transformation)
slicedVolVectorField& C = *CPtr_;
forAll(C.boundaryField(), patchi)
{
if
(
isA<cyclicFvPatchVectorField>(C.boundaryField()[patchi])
|| isA<cyclicAMIFvPatchVectorField>(C.boundaryField()[patchi])
)
{
// Note: cyclic is not slice but proper field
C.boundaryField()[patchi] == static_cast<const vectorField&>
(
static_cast<const List<vector>&>
(
boundary_[patchi].patchSlice(faceCentres())
)
);
}
}
} }