Fixed a bug introduced by maintaining the coupled patch fields in

sliced fields.
This commit is contained in:
h.weller@opencfd.co.uk
2008-06-24 17:01:01 +01:00
committed by graham
parent f4c75b2f02
commit 141e0d43ca
3 changed files with 30 additions and 16 deletions

View File

@ -35,12 +35,13 @@ template
template<class> class SlicedPatchField, template<class> class SlicedPatchField,
class GeoMesh class GeoMesh
> >
Foam::tmp<Foam::FieldField<PatchField, Type> > Foam::tmp<Foam::FieldField<PatchField, Type> >
Foam::SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>:: Foam::SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>::
slicedBoundaryField slicedBoundaryField
( (
const Mesh& mesh, const Mesh& mesh,
const Field<Type>& completeField const Field<Type>& completeField,
const bool preserveCouples
) )
{ {
tmp<FieldField<PatchField, Type> > tbf tmp<FieldField<PatchField, Type> > tbf
@ -52,7 +53,7 @@ slicedBoundaryField
forAll (mesh.boundary(), patchi) forAll (mesh.boundary(), patchi)
{ {
if (mesh.boundary()[patchi].coupled()) if (preserveCouples && mesh.boundary()[patchi].coupled())
{ {
// For coupled patched construct the correct patch field type // For coupled patched construct the correct patch field type
bf.set bf.set
@ -143,7 +144,8 @@ SlicedGeometricField
const IOobject& io, const IOobject& io,
const Mesh& mesh, const Mesh& mesh,
const dimensionSet& ds, const dimensionSet& ds,
const Field<Type>& completeField const Field<Type>& completeField,
const bool preserveCouples
) )
: :
GeometricField<Type, PatchField, GeoMesh> GeometricField<Type, PatchField, GeoMesh>
@ -152,7 +154,7 @@ SlicedGeometricField
mesh, mesh,
ds, ds,
Field<Type>(), Field<Type>(),
slicedBoundaryField(mesh, completeField) slicedBoundaryField(mesh, completeField, preserveCouples)
) )
{ {
// Set the internalField to the slice of the complete field // Set the internalField to the slice of the complete field
@ -179,7 +181,8 @@ SlicedGeometricField
const Mesh& mesh, const Mesh& mesh,
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
) )
: :
GeometricField<Type, PatchField, GeoMesh> GeometricField<Type, PatchField, GeoMesh>
@ -188,7 +191,7 @@ SlicedGeometricField
mesh, mesh,
ds, ds,
Field<Type>(), Field<Type>(),
slicedBoundaryField(mesh, completeBField) slicedBoundaryField(mesh, completeBField, preserveCouples)
) )
{ {
// Set the internalField to the slice of the complete field // Set the internalField to the slice of the complete field

View File

@ -28,11 +28,11 @@ Class
Description Description
Specialization of GeometricField which holds slices of given complete Specialization of GeometricField which holds slices of given complete
fields in a form that they act as a GeometricField. fields in a form that they act as a GeometricField.
The destructor is wrapped to avoid deallocation of the storage of the The destructor is wrapped to avoid deallocation of the storage of the
complete fields when this is destroyed. complete fields when this is destroyed.
SlicedGeometricField can only be instantiated with a valid form of SlicedGeometricField can only be instantiated with a valid form of
SlicedPatchField to handle the slicing and storage deallocation of the SlicedPatchField to handle the slicing and storage deallocation of the
boundary field. boundary field.
@ -83,7 +83,8 @@ private:
tmp<FieldField<PatchField, Type> > slicedBoundaryField tmp<FieldField<PatchField, Type> > slicedBoundaryField
( (
const Mesh& mesh, const Mesh& mesh,
const Field<Type>& completeField const Field<Type>& completeField,
const bool preserveCouples
); );
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
@ -111,7 +112,8 @@ public:
const IOobject&, const IOobject&,
const Mesh&, const Mesh&,
const dimensionSet&, const dimensionSet&,
const Field<Type>& completeField const Field<Type>& completeField,
const bool preserveCouples=true
); );
//- Construct from components and separate fields to slice for the //- Construct from components and separate fields to slice for the
@ -122,7 +124,8 @@ public:
const Mesh&, const Mesh&,
const dimensionSet&, const dimensionSet&,
const Field<Type>& completeIField, const Field<Type>& completeIField,
const Field<Type>& completeBField const Field<Type>& completeBField,
const bool preserveCouples=true
); );

View File

@ -55,6 +55,7 @@ void Foam::MULES::explicitSolve
Info<< "MULES: Solving for " << psi.name() << endl; Info<< "MULES: Solving for " << psi.name() << endl;
const fvMesh& mesh = psi.mesh(); const fvMesh& mesh = psi.mesh();
psi.correctBoundaryConditions();
surfaceScalarField phiBD = upwind<scalar>(psi.mesh(), phi).flux(psi); surfaceScalarField phiBD = upwind<scalar>(psi.mesh(), phi).flux(psi);
@ -76,7 +77,8 @@ void Foam::MULES::explicitSolve
), ),
mesh, mesh,
dimless, dimless,
allLambda allLambda,
false // Use slices for the couples
); );
limiter limiter
@ -183,7 +185,8 @@ void Foam::MULES::implicitSolve
), ),
mesh, mesh,
dimless, dimless,
allCoLambda allCoLambda,
false // Use slices for the couples
); );
CoLambda == 1.0/max(CoCoeff*Cof, scalar(1)); CoLambda == 1.0/max(CoCoeff*Cof, scalar(1));
@ -205,7 +208,8 @@ void Foam::MULES::implicitSolve
), ),
mesh, mesh,
dimless, dimless,
allLambda allLambda,
false // Use slices for the couples
); );
linear<scalar> CDs(mesh); linear<scalar> CDs(mesh);
@ -347,7 +351,8 @@ void Foam::MULES::limiter
), ),
mesh, mesh,
dimless, dimless,
allLambda allLambda,
false // Use slices for the couples
); );
scalarField& lambdaIf = lambda; scalarField& lambdaIf = lambda;
@ -406,6 +411,9 @@ void Foam::MULES::limiter
{ {
label pfCelli = pFaceCells[pFacei]; label pfCelli = pFaceCells[pFacei];
psiMaxn[pfCelli] = max(psiMaxn[pfCelli], psiPf[pFacei]);
psiMinn[pfCelli] = min(psiMinn[pfCelli], psiPf[pFacei]);
psiMaxn[pfCelli] = max(psiMaxn[pfCelli], psiPNf[pFacei]); psiMaxn[pfCelli] = max(psiMaxn[pfCelli], psiPNf[pFacei]);
psiMinn[pfCelli] = min(psiMinn[pfCelli], psiPNf[pFacei]); psiMinn[pfCelli] = min(psiMinn[pfCelli], psiPNf[pFacei]);
} }