Commit 193f698f authored by andy's avatar andy
Browse files

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

parents 681948b4 8a8d5b2d
......@@ -105,7 +105,15 @@
+ Additional wall functions for primary region momentum and temperature
taking film into account
+ Parallel aware
*** *New* ptscotch decomposition method
*** *New* ptscotch decomposition method.
*** *New* multiLevel decomposition method.
Decomposes in levels, e.g. first decompose onto number of nodes and
then onto number of cores per node. This will minimise off-node
communication. Each level can use any of the other decomposition methods
*** *New* structured decomposition method.
Does a 2D decomposition of a mesh. Valid only for an 'extruded' mesh, i.e.
columns of cells originating from a patch. Bases decomposition on this
patch and assigns the cells according to the patch decomposition.
*** *Updated* scotch decomposition method to run in parallel by doing
decomposition on the master. Unfortunately scotch and ptscotch cannot
be linked in to the same executable.
......@@ -229,7 +237,8 @@
(nonuniformTransform)cyclic <zoneA>_<zoneB>
+ extrudes into master direction (i.e. away from the owner cell
if flipMap is false)
+ =topoSet=: replacement of cellSet,faceSet,pointSet utilities.
+ =topoSet=: replacement of cellSet,faceSet,pointSet utilities. Multiple
commands operating on different sets.
Comparable to a dictionary driven =setSet= utility.
*** Updated utilities
+ =setFields=: optionally use faceSets to set patch values (see
......
buoyantBaffleSimpleFoam.C
EXE = $(FOAM_APPBIN)/buoyantBaffleSimpleFoam
EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
-I$(LIB_SRC)/finiteVolume/cfdTools \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
-I$(LIB_SRC)/regionModels/thermoBaffleModels/lnInclude
EXE_LIBS = \
-lmeshTools \
-lbasicThermophysicalModels \
-lspecie \
-lcompressibleTurbulenceModel \
-lcompressibleRASModels \
-lfiniteVolume \
-lmeshTools \
-lthermoBaffleModels
// Solve the Momentum equation
tmp<fvVectorMatrix> UEqn
(
fvm::div(phi, U)
+ turbulence->divDevRhoReff(U)
);
UEqn().relax();
if (simple.momentumPredictor())
{
solve
(
UEqn()
==
fvc::reconstruct
(
(
- ghf*fvc::snGrad(rho)
- fvc::snGrad(p_rgh)
)*mesh.magSf()
)
);
}
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
buoyantBaffleSimpleFoam
Description
Steady-state solver for buoyant, turbulent flow of compressible fluids
using thermal baffles
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "basicPsiThermo.H"
#include "RASModel.H"
#include "fixedGradientFvPatchFields.H"
#include "simpleControl.H"
#include "thermoBaffleModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
#include "readGravitationalAcceleration.H"
#include "createFields.H"
#include "initContinuityErrs.H"
simpleControl simple(mesh);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
while (simple.loop())
{
Info<< "Time = " << runTime.timeName() << nl << endl;
p_rgh.storePrevIter();
rho.storePrevIter();
// Pressure-velocity SIMPLE corrector
{
#include "UEqn.H"
#include "hEqn.H"
#include "pEqn.H"
}
turbulence->correct();
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //
Info<< "Reading thermophysical properties\n" << endl;
autoPtr<basicPsiThermo> pThermo
(
basicPsiThermo::New(mesh)
);
basicPsiThermo& thermo = pThermo();
volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
thermo.rho()
);
volScalarField& p = thermo.p();
volScalarField& h = thermo.h();
const volScalarField& psi = thermo.psi();
Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
#include "compressibleCreatePhi.H"
Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::RASModel> turbulence
(
compressible::RASModel::New
(
rho,
U,
phi,
thermo
)
);
Info<< "Calculating field g.h\n" << endl;
volScalarField gh("gh", g & mesh.C());
surfaceScalarField ghf("ghf", g & mesh.Cf());
Info<< "Reading field p_rgh\n" << endl;
volScalarField p_rgh
(
IOobject
(
"p_rgh",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
// Force p_rgh to be consistent with p
p_rgh = p - rho*gh;
label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell
(
p,
p_rgh,
mesh.solutionDict().subDict("SIMPLE"),
pRefCell,
pRefValue
);
autoPtr<regionModels::thermoBaffleModels::thermoBaffleModel> baffles
(
regionModels::thermoBaffleModels::thermoBaffleModel::New(mesh)
);
dimensionedScalar initialMass = fvc::domainIntegrate(rho);
dimensionedScalar totalVolume = sum(mesh.V());
{
fvScalarMatrix hEqn
(
fvm::div(phi, h)
- fvm::Sp(fvc::div(phi), h)
- fvm::laplacian(turbulence->alphaEff(), h)
==
fvc::div(phi/fvc::interpolate(rho)*fvc::interpolate(p))
- p*fvc::div(phi/fvc::interpolate(rho))
);
hEqn.relax();
hEqn.solve();
baffles->evolve();
thermo.correct();
}
{
rho = thermo.rho();
rho.relax();
volScalarField rAU(1.0/UEqn().A());
surfaceScalarField rhorAUf("(rho*(1|A(U)))", fvc::interpolate(rho*rAU));
U = rAU*UEqn().H();
UEqn.clear();
phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf());
bool closedVolume = adjustPhi(phi, U, p_rgh);
surfaceScalarField buoyancyPhi(rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf());
phi -= buoyancyPhi;
for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
{
fvScalarMatrix p_rghEqn
(
fvm::laplacian(rhorAUf, p_rgh) == fvc::div(phi)
);
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
p_rghEqn.solve();
if (nonOrth == simple.nNonOrthCorr())
{
// Calculate the conservative fluxes
phi -= p_rghEqn.flux();
// Explicitly relax pressure for momentum corrector
p_rgh.relax();
// Correct the momentum source with the pressure gradient flux
// calculated from the relaxed pressure
U -= rAU*fvc::reconstruct((buoyancyPhi + p_rghEqn.flux())/rhorAUf);
U.correctBoundaryConditions();
}
}
#include "continuityErrs.H"
p = p_rgh + rho*gh;
// For closed-volume cases adjust the pressure level
// to obey overall mass continuity
if (closedVolume)
{
p += (initialMass - fvc::domainIntegrate(psi*p))
/fvc::domainIntegrate(psi);
p_rgh = p - rho*gh;
}
rho = thermo.rho();
rho.relax();
Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value()
<< endl;
}
......@@ -37,6 +37,7 @@ method scotch;
// method metis;
// method manual;
// method multiLevel;
// method structured; // does 2D decomposition of structured mesh
multiLevelCoeffs
{
......@@ -108,6 +109,15 @@ manualCoeffs
}
structuredCoeffs
{
// Patches to do 2D decomposition on. Structured mesh only; cells have
// to be in 'columns' on top of patches.
patches (bottomPatch);
}
//// Is the case distributed
//distributed yes;
//// Per slave (so nProcs-1 entries) the directory above the case.
......
......@@ -860,6 +860,16 @@ bool Foam::domainDecomposition::writeDecomposition()
scalar avgProcPatches = scalar(totProcPatches)/nProcs_;
scalar avgProcFaces = scalar(totProcFaces)/nProcs_;
// In case of all faces on one processor. Just to avoid division by 0.
if (totProcPatches == 0)
{
avgProcPatches = 1;
}
if (totProcFaces == 0)
{
avgProcFaces = 1;
}
Info<< nl
<< "Number of processor faces = " << totProcFaces/2 << nl
<< "Max number of cells = " << maxProcCells
......
......@@ -475,6 +475,16 @@ void printMeshData(const polyMesh& mesh)
scalar avgProcPatches = scalar(totProcPatches)/Pstream::nProcs();
scalar avgProcFaces = scalar(totProcFaces)/Pstream::nProcs();
// In case of all faces on one processor. Just to avoid division by 0.
if (totProcPatches == 0)
{
avgProcPatches = 1;
}
if (totProcFaces == 0)
{
avgProcFaces = 1;
}
Info<< nl
<< "Number of processor faces = " << totProcFaces/2 << nl
<< "Max number of cells = " << maxProcCells
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -249,7 +249,11 @@ int main(int argc, char *argv[])
// search engine
indexedOctree<treeDataTriSurface> selectTree
(
treeDataTriSurface(selectSurf),
treeDataTriSurface
(
selectSurf,
indexedOctree<treeDataTriSurface>::perturbTol()
),
bb.extend(rndGen, 1E-4), // slightly randomize bb
8, // maxLevel
10, // leafsize
......
......@@ -714,7 +714,7 @@ Foam::point Foam::indexedOctree<Type>::pushPoint
)
{
// Get local length scale.
const vector perturbVec = perturbTol_*(bb.span());
const vector perturbVec = perturbTol_*bb.span();
point perturbedPt(pt);
......
......@@ -179,9 +179,14 @@ defineTypeNameAndDebug(Foam::treeDataTriSurface, 0);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::treeDataTriSurface::treeDataTriSurface(const triSurface& surface)
Foam::treeDataTriSurface::treeDataTriSurface
(
const triSurface& surface,
const scalar planarTol
)
:
surface_(surface)
surface_(surface),
planarTol_(planarTol)
{}
......@@ -437,7 +442,7 @@ bool Foam::treeDataTriSurface::intersects
dir,
points,
intersection::HALF_RAY,
indexedOctree<treeDataTriSurface>::perturbTol()
planarTol_
);
if (inter.hit() && inter.distance() <= 1)
......
......@@ -55,8 +55,11 @@ class treeDataTriSurface
{
// Private data
//- Reference to triSurface
const triSurface& surface_;
//- Tolerance to use for intersection tests
const scalar planarTol_;
// Private Member Functions
......@@ -83,8 +86,9 @@ public:
// Constructors
//- Construct from triSurface. Holds reference.
treeDataTriSurface(const triSurface&);
//- Construct from triSurface and tolerance for intersection
// tests. Holds reference.
treeDataTriSurface(const triSurface&, const scalar planarTol);
// Member Functions
......
......@@ -492,7 +492,7 @@ void Foam::triSurfaceMesh::movePoints(const pointField& newPoints)
const Foam::indexedOctree<Foam::treeDataTriSurface>&
Foam::triSurfaceMesh::tree() const
Foam::triSurfaceMesh::tree() const
{
if (tree_.empty())
{
......@@ -528,7 +528,7 @@ const Foam::indexedOctree<Foam::treeDataTriSurface>&
(
new indexedOctree<treeDataTriSurface>
(
treeDataTriSurface(*this),
treeDataTriSurface(*this, tolerance_),
bb,
maxTreeDepth_, // maxLevel
10, // leafsize
......@@ -544,7 +544,7 @@ const Foam::indexedOctree<Foam::treeDataTriSurface>&
const Foam::indexedOctree<Foam::treeDataEdge>&
Foam::triSurfaceMesh::edgeTree() const
Foam::triSurfaceMesh::edgeTree() const
{
if (edgeTree_.empty())
{
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -64,7 +64,11 @@ Foam::triSurfaceSearch::triSurfaceSearch(const triSurface& surface)
(
new indexedOctree<treeDataTriSurface>
(
treeDataTriSurface(surface_),
treeDataTriSurface
(
surface_,
indexedOctree<treeDataTriSurface>::perturbTol()
),
treeBb,
8, // maxLevel
10, // leafsize
......
......@@ -448,8 +448,8 @@ void Foam::decompositionMethod::calcCellCells
// Count number of faces (internal + coupled)
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Number of faces per cell
labelList nFacesPerCell(mesh.nCells(), 0);
// Number of faces per coarse cell
labelList nFacesPerCell(nCoarse, 0);
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
{
......@@ -481,7 +481,11 @@ void Foam::decompositionMethod::calcCellCells
{
label own = agglom[faceOwner[faceI]];
label globalNei = globalNeighbour[bFaceI];
if (cellPair.insert(labelPair(own, globalNei)))
if
(
globalAgglom.toGlobal(own) != globalNei
&& cellPair.insert(labelPair(own, globalNei))
)
{
nFacesPerCell[own]++;
}
......
......@@ -76,10 +76,10 @@ class temperatureThermoBaffle1DFvPatchScalarField
solidThermoData(const dictionary& dict)
:
solidPtr_(new solidType(dict)),
transportDict_(dict.subDict("transportProperties")),
radiationDict_(dict.subDict("radiativeProperties")),
thermoDict_(dict.subDict("thermoProperties")),
densityDict_(dict.subDict("densityProperties"))
transportDict_(dict.subDict("transport")),
radiationDict_(dict.subDict("radiation")),
thermoDict_(dict.subDict("thermodynamics")),
densityDict_(dict.subDict("density"))
{}
......@@ -103,13 +103,13 @@ class temperatureThermoBaffle1DFvPatchScalarField
void write(Ostream& os) const
{
os.writeKeyword("transportProperties");
os.writeKeyword("transport");
os << transportDict_ << nl;
os.writeKeyword("radiativeProperties");
os.writeKeyword("radiation");
os << radiationDict_ << nl;
os.writeKeyword("thermoProperties");
os.writeKeyword("thermodynamics");
os << thermoDict_ << nl;