Temporary commit - not working properly

This commit is contained in:
Vuko Vukcevic 2017-10-16 12:11:59 +02:00
parent 3aa2b659a3
commit 6a512f13f7
7 changed files with 92 additions and 28 deletions

View file

@ -189,8 +189,8 @@ tmp<Field<Type> > ggiFvPatchField<Type>::patchNeighbourField() const
ggiPatch_.bridge(bridgeField, pnf);
// Correct partially overlapping (bridged) faces
ggiPatch_.correctPartialFaces(pnf);
// Correct partially overlapping (partially bridged) faces
ggiPatch_.correctPartialFaces(bridgeField, pnf);
}
return tpnf;

View file

@ -78,7 +78,10 @@ void Foam::ggiFvPatch::makeWeights(scalarField& w) const
{
// Set overlap weights to 0.5 and use mirrored neighbour field
// for interpolation. HJ, 21/Jan/2009
bridge(scalarField(size(), 0.5), w);
const scalarField bridgedField(size(), 0.5);
bridge(bridgedField, w);
correctPartialFaces(bridgedField, w);
}
Info<< "Master weights: " << w << endl;
@ -97,9 +100,13 @@ void Foam::ggiFvPatch::makeWeights(scalarField& w) const
{
// Set overlap weights to 0.5 and use mirrored neighbour field
// for interpolation. HJ, 21/Jan/2009
bridge(scalarField(size(), 0.5), w);
const scalarField bridgedField(size(), 0.5);
bridge(bridgedField, w);
correctPartialFaces(bridgedField, w);
}
// w = 0.5;
Info<< "Slave weights: " << w << endl;
}
}
@ -117,11 +124,12 @@ void Foam::ggiFvPatch::makeDeltaCoeffs(scalarField& dc) const
if (bridgeOverlap())
{
scalarField bridgeDeltas = nf() & fvPatch::delta();
const scalarField bridgeDeltas = nf() & fvPatch::delta();
bridge(bridgeDeltas, dc);
correctPartialFaces(bridgeDeltas, dc);
}
Info<< "Master deltaCoeffs: " << dc << endl;
}
else
@ -132,11 +140,13 @@ void Foam::ggiFvPatch::makeDeltaCoeffs(scalarField& dc) const
if (bridgeOverlap())
{
scalarField bridgeDeltas = nf() & fvPatch::delta();
const scalarField bridgeDeltas = nf() & fvPatch::delta();
bridge(bridgeDeltas, dc);
correctPartialFaces(bridgeDeltas, dc);
}
dc = 1.0;
Info<< "Slave deltaCoeffs: " << dc << endl;
}
}
@ -169,11 +179,14 @@ Foam::tmp<Foam::vectorField> Foam::ggiFvPatch::delta() const
if (bridgeOverlap())
{
vectorField bridgeDeltas = Cf() - Cn();
const vectorField bridgeDeltas = Cf() - Cn();
bridge(bridgeDeltas, tDelta());
correctPartialFaces(bridgeDeltas, tDelta());
}
Info<< "Master deltas: " << tDelta() << endl;
return tDelta;
}
else
@ -185,11 +198,15 @@ Foam::tmp<Foam::vectorField> Foam::ggiFvPatch::delta() const
if (bridgeOverlap())
{
vectorField bridgeDeltas = Cf() - Cn();
const vectorField bridgeDeltas = Cf() - Cn();
bridge(bridgeDeltas, tDelta());
correctPartialFaces(bridgeDeltas, tDelta());
}
tDelta() = vector(0, 0, -1);
Info<< "Slave deltas: " << tDelta() << endl;
return tDelta;
}
}

View file

@ -156,9 +156,14 @@ public:
//- Correct partially overlapping (partially bridged) faces
template<class Type>
void correctPartialFaces(Field<Type>& ff) const
void correctPartialFaces
(
const Field<Type>& bridgeField,
Field<Type>& ff
)
const
{
return ggiPolyPatch_.correctPartialFaces(ff);
return ggiPolyPatch_.correctPartialFaces(bridgeField, ff);
}

View file

@ -162,27 +162,30 @@ template<class MasterPatch, class SlavePatch>
template<class Type>
void GGIInterpolation<MasterPatch, SlavePatch>::correctPartiallyCoveredFaces
(
const Field<Type>& bridgeField,
Field<Type>& result,
const labelList& partiallyCoveredAddr,
const scalarField& coveredFractions
)
{
// Loop through partially covered faces and scale them down with the covered
// face fraction. Note the operator*= since we assume that the interpolation
// part is carried out before bridging (see
// e.g. ggiFvPatchField::patchNeighbourField()) using weights that do not
// sum up to 1
// Loop through partially covered faces and correct them. Note the
// operator+= since we assume that the interpolation part is carried out
// before bridging (see e.g. ggiFvPatchField::patchNeighbourField()) using
// weights that do not sum up to 1
forAll (partiallyCoveredAddr, pcfI)
{
result[partiallyCoveredAddr[pcfI]] *= coveredFractions[pcfI];
result[partiallyCoveredAddr[pcfI]] +=
coveredFractions[pcfI]*bridgeField[partiallyCoveredAddr[pcfI]];
}
}
template<class MasterPatch, class SlavePatch>
template<class Type>
void GGIInterpolation<MasterPatch, SlavePatch>::maskedCorrectPartiallyCoveredFaces
void GGIInterpolation<MasterPatch, SlavePatch>::
maskedCorrectPartiallyCoveredFaces
(
const Field<Type>& bridgeField,
Field<Type>& result,
const labelList& mask,
const labelList& partiallyCoveredAddr,
@ -203,7 +206,8 @@ void GGIInterpolation<MasterPatch, SlavePatch>::maskedCorrectPartiallyCoveredFac
if (faceI == mask[maskAddrI])
{
// Found masked partially covered face
result[maskAddrI] *= coveredFractions[pcfI];
result[maskAddrI] +=
coveredFractions[pcfI]*bridgeField[partiallyCoveredAddr[pcfI]];
break;
}
@ -639,10 +643,15 @@ template<class MasterPatch, class SlavePatch>
template<class Type>
void GGIInterpolation<MasterPatch, SlavePatch>::correctPartialMaster
(
const Field<Type>& bridgeField,
Field<Type>& ff
) const
{
if (ff.size() != masterPatch_.size())
if
(
bridgeField.size() != masterPatch_.size()
|| ff.size() != masterPatch_.size()
)
{
FatalErrorIn
(
@ -659,6 +668,7 @@ void GGIInterpolation<MasterPatch, SlavePatch>::correctPartialMaster
correctPartiallyCoveredFaces
(
bridgeField,
ff,
partiallyCoveredMasterFaces(),
masterFaceCoveredFractions()
@ -670,6 +680,7 @@ template<class MasterPatch, class SlavePatch>
template<class Type>
void GGIInterpolation<MasterPatch, SlavePatch>::maskedCorrectPartialMaster
(
const Field<Type>& bridgeField,
Field<Type>& ff,
const labelList& mask
) const
@ -691,6 +702,7 @@ void GGIInterpolation<MasterPatch, SlavePatch>::maskedCorrectPartialMaster
maskedCorrectPartiallyCoveredFaces
(
bridgeField,
ff,
mask,
partiallyCoveredMasterFaces(),
@ -773,10 +785,15 @@ template<class MasterPatch, class SlavePatch>
template<class Type>
void GGIInterpolation<MasterPatch, SlavePatch>::correctPartialSlave
(
const Field<Type>& bridgeField,
Field<Type>& ff
) const
{
if (ff.size() != slavePatch_.size())
if
(
bridgeField.size() != slavePatch_.size()
|| ff.size() != slavePatch_.size()
)
{
FatalErrorIn
(
@ -793,6 +810,7 @@ void GGIInterpolation<MasterPatch, SlavePatch>::correctPartialSlave
correctPartiallyCoveredFaces
(
bridgeField,
ff,
partiallyCoveredSlaveFaces(),
slaveFaceCoveredFractions()
@ -804,6 +822,7 @@ template<class MasterPatch, class SlavePatch>
template<class Type>
void GGIInterpolation<MasterPatch, SlavePatch>::maskedCorrectPartialSlave
(
const Field<Type>& bridgeField,
Field<Type>& ff,
const labelList& mask
) const
@ -825,6 +844,7 @@ void GGIInterpolation<MasterPatch, SlavePatch>::maskedCorrectPartialSlave
maskedCorrectPartiallyCoveredFaces
(
bridgeField,
ff,
mask,
partiallyCoveredSlaveFaces(),

View file

@ -501,6 +501,7 @@ class GGIInterpolation
template<class Type>
static void correctPartiallyCoveredFaces
(
const Field<Type>& bridgeField,
Field<Type>& result,
const labelList& partiallyCoveredAddr,
const scalarField& coveredFractions
@ -511,6 +512,7 @@ class GGIInterpolation
template<class Type>
static void maskedCorrectPartiallyCoveredFaces
(
const Field<Type>& bridgeField,
Field<Type>& result,
const labelList& mask,
const labelList& partiallyCoveredAddr,
@ -683,13 +685,18 @@ public:
//- Correct partially covered master patch field
template<class Type>
void correctPartialMaster(Field<Type>& ff) const;
void correctPartialMaster
(
const Field<Type>& bridgeField,
Field<Type>& ff
) const;
//- Correct partially covered master patch field, only for marked master
// faces
template<class Type>
void maskedCorrectPartialMaster
(
const Field<Type>& bridgeField,
Field<Type>& ff,
const labelList& mask
) const;
@ -713,13 +720,18 @@ public:
//- Correct partially covered slave patch field
template<class Type>
void correctPartialSlave(Field<Type>& ff) const;
void correctPartialSlave
(
const Field<Type>& bridgeField,
Field<Type>& ff
) const;
//- Correct partially covered slave patch field, only for marked slave
// faces
template<class Type>
void maskedCorrectPartialSlave
(
const Field<Type>& bridgeField,
Field<Type>& ff,
const labelList& mask
) const;

View file

@ -380,7 +380,11 @@ public:
//- Correct interpolated face field for partially covered faces
template<class Type>
void correctPartialFaces(Field<Type>& ff) const;
void correctPartialFaces
(
const Field<Type>& bridgeField,
Field<Type>& ff
) const;
// Geometric data

View file

@ -268,7 +268,11 @@ void Foam::ggiPolyPatch::bridge
template<class Type>
void Foam::ggiPolyPatch::correctPartialFaces(Field<Type>& ff) const
void Foam::ggiPolyPatch::correctPartialFaces
(
const Field<Type>& bridgeField,
Field<Type>& ff
) const
{
// Check
if (ff.size() != size())
@ -296,11 +300,11 @@ void Foam::ggiPolyPatch::correctPartialFaces(Field<Type>& ff) const
{
if (master())
{
patchToPatch().correctPartialMaster(ff);
patchToPatch().correctPartialMaster(bridgeField, ff);
}
else
{
patchToPatch().correctPartialSlave(ff);
patchToPatch().correctPartialSlave(bridgeField, ff);
}
}
else
@ -310,6 +314,7 @@ void Foam::ggiPolyPatch::correctPartialFaces(Field<Type>& ff) const
{
patchToPatch().maskedCorrectPartialMaster
(
bridgeField,
ff,
zoneAddressing()
);
@ -318,6 +323,7 @@ void Foam::ggiPolyPatch::correctPartialFaces(Field<Type>& ff) const
{
patchToPatch().maskedCorrectPartialSlave
(
bridgeField,
ff,
zoneAddressing()
);