Merge commit '4be7661f1d586bad69ddad93b4463cc683b7f671' into nextRelease

This commit is contained in:
Hrvoje Jasak 2018-02-07 12:09:04 +00:00
commit 9af1e121aa
10 changed files with 663 additions and 87 deletions

View file

@ -1036,6 +1036,30 @@ void checkMethod
}
template<class Type>
void checkMethod
(
const faMatrix<Type>& fam,
const DimensionedField<Type, areaMesh>& vf,
const char* op
)
{
if (dimensionSet::debug && fam.dimensions()/dimArea != vf.dimensions())
{
FatalErrorIn
(
"checkMethod(const faMatrix<Type>&, const DimensionedField<Type, "
"areaMesh>&)"
) << "incompatible dimensions for operation "
<< endl << " "
<< "[" << fam.psi().name() << fam.dimensions()/dimArea << " ] "
<< op
<< " [" << vf.name() << vf.dimensions() << " ]"
<< abort(FatalError);
}
}
template<class Type>
void checkMethod
(
@ -1103,6 +1127,32 @@ lduSolverPerformance solve(const tmp<faMatrix<Type> >& tfam)
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
// Unary operators for negation
template<class Type>
tmp<faMatrix<Type> > operator-
(
const faMatrix<Type>& A
)
{
tmp<faMatrix<Type> > tC(new faMatrix<Type>(A));
tC().negate();
return tC;
}
template<class Type>
tmp<faMatrix<Type> > operator-
(
const tmp<faMatrix<Type> >& tA
)
{
tmp<faMatrix<Type> > tC(tA.ptr());
tC().negate();
return tC;
}
// Operators for faMatrix and faMatrix
template<class Type>
tmp<faMatrix<Type> > operator+
(
@ -1160,30 +1210,6 @@ tmp<faMatrix<Type> > operator+
}
template<class Type>
tmp<faMatrix<Type> > operator-
(
const faMatrix<Type>& A
)
{
tmp<faMatrix<Type> > tC(new faMatrix<Type>(A));
tC().negate();
return tC;
}
template<class Type>
tmp<faMatrix<Type> > operator-
(
const tmp<faMatrix<Type> >& tA
)
{
tmp<faMatrix<Type> > tC(tA.ptr());
tC().negate();
return tC;
}
template<class Type>
tmp<faMatrix<Type> > operator-
(
@ -1290,6 +1316,7 @@ tmp<faMatrix<Type> > operator==
}
// Operators for faMatrix and GeometricField
template<class Type>
tmp<faMatrix<Type> > operator+
(
@ -1516,6 +1543,238 @@ tmp<faMatrix<Type> > operator-
}
// Operators for faMatrix and DimensionedField
template<class Type>
tmp<faMatrix<Type> > operator+
(
const faMatrix<Type>& A,
const DimensionedField<Type, areaMesh>& su
)
{
checkMethod(A, su, "+");
tmp<faMatrix<Type> > tC(new faMatrix<Type>(A));
tC().source() -= su.mesh().S()*su.field();
return tC;
}
template<class Type>
tmp<faMatrix<Type> > operator+
(
const tmp<faMatrix<Type> >& tA,
const DimensionedField<Type, areaMesh>& su
)
{
checkMethod(tA(), su, "+");
tmp<faMatrix<Type> > tC(tA.ptr());
tC().source() -= su.mesh().S()*su.field();
return tC;
}
template<class Type>
tmp<faMatrix<Type> > operator+
(
const faMatrix<Type>& A,
const tmp<DimensionedField<Type, areaMesh> >& tsu
)
{
checkMethod(A, tsu(), "+");
tmp<faMatrix<Type> > tC(new faMatrix<Type>(A));
tC().source() -= tsu().mesh().S()*tsu().field();
tsu.clear();
return tC;
}
template<class Type>
tmp<faMatrix<Type> > operator+
(
const tmp<faMatrix<Type> >& tA,
const tmp<DimensionedField<Type, areaMesh> >& tsu
)
{
checkMethod(tA(), tsu(), "+");
tmp<faMatrix<Type> > tC(tA.ptr());
tC().source() -= tsu().mesh().S()*tsu().field();
tsu.clear();
return tC;
}
template<class Type>
tmp<faMatrix<Type> > operator+
(
const DimensionedField<Type, areaMesh>& su,
const faMatrix<Type>& A
)
{
checkMethod(A, su, "+");
tmp<faMatrix<Type> > tC(new faMatrix<Type>(A));
tC().source() -= su.mesh().S()*su.field();
return tC;
}
template<class Type>
tmp<faMatrix<Type> > operator+
(
const DimensionedField<Type, areaMesh>& su,
const tmp<faMatrix<Type> >& tA
)
{
checkMethod(tA(), su, "+");
tmp<faMatrix<Type> > tC(tA.ptr());
tC().source() -= su.mesh().S()*su.field();
return tC;
}
template<class Type>
tmp<faMatrix<Type> > operator+
(
const tmp<DimensionedField<Type, areaMesh> >& tsu,
const faMatrix<Type>& A
)
{
checkMethod(A, tsu(), "+");
tmp<faMatrix<Type> > tC(new faMatrix<Type>(A));
tC().source() -= tsu().mesh().S()*tsu().field();
tsu.clear();
return tC;
}
template<class Type>
tmp<faMatrix<Type> > operator+
(
const tmp<DimensionedField<Type, areaMesh> >& tsu,
const tmp<faMatrix<Type> >& tA
)
{
checkMethod(tA(), tsu(), "+");
tmp<faMatrix<Type> > tC(tA.ptr());
tC().source() -= tsu().mesh().S()*tsu().field();
tsu.clear();
return tC;
}
template<class Type>
tmp<faMatrix<Type> > operator-
(
const faMatrix<Type>& A,
const DimensionedField<Type, areaMesh>& su
)
{
checkMethod(A, su, "-");
tmp<faMatrix<Type> > tC(new faMatrix<Type>(A));
tC().source() += su.mesh().S()*su.field();
return tC;
}
template<class Type>
tmp<faMatrix<Type> > operator-
(
const tmp<faMatrix<Type> >& tA,
const DimensionedField<Type, areaMesh>& su
)
{
checkMethod(tA(), su, "-");
tmp<faMatrix<Type> > tC(tA.ptr());
tC().source() += su.mesh().S()*su.field();
return tC;
}
template<class Type>
tmp<faMatrix<Type> > operator-
(
const faMatrix<Type>& A,
const tmp<DimensionedField<Type, areaMesh> >& tsu
)
{
checkMethod(A, tsu(), "-");
tmp<faMatrix<Type> > tC(new faMatrix<Type>(A));
tC().source() += tsu().mesh().S()*tsu().field();
tsu.clear();
return tC;
}
template<class Type>
tmp<faMatrix<Type> > operator-
(
const tmp<faMatrix<Type> >& tA,
const tmp<DimensionedField<Type, areaMesh> >& tsu
)
{
checkMethod(tA(), tsu(), "-");
tmp<faMatrix<Type> > tC(tA.ptr());
tC().source() += tsu().mesh().S()*tsu().field();
tsu.clear();
return tC;
}
template<class Type>
tmp<faMatrix<Type> > operator-
(
const DimensionedField<Type, areaMesh>& su,
const faMatrix<Type>& A
)
{
checkMethod(A, su, "-");
tmp<faMatrix<Type> > tC(new faMatrix<Type>(A));
tC().negate();
tC().source() -= su.mesh().S()*su.field();
return tC;
}
template<class Type>
tmp<faMatrix<Type> > operator-
(
const DimensionedField<Type, areaMesh>& su,
const tmp<faMatrix<Type> >& tA
)
{
checkMethod(tA(), su, "-");
tmp<faMatrix<Type> > tC(tA.ptr());
tC().negate();
tC().source() -= su.mesh().S()*su.field();
return tC;
}
template<class Type>
tmp<faMatrix<Type> > operator-
(
const tmp<DimensionedField<Type, areaMesh> >& tsu,
const faMatrix<Type>& A
)
{
checkMethod(A, tsu(), "-");
tmp<faMatrix<Type> > tC(new faMatrix<Type>(A));
tC().negate();
tC().source() -= tsu().mesh().S()*tsu().field();
tsu.clear();
return tC;
}
template<class Type>
tmp<faMatrix<Type> > operator-
(
const tmp<DimensionedField<Type, areaMesh> >& tsu,
const tmp<faMatrix<Type> >& tA
)
{
checkMethod(tA(), tsu(), "-");
tmp<faMatrix<Type> > tC(tA.ptr());
tC().negate();
tC().source() -= tsu().mesh().S()*tsu().field();
tsu.clear();
return tC;
}
// Operators for faMatrix and dimensionedType
template<class Type>
tmp<faMatrix<Type> > operator+
(
@ -1530,6 +1789,49 @@ tmp<faMatrix<Type> > operator+
}
template<class Type>
tmp<faMatrix<Type> > operator+
(
const dimensioned<Type>& su,
const faMatrix<Type>& A
)
{
checkMethod(A, su, "+");
tmp<faMatrix<Type> > tC(new faMatrix<Type>(A));
tC().source() -= su.value()*A.psi().mesh().S();
return tC;
}
template<class Type>
tmp<faMatrix<Type> > operator-
(
const faMatrix<Type>& A,
const dimensioned<Type>& su
)
{
checkMethod(A, su, "-");
tmp<faMatrix<Type> > tC(new faMatrix<Type>(A));
tC().source() += su.value()*tC().psi().mesh().S();
return tC;
}
template<class Type>
tmp<faMatrix<Type> > operator-
(
const dimensioned<Type>& su,
const faMatrix<Type>& A
)
{
checkMethod(A, su, "-");
tmp<faMatrix<Type> > tC(new faMatrix<Type>(A));
tC().negate();
tC().source() -= su.value()*A.psi().mesh().S();
return tC;
}
template<class Type>
tmp<faMatrix<Type> > operator+
(
@ -1544,20 +1846,6 @@ tmp<faMatrix<Type> > operator+
}
template<class Type>
tmp<faMatrix<Type> > operator+
(
const dimensioned<Type>& su,
const faMatrix<Type>& A
)
{
checkMethod(A, su, "+");
tmp<faMatrix<Type> > tC(new faMatrix<Type>(A));
tC().source() -= su.value()*A.psi().mesh().S();
return tC;
}
template<class Type>
tmp<faMatrix<Type> > operator+
(
@ -1572,20 +1860,6 @@ tmp<faMatrix<Type> > operator+
}
template<class Type>
tmp<faMatrix<Type> > operator-
(
const faMatrix<Type>& A,
const dimensioned<Type>& su
)
{
checkMethod(A, su, "-");
tmp<faMatrix<Type> > tC(new faMatrix<Type>(A));
tC().source() += su.value()*tC().psi().mesh().S();
return tC;
}
template<class Type>
tmp<faMatrix<Type> > operator-
(
@ -1600,21 +1874,6 @@ tmp<faMatrix<Type> > operator-
}
template<class Type>
tmp<faMatrix<Type> > operator-
(
const dimensioned<Type>& su,
const faMatrix<Type>& A
)
{
checkMethod(A, su, "-");
tmp<faMatrix<Type> > tC(new faMatrix<Type>(A));
tC().negate();
tC().source() -= su.value()*A.psi().mesh().S();
return tC;
}
template<class Type>
tmp<faMatrix<Type> > operator-
(
@ -1630,6 +1889,9 @@ tmp<faMatrix<Type> > operator-
}
// Subtraction operators
// Operations for faMatrix and GeometricField
template<class Type>
tmp<faMatrix<Type> > operator==
(
@ -1685,6 +1947,7 @@ tmp<faMatrix<Type> > operator==
}
// Operators for faMatrix and dimensionedType
template<class Type>
tmp<faMatrix<Type> > operator==
(
@ -1713,6 +1976,9 @@ tmp<faMatrix<Type> > operator==
}
// Multiplication operators
// Operators for faMatrix and areaScalarField
template<class Type>
tmp<faMatrix<Type> > operator*
(
@ -1762,6 +2028,7 @@ tmp<faMatrix<Type> > operator*
}
// Operators for faMatrix and dimensionedScalar
template<class Type>
tmp<faMatrix<Type> > operator*
(

View file

@ -384,6 +384,14 @@ void checkMethod
const char*
);
template<class Type>
void checkMethod
(
const faMatrix<Type>&,
const GeometricField<Type, faPatchField, areaMesh>&,
const char*
);
template<class Type>
void checkMethod
(
@ -421,6 +429,7 @@ lduSolverPerformance solve(const tmp<faMatrix<Type> >&);
// * * * * * * * * * * * * * * * Global operators * * * * * * * * * * * * * //
// Unary operators for negation
template<class Type>
tmp<faMatrix<Type> > operator-
(
@ -433,6 +442,7 @@ tmp<faMatrix<Type> > operator-
const tmp<faMatrix<Type> >&
);
// Operators for faMatrix and faMatrix
template<class Type>
tmp<faMatrix<Type> > operator+
(
@ -517,6 +527,8 @@ tmp<faMatrix<Type> > operator==
const tmp<faMatrix<Type> >&
);
// Operators for faMatrix and GeometricField
template<class Type>
tmp<faMatrix<Type> > operator+
(
@ -629,6 +641,150 @@ tmp<faMatrix<Type> > operator-
const tmp<faMatrix<Type> >&
);
// Operators for faMatrix and DimensionedField
template<class Type>
tmp<faMatrix<Type> > operator+
(
const faMatrix<Type>&,
const DimensionedField<Type, areaMesh>&
);
template<class Type>
tmp<faMatrix<Type> > operator+
(
const tmp<faMatrix<Type> >&,
const DimensionedField<Type, areaMesh>&
);
template<class Type>
tmp<faMatrix<Type> > operator+
(
const faMatrix<Type>&,
const tmp<DimensionedField<Type, areaMesh> >&
);
template<class Type>
tmp<faMatrix<Type> > operator+
(
const tmp<faMatrix<Type> >&,
const tmp<DimensionedField<Type, areaMesh> >&
);
template<class Type>
tmp<faMatrix<Type> > operator+
(
const DimensionedField<Type, areaMesh>&,
const faMatrix<Type>&
);
template<class Type>
tmp<faMatrix<Type> > operator+
(
const DimensionedField<Type, areaMesh>&,
const tmp<faMatrix<Type> >&
);
template<class Type>
tmp<faMatrix<Type> > operator+
(
const tmp<DimensionedField<Type, areaMesh> >&,
const faMatrix<Type>&
);
template<class Type>
tmp<faMatrix<Type> > operator+
(
const tmp<DimensionedField<Type, areaMesh> >&,
const tmp<faMatrix<Type> >&
);
template<class Type>
tmp<faMatrix<Type> > operator-
(
const faMatrix<Type>&,
const DimensionedField<Type, areaMesh>&
);
template<class Type>
tmp<faMatrix<Type> > operator-
(
const tmp<faMatrix<Type> >&,
const DimensionedField<Type, areaMesh>&
);
template<class Type>
tmp<faMatrix<Type> > operator-
(
const faMatrix<Type>&,
const tmp<DimensionedField<Type, areaMesh> >&
);
template<class Type>
tmp<faMatrix<Type> > operator-
(
const tmp<faMatrix<Type> >&,
const tmp<DimensionedField<Type, areaMesh> >&
);
template<class Type>
tmp<faMatrix<Type> > operator-
(
const DimensionedField<Type, areaMesh>&,
const faMatrix<Type>&
);
template<class Type>
tmp<faMatrix<Type> > operator-
(
const DimensionedField<Type, areaMesh>&,
const tmp<faMatrix<Type> >&
);
template<class Type>
tmp<faMatrix<Type> > operator-
(
const tmp<DimensionedField<Type, areaMesh> >&,
const faMatrix<Type>&
);
template<class Type>
tmp<faMatrix<Type> > operator-
(
const tmp<DimensionedField<Type, areaMesh> >&,
const tmp<faMatrix<Type> >&
);
// Operators for faMatrix and dimensionedType
template<class Type>
tmp<faMatrix<Type> > operator+
(
const faMatrix<Type>&,
const dimensioned<Type>&
);
template<class Type>
tmp<faMatrix<Type> > operator+
(
const dimensioned<Type>&,
const faMatrix<Type>&
);
template<class Type>
tmp<faMatrix<Type> > operator-
(
const faMatrix<Type>&,
const dimensioned<Type>&
);
template<class Type>
tmp<faMatrix<Type> > operator-
(
const dimensioned<Type>&,
const faMatrix<Type>&
);
template<class Type>
tmp<faMatrix<Type> > operator+
(
@ -657,6 +813,10 @@ tmp<faMatrix<Type> > operator-
const tmp<faMatrix<Type> >&
);
// Subtraction operators
// Operators for faMatrix and GeometricField
template<class Type>
tmp<faMatrix<Type> > operator==
(
@ -685,6 +845,7 @@ tmp<faMatrix<Type> > operator==
const tmp<GeometricField<Type, faPatchField, areaMesh> >&
);
// Operators for faMatrix and dimensionedType
template<class Type>
tmp<faMatrix<Type> > operator==
(
@ -700,6 +861,9 @@ tmp<faMatrix<Type> > operator==
);
// Multiplication operators
// Operators for faMatrix and areaScalarField
template<class Type>
tmp<faMatrix<Type> > operator*
(
@ -728,7 +892,7 @@ tmp<faMatrix<Type> > operator*
const tmp<faMatrix<Type> >&
);
// Operators for faMatrix and dimensionedScalar
template<class Type>
tmp<faMatrix<Type> > operator*
(

View file

@ -189,6 +189,9 @@ tmp<Field<Type> > ggiFvPatchField<Type>::patchNeighbourField() const
// Note: bridging now takes into account fully uncovered and partially
// covered faces. VV, 18/Oct/2017.
ggiPatch_.bridge(bridgeField, pnf);
// Correct partially overlapping (partially bridged) faces
ggiPatch_.correctPartialFaces(bridgeField, pnf);
}
return tpnf;

View file

@ -154,6 +154,18 @@ public:
return ggiPolyPatch_.bridge(bridgeField, ff);
}
//- Correct partially overlapping (partially bridged) faces
template<class Type>
void correctPartialFaces
(
const Field<Type>& bridgeField,
Field<Type>& ff
)
const
{
return ggiPolyPatch_.correctPartialFaces(bridgeField, ff);
}
// Interface transfer functions

View file

@ -84,7 +84,7 @@ sendField
// This needs complete rewrite:
// - move communications into a patch
// - allow for various types of communication - done HR, 12/6/2017
// HR, 12/6/2017
// HJ, 15/Apr/2009
if (commsType == Pstream::blocking || commsType == Pstream::scheduled)

View file

@ -501,6 +501,28 @@ class GGIInterpolation
const scalarField& coveredFractions
);
//- Correct partially covered faces given addressing
template<class Type>
static void correctPartiallyCoveredFaces
(
const Field<Type>& bridgeField,
Field<Type>& result,
const labelList& partiallyCoveredAddr,
const scalarField& coveredFractions
);
//- Correct partially covered faces given addressing for masked faces
// only
template<class Type>
static void maskedCorrectPartiallyCoveredFaces
(
const Field<Type>& bridgeField,
Field<Type>& result,
const labelList& mask,
const labelList& partiallyCoveredAddr,
const scalarField& coveredFractions
);
//- Is a transform required?
inline bool doTransform() const
{
@ -665,6 +687,24 @@ public:
const labelList& mask
) const;
//- Correct partially covered master patch field
template<class Type>
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;
//- Bridge uncovered slave patch field
template<class Type>
void bridgeSlave
@ -682,6 +722,24 @@ public:
const labelList& mask
) const;
//- Correct partially covered slave patch field
template<class Type>
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;
//- Interpolate point field
template<class Type>
tmp<Field<Type> > masterToSlavePointInterpolate

View file

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

View file

@ -267,4 +267,70 @@ void Foam::ggiPolyPatch::bridge
}
template<class Type>
void Foam::ggiPolyPatch::correctPartialFaces
(
const Field<Type>& bridgeField,
Field<Type>& ff
) const
{
// Check
if (ff.size() != size())
{
FatalErrorIn
(
"tmp<Field<Type> > ggiPolyPatch::correctPartialFaces\n"
"(\n"
" Field<Type>& ff\n"
") const"
) << "Incorrect patch field size for partial face correction. "
<< "Field size: " << ff.size() << " patch size: " << size()
<< abort(FatalError);
}
if (bridgeOverlap())
{
if (empty())
{
// Patch empty, no bridging
return;
}
if (localParallel())
{
if (master())
{
patchToPatch().correctPartialMaster(bridgeField, ff);
}
else
{
patchToPatch().correctPartialSlave(bridgeField, ff);
}
}
else
{
// Note: since bridging is only a local operation
if (master())
{
patchToPatch().maskedCorrectPartialMaster
(
bridgeField,
ff,
zoneAddressing()
);
}
else
{
patchToPatch().maskedCorrectPartialSlave
(
bridgeField,
ff,
zoneAddressing()
);
}
}
}
}
// ************************************************************************* //

View file

@ -50,7 +50,7 @@ adjustTimeStep yes;
maxDeltaT 3600;
functions
(
(
probes1
{
type probes; // Type of functionObject
@ -60,6 +60,7 @@ functions
(
(0.5 0.5 1.)
);
// Fields to be probed. runTime modifiable!
fields
(
@ -69,10 +70,7 @@ functions
outputControl timeStep;
outputInterval 1;
}
);
);
//libs ( "libOpenFOAM.so" );
//libs ("libuserBCs.so");
// ************************************************************************* //