Commit 1eb2458c authored by sergio's avatar sergio
Browse files

Merge branch 'master' of develop.openfoam.com:Development/OpenFOAM-plus

parents a65b1897 1edb2f7d
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -2560,6 +2560,11 @@ Foam::labelBits Foam::indexedOctree<Type>::findNode
template<class Type>
Foam::label Foam::indexedOctree<Type>::findInside(const point& sample) const
{
if (nodes_.empty())
{
return -1;
}
labelBits index = findNode(0, sample);
const node& nod = nodes_[getNode(index)];
......@@ -2592,6 +2597,11 @@ const Foam::labelList& Foam::indexedOctree<Type>::findIndices
const point& sample
) const
{
if (nodes_.empty())
{
return emptyList<label>();
}
labelBits index = findNode(0, sample);
const node& nod = nodes_[getNode(index)];
......@@ -2603,10 +2613,8 @@ const Foam::labelList& Foam::indexedOctree<Type>::findIndices
{
return contents_[getContent(contentIndex)];
}
else
{
return emptyList<label>();
}
return emptyList<label>();
}
......@@ -2688,18 +2696,21 @@ void Foam::indexedOctree<Type>::findNear
CompareOp& cop
) const
{
findNear
(
nearDist,
true,
*this,
nodePlusOctant(0, 0),
bb(),
tree2,
nodePlusOctant(0, 0),
tree2.bb(),
cop
);
if (!nodes_.empty())
{
findNear
(
nearDist,
true,
*this,
nodePlusOctant(0, 0),
bb(),
tree2,
nodePlusOctant(0, 0),
tree2.bb(),
cop
);
}
}
......@@ -2711,6 +2722,11 @@ void Foam::indexedOctree<Type>::print
const label nodeI
) const
{
if (nodes_.empty())
{
return;
}
const node& nod = nodes_[nodeI];
const treeBoundBox& bb = nod.bb_;
......
......@@ -58,6 +58,8 @@ externalWallHeatFluxTemperatureFvPatchScalarField
temperatureCoupledBase(patch(), "undefined", "undefined", "undefined-K"),
mode_(fixedHeatFlux),
Q_(0),
q_(),
h_(),
Ta_(),
relaxation_(1),
emissivity_(0),
......@@ -84,7 +86,9 @@ externalWallHeatFluxTemperatureFvPatchScalarField
temperatureCoupledBase(patch(), dict),
mode_(operationModeNames.lookup("mode", dict)),
Q_(0),
Ta_(Function1<scalar>::New("Ta", dict)),
q_(),
h_(),
Ta_(),
relaxation_(dict.lookupOrDefault<scalar>("relaxation", 1)),
emissivity_(dict.lookupOrDefault<scalar>("emissivity", 0)),
qrRelaxation_(dict.lookupOrDefault<scalar>("qrRelaxation", 1)),
......@@ -109,6 +113,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField
case fixedHeatTransferCoeff:
{
h_ = scalarField("h", dict, p.size());
Ta_ = Function1<scalar>::New("Ta", dict);
if (dict.found("thicknessLayers"))
{
......@@ -175,12 +180,12 @@ externalWallHeatFluxTemperatureFvPatchScalarField
temperatureCoupledBase(patch(), ptf),
mode_(ptf.mode_),
Q_(ptf.Q_),
q_(ptf.q_, mapper),
h_(ptf.h_, mapper),
q_(),
h_(),
Ta_(ptf.Ta_, false),
relaxation_(ptf.relaxation_),
emissivity_(ptf.emissivity_),
qrPrevious_(ptf.qrPrevious_, mapper),
qrPrevious_(),
qrRelaxation_(ptf.qrRelaxation_),
qrName_(ptf.qrName_),
thicknessLayers_(ptf.thicknessLayers_),
......@@ -194,12 +199,14 @@ externalWallHeatFluxTemperatureFvPatchScalarField
}
case fixedHeatFlux:
{
q_.setSize(mapper.size());
q_.map(ptf.q_, mapper);
break;
}
case fixedHeatTransferCoeff:
{
h_.setSize(mapper.size());
h_.map(ptf.h_, mapper);
break;
......
......@@ -615,8 +615,8 @@ void Foam::isoAdvection::limitFluxes()
const scalar aTol = 1.0e-12; // Note: tolerances
const scalar maxAlphaMinus1 = 1; // max(alphaNew - 1);
const scalar minAlpha = -1; // min(alphaNew);
const label nUndershoots = 20; // sum(neg(alphaNew + aTol));
const label nOvershoots = 20; // sum(pos(alphaNew - 1 - aTol));
const label nUndershoots = 20; // sum(neg0(alphaNew + aTol));
const label nOvershoots = 20; // sum(pos0(alphaNew - 1 - aTol));
cellIsBounded_ = false;
// Loop number of bounding steps
......@@ -682,8 +682,8 @@ void Foam::isoAdvection::limitFluxes()
scalarField alphaNew(alpha1In_ - fvc::surfaceIntegrate(dVf_)());
label maxAlphaMinus1 = max(alphaNew - 1);
scalar minAlpha = min(alphaNew);
label nUndershoots = sum(neg(alphaNew + aTol));
label nOvershoots = sum(pos(alphaNew - 1 - aTol));
label nUndershoots = sum(neg0(alphaNew + aTol));
label nOvershoots = sum(pos0(alphaNew - 1 - aTol));
Info<< "After bounding number " << n + 1 << " of time "
<< mesh_.time().value() << ":" << endl;
Info<< "nOvershoots = " << nOvershoots << " with max(alphaNew-1) = "
......@@ -792,7 +792,7 @@ void Foam::isoAdvection::boundFromAbove
fluidToPassOn*mag(phi[fi]*dt)/dVftot;
nFacesToPassFluidThrough +=
pos(dVfmax[fi] - fluidToPassThroughFace);
pos0(dVfmax[fi] - fluidToPassThroughFace);
fluidToPassThroughFace =
min(fluidToPassThroughFace, dVfmax[fi]);
......@@ -1014,9 +1014,9 @@ void Foam::isoAdvection::applyBruteForceBounding()
{
alpha1_ =
alpha1_
*pos(alpha1_ - snapAlphaTol)
*neg(alpha1_ - (1.0 - snapAlphaTol))
+ pos(alpha1_ - (1.0 - snapAlphaTol));
*pos0(alpha1_ - snapAlphaTol)
*neg0(alpha1_ - (1.0 - snapAlphaTol))
+ pos0(alpha1_ - (1.0 - snapAlphaTol));
alpha1Changed = true;
}
......
......@@ -362,7 +362,7 @@ Foam::scalar Foam::isoCutFace::timeIntegratedArea
{
// If all face cuttings were in the past and cell is filling up (Un0>0)
// then face must be full during whole time interval
tIntArea = magSf*dt*pos(Un0);
tIntArea = magSf*dt*pos0(Un0);
return tIntArea;
}
......@@ -373,7 +373,7 @@ Foam::scalar Foam::isoCutFace::timeIntegratedArea
// If all cuttings are in the future but non of them within [0,dt] then
// if cell is filling up (Un0 > 0) face must be empty during whole time
// interval
tIntArea = magSf*dt*(1 - pos(Un0));
tIntArea = magSf*dt*(1 - pos0(Un0));
return tIntArea;
}
......@@ -398,7 +398,7 @@ Foam::scalar Foam::isoCutFace::timeIntegratedArea
// If Un0 > 0 cell is filling up and it must initially be empty.
// If Un0 < 0 cell must initially be full(y immersed in fluid A).
time = firstTime;
initialArea = magSf*(1.0 - pos(Un0));
initialArea = magSf*(1.0 - pos0(Un0));
tIntArea = initialArea*time;
cutPoints(fPts, pTimes, time, FIIL);
}
......@@ -470,7 +470,7 @@ Foam::scalar Foam::isoCutFace::timeIntegratedArea
{
// FIIL will leave the face at lastTime and face will be fully in fluid
// A or fluid B in the time interval from lastTime to dt.
tIntArea += magSf*(dt - lastTime)*pos(Un0);
tIntArea += magSf*(dt - lastTime)*pos0(Un0);
}
return tIntArea;
......
......@@ -47,10 +47,6 @@ const char* Foam::distributionModels::binned::header =
void Foam::distributionModels::binned::initialise()
{
const label nSample(xy_.size());
forAll(xy_, bini)
{
xy_[bini][1] /= scalar(nSample);
}
// Convert values to integral values
for (label bini = 1; bini < nSample; ++bini)
......@@ -58,6 +54,13 @@ void Foam::distributionModels::binned::initialise()
xy_[bini][1] += xy_[bini - 1][1];
}
// Normalise
scalar sumProb = xy_.last()[1];
forAll(xy_, bini)
{
xy_[bini][1] /= sumProb;
}
// Calculate the mean value
label bini = 0;
forAll(xy_, i)
......@@ -188,16 +191,7 @@ Foam::scalar Foam::distributionModels::binned::sample() const
{
if (xy_[i][1] > y)
{
scalar d1 = y - xy_[i][1];
scalar d2 = xy_[i+1][1] - y;
if (d1 < d2)
{
return xy_[i][0];
}
else
{
return xy_[i+1][0];
}
return xy_[i][0];
}
}
......
......@@ -312,7 +312,7 @@ void Foam::fileFormats::AC3DsurfaceFormat<Face>::write
const pointField& pointLst = surf.points();
const UList<Face>& faceLst = surf.surfFaces();
const UList<surfZone>& zones =
const surfZoneList zones =
(
surf.surfZones().size()
? surf.surfZones()
......@@ -393,7 +393,7 @@ void Foam::fileFormats::AC3DsurfaceFormat<Face>::write
if (zoneLst.size() <= 1)
{
const List<surfZone>& zones =
const surfZoneList zones =
(
zoneLst.size()
? zoneLst
......
......@@ -169,7 +169,7 @@ void Foam::fileFormats::FLMAsurfaceFormat<Face>::write
const UList<label>& faceMap = surf.faceMap();
// for no zones, suppress the group name
const List<surfZone>& zones =
const surfZoneList zones =
(
surf.surfZones().empty()
? surfaceFormatsCore::oneZone(faceLst, word::null)
......
......@@ -253,7 +253,7 @@ void Foam::fileFormats::GTSsurfaceFormat<Face>::write
const UList<point>& pointLst = surf.points();
const UList<Face>& faceLst = surf.surfFaces();
const UList<surfZone>& zones =
const surfZoneList zones =
(
surf.surfZones().size()
? surf.surfZones()
......
......@@ -420,7 +420,7 @@ void Foam::fileFormats::NASsurfaceFormat<Face>::write
const UList<label>& faceMap = surf.faceMap();
// for no zones, suppress the group name
const UList<surfZone>& zones =
const surfZoneList zones =
(
surf.surfZones().empty()
? surfaceFormatsCore::oneZone(faceLst, "")
......
......@@ -217,7 +217,7 @@ void Foam::fileFormats::OBJsurfaceFormat<Face>::write
const UList<label>& faceMap = surf.faceMap();
// for no zones, suppress the group name
const UList<surfZone>& zones =
const surfZoneList zones =
(
surf.surfZones().empty()
? surfaceFormatsCore::oneZone(faceLst, "")
......
......@@ -41,7 +41,7 @@ void Foam::fileFormats::SMESHsurfaceFormat<Face>::write
const UList<Face>& faceLst = surf.surfFaces();
const UList<label>& faceMap = surf.faceMap();
const UList<surfZone>& zones =
const surfZoneList zones =
(
surf.surfZones().empty()
? surfaceFormatsCore::oneZone(faceLst)
......
......@@ -241,7 +241,7 @@ void Foam::fileFormats::STARCDsurfaceFormat<Face>::write
const UList<Face>& faceLst = surf.surfFaces();
const UList<label>& faceMap = surf.faceMap();
const UList<surfZone>& zones =
const surfZoneList zones =
(
surf.surfZones().empty()
? surfaceFormatsCore::oneZone(faceLst)
......
......@@ -215,7 +215,7 @@ void Foam::fileFormats::STLsurfaceFormat<Face>::writeAscii
const UList<Face>& faceLst = surf.surfFaces();
const UList<label>& faceMap = surf.faceMap();
const UList<surfZone>& zones =
const surfZoneList zones =
(
surf.surfZones().empty()
? surfaceFormatsCore::oneZone(faceLst)
......@@ -269,7 +269,7 @@ void Foam::fileFormats::STLsurfaceFormat<Face>::writeBinary
const UList<Face>& faceLst = surf.surfFaces();
const UList<label>& faceMap = surf.faceMap();
const UList<surfZone>& zones =
const surfZoneList zones =
(
surf.surfZones().size() > 1
? surf.surfZones()
......
......@@ -161,7 +161,7 @@ void Foam::fileFormats::TRIsurfaceFormat<Face>::write
const UList<Face>& faceLst = surf.surfFaces();
const UList<label>& faceMap = surf.faceMap();
const UList<surfZone>& zones =
const surfZoneList zones =
(
surf.surfZones().empty()
? surfaceFormatsCore::oneZone(faceLst)
......
......@@ -265,7 +265,7 @@ void Foam::fileFormats::VTKsurfaceFormat<Face>::write
const UList<Face>& faceLst = surf.surfFaces();
const UList<label>& faceMap = surf.faceMap();
const UList<surfZone>& zones =
const surfZoneList zones =
(
surf.surfZones().empty()
? surfaceFormatsCore::oneZone(faceLst)
......
......@@ -118,7 +118,7 @@ void Foam::fileFormats::VTPsurfaceFormat<Face>::write
const UList<Face>& faceLst = surf.surfFaces();
const UList<label>& faceMap = surf.faceMap();
const List<surfZone>& zones =
const surfZoneList zones =
(
surf.surfZones().empty()
? surfaceFormatsCore::oneZone(faceLst)
......
......@@ -41,7 +41,7 @@ void Foam::fileFormats::X3DsurfaceFormat<Face>::write
const UList<label>& faceMap = surf.faceMap();
// for no zones, suppress the group name
const UList<surfZone>& zones =
const surfZoneList zones =
(
surf.surfZones().empty()
? surfaceFormatsCore::oneZone(faceLst, word::null)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment