Limiters: preparation
This commit is contained in:
parent
400afe8ec6
commit
a55eb64d4c
12 changed files with 149 additions and 13 deletions
|
@ -533,6 +533,7 @@ fields/cloud/cloud.C
|
||||||
Fields = fields/Fields
|
Fields = fields/Fields
|
||||||
$(Fields)/labelField/labelField.C
|
$(Fields)/labelField/labelField.C
|
||||||
$(Fields)/scalarField/scalarField.C
|
$(Fields)/scalarField/scalarField.C
|
||||||
|
$(Fields)/vectorField/vectorField.C
|
||||||
$(Fields)/sphericalTensorField/sphericalTensorField.C
|
$(Fields)/sphericalTensorField/sphericalTensorField.C
|
||||||
$(Fields)/diagTensorField/diagTensorField.C
|
$(Fields)/diagTensorField/diagTensorField.C
|
||||||
$(Fields)/symmTensorField/symmTensorField.C
|
$(Fields)/symmTensorField/symmTensorField.C
|
||||||
|
|
|
@ -52,6 +52,9 @@ UNARY_FUNCTION(CmptType, vectorType, cmptSum) \
|
||||||
BINARY_FUNCTION(vectorType, vectorType, vectorType, cmptMultiply) \
|
BINARY_FUNCTION(vectorType, vectorType, vectorType, cmptMultiply) \
|
||||||
BINARY_TYPE_FUNCTION(vectorType, vectorType, vectorType, cmptMultiply) \
|
BINARY_TYPE_FUNCTION(vectorType, vectorType, vectorType, cmptMultiply) \
|
||||||
\
|
\
|
||||||
|
BINARY_FUNCTION(vectorType, vectorType, CmptType, scaleRow) \
|
||||||
|
BINARY_TYPE_FUNCTION(vectorType, vectorType, CmptType, scaleRow) \
|
||||||
|
\
|
||||||
BINARY_OPERATOR(vectorType, CmptType, vectorType, /, divide) \
|
BINARY_OPERATOR(vectorType, CmptType, vectorType, /, divide) \
|
||||||
BINARY_TYPE_OPERATOR(vectorType, CmptType, vectorType, /, divide) \
|
BINARY_TYPE_OPERATOR(vectorType, CmptType, vectorType, /, divide) \
|
||||||
\
|
\
|
||||||
|
|
|
@ -35,7 +35,7 @@ License
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * global functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
UNARY_FUNCTION(scalar, tensor, tr)
|
UNARY_FUNCTION(scalar, tensor, tr)
|
||||||
UNARY_FUNCTION(sphericalTensor, tensor, sph)
|
UNARY_FUNCTION(sphericalTensor, tensor, sph)
|
||||||
|
@ -160,7 +160,11 @@ tmp<Field<tensor> > transformFieldMask<tensor>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * global operators * * * * * * * * * * * * * //
|
BINARY_FUNCTION(tensor, tensor, vector, scaleRow)
|
||||||
|
BINARY_TYPE_FUNCTION(tensor, tensor, vector, scaleRow)
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
UNARY_OPERATOR(vector, tensor, *, hdual)
|
UNARY_OPERATOR(vector, tensor, *, hdual)
|
||||||
UNARY_OPERATOR(tensor, vector, *, hdual)
|
UNARY_OPERATOR(tensor, vector, *, hdual)
|
||||||
|
|
|
@ -51,7 +51,7 @@ namespace Foam
|
||||||
|
|
||||||
typedef Field<tensor> tensorField;
|
typedef Field<tensor> tensorField;
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
UNARY_FUNCTION(scalar, tensor, tr)
|
UNARY_FUNCTION(scalar, tensor, tr)
|
||||||
UNARY_FUNCTION(sphericalTensor, tensor, sph)
|
UNARY_FUNCTION(sphericalTensor, tensor, sph)
|
||||||
|
@ -70,8 +70,11 @@ UNARY_FUNCTION(tensor, tensor, hinv)
|
||||||
UNARY_FUNCTION(vector, symmTensor, eigenValues)
|
UNARY_FUNCTION(vector, symmTensor, eigenValues)
|
||||||
UNARY_FUNCTION(tensor, symmTensor, eigenVectors)
|
UNARY_FUNCTION(tensor, symmTensor, eigenVectors)
|
||||||
|
|
||||||
|
BINARY_FUNCTION(tensor, tensor, vector, scaleRow)
|
||||||
|
BINARY_TYPE_FUNCTION(tensor, tensor, vector, scaleRow)
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * global operators * * * * * * * * * * * * * //
|
|
||||||
|
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
UNARY_OPERATOR(vector, tensor, *, hdual)
|
UNARY_OPERATOR(vector, tensor, *, hdual)
|
||||||
UNARY_OPERATOR(tensor, vector, *, hdual)
|
UNARY_OPERATOR(tensor, vector, *, hdual)
|
||||||
|
|
50
src/foam/fields/Fields/vectorField/vectorField.C
Normal file
50
src/foam/fields/Fields/vectorField/vectorField.C
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration | Version: 3.2
|
||||||
|
\\ / A nd | Web: http://www.foam-extend.org
|
||||||
|
\\/ M anipulation | For copyright notice see file Copyright
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of foam-extend.
|
||||||
|
|
||||||
|
foam-extend is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
foam-extend is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "vectorField.H"
|
||||||
|
|
||||||
|
#define TEMPLATE
|
||||||
|
#include "FieldFunctionsM.C"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
BINARY_FUNCTION(vector, vector, scalar, scaleRow)
|
||||||
|
BINARY_TYPE_FUNCTION(vector, vector, scalar, scaleRow)
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "undefFieldFunctionsM.H"
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -38,6 +38,9 @@ SourceFiles
|
||||||
#include "scalarField.H"
|
#include "scalarField.H"
|
||||||
#include "vector.H"
|
#include "vector.H"
|
||||||
|
|
||||||
|
#define TEMPLATE
|
||||||
|
#include "FieldFunctionsM.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
|
@ -47,12 +50,23 @@ namespace Foam
|
||||||
|
|
||||||
typedef Field<vector> vectorField;
|
typedef Field<vector> vectorField;
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
BINARY_FUNCTION(vector, vector, scalar, scaleRow)
|
||||||
|
BINARY_TYPE_FUNCTION(vector, vector, scalar, scaleRow)
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "undefFieldFunctionsM.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|
|
@ -567,6 +567,19 @@ inline Cmpt invariantIII(const Tensor<Cmpt>& t)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Scale row
|
||||||
|
template <class Cmpt>
|
||||||
|
inline Tensor<Cmpt> scaleRow(const Tensor<Cmpt>& t, const Vector<Cmpt>& v)
|
||||||
|
{
|
||||||
|
return Tensor<Cmpt>
|
||||||
|
(
|
||||||
|
t.xx()*v.x(), t.xy()*v.x(), t.xz()*v.x(),
|
||||||
|
t.yx()*v.y(), t.yy()*v.y(), t.yz()*v.y(),
|
||||||
|
t.zx()*v.z(), t.zy()*v.z(), t.zz()*v.z()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * Mixed Tensor SphericalTensor Operators * * * * * * * * //
|
// * * * * * * * * * Mixed Tensor SphericalTensor Operators * * * * * * * * //
|
||||||
|
|
||||||
template <class Cmpt>
|
template <class Cmpt>
|
||||||
|
|
|
@ -156,6 +156,14 @@ inline Vector<Cmpt> operator^(const Vector<Cmpt>& v1, const Vector<Cmpt>& v2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <class Cmpt>
|
||||||
|
inline Vector<Cmpt> scaleRow(const Vector<Cmpt>& v, const Cmpt& c)
|
||||||
|
{
|
||||||
|
// Multiply by scalar
|
||||||
|
return v*c;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
|
@ -121,15 +121,16 @@ public:
|
||||||
const direction j
|
const direction j
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Diagonal
|
//- Return diagonal
|
||||||
inline DiagTensorN<Cmpt, length> diag() const;
|
inline DiagTensorN<Cmpt, length> diag() const;
|
||||||
|
|
||||||
//- Transpose
|
//- Return transpose
|
||||||
inline TensorN<Cmpt, length> T() const;
|
inline TensorN<Cmpt, length> T() const;
|
||||||
|
|
||||||
//- Negative sum the vertical off-diagonal components
|
//- Negative sum the vertical off-diagonal components
|
||||||
inline TensorN<Cmpt, length> negSumDiag() const;
|
inline TensorN<Cmpt, length> negSumDiag() const;
|
||||||
|
|
||||||
|
|
||||||
// Member Operators
|
// Member Operators
|
||||||
|
|
||||||
//- Assign to a SphericalTensorN
|
//- Assign to a SphericalTensorN
|
||||||
|
|
|
@ -1007,6 +1007,29 @@ inline TensorN<Cmpt, length> negSumDiag(const TensorN<Cmpt, length>& t)
|
||||||
return t.negSumDiag();
|
return t.negSumDiag();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Scale tensor row with a VectorN
|
||||||
|
template <class Cmpt, int length>
|
||||||
|
inline TensorN<Cmpt, length> scaleRow
|
||||||
|
(
|
||||||
|
const TensorN<Cmpt, length>& t,
|
||||||
|
const VectorN<Cmpt, length>& v
|
||||||
|
)
|
||||||
|
{
|
||||||
|
TensorN<Cmpt, length> result;
|
||||||
|
|
||||||
|
for (label i = 0; i < TensorN<Cmpt, length>::rowLength; i++)
|
||||||
|
{
|
||||||
|
for (label j = 0; j < TensorN<Cmpt, length>::rowLength; j++)
|
||||||
|
{
|
||||||
|
result(i, j) = t(i, j)*v(j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Return the component sum
|
//- Return the component sum
|
||||||
// template <class Cmpt, int length>
|
// template <class Cmpt, int length>
|
||||||
// inline Cmpt sum(const TensorN<Cmpt, length>& t)
|
// inline Cmpt sum(const TensorN<Cmpt, length>& t)
|
||||||
|
|
|
@ -100,7 +100,7 @@ public:
|
||||||
//- Return access to ith component
|
//- Return access to ith component
|
||||||
inline Cmpt& operator()(const direction i);
|
inline Cmpt& operator()(const direction i);
|
||||||
|
|
||||||
//- Componentwise multiply
|
//- Component-wise multiply
|
||||||
inline VectorN<Cmpt, length> cmptMultiply
|
inline VectorN<Cmpt, length> cmptMultiply
|
||||||
(
|
(
|
||||||
const VectorN<Cmpt, length>&
|
const VectorN<Cmpt, length>&
|
||||||
|
|
|
@ -73,7 +73,8 @@ inline VectorN<Cmpt, length>::VectorN
|
||||||
template <class Cmpt, int length>
|
template <class Cmpt, int length>
|
||||||
inline VectorN<Cmpt, length>::VectorN(const Cmpt& vx)
|
inline VectorN<Cmpt, length>::VectorN(const Cmpt& vx)
|
||||||
{
|
{
|
||||||
VectorSpaceOps<VectorN<Cmpt, length>::nComponents,0>::eqOpS(*this, vx, eqOp<Cmpt>());
|
VectorSpaceOps<VectorN<Cmpt, length>::nComponents,0>::eqOpS
|
||||||
|
(*this, vx, eqOp<Cmpt>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -103,10 +104,12 @@ inline Cmpt& VectorN<Cmpt, length>::operator()(const direction i)
|
||||||
|
|
||||||
//- Multiply components of VectorN by VectorN
|
//- Multiply components of VectorN by VectorN
|
||||||
template<class Cmpt, int length>
|
template<class Cmpt, int length>
|
||||||
inline VectorN<Cmpt, length> VectorN<Cmpt, length>::cmptMultiply(const VectorN<Cmpt, length>& v)
|
inline VectorN<Cmpt, length>
|
||||||
|
VectorN<Cmpt, length>::cmptMultiply(const VectorN<Cmpt, length>& v)
|
||||||
{
|
{
|
||||||
VectorN<Cmpt, length> res;
|
VectorN<Cmpt, length> res;
|
||||||
VectorSpaceOps<VectorN<Cmpt, length>::nComponents,0>::op(res, *this, v, multiplyOp<Cmpt>());
|
VectorSpaceOps<VectorN<Cmpt, length>::nComponents,0>::op
|
||||||
|
(res, *this, v, multiplyOp<Cmpt>());
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,20 +178,33 @@ inline VectorN<Cmpt, length>
|
||||||
operator/(const scalar s, const VectorN<Cmpt, length>& v)
|
operator/(const scalar s, const VectorN<Cmpt, length>& v)
|
||||||
{
|
{
|
||||||
VectorN<Cmpt, length> res;
|
VectorN<Cmpt, length> res;
|
||||||
VectorSpaceOps<VectorN<Cmpt, length>::nComponents,0>::opSV(res, s, v, divideOp3<Cmpt, scalar, Cmpt>());
|
VectorSpaceOps<VectorN<Cmpt, length>::nComponents,0>::opSV
|
||||||
|
(res, s, v, divideOp3<Cmpt, scalar, Cmpt>());
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Multiply components of VectorN by VectorN
|
//- Multiply components of VectorN by VectorN
|
||||||
template<class Cmpt, int length>
|
template<class Cmpt, int length>
|
||||||
inline VectorN<Cmpt, length> cmptMultiply(const VectorN<Cmpt, length>& v1, const VectorN<Cmpt, length>& v2)
|
inline VectorN<Cmpt, length>
|
||||||
|
cmptMultiply(const VectorN<Cmpt, length>& v1, const VectorN<Cmpt, length>& v2)
|
||||||
{
|
{
|
||||||
VectorN<Cmpt, length> res;
|
VectorN<Cmpt, length> res;
|
||||||
VectorSpaceOps<VectorN<Cmpt, length>::nComponents,0>::op(res, v1, v2, multiplyOp<Cmpt>());
|
VectorSpaceOps<VectorN<Cmpt, length>::nComponents,0>::op
|
||||||
|
(res, v1, v2, multiplyOp<Cmpt>());
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Multiply row of VectorN with a scalar
|
||||||
|
template<class Cmpt, int length>
|
||||||
|
inline VectorN<Cmpt, length>
|
||||||
|
scaleRow(const VectorN<Cmpt, length>& v, const Cmpt& c)
|
||||||
|
{
|
||||||
|
return v*c;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Return the component sum
|
//- Return the component sum
|
||||||
// template <class Cmpt, int length>
|
// template <class Cmpt, int length>
|
||||||
// inline Cmpt sum(const VectorN<Cmpt, length>& v)
|
// inline Cmpt sum(const VectorN<Cmpt, length>& v)
|
||||||
|
|
Reference in a new issue