Merge remote-tracking branch 'origin/master' into develop

This commit is contained in:
Mark Olesen
2017-09-15 11:20:35 +02:00
10 changed files with 64 additions and 36 deletions

View File

@ -28,3 +28,8 @@ bool ddtCorr
( (
pimple.dict().lookupOrDefault("ddtCorr", true) pimple.dict().lookupOrDefault("ddtCorr", true)
); );
bool adjustFringe
(
pimple.dict().lookupOrDefault("oversetAdjustPhi", false)
);

View File

@ -65,7 +65,7 @@ int main(int argc, char *argv[])
#include "createTime.H" #include "createTime.H"
#include "createDynamicFvMesh.H" #include "createDynamicFvMesh.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
#include "createControl.H" pimpleControl pimple(mesh);
#include "createTimeControls.H" #include "createTimeControls.H"
#include "createDyMControls.H" #include "createDyMControls.H"
#include "createFields.H" #include "createFields.H"

View File

@ -46,6 +46,13 @@
phiHbyA += phig; phiHbyA += phig;
if (adjustFringe)
{
fvc::makeRelative(phiHbyA, U);
oversetAdjustPhi(phiHbyA, U);
fvc::makeAbsolute(phiHbyA, U);
}
// Update the pressure BCs to ensure flux consistency // Update the pressure BCs to ensure flux consistency
constrainPressure(p_rgh, U, phiHbyA, rAUf, MRF); constrainPressure(p_rgh, U, phiHbyA, rAUf, MRF);
@ -72,7 +79,8 @@
"minGradP", "minGradP",
fvc::reconstruct((phig - p_rghEqn.flux())/rAUf) fvc::reconstruct((phig - p_rghEqn.flux())/rAUf)
); );
U = HbyA + rAU*cellMask*minGradP; //U = HbyA + rAU*cellMask*minGradP;
U = fvc::reconstruct(phi);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
fvOptions.correct(U); fvOptions.correct(U);
} }

View File

@ -11,5 +11,6 @@ moveMeshOuterCorrectors =
massFluxInterpolation = massFluxInterpolation =
pimple.dict().lookupOrDefault("massFluxInterpolation", false); pimple.dict().lookupOrDefault("massFluxInterpolation", false);
ddtCorr = ddtCorr = pimple.dict().lookupOrDefault("ddtCorr", true);
pimple.dict().lookupOrDefault("ddtCorr", true);
adjustFringe = pimple.dict().lookupOrDefault("oversetAdjustPhi", false);

View File

@ -34,28 +34,33 @@ Foam::fileFormats::NASCore::NASCore()
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::scalar Foam::fileFormats::NASCore::parseNASCoord Foam::scalar Foam::fileFormats::NASCore::parseNASCoord(const string& s)
(
const string& s
)
{ {
size_t expSign = s.find_last_of("+-"); scalar value = 0;
if (expSign != string::npos && expSign > 0 && !isspace(s[expSign-1])) const size_t expSign = s.find_last_of("+-");
if (expSign != std::string::npos && expSign > 0 && !isspace(s[expSign-1]))
{ {
scalar mantissa = readScalar(IStringStream(s.substr(0, expSign))()); scalar exponent = 0;
scalar exponent = readScalar(IStringStream(s.substr(expSign+1))());
// Parse as per strtod/strtof - allowing trailing space or [Ee]
readScalar(s.substr(0, expSign).c_str(), value); // mantissa
readScalar(s.substr(expSign+1).c_str(), exponent);
if (s[expSign] == '-') if (s[expSign] == '-')
{ {
exponent = -exponent; exponent = -exponent;
} }
return mantissa * pow(10, exponent);
value *= ::pow(10, exponent);
} }
else else
{ {
return readScalar(IStringStream(s)()); readScalar(s.c_str(), value);
} }
return value;
} }

View File

@ -55,8 +55,8 @@ public:
// Public Member Functions // Public Member Functions
//- Do weird things to extract number //- Extract numbers from things like "-2.358-8" (same as "-2.358e-8")
static scalar parseNASCoord(const string&); static scalar parseNASCoord(const string& s);
// Constructors // Constructors

View File

@ -361,6 +361,23 @@ Foam::label Foam::isoCutCell::calcSubCell
// Cell cut at least at one face // Cell cut at least at one face
cellStatus_ = 0; cellStatus_ = 0;
calcIsoFaceCentreAndArea(); calcIsoFaceCentreAndArea();
// In the rare but occuring cases where a cell is only touched at a
// point or a line the isoFaceArea_ will have zero length and here the
// cell should be treated as either completely empty or full.
if (mag(isoFaceArea_) < 10*SMALL)
{
if (fullySubFaces_.empty())
{
// Cell fully above isosurface
cellStatus_ = 1;
}
else
{
// Cell fully below isosurface
cellStatus_ = -1;
}
}
} }
else if (fullySubFaces_.empty()) else if (fullySubFaces_.empty())
{ {

View File

@ -35,6 +35,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "triSurface.H" #include "triSurface.H"
#include "NASCore.H"
#include "IFstream.H" #include "IFstream.H"
#include "StringStream.H" #include "StringStream.H"
@ -46,25 +47,9 @@ namespace Foam
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// Do weird things to extract number // Do weird things to extract number
static scalar parseNASCoord(const string& s) static inline scalar parseNASCoord(const string& s)
{ {
size_t expSign = s.find_last_of("+-"); return fileFormats::NASCore::parseNASCoord(s);
if (expSign != string::npos && expSign > 0 && !isspace(s[expSign-1]))
{
scalar mantissa = readScalar(IStringStream(s.substr(0, expSign))());
scalar exponent = readScalar(IStringStream(s.substr(expSign+1))());
if (s[expSign] == '-')
{
exponent = -exponent;
}
return mantissa*pow(10, exponent);
}
else
{
return readScalar(IStringStream(s)());
}
} }
@ -300,8 +285,8 @@ bool triSurface::readNAS(const fileName& fName)
// GRID* 126 0 -5.55999875E+02 -5.68730474E+02 // GRID* 126 0 -5.55999875E+02 -5.68730474E+02
// * 2.14897901E+02 // * 2.14897901E+02
label index = label index =
readLabel(IStringStream(readNASToken(line, 8, linei))()); readLabel(IStringStream(readNASToken(line, 16, linei))());
readNASToken(line, 8, linei); readNASToken(line, 16, linei);
scalar x = parseNASCoord(readNASToken(line, 16, linei)); scalar x = parseNASCoord(readNASToken(line, 16, linei));
scalar y = parseNASCoord(readNASToken(line, 16, linei)); scalar y = parseNASCoord(readNASToken(line, 16, linei));

View File

@ -57,6 +57,11 @@ oversetInterpolation
method inverseDistance; method inverseDistance;
} }
oversetInterpolationRequired
{
alpha.water;
}
fluxRequired fluxRequired
{ {
default no; default no;

View File

@ -85,6 +85,8 @@ PIMPLE
ddtCorr yes; ddtCorr yes;
correctPhi no; correctPhi no;
oversetAdjustPhi no;
moveMeshOuterCorrectors no; moveMeshOuterCorrectors no;
turbOnFinalIterOnly no; turbOnFinalIterOnly no;
} }