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

This commit is contained in:
Sergio Ferraris
2013-05-23 17:47:36 +01:00
81 changed files with 2362 additions and 607 deletions

View File

@ -56,6 +56,8 @@ Description
//#include "centredCFCFaceToCellStencilObject.H"
#include "centredCECCellToCellStencilObject.H"
#include "centredCFCCellToCellStencilObject.H"
#include "centredCPCCellToCellStencilObject.H"
using namespace Foam;
@ -460,7 +462,63 @@ int main(int argc, char *argv[])
{
writeStencilOBJ
(
runTime.path()/"centredCell" + Foam::name(cellI) + ".obj",
runTime.path()/"centredCECCell" + Foam::name(cellI) + ".obj",
mesh.cellCentres()[cellI],
stencilPoints[cellI]
);
}
}
{
const extendedCentredCellToCellStencil& addressing =
centredCPCCellToCellStencilObject::New
(
mesh
);
Info<< "cellCellCell:" << endl;
writeStencilStats(addressing.stencil());
// Collect stencil cell centres
List<List<point> > stencilPoints(mesh.nCells());
addressing.collectData
(
mesh.C(),
stencilPoints
);
forAll(stencilPoints, cellI)
{
writeStencilOBJ
(
runTime.path()/"centredCPCCell" + Foam::name(cellI) + ".obj",
mesh.cellCentres()[cellI],
stencilPoints[cellI]
);
}
}
{
const extendedCentredCellToCellStencil& addressing =
centredCFCCellToCellStencilObject::New
(
mesh
);
Info<< "cellCellCell:" << endl;
writeStencilStats(addressing.stencil());
// Collect stencil cell centres
List<List<point> > stencilPoints(mesh.nCells());
addressing.collectData
(
mesh.C(),
stencilPoints
);
forAll(stencilPoints, cellI)
{
writeStencilOBJ
(
runTime.path()/"centredCFCCell" + Foam::name(cellI) + ".obj",
mesh.cellCentres()[cellI],
stencilPoints[cellI]
);

View File

@ -493,7 +493,6 @@ int main(int argc, char *argv[])
mesh.nFaces(), // start
patchI, // index
mesh.boundaryMesh(),// polyBoundaryMesh
Pstream::worldComm, // communicator
Pstream::myProcNo(),// myProcNo
nbrProcI // neighbProcNo
)

View File

@ -180,6 +180,12 @@ castellatedMeshControls
// - used if feature snapping (see snapControls below) is used
resolveFeatureAngle 30;
// Planar angle:
// - used to determine if neighbouring surface normals
// are roughly the same so e.g. free-standing baffles can be merged
// If not specified same as resolveFeatureAngle
//planarAngle 30;
// Region-wise refinement
// ~~~~~~~~~~~~~~~~~~~~~~

View File

@ -14,6 +14,20 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Sample for creating baffles:
// - usually converting internal faces into two boundary faces
// - or converting boundary faces into a boundary face
// (internalFacesOnly=false)(though should use really createPatch
// to do this)
// - can also create duplicate (overlapping) sets of baffles:
// - internalFacesOnly = false
// - have 4 entries in patches:
// - master
// - slave
// - additional master
// - additional slave
// Whether to convert internal faces only (so leave boundary faces intact).
// This is only relevant if your face selection type can pick up boundary
// faces.

View File

@ -448,7 +448,6 @@ bool Foam::domainDecomposition::writeDecomposition()
curStart,
nPatches,
procMesh.boundaryMesh(),
Pstream::worldComm,
procI,
curNeighbourProcessors[procPatchI]
);
@ -476,7 +475,6 @@ bool Foam::domainDecomposition::writeDecomposition()
curStart,
nPatches,
procMesh.boundaryMesh(),
Pstream::worldComm,
procI,
curNeighbourProcessors[procPatchI],
referPatch,

View File

@ -240,7 +240,7 @@ int main(int argc, char *argv[])
wordHashSet allCloudNames;
if (Pstream::master())
{
word geomFileName = prepend + "000";
word geomFileName = prepend + "0000";
// test pre check variable if there is a moving mesh
if (meshMoving)

View File

@ -26,7 +26,8 @@ dict.add("mergeDistance", SMALL);
labelHashSet includePatches;
forAll(patches, patchI)
{
if (!isA<processorPolyPatch>(patches[patchI]))
const polyPatch& pp = patches[patchI];
if (!pp.coupled() && !isA<cyclicAMIPolyPatch>(pp))
{
includePatches.insert(patchI);
}

View File

@ -44,6 +44,7 @@ Description
#include "volFields.H"
#include "surfaceFields.H"
#include "distributedTriSurfaceMesh.H"
#include "cyclicAMIPolyPatch.H"
#include "triSurfaceTools.H"
#include "mapDistribute.H"

View File

@ -135,7 +135,7 @@ DebugSwitches
FDIC 0;
FaceCellWave 0;
GAMG 0;
GAMGAgglomeration 0;
GAMGAgglomeration 1;
GAMGInterface 0;
GAMGInterfaceField 0;
Gamma 0;

View File

@ -331,10 +331,8 @@ eagerGAMGProcAgglomeration = $(GAMGProcAgglomerations)/eagerGAMGProcAgglomeratio
$(eagerGAMGProcAgglomeration)/eagerGAMGProcAgglomeration.C
noneGAMGProcAgglomeration = $(GAMGProcAgglomerations)/noneGAMGProcAgglomeration
$(noneGAMGProcAgglomeration)/noneGAMGProcAgglomeration.C
/*
cellFaceRatioGAMGProcAgglomeration = $(GAMGProcAgglomerations)/cellFaceRatioGAMGProcAgglomeration
$(cellFaceRatioGAMGProcAgglomeration)/cellFaceRatioGAMGProcAgglomeration.C
*/
procFacesGAMGProcAgglomeration = $(GAMGProcAgglomerations)/procFacesGAMGProcAgglomeration
$(procFacesGAMGProcAgglomeration)/procFacesGAMGProcAgglomeration.C
meshes/lduMesh/lduMesh.C

View File

@ -351,7 +351,7 @@ void Foam::GAMGAgglomeration::agglomerateLduAddressing
);
if (debug)
if (debug & 2)
{
Pout<< "GAMGAgglomeration :"
<< " agglomerated level " << fineLevelIndex

View File

@ -27,9 +27,9 @@ License
#include "lduMesh.H"
#include "lduMatrix.H"
#include "Time.H"
#include "dlLibraryTable.H"
#include "GAMGInterface.H"
#include "GAMGProcAgglomeration.H"
#include "IOmanip.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -67,23 +67,112 @@ void Foam::GAMGAgglomeration::compactLevels(const label nCreatedLevels)
procBoundaryFaceMap_.setSize(nCreatedLevels);
procAgglomeratorPtr_().agglomerate();
}
if (debug)
{
for (label levelI = 0; levelI <= size(); levelI++)
if (debug)
{
if (hasMeshLevel(levelI))
Info<< "GAMGAgglomeration:" << nl
<< " local agglomerator : " << type() << nl
<< " processor agglomerator : "
<< procAgglomeratorPtr_().type() << nl
<< nl;
Info<< setw(40) << "nCells"
<< setw(24) << "nFaces/nCells"
<< setw(24) << "nInterfaces"
<< setw(24) << "nIntFaces/nCells" << nl
<< setw(8) << "Level"
<< setw(8) << "nProcs"
<< " "
<< setw(8) << "avg"
<< setw(8) << "max"
<< " "
<< setw(8) << "avg"
<< setw(8) << "max"
<< " "
<< setw(8) << "avg"
<< setw(8) << "max"
<< " " << setw(4) << "avg"
<< " " << setw(4) << "max"
<< nl
<< setw(8) << "-----"
<< setw(8) << "------"
<< " "
<< setw(8) << "---"
<< setw(8) << "---"
<< " "
<< setw(8) << "---"
<< setw(8) << "---"
<< " " << setw(4) << "---"
<< " " << setw(4) << "---"
<< nl;
for (label levelI = 0; levelI <= size(); levelI++)
{
const lduMesh& fineMesh = meshLevel(levelI);
Pout<< "Level " << levelI << " fine mesh:"<< nl;
Pout<< fineMesh.info() << endl;
}
else
{
Pout<< "Level " << levelI << " has no fine mesh:" << nl
<< endl;
label nProcs = 0;
label nCells = 0;
scalar faceCellRatio = 0;
label nInterfaces = 0;
label nIntFaces = 0;
scalar ratio = 0.0;
if (hasMeshLevel(levelI))
{
nProcs = 1;
const lduMesh& fineMesh = meshLevel(levelI);
nCells = fineMesh.lduAddr().size();
faceCellRatio =
scalar(fineMesh.lduAddr().lowerAddr().size())/nCells;
const lduInterfacePtrsList interfaces =
fineMesh.interfaces();
forAll(interfaces, i)
{
if (interfaces.set(i))
{
nInterfaces++;
nIntFaces += interfaces[i].faceCells().size();
}
}
ratio = scalar(nIntFaces)/nCells;
}
label totNprocs = returnReduce(nProcs, sumOp<label>());
label maxNCells = returnReduce(nCells, maxOp<label>());
label totNCells = returnReduce(nCells, sumOp<label>());
scalar maxFaceCellRatio =
returnReduce(faceCellRatio, maxOp<scalar>());
scalar totFaceCellRatio =
returnReduce(faceCellRatio, sumOp<scalar>());
label maxNInt = returnReduce(nInterfaces, maxOp<label>());
label totNInt = returnReduce(nInterfaces, sumOp<label>());
scalar maxRatio = returnReduce(ratio, maxOp<scalar>());
scalar totRatio = returnReduce(ratio, sumOp<scalar>());
Info<< setw(8) << levelI
<< setw(8) << totNprocs
<< setw(16) << totNCells/totNprocs
<< setw(8) << maxNCells
<< " "
<< setw(8) << setprecision(4) << totFaceCellRatio/totNprocs
<< setw(8) << setprecision(4) << maxFaceCellRatio
<< " "
<< setw(8) << totNInt/totNprocs
<< setw(8) << maxNInt
<< " "
<< setw(8) << setprecision(4) << totRatio/totNprocs
<< setw(8) << setprecision(4) << maxRatio
<< nl;
}
Info<< endl;
}
}
}
@ -190,9 +279,9 @@ const Foam::GAMGAgglomeration& Foam::GAMGAgglomeration::New
"(const lduMesh& mesh, const dictionary& controlDict)"
) << "Unknown GAMGAgglomeration type "
<< agglomeratorType << ".\n"
<< "Valid algebraic GAMGAgglomeration types are :"
<< "Valid matrix GAMGAgglomeration types are :"
<< lduMatrixConstructorTablePtr_->sortedToc() << endl
<< "Valid algebraic GAMGAgglomeration types are :"
<< "Valid geometric GAMGAgglomeration types are :"
<< lduMeshConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
@ -285,7 +374,8 @@ Foam::autoPtr<Foam::GAMGAgglomeration> Foam::GAMGAgglomeration::New
FatalErrorIn
(
"GAMGAgglomeration::New"
"(const lduMesh& mesh, const dictionary& controlDict)"
"(const lduMesh& mesh, const scalarField&"
", const vectorField&, const dictionary& controlDict)"
) << "Unknown GAMGAgglomeration type "
<< agglomeratorType << ".\n"
<< "Valid geometric GAMGAgglomeration types are :"

View File

@ -61,14 +61,6 @@ protected:
// Protected Member Functions
//- Calculate and return agglomeration of given level
tmp<labelField> agglomerate
(
label& nCoarseCells,
const lduAddressing& fineMatrixAddressing,
const scalarField& faceWeights
);
//- Agglomerate all levels starting from the given face weights
void agglomerate
(
@ -97,6 +89,15 @@ public:
const lduMesh& mesh,
const dictionary& controlDict
);
//- Calculate and return agglomeration
static tmp<labelField> agglomerate
(
label& nCoarseCells,
const lduAddressing& fineMatrixAddressing,
const scalarField& faceWeights
);
};

View File

@ -0,0 +1,333 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ 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/>.
\*---------------------------------------------------------------------------*/
#include "procFacesGAMGProcAgglomeration.H"
#include "addToRunTimeSelectionTable.H"
#include "GAMGAgglomeration.H"
#include "Random.H"
#include "lduMesh.H"
#include "processorLduInterface.H"
#include "processorGAMGInterface.H"
#include "pairGAMGAgglomeration.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(procFacesGAMGProcAgglomeration, 0);
addToRunTimeSelectionTable
(
GAMGProcAgglomeration,
procFacesGAMGProcAgglomeration,
GAMGAgglomeration
);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Create single cell mesh
Foam::autoPtr<Foam::lduPrimitiveMesh>
Foam::procFacesGAMGProcAgglomeration::singleCellMesh
(
const label singleCellMeshComm,
const lduMesh& mesh,
scalarField& faceWeights
) const
{
// Count number of faces per processor
List<Map<label> > procFaces(UPstream::nProcs(mesh.comm()));
Map<label>& myNeighbours = procFaces[UPstream::myProcNo(mesh.comm())];
{
const lduInterfacePtrsList interfaces(mesh.interfaces());
forAll(interfaces, intI)
{
if (interfaces.set(intI))
{
const processorLduInterface& pp =
refCast<const processorLduInterface>
(
interfaces[intI]
);
label size = interfaces[intI].faceCells().size();
myNeighbours.insert(pp.neighbProcNo(), size);
}
}
}
Pstream::gatherList(procFaces, Pstream::msgType(), mesh.comm());
Pstream::scatterList(procFaces, Pstream::msgType(), mesh.comm());
autoPtr<lduPrimitiveMesh> singleCellMeshPtr;
if (Pstream::master(mesh.comm()))
{
// I am master
label nCells = Pstream::nProcs(mesh.comm());
DynamicList<label> l(3*nCells);
DynamicList<label> u(3*nCells);
DynamicList<scalar> weight(3*nCells);
DynamicList<label> nbrs;
DynamicList<scalar> weights;
forAll(procFaces, procI)
{
const Map<label>& neighbours = procFaces[procI];
// Add all the higher processors
nbrs.clear();
weights.clear();
forAllConstIter(Map<label>, neighbours, iter)
{
if (iter.key() > procI)
{
nbrs.append(iter.key());
weights.append(iter());
}
sort(nbrs);
forAll(nbrs, i)
{
l.append(procI);
u.append(nbrs[i]);
weight.append(weights[i]);
}
}
}
faceWeights.transfer(weight);
PtrList<const lduInterface> primitiveInterfaces(0);
const lduSchedule ps(0);
singleCellMeshPtr.reset
(
new lduPrimitiveMesh
(
nCells,
l,
u,
primitiveInterfaces,
ps,
singleCellMeshComm
)
);
}
return singleCellMeshPtr;
}
Foam::tmp<Foam::labelField>
Foam::procFacesGAMGProcAgglomeration::processorAgglomeration
(
const lduMesh& mesh
) const
{
label singleCellMeshComm = UPstream::allocateCommunicator
(
mesh.comm(),
labelList(1, 0) // only processor 0
);
scalarField faceWeights;
autoPtr<lduPrimitiveMesh> singleCellMeshPtr
(
singleCellMesh
(
singleCellMeshComm,
mesh,
faceWeights
)
);
tmp<labelField> tfineToCoarse(new labelField(0));
labelField& fineToCoarse = tfineToCoarse();
if (singleCellMeshPtr.valid())
{
// On master call the agglomerator
const lduPrimitiveMesh& singleCellMesh = singleCellMeshPtr();
label nCoarseProcs;
fineToCoarse = pairGAMGAgglomeration::agglomerate
(
nCoarseProcs,
singleCellMesh,
faceWeights
);
labelList coarseToMaster(nCoarseProcs, labelMax);
forAll(fineToCoarse, cellI)
{
label coarseI = fineToCoarse[cellI];
coarseToMaster[coarseI] = min(coarseToMaster[coarseI], cellI);
}
// Sort according to master and redo restriction
labelList newToOld;
sortedOrder(coarseToMaster, newToOld);
labelList oldToNew(invert(newToOld.size(), newToOld));
fineToCoarse = UIndirectList<label>(oldToNew, fineToCoarse)();
}
Pstream::scatter(fineToCoarse, Pstream::msgType(), mesh.comm());
UPstream::freeCommunicator(singleCellMeshComm);
return tfineToCoarse;
}
bool Foam::procFacesGAMGProcAgglomeration::doProcessorAgglomeration
(
const lduMesh& mesh
) const
{
// Check the need for further agglomeration on all processors
bool doAgg = mesh.lduAddr().size() < nAgglomeratingCells_;
mesh.reduce(doAgg, orOp<bool>());
return doAgg;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::procFacesGAMGProcAgglomeration::procFacesGAMGProcAgglomeration
(
GAMGAgglomeration& agglom,
const dictionary& controlDict
)
:
GAMGProcAgglomeration(agglom, controlDict),
nAgglomeratingCells_(readLabel(controlDict.lookup("nAgglomeratingCells")))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::procFacesGAMGProcAgglomeration::~procFacesGAMGProcAgglomeration()
{
forAllReverse(comms_, i)
{
if (comms_[i] != -1)
{
UPstream::freeCommunicator(comms_[i]);
}
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::procFacesGAMGProcAgglomeration::agglomerate()
{
if (debug)
{
Pout<< nl << "Starting mesh overview" << endl;
printStats(Pout, agglom_);
}
if (agglom_.size() >= 1)
{
Random rndGen(0);
for
(
label fineLevelIndex = 2;
fineLevelIndex < agglom_.size();
fineLevelIndex++
)
{
if (agglom_.hasMeshLevel(fineLevelIndex))
{
// Get the fine mesh
const lduMesh& levelMesh = agglom_.meshLevel(fineLevelIndex);
label levelComm = levelMesh.comm();
label nProcs = UPstream::nProcs(levelComm);
if (nProcs > 1 && doProcessorAgglomeration(levelMesh))
{
tmp<labelField> tprocAgglomMap
(
processorAgglomeration(levelMesh)
);
const labelField& procAgglomMap = tprocAgglomMap();
// Master processor
labelList masterProcs;
// Local processors that agglomerate. agglomProcIDs[0] is in
// masterProc.
List<int> agglomProcIDs;
GAMGAgglomeration::calculateRegionMaster
(
levelComm,
procAgglomMap,
masterProcs,
agglomProcIDs
);
// Allocate a communicator for the processor-agglomerated
// matrix
comms_.append
(
UPstream::allocateCommunicator
(
levelComm,
masterProcs
)
);
// Use procesor agglomeration maps to do the actual
// collecting.
GAMGProcAgglomeration::agglomerate
(
fineLevelIndex,
procAgglomMap,
masterProcs,
agglomProcIDs,
comms_.last()
);
}
}
}
}
// Print a bit
if (debug)
{
Pout<< nl << "Agglomerated mesh overview" << endl;
printStats(Pout, agglom_);
}
return true;
}
// ************************************************************************* //

View File

@ -0,0 +1,136 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ 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/>.
Class
Foam::procFacesGAMGProcAgglomeration
Description
Processor agglomeration of GAMGAgglomerations. Needs nAgglomeratingCells
which is when to start agglomerating processors. Processors get agglomerated
by constructing a single cell mesh for each processor with each
processor interface a face. This then gets agglomerated using
the pairGAMGAgglomeration algorithm with the number of faces
on the original processor interface as face weight.
SourceFiles
procFacesGAMGProcAgglomeration.C
\*---------------------------------------------------------------------------*/
#ifndef procFacesGAMGProcAgglomeration_H
#define procFacesGAMGProcAgglomeration_H
#include "GAMGProcAgglomeration.H"
#include "DynamicList.H"
#include "labelField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class GAMGAgglomeration;
class lduMesh;
class lduPrimitiveMesh;
/*---------------------------------------------------------------------------*\
Class procFacesGAMGProcAgglomeration Declaration
\*---------------------------------------------------------------------------*/
class procFacesGAMGProcAgglomeration
:
public GAMGProcAgglomeration
{
// Private data
//- When to processor agglomerate
const label nAgglomeratingCells_;
//- Allocated communicators
DynamicList<label> comms_;
// Private Member Functions
//- Return (on master) all single-cell meshes collected. single-cell
// meshes are just one cell with all proc faces intact.
autoPtr<lduPrimitiveMesh> singleCellMesh
(
const label singleCellMeshComm,
const lduMesh& mesh,
scalarField& faceWeights
) const;
//- Construct processor agglomeration: for every processor the
// coarse processor-cluster it agglomerates onto
tmp<labelField> processorAgglomeration(const lduMesh&) const;
//- Do we need to agglomerate across processors?
bool doProcessorAgglomeration(const lduMesh&) const;
//- Disallow default bitwise copy construct
procFacesGAMGProcAgglomeration
(
const procFacesGAMGProcAgglomeration&
);
//- Disallow default bitwise assignment
void operator=(const procFacesGAMGProcAgglomeration&);
public:
//- Runtime type information
TypeName("procFaces");
// Constructors
//- Construct given agglomerator and controls
procFacesGAMGProcAgglomeration
(
GAMGAgglomeration& agglom,
const dictionary& controlDict
);
//- Destructor
virtual ~procFacesGAMGProcAgglomeration();
// Member Functions
//- Modify agglomeration. Return true if modified
virtual bool agglomerate();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -67,6 +67,10 @@ public:
// setting the arguments pointer to NULL
inline autoPtr(const autoPtr<T>&);
//- Construct either by transfering pointer or cloning. Should
// only be called with type that supports cloning.
inline autoPtr(const autoPtr<T>&, const bool reUse);
//- Destructor, delete object if pointer is not NULL
inline ~autoPtr();

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "error.H"
#include <typeinfo>
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -43,6 +44,21 @@ inline Foam::autoPtr<T>::autoPtr(const autoPtr<T>& ap)
}
template<class T>
inline Foam::autoPtr<T>::autoPtr(const autoPtr<T>& ap, const bool reUse)
{
if (reUse)
{
ptr_ = ap.ptr_;
ap.ptr_ = 0;
}
else
{
ptr_ = ap().clone().ptr();
}
}
template<class T>
inline Foam::autoPtr<T>::~autoPtr()
{
@ -81,7 +97,8 @@ inline void Foam::autoPtr<T>::set(T* p)
if (ptr_)
{
FatalErrorIn("void Foam::autoPtr<T>::set(T*)")
<< "object already allocated"
<< "object of type " << typeid(T).name()
<< " already allocated"
<< abort(FatalError);
}
@ -116,7 +133,8 @@ inline T& Foam::autoPtr<T>::operator()()
if (!ptr_)
{
FatalErrorIn("T& Foam::autoPtr<T>::operator()()")
<< "object is not allocated"
<< "object of type " << typeid(T).name()
<< " is not allocated"
<< abort(FatalError);
}
@ -130,7 +148,8 @@ inline const T& Foam::autoPtr<T>::operator()() const
if (!ptr_)
{
FatalErrorIn("const T& Foam::autoPtr<T>::operator()() const")
<< "object is not allocated"
<< "object of type " << typeid(T).name()
<< " is not allocated"
<< abort(FatalError);
}
@ -151,7 +170,8 @@ inline T* Foam::autoPtr<T>::operator->()
if (!ptr_)
{
FatalErrorIn("Foam::autoPtr<T>::operator->()")
<< "object is not allocated"
<< "object of type " << typeid(T).name()
<< " is not allocated"
<< abort(FatalError);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "error.H"
#include <typeinfo>
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -62,6 +63,7 @@ inline Foam::tmp<T>::tmp(const tmp<T>& t)
{
FatalErrorIn("Foam::tmp<T>::tmp(const tmp<T>&)")
<< "attempted copy of a deallocated temporary"
<< " of type " << typeid(T).name()
<< abort(FatalError);
}
}
@ -93,6 +95,7 @@ inline Foam::tmp<T>::tmp(const tmp<T>& t, bool allowTransfer)
(
"Foam::tmp<T>::tmp(const tmp<T>&, bool allowTransfer)"
) << "attempted copy of a deallocated temporary"
<< " of type " << typeid(T).name()
<< abort(FatalError);
}
}
@ -149,7 +152,7 @@ inline T* Foam::tmp<T>::ptr() const
if (!ptr_)
{
FatalErrorIn("Foam::tmp<T>::ptr() const")
<< "temporary deallocated"
<< "temporary of type " << typeid(T).name() << " deallocated"
<< abort(FatalError);
}
@ -188,7 +191,7 @@ inline T& Foam::tmp<T>::operator()()
if (!ptr_)
{
FatalErrorIn("T& Foam::tmp<T>::operator()()")
<< "temporary deallocated"
<< "temporary of type " << typeid(T).name() << " deallocated"
<< abort(FatalError);
}
@ -217,7 +220,7 @@ inline const T& Foam::tmp<T>::operator()() const
if (!ptr_)
{
FatalErrorIn("const T& Foam::tmp<T>::operator()() const")
<< "temporary deallocated"
<< "temporary of type " << typeid(T).name() << " deallocated"
<< abort(FatalError);
}
@ -245,7 +248,7 @@ inline T* Foam::tmp<T>::operator->()
if (!ptr_)
{
FatalErrorIn("Foam::tmp<T>::operator->()")
<< "temporary deallocated"
<< "temporary of type " << typeid(T).name() << " deallocated"
<< abort(FatalError);
}
@ -294,6 +297,7 @@ inline void Foam::tmp<T>::operator=(const tmp<T>& t)
{
FatalErrorIn("Foam::tmp<T>::operator=(const tmp<T>&)")
<< "attempted copy of a deallocated temporary"
<< " of type " << typeid(T).name()
<< abort(FatalError);
}
}
@ -301,6 +305,7 @@ inline void Foam::tmp<T>::operator=(const tmp<T>& t)
{
FatalErrorIn("Foam::tmp<T>::operator=(const tmp<T>&)")
<< "attempted to assign to a const reference to constant object"
<< " of type " << typeid(T).name()
<< abort(FatalError);
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -254,7 +254,7 @@ Foam::lduPrimitiveMesh::lduPrimitiveMesh
const label nCells,
labelList& l,
labelList& u,
const Xfer<PtrList<const lduInterface> >& primitiveInterfaces,
PtrList<const lduInterface>& primitiveInterfaces,
const lduSchedule& ps,
const label comm
)
@ -262,10 +262,12 @@ Foam::lduPrimitiveMesh::lduPrimitiveMesh
lduAddressing(nCells),
lowerAddr_(l, true),
upperAddr_(u, true),
primitiveInterfaces_(primitiveInterfaces),
primitiveInterfaces_(0),
patchSchedule_(ps),
comm_(comm)
{
primitiveInterfaces_.transfer(primitiveInterfaces);
// Create interfaces
interfaces_.setSize(primitiveInterfaces_.size());
forAll(primitiveInterfaces_, i)

View File

@ -133,7 +133,7 @@ public:
const label nCells,
labelList& l,
labelList& u,
const Xfer<PtrList<const lduInterface> >& primitiveInterfaces,
PtrList<const lduInterface>& primitiveInterfaces,
const lduSchedule& ps,
const label comm
);

View File

@ -54,14 +54,12 @@ Foam::processorPolyPatch::processorPolyPatch
const label start,
const label index,
const polyBoundaryMesh& bm,
const label comm,
const int myProcNo,
const int neighbProcNo,
const transformType transform
)
:
coupledPolyPatch(name, size, start, index, bm, typeName, transform),
// comm_(comm),
myProcNo_(myProcNo),
neighbProcNo_(neighbProcNo),
neighbFaceCentres_(),
@ -80,10 +78,6 @@ Foam::processorPolyPatch::processorPolyPatch
)
:
coupledPolyPatch(name, dict, index, bm, patchType),
// comm_
// (
// dict.lookupOrDefault("communicator", UPstream::worldComm)
// ),
myProcNo_(readLabel(dict.lookup("myProcNo"))),
neighbProcNo_(readLabel(dict.lookup("neighbProcNo"))),
neighbFaceCentres_(),
@ -99,7 +93,6 @@ Foam::processorPolyPatch::processorPolyPatch
)
:
coupledPolyPatch(pp, bm),
// comm_(pp.comm_),
myProcNo_(pp.myProcNo_),
neighbProcNo_(pp.neighbProcNo_),
neighbFaceCentres_(),
@ -118,7 +111,6 @@ Foam::processorPolyPatch::processorPolyPatch
)
:
coupledPolyPatch(pp, bm, index, newSize, newStart),
// comm_(pp.comm_),
myProcNo_(pp.myProcNo_),
neighbProcNo_(pp.neighbProcNo_),
neighbFaceCentres_(),
@ -137,7 +129,6 @@ Foam::processorPolyPatch::processorPolyPatch
)
:
coupledPolyPatch(pp, bm, index, mapAddressing, newStart),
// comm_(pp.comm_),
myProcNo_(pp.myProcNo_),
neighbProcNo_(pp.neighbProcNo_),
neighbFaceCentres_(),
@ -1091,11 +1082,6 @@ bool Foam::processorPolyPatch::order
void Foam::processorPolyPatch::write(Ostream& os) const
{
coupledPolyPatch::write(os);
// if (comm_ != UPstream::worldComm)
// {
// os.writeKeyword("communicator") << comm_
// << token::END_STATEMENT << nl;
// }
os.writeKeyword("myProcNo") << myProcNo_
<< token::END_STATEMENT << nl;
os.writeKeyword("neighbProcNo") << neighbProcNo_

View File

@ -134,7 +134,6 @@ public:
const label start,
const label index,
const polyBoundaryMesh& bm,
const label comm,
const int myProcNo,
const int neighbProcNo,
const transformType transform = UNKNOWN // transformation type

View File

@ -46,7 +46,6 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
const label start,
const label index,
const polyBoundaryMesh& bm,
const label comm,
const int myProcNo,
const int neighbProcNo,
const word& referPatchName,
@ -60,7 +59,6 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
start,
index,
bm,
comm,
myProcNo,
neighbProcNo,
transform

View File

@ -119,7 +119,6 @@ public:
const label start,
const label index,
const polyBoundaryMesh& bm,
const label comm,
const int myProcNo,
const int neighbProcNo,
const word& referPatchName,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -142,62 +142,60 @@ public:
virtual void convertTimeBase(const Time& t);
public:
// Evaluation
//- Return value as a function of (scalar) independent variable
virtual Type value(const scalar x) const;
//- Return value as a function of (scalar) independent variable
virtual tmp<Field<Type> > value(const scalarField& x) const;
//- Integrate between two (scalar) values
virtual Type integrate(const scalar x1, const scalar x2) const;
//- Integrate between two (scalar) values
virtual tmp<Field<Type> > integrate
(
const scalarField& x1,
const scalarField& x2
) const;
//- Return dimensioned type
virtual dimensioned<Type> dimValue(const scalar x) const;
//- Return dimensioned type as a function of (scalar)
virtual tmp<Field<dimensioned<Type> > > dimValue
(
const scalarField& x
) const;
//- Integrate between two scalars and return a dimensioned type
virtual dimensioned<Type> dimIntegrate
(
const scalar x1,
const scalar x2
) const;
//- Integrate between two scalar fields and return a field of
// dimensioned type
virtual tmp<Field<dimensioned<Type> > > dimIntegrate
(
const scalarField& x1,
const scalarField& x2
) const;
// Evaluation
// I/O
//- Return value as a function of (scalar) independent variable
virtual Type value(const scalar x) const;
//- Ostream Operator
friend Ostream& operator<< <Type>
(
Ostream& os,
const DataEntry<Type>& de
);
//- Return value as a function of (scalar) independent variable
virtual tmp<Field<Type> > value(const scalarField& x) const;
//- Integrate between two (scalar) values
virtual Type integrate(const scalar x1, const scalar x2) const;
//- Integrate between two (scalar) values
virtual tmp<Field<Type> > integrate
(
const scalarField& x1,
const scalarField& x2
) const;
//- Return dimensioned type
virtual dimensioned<Type> dimValue(const scalar x) const;
//- Return dimensioned type as a function of (scalar)
virtual tmp<Field<dimensioned<Type> > > dimValue
(
const scalarField& x
) const;
//- Integrate between two scalars and returns a dimensioned type
virtual dimensioned<Type> dimIntegrate
(
const scalar x1,
const scalar x2
) const;
//- Integrate between two scalars and returns list of dimensioned type
virtual tmp<Field<dimensioned<Type> > > dimIntegrate
(
const scalarField& x1,
const scalarField& x2
) const;
// I/O
//- Ostream Operator
friend Ostream& operator<< <Type>
(
Ostream& os,
const DataEntry<Type>& de
);
//- Write in dictionary format
virtual void writeData(Ostream& os) const;
//- Write in dictionary format
virtual void writeData(Ostream& os) const;
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -38,12 +38,17 @@ namespace Foam
}
void Foam::printTable(const List<wordList>& wll, Ostream& os)
void Foam::printTable
(
const List<wordList>& wll,
List<string::size_type>& columnWidth,
Ostream& os
)
{
if (!wll.size()) return;
// Find the maximum word length for each column
List<string::size_type> columnWidth(wll[0].size(), string::size_type(0));
columnWidth.setSize(wll[0].size(), string::size_type(0));
forAll(columnWidth, j)
{
forAll(wll, i)
@ -75,4 +80,11 @@ void Foam::printTable(const List<wordList>& wll, Ostream& os)
}
void Foam::printTable(const List<wordList>& wll, Ostream& os)
{
List<string::size_type> columnWidth;
printTable(wll, columnWidth, os);
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -43,6 +43,7 @@ namespace Foam
typedef IOList<wordList> wordListIOList;
// Print word list list as a table
void printTable(const List<wordList>&, List<string::size_type>&, Ostream&);
void printTable(const List<wordList>&, Ostream&);
}

View File

@ -945,7 +945,6 @@ void Foam::fvMeshDistribute::addProcPatches
mesh_.nFaces(),
mesh_.boundaryMesh().size(),
mesh_.boundaryMesh(),
Pstream::worldComm,
Pstream::myProcNo(),
nbrProc[bFaceI]
);
@ -989,7 +988,6 @@ void Foam::fvMeshDistribute::addProcPatches
mesh_.nFaces(),
mesh_.boundaryMesh().size(),
mesh_.boundaryMesh(),
Pstream::worldComm,
Pstream::myProcNo(),
nbrProc[bFaceI],
cycName,

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -56,11 +56,7 @@ bool Foam::adjustPhi
if (!isA<processorFvsPatchScalarField>(phip))
{
if
(
Up.fixesValue()
&& !isA<inletOutletFvPatchVectorField>(Up)
)
if (Up.fixesValue() && !isA<inletOutletFvPatchVectorField>(Up))
{
forAll(phip, i)
{
@ -113,8 +109,12 @@ bool Foam::adjustPhi
{
FatalErrorIn
(
"adjustPhi(surfaceScalarField& phi, const volVectorField& U,"
"const volScalarField& p"
"adjustPhi"
"("
"surfaceScalarField&, "
"const volVectorField&,"
"volScalarField&"
")"
) << "Continuity error cannot be removed by adjusting the"
" outflow.\nPlease check the velocity boundary conditions"
" and/or run potentialFoam to initialise the outflow." << nl

View File

@ -46,6 +46,7 @@ timeVaryingMappedFixedValueFvPatchField
fieldTableName_(iF.name()),
setAverage_(false),
perturb_(0),
mapperPtr_(NULL),
sampleTimes_(0),
startSampleTime_(-1),
startSampledValues_(0),
@ -71,7 +72,7 @@ timeVaryingMappedFixedValueFvPatchField
fieldTableName_(ptf.fieldTableName_),
setAverage_(ptf.setAverage_),
perturb_(ptf.perturb_),
mapperPtr_(ptf.mapperPtr_),
mapperPtr_(NULL),
sampleTimes_(0),
startSampleTime_(-1),
startSampledValues_(0),
@ -79,7 +80,12 @@ timeVaryingMappedFixedValueFvPatchField
endSampleTime_(-1),
endSampledValues_(0),
endAverage_(pTraits<Type>::zero),
offset_(ptf.offset_().clone().ptr())
offset_
(
ptf.offset_.valid()
? ptf.offset_().clone().ptr()
: NULL
)
{}
@ -130,7 +136,7 @@ timeVaryingMappedFixedValueFvPatchField
fieldTableName_(ptf.fieldTableName_),
setAverage_(ptf.setAverage_),
perturb_(ptf.perturb_),
mapperPtr_(ptf.mapperPtr_),
mapperPtr_(NULL),
sampleTimes_(ptf.sampleTimes_),
startSampleTime_(ptf.startSampleTime_),
startSampledValues_(ptf.startSampledValues_),
@ -138,11 +144,15 @@ timeVaryingMappedFixedValueFvPatchField
endSampleTime_(ptf.endSampleTime_),
endSampledValues_(ptf.endSampledValues_),
endAverage_(ptf.endAverage_),
offset_(ptf.offset_().clone().ptr())
offset_
(
ptf.offset_.valid()
? ptf.offset_().clone().ptr()
: NULL
)
{}
template<class Type>
timeVaryingMappedFixedValueFvPatchField<Type>::
timeVaryingMappedFixedValueFvPatchField
@ -155,7 +165,7 @@ timeVaryingMappedFixedValueFvPatchField
fieldTableName_(ptf.fieldTableName_),
setAverage_(ptf.setAverage_),
perturb_(ptf.perturb_),
mapperPtr_(ptf.mapperPtr_),
mapperPtr_(NULL),
sampleTimes_(ptf.sampleTimes_),
startSampleTime_(ptf.startSampleTime_),
startSampledValues_(ptf.startSampledValues_),
@ -163,7 +173,12 @@ timeVaryingMappedFixedValueFvPatchField
endSampleTime_(ptf.endSampleTime_),
endSampledValues_(ptf.endSampledValues_),
endAverage_(ptf.endAverage_),
offset_(ptf.offset_().clone().ptr())
offset_
(
ptf.offset_.valid()
? ptf.offset_().clone().ptr()
: NULL
)
{}

View File

@ -90,8 +90,6 @@ Foam::faceAreaPairGAMGAgglomeration::faceAreaPairGAMGAgglomeration
:
pairGAMGAgglomeration(mesh, controlDict)
{
vectorField n(faceAreas/mag(faceAreas));
//agglomerate(mesh, sqrt(mag(faceAreas)));
agglomerate
(
@ -100,7 +98,8 @@ Foam::faceAreaPairGAMGAgglomeration::faceAreaPairGAMGAgglomeration
(
cmptMultiply
(
n,
faceAreas
/sqrt(mag(faceAreas)),
vector(1, 1.01, 1.02)
//vector::one
)

View File

@ -59,7 +59,11 @@ Foam::MGridGenGAMGAgglomeration::MGridGenGAMGAgglomeration
// Start geometric agglomeration from the cell volumes and areas of the mesh
scalarField* VPtr = const_cast<scalarField*>(&fvMesh_.cellVolumes());
vectorField* SfPtr = const_cast<vectorField*>(&fvMesh_.faceAreas());
SubField<vector> Sf(fvMesh_.faceAreas(), fvMesh_.nInternalFaces());
vectorField* SfPtr = const_cast<vectorField*>
(
&Sf.operator const vectorField&()
);
// Create the boundary area cell field
scalarField* SbPtr(new scalarField(fvMesh_.nCells(), 0));

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -167,7 +167,8 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection
"Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection"
"("
"const dictionary&, "
"CloudType&"
"CloudType&, "
"const word&"
")"
)<< "innerNozzleDiameter >= outerNozzleDiameter" << nl
<< exit(FatalError);
@ -369,6 +370,7 @@ void Foam::ConeNozzleInjection<CloudType>::setPositionAndCell
"const scalar, "
"vector&, "
"label&, "
"label&, "
"label&"
")"
)<< "Unknown injectionMethod type" << nl

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -43,6 +43,7 @@ Foam::KinematicLookupTableInjection<CloudType>::KinematicLookupTableInjection
(
readScalar(this->coeffDict().lookup("parcelsPerSecond"))
),
randomise_(readBool(this->coeffDict().lookup("randomise"))),
injectors_
(
IOobject
@ -87,6 +88,7 @@ Foam::KinematicLookupTableInjection<CloudType>::KinematicLookupTableInjection
inputFileName_(im.inputFileName_),
duration_(im.duration_),
parcelsPerSecond_(im.parcelsPerSecond_),
randomise_(im.randomise_),
injectors_(im.injectors_),
injectorCells_(im.injectorCells_),
injectorTetFaces_(im.injectorTetFaces_),
@ -177,7 +179,16 @@ void Foam::KinematicLookupTableInjection<CloudType>::setPositionAndCell
label& tetPtI
)
{
label injectorI = parcelI*injectorCells_.size()/nParcels;
label injectorI = 0;
if (randomise_)
{
cachedRandom& rnd = this->owner().rndGen();
injectorI = rnd.position<label>(0, injectorCells_.size() - 1);
}
else
{
injectorI = parcelI*injectorCells_.size()/nParcels;
}
position = injectors_[injectorI].x();
cellOwner = injectorCells_[injectorI];

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -78,6 +78,9 @@ class KinematicLookupTableInjection
//- Number of parcels per injector - common to all injection sources
const scalar parcelsPerSecond_;
//- Flag to indicate to randomise injection positions
bool randomise_;
//- List of injectors
kinematicParcelInjectionDataIOList injectors_;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -141,7 +141,7 @@ Foam::forceSuSp Foam::LiftForce<CloudType>::calcCoupled
scalar Cl = this->Cl(p, curlUc, Re, muc);
value.Su() = mass/p.rho()*p.d()/2.0*p.rhoc()*Cl*((p.Uc() - p.U())^curlUc);
value.Su() = mass/p.rho()*p.rhoc()*Cl*((p.Uc() - p.U())^curlUc);
return value;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -42,6 +42,7 @@ Foam::ReactingLookupTableInjection<CloudType>::ReactingLookupTableInjection
(
readScalar(this->coeffDict().lookup("parcelsPerSecond"))
),
randomise_(readBool(this->coeffDict().lookup("randomise"))),
injectors_
(
IOobject
@ -86,6 +87,7 @@ Foam::ReactingLookupTableInjection<CloudType>::ReactingLookupTableInjection
inputFileName_(im.inputFileName_),
duration_(im.duration_),
parcelsPerSecond_(im.parcelsPerSecond_),
randomise_(im.randomise_),
injectors_(im.injectors_),
injectorCells_(im.injectorCells_),
injectorTetFaces_(im.injectorTetFaces_),
@ -176,7 +178,16 @@ void Foam::ReactingLookupTableInjection<CloudType>::setPositionAndCell
label& tetPtI
)
{
label injectorI = parcelI*injectorCells_.size()/nParcels;
label injectorI = 0;
if (randomise_)
{
cachedRandom& rnd = this->owner().rndGen();
injectorI = rnd.position<label>(0, injectorCells_.size() - 1);
}
else
{
injectorI = parcelI*injectorCells_.size()/nParcels;
}
position = injectors_[injectorI].x();
cellOwner = injectorCells_[injectorI];

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -81,6 +81,9 @@ class ReactingLookupTableInjection
//- Number of parcels per injector - common to all injection sources
const scalar parcelsPerSecond_;
//- Flag to indicate to randomise injection positions
bool randomise_;
//- List of injectors
reactingParcelInjectionDataIOList injectors_;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -43,6 +43,7 @@ ReactingMultiphaseLookupTableInjection
(
readScalar(this->coeffDict().lookup("parcelsPerSecond"))
),
randomise_(readBool(this->coeffDict().lookup("randomise"))),
injectors_
(
IOobject
@ -88,6 +89,7 @@ ReactingMultiphaseLookupTableInjection
inputFileName_(im.inputFileName_),
duration_(im.duration_),
parcelsPerSecond_(im.parcelsPerSecond_),
randomise_(im.randomise_),
injectors_(im.injectors_),
injectorCells_(im.injectorCells_),
injectorTetFaces_(im.injectorTetFaces_),
@ -182,7 +184,16 @@ void Foam::ReactingMultiphaseLookupTableInjection<CloudType>::setPositionAndCell
label& tetPtI
)
{
label injectorI = parcelI*injectorCells_.size()/nParcels;
label injectorI = 0;
if (randomise_)
{
cachedRandom& rnd = this->owner().rndGen();
injectorI = rnd.position<label>(0, injectorCells_.size() - 1);
}
else
{
injectorI = parcelI*injectorCells_.size()/nParcels;
}
position = injectors_[injectorI].x();
cellOwner = injectorCells_[injectorI];

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -84,6 +84,9 @@ class ReactingMultiphaseLookupTableInjection
//- Number of parcels per injector - common to all injection sources
const scalar parcelsPerSecond_;
//- Flag to indicate to randomise injection positions
bool randomise_;
//- List of injectors
reactingMultiphaseParcelInjectionDataIOList injectors_;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -43,6 +43,7 @@ Foam::ThermoLookupTableInjection<CloudType>::ThermoLookupTableInjection
(
readScalar(this->coeffDict().lookup("parcelsPerSecond"))
),
randomise_(readBool(this->coeffDict().lookup("randomise"))),
injectors_
(
IOobject
@ -87,6 +88,7 @@ Foam::ThermoLookupTableInjection<CloudType>::ThermoLookupTableInjection
inputFileName_(im.inputFileName_),
duration_(im.duration_),
parcelsPerSecond_(im.parcelsPerSecond_),
randomise_(im.randomise_),
injectors_(im.injectors_),
injectorCells_(im.injectorCells_),
injectorTetFaces_(im.injectorTetFaces_),
@ -177,7 +179,16 @@ void Foam::ThermoLookupTableInjection<CloudType>::setPositionAndCell
label& tetPtI
)
{
label injectorI = parcelI*injectorCells_.size()/nParcels;
label injectorI = 0;
if (randomise_)
{
cachedRandom& rnd = this->owner().rndGen();
injectorI = rnd.position<label>(0, injectorCells_.size() - 1);
}
else
{
injectorI = parcelI*injectorCells_.size()/nParcels;
}
position = injectors_[injectorI].x();
cellOwner = injectorCells_[injectorI];

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -80,6 +80,9 @@ class ThermoLookupTableInjection
//- Number of parcels per injector - common to all injection sources
const scalar parcelsPerSecond_;
//- Flag to indicate to randomise injection positions
bool randomise_;
//- List of injectors
kinematicParcelInjectionDataIOList injectors_;

View File

@ -522,6 +522,7 @@ void Foam::autoRefineDriver::baffleAndSplitMesh
false, // perpendicular edge connected cells
scalarField(0), // per region perpendicular angle
!handleSnapProblems, // merge free standing baffles?
refineParams.planarAngle(),
motionDict,
const_cast<Time&>(mesh.time()),
globalToMasterPatch_,
@ -606,8 +607,8 @@ void Foam::autoRefineDriver::splitAndMergeBaffles
handleSnapProblems,
handleSnapProblems, // remove perp edge connected cells
perpAngle, // perp angle
false, // merge free standing baffles?
//true, // merge free standing baffles?
true, // merge free standing baffles?
refineParams.planarAngle(), // planar angle
motionDict,
const_cast<Time&>(mesh.time()),
globalToMasterPatch_,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -41,6 +41,7 @@ Foam::refinementParameters::refinementParameters
maxLocalCells_(readLabel(dict.lookup("procCellLimit"))),
minRefineCells_(readLabel(dict.lookup("minimumRefine"))),
curvature_(readScalar(dict.lookup("curvature"))),
planarAngle_(dict.lookupOrDefault("planarAngle", curvature_)),
nBufferLayers_(readLabel(dict.lookup("nBufferLayers"))),
keepPoints_(dict.lookup("keepPoints")),
allowFreeStandingZoneFaces_(dict.lookup("allowFreeStandingZoneFaces")),
@ -53,6 +54,14 @@ Foam::refinementParameters::refinementParameters(const dictionary& dict)
maxGlobalCells_(readLabel(dict.lookup("maxGlobalCells"))),
maxLocalCells_(readLabel(dict.lookup("maxLocalCells"))),
minRefineCells_(readLabel(dict.lookup("minRefinementCells"))),
planarAngle_
(
dict.lookupOrDefault
(
"planarAngle",
readScalar(dict.lookup("resolveFeatureAngle"))
)
),
nBufferLayers_(readLabel(dict.lookup("nCellsBetweenLevels"))),
keepPoints_(pointField(1, dict.lookup("locationInMesh"))),
allowFreeStandingZoneFaces_(dict.lookup("allowFreeStandingZoneFaces")),

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -67,6 +67,9 @@ class refinementParameters
//- Curvature
scalar curvature_;
//- Planarity criterion
scalar planarAngle_;
//- Number of layers between different refinement levels
const label nBufferLayers_;
@ -129,6 +132,12 @@ public:
return curvature_;
}
//- Angle when two intersections are considered to be planar
scalar planarAngle() const
{
return planarAngle_;
}
//- Number of layers between different refinement levels
label nBufferLayers() const
{

View File

@ -253,6 +253,14 @@ private:
label& nRefine
);
//- Mark every cell with level of feature passing through it
// (or -1 if not passed through). Uses tracking.
void markFeatureCellLevel
(
const point& keepPoint,
labelList& maxFeatureLevel
) const;
//- Calculate list of cells to refine based on intersection of
// features.
label markFeatureRefinement
@ -337,16 +345,6 @@ private:
const labelList& globalToSlavePatch
) const;
//- Geometric test on see whether face needs to be baffled:
// is face boundary face and perpendicular to surface normal?
bool validBaffleTopology
(
const label faceI,
const vector& n1,
const vector& n2,
const vector& testDir
) const;
//- Determine patches for baffles
void getBafflePatches
(
@ -435,7 +433,11 @@ private:
//- Extract those baffles (duplicate) faces that are on the edge
// of a baffle region. These are candidates for merging.
List<labelPair> freeStandingBaffles(const List<labelPair>&) const;
List<labelPair> freeStandingBaffles
(
const List<labelPair>&,
const scalar freeStandingAngle
) const;
// Zone handling
@ -489,6 +491,16 @@ private:
labelList& namedSurfaceIndex
) const;
//- Remove any loose standing cells
void handleSnapProblems
(
const bool removeEdgeConnectedCells,
const scalarField& perpendicularAngle,
const dictionary& motionDict,
Time& runTime,
const labelList& globalToMasterPatch,
const labelList& globalToSlavePatch
);
//- Disallow default bitwise copy construct
meshRefinement(const meshRefinement&);
@ -707,6 +719,7 @@ public:
const bool removeEdgeConnectedCells,
const scalarField& perpendicularAngle,
const bool mergeFreeStanding,
const scalar freeStandingAngle,
const dictionary& motionDict,
Time& runTime,
const labelList& globalToMasterPatch,

View File

@ -44,6 +44,7 @@ License
#include "regionSplit.H"
#include "removeCells.H"
#include "unitConversion.H"
#include "OBJstream.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -217,43 +218,43 @@ Foam::label Foam::meshRefinement::getBafflePatch
}
// Check if we are a boundary face and normal of surface does
// not align with test vector. In this case there'd probably be
// a freestanding 'baffle' so we might as well not create it.
// Note that since it is not a proper baffle we cannot detect it
// afterwards so this code cannot be merged with the
// filterDuplicateFaces code.
bool Foam::meshRefinement::validBaffleTopology
(
const label faceI,
const vector& n1,
const vector& n2,
const vector& testDir
) const
{
label patchI = mesh_.boundaryMesh().whichPatch(faceI);
if (patchI == -1 || mesh_.boundaryMesh()[patchI].coupled())
{
return true;
}
else if (mag(n1&n2) > cos(degToRad(30)))
{
// Both normals aligned. Check that test vector perpendicularish to
// surface normal
scalar magTestDir = mag(testDir);
if (magTestDir > VSMALL)
{
if (mag(n1&(testDir/magTestDir)) < cos(degToRad(45)))
{
//Pout<< "** disabling baffling face "
// << mesh_.faceCentres()[faceI] << endl;
return false;
}
}
}
return true;
}
//// Check if we are a boundary face and normal of surface does
//// not align with test vector. In this case there'd probably be
//// a freestanding 'baffle' so we might as well not create it.
//// Note that since it is not a proper baffle we cannot detect it
//// afterwards so this code cannot be merged with the
//// filterDuplicateFaces code.
//bool Foam::meshRefinement::validBaffleTopology
//(
// const label faceI,
// const vector& n1,
// const vector& n2,
// const vector& testDir
//) const
//{
//
// label patchI = mesh_.boundaryMesh().whichPatch(faceI);
// if (patchI == -1 || mesh_.boundaryMesh()[patchI].coupled())
// {
// return true;
// }
// else if (mag(n1&n2) > cos(degToRad(30)))
// {
// // Both normals aligned. Check that test vector perpendicularish to
// // surface normal
// scalar magTestDir = mag(testDir);
// if (magTestDir > VSMALL)
// {
// if (mag(n1&(testDir/magTestDir)) < cos(degToRad(45)))
// {
// //Pout<< "** disabling baffling face "
// // << mesh_.faceCentres()[faceI] << endl;
// return false;
// }
// }
// }
// return true;
//}
// Determine patches for baffles on all intersected unnamed faces
@ -800,7 +801,8 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::createZoneBaffles
// region.
Foam::List<Foam::labelPair> Foam::meshRefinement::freeStandingBaffles
(
const List<labelPair>& couples
const List<labelPair>& couples,
const scalar planarAngle
) const
{
// All duplicate faces on edge of the patch are to be merged.
@ -809,6 +811,22 @@ Foam::List<Foam::labelPair> Foam::meshRefinement::freeStandingBaffles
labelList nBafflesPerEdge(mesh_.nEdges(), 0);
// This algorithm is quite tricky. We don't want to use edgeFaces and
// also want it to run in parallel so it is now an algorithm over
// all (boundary) faces instead.
// We want to pick up any edges that are only used by the baffle
// or internal faces but not by any other boundary faces. So
// - increment count on an edge by 1 if it is used by any (uncoupled)
// boundary face.
// - increment count on an edge by 1000000 if it is used by a baffle face
// - sum in parallel
//
// So now any edge that is used by baffle faces only will have the
// value 2*1000000+2*1.
const label baffleValue = 1000000;
// Count number of boundary faces per edge
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -847,18 +865,22 @@ Foam::List<Foam::labelPair> Foam::meshRefinement::freeStandingBaffles
forAll(couples, i)
{
const labelList& fEdges0 = mesh_.faceEdges(couples[i].first(), fe0);
forAll(fEdges0, fEdgeI)
{
nBafflesPerEdge[fEdges0[fEdgeI]] += 1000000;
label f0 = couples[i].first();
const labelList& fEdges0 = mesh_.faceEdges(f0, fe0);
forAll(fEdges0, fEdgeI)
{
nBafflesPerEdge[fEdges0[fEdgeI]] += baffleValue;
}
}
const labelList& fEdges1 = mesh_.faceEdges(couples[i].second(), fe1);
forAll(fEdges1, fEdgeI)
{
nBafflesPerEdge[fEdges1[fEdgeI]] += 1000000;
label f1 = couples[i].second();
const labelList& fEdges1 = mesh_.faceEdges(f1, fe1);
forAll(fEdges1, fEdgeI)
{
nBafflesPerEdge[fEdges1[fEdgeI]] += baffleValue;
}
}
}
@ -873,8 +895,8 @@ Foam::List<Foam::labelPair> Foam::meshRefinement::freeStandingBaffles
// Baffles which are not next to other boundaries and baffles will have
// nBafflesPerEdge value 2*1000000+2*1 (from 2 boundary faces which are
// both baffle faces)
// nBafflesPerEdge value 2*baffleValue+2*1 (from 2 boundary faces which
// are both baffle faces)
List<labelPair> filteredCouples(couples.size());
label filterI = 0;
@ -889,15 +911,15 @@ Foam::List<Foam::labelPair> Foam::meshRefinement::freeStandingBaffles
== patches.whichPatch(couple.second())
)
{
const labelList& fEdges = mesh_.faceEdges(couples[i].first());
const labelList& fEdges = mesh_.faceEdges(couple.first());
forAll(fEdges, fEdgeI)
{
label edgeI = fEdges[fEdgeI];
if (nBafflesPerEdge[edgeI] == 2*1000000+2*1)
if (nBafflesPerEdge[edgeI] == 2*baffleValue+2*1)
{
filteredCouples[filterI++] = couples[i];
filteredCouples[filterI++] = couple;
break;
}
}
@ -905,111 +927,127 @@ Foam::List<Foam::labelPair> Foam::meshRefinement::freeStandingBaffles
}
filteredCouples.setSize(filterI);
//Info<< "freeStandingBaffles : from "
// << returnReduce(couples.size(), sumOp<label>())
// << " down to "
// << returnReduce(filteredCouples.size(), sumOp<label>())
// << " baffles." << nl << endl;
label nFiltered = returnReduce(filteredCouples.size(), sumOp<label>());
Info<< "freeStandingBaffles : detected "
<< nFiltered
<< " free-standing baffles out of "
<< returnReduce(couples.size(), sumOp<label>())
<< nl << endl;
if (nFiltered > 0)
{
// Collect segments
// ~~~~~~~~~~~~~~~~
//XXXXXX
// {
// // Collect segments
// // ~~~~~~~~~~~~~~~~
//
// pointField start(filteredCouples.size());
// pointField end(filteredCouples.size());
//
// const pointField& cellCentres = mesh_.cellCentres();
//
// forAll(filteredCouples, i)
// {
// const labelPair& couple = couples[i];
// start[i] = cellCentres[mesh_.faceOwner()[couple.first()]];
// end[i] = cellCentres[mesh_.faceOwner()[couple.second()]];
// }
//
// // Extend segments a bit
// {
// const vectorField smallVec(Foam::sqrt(SMALL)*(end-start));
// start -= smallVec;
// end += smallVec;
// }
//
//
// // Do test for intersections
// // ~~~~~~~~~~~~~~~~~~~~~~~~~
// labelList surface1;
// List<pointIndexHit> hit1;
// labelList region1;
// vectorField normal1;
//
// labelList surface2;
// List<pointIndexHit> hit2;
// labelList region2;
// vectorField normal2;
//
// surfaces_.findNearestIntersection
// (
// surfacesToBaffle,
// start,
// end,
//
// surface1,
// hit1,
// region1,
// normal1,
//
// surface2,
// hit2,
// region2,
// normal2
// );
//
// forAll(testFaces, i)
// {
// if (hit1[i].hit() && hit2[i].hit())
// {
// bool createBaffle = true;
//
// label faceI = couples[i].first();
// label patchI = mesh_.boundaryMesh().whichPatch(faceI);
// if (patchI != -1 && !mesh_.boundaryMesh()[patchI].coupled())
// {
// // Check if we are a boundary face and normal of surface
// // does
// // not align with test vector. In this case there'd
// // probably be
// // a freestanding 'baffle' so we might as well not
// // create it.
// // Note that since it is not a proper baffle we cannot
// // detect it
// // afterwards so this code cannot be merged with the
// // filterDuplicateFaces code.
// if (mag(normal1[i]&normal2[i]) > cos(degToRad(30)))
// {
// // Both normals aligned
// vector n = end[i]-start[i];
// scalar magN = mag(n);
// if (magN > VSMALL)
// {
// n /= magN;
//
// if (mag(normal1[i]&n) < cos(degToRad(45)))
// {
// Pout<< "** disabling baffling face "
// << mesh_.faceCentres()[faceI] << endl;
// createBaffle = false;
// }
// }
// }
// }
//
//
// }
//XXXXXX
pointField start(filteredCouples.size());
pointField end(filteredCouples.size());
const pointField& cellCentres = mesh_.cellCentres();
forAll(filteredCouples, i)
{
const labelPair& couple = filteredCouples[i];
start[i] = cellCentres[mesh_.faceOwner()[couple.first()]];
end[i] = cellCentres[mesh_.faceOwner()[couple.second()]];
}
// Extend segments a bit
{
const vectorField smallVec(Foam::sqrt(SMALL)*(end-start));
start -= smallVec;
end += smallVec;
}
// Do test for intersections
// ~~~~~~~~~~~~~~~~~~~~~~~~~
labelList surface1;
List<pointIndexHit> hit1;
labelList region1;
vectorField normal1;
labelList surface2;
List<pointIndexHit> hit2;
labelList region2;
vectorField normal2;
surfaces_.findNearestIntersection
(
identity(surfaces_.surfaces().size()),
start,
end,
surface1,
hit1,
region1,
normal1,
surface2,
hit2,
region2,
normal2
);
//mkDir(mesh_.time().path()/timeName());
//OBJstream str
//(
// mesh_.time().path()/timeName()/"flatBaffles.obj"
//);
const scalar planarAngleCos = Foam::cos(degToRad(planarAngle));
label filterI = 0;
forAll(filteredCouples, i)
{
const labelPair& couple = filteredCouples[i];
if
(
hit1[i].hit()
&& hit2[i].hit()
&& (
surface1[i] != surface2[i]
|| hit1[i].index() != hit2[i].index()
)
)
{
// Two different hits. Check angle.
//str.write
//(
// linePointRef(hit1[i].hitPoint(), hit2[i].hitPoint()),
// normal1[i],
// normal2[i]
//);
if ((normal1[i]&normal2[i]) > planarAngleCos)
{
// Both normals aligned
vector n = end[i]-start[i];
scalar magN = mag(n);
if (magN > VSMALL)
{
filteredCouples[filterI++] = couple;
}
}
}
else if (hit1[i].hit() || hit2[i].hit())
{
// Single hit. Do not include in freestanding baffles.
}
}
filteredCouples.setSize(filterI);
Info<< "freeStandingBaffles : detected "
<< returnReduce(filterI, sumOp<label>())
<< " planar (within " << planarAngle
<< " degrees) free-standing baffles out of "
<< nFiltered
<< nl << endl;
}
return filteredCouples;
}
@ -1832,15 +1870,102 @@ void Foam::meshRefinement::makeConsistentFaceIndex
}
void Foam::meshRefinement::handleSnapProblems
(
const bool removeEdgeConnectedCells,
const scalarField& perpendicularAngle,
const dictionary& motionDict,
Time& runTime,
const labelList& globalToMasterPatch,
const labelList& globalToSlavePatch
)
{
Info<< nl
<< "Introducing baffles to block off problem cells" << nl
<< "----------------------------------------------" << nl
<< endl;
labelList facePatch
(
markFacesOnProblemCells
(
motionDict,
removeEdgeConnectedCells,
perpendicularAngle,
globalToMasterPatch
)
);
Info<< "Analyzed problem cells in = "
<< runTime.cpuTimeIncrement() << " s\n" << nl << endl;
if (debug&meshRefinement::MESH)
{
faceSet problemTopo(mesh_, "problemFacesTopo", 100);
const labelList facePatchTopo
(
markFacesOnProblemCells
(
motionDict,
removeEdgeConnectedCells,
perpendicularAngle,
globalToMasterPatch
)
);
forAll(facePatchTopo, faceI)
{
if (facePatchTopo[faceI] != -1)
{
problemTopo.insert(faceI);
}
}
problemTopo.instance() = timeName();
Pout<< "Dumping " << problemTopo.size()
<< " problem faces to " << problemTopo.objectPath() << endl;
problemTopo.write();
}
Info<< "Introducing baffles to delete problem cells." << nl << endl;
if (debug)
{
runTime++;
}
// Create baffles with same owner and neighbour for now.
createBaffles(facePatch, facePatch);
if (debug)
{
// Debug:test all is still synced across proc patches
checkData();
}
Info<< "Created baffles in = "
<< runTime.cpuTimeIncrement() << " s\n" << nl << endl;
printMeshInfo(debug, "After introducing baffles");
if (debug&meshRefinement::MESH)
{
Pout<< "Writing extra baffled mesh to time "
<< timeName() << endl;
write(debug, runTime.path()/"extraBaffles");
Pout<< "Dumped debug data in = "
<< runTime.cpuTimeIncrement() << " s\n" << nl << endl;
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// Split off unreachable areas of mesh.
void Foam::meshRefinement::baffleAndSplitMesh
(
const bool handleSnapProblems,
const bool doHandleSnapProblems,
const bool removeEdgeConnectedCells,
const scalarField& perpendicularAngle,
const bool mergeFreeStanding,
const scalar freeStandingAngle,
const dictionary& motionDict,
Time& runTime,
const labelList& globalToMasterPatch,
@ -1902,82 +2027,92 @@ void Foam::meshRefinement::baffleAndSplitMesh
// Create some additional baffles where we want surface cells removed.
if (handleSnapProblems)
if (doHandleSnapProblems)
{
Info<< nl
<< "Introducing baffles to block off problem cells" << nl
<< "----------------------------------------------" << nl
<< endl;
//Info<< nl
// << "Introducing baffles to block off problem cells" << nl
// << "----------------------------------------------" << nl
// << endl;
//
//labelList facePatch
//(
// markFacesOnProblemCells
// (
// motionDict,
// removeEdgeConnectedCells,
// perpendicularAngle,
// globalToMasterPatch
// )
// //markFacesOnProblemCellsGeometric(motionDict)
//);
//Info<< "Analyzed problem cells in = "
// << runTime.cpuTimeIncrement() << " s\n" << nl << endl;
//
//if (debug&meshRefinement::MESH)
//{
// faceSet problemTopo(mesh_, "problemFacesTopo", 100);
//
// const labelList facePatchTopo
// (
// markFacesOnProblemCells
// (
// motionDict,
// removeEdgeConnectedCells,
// perpendicularAngle,
// globalToMasterPatch
// )
// );
// forAll(facePatchTopo, faceI)
// {
// if (facePatchTopo[faceI] != -1)
// {
// problemTopo.insert(faceI);
// }
// }
// problemTopo.instance() = timeName();
// Pout<< "Dumping " << problemTopo.size()
// << " problem faces to " << problemTopo.objectPath() << endl;
// problemTopo.write();
//}
//
//Info<< "Introducing baffles to delete problem cells." << nl << endl;
//
//if (debug)
//{
// runTime++;
//}
//
//// Create baffles with same owner and neighbour for now.
//createBaffles(facePatch, facePatch);
//
//if (debug)
//{
// // Debug:test all is still synced across proc patches
// checkData();
//}
//Info<< "Created baffles in = "
// << runTime.cpuTimeIncrement() << " s\n" << nl << endl;
//
//printMeshInfo(debug, "After introducing baffles");
//
//if (debug&meshRefinement::MESH)
//{
// Pout<< "Writing extra baffled mesh to time "
// << timeName() << endl;
// write(debug, runTime.path()/"extraBaffles");
// Pout<< "Dumped debug data in = "
// << runTime.cpuTimeIncrement() << " s\n" << nl << endl;
//}
labelList facePatch
handleSnapProblems
(
markFacesOnProblemCells
(
motionDict,
removeEdgeConnectedCells,
perpendicularAngle,
globalToMasterPatch
)
//markFacesOnProblemCellsGeometric(motionDict)
removeEdgeConnectedCells,
perpendicularAngle,
motionDict,
runTime,
globalToMasterPatch,
globalToSlavePatch
);
Info<< "Analyzed problem cells in = "
<< runTime.cpuTimeIncrement() << " s\n" << nl << endl;
if (debug&meshRefinement::MESH)
{
faceSet problemTopo(mesh_, "problemFacesTopo", 100);
const labelList facePatchTopo
(
markFacesOnProblemCells
(
motionDict,
removeEdgeConnectedCells,
perpendicularAngle,
globalToMasterPatch
)
);
forAll(facePatchTopo, faceI)
{
if (facePatchTopo[faceI] != -1)
{
problemTopo.insert(faceI);
}
}
problemTopo.instance() = timeName();
Pout<< "Dumping " << problemTopo.size()
<< " problem faces to " << problemTopo.objectPath() << endl;
problemTopo.write();
}
Info<< "Introducing baffles to delete problem cells." << nl << endl;
if (debug)
{
runTime++;
}
// Create baffles with same owner and neighbour for now.
createBaffles(facePatch, facePatch);
if (debug)
{
// Debug:test all is still synced across proc patches
checkData();
}
Info<< "Created baffles in = "
<< runTime.cpuTimeIncrement() << " s\n" << nl << endl;
printMeshInfo(debug, "After introducing baffles");
if (debug&meshRefinement::MESH)
{
Pout<< "Writing extra baffled mesh to time "
<< timeName() << endl;
write(debug, runTime.path()/"extraBaffles");
Pout<< "Dumped debug data in = "
<< runTime.cpuTimeIncrement() << " s\n" << nl << endl;
}
}
@ -2036,7 +2171,8 @@ void Foam::meshRefinement::baffleAndSplitMesh
(
identity(mesh_.nFaces()-mesh_.nInternalFaces())
+mesh_.nInternalFaces()
)
),
freeStandingAngle
)
);
@ -2052,6 +2188,18 @@ void Foam::meshRefinement::baffleAndSplitMesh
// from them.
mergeBaffles(couples);
// Detect any problem cells resulting from merging of baffles
// and delete them
handleSnapProblems
(
removeEdgeConnectedCells,
perpendicularAngle,
motionDict,
runTime,
globalToMasterPatch,
globalToSlavePatch
);
if (debug)
{
// Debug:test all is still synced across proc patches
@ -2663,18 +2811,6 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
if (surface1[i] != -1)
{
//- Not allowed not to create baffle - is vital for regioning.
// Have logic instead at erosion!
//bool createBaffle = validBaffleTopology
//(
// faceI,
// normal1[i],
// normal2[i],
// end[i]-start[i]
//);
//
// If both hit should probably choose 'nearest'
if
(

View File

@ -244,14 +244,10 @@ bool Foam::meshRefinement::markForRefine
}
// Calculates list of cells to refine based on intersection with feature edge.
Foam::label Foam::meshRefinement::markFeatureRefinement
void Foam::meshRefinement::markFeatureCellLevel
(
const point& keepPoint,
const label nAllowRefine,
labelList& refineCell,
label& nRefine
labelList& maxFeatureLevel
) const
{
// We want to refine all cells containing a feature edge.
@ -384,7 +380,7 @@ Foam::label Foam::meshRefinement::markFeatureRefinement
// Largest refinement level of any feature passed through
labelList maxFeatureLevel(mesh_.nCells(), -1);
maxFeatureLevel = labelList(mesh_.nCells(), -1);
// Database to pass into trackedParticle::move
trackedParticle::trackingData td(cloud, maxFeatureLevel);
@ -467,8 +463,23 @@ Foam::label Foam::meshRefinement::markFeatureRefinement
// Track all particles to their end position.
cloud.move(td, GREAT);
}
}
// Calculates list of cells to refine based on intersection with feature edge.
Foam::label Foam::meshRefinement::markFeatureRefinement
(
const point& keepPoint,
const label nAllowRefine,
labelList& refineCell,
label& nRefine
) const
{
// Largest refinement level of any feature passed through
labelList maxFeatureLevel;
markFeatureCellLevel(keepPoint, maxFeatureLevel);
// See which cells to refine. maxFeatureLevel will hold highest level
// of any feature edge that passed through.

View File

@ -433,24 +433,28 @@ Foam::triSurfaceMesh::edgeTree() const
+ nInternalEdges()
);
treeBoundBox bb;
label nPoints;
PatchTools::calcBounds
(
static_cast<const triSurface&>(*this),
bb,
nPoints
);
treeBoundBox bb(vector::zero, vector::zero);
// Random number generator. Bit dodgy since not exactly random ;-)
Random rndGen(65431);
if (bEdges.size())
{
label nPoints;
PatchTools::calcBounds
(
static_cast<const triSurface&>(*this),
bb,
nPoints
);
// Slightly extended bb. Slightly off-centred just so on symmetric
// geometry there are less face/edge aligned items.
// Random number generator. Bit dodgy since not exactly random ;-)
Random rndGen(65431);
bb = bb.extend(rndGen, 1e-4);
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
// Slightly extended bb. Slightly off-centred just so on symmetric
// geometry there are less face/edge aligned items.
bb = bb.extend(rndGen, 1e-4);
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
}
scalar oldTol = indexedOctree<treeDataEdge>::perturbTol();
indexedOctree<treeDataEdge>::perturbTol() = tolerance();

View File

@ -121,33 +121,40 @@ Foam::triSurfaceRegionSearch::treeByRegion() const
);
// Calculate bb without constructing local point numbering.
treeBoundBox bb;
label nPoints;
PatchTools::calcBounds
(
indirectRegionPatches_[regionI],
bb,
nPoints
);
treeBoundBox bb(vector::zero, vector::zero);
// if (nPoints != surface().points().size())
// {
// WarningIn("triSurfaceRegionSearch::treeByRegion() const")
// << "Surface does not have compact point numbering. "
// << "Of " << surface().points().size()
// << " only " << nPoints
// << " are used. This might give problems in some routines."
// << endl;
// }
if (indirectRegionPatches_[regionI].size())
{
label nPoints;
PatchTools::calcBounds
(
indirectRegionPatches_[regionI],
bb,
nPoints
);
// Random number generator. Bit dodgy since not exactly random ;-)
Random rndGen(65431);
// if (nPoints != surface().points().size())
// {
// WarningIn("triSurfaceRegionSearch::treeByRegion() const")
// << "Surface does not have compact point numbering. "
// << "Of " << surface().points().size()
// << " only " << nPoints
// << " are used."
// << " This might give problems in some routines."
// << endl;
// }
// Slightly extended bb. Slightly off-centred just so on symmetric
// geometry there are fewer face/edge aligned items.
bb = bb.extend(rndGen, 1e-4);
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
// Random number generator. Bit dodgy since not exactly
// random ;-)
Random rndGen(65431);
// Slightly extended bb. Slightly off-centred just so
// on symmetric geometry there are fewer face/edge
// aligned items.
bb = bb.extend(rndGen, 1e-4);
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
}
treeByRegion_.set
(

View File

@ -200,28 +200,33 @@ Foam::triSurfaceSearch::tree() const
if (treePtr_.empty())
{
// Calculate bb without constructing local point numbering.
treeBoundBox bb;
label nPoints;
PatchTools::calcBounds(surface(), bb, nPoints);
treeBoundBox bb(vector::zero, vector::zero);
if (nPoints != surface().points().size())
if (surface().size())
{
WarningIn("triSurfaceSearch::tree() const")
<< "Surface does not have compact point numbering."
<< " Of " << surface().points().size() << " only " << nPoints
<< " are used. This might give problems in some routines."
<< endl;
label nPoints;
PatchTools::calcBounds(surface(), bb, nPoints);
if (nPoints != surface().points().size())
{
WarningIn("triSurfaceSearch::tree() const")
<< "Surface does not have compact point numbering."
<< " Of " << surface().points().size()
<< " only " << nPoints
<< " are used. This might give problems in some routines."
<< endl;
}
// Random number generator. Bit dodgy since not exactly random ;-)
Random rndGen(65431);
// Slightly extended bb. Slightly off-centred just so on symmetric
// geometry there are less face/edge aligned items.
bb = bb.extend(rndGen, 1e-4);
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
}
// Random number generator. Bit dodgy since not exactly random ;-)
Random rndGen(65431);
// Slightly extended bb. Slightly off-centred just so on symmetric
// geometry there are less face/edge aligned items.
bb = bb.extend(rndGen, 1e-4);
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
scalar oldTol = indexedOctree<treeDataTriSurface>::perturbTol();
indexedOctree<treeDataTriSurface>::perturbTol() = tolerance_;

View File

@ -2360,10 +2360,28 @@ bool Foam::distributedTriSurfaceMesh::writeObject
// Make sure dictionary goes to same directory as surface
const_cast<fileName&>(dict_.instance()) = searchableSurface::instance();
// Copy of triSurfaceMesh::writeObject except for the sorting of
// triangles by region. This is done so we preserve region names,
// even if locally we have zero triangles.
{
fileName fullPath(searchableSurface::objectPath());
if (!mkDir(fullPath.path()))
{
return false;
}
// Important: preserve any zero-sized patches
triSurface::write(fullPath, true);
if (!isFile(fullPath))
{
return false;
}
}
// Dictionary needs to be written in ascii - binary output not supported.
return
triSurfaceMesh::writeObject(fmt, ver, cmp)
&& dict_.writeObject(IOstream::ASCII, ver, cmp);
return dict_.writeObject(IOstream::ASCII, ver, cmp);
}

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -446,6 +446,10 @@ public:
// regIOobject implementation
//- Write using given format, version and compression
// Do not use the triSurfaceMesh::writeObject since it
// would filter out empty regions. These need to be preserved
// in case we want to make decisions based on the number of
// regions.
virtual bool writeObject
(
IOstream::streamFormat fmt,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -38,7 +38,7 @@ Description
type writeRegisteredObject;
functionObjectLibs ("libIOFunctionObjects.so");
...
objectNames (obj1 obj2);
objectNames (obj1 obj2);
}
\endverbatim

View File

@ -311,6 +311,7 @@ Foam::fieldAverage::fieldAverage
prevTimeIndex_(-1),
resetOnRestart_(false),
resetOnOutput_(false),
initialised_(false),
faItems_(),
meanScalarFields_(),
meanVectorFields_(),
@ -361,11 +362,7 @@ void Foam::fieldAverage::read(const dictionary& dict)
dict.readIfPresent("resetOnOutput", resetOnOutput_);
dict.lookup("fields") >> faItems_;
initialize();
readAveragingProperties();
// ensure first averaging works unconditionally
prevTimeIndex_ = -1;
}
}
@ -374,6 +371,16 @@ void Foam::fieldAverage::execute()
{
if (active_)
{
if (!initialised_)
{
initialize();
// ensure first averaging works unconditionally
prevTimeIndex_ = -1;
initialised_ = true;
}
calcAverages();
}
}

View File

@ -171,6 +171,9 @@ protected:
//- Reset the averaging process on output flag
Switch resetOnOutput_;
//- Initialised flag
bool initialised_;
//- List of field average items, describing what averages to be
// calculated and output
List<fieldAverageItem> faItems_;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -222,11 +222,22 @@ void Foam::fieldValues::cellSource::write()
forAll(fields_, i)
{
writeValues<scalar>(fields_[i]);
writeValues<vector>(fields_[i]);
writeValues<sphericalTensor>(fields_[i]);
writeValues<symmTensor>(fields_[i]);
writeValues<tensor>(fields_[i]);
const word& fieldName = fields_[i];
bool processed = false;
processed = processed || writeValues<scalar>(fieldName);
processed = processed || writeValues<vector>(fieldName);
processed = processed || writeValues<sphericalTensor>(fieldName);
processed = processed || writeValues<symmTensor>(fieldName);
processed = processed || writeValues<tensor>(fieldName);
if (!processed)
{
WarningIn("void Foam::fieldValues::cellSource::write()")
<< "Requested field " << fieldName
<< " not found in database and not processed"
<< endl;
}
}
if (Pstream::master())

View File

@ -630,11 +630,22 @@ void Foam::fieldValues::faceSource::write()
forAll(fields_, i)
{
writeValues<scalar>(fields_[i]);
writeValues<vector>(fields_[i]);
writeValues<sphericalTensor>(fields_[i]);
writeValues<symmTensor>(fields_[i]);
writeValues<tensor>(fields_[i]);
const word& fieldName = fields_[i];
bool processed = false;
processed = processed || writeValues<scalar>(fieldName);
processed = processed || writeValues<vector>(fieldName);
processed = processed || writeValues<sphericalTensor>(fieldName);
processed = processed || writeValues<symmTensor>(fieldName);
processed = processed || writeValues<tensor>(fieldName);
if (!processed)
{
WarningIn("void Foam::fieldValues::faceSource::write()")
<< "Requested field " << fieldName
<< " not found in database and not processed"
<< endl;
}
}
if (Pstream::master())

View File

@ -28,16 +28,12 @@ License
#include "dictionary.H"
#include "Time.H"
#include "wordReList.H"
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
#include "incompressible/RAS/RASModel/RASModel.H"
#include "incompressible/LES/LESModel/LESModel.H"
#include "fluidThermo.H"
#include "compressible/RAS/RASModel/RASModel.H"
#include "compressible/LES/LESModel/LESModel.H"
#include "fvcGrad.H"
#include "porosityModel.H"
#include "fluidThermo.H"
#include "incompressible/turbulenceModel/turbulenceModel.H"
#include "compressible/turbulenceModel/turbulenceModel.H"
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -70,38 +66,27 @@ void Foam::forces::writeFileHeader(const label i)
Foam::tmp<Foam::volSymmTensorField> Foam::forces::devRhoReff() const
{
if (obr_.foundObject<compressible::RASModel>("RASProperties"))
{
const compressible::RASModel& ras
= obr_.lookupObject<compressible::RASModel>("RASProperties");
typedef compressible::turbulenceModel cmpTurbModel;
typedef incompressible::turbulenceModel icoTurbModel;
return ras.devRhoReff();
}
else if (obr_.foundObject<incompressible::RASModel>("RASProperties"))
if (obr_.foundObject<cmpTurbModel>(cmpTurbModel::typeName))
{
const incompressible::RASModel& ras
= obr_.lookupObject<incompressible::RASModel>("RASProperties");
const cmpTurbModel& turb =
obr_.lookupObject<cmpTurbModel>(cmpTurbModel::typeName);
return rho()*ras.devReff();
return turb.devRhoReff();
}
else if (obr_.foundObject<compressible::LESModel>("LESProperties"))
else if (obr_.foundObject<icoTurbModel>(icoTurbModel::typeName))
{
const compressible::LESModel& les =
obr_.lookupObject<compressible::LESModel>("LESProperties");
const incompressible::turbulenceModel& turb =
obr_.lookupObject<icoTurbModel>(icoTurbModel::typeName);
return les.devRhoReff();
return rho()*turb.devReff();
}
else if (obr_.foundObject<incompressible::LESModel>("LESProperties"))
{
const incompressible::LESModel& les
= obr_.lookupObject<incompressible::LESModel>("LESProperties");
return rho()*les.devReff();
}
else if (obr_.foundObject<fluidThermo>("thermophysicalProperties"))
else if (obr_.foundObject<fluidThermo>(fluidThermo::typeName))
{
const fluidThermo& thermo =
obr_.lookupObject<fluidThermo>("thermophysicalProperties");
obr_.lookupObject<fluidThermo>(fluidThermo::typeName);
const volVectorField& U = obr_.lookupObject<volVectorField>(UName_);

View File

@ -70,7 +70,7 @@ Foam::dimensionedScalar Foam::pressureTools::rhoScale
}
else
{
return dimensionedScalar("rhoRef", dimDensity, rhoRef_);
return dimensionedScalar("rhoRef", dimDensity, rhoInf_);
}
}
@ -100,7 +100,7 @@ Foam::tmp<Foam::volScalarField> Foam::pressureTools::rho
IOobject::NO_WRITE
),
p.mesh(),
dimensionedScalar("zero", dimDensity, rhoRef_)
dimensionedScalar("zero", dimDensity, rhoInf_)
)
);
}
@ -193,7 +193,6 @@ Foam::pressureTools::pressureTools
pName_("p"),
UName_("U"),
rhoName_("rho"),
rhoRef_(1.0),
calcTotal_(false),
pRef_(0.0),
calcCoeff_(false),
@ -242,7 +241,7 @@ void Foam::pressureTools::read(const dictionary& dict)
if (p.dimensions() != dimPressure)
{
dict.lookup("rhoRef") >> rhoRef_;
dict.lookup("rhoRef") >> rhoInf_;
}
dict.lookup("calcTotal") >> calcTotal_;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -92,7 +92,6 @@ Description
\table
Property | Description | Required | Default value
type | type name: pressureTools| yes |
rhoRef | Reference density for incompressible cases | no | 1
calcTotal | Calculate total coefficient | yes |
pRef | Reference pressure for total pressure | no | 0.0
calcCoeff | Calculate pressure coefficient | yes |
@ -150,9 +149,6 @@ class pressureTools
//- Name of density field, default is "rho"
word rhoName_;
//- Reference density employed for incompressible cases
scalar rhoRef_;
// Total pressure calculation

View File

@ -24,6 +24,10 @@ $(KINEMATICMODELS)/injectionModel/drippingInjection/drippingInjection.C
$(KINEMATICMODELS)/injectionModel/removeInjection/removeInjection.C
$(KINEMATICMODELS)/injectionModel/curvatureSeparation/curvatureSeparation.C
$(KINEMATICMODELS)/filmTurbulenceModel/filmTurbulenceModel/filmTurbulenceModel.C
$(KINEMATICMODELS)/filmTurbulenceModel/filmTurbulenceModel/filmTurbulenceModelNew.C
$(KINEMATICMODELS)/filmTurbulenceModel/laminar/laminar.C
THERMOMODELS=submodels/thermo
$(THERMOMODELS)/phaseChangeModel/phaseChangeModel/phaseChangeModel.C
$(THERMOMODELS)/phaseChangeModel/phaseChangeModel/phaseChangeModelNew.C

View File

@ -163,7 +163,7 @@ tmp<volScalarField> kinematicSingleLayer::pu()
(
IOobject
(
"pu",
typeName + ":pu",
time_.timeName(),
regionMesh(),
IOobject::NO_READ,
@ -185,7 +185,7 @@ tmp<volScalarField> kinematicSingleLayer::pp()
(
IOobject
(
"pp",
typeName + ":pp",
time_.timeName(),
regionMesh(),
IOobject::NO_READ,
@ -216,6 +216,8 @@ void kinematicSingleLayer::updateSubmodels()
// Update source fields
const dimensionedScalar deltaT = time().deltaT();
rhoSp_ += cloudMassTrans_/magSf()/deltaT;
turbulence_->correct();
}
@ -282,9 +284,7 @@ void kinematicSingleLayer::updateSurfaceVelocities()
Uw_ -= nHat()*(Uw_ & nHat());
Uw_.correctBoundaryConditions();
// apply quadratic profile to surface velocity (scale by sqrt(2))
Us_ = 1.414*U_;
Us_.correctBoundaryConditions();
Us_ = turbulence_->Us();
}
@ -309,6 +309,7 @@ tmp<Foam::fvVectorMatrix> kinematicSingleLayer::solveMomentum
// - fvm::SuSp(rhoSp_, U_)
- rhoSp_*U_
+ forces_.correct(U_)
+ turbulence_->Su(U_)
);
fvVectorMatrix& UEqn = tUEqn();
@ -779,6 +780,8 @@ kinematicSingleLayer::kinematicSingleLayer
injection_(*this, coeffs_),
turbulence_(filmTurbulenceModel::New(*this, coeffs_)),
forces_(*this, coeffs_),
addedMassTotal_(0.0)
@ -1020,7 +1023,7 @@ tmp<volScalarField> kinematicSingleLayer::primaryMassTrans() const
(
IOobject
(
"kinematicSingleLayer::primaryMassTrans",
typeName + ":primaryMassTrans",
time().timeName(),
primaryMesh(),
IOobject::NO_READ,
@ -1075,7 +1078,7 @@ tmp<DimensionedField<scalar, volMesh> > kinematicSingleLayer::Srho() const
(
IOobject
(
"kinematicSingleLayer::Srho",
typeName + ":Srho",
time().timeName(),
primaryMesh(),
IOobject::NO_READ,
@ -1100,7 +1103,7 @@ tmp<DimensionedField<scalar, volMesh> > kinematicSingleLayer::Srho
(
IOobject
(
"kinematicSingleLayer::Srho(" + Foam::name(i) + ")",
typeName + ":Srho(" + Foam::name(i) + ")",
time().timeName(),
primaryMesh(),
IOobject::NO_READ,
@ -1122,7 +1125,7 @@ tmp<DimensionedField<scalar, volMesh> > kinematicSingleLayer::Sh() const
(
IOobject
(
"kinematicSingleLayer::Sh",
typeName + ":Sh",
time().timeName(),
primaryMesh(),
IOobject::NO_READ,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -43,6 +43,7 @@ SourceFiles
#include "injectionModelList.H"
#include "forceList.H"
#include "filmTurbulenceModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -197,6 +198,9 @@ protected:
//- Cloud injection
injectionModelList injection_;
//- Turbulence model
autoPtr<filmTurbulenceModel> turbulence_;
//- List of film forces
forceList forces_;
@ -444,6 +448,9 @@ public:
//- Injection
inline injectionModelList& injection();
//- Turbulence
inline const filmTurbulenceModel& turbulence() const;
// Helper functions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -169,6 +169,12 @@ inline injectionModelList& kinematicSingleLayer::injection()
}
inline const filmTurbulenceModel& kinematicSingleLayer::turbulence() const
{
return turbulence_();
}
inline tmp<volScalarField> kinematicSingleLayer::mass() const
{
return rho_*delta_*magSf();

View File

@ -0,0 +1,73 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ 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/>.
\*---------------------------------------------------------------------------*/
#include "filmTurbulenceModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(filmTurbulenceModel, 0);
defineRunTimeSelectionTable(filmTurbulenceModel, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
filmTurbulenceModel::filmTurbulenceModel(const surfaceFilmModel& owner)
:
subModelBase(owner)
{}
filmTurbulenceModel::filmTurbulenceModel
(
const word& type,
const surfaceFilmModel& owner,
const dictionary& dict
)
:
subModelBase(type, owner, dict)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
filmTurbulenceModel::~filmTurbulenceModel()
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,148 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ 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/>.
Class
Foam::regionModels::surfaceFilmModels::filmTurbulenceModel
Description
Base class for film turbulence models
SourceFiles
filmTurbulenceModel.C
filmTurbulenceModelNew.C
\*---------------------------------------------------------------------------*/
#ifndef filmTurbulenceModel_H
#define filmTurbulenceModel_H
#include "subModelBase.H"
#include "runTimeSelectionTables.H"
#include "fvMatricesFwd.H"
#include "volFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
/*---------------------------------------------------------------------------*\
Class filmTurbulenceModel Declaration
\*---------------------------------------------------------------------------*/
class filmTurbulenceModel
:
public subModelBase
{
private:
// Private Member Functions
//- Disallow default bitwise copy construct
filmTurbulenceModel(const filmTurbulenceModel&);
//- Disallow default bitwise assignment
void operator=(const filmTurbulenceModel&);
public:
//- Runtime type information
TypeName("filmTurbulenceModel");
// Declare runtime constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
filmTurbulenceModel,
dictionary,
(
const surfaceFilmModel& owner,
const dictionary& dict
),
(owner, dict)
);
// Constructors
//- Construct null
filmTurbulenceModel(const surfaceFilmModel& owner);
//- Construct from type name, dictionary and surface film model
filmTurbulenceModel
(
const word& type,
const surfaceFilmModel& owner,
const dictionary& dict
);
// Selectors
//- Return a reference to the selected injection model
static autoPtr<filmTurbulenceModel> New
(
const surfaceFilmModel& owner,
const dictionary& dict
);
//- Destructor
virtual ~filmTurbulenceModel();
// Member Functions
// Evolution
//- Return the film surface velocity
virtual tmp<volVectorField> Us() const = 0;
//- Return the film turbulence viscosity
virtual tmp<volScalarField> mut() const = 0;
//- Correct/update the model
virtual void correct() = 0;
//- Return the source for the film momentum equation
virtual tmp<fvVectorMatrix> Su(volVectorField& U) const = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,77 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ 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/>.
\*---------------------------------------------------------------------------*/
#include "filmTurbulenceModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
autoPtr<filmTurbulenceModel> filmTurbulenceModel::New
(
const surfaceFilmModel& model,
const dictionary& dict
)
{
const word modelType(dict.lookup("turbulence"));
Info<< " " << modelType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(modelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"filmTurbulenceModel::New"
"("
"const surfaceFilmModel&, "
"const dictionary&"
")"
) << "Unknown filmTurbulenceModel type " << modelType
<< nl << nl << "Valid filmTurbulenceModel types are:" << nl
<< dictionaryConstructorTablePtr_->toc()
<< exit(FatalError);
}
return autoPtr<filmTurbulenceModel>(cstrIter()(model, dict));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,160 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ 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/>.
\*---------------------------------------------------------------------------*/
#include "laminar.H"
#include "addToRunTimeSelectionTable.H"
#include "fvMesh.H"
#include "fvMatrices.H"
#include "Time.H"
#include "volFields.H"
#include "fvmSup.H"
#include "kinematicSingleLayer.H"
#include "zeroGradientFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(laminar, 0);
addToRunTimeSelectionTable(filmTurbulenceModel, laminar, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
laminar::laminar
(
const surfaceFilmModel& owner,
const dictionary& dict
)
:
filmTurbulenceModel(type(), owner, dict),
Cf_(readScalar(coeffs_.lookup("Cf")))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
laminar::~laminar()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
tmp<volVectorField> laminar::Us() const
{
tmp<volVectorField> tUs
(
new volVectorField
(
IOobject
(
typeName + ".Us",
owner_.regionMesh().time().timeName(),
owner_.regionMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
owner_.regionMesh(),
dimensionedVector("zero", dimVelocity, vector::zero),
zeroGradientFvPatchVectorField::typeName
)
);
// apply quadratic profile
tUs() = Foam::sqrt(2.0)*owner_.U();
tUs().correctBoundaryConditions();
return tUs;
}
tmp<volScalarField> laminar::mut() const
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
typeName + ".mut",
owner_.regionMesh().time().timeName(),
owner_.regionMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
owner_.regionMesh(),
dimensionedScalar("zero", dimMass/dimLength/dimTime, 0.0)
)
);
}
void laminar::correct()
{
// do nothing
}
tmp<fvVectorMatrix> laminar::Su(volVectorField& U) const
{
// local reference to film model
const kinematicSingleLayer& film =
static_cast<const kinematicSingleLayer&>(owner_);
// local references to film fields
const volScalarField& mu = film.mu();
const volVectorField& Uw = film.Uw();
const volVectorField& Us = film.Us();
const volScalarField& delta = film.delta();
const volVectorField& Up = film.UPrimary();
const volScalarField& rhop = film.rhoPrimary();
// employ simple coeff-based model
volScalarField Cs("Cs", Cf_*rhop*mag(Up - Us));
dimensionedScalar d0("SMALL", delta.dimensions(), SMALL);
volScalarField Cw("Cw", mu/(0.3333*(delta + d0)));
Cw.min(5000.0);
return
(
- fvm::Sp(Cs, U) + Cs*Us // surface contribution
- fvm::Sp(Cw, U) + Cw*Uw // wall contribution
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,118 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ 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/>.
Class
Foam::regionModels::surfaceFilmModels::laminar
Description
Film laminar turbulence model.
SourceFiles
laminar.C
\*---------------------------------------------------------------------------*/
#ifndef laminar_H
#define laminar_H
#include "filmTurbulenceModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
/*---------------------------------------------------------------------------*\
Class laminar Declaration
\*---------------------------------------------------------------------------*/
class laminar
:
public filmTurbulenceModel
{
private:
// Private Data
//- Surface roughness coefficient
scalar Cf_;
// Private member functions
//- Disallow default bitwise copy construct
laminar(const laminar&);
//- Disallow default bitwise assignment
void operator=(const laminar&);
public:
//- Runtime type information
TypeName("laminar");
// Constructors
//- Construct from surface film model
laminar(const surfaceFilmModel& owner, const dictionary& dict);
//- Destructor
virtual ~laminar();
// Member Functions
// Evolution
//- Return the film surface velocity
virtual tmp<volVectorField> Us() const;
//- Return the film turbulence viscosity
virtual tmp<volScalarField> mut() const;
//- Correct/update the model
virtual void correct();
//- Return the source for the film momentum equation
virtual tmp<fvVectorMatrix> Su(volVectorField& U) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,6 +25,7 @@ License
#include "thermoSingleLayer.H"
#include "heatTransferModel.H"
#include "filmRadiationModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -202,7 +202,7 @@ Foam::labelList Foam::structuredRenumber::renumber
if (depthFirst_)
{
orderedToOld[nLayers*cellData[cellI].data()+layerI] = cellI;
}
}
else
{
orderedToOld[cellData[cellI].data()+nLayers*layerI] = cellI;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -63,20 +63,51 @@ tmp<volScalarField> SpalartAllmaras::fv1() const
tmp<volScalarField> SpalartAllmaras::fv2() const
{
return 1.0/pow3(scalar(1) + rho()*nuTilda_/(mu()*Cv2_));
if (ashfordCorrection_)
{
return 1.0/pow3(scalar(1) + rho()*nuTilda_/(mu()*Cv2_));
}
else
{
const volScalarField chi("chi", rho()*nuTilda_/mu());
return 1.0 - chi/(1.0 + chi*fv1());
}
}
tmp<volScalarField> SpalartAllmaras::fv3() const
{
volScalarField chi(rho()*nuTilda_/mu());
volScalarField chiByCv2((1/Cv2_)*chi);
if (ashfordCorrection_)
{
volScalarField chi(rho()*nuTilda_/mu());
volScalarField chiByCv2((1/Cv2_)*chi);
return
(scalar(1) + chi*fv1())
*(1/Cv2_)
*(3*(scalar(1) + chiByCv2) + sqr(chiByCv2))
/pow3(scalar(1) + chiByCv2);
return
(scalar(1) + chi*fv1())
*(1/Cv2_)
*(3*(scalar(1) + chiByCv2) + sqr(chiByCv2))
/pow3(scalar(1) + chiByCv2);
}
else
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"fv3",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("fv3", dimless, 1),
zeroGradientFvPatchScalarField::typeName
)
);
}
}
@ -222,6 +253,8 @@ SpalartAllmaras::SpalartAllmaras
)
),
ashfordCorrection_(coeffDict_.lookupOrDefault("ashfordCorrection", true)),
nuTilda_
(
IOobject
@ -265,6 +298,11 @@ SpalartAllmaras::SpalartAllmaras
updateSubGridScaleFields();
printCoeffs();
if (ashfordCorrection_)
{
Info<< " Employing Ashford correction" << endl;
}
}
@ -344,16 +382,19 @@ bool SpalartAllmaras::read()
{
sigmaNut_.readIfPresent(coeffDict());
Prt_.readIfPresent(coeffDict());
Cb1_.readIfPresent(coeffDict());
Cb2_.readIfPresent(coeffDict());
Cw1_ = Cb1_/sqr(kappa_) + (1.0 + Cb2_)/sigmaNut_;
Cw2_.readIfPresent(coeffDict());
Cw3_.readIfPresent(coeffDict());
Cv1_.readIfPresent(coeffDict());
Cv2_.readIfPresent(coeffDict());
CDES_.readIfPresent(coeffDict());
ck_.readIfPresent(coeffDict());
kappa_.readIfPresent(*this);
Cw1_ = Cb1_/sqr(kappa_) + (1.0 + Cb2_)/sigmaNut_;
Cw2_.readIfPresent(coeffDict());
Cw3_.readIfPresent(coeffDict());
ashfordCorrection_.readIfPresent("ashfordCorrection", coeffDict());
return true;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -30,6 +30,15 @@ Group
Description
SpalartAllmaras for compressible flows
Extended according to
\verbatim
"An Unstructured Grid Generation and Adaptive Solution Technique
for High Reynolds Number Compressible Flows"
G.A. Ashford,
Ph.D. thesis, University of Michigan, 1996.
\endverbatim
by using the optional flag \c ashfordCorrection
SourceFiles
SpalartAllmaras.C
@ -77,12 +86,16 @@ class SpalartAllmaras
dimensionedScalar Cw3_;
// Fields
//- Optional flag to activate the Ashford correction
Switch ashfordCorrection_;
volScalarField nuTilda_;
volScalarField dTilda_;
volScalarField muSgs_;
volScalarField alphaSgs_;
// Fields
volScalarField nuTilda_;
volScalarField dTilda_;
volScalarField muSgs_;
volScalarField alphaSgs_;
// Private Member Functions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -63,7 +63,14 @@ tmp<volScalarField> SpalartAllmaras::fv2
const volScalarField& fv1
) const
{
return 1.0/pow3(scalar(1) + chi/Cv2_);
if (ashfordCorrection_)
{
return 1.0/pow3(scalar(1) + chi/Cv2_);
}
else
{
return 1.0 - chi/(1.0 + chi*fv1);
}
}
@ -73,13 +80,36 @@ tmp<volScalarField> SpalartAllmaras::fv3
const volScalarField& fv1
) const
{
const volScalarField chiByCv2((1/Cv2_)*chi);
if (ashfordCorrection_)
{
const volScalarField chiByCv2((1/Cv2_)*chi);
return
(scalar(1) + chi*fv1)
*(1/Cv2_)
*(3*(scalar(1) + chiByCv2) + sqr(chiByCv2))
/pow3(scalar(1) + chiByCv2);
return
(scalar(1) + chi*fv1)
*(1/Cv2_)
*(3*(scalar(1) + chiByCv2) + sqr(chiByCv2))
/pow3(scalar(1) + chiByCv2);
}
else
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"fv3",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("fv3", dimless, 1),
zeroGradientFvPatchScalarField::typeName
)
);
}
}
@ -252,6 +282,11 @@ SpalartAllmaras::SpalartAllmaras
alphat_.correctBoundaryConditions();
printCoeffs();
if (ashfordCorrection_)
{
Info<< " Employing Ashford correction" << endl;
}
}
@ -372,6 +407,8 @@ bool SpalartAllmaras::read()
Cv1_.readIfPresent(coeffDict());
Cv2_.readIfPresent(coeffDict());
ashfordCorrection_.readIfPresent("ashfordCorrection", coeffDict());
return true;
}
else

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -37,14 +37,16 @@ Description
P.R. Spalart,
S.R. Allmaras,
La Recherche Aerospatiale, No. 1, 1994, pp. 5-21.
\endverbatim
Extended according to:
Extended according to:
\verbatim
"An Unstructured Grid Generation and Adaptive Solution Technique
for High Reynolds Number Compressible Flows"
G.A. Ashford,
Ph.D. thesis, University of Michigan, 1996.
\endverbatim
by using the optional flag \c ashfordCorrection
The default model coefficients correspond to the following:
\verbatim
@ -110,6 +112,10 @@ protected:
dimensionedScalar Cv2_;
//- Optional flag to activate the Ashford correction
Switch ashfordCorrection_;
// Fields
volScalarField nuTilda_;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -60,20 +60,51 @@ tmp<volScalarField> SpalartAllmaras::fv1() const
tmp<volScalarField> SpalartAllmaras::fv2() const
{
return 1/pow3(scalar(1) + nuTilda_/(Cv2_*nu()));
if (ashfordCorrection_)
{
return 1/pow3(scalar(1) + nuTilda_/(Cv2_*nu()));
}
else
{
const volScalarField chi("chi", nuTilda_/nu());
return 1.0 - chi/(1.0 + chi*fv1());
}
}
tmp<volScalarField> SpalartAllmaras::fv3() const
{
const volScalarField chi("chi", nuTilda_/nu());
const volScalarField chiByCv2(chi/Cv2_);
if (ashfordCorrection_)
{
const volScalarField chi("chi", nuTilda_/nu());
const volScalarField chiByCv2(chi/Cv2_);
return
(scalar(1) + chi*fv1())
*(1/Cv2_)
*(3*(scalar(1) + chiByCv2) + sqr(chiByCv2))
/pow3(scalar(1) + chiByCv2);
return
(scalar(1) + chi*fv1())
*(1/Cv2_)
*(3*(scalar(1) + chiByCv2) + sqr(chiByCv2))
/pow3(scalar(1) + chiByCv2);
}
else
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"fv3",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("fv3", dimless, 1),
zeroGradientFvPatchScalarField::typeName
)
);
}
}
@ -246,6 +277,8 @@ SpalartAllmaras::SpalartAllmaras
)
),
ashfordCorrection_(coeffDict_.lookupOrDefault("ashfordCorrection", true)),
y_(mesh_),
nuTilda_
@ -275,6 +308,11 @@ SpalartAllmaras::SpalartAllmaras
)
{
updateSubGridScaleFields();
if (ashfordCorrection_)
{
Info<< " Employing Ashford correction" << endl;
}
}
@ -376,6 +414,7 @@ bool SpalartAllmaras::read()
{
sigmaNut_.readIfPresent(coeffDict());
kappa_.readIfPresent(*this);
Cb1_.readIfPresent(coeffDict());
Cb2_.readIfPresent(coeffDict());
Cv1_.readIfPresent(coeffDict());
@ -386,6 +425,8 @@ bool SpalartAllmaras::read()
Cw2_.readIfPresent(coeffDict());
Cw3_.readIfPresent(coeffDict());
ashfordCorrection_.readIfPresent("ashfordCorrection", coeffDict());
return true;
}
else

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -30,6 +30,15 @@ Group
Description
SpalartAllmaras DES (SA + LES) turbulence model for incompressible flows
Extended according to
\verbatim
"An Unstructured Grid Generation and Adaptive Solution Technique
for High Reynolds Number Compressible Flows"
G.A. Ashford,
Ph.D. thesis, University of Michigan, 1996.
\endverbatim
by using the optional flag \c ashfordCorrection
SourceFiles
SpalartAllmaras.C
@ -90,6 +99,10 @@ protected:
dimensionedScalar Cw3_;
//- Optional flag to activate the Ashford correction
Switch ashfordCorrection_;
// Fields
wallDist y_;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -61,7 +61,14 @@ tmp<volScalarField> SpalartAllmaras::fv2
const volScalarField& fv1
) const
{
return 1.0/pow3(scalar(1) + chi/Cv2_);
if (ashfordCorrection_)
{
return 1.0/pow3(scalar(1) + chi/Cv2_);
}
else
{
return 1.0 - chi/(1.0 + chi*fv1);
}
}
@ -71,13 +78,36 @@ tmp<volScalarField> SpalartAllmaras::fv3
const volScalarField& fv1
) const
{
const volScalarField chiByCv2((1/Cv2_)*chi);
if (ashfordCorrection_)
{
const volScalarField chiByCv2((1/Cv2_)*chi);
return
(scalar(1) + chi*fv1)
*(1/Cv2_)
*(3*(scalar(1) + chiByCv2) + sqr(chiByCv2))
/pow3(scalar(1) + chiByCv2);
return
(scalar(1) + chi*fv1)
*(1/Cv2_)
*(3*(scalar(1) + chiByCv2) + sqr(chiByCv2))
/pow3(scalar(1) + chiByCv2);
}
else
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"fv3",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("fv3", dimless, 1),
zeroGradientFvPatchScalarField::typeName
)
);
}
}
@ -195,6 +225,8 @@ SpalartAllmaras::SpalartAllmaras
)
),
ashfordCorrection_(coeffDict_.lookupOrDefault("ashfordCorrection", true)),
nuTilda_
(
IOobject
@ -224,6 +256,11 @@ SpalartAllmaras::SpalartAllmaras
d_(mesh_)
{
printCoeffs();
if (ashfordCorrection_)
{
Info<< " Employing Ashford correction" << endl;
}
}
@ -368,6 +405,8 @@ bool SpalartAllmaras::read()
Cv1_.readIfPresent(coeffDict());
Cv2_.readIfPresent(coeffDict());
ashfordCorrection_.readIfPresent("ashfordCorrection", coeffDict());
return true;
}
else

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -37,14 +37,16 @@ Description
P.R. Spalart,
S.R. Allmaras,
La Recherche Aerospatiale, No. 1, 1994, pp. 5-21.
\endverbatim
Extended according to:
Extended according to
\verbatim
"An Unstructured Grid Generation and Adaptive Solution Technique
for High Reynolds Number Compressible Flows"
G.A. Ashford,
Ph.D. thesis, University of Michigan, 1996.
\endverbatim
using the optional flag \c ashfordCorrection
The default model coefficients correspond to the following:
\verbatim
@ -82,7 +84,7 @@ namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class SpalartAllmaras Declaration
Class SpalartAllmaras Declaration
\*---------------------------------------------------------------------------*/
class SpalartAllmaras
@ -108,6 +110,10 @@ protected:
dimensionedScalar Cv2_;
//- Optional flag to activate the Ashford correction
Switch ashfordCorrection_;
// Fields
volScalarField nuTilda_;