mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
Conflicts: src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C
This commit is contained in:
@ -1351,8 +1351,10 @@ bool Foam::polyMesh::pointInCell
|
||||
|
||||
case FACECENTRETETS:
|
||||
{
|
||||
const point& cc = cellCentres()[cellI];
|
||||
// only test that point is on inside of plane defined by cell face
|
||||
// triangles
|
||||
const cell& cFaces = cells()[cellI];
|
||||
|
||||
forAll(cFaces, cFaceI)
|
||||
{
|
||||
label faceI = cFaces[cFaceI];
|
||||
@ -1376,31 +1378,61 @@ bool Foam::polyMesh::pointInCell
|
||||
nextPointI = f[fp];
|
||||
}
|
||||
|
||||
if
|
||||
(
|
||||
tetPointRef
|
||||
(
|
||||
points()[nextPointI],
|
||||
points()[pointI],
|
||||
fc,
|
||||
cc
|
||||
).inside(p)
|
||||
)
|
||||
const point& p0 = points()[pointI];
|
||||
const point& p1 = points()[nextPointI];
|
||||
const point& p2 = fc;
|
||||
|
||||
vector twoFaceArea = (p1 - p0)^(p2 - p0);
|
||||
point centre = (p0 + p1 + p2)/3.0;
|
||||
vector proj = p - centre;
|
||||
|
||||
if ((twoFaceArea & proj) > 0)
|
||||
{
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
case FACEDIAGTETS:
|
||||
{
|
||||
label tetFaceI, tetPtI;
|
||||
findTetFacePt(cellI, p, tetFaceI, tetPtI);
|
||||
// only test that point is on inside of plane defined by cell face
|
||||
// triangles
|
||||
const cell& cFaces = cells()[cellI];
|
||||
|
||||
return tetFaceI != -1;
|
||||
forAll(cFaces, cFaceI)
|
||||
{
|
||||
label faceI = cFaces[cFaceI];
|
||||
const face& f = faces_[faceI];
|
||||
|
||||
for (label tetPtI = 1; tetPtI < f.size() - 1; tetPtI++)
|
||||
{
|
||||
// Get tetIndices of face triangle
|
||||
tetIndices faceTetIs
|
||||
(
|
||||
polyMeshTetDecomposition::triangleTetIndices
|
||||
(
|
||||
*this,
|
||||
faceI,
|
||||
cellI,
|
||||
tetPtI
|
||||
)
|
||||
);
|
||||
|
||||
triPointRef faceTri = faceTetIs.faceTri(*this);
|
||||
|
||||
vector proj = p - faceTri.centre();
|
||||
|
||||
if ((faceTri.normal() & proj) > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -85,12 +85,12 @@ class tetIndices
|
||||
label faceBasePtI_;
|
||||
|
||||
//- point on the face such that the right-hand circulation
|
||||
// {faceBasePtI_, facePtIA_, facePtBI_}
|
||||
// {faceBasePtI_, facePtAI_, facePtBI_}
|
||||
// forms a triangle that points out of the tet
|
||||
label facePtAI_;
|
||||
|
||||
//- point on the face such that the right-hand circulation
|
||||
// {faceBasePtI_, facePtIA_, facePtBI_}
|
||||
// {faceBasePtI_, facePtAI_, facePtBI_}
|
||||
// forms a triangle that points out of the tet
|
||||
label facePtBI_;
|
||||
|
||||
|
||||
@ -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-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -66,8 +66,6 @@ bool Foam::primitiveMesh::pointInCell(const point& p, label celli) const
|
||||
const vectorField& cf = faceCentres();
|
||||
const vectorField& Sf = faceAreas();
|
||||
|
||||
bool inCell = true;
|
||||
|
||||
forAll(f, facei)
|
||||
{
|
||||
label nFace = f[facei];
|
||||
@ -77,10 +75,14 @@ bool Foam::primitiveMesh::pointInCell(const point& p, label celli) const
|
||||
{
|
||||
normal = -normal;
|
||||
}
|
||||
inCell = inCell && ((normal & proj) <= 0);
|
||||
|
||||
if ((normal & proj) > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return inCell;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -123,12 +123,14 @@ inline Vector<Cmpt> Tensor<Cmpt>::x() const
|
||||
return Vector<Cmpt>(this->v_[XX], this->v_[XY], this->v_[XZ]);
|
||||
}
|
||||
|
||||
|
||||
template<class Cmpt>
|
||||
inline Vector<Cmpt> Tensor<Cmpt>::y() const
|
||||
{
|
||||
return Vector<Cmpt>(this->v_[YX], this->v_[YY], this->v_[YZ]);
|
||||
}
|
||||
|
||||
|
||||
template<class Cmpt>
|
||||
inline Vector<Cmpt> Tensor<Cmpt>::z() const
|
||||
{
|
||||
@ -160,12 +162,14 @@ inline const Cmpt& Tensor<Cmpt>::xx() const
|
||||
return this->v_[XX];
|
||||
}
|
||||
|
||||
|
||||
template<class Cmpt>
|
||||
inline const Cmpt& Tensor<Cmpt>::xy() const
|
||||
{
|
||||
return this->v_[XY];
|
||||
}
|
||||
|
||||
|
||||
template<class Cmpt>
|
||||
inline const Cmpt& Tensor<Cmpt>::xz() const
|
||||
{
|
||||
@ -179,12 +183,14 @@ inline const Cmpt& Tensor<Cmpt>::yx() const
|
||||
return this->v_[YX];
|
||||
}
|
||||
|
||||
|
||||
template<class Cmpt>
|
||||
inline const Cmpt& Tensor<Cmpt>::yy() const
|
||||
{
|
||||
return this->v_[YY];
|
||||
}
|
||||
|
||||
|
||||
template<class Cmpt>
|
||||
inline const Cmpt& Tensor<Cmpt>::yz() const
|
||||
{
|
||||
@ -198,12 +204,14 @@ inline const Cmpt& Tensor<Cmpt>::zx() const
|
||||
return this->v_[ZX];
|
||||
}
|
||||
|
||||
|
||||
template<class Cmpt>
|
||||
inline const Cmpt& Tensor<Cmpt>::zy() const
|
||||
{
|
||||
return this->v_[ZY];
|
||||
}
|
||||
|
||||
|
||||
template<class Cmpt>
|
||||
inline const Cmpt& Tensor<Cmpt>::zz() const
|
||||
{
|
||||
@ -217,12 +225,14 @@ inline Cmpt& Tensor<Cmpt>::xx()
|
||||
return this->v_[XX];
|
||||
}
|
||||
|
||||
|
||||
template<class Cmpt>
|
||||
inline Cmpt& Tensor<Cmpt>::xy()
|
||||
{
|
||||
return this->v_[XY];
|
||||
}
|
||||
|
||||
|
||||
template<class Cmpt>
|
||||
inline Cmpt& Tensor<Cmpt>::xz()
|
||||
{
|
||||
@ -236,12 +246,14 @@ inline Cmpt& Tensor<Cmpt>::yx()
|
||||
return this->v_[YX];
|
||||
}
|
||||
|
||||
|
||||
template<class Cmpt>
|
||||
inline Cmpt& Tensor<Cmpt>::yy()
|
||||
{
|
||||
return this->v_[YY];
|
||||
}
|
||||
|
||||
|
||||
template<class Cmpt>
|
||||
inline Cmpt& Tensor<Cmpt>::yz()
|
||||
{
|
||||
@ -255,12 +267,14 @@ inline Cmpt& Tensor<Cmpt>::zx()
|
||||
return this->v_[ZX];
|
||||
}
|
||||
|
||||
|
||||
template<class Cmpt>
|
||||
inline Cmpt& Tensor<Cmpt>::zy()
|
||||
{
|
||||
return this->v_[ZY];
|
||||
}
|
||||
|
||||
|
||||
template<class Cmpt>
|
||||
inline Cmpt& Tensor<Cmpt>::zz()
|
||||
{
|
||||
@ -268,7 +282,6 @@ inline Cmpt& Tensor<Cmpt>::zz()
|
||||
}
|
||||
|
||||
|
||||
//- Return tensor transpose
|
||||
template<class Cmpt>
|
||||
inline Tensor<Cmpt> Tensor<Cmpt>::T() const
|
||||
{
|
||||
@ -320,7 +333,6 @@ inline void Tensor<Cmpt>::operator=(const Vector<Vector<Cmpt> >& tr)
|
||||
|
||||
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
|
||||
|
||||
//- Hodge Dual operator (tensor -> vector)
|
||||
template<class Cmpt>
|
||||
inline Vector<Cmpt> operator*(const Tensor<Cmpt>& t)
|
||||
{
|
||||
@ -328,7 +340,6 @@ inline Vector<Cmpt> operator*(const Tensor<Cmpt>& t)
|
||||
}
|
||||
|
||||
|
||||
//- Hodge Dual operator (vector -> tensor)
|
||||
template<class Cmpt>
|
||||
inline Tensor<Cmpt> operator*(const Vector<Cmpt>& v)
|
||||
{
|
||||
@ -341,7 +352,6 @@ inline Tensor<Cmpt> operator*(const Vector<Cmpt>& v)
|
||||
}
|
||||
|
||||
|
||||
//- Inner-product between two tensors
|
||||
template<class Cmpt>
|
||||
inline typename innerProduct<Tensor<Cmpt>, Tensor<Cmpt> >::type
|
||||
operator&(const Tensor<Cmpt>& t1, const Tensor<Cmpt>& t2)
|
||||
@ -363,7 +373,6 @@ operator&(const Tensor<Cmpt>& t1, const Tensor<Cmpt>& t2)
|
||||
}
|
||||
|
||||
|
||||
//- Inner-product between a tensor and a vector
|
||||
template<class Cmpt>
|
||||
inline typename innerProduct<Tensor<Cmpt>, Vector<Cmpt> >::type
|
||||
operator&(const Tensor<Cmpt>& t, const Vector<Cmpt>& v)
|
||||
@ -377,7 +386,6 @@ operator&(const Tensor<Cmpt>& t, const Vector<Cmpt>& v)
|
||||
}
|
||||
|
||||
|
||||
//- Inner-product between a vector and a tensor
|
||||
template<class Cmpt>
|
||||
inline typename innerProduct<Vector<Cmpt>, Tensor<Cmpt> >::type
|
||||
operator&(const Vector<Cmpt>& v, const Tensor<Cmpt>& t)
|
||||
@ -391,7 +399,6 @@ operator&(const Vector<Cmpt>& v, const Tensor<Cmpt>& t)
|
||||
}
|
||||
|
||||
|
||||
//- Outer-product between two vectors
|
||||
template<class Cmpt>
|
||||
inline typename outerProduct<Vector<Cmpt>, Vector<Cmpt> >::type
|
||||
operator*(const Vector<Cmpt>& v1, const Vector<Cmpt>& v2)
|
||||
@ -405,7 +412,6 @@ operator*(const Vector<Cmpt>& v1, const Vector<Cmpt>& v2)
|
||||
}
|
||||
|
||||
|
||||
//- Division of a vector by a tensor, i.e. dot-product with the tensor inverse
|
||||
template<class Cmpt>
|
||||
inline typename innerProduct<Vector<Cmpt>, Tensor<Cmpt> >::type
|
||||
operator/(const Vector<Cmpt>& v, const Tensor<Cmpt>& t)
|
||||
@ -690,6 +696,7 @@ operator&&(const Tensor<Cmpt>& t1, const SphericalTensor<Cmpt>& st2)
|
||||
return(t1.xx()*st2.ii() + t1.yy()*st2.ii() + t1.zz()*st2.ii());
|
||||
}
|
||||
|
||||
|
||||
template<class Cmpt>
|
||||
class typeOfSum<SphericalTensor<Cmpt>, Tensor<Cmpt> >
|
||||
{
|
||||
@ -698,6 +705,7 @@ public:
|
||||
typedef Tensor<Cmpt> type;
|
||||
};
|
||||
|
||||
|
||||
template<class Cmpt>
|
||||
class typeOfSum<Tensor<Cmpt>, SphericalTensor<Cmpt> >
|
||||
{
|
||||
@ -706,6 +714,7 @@ public:
|
||||
typedef Tensor<Cmpt> type;
|
||||
};
|
||||
|
||||
|
||||
template<class Cmpt>
|
||||
class innerProduct<SphericalTensor<Cmpt>, Tensor<Cmpt> >
|
||||
{
|
||||
@ -714,6 +723,7 @@ public:
|
||||
typedef Tensor<Cmpt> type;
|
||||
};
|
||||
|
||||
|
||||
template<class Cmpt>
|
||||
class innerProduct<Tensor<Cmpt>, SphericalTensor<Cmpt> >
|
||||
{
|
||||
@ -777,7 +787,7 @@ operator-(const Tensor<Cmpt>& t1, const SymmTensor<Cmpt>& st2)
|
||||
}
|
||||
|
||||
|
||||
//- Inner-product between a spherical tensor and a tensor
|
||||
//- Inner-product between a symmetric tensor and a tensor
|
||||
template<class Cmpt>
|
||||
inline Tensor<Cmpt>
|
||||
operator&(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
|
||||
@ -799,7 +809,7 @@ operator&(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
|
||||
}
|
||||
|
||||
|
||||
//- Inner-product between a tensor and a spherical tensor
|
||||
//- Inner-product between a tensor and a symmetric tensor
|
||||
template<class Cmpt>
|
||||
inline Tensor<Cmpt>
|
||||
operator&(const Tensor<Cmpt>& t1, const SymmTensor<Cmpt>& st2)
|
||||
@ -821,7 +831,7 @@ operator&(const Tensor<Cmpt>& t1, const SymmTensor<Cmpt>& st2)
|
||||
}
|
||||
|
||||
|
||||
//- Double-dot-product between a spherical tensor and a tensor
|
||||
//- Double-dot-product between a symmetric tensor and a tensor
|
||||
template<class Cmpt>
|
||||
inline Cmpt
|
||||
operator&&(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
|
||||
@ -835,7 +845,7 @@ operator&&(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
|
||||
}
|
||||
|
||||
|
||||
//- Double-dot-product between a tensor and a spherical tensor
|
||||
//- Double-dot-product between a tensor and a symmetric tensor
|
||||
template<class Cmpt>
|
||||
inline Cmpt
|
||||
operator&&(const Tensor<Cmpt>& t1, const SymmTensor<Cmpt>& st2)
|
||||
@ -848,6 +858,7 @@ operator&&(const Tensor<Cmpt>& t1, const SymmTensor<Cmpt>& st2)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Cmpt>
|
||||
class typeOfSum<SymmTensor<Cmpt>, Tensor<Cmpt> >
|
||||
{
|
||||
@ -856,6 +867,7 @@ public:
|
||||
typedef Tensor<Cmpt> type;
|
||||
};
|
||||
|
||||
|
||||
template<class Cmpt>
|
||||
class typeOfSum<Tensor<Cmpt>, SymmTensor<Cmpt> >
|
||||
{
|
||||
@ -873,6 +885,7 @@ public:
|
||||
typedef Tensor<Cmpt> type;
|
||||
};
|
||||
|
||||
|
||||
template<class Cmpt>
|
||||
class innerProduct<Tensor<Cmpt>, SymmTensor<Cmpt> >
|
||||
{
|
||||
|
||||
155
src/finiteVolume/finiteVolume/fvc/fvcSimpleReconstruct.C
Normal file
155
src/finiteVolume/finiteVolume/fvc/fvcSimpleReconstruct.C
Normal file
@ -0,0 +1,155 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM 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.
|
||||
|
||||
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvcReconstruct.H"
|
||||
#include "fvMesh.H"
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace fvc
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
tmp
|
||||
<
|
||||
GeometricField
|
||||
<
|
||||
typename outerProduct<vector,Type>::type, fvPatchField, volMesh
|
||||
>
|
||||
>
|
||||
reconstruct
|
||||
(
|
||||
const GeometricField<Type, fvsPatchField, surfaceMesh>& ssf
|
||||
)
|
||||
{
|
||||
typedef typename outerProduct<vector, Type>::type GradType;
|
||||
|
||||
const fvMesh& mesh = ssf.mesh();
|
||||
|
||||
const labelUList& owner = mesh.owner();
|
||||
const labelUList& neighbour = mesh.neighbour();
|
||||
|
||||
const volVectorField& C = mesh.C();
|
||||
const surfaceVectorField& Cf = mesh.Cf();
|
||||
|
||||
tmp<GeometricField<GradType, fvPatchField, volMesh> > treconField
|
||||
(
|
||||
new GeometricField<GradType, fvPatchField, volMesh>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"reconstruct("+ssf.name()+')',
|
||||
ssf.instance(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensioned<GradType>
|
||||
(
|
||||
"0",
|
||||
ssf.dimensions()/dimArea,
|
||||
pTraits<GradType>::zero
|
||||
),
|
||||
zeroGradientFvPatchField<GradType>::typeName
|
||||
)
|
||||
);
|
||||
|
||||
Field<GradType>& rf = treconField();
|
||||
|
||||
forAll(owner, facei)
|
||||
{
|
||||
label own = owner[facei];
|
||||
label nei = neighbour[facei];
|
||||
|
||||
rf[own] += (Cf[facei] - C[own])*ssf[facei];
|
||||
rf[nei] -= (Cf[facei] - C[nei])*ssf[facei];
|
||||
}
|
||||
|
||||
const typename GeometricField<Type, fvsPatchField, surfaceMesh>::
|
||||
GeometricBoundaryField& bsf = ssf.boundaryField();
|
||||
|
||||
forAll(bsf, patchi)
|
||||
{
|
||||
const fvsPatchField<Type>& psf = bsf[patchi];
|
||||
|
||||
const labelUList& pOwner = mesh.boundary()[patchi].faceCells();
|
||||
const vectorField& pCf = Cf.boundaryField()[patchi];
|
||||
|
||||
forAll(pOwner, pFacei)
|
||||
{
|
||||
label own = pOwner[pFacei];
|
||||
rf[own] += (pCf[pFacei] - C[own])*psf[pFacei];
|
||||
}
|
||||
}
|
||||
|
||||
rf /= mesh.V();
|
||||
|
||||
treconField().correctBoundaryConditions();
|
||||
|
||||
return treconField;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
tmp
|
||||
<
|
||||
GeometricField
|
||||
<
|
||||
typename outerProduct<vector, Type>::type, fvPatchField, volMesh
|
||||
>
|
||||
>
|
||||
reconstruct
|
||||
(
|
||||
const tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >& tssf
|
||||
)
|
||||
{
|
||||
typedef typename outerProduct<vector, Type>::type GradType;
|
||||
tmp<GeometricField<GradType, fvPatchField, volMesh> > tvf
|
||||
(
|
||||
fvc::reconstruct(tssf())
|
||||
);
|
||||
tssf.clear();
|
||||
return tvf;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace fvc
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,187 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM 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.
|
||||
|
||||
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "leastSquaresVectors.H"
|
||||
#include "volFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(leastSquaresVectors, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::leastSquaresVectors::leastSquaresVectors(const fvMesh& mesh)
|
||||
:
|
||||
MeshObject<fvMesh, Foam::MoveableMeshObject, leastSquaresVectors>(mesh),
|
||||
pVectors_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"LeastSquaresP",
|
||||
mesh_.pointsInstance(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
mesh_,
|
||||
dimensionedVector("zero", dimless/dimLength, vector::zero)
|
||||
),
|
||||
nVectors_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"LeastSquaresN",
|
||||
mesh_.pointsInstance(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
mesh_,
|
||||
dimensionedVector("zero", dimless/dimLength, vector::zero)
|
||||
)
|
||||
{
|
||||
calcLeastSquaresVectors();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::leastSquaresVectors::~leastSquaresVectors()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::leastSquaresVectors::calcLeastSquaresVectors()
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "leastSquaresVectors::calcLeastSquaresVectors() :"
|
||||
<< "Calculating least square gradient vectors"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
const fvMesh& mesh = mesh_;
|
||||
|
||||
// Set local references to mesh data
|
||||
const labelUList& owner = mesh_.owner();
|
||||
const labelUList& neighbour = mesh_.neighbour();
|
||||
|
||||
const volVectorField& C = mesh.C();
|
||||
|
||||
// Set up temporary storage for the dd tensor (before inversion)
|
||||
symmTensorField dd(mesh_.nCells(), symmTensor::zero);
|
||||
|
||||
forAll(owner, facei)
|
||||
{
|
||||
label own = owner[facei];
|
||||
label nei = neighbour[facei];
|
||||
|
||||
vector d = C[nei] - C[own];
|
||||
symmTensor wdd = sqr(d)/magSqr(d);
|
||||
dd[own] += wdd;
|
||||
dd[nei] += wdd;
|
||||
}
|
||||
|
||||
|
||||
surfaceVectorField::GeometricBoundaryField& blsP =
|
||||
pVectors_.boundaryField();
|
||||
|
||||
forAll(blsP, patchi)
|
||||
{
|
||||
const fvsPatchVectorField& patchLsP = blsP[patchi];
|
||||
|
||||
const fvPatch& p = patchLsP.patch();
|
||||
const labelUList& faceCells = p.patch().faceCells();
|
||||
|
||||
// Build the d-vectors
|
||||
vectorField pd(p.delta());
|
||||
|
||||
forAll(pd, patchFacei)
|
||||
{
|
||||
const vector& d = pd[patchFacei];
|
||||
|
||||
dd[faceCells[patchFacei]] += sqr(d)/magSqr(d);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Invert the dd tensor
|
||||
const symmTensorField invDd(inv(dd));
|
||||
|
||||
|
||||
// Revisit all faces and calculate the pVectors_ and nVectors_ vectors
|
||||
forAll(owner, facei)
|
||||
{
|
||||
label own = owner[facei];
|
||||
label nei = neighbour[facei];
|
||||
|
||||
vector d = C[nei] - C[own];
|
||||
|
||||
pVectors_[facei] = (invDd[own] & d)/magSqr(d);
|
||||
nVectors_[facei] = -(invDd[nei] & d)/magSqr(d);
|
||||
}
|
||||
|
||||
forAll(blsP, patchi)
|
||||
{
|
||||
fvsPatchVectorField& patchLsP = blsP[patchi];
|
||||
|
||||
const fvPatch& p = patchLsP.patch();
|
||||
const labelUList& faceCells = p.faceCells();
|
||||
|
||||
// Build the d-vectors
|
||||
vectorField pd(p.delta());
|
||||
|
||||
forAll(pd, patchFacei)
|
||||
{
|
||||
const vector& d = pd[patchFacei];
|
||||
|
||||
patchLsP[patchFacei] = (invDd[faceCells[patchFacei]] & d)/magSqr(d);
|
||||
}
|
||||
}
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "leastSquaresVectors::calcLeastSquaresVectors() :"
|
||||
<< "Finished calculating least square gradient vectors"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Foam::leastSquaresVectors::movePoints()
|
||||
{
|
||||
calcLeastSquaresVectors();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,183 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM 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.
|
||||
|
||||
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "leastSquaresVectors.H"
|
||||
#include "volFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(leastSquaresVectors, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::leastSquaresVectors::leastSquaresVectors(const fvMesh& mesh)
|
||||
:
|
||||
MeshObject<fvMesh, Foam::MoveableMeshObject, leastSquaresVectors>(mesh),
|
||||
pVectors_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"LeastSquaresP",
|
||||
mesh_.pointsInstance(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
mesh_,
|
||||
dimensionedVector("zero", dimless/dimLength, vector::zero)
|
||||
),
|
||||
nVectors_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"LeastSquaresN",
|
||||
mesh_.pointsInstance(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
mesh_,
|
||||
dimensionedVector("zero", dimless/dimLength, vector::zero)
|
||||
)
|
||||
{
|
||||
calcLeastSquaresVectors();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::leastSquaresVectors::~leastSquaresVectors()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::leastSquaresVectors::calcLeastSquaresVectors()
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "leastSquaresVectors::calcLeastSquaresVectors() :"
|
||||
<< "Calculating least square gradient vectors"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
const fvMesh& mesh = mesh_;
|
||||
|
||||
// Set local references to mesh data
|
||||
const labelUList& owner = mesh_.owner();
|
||||
const labelUList& neighbour = mesh_.neighbour();
|
||||
|
||||
const volVectorField& C = mesh.C();
|
||||
|
||||
// Set up temporary storage for the dd tensor (before inversion)
|
||||
symmTensorField dd(mesh_.nCells(), symmTensor::zero);
|
||||
|
||||
forAll(owner, facei)
|
||||
{
|
||||
label own = owner[facei];
|
||||
label nei = neighbour[facei];
|
||||
|
||||
symmTensor wdd = sqr(C[nei] - C[own]);
|
||||
dd[own] += wdd;
|
||||
dd[nei] += wdd;
|
||||
}
|
||||
|
||||
|
||||
surfaceVectorField::GeometricBoundaryField& blsP =
|
||||
pVectors_.boundaryField();
|
||||
|
||||
forAll(blsP, patchi)
|
||||
{
|
||||
const fvsPatchVectorField& patchLsP = blsP[patchi];
|
||||
|
||||
const fvPatch& p = patchLsP.patch();
|
||||
const labelUList& faceCells = p.patch().faceCells();
|
||||
|
||||
// Build the d-vectors
|
||||
vectorField pd(p.delta());
|
||||
|
||||
forAll(pd, patchFacei)
|
||||
{
|
||||
dd[faceCells[patchFacei]] += sqr(pd[patchFacei]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Invert the dd tensor
|
||||
const symmTensorField invDd(inv(dd));
|
||||
|
||||
|
||||
// Revisit all faces and calculate the pVectors_ and nVectors_ vectors
|
||||
forAll(owner, facei)
|
||||
{
|
||||
label own = owner[facei];
|
||||
label nei = neighbour[facei];
|
||||
|
||||
vector d = C[nei] - C[own];
|
||||
|
||||
pVectors_[facei] = (invDd[own] & d);
|
||||
nVectors_[facei] = -(invDd[nei] & d);
|
||||
}
|
||||
|
||||
forAll(blsP, patchi)
|
||||
{
|
||||
fvsPatchVectorField& patchLsP = blsP[patchi];
|
||||
|
||||
const fvPatch& p = patchLsP.patch();
|
||||
const labelUList& faceCells = p.faceCells();
|
||||
|
||||
// Build the d-vectors
|
||||
vectorField pd(p.delta());
|
||||
|
||||
forAll(pd, patchFacei)
|
||||
{
|
||||
patchLsP[patchFacei] =
|
||||
(invDd[faceCells[patchFacei]] & pd[patchFacei]);
|
||||
}
|
||||
}
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "leastSquaresVectors::calcLeastSquaresVectors() :"
|
||||
<< "Finished calculating least square gradient vectors"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Foam::leastSquaresVectors::movePoints()
|
||||
{
|
||||
calcLeastSquaresVectors();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -216,19 +216,39 @@ void Foam::fv::interRegionHeatTransferModel::addSup
|
||||
{
|
||||
if (h.dimensions() == dimEnergy/dimMass)
|
||||
{
|
||||
const fluidThermo& thermo =
|
||||
mesh_.lookupObject<fluidThermo>("thermophysicalProperties");
|
||||
|
||||
eqn += htc_*Tmapped - fvm::SuSp(htc_/thermo.Cp(), h);
|
||||
|
||||
if (debug)
|
||||
if (mesh_.foundObject<fluidThermo>("thermophysicalProperties"))
|
||||
{
|
||||
const dimensionedScalar energy =
|
||||
fvc::domainIntegrate(htc_*(h/thermo.Cp() - Tmapped));
|
||||
const basicThermo& thermo =
|
||||
mesh_.lookupObject<basicThermo>("thermophysicalProperties");
|
||||
|
||||
Info<< "Energy exchange from region " << nbrMesh.name()
|
||||
<< " To " << mesh_.name() << " : " << energy.value()
|
||||
<< endl;
|
||||
eqn += htc_*Tmapped - fvm::SuSp(htc_/thermo.Cp(), h);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
const dimensionedScalar energy =
|
||||
fvc::domainIntegrate(htc_*(h/thermo.Cp() - Tmapped));
|
||||
|
||||
Info<< "Energy exchange from region " << nbrMesh.name()
|
||||
<< " To " << mesh_.name() << " : " << energy.value()
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"void Foam::fv::interRegionHeatTransferModel::addSup"
|
||||
"("
|
||||
" fvMatrix<scalar>&, "
|
||||
" const label "
|
||||
")"
|
||||
) << " on mesh " << mesh_.name()
|
||||
<< " could not find object fluidThermo."
|
||||
<< " The available objects : "
|
||||
<< mesh_.names()
|
||||
<< " The semi implicit option can only be used for "
|
||||
<< "fluid-fluid inter region heat transfer models "
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
else if (h.dimensions() == dimTemperature)
|
||||
|
||||
@ -46,10 +46,14 @@ Description
|
||||
pitchAxis (0 0 1);
|
||||
magUInf 100;
|
||||
lRef 3.5;
|
||||
ARef 2.2;
|
||||
nBin 20;
|
||||
binDir (1 0 0);
|
||||
binFormat gnuplot;
|
||||
Aref 2.2;
|
||||
|
||||
binData
|
||||
{
|
||||
nBin 20;
|
||||
direction (1 0 0);
|
||||
cumulative yes;
|
||||
}
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
@ -64,10 +68,15 @@ Description
|
||||
pitchAxis | picth axis | yes |
|
||||
magUInf | free stream velocity magnitude | yes |
|
||||
lRef | reference length scale for moment calculations | yes |
|
||||
ARef | reference area | yes |
|
||||
nBin | number of data bins | no |
|
||||
binDir | direction along which bins are defined | no |
|
||||
binFormat | output format for bin data | no |
|
||||
Aref | reference area | yes |
|
||||
\endtable
|
||||
|
||||
Bin data is optional, but if the dictionary is present, the entries must
|
||||
be defined according o
|
||||
\table
|
||||
nBin | number of data bins | yes |
|
||||
direction | direction along which bins are defined | yes |
|
||||
cumulative | bin data accumulated with incresing distance | yes |
|
||||
\endtable
|
||||
|
||||
SeeAlso
|
||||
|
||||
@ -44,8 +44,13 @@ Description
|
||||
...
|
||||
log yes;
|
||||
patches (walls);
|
||||
nBin 20;
|
||||
binDir (1 0 0);
|
||||
|
||||
binData
|
||||
{
|
||||
nBin 20;
|
||||
direction (1 0 0);
|
||||
cumulative yes;
|
||||
}
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
@ -55,8 +60,6 @@ Description
|
||||
type | type name: forces | yes |
|
||||
log | write force data to standard output | no | no
|
||||
patches | patches included in the forces calculation | yes |
|
||||
nBin | number of data bins | no |
|
||||
binDir | direction along which bins are defined | no |
|
||||
pName | pressure field name | no | p
|
||||
UName | velocity field name | no | U
|
||||
rhoName | density field name (see below) | no | rho
|
||||
@ -65,6 +68,14 @@ Description
|
||||
fDName | name of force density field (see below) | no | fD
|
||||
\endtable
|
||||
|
||||
Bin data is optional, but if the dictionary is present, the entries must
|
||||
be defined according o
|
||||
\table
|
||||
nBin | number of data bins | yes |
|
||||
direction | direction along which bins are defined | yes |
|
||||
cumulative | bin data accumulated with incresing distance | yes |
|
||||
\endtable
|
||||
|
||||
Note
|
||||
- For incompressible cases, set \c rhoName to \c rhoInf. You will then be
|
||||
required to provide a \c rhoInf value corresponding to the free-stream
|
||||
|
||||
@ -44,7 +44,12 @@ bool Foam::directMethod::intersect
|
||||
const label tgtCellI
|
||||
) const
|
||||
{
|
||||
return tgt_.pointInCell(src_.cellCentres()[srcCellI], tgtCellI);
|
||||
return tgt_.pointInCell
|
||||
(
|
||||
src_.cellCentres()[srcCellI],
|
||||
tgtCellI,
|
||||
polyMesh::FACEPLANES
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -191,7 +196,15 @@ void Foam::directMethod::appendToDirectSeeds
|
||||
{
|
||||
label tgtI = tgtNbr[j];
|
||||
|
||||
if (tgt_.pointInCell(srcCentre[srcI], tgtI))
|
||||
if
|
||||
(
|
||||
tgt_.pointInCell
|
||||
(
|
||||
srcCentre[srcI],
|
||||
tgtI,
|
||||
polyMesh::FACEPLANES
|
||||
)
|
||||
)
|
||||
{
|
||||
// new match - append to lists
|
||||
found = true;
|
||||
|
||||
@ -26,10 +26,10 @@ License
|
||||
#include "P1.H"
|
||||
#include "fvmLaplacian.H"
|
||||
#include "fvmSup.H"
|
||||
|
||||
#include "absorptionEmissionModel.H"
|
||||
#include "scatterModel.H"
|
||||
#include "constants.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
using namespace Foam::constant;
|
||||
|
||||
|
||||
@ -28,6 +28,7 @@ License
|
||||
#include "scatterModel.H"
|
||||
#include "constants.H"
|
||||
#include "fvm.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
using namespace Foam::constant;
|
||||
using namespace Foam::constant::mathematical;
|
||||
|
||||
@ -28,6 +28,7 @@ License
|
||||
#include "fvMesh.H"
|
||||
#include "Time.H"
|
||||
#include "volFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -28,6 +28,7 @@ License
|
||||
#include "fvMesh.H"
|
||||
#include "Time.H"
|
||||
#include "volFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -45,7 +45,6 @@ SourceFiles
|
||||
#include "IOdictionary.H"
|
||||
#include "autoPtr.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "DimensionedField.H"
|
||||
#include "fvMatricesFwd.H"
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,7 +28,7 @@ License
|
||||
#include "constants.H"
|
||||
#include "greyDiffusiveViewFactorFixedValueFvPatchScalarField.H"
|
||||
#include "typeInfo.H"
|
||||
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
using namespace Foam::constant;
|
||||
|
||||
|
||||
@ -179,7 +179,7 @@ Foam::incompressibleTwoPhaseMixture::nuf() const
|
||||
|
||||
bool Foam::incompressibleTwoPhaseMixture::read()
|
||||
{
|
||||
if (transportModel::read())
|
||||
if (regIOobject::read())
|
||||
{
|
||||
if
|
||||
(
|
||||
|
||||
@ -17,7 +17,7 @@ FoamFile
|
||||
|
||||
chemistryType
|
||||
{
|
||||
chemistrySolver ode;
|
||||
chemistrySolver noChemistrySolver;
|
||||
chemistryThermo rho;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user