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

This commit is contained in:
sergio
2012-04-19 14:10:14 +01:00
175 changed files with 7067 additions and 1808 deletions

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -58,7 +58,7 @@ using namespace Foam;
// Max cos angle for edges to be considered aligned with axis.
static const scalar edgeTol = 1E-3;
static const scalar edgeTol = 1e-3;
void writeSet(const cellSet& cells, const string& msg)

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -528,7 +528,7 @@ int main(int argc, char *argv[])
(
mesh,
boundaryPoint,
1E-9, // factor of largest face area
1e-9, // factor of largest face area
5, // factor between smallest and largest edge on
// face
collapser

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -31,7 +31,7 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const Foam::scalar Foam::edgeStats::edgeTol_ = 1E-3;
const Foam::scalar Foam::edgeStats::edgeTol_ = 1e-3;

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -209,7 +209,7 @@ int main(int argc, char *argv[])
const pointField& points = pMesh.points();
const boundBox& bb = pMesh.bounds();
const scalar mergeDim = 1E-4 * bb.minDim();
const scalar mergeDim = 1e-4 * bb.minDim();
forAll(edges, edgeI)
{

View File

@ -561,7 +561,7 @@ Foam::label Foam::conformalVoronoiMesh::mergeCloseDualVertices
scalar closenessTolerance = cvMeshControls().mergeClosenessCoeff();
// Absolute distance for points to be considered coincident. Bit adhoc
// but points were seen with distSqr ~ 1E-30 which is SMALL^2. Add a few
// but points were seen with distSqr ~ 1e-30 which is SMALL^2. Add a few
// digits to account for truncation errors.
scalar coincidentDistanceSqr = sqr
(

View File

@ -51,7 +51,7 @@ using namespace Foam;
// Tolerance (as fraction of the bounding box). Needs to be fairly lax since
// usually meshes get written with limited precision (6 digits)
static const scalar defaultMergeTol = 1E-6;
static const scalar defaultMergeTol = 1e-6;
// Get merging distance when matching face centres
scalar getMergeDistance
@ -397,7 +397,7 @@ int main(int argc, char *argv[])
"mergeTol",
"scalar",
"specify the merge distance relative to the bounding box size "
"(default 1E-6)"
"(default 1e-6)"
);
#include "setRootCase.H"

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -666,7 +666,7 @@ int main(int argc, char *argv[])
const boundBox& bb = mesh.bounds();
const vector span = bb.span();
const scalar mergeDim = 1E-4 * bb.minDim();
const scalar mergeDim = 1e-4 * bb.minDim();
Info<< "Mesh bounding box : " << bb << nl
<< " with span : " << span << nl

View File

@ -257,7 +257,7 @@ int main(int argc, char *argv[])
const pointField& points = mesh().points();
const boundBox& bb = mesh().bounds();
const scalar mergeDim = 1E-4 * bb.minDim();
const scalar mergeDim = 1e-4 * bb.minDim();
forAll(edges, edgeI)
{

View File

@ -41,8 +41,8 @@ Foam::label Foam::findOppositeWedge
if
(
pp.size() == wpp.size()
&& mag(pp.axis() & wpp.axis()) >= (1-1E-3)
&& mag(ppCosAngle - wppCosAngle) >= 1E-3
&& mag(pp.axis() & wpp.axis()) >= (1-1e-3)
&& mag(ppCosAngle - wppCosAngle) >= 1e-3
)
{
return patchI;
@ -106,7 +106,7 @@ bool Foam::checkWedges
);
if (mag(opp.axis() & pp.axis()) < (1-1E-3))
if (mag(opp.axis() & pp.axis()) < (1-1e-3))
{
if (report)
{

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -52,7 +52,7 @@ void Foam::meshDualiser::checkPolyTopoChange(const polyTopoChange& meshMod)
label nUnique = mergePoints
(
points,
1E-6,
1e-6,
false,
oldToNew
);
@ -226,7 +226,7 @@ Foam::label Foam::meshDualiser::addInternalFace
label nUnique = mergePoints
(
facePoints,
1E-6,
1e-6,
false,
oldToNew
);

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -52,7 +52,7 @@ using namespace Foam;
// Max cos angle for edges to be considered aligned with axis.
static const scalar edgeTol = 1E-3;
static const scalar edgeTol = 1e-3;
// Calculate some edge statistics on mesh.
@ -206,7 +206,7 @@ label twoDNess(const polyMesh& mesh)
minLen = min(minLen, mesh.edges()[cEdges[i]].mag(mesh.points()));
}
if (cellPlane.distance(ctrs[cellI]) > 1E-6*minLen)
if (cellPlane.distance(ctrs[cellI]) > 1e-6*minLen)
{
// Centres not in plane
return -1;
@ -274,7 +274,7 @@ label twoDNess(const polyMesh& mesh)
const scalarField cosAngle(mag(n/mag(n) & cellPlane.normal()));
if (mag(min(cosAngle) - max(cosAngle)) > 1E-6)
if (mag(min(cosAngle) - max(cosAngle)) > 1e-6)
{
// cosAngle should be either ~1 over all faces (2D front and
// back) or ~0 (all other patches perp to 2D)

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -55,7 +55,7 @@ using namespace Foam;
// Tolerance (as fraction of the bounding box). Needs to be fairly lax since
// usually meshes get written with limited precision (6 digits)
static const scalar defaultMergeTol = 1E-7;
static const scalar defaultMergeTol = 1e-7;
static void renumber
@ -290,7 +290,7 @@ int main(int argc, char *argv[])
"mergeTol",
"scalar",
"specify the merge distance relative to the bounding box size "
"(default 1E-7)"
"(default 1e-7)"
);
argList::addBoolOption
(

View File

@ -60,7 +60,7 @@ Description
// Tolerance (as fraction of the bounding box). Needs to be fairly lax since
// usually meshes get written with limited precision (6 digits)
static const scalar defaultMergeTol = 1E-6;
static const scalar defaultMergeTol = 1e-6;
//// Read mesh if available. Otherwise create empty mesh with same non-proc
@ -721,7 +721,7 @@ int main(int argc, char *argv[])
"mergeTol",
"scalar",
"specify the merge distance relative to the bounding box size "
"(default 1E-6)"
"(default 1e-6)"
);
# include "setRootCase.H"

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -37,6 +37,8 @@ Description
#include "surfaceFields.H"
#include "pointFields.H"
#include "ReadFields.H"
#include "interpolationWeights.H"
#include "uniformInterpolate.H"
using namespace Foam;
@ -48,6 +50,8 @@ class fieldInterpolator
const HashSet<word>& selectedFields_;
instant ti_;
instant ti1_;
const interpolationWeights& interpolator_;
const wordList& timeNames_;
int divisions_;
public:
@ -60,6 +64,8 @@ public:
const HashSet<word>& selectedFields,
const instant& ti,
const instant& ti1,
const interpolationWeights& interpolator,
const wordList& timeNames,
int divisions
)
:
@ -69,6 +75,8 @@ public:
selectedFields_(selectedFields),
ti_(ti),
ti1_(ti1),
interpolator_(interpolator),
timeNames_(timeNames),
divisions_(divisions)
{}
@ -98,34 +106,6 @@ void fieldInterpolator::interpolate()
{
Info<< " " << fieldIter()->name() << '(';
GeoFieldType fieldi
(
IOobject
(
fieldIter()->name(),
ti_.name(),
fieldIter()->db(),
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
),
mesh_
);
GeoFieldType fieldi1
(
IOobject
(
fieldIter()->name(),
ti1_.name(),
fieldIter()->db(),
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
),
mesh_
);
scalar deltaT = (ti1_.value() - ti_.value())/(divisions_ + 1);
for (int j=0; j<divisions_; j++)
@ -141,20 +121,51 @@ void fieldInterpolator::interpolate()
Info<< " ";
}
scalar lambda = scalar(j + 1)/scalar(divisions_ + 1);
// Calculate times to read and weights
labelList indices;
scalarField weights;
interpolator_.valueWeights
(
runTime_.value(),
indices,
weights
);
const wordList selectedTimeNames
(
UIndirectList<word>(timeNames_, indices)()
);
//Info<< "For time " << runTime_.value()
// << " need times " << selectedTimeNames
// << " need weights " << weights << endl;
// Read on the objectRegistry all the required fields
ReadFields<GeoFieldType>
(
fieldIter()->name(),
mesh_,
selectedTimeNames
);
GeoFieldType fieldj
(
IOobject
uniformInterpolate<GeoFieldType>
(
IOobject
(
fieldIter()->name(),
runTime_.timeName(),
fieldIter()->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
fieldIter()->name(),
timej.name(),
fieldIter()->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
(1.0 - lambda)*fieldi + lambda*fieldi1
selectedTimeNames,
weights
)
);
fieldj.write();
@ -188,6 +199,12 @@ int main(int argc, char *argv[])
"integer",
"specify number of temporal sub-divisions to create (default = 1)."
);
argList::addOption
(
"interpolationType",
"word",
"specify type of interpolation (linear or spline)"
);
#include "setRootCase.H"
#include "createTime.H"
@ -198,15 +215,51 @@ int main(int argc, char *argv[])
{
args.optionLookup("fields")() >> selectedFields;
}
if (selectedFields.size())
{
Info<< "Interpolating fields " << selectedFields << nl << endl;
}
else
{
Info<< "Interpolating all fields" << nl << endl;
}
int divisions = 1;
if (args.optionFound("divisions"))
{
args.optionLookup("divisions")() >> divisions;
}
Info<< "Using " << divisions << " per time interval" << nl << endl;
const word interpolationType = args.optionLookupOrDefault<word>
(
"interpolationType",
"linear"
);
Info<< "Using interpolation " << interpolationType << nl << endl;
instantList timeDirs = timeSelector::select0(runTime, args);
scalarField timeVals(timeDirs.size());
wordList timeNames(timeDirs.size());
forAll(timeDirs, i)
{
timeVals[i] = timeDirs[i].value();
timeNames[i] = timeDirs[i].name();
}
autoPtr<interpolationWeights> interpolatorPtr
(
interpolationWeights::New
(
interpolationType,
timeVals
)
);
#include "createMesh.H"
Info<< "Interpolating fields for times:" << endl;
@ -226,6 +279,8 @@ int main(int argc, char *argv[])
selectedFields,
timeDirs[timei],
timeDirs[timei+1],
interpolatorPtr(),
timeNames,
divisions
);

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -70,6 +70,7 @@ Usage
#include "IOPtrList.H"
#include "volFields.H"
#include "stringListOps.H"
#include "timeSelector.H"
using namespace Foam;
@ -252,12 +253,10 @@ int main(int argc, char *argv[])
"file",
"specify an alternative to system/changeDictionaryDict"
);
argList::addOption
(
"instance",
"name",
"specify alternate time instance - default is latest time"
);
// Add explicit time option
timeSelector::addOptions();
argList::addBoolOption
(
"literalRE",
@ -272,6 +271,17 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
#include "createTime.H"
// Optionally override controlDict time with -time options
instantList times = timeSelector::selectIfPresent(runTime, args);
if (times.size() < 1)
{
FatalErrorIn(args.executable())
<< "No times selected." << exit(FatalError);
}
runTime.setTime(times[0], 0);
#include "createNamedMesh.H"
const word dictName("changeDictionaryDict");
@ -317,11 +327,6 @@ int main(int argc, char *argv[])
regionPrefix = regionName;
}
word instance = runTime.timeName();
if (args.options().found("instance"))
{
instance = args.options()["instance"];
}
// Make sure we do not use the master-only reading since we read
// fields (different per processor) as dictionaries.
@ -460,7 +465,7 @@ int main(int argc, char *argv[])
IOobject
(
fieldName,
instance,
runTime.timeName(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -32,7 +32,7 @@ License
namespace Foam
{
static const scalar perturbFactor = 1E-6;
static const scalar perturbFactor = 1e-6;
// Special version of findCell that generates a cell guaranteed to be

View File

@ -7,7 +7,7 @@ List<treeBoundBox> meshBb
treeBoundBox
(
boundBox(coarseMesh.points(), false)
).extend(rndGen, 1E-3)
).extend(rndGen, 1e-3)
);
// Dummy bounds dictionary

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -367,7 +367,7 @@ int main(int argc, char *argv[])
forAll(triQ, faceI)
{
if (triQ[faceI] < 1E-11)
if (triQ[faceI] < 1e-11)
{
problemFaces.append(faceI);
}
@ -427,9 +427,9 @@ int main(int argc, char *argv[])
const pointField& localPoints = surf.localPoints();
const boundBox bb(localPoints);
scalar smallDim = 1E-6 * bb.mag();
scalar smallDim = 1e-6 * bb.mag();
Info<< "Checking for points less than 1E-6 of bounding box ("
Info<< "Checking for points less than 1e-6 of bounding box ("
<< bb.span() << " meter) apart."
<< endl;

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -159,7 +159,7 @@ int main(int argc, char *argv[])
treeBoundBox
(
boundBox(mesh.points(), false)
).extend(rndGen, 1E-3)
).extend(rndGen, 1e-3)
);
Pstream::gatherList(meshBb);
Pstream::scatterList(meshBb);

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -254,7 +254,7 @@ int main(int argc, char *argv[])
selectSurf,
indexedOctree<treeDataTriSurface>::perturbTol()
),
bb.extend(rndGen, 1E-4), // slightly randomize bb
bb.extend(rndGen, 1e-4), // slightly randomize bb
8, // maxLevel
10, // leafsize
3.0 // duplicity