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

View file

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

View file

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

View file

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

View file

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