Commit c15ceeb6 authored by mattijs's avatar mattijs
Browse files

Merge branch 'master' of /home/hunt2/OpenFOAM/OpenFOAM-dev

parents ce41e459 3a394556
......@@ -2,7 +2,8 @@
cd ${0%/*} || exit 1 # run from this directory
set -x
( cd OpenFOAM && wmakeLnInclude . )
wmakeLnInclude -f OpenFOAM
wmakeLnInclude -f OSspecific/$WM_OS
( cd Pstream && ./Allwmake )
wmake libo OSspecific/$WM_OS
......
......@@ -31,13 +31,16 @@ License
namespace Foam
{
namespace compressibilityModels
{
defineTypeNameAndDebug(Chung, 0);
addToRunTimeSelectionTable(barotropicCompressibilityModel, Chung, dictionary);
}
namespace compressibilityModels
{
defineTypeNameAndDebug(Chung, 0);
addToRunTimeSelectionTable
(
barotropicCompressibilityModel,
Chung,
dictionary
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
......@@ -45,10 +48,11 @@ addToRunTimeSelectionTable(barotropicCompressibilityModel, Chung, dictionary);
Foam::compressibilityModels::Chung::Chung
(
const dictionary& compressibilityProperties,
const volScalarField& gamma
const volScalarField& gamma,
const word& psiName
)
:
barotropicCompressibilityModel(compressibilityProperties, gamma),
barotropicCompressibilityModel(compressibilityProperties, gamma, psiName),
psiv_(compressibilityProperties_.lookup("psiv")),
psil_(compressibilityProperties_.lookup("psil")),
rhovSat_(compressibilityProperties_.lookup("rhovSat")),
......
......@@ -75,7 +75,8 @@ public:
Chung
(
const dictionary& compressibilityProperties,
const volScalarField& gamma
const volScalarField& gamma,
const word& psiName = "psi"
);
......
......@@ -31,13 +31,16 @@ License
namespace Foam
{
namespace compressibilityModels
{
defineTypeNameAndDebug(Wallis, 0);
addToRunTimeSelectionTable(barotropicCompressibilityModel, Wallis, dictionary);
}
namespace compressibilityModels
{
defineTypeNameAndDebug(Wallis, 0);
addToRunTimeSelectionTable
(
barotropicCompressibilityModel,
Wallis,
dictionary
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
......@@ -45,10 +48,11 @@ addToRunTimeSelectionTable(barotropicCompressibilityModel, Wallis, dictionary);
Foam::compressibilityModels::Wallis::Wallis
(
const dictionary& compressibilityProperties,
const volScalarField& gamma
const volScalarField& gamma,
const word& psiName
)
:
barotropicCompressibilityModel(compressibilityProperties, gamma),
barotropicCompressibilityModel(compressibilityProperties, gamma, psiName),
psiv_(compressibilityProperties_.lookup("psiv")),
psil_(compressibilityProperties_.lookup("psil")),
rhovSat_(compressibilityProperties_.lookup("rhovSat")),
......@@ -62,8 +66,9 @@ Foam::compressibilityModels::Wallis::Wallis
void Foam::compressibilityModels::Wallis::correct()
{
psi_ = (gamma_*rhovSat_ + (scalar(1) - gamma_)*rholSat_)
*(gamma_*psiv_/rhovSat_ + (scalar(1) - gamma_)*psil_/rholSat_);
psi_ =
(gamma_*rhovSat_ + (scalar(1) - gamma_)*rholSat_)
*(gamma_*psiv_/rhovSat_ + (scalar(1) - gamma_)*psil_/rholSat_);
}
......
......@@ -75,7 +75,8 @@ public:
Wallis
(
const dictionary& compressibilityProperties,
const volScalarField& gamma
const volScalarField& gamma,
const word& psiName = "psi"
);
......
......@@ -42,7 +42,8 @@ namespace Foam
Foam::barotropicCompressibilityModel::barotropicCompressibilityModel
(
const dictionary& compressibilityProperties,
const volScalarField& gamma
const volScalarField& gamma,
const word& psiName
)
:
compressibilityProperties_(compressibilityProperties),
......@@ -50,12 +51,12 @@ Foam::barotropicCompressibilityModel::barotropicCompressibilityModel
(
IOobject
(
"psi",
psiName,
gamma.mesh().time().timeName(),
gamma.mesh()
),
gamma.mesh(),
dimensionedScalar("psi", dimensionSet(0, -2, 2, 0, 0), 0)
dimensionedScalar(psiName, dimensionSet(0, -2, 2, 0, 0), 0)
),
gamma_(gamma)
{}
......
......@@ -97,9 +97,10 @@ public:
dictionary,
(
const dictionary& compressibilityProperties,
const volScalarField& gamma
const volScalarField& gamma,
const word& psiName
),
(compressibilityProperties, gamma)
(compressibilityProperties, gamma, psiName)
);
......@@ -109,7 +110,8 @@ public:
static autoPtr<barotropicCompressibilityModel> New
(
const dictionary& compressibilityProperties,
const volScalarField& gamma
const volScalarField& gamma,
const word& psiName = "psi"
);
......@@ -119,7 +121,8 @@ public:
barotropicCompressibilityModel
(
const dictionary& compressibilityProperties,
const volScalarField& gamma
const volScalarField& gamma,
const word& psiName = "psi"
);
......
......@@ -32,7 +32,8 @@ Foam::autoPtr<Foam::barotropicCompressibilityModel>
Foam::barotropicCompressibilityModel::New
(
const dictionary& compressibilityProperties,
const volScalarField& gamma
const volScalarField& gamma,
const word& psiName
)
{
word bcModelTypeName
......@@ -60,7 +61,7 @@ Foam::barotropicCompressibilityModel::New
return autoPtr<barotropicCompressibilityModel>
(
cstrIter()(compressibilityProperties, gamma)
cstrIter()(compressibilityProperties, gamma, psiName)
);
}
......
......@@ -31,13 +31,16 @@ License
namespace Foam
{
namespace compressibilityModels
{
defineTypeNameAndDebug(linear, 0);
addToRunTimeSelectionTable(barotropicCompressibilityModel, linear, dictionary);
}
namespace compressibilityModels
{
defineTypeNameAndDebug(linear, 0);
addToRunTimeSelectionTable
(
barotropicCompressibilityModel,
linear,
dictionary
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
......@@ -45,10 +48,11 @@ addToRunTimeSelectionTable(barotropicCompressibilityModel, linear, dictionary);
Foam::compressibilityModels::linear::linear
(
const dictionary& compressibilityProperties,
const volScalarField& gamma
const volScalarField& gamma,
const word& psiName
)
:
barotropicCompressibilityModel(compressibilityProperties, gamma),
barotropicCompressibilityModel(compressibilityProperties, gamma, psiName),
psiv_(compressibilityProperties_.lookup("psiv")),
psil_(compressibilityProperties_.lookup("psil"))
{
......
......@@ -72,7 +72,8 @@ public:
linear
(
const dictionary& compressibilityProperties,
const volScalarField& gamma
const volScalarField& gamma,
const word& psiName = "psi"
);
......
......@@ -23,10 +23,16 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
Nastran surface reader. Does Ansa $ANSA_NAME extension to get name
of patch. Handles Ansa coordinates like:
Nastran surface reader.
- Uses the Ansa "$ANSA_NAME" or the Hypermesh "$HMNAME COMP" extensions
to obtain patch names.
- Handles Nastran short and long formats, but not free format.
- Properly handles the Nastran compact floating point notation: \n
@verbatim
GRID 28 10.20269-.030265-2.358-8
@endverbatim
\*---------------------------------------------------------------------------*/
......@@ -49,13 +55,13 @@ static scalar parseNASCoord(const string& s)
if (expSign != string::npos && expSign > 0 && !isspace(s[expSign-1]))
{
scalar mantissa = readScalar(IStringStream(s.substr(0, expSign))());
scalar exp = readScalar(IStringStream(s.substr(expSign+1))());
scalar exponent = readScalar(IStringStream(s.substr(expSign+1))());
if (s[expSign] == '-')
{
exp = -exp;
exponent = -exponent;
}
return mantissa*pow(10, exp);
return mantissa*pow(10, exponent);
}
else
{
......@@ -64,14 +70,14 @@ static scalar parseNASCoord(const string& s)
}
bool triSurface::readNAS(const fileName& OBJfileName)
bool triSurface::readNAS(const fileName& fName)
{
IFstream OBJfile(OBJfileName);
IFstream is(fName);
if (!OBJfile.good())
if (!is.good())
{
FatalErrorIn("triSurface::readNAS(const fileName&)")
<< "Cannot read file " << OBJfileName
<< "Cannot read file " << fName
<< exit(FatalError);
}
......@@ -90,17 +96,17 @@ bool triSurface::readNAS(const fileName& OBJfileName)
// Ansa tags. Denoted by $ANSA_NAME. These will appear just before the
// first use of a type. We read them and store the pshell types which
// are used to name the patches.
label ansaID = -1;
label ansaId = -1;
word ansaType;
string ansaName;
// Done warnings per unrecognized command
// A single warning per unrecognized command
HashSet<word> unhandledCmd;
while (OBJfile.good())
while (is.good())
{
string line;
OBJfile.getLine(line);
is.getLine(line);
// Ansa extension
if (line.substr(0, 10) == "$ANSA_NAME")
......@@ -116,14 +122,14 @@ bool triSurface::readNAS(const fileName& OBJfileName)
&& sem2 != string::npos
)
{
ansaID = readLabel
ansaId = readLabel
(
IStringStream(line.substr(sem0+1, sem1-sem0-1))()
);
ansaType = line.substr(sem1+1, sem2-sem1-1);
string nameString;
OBJfile.getLine(ansaName);
is.getLine(ansaName);
if (ansaName[ansaName.size()-1] == '\r')
{
ansaName = ansaName.substr(1, ansaName.size()-2);
......@@ -132,13 +138,37 @@ bool triSurface::readNAS(const fileName& OBJfileName)
{
ansaName = ansaName.substr(1, ansaName.size()-1);
}
//Pout<< "ANSA tag for NastranID:" << ansaID
// << " of type " << ansaType
// << " name " << ansaName << endl;
// Info<< "ANSA tag for NastranID:" << ansaId
// << " of type " << ansaType
// << " name " << ansaName << endl;
}
}
// Hypermesh extension
// $HMNAME COMP 1"partName"
if
(
line.substr(0, 12) == "$HMNAME COMP"
&& line.find ('"') != string::npos
)
{
label groupId = readLabel
(
IStringStream(line.substr(16, 16))()
);
IStringStream lineStream(line.substr(32));
string rawName;
lineStream >> rawName;
groupToName.insert(groupId, string::validate<word>(rawName));
Info<< "group " << groupId << " => " << rawName << endl;
}
if (line.size() == 0 || line[0] == '$')
{
// Skip empty or comment
......@@ -153,7 +183,7 @@ bool triSurface::readNAS(const fileName& OBJfileName)
while (true)
{
string buf;
OBJfile.getLine(buf);
is.getLine(buf);
if (buf.size() > 72 && buf[72]=='+')
{
......@@ -174,26 +204,21 @@ bool triSurface::readNAS(const fileName& OBJfileName)
if (cmd == "CTRIA3")
{
//label index, group, a, b, c;
//lineStream >> index >> group >> a >> b >> c;
label group = readLabel(IStringStream(line.substr(16,8))());
label groupId = readLabel(IStringStream(line.substr(16,8))());
label a = readLabel(IStringStream(line.substr(24,8))());
label b = readLabel(IStringStream(line.substr(32,8))());
label c = readLabel(IStringStream(line.substr(40,8))());
// Convert group into patch
Map<label>::const_iterator iter = groupToPatch.find(group);
Map<label>::const_iterator iter = groupToPatch.find(groupId);
label patchI;
if (iter == groupToPatch.end())
{
patchI = nPatches++;
Pout<< "Allocating Foam patch " << patchI
<< " for group " << group << endl;
groupToPatch.insert(group, patchI);
groupToPatch.insert(groupId, patchI);
Info<< "patch " << patchI << " => group " << groupId << endl;
}
else
{
......@@ -204,26 +229,21 @@ bool triSurface::readNAS(const fileName& OBJfileName)
}
else if (cmd == "CQUAD4")
{
//label index, group, a, b, c, d;
//lineStream >> index >> group >> a >> b >> c >> d;
label group = readLabel(IStringStream(line.substr(16,8))());
label groupId = readLabel(IStringStream(line.substr(16,8))());
label a = readLabel(IStringStream(line.substr(24,8))());
label b = readLabel(IStringStream(line.substr(32,8))());
label c = readLabel(IStringStream(line.substr(40,8))());
label d = readLabel(IStringStream(line.substr(48,8))());
// Convert group into patch
Map<label>::const_iterator iter = groupToPatch.find(group);
Map<label>::const_iterator iter = groupToPatch.find(groupId);
label patchI;
if (iter == groupToPatch.end())
{
patchI = nPatches++;
Pout<< "Allocating Foam patch " << patchI
<< " for group " << group << endl;
groupToPatch.insert(group, patchI);
groupToPatch.insert(groupId, patchI);
Info<< "patch " << patchI << " => group " << groupId << endl;
}
else
{
......@@ -235,66 +255,56 @@ bool triSurface::readNAS(const fileName& OBJfileName)
}
else if (cmd == "PSHELL")
{
// Read shell type since gives patchnames.
//label group;
//lineStream >> group;
label group = readLabel(IStringStream(line.substr(8,8))());
if (group == ansaID && ansaType == "PSHELL")
// Read shell type since group gives patchnames
label groupId = readLabel(IStringStream(line.substr(8,8))());
if (groupId == ansaId && ansaType == "PSHELL")
{
Pout<< "Found name " << ansaName << " for group "
<< group << endl;
groupToName.insert(group, string::validate<word>(ansaName));
groupToName.insert(groupId, string::validate<word>(ansaName));
Info<< "group " << groupId << " => " << ansaName << endl;
}
}
else if (cmd == "GRID")
{
//label index;
//lineStream >> index;
label index = readLabel(IStringStream(line.substr(8,8))());
indices.append(index);
scalar x = parseNASCoord(line.substr(24, 8));
scalar y = parseNASCoord(line.substr(32, 8));
scalar z = parseNASCoord(line.substr(40, 8));
indices.append(index);
points.append(point(x, y, z));
}
else if (cmd == "GRID*")
{
// Assume on two lines with '*' continuation symbol on start of
// second line. (comes out of Tgrid. Typical line (spaces truncated)
// Long format is on two lines with '*' continuation symbol
// on start of second line.
// Typical line (spaces compacted)
// GRID* 126 0 -5.55999875E+02 -5.68730474E+02
// * 2.14897901E+02
string line2;
OBJfile.getLine(line2);
if (line2[0] != '*')
label index = readLabel(IStringStream(line.substr(8,16))());
scalar x = parseNASCoord(line.substr(40, 16));
scalar y = parseNASCoord(line.substr(56, 16));
is.getLine(line);
if (line[0] != '*')
{
FatalErrorIn("triSurface::readNAS(const fileName&)")
<< "Expected continuation symbol '*' when reading GRID*"
<< " (double precision coordinate) output by Tgrid" << nl
<< "Read:" << line2 << nl
<< "File:" << OBJfile.name()
<< " line:" << OBJfile.lineNumber()
<< " (double precision coordinate) output" << nl
<< "Read:" << line << nl
<< "File:" << is.name()
<< " line:" << is.lineNumber()
<< exit(FatalError);
}
IStringStream lineStream(line.substr(10) + line2.substr(1));
scalar z = parseNASCoord(line.substr(8, 16));
label index;
lineStream >> index;
indices.append(index);
readScalar(lineStream); // What is this field?
scalar x = readScalar(lineStream);
scalar y = readScalar(lineStream);
scalar z = readScalar(lineStream);
points.append(point(x, y, z));
}
else if (unhandledCmd.insert(cmd))
{
Info<< "Unhandled Nastran command " << line << nl
<< "File:" << OBJfile.name()
<< " line:" << OBJfile.lineNumber()
<< endl;
<< "File:" << is.name() << " line:" << is.lineNumber() << endl;
}
}
......@@ -303,7 +313,7 @@ bool triSurface::readNAS(const fileName& OBJfileName)
faces.shrink();
Pout<< "Read triangles:" << faces.size() << " points:" << points.size()
Info<< "Read triangles:" << faces.size() << " points:" << points.size()
<< endl;
{
......@@ -314,7 +324,7 @@ bool triSurface::readNAS(const fileName& OBJfileName)
indexToPoint.insert(indices[i], i);
}
// Relabel triangles
// Relabel faces
forAll(faces, i)
{
labelledTri& f = faces[i];
......@@ -341,7 +351,7 @@ bool triSurface::readNAS(const fileName& OBJfileName)
);
}
Pout<< "patches:" << patches << endl;
Info<< "patches:" << patches << endl;
// Transfer DynamicLists to straight ones.
......
......@@ -2,8 +2,9 @@
cd ${0%/*} || exit 1 # run from this directory
set -x
wmakeLnInclude -f incompressible
wmake libso LESfilters
wmakeLnInclude incompressible
wmake libso LESdeltas
wmake libso incompressible
wmake libso compressible
......
......@@ -14,6 +14,6 @@ SpalartAllmaras/SpalartAllmaras.C
wallFunctions=derivedFvPatchFields/wallFunctions
muSgsWallFunctions=$(wallFunctions)/muSgsWallFunctions
$(muSgsWallFunctions)/muSgsWallFunction/muSgsWallFunctionFvPatchScalarField.C
$(muSgsWallFunctions)/muSgsSpalartAllmarasWallFunction/muSgsSpalartAllmarasWallFunctionFvPatchScalarField.C
LIB = $(FOAM_LIBBIN)/libcompressibleLESModels
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I../LESdeltas/lnInclude \
-I../LESfilters/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude
......