ENH: Further updates to fan and jump BCs

This commit is contained in:
andy
2012-10-29 12:22:04 +00:00
parent f290ad6018
commit 0ef5b1cbfb
10 changed files with 153 additions and 94 deletions

View File

@ -142,43 +142,17 @@ void jumpCyclicFvPatchField<Type>::updateInterfaceMatrix
const Pstream::commsTypes
) const
{
scalarField pnf(this->size());
const labelUList& nbrFaceCells =
this->cyclicPatch().neighbFvPatch().faceCells();
// for AMG solve - only apply jump to finest level
if (psiInternal.size() == this->internalField().size())
{
Field<scalar> jf(this->jump()().component(cmpt));
if (!this->cyclicPatch().owner())
{
jf *= -1.0;
}
forAll(*this, facei)
{
pnf[facei] = psiInternal[nbrFaceCells[facei]] - jf[facei];
}
}
else
{
forAll(*this, facei)
{
pnf[facei] = psiInternal[nbrFaceCells[facei]];
}
}
// Transform according to the transformation tensors
this->transformCoupleField(pnf, cmpt);
// Multiply the field by coefficients and add into the result
const labelUList& faceCells = this->cyclicPatch().faceCells();
forAll(faceCells, elemI)
{
result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
}
notImplemented
(
"void jumpCyclicFvPatchField<Type>::updateInterfaceMatrix"
"("
"scalarField&, "
"const scalarField&, "
"const scalarField&, "
"const direction, "
"const Pstream::commsTypes"
") const"
);
}
@ -196,8 +170,8 @@ void jumpCyclicFvPatchField<Type>::updateInterfaceMatrix
const labelUList& nbrFaceCells =
this->cyclicPatch().neighbFvPatch().faceCells();
// for AMG solve - only apply jump to finest level
if (psiInternal.size() == this->internalField().size())
// only apply jump to original field
if (&psiInternal == &this->internalField())
{
Field<Type> jf(this->jump());

View File

@ -144,6 +144,17 @@ public:
) const;
};
//- Update result field based on interface functionality
template<>
void jumpCyclicFvPatchField<scalar>::updateInterfaceMatrix
(
scalarField& result,
const scalarField& psiInternal,
const scalarField& coeffs,
const direction cmpt,
const Pstream::commsTypes commsType
) const;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,6 +36,58 @@ namespace Foam
makePatchFieldsTypeName(jumpCyclic);
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<>
void jumpCyclicFvPatchField<scalar>::updateInterfaceMatrix
(
scalarField& result,
const scalarField& psiInternal,
const scalarField& coeffs,
const direction cmpt,
const Pstream::commsTypes
) const
{
scalarField pnf(this->size());
const labelUList& nbrFaceCells =
this->cyclicPatch().neighbFvPatch().faceCells();
// only apply jump to original field
if (&psiInternal == &this->internalField())
{
Field<scalar> jf(this->jump());
if (!this->cyclicPatch().owner())
{
jf *= -1.0;
}
forAll(*this, facei)
{
pnf[facei] = psiInternal[nbrFaceCells[facei]] - jf[facei];
}
}
else
{
forAll(*this, facei)
{
pnf[facei] = psiInternal[nbrFaceCells[facei]];
}
}
// Transform according to the transformation tensors
this->transformCoupleField(pnf, cmpt);
// Multiply the field by coefficients and add into the result
const labelUList& faceCells = this->cyclicPatch().faceCells();
forAll(faceCells, elemI)
{
result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -129,33 +129,17 @@ void Foam::jumpCyclicAMIFvPatchField<Type>::updateInterfaceMatrix
const Pstream::commsTypes
) const
{
const labelUList& nbrFaceCells =
this->cyclicAMIPatch().cyclicAMIPatch().neighbPatch().faceCells();
scalarField pnf(psiInternal, nbrFaceCells);
pnf = this->cyclicAMIPatch().interpolate(pnf);
// for AMG solve - only apply jump to finest level
if (psiInternal.size() == this->internalField().size())
{
tmp<Field<scalar> > tjf = jump()().component(cmpt);
if (!this->cyclicAMIPatch().owner())
{
tjf = -tjf;
}
pnf -= tjf;
}
// Transform according to the transformation tensors
this->transformCoupleField(pnf, cmpt);
// Multiply the field by coefficients and add into the result
const labelUList& faceCells = this->cyclicAMIPatch().faceCells();
forAll(faceCells, elemI)
{
result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
}
notImplemented
(
"void Foam::jumpCyclicAMIFvPatchField<Type>::updateInterfaceMatrix"
"("
"scalarField&, "
"const scalarField&, "
"const scalarField& coeffs,"
"const direction, "
"const Pstream::commsTypes"
") const"
);
}
@ -175,15 +159,16 @@ void Foam::jumpCyclicAMIFvPatchField<Type>::updateInterfaceMatrix
pnf = this->cyclicAMIPatch().interpolate(pnf);
// for AMG solve - only apply jump to finest level
if (psiInternal.size() == this->internalField().size())
// only apply jump to original field
if (&psiInternal == &this->internalField())
{
tmp<Field<Type> > tjf = jump();
Field<Type> jf(this->jump());
if (!this->cyclicAMIPatch().owner())
{
tjf = -tjf;
jf *= -1.0;
}
pnf -= tjf;
pnf -= jf;
}
// Transform according to the transformation tensors

View File

@ -148,6 +148,18 @@ public:
};
//- Update result field based on interface functionality
template<>
void jumpCyclicAMIFvPatchField<scalar>::updateInterfaceMatrix
(
scalarField& result,
const scalarField& psiInternal,
const scalarField& coeffs,
const direction cmpt,
const Pstream::commsTypes commsType
) const;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -36,6 +36,50 @@ namespace Foam
makePatchFieldsTypeName(jumpCyclicAMI);
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<>
void Foam::jumpCyclicAMIFvPatchField<scalar>::updateInterfaceMatrix
(
scalarField& result,
const scalarField& psiInternal,
const scalarField& coeffs,
const direction cmpt,
const Pstream::commsTypes
) const
{
const labelUList& nbrFaceCells =
this->cyclicAMIPatch().cyclicAMIPatch().neighbPatch().faceCells();
scalarField pnf(psiInternal, nbrFaceCells);
pnf = this->cyclicAMIPatch().interpolate(pnf);
// only apply jump to original field
if (&psiInternal == &this->internalField())
{
Field<scalar> jf(this->jump());
if (!this->cyclicAMIPatch().owner())
{
jf *= -1.0;
}
pnf -= jf;
}
// Transform according to the transformation tensors
this->transformCoupleField(pnf, cmpt);
// Multiply the field by coefficients and add into the result
const labelUList& faceCells = this->cyclicAMIPatch().faceCells();
forAll(faceCells, elemI)
{
result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -98,13 +98,6 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Foam::tmp<Foam::Field<Type> > Foam::fanFvPatchField<Type>::jump() const
{
return this->jump_;
}
template<class Type>
void Foam::fanFvPatchField<Type>::updateCoeffs()
{

View File

@ -39,7 +39,6 @@ Description
\table
Property | Description | Required | Default value
patchType | underlying patch type should be \c cyclic| yes |
jump | current jump value | yes |
jumpTable | jump data, e.g. \c csvFile | yes |
\endtable
@ -49,7 +48,6 @@ Description
{
type fan;
patchType cyclic;
jump uniform 0;
jumpTable csvFile;
csvFileCoeffs
{
@ -176,13 +174,8 @@ public:
// Member functions
// Evaluation functions
//- Return the "jump" across the patch
tmp<Field<Type> > jump() const;
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
};

View File

@ -116,11 +116,6 @@ Foam::fanFvPatchField<Foam::scalar>::fanFvPatchField
this->jumpTable_ = DataEntry<scalar>::New("jumpTable", dict);
}
}
else
{
// Dummy jump table
this->jumpTable_.reset(new DataEntry<scalar>("jumpTable"));
}
if (dict.found("value"))
{

View File

@ -35,7 +35,7 @@ Foam::uniformJumpFvPatchField<Type>::uniformJumpFvPatchField
)
:
fixedJumpFvPatchField<Type>(p, iF),
jumpTable_(0)
jumpTable_(new DataEntry<Type>("jumpTable"))
{}