mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
COMP: references to temporaries
COMP: include <limits>
This commit is contained in:
@ -591,7 +591,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
const word& opt
|
const char * const opt
|
||||||
: { "cellSet", "cellZone", "faceSet", "pointSet" }
|
: { "cellSet", "cellZone", "faceSet", "pointSet" }
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -92,7 +92,7 @@ bool setCellFieldType
|
|||||||
|
|
||||||
fieldType field(fieldHeader, mesh, false);
|
fieldType field(fieldHeader, mesh, false);
|
||||||
|
|
||||||
const Type& value = pTraits<Type>(fieldValueStream);
|
const Type value = pTraits<Type>(fieldValueStream);
|
||||||
|
|
||||||
if (selectedCells.size() == field.size())
|
if (selectedCells.size() == field.size())
|
||||||
{
|
{
|
||||||
@ -244,7 +244,7 @@ bool setFaceFieldType
|
|||||||
|
|
||||||
fieldType field(fieldHeader, mesh);
|
fieldType field(fieldHeader, mesh);
|
||||||
|
|
||||||
const Type& value = pTraits<Type>(fieldValueStream);
|
const Type value = pTraits<Type>(fieldValueStream);
|
||||||
|
|
||||||
// Create flat list of selected faces and their value.
|
// Create flat list of selected faces and their value.
|
||||||
Field<Type> allBoundaryValues(mesh.nBoundaryFaces());
|
Field<Type> allBoundaryValues(mesh.nBoundaryFaces());
|
||||||
|
|||||||
@ -28,6 +28,8 @@ License
|
|||||||
#include "MathFunctions.H"
|
#include "MathFunctions.H"
|
||||||
#include "mathematicalConstants.H"
|
#include "mathematicalConstants.H"
|
||||||
#include "error.H"
|
#include "error.H"
|
||||||
|
#include <cmath>
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -36,6 +36,7 @@ Description
|
|||||||
#include "mathematicalConstants.H"
|
#include "mathematicalConstants.H"
|
||||||
#include "error.H"
|
#include "error.H"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -35,6 +35,8 @@ Description
|
|||||||
#include "MathFunctions.H"
|
#include "MathFunctions.H"
|
||||||
#include "mathematicalConstants.H"
|
#include "mathematicalConstants.H"
|
||||||
#include "error.H"
|
#include "error.H"
|
||||||
|
#include <cmath>
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
using namespace Foam::constant::mathematical;
|
using namespace Foam::constant::mathematical;
|
||||||
|
|
||||||
|
|||||||
@ -161,38 +161,38 @@ Foam::turbulentDigitalFilterInletFvPatchVectorField::indexPairs()
|
|||||||
|
|
||||||
void Foam::turbulentDigitalFilterInletFvPatchVectorField::checkR() const
|
void Foam::turbulentDigitalFilterInletFvPatchVectorField::checkR() const
|
||||||
{
|
{
|
||||||
const vectorField& faceCentres = this->patch().patch().faceCentres();
|
label badFacei = -1;
|
||||||
|
|
||||||
forAll(R_, facei)
|
forAll(R_, facei)
|
||||||
{
|
{
|
||||||
if (R_[facei].xx() <= 0)
|
if (R_[facei].xx() <= 0)
|
||||||
{
|
{
|
||||||
|
badFacei = facei;
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Reynolds stress tensor component Rxx cannot be negative"
|
<< "Reynolds stress tensor component Rxx cannot be negative"
|
||||||
<< " or zero, where Rxx = " << R_[facei].xx()
|
<< " or zero, where Rxx = " << R_[facei].xx();
|
||||||
<< " at the face centre = " << faceCentres[facei]
|
break;
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (R_[facei].yy() < 0 || R_[facei].zz() < 0)
|
if (R_[facei].yy() < 0 || R_[facei].zz() < 0)
|
||||||
{
|
{
|
||||||
|
badFacei = facei;
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Reynolds stress tensor components Ryy or Rzz cannot be"
|
<< "Reynolds stress tensor components Ryy or Rzz cannot be"
|
||||||
<< " negative where Ryy = " << R_[facei].yy()
|
<< " negative where Ryy = " << R_[facei].yy()
|
||||||
<< ", and Rzz = " << R_[facei].zz()
|
<< ", and Rzz = " << R_[facei].zz();
|
||||||
<< " at the face centre = " << faceCentres[facei]
|
break;
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const scalar x0 = R_[facei].xx()*R_[facei].yy() - sqr(R_[facei].xy());
|
const scalar x0 = R_[facei].xx()*R_[facei].yy() - sqr(R_[facei].xy());
|
||||||
|
|
||||||
if (x0 <= 0)
|
if (x0 <= 0)
|
||||||
{
|
{
|
||||||
|
badFacei = facei;
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Reynolds stress tensor component group, Rxx*Ryy - Rxy^2"
|
<< "Reynolds stress tensor component group, Rxx*Ryy - Rxy^2"
|
||||||
<< " cannot be negative or zero"
|
<< " cannot be negative or zero";
|
||||||
<< " at the face centre = " << faceCentres[facei]
|
break;
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const scalar x1 = R_[facei].zz() - sqr(R_[facei].xz())/R_[facei].xx();
|
const scalar x1 = R_[facei].zz() - sqr(R_[facei].xz())/R_[facei].xx();
|
||||||
@ -202,15 +202,23 @@ void Foam::turbulentDigitalFilterInletFvPatchVectorField::checkR() const
|
|||||||
|
|
||||||
if (x3 < 0)
|
if (x3 < 0)
|
||||||
{
|
{
|
||||||
|
badFacei = facei;
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Reynolds stress tensor component group, "
|
<< "Reynolds stress tensor component group, "
|
||||||
<< "Rzz - Rxz^2/Rxx - (Ryz - Rxy*Rxz/(Rxx*(Rxx*Ryy - Rxy^2)))^2"
|
<< "Rzz - Rxz^2/Rxx - (Ryz - Rxy*Rxz/(Rxx*(Rxx*Ryy - Rxy^2)))^2"
|
||||||
<< " cannot be negative at the face centre = "
|
<< " cannot be negative";
|
||||||
<< faceCentres[facei]
|
break;
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (badFacei >= 0)
|
||||||
|
{
|
||||||
|
FatalError
|
||||||
|
<< " at the face centre = "
|
||||||
|
<< this->patch().patch().faceCentres()[badFacei]
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
Info<< " # Reynolds stress tensor on patch is consistent #" << endl;
|
Info<< " # Reynolds stress tensor on patch is consistent #" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -79,7 +79,7 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
|
|||||||
const vectorField nf(patch.nf());
|
const vectorField nf(patch.nf());
|
||||||
const vectorField faceCellCentres(patch.patch().faceCellCentres());
|
const vectorField faceCellCentres(patch.patch().faceCellCentres());
|
||||||
const labelUList& faceCells = patch.patch().faceCells();
|
const labelUList& faceCells = patch.patch().faceCells();
|
||||||
const vectorField::subField& faceCentres = patch.patch().faceCentres();
|
const vectorField::subField faceCentres = patch.patch().faceCentres();
|
||||||
|
|
||||||
forAll(patch, patchFacei)
|
forAll(patch, patchFacei)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -37,7 +37,7 @@ Description
|
|||||||
Typical use might be to e.g. average face centres to points on a patch
|
Typical use might be to e.g. average face centres to points on a patch
|
||||||
|
|
||||||
const labelListList& pointFaces = pp.pointFaces();
|
const labelListList& pointFaces = pp.pointFaces();
|
||||||
const pointField& faceCentres = pp.faceCentres();
|
const vectorField::subField faceCentres = pp.faceCentres();
|
||||||
|
|
||||||
Field<weightedPosition> avgBoundary(pointFaces.size());
|
Field<weightedPosition> avgBoundary(pointFaces.size());
|
||||||
|
|
||||||
|
|||||||
@ -136,7 +136,7 @@ void Foam::faceReflecting::initialise(const dictionary& coeffs)
|
|||||||
forAll(patches, patchI)
|
forAll(patches, patchI)
|
||||||
{
|
{
|
||||||
const polyPatch& pp = patches[patchI];
|
const polyPatch& pp = patches[patchI];
|
||||||
const pointField& cf = pp.faceCentres();
|
const vectorField::subField cf = pp.faceCentres();
|
||||||
|
|
||||||
if (!pp.coupled() && !isA<cyclicAMIPolyPatch>(pp))
|
if (!pp.coupled() && !isA<cyclicAMIPolyPatch>(pp))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -155,7 +155,7 @@ void Foam::faceShading::calculate()
|
|||||||
forAll(patches, patchI)
|
forAll(patches, patchI)
|
||||||
{
|
{
|
||||||
const polyPatch& pp = patches[patchI];
|
const polyPatch& pp = patches[patchI];
|
||||||
const pointField& cf = pp.faceCentres();
|
const vectorField::subField cf = pp.faceCentres();
|
||||||
|
|
||||||
if (!pp.coupled() && !isA<cyclicAMIPolyPatch>(pp))
|
if (!pp.coupled() && !isA<cyclicAMIPolyPatch>(pp))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user