GIT: Resolved merge conflict

This commit is contained in:
andy
2014-01-10 09:59:37 +00:00
267 changed files with 1828 additions and 7849 deletions

View File

@ -188,12 +188,12 @@ Foam::OSstream& Foam::messageStream::operator()
Foam::OSstream& Foam::messageStream::operator()(const bool output)
{
if (output && level)
if (level)
{
bool collect = (severity_ == INFO || severity_ == WARNING);
// Report the error
if (collect)
if (!output && collect)
{
return Snull;
}

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) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -652,7 +652,7 @@ Foam::Ostream& Foam::dimensionSet::write
os << token::BEGIN_SQR;
if (writeUnits.valid())
if (writeUnits.valid() && os.format() == IOstream::ASCII)
{
scalarField exponents(dimensionSet::nDimensions);
for (int d=0; d<dimensionSet::nDimensions; d++)

View File

@ -352,7 +352,11 @@ void Foam::GAMGSolver::Vcycle
// Scale coarse-grid correction field
// but not on the coarsest level because it evaluates to 1
if (scaleCorrection_ && leveli < coarsestLevel - 1)
if
(
scaleCorrection_
&& (interpolateCorrection_ || leveli < coarsestLevel - 1)
)
{
scale
(

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) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -43,7 +43,7 @@ Foam::Ostream& Foam::operator<<
os.write
(
reinterpret_cast<const char*>(&tbl.table_),
sizeof(tbl.table_)
tbl.table_.byteSize()
);
}

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) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -261,7 +261,7 @@ Foam::label Foam::UIPstream::read
(
buf,
bufSize,
MPI_PACKED,
MPI_BYTE,
fromProcNo,
tag,
PstreamGlobals::MPICommunicators_[communicator],
@ -317,7 +317,7 @@ Foam::label Foam::UIPstream::read
(
buf,
bufSize,
MPI_PACKED,
MPI_BYTE,
fromProcNo,
tag,
PstreamGlobals::MPICommunicators_[communicator],

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) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -74,7 +74,7 @@ bool Foam::UOPstream::write
(
const_cast<char*>(buf),
bufSize,
MPI_PACKED,
MPI_BYTE,
toProcNo, //procID(toProcNo),
tag,
PstreamGlobals::MPICommunicators_[communicator] //MPI_COMM_WORLD
@ -94,7 +94,7 @@ bool Foam::UOPstream::write
(
const_cast<char*>(buf),
bufSize,
MPI_PACKED,
MPI_BYTE,
toProcNo, //procID(toProcNo),
tag,
PstreamGlobals::MPICommunicators_[communicator] //MPI_COMM_WORLD
@ -116,7 +116,7 @@ bool Foam::UOPstream::write
(
const_cast<char*>(buf),
bufSize,
MPI_PACKED,
MPI_BYTE,
toProcNo, //procID(toProcNo),
tag,
PstreamGlobals::MPICommunicators_[communicator],//MPI_COMM_WORLD,

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) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -81,15 +81,6 @@ private:
const label unmappedIndex
);
//- Map from old to new according to map. Handles map = -1.
template<class Type>
static void map
(
const Field<Type>&,
const labelList& map,
Field<Type>&
);
//- Update single volField.
template<class Type>
static void MapVolField

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) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -30,26 +30,6 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::fvMeshAdder::map
(
const Field<Type>& oldFld,
const labelList& oldToNew,
Field<Type>& fld
)
{
forAll(oldFld, cellI)
{
label newCellI = oldToNew[cellI];
if (newCellI >= 0 && newCellI < fld.size())
{
fld[newCellI] = oldFld[cellI];
}
}
}
template<class Type>
void Foam::fvMeshAdder::MapVolField
(
@ -73,8 +53,8 @@ void Foam::fvMeshAdder::MapVolField
intFld.setSize(mesh.nCells());
map(oldInternalField, meshMap.oldCellMap(), intFld);
map(fldToAdd.internalField(), meshMap.addedCellMap(), intFld);
intFld.rmap(oldInternalField, meshMap.oldCellMap());
intFld.rmap(fldToAdd.internalField(), meshMap.addedCellMap());
}
@ -156,7 +136,7 @@ void Foam::fvMeshAdder::MapVolField
oldPatchSizes[patchI],
meshMap.oldFaceMap(),
mesh.boundaryMesh()[newPatchI],
0 // unmapped value
-1 // unmapped value
)
);
@ -218,7 +198,7 @@ void Foam::fvMeshAdder::MapVolField
oldPatch.size(),
meshMap.addedFaceMap(),
newPatch,
0 // unmapped values
-1 // unmapped values
)
);
@ -241,34 +221,23 @@ void Foam::fvMeshAdder::MapVolField
// PatchField will have correct size already. Just slot in
// my elements.
// From new patch faces to patch faces on added mesh. This
// time keep unmapped elements -1.
labelList newToAdded
(
calcPatchMap
(
oldPatch.start(),
oldPatch.size(),
meshMap.addedFaceMap(),
newPatch,
-1 // unmapped values
)
);
const fvPatchField<Type>& addedFld =
fldToAdd.boundaryField()[patchI];
fvPatchField<Type>& newFld = bfld[newPatchI];
forAll(newFld, i)
labelList addedToNew(oldPatch.size(), -1);
forAll(addedToNew, i)
{
label oldFaceI = newToAdded[i];
if (oldFaceI >= 0 && oldFaceI < addedFld.size())
label addedFaceI = oldPatch.start()+i;
label newFaceI = meshMap.addedFaceMap()[addedFaceI];
label patchFaceI = newFaceI-newPatch.start();
if (patchFaceI >= 0 && patchFaceI < newPatch.size())
{
newFld[i] = addedFld[oldFaceI];
addedToNew[i] = patchFaceI;
}
}
bfld[newPatchI].rmap
(
fldToAdd.boundaryField()[patchI],
addedToNew
);
}
}
}
@ -375,8 +344,9 @@ void Foam::fvMeshAdder::MapSurfaceField
intFld.setSize(mesh.nInternalFaces());
map(oldField, meshMap.oldFaceMap(), intFld);
map(fldToAdd, meshMap.addedFaceMap(), intFld);
intFld.rmap(oldField, meshMap.oldFaceMap());
intFld.rmap(fldToAdd, meshMap.addedFaceMap());
// Faces that were boundary faces but are not anymore.
// Use owner value (so lowest numbered cell, i.e. from 'old' not 'added'
@ -474,13 +444,12 @@ void Foam::fvMeshAdder::MapSurfaceField
oldPatchSizes[patchI],
meshMap.oldFaceMap(),
mesh.boundaryMesh()[newPatchI],
0 // unmapped value
-1 // unmapped value
)
);
directFvPatchFieldMapper patchMapper(newToOld);
// Create new patchField with same type as existing one.
// Note:
// - boundaryField already in new order so access with newPatchI
@ -536,7 +505,7 @@ void Foam::fvMeshAdder::MapSurfaceField
oldPatch.size(),
meshMap.addedFaceMap(),
newPatch,
0 // unmapped values
-1 // unmapped values
)
);
@ -559,34 +528,23 @@ void Foam::fvMeshAdder::MapSurfaceField
// PatchField will have correct size already. Just slot in
// my elements.
// From new patch faces to patch faces on added mesh. This
// time keep unmapped elements -1.
labelList newToAdded
(
calcPatchMap
(
oldPatch.start(),
oldPatch.size(),
meshMap.addedFaceMap(),
newPatch,
-1 // unmapped values
)
);
const fvsPatchField<Type>& addedFld =
fldToAdd.boundaryField()[patchI];
fvsPatchField<Type>& newFld = bfld[newPatchI];
forAll(newFld, i)
labelList addedToNew(oldPatch.size(), -1);
forAll(addedToNew, i)
{
label oldFaceI = newToAdded[i];
if (oldFaceI >= 0 && oldFaceI < addedFld.size())
label addedFaceI = oldPatch.start()+i;
label newFaceI = meshMap.addedFaceMap()[addedFaceI];
label patchFaceI = newFaceI-newPatch.start();
if (patchFaceI >= 0 && patchFaceI < newPatch.size())
{
newFld[i] = addedFld[oldFaceI];
addedToNew[i] = patchFaceI;
}
}
bfld[newPatchI].rmap
(
fldToAdd.boundaryField()[patchI],
addedToNew
);
}
}
}

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) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -1058,7 +1058,7 @@ void Foam::fvMeshDistribute::sendMesh
const labelList& sourceProc,
const labelList& sourcePatch,
const labelList& sourceNewNbrProc,
UOPstream& toDomain
Ostream& toDomain
)
{
if (debug)
@ -1217,7 +1217,7 @@ Foam::autoPtr<Foam::fvMesh> Foam::fvMeshDistribute::receiveMesh
labelList& domainSourceProc,
labelList& domainSourcePatch,
labelList& domainSourceNewNbrProc,
UIPstream& fromNbr
Istream& fromNbr
)
{
pointField domainPoints(fromNbr);

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) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -255,7 +255,7 @@ class fvMeshDistribute
const labelList& sourceProc,
const labelList& sourcePatch,
const labelList& sourceNewProc,
UOPstream& toDomain
Ostream& toDomain
);
//- Send subset of fields
template<class GeoField>
@ -264,7 +264,7 @@ class fvMeshDistribute
const label domain,
const wordList& fieldNames,
const fvMeshSubset&,
UOPstream& toNbr
Ostream& toNbr
);
//- Receive mesh. Opposite of sendMesh
@ -279,7 +279,7 @@ class fvMeshDistribute
labelList& domainSourceProc,
labelList& domainSourcePatch,
labelList& domainSourceNewProc,
UIPstream& fromNbr
Istream& fromNbr
);
//- Receive fields. Opposite of sendFields

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) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -216,7 +216,7 @@ void Foam::fvMeshDistribute::sendFields
const label domain,
const wordList& fieldNames,
const fvMeshSubset& subsetter,
UOPstream& toNbr
Ostream& toNbr
)
{
toNbr << GeoField::typeName << token::NL << token::BEGIN_BLOCK << token::NL;

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) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -475,7 +475,7 @@ Foam::scalarField Foam::edgeCollapser::calcTargetFaceSizes() const
{
scalarField targetFaceSizes(mesh_.nFaces(), -1);
const scalarField& cellVolumes = mesh_.cellVolumes();
const scalarField& V = mesh_.cellVolumes();
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
const labelList& cellOwner = mesh_.faceOwner();
@ -486,8 +486,8 @@ Foam::scalarField Foam::edgeCollapser::calcTargetFaceSizes() const
// Calculate face size from cell volumes for internal faces
for (label intFaceI = 0; intFaceI < mesh_.nInternalFaces(); ++intFaceI)
{
const scalar cellOwnerVol = cellVolumes[cellOwner[intFaceI]];
const scalar cellNeighbourVol = cellVolumes[cellNeighbour[intFaceI]];
const scalar cellOwnerVol = max(0.0, V[cellOwner[intFaceI]]);
const scalar cellNeighbourVol = max(0.0, V[cellNeighbour[intFaceI]]);
scalar targetFaceSizeA = Foam::pow(cellOwnerVol, 1.0/3.0);
scalar targetFaceSizeB = Foam::pow(cellNeighbourVol, 1.0/3.0);
@ -512,7 +512,7 @@ Foam::scalarField Foam::edgeCollapser::calcTargetFaceSizes() const
forAll(faceCells, facei)
{
neiCellVolumes[bFaceI++] = cellVolumes[faceCells[facei]];
neiCellVolumes[bFaceI++] = max(0.0, V[faceCells[facei]]);
}
}
else
@ -522,7 +522,7 @@ Foam::scalarField Foam::edgeCollapser::calcTargetFaceSizes() const
forAll(patch, patchFaceI)
{
const label extFaceI = patchFaceI + patch.start();
const scalar cellOwnerVol = cellVolumes[cellOwner[extFaceI]];
const scalar cellOwnerVol = max(0.0, V[cellOwner[extFaceI]]);
targetFaceSizes[extFaceI] = Foam::pow(cellOwnerVol, 1.0/3.0);
}
@ -542,7 +542,7 @@ Foam::scalarField Foam::edgeCollapser::calcTargetFaceSizes() const
forAll(patch, patchFaceI)
{
const label localFaceI = patchFaceI + patch.start();
const scalar cellOwnerVol = cellVolumes[cellOwner[localFaceI]];
const scalar cellOwnerVol = max(0.0, V[cellOwner[localFaceI]]);
const scalar cellNeighbourVol = neiCellVolumes[bFaceI++];
scalar targetFaceSizeA = Foam::pow(cellOwnerVol, 1.0/3.0);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -102,9 +102,10 @@ Foam::porosityModels::DarcyForchheimer::DarcyForchheimer
D_[zoneI][i].yy() = d.value().y();
D_[zoneI][i].zz() = d.value().z();
F_[zoneI][i].xx() = f.value().x();
F_[zoneI][i].yy() = f.value().y();
F_[zoneI][i].zz() = f.value().z();
// leading 0.5 is from 1/2*rho
F_[zoneI][i].xx() = 0.5*f.value().x();
F_[zoneI][i].yy() = 0.5*f.value().y();
F_[zoneI][i].zz() = 0.5*f.value().z();
}
D_[zoneI] = coordSys_.R().transformTensor(D_[zoneI], cells);

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-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -55,7 +55,7 @@ Ostream& operator<<(Ostream& os, const porosityModelList& models);
class porosityModelList
:
PtrList<porosityModel>
public PtrList<porosityModel>
{
private:

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-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -78,7 +78,6 @@ SourceFiles
#define uniformTotalPressureFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
#include "interpolationTable.H"
#include "DataEntry.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,8 +25,8 @@ License
#include "MGridGenGAMGAgglomeration.H"
#include "fvMesh.H"
#include "processorPolyPatch.H"
#include "addToRunTimeSelectionTable.H"
#include "processorLduInterface.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -43,6 +43,121 @@ namespace Foam
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::MGridGenGAMGAgglomeration::swap
(
const lduInterfacePtrsList& interfaces,
const labelUList& cellValues,
PtrList<labelList>& nbrValues
) const
{
// Initialise transfer of restrict addressing on the interface
forAll(interfaces, inti)
{
if (interfaces.set(inti))
{
interfaces[inti].initInternalFieldTransfer
(
Pstream::nonBlocking,
cellValues
);
}
}
if (Pstream::parRun())
{
Pstream::waitRequests();
}
// Get the interface agglomeration
nbrValues.setSize(interfaces.size());
forAll(interfaces, inti)
{
if (interfaces.set(inti))
{
nbrValues.set
(
inti,
new labelList
(
interfaces[inti].internalFieldTransfer
(
Pstream::nonBlocking,
cellValues
)
)
);
}
}
}
void Foam::MGridGenGAMGAgglomeration::getNbrAgglom
(
const lduAddressing& addr,
const lduInterfacePtrsList& interfaces,
const PtrList<labelList>& nbrGlobalAgglom,
labelList& cellToNbrAgglom
) const
{
cellToNbrAgglom.setSize(addr.size());
cellToNbrAgglom = -1;
forAll(interfaces, inti)
{
if (interfaces.set(inti))
{
if (isA<processorLduInterface>(interfaces[inti]))
{
const processorLduInterface& pldui =
refCast<const processorLduInterface>(interfaces[inti]);
if (pldui.myProcNo() > pldui.neighbProcNo())
{
const labelUList& faceCells =
interfaces[inti].faceCells();
const labelList& nbrData = nbrGlobalAgglom[inti];
forAll(faceCells, i)
{
cellToNbrAgglom[faceCells[i]] = nbrData[i];
}
}
}
}
}
}
void Foam::MGridGenGAMGAgglomeration::detectSharedFaces
(
const lduMesh& mesh,
const labelList& value,
labelHashSet& sharedFaces
) const
{
const lduAddressing& addr = mesh.lduAddr();
const labelUList& lower = addr.lowerAddr();
const labelUList& upper = addr.upperAddr();
sharedFaces.clear();
sharedFaces.resize(addr.lowerAddr().size()/100);
// Detect any faces inbetween same value
forAll(lower, faceI)
{
label lowerData = value[lower[faceI]];
label upperData = value[upper[faceI]];
if (lowerData != -1 && lowerData == upperData)
{
sharedFaces.insert(faceI);
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::MGridGenGAMGAgglomeration::MGridGenGAMGAgglomeration
@ -58,6 +173,13 @@ Foam::MGridGenGAMGAgglomeration::MGridGenGAMGAgglomeration
label minSize(readLabel(controlDict.lookup("minSize")));
label maxSize(readLabel(controlDict.lookup("maxSize")));
// Number of iterations applied to improve agglomeration consistency across
// processor boundaries
label nProcConsistencyIter
(
readLabel(controlDict.lookup("nProcConsistencyIter"))
);
// Start geometric agglomeration from the cell volumes and areas of the mesh
scalarField* VPtr = const_cast<scalarField*>(&fvMesh_.cellVolumes());
@ -87,28 +209,6 @@ Foam::MGridGenGAMGAgglomeration::MGridGenGAMGAgglomeration
}
}
/*
{
scalarField& magSb = *magSbPtr;
const polyBoundaryMesh& patches = fvMesh_.boundaryMesh();
forAll(patches, patchi)
{
const polyPatch& pp = patches[patchi];
if (!(Pstream::parRun() && isA<processorPolyPatch>(pp)))
{
const labelUList& faceCells = pp.faceCells();
const vectorField& pSf = pp.faceAreas();
forAll(faceCells, pfi)
{
magSb[faceCells[pfi]] += mag(pSf[pfi]);
}
}
}
}
*/
// Agglomerate until the required number of cells in the coarsest level
// is reached
@ -129,6 +229,63 @@ Foam::MGridGenGAMGAgglomeration::MGridGenGAMGAgglomeration
*magSbPtr
);
// Adjust weights only
for (int i=0; i<nProcConsistencyIter; i++)
{
const lduMesh& mesh = meshLevel(nCreatedLevels);
const lduAddressing& addr = mesh.lduAddr();
const lduInterfacePtrsList interfaces = mesh.interfaces();
const labelField& agglom = finalAgglomPtr();
// Global nubmering
const globalIndex globalNumbering(nCoarseCells);
labelField globalAgglom(addr.size());
forAll(agglom, cellI)
{
globalAgglom[cellI] = globalNumbering.toGlobal(agglom[cellI]);
}
// Get the interface agglomeration
PtrList<labelList> nbrGlobalAgglom;
swap(interfaces, globalAgglom, nbrGlobalAgglom);
// Get the interface agglomeration on a cell basis (-1 for all
// other cells)
labelList cellToNbrAgglom;
getNbrAgglom(addr, interfaces, nbrGlobalAgglom, cellToNbrAgglom);
// Mark all faces inbetween cells with same nbragglomeration
labelHashSet sharedFaces(addr.size()/100);
detectSharedFaces(mesh, cellToNbrAgglom, sharedFaces);
//- Note: in-place update of weights is more effective it seems?
// Should not be. fluke?
//scalarField weights(*faceWeightsPtr);
scalarField weights = *magSfPtr;
forAllConstIter(labelHashSet, sharedFaces, iter)
{
label faceI= iter.key();
weights[faceI] *= 2.0;
}
// Redo the agglomeration using the new weights
finalAgglomPtr = agglomerate
(
nCoarseCells,
minSize,
maxSize,
meshLevel(nCreatedLevels).lduAddr(),
*VPtr,
weights,
*magSbPtr
);
}
if (continueAgglomerating(nCoarseCells))
{
nCells_[nCreatedLevels] = nCoarseCells;

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) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -67,6 +67,29 @@ class MGridGenGAMGAgglomeration
// Private Member Functions
void swap
(
const lduInterfacePtrsList& interfaces,
const labelUList& cellValues,
PtrList<labelList>& nbrValues
) const;
void getNbrAgglom
(
const lduAddressing& addr,
const lduInterfacePtrsList& interfaces,
const PtrList<labelList>& nbrGlobalAgglom,
labelList& cellToNbrAgglom
) const;
void detectSharedFaces
(
const lduMesh& mesh,
const labelList& value,
labelHashSet& sharedFaces
) const;
//- Construct the CSR format addressing
void makeCompactCellFaceAddressingAndFaceWeights
(

View File

@ -65,14 +65,14 @@ void Foam::fv::CodedSource<Type>::prepare
dynCode.setMakeOptions
(
"EXE_INC = -g \\\n"
"-I$(LIB_SRC)/fieldSources/lnInclude \\\n"
"-I$(LIB_SRC)/fvOptions/lnInclude \\\n"
"-I$(LIB_SRC)/finiteVolume/lnInclude \\\n"
"-I$(LIB_SRC)/meshTools/lnInclude \\\n"
"-I$(LIB_SRC)/sampling/lnInclude \\\n"
+ context.options()
+ "\n\nLIB_LIBS = \\\n"
+ " -lmeshTools \\\n"
+ " -lfieldSources \\\n"
+ " -lfvOptions \\\n"
+ " -lsampling \\\n"
+ " -lfiniteVolume \\\n"
+ context.libs()

View File

@ -25,44 +25,85 @@ Class
Foam::fv::codedSource
Description
Constructs on-the-fly source
Constructs on-the-fly fvOption source
The hook functions take the following arguments:
codeCorrect
(
GeometricField<Type, fvPatchField, volMesh>& fld
)
codeAddSup
(
fvMatrix<Type}>& eqn,
const label fieldI
)
setValue
(
fvMatrix<Type}>& eqn,
const label fieldI
)
where :
fld is the field in fieldNames
eqn is the fvMatrix
\heading Source usage
Example usage:
Example usage in controlDict:
\verbatim
vectorCodedSourceCoeffs
energySource
{
fieldNames (U);
redirectType ramp;
type scalarCodedSource;
codeCorrect
#{
Pout<< "**codeCorrect**" << endl;
#};
active true;
selectionMode all;
codeAddSup
#{
Pout<< "**codeAddSup**" << endl;
#};
scalarCodedSourceCoeffs
{
fieldNames (h);
redirectType sourceTime;
codeSetValue
#{
Pout<< "**codeSetValue**" << endl;
#};
codeInclude
#{
// Dummy entry. Make dependent on above to trigger recompilation
code
#{
$codeCorrect
$codeAddSup
$codeSetValue
#};
#};
codeCorrect
#{
Pout<< "**codeCorrect**" << endl;
#};
codeAddSup
#{
const Time& time = mesh().time();
const scalarField& V = mesh_.V();
scalarField& heSource = eqn.source();
heSource -= 0.1*sqr(time.value())*V;
#};
codeSetValue
#{
Pout<< "**codeSetValue**" << endl;
#};
// Dummy entry. Make dependent on above to trigger recompilation
code
#{
$codeInclude
$codeCorrect
$codeAddSup
$codeSetValue
#};
}
sourceTimeCoeffs
{
// Dummy entry
}
}
// Dummy entry
rampCoeffs
{}
\endverbatim

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) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -173,7 +173,7 @@ void Foam::refinementFeatures::read
labelListList(0), // edgeNormals
labelListList(0), // featurePointNormals
labelListList(0), // featurePointEdges
labelList(0) // regionEdges
identity(newEdges.size()) // regionEdges
);
@ -313,6 +313,58 @@ void Foam::refinementFeatures::buildTrees(const label featI)
}
const Foam::PtrList<Foam::indexedOctree<Foam::treeDataEdge> >&
Foam::refinementFeatures::regionEdgeTrees() const
{
if (!regionEdgeTreesPtr_.valid())
{
regionEdgeTreesPtr_.reset
(
new PtrList<indexedOctree<treeDataEdge> >(size())
);
PtrList<indexedOctree<treeDataEdge> >& trees = regionEdgeTreesPtr_();
forAll(*this, featI)
{
const extendedEdgeMesh& eMesh = operator[](featI);
const pointField& points = eMesh.points();
const edgeList& edges = eMesh.edges();
// Calculate bb of all points
treeBoundBox bb(points);
// 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);
trees.set
(
featI,
new indexedOctree<treeDataEdge>
(
treeDataEdge
(
false, // do not cache bb
edges,
points,
eMesh.regionEdges()
),
bb, // overall search domain
8, // maxLevel
10, // leafsize
3.0 // duplicity
)
);
}
}
return regionEdgeTreesPtr_();
}
// Find maximum level of a shell.
void Foam::refinementFeatures::findHigherLevel
@ -543,6 +595,68 @@ void Foam::refinementFeatures::findNearestEdge
}
void Foam::refinementFeatures::findNearestRegionEdge
(
const pointField& samples,
const scalarField& nearestDistSqr,
labelList& nearFeature,
List<pointIndexHit>& nearInfo,
vectorField& nearNormal
) const
{
nearFeature.setSize(samples.size());
nearFeature = -1;
nearInfo.setSize(samples.size());
nearInfo = pointIndexHit();
nearNormal.setSize(samples.size());
nearNormal = vector::zero;
const PtrList<indexedOctree<treeDataEdge> >& regionTrees =
regionEdgeTrees();
forAll(regionTrees, featI)
{
const indexedOctree<treeDataEdge>& regionTree = regionTrees[featI];
forAll(samples, sampleI)
{
const point& sample = samples[sampleI];
scalar distSqr;
if (nearInfo[sampleI].hit())
{
distSqr = magSqr(nearInfo[sampleI].hitPoint()-sample);
}
else
{
distSqr = nearestDistSqr[sampleI];
}
// Find anything closer than current best
pointIndexHit info = regionTree.findNearest(sample, distSqr);
if (info.hit())
{
const treeDataEdge& td = regionTree.shapes();
nearFeature[sampleI] = featI;
nearInfo[sampleI] = pointIndexHit
(
info.hit(),
info.hitPoint(),
regionTree.shapes().edgeLabels()[info.index()]
);
const edge& e = td.edges()[nearInfo[sampleI].index()];
nearNormal[sampleI] = e.vec(td.points());
nearNormal[sampleI] /= mag(nearNormal[sampleI])+VSMALL;
}
}
}
}
//void Foam::refinementFeatures::findNearestPoint
//(
// const pointField& samples,

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) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -69,6 +69,10 @@ private:
//- Features points
PtrList<indexedOctree<treeDataPoint> > pointTrees_;
//- Region edge trees (demand driven)
mutable autoPtr<PtrList<indexedOctree<treeDataEdge> > >
regionEdgeTreesPtr_;
// Private Member Functions
@ -100,6 +104,8 @@ protected:
}
const PtrList<indexedOctree<treeDataEdge> >& regionEdgeTrees() const;
public:
// Constructors
@ -149,6 +155,21 @@ public:
vectorField& nearNormal
) const;
//- Find nearest point on nearest region edge. Sets
// - nearFeature: index of feature mesh
// - nearInfo : location on feature edge and edge index
// (note: not feature edge index but index into
// edges() directly)
// - nearNormal : local feature edge normal
void findNearestRegionEdge
(
const pointField& samples,
const scalarField& nearestDistSqr,
labelList& nearFeature,
List<pointIndexHit>& nearInfo,
vectorField& nearNormal
) const;
//- Find nearest feature point. Sets
// - nearFeature: index of feature mesh
// - nearInfo : location on feature point and point index.

View File

@ -55,7 +55,7 @@ Description
In between ratio 0 and 1 the gradient and value contributions are
weighted using the ratio field in the followig way:
qConv = ratio*htcwfilm*(Tfilm - *this)*convectiveScaling_;
qConv = ratio*htcwfilm*(Tfilm - *this);
qRad = (1.0 - ratio)*Qr;
Then the solid can gain or loose energy through radiation or conduction

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) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -39,112 +39,114 @@ Description
- 2-D, normal and tangential components
The thermodynamic properties of the baffle material are specified via
dictionary entries.
dictionary entries on the master patch
\heading Patch usage
Example of the boundary condition specification:
\verbatim
myPatch
myPatch_master
{
type compressible::temperatureThermoBaffle;
type compressible::thermalBaffle;
// Underlaying coupled boundary condition
Tnbr T;
kappa fluidThermo; // or solidThermo
KappaName none;
QrNbr Qr;//or none.Name of Qr field on neighbourregion
Qr none;// or none.Name of Qr field on localregion
value uniform 300;
Tnbr T;
kappa fluidThermo; // or solidThermo
KappaName none;
QrNbr Qr;//or none.Name of Qr field on neighbourregion
Qr none;// or none.Name of Qr field on localregion
value uniform 300;
// Thermo baffle model
regionName baffleRegion; // solid region name
infoOutput yes;
active yes;
// Baffle region name
regionName baffleRegion;
active yes;
// Solid thermo in solid region
thermoType
{
type heSolidThermo;
mixture pureSolidMixture;
transport constIso;
thermo hConst;
equationOfState rhoConst;
specie specie;
energy sensibleEnthalpy;
}
thermoType
{
type heSolidThermo;
mixture pureMixture;
transport constIso;
thermo hConst;
equationOfState rhoConst;
specie specie;
energy sensibleEnthalpy;
}
mixture
mixture
{
specie
{
specie
{
nMoles 1;
molWeight 20;
}
transport
{
kappa 0.01;
}
thermodynamics
{
Hf 0;
Cp 15;
}
density
{
rho 80;
}
nMoles 1;
molWeight 20;
}
transport
{
kappa 0.01;
}
thermodynamics
{
Hf 0;
Cp 15;
}
density
{
rho 80;
}
}
radiation
{
radiationModel opaqueSolid;
absorptionEmissionModel none;
scatterModel none;
}
radiation
{
radiationModel opaqueSolid;
absorptionEmissionModel none;
scatterModel none;
}
// Extrude model for new region
extrudeModel linearNormal;
nLayers 50;
expansionRatio 1;
columnCells false; //3D or 1D
linearNormalCoeffs
{
thickness 0.02;
}
extrudeModel linearNormal;
nLayers 50;
expansionRatio 1;
columnCells false; //3D or 1D
linearNormalCoeffs
{
thickness 0.02;
}
// New mesh polyPatch information
bottomCoeffs
{
name "bottom";
type mappedWall;
sampleMode nearestPatchFace;
samplePatch baffle3DWall_master;
offsetMode uniform;
offset (0 0 0);
}
topCoeffs
{
name "top";
type mappedWall;
sampleMode nearestPatchFace;
samplePatch baffle3DWall_slave;
offsetMode uniform;
offset (0 0 0);
}
sideCoeffs
{
name "side";
type patch;
}
}
\endverbatim
/- Slave patch on primary region
\verbatim
myPatch_slave
{
type compressible::thermalBaffle;
kappa fluidThermo;
kappaName none;
value uniform 300;
\endverbatim
/- Patches on baffle region
\verbatim
bottom
{
type compressible::thermalBaffle;
kappa solidThermo;
kappaName none;
value uniform 300;
}
top
{
type compressible::thermalBaffle;
kappa solidThermo;
kappaName none;
value uniform 300;
}
\endverbatim
SeeAlso
Foam::turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
Foam::regionModels::thermalBaffleModels::thermalBaffleModel

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) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -26,6 +26,7 @@ License
#include "radiationModel.H"
#include "absorptionEmissionModel.H"
#include "scatterModel.H"
#include "sootModel.H"
#include "fvmSup.H"
#include "fluidThermo.H"
@ -83,6 +84,8 @@ void Foam::radiation::radiationModel::initialise()
);
scatter_.reset(scatterModel::New(*this, mesh_).ptr());
soot_.reset(sootModel::New(*this, mesh_).ptr());
}
}
@ -110,7 +113,8 @@ Foam::radiation::radiationModel::radiationModel(const volScalarField& T)
solverFreq_(0),
firstIter_(true),
absorptionEmission_(NULL),
scatter_(NULL)
scatter_(NULL),
soot_(NULL)
{}
@ -129,7 +133,8 @@ Foam::radiation::radiationModel::radiationModel
solverFreq_(1),
firstIter_(true),
absorptionEmission_(NULL),
scatter_(NULL)
scatter_(NULL),
soot_(NULL)
{
if (readOpt() == IOobject::NO_READ)
{
@ -167,7 +172,8 @@ Foam::radiation::radiationModel::radiationModel
solverFreq_(1),
firstIter_(true),
absorptionEmission_(NULL),
scatter_(NULL)
scatter_(NULL),
soot_(NULL)
{
initialise();
}
@ -212,6 +218,11 @@ void Foam::radiation::radiationModel::correct()
calculate();
firstIter_ = false;
}
if (!soot_.empty())
{
soot_->correct();
}
}
@ -265,4 +276,22 @@ Foam::radiation::radiationModel::absorptionEmission() const
}
const Foam::radiation::sootModel&
Foam::radiation::radiationModel::soot() const
{
if (!soot_.valid())
{
FatalErrorIn
(
"const Foam::radiation::sootModel&"
"Foam::radiation::radiationModel::soot() const"
)
<< "Requested radiation sootModel model, but model is "
<< "not activate" << abort(FatalError);
}
return soot_();
}
// ************************************************************************* //

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) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -64,6 +64,7 @@ namespace radiation
// Forward declaration of classes
class absorptionEmissionModel;
class scatterModel;
class sootModel;
/*---------------------------------------------------------------------------*\
Class radiationModel Declaration
@ -108,6 +109,9 @@ protected:
//- Scatter model
autoPtr<scatterModel> scatter_;
//- Soot model
autoPtr<sootModel> soot_;
private:
@ -232,6 +236,9 @@ public:
//- Access to absorptionEmission model
const absorptionEmissionModel& absorptionEmission() const;
//- Access to soot Model
const sootModel& soot() const;
};

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) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

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) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -47,7 +47,10 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
:
mixedFvPatchScalarField(p, iF),
temperatureCoupledBase(patch(), "undefined", "undefined-K"),
TnbrName_("undefined-Tnbr")
TnbrName_("undefined-Tnbr"),
thicknessLayers_(0),
kappaLayers_(0),
contactRes_(0)
{
this->refValue() = 0.0;
this->refGrad() = 0.0;
@ -66,7 +69,10 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
:
mixedFvPatchScalarField(ptf, p, iF, mapper),
temperatureCoupledBase(patch(), ptf.KMethod(), ptf.kappaName()),
TnbrName_(ptf.TnbrName_)
TnbrName_(ptf.TnbrName_),
thicknessLayers_(ptf.thicknessLayers_),
kappaLayers_(ptf.kappaLayers_),
contactRes_(ptf.contactRes_)
{}
@ -80,7 +86,10 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
:
mixedFvPatchScalarField(p, iF),
temperatureCoupledBase(patch(), dict),
TnbrName_(dict.lookup("Tnbr"))
TnbrName_(dict.lookup("Tnbr")),
thicknessLayers_(0),
kappaLayers_(0),
contactRes_(0.0)
{
if (!isA<mappedPatchBase>(this->patch().patch()))
{
@ -101,6 +110,24 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
<< exit(FatalError);
}
if (dict.found("thicknessLayers"))
{
dict.lookup("thicknessLayers") >> thicknessLayers_;
dict.lookup("kappaLayers") >> kappaLayers_;
if (thicknessLayers_.size() > 0)
{
forAll (thicknessLayers_, iLayer)
{
const scalar l = thicknessLayers_[iLayer];
if (l > 0.0)
{
contactRes_ += kappaLayers_[iLayer]/l;
}
}
}
}
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
if (dict.found("refValue"))
@ -129,7 +156,10 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
:
mixedFvPatchScalarField(wtcsf, iF),
temperatureCoupledBase(patch(), wtcsf.KMethod(), wtcsf.kappaName()),
TnbrName_(wtcsf.TnbrName_)
TnbrName_(wtcsf.TnbrName_),
thicknessLayers_(wtcsf.thicknessLayers_),
kappaLayers_(wtcsf.kappaLayers_),
contactRes_(wtcsf.contactRes_)
{}
@ -155,7 +185,7 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs()
const fvPatch& nbrPatch =
refCast<const fvMesh>(nbrMesh).boundary()[samplePatchI];
tmp<scalarField> intFld = patchInternalField();
//tmp<scalarField> intFld = patchInternalField();
// Calculate the temperature by harmonic averaging
@ -174,12 +204,22 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs()
);
// Swap to obtain full local values of neighbour internal field
scalarField nbrIntFld(nbrField.patchInternalField());
mpp.distribute(nbrIntFld);
tmp<scalarField> nbrIntFld(new scalarField(nbrField.size(), 0.0));
tmp<scalarField> nbrKDelta(new scalarField(nbrField.size(), 0.0));
// Swap to obtain full local values of neighbour kappa*delta
scalarField nbrKDelta(nbrField.kappa(nbrField)*nbrPatch.deltaCoeffs());
mpp.distribute(nbrKDelta);
if (contactRes_ == 0.0)
{
nbrIntFld() = nbrField.patchInternalField();
nbrKDelta() = nbrField.kappa(nbrField)*nbrPatch.deltaCoeffs();
}
else
{
nbrIntFld() = nbrField;
nbrKDelta() = contactRes_;
}
mpp.distribute(nbrIntFld());
mpp.distribute(nbrKDelta());
tmp<scalarField> myKDelta = kappa(*this)*patch().deltaCoeffs();
@ -200,11 +240,11 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs()
// - mixFraction = nbrKDelta / (nbrKDelta + myKDelta())
this->refValue() = nbrIntFld;
this->refValue() = nbrIntFld();
this->refGrad() = 0.0;
this->valueFraction() = nbrKDelta/(nbrKDelta + myKDelta());
this->valueFraction() = nbrKDelta()/(nbrKDelta() + myKDelta());
mixedFvPatchScalarField::updateCoeffs();
@ -239,6 +279,9 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::write
mixedFvPatchScalarField::write(os);
os.writeKeyword("Tnbr")<< TnbrName_
<< token::END_STATEMENT << nl;
thicknessLayers_.writeEntry("thicknessLayers", os);
thicknessLayers_.writeEntry("kappaLayers", os);
temperatureCoupledBase::write(os);
}

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) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,11 +22,20 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::compressible::turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
Foam::
compressible::
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
Description
Mixed boundary condition for temperature, to be used for heat-transfer
on back-to-back baffles.
on back-to-back baffles.Optional thin thermal layer
resistances can be specified through thicknessLayers and kappaLayers
entries.
The thermal conductivity, \c kappa, can either be retrieved from the
mesh database using the \c lookup option, or from a \c solidThermo
or \c fluidThermo thermophysical package.
Specifies gradient and temperature such that the equations are the same
on both sides:
@ -36,29 +45,41 @@ Description
where KDelta is heat-transfer coefficient K * deltaCoeffs
Example usage:
myInterfacePatchName
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
Tnbr T;
kappa lookup;
kappaName kappa;
value uniform 300;
}
\heading Patch usage
\table
Property | Description | Required | Default value
kappa | thermal conductivity option | yes |
kappaName | name of thermal conductivity field | no |
Tnbr | name of the field | no | T
thicknessLayers | list of thicknesses per layer [m] | no |
kappaLayers | list of thermal conductivites per layer [W/m/K] | no |
\endtable
Example of the boundary condition specification:
\verbatim
myPatch
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
Tnbr T;
kappa lookup;
KappaName kappa;
thicknessLayers (0.1 0.2 0.3 0.4);
kappaLayers (1 2 3 4)
value uniform 300;
}
Needs to be on underlying mapped(Wall)FvPatch.
Note: kappa : heat conduction at patch. Gets supplied how to lookup
calculate kappa:
- 'lookup' : lookup volScalarField (or volSymmTensorField) with name
- 'fluidThermo' : use fluidThermo and compressible::RASmodel to calculate
kappa
- 'solidThermo' : use solidThermo kappa()
- 'directionalSolidThermo' directionalKappa()
Note: runs in parallel with arbitrary decomposition. Uses mapped
functionality to calculate exchange.
SourceFiles
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C
@ -69,6 +90,7 @@ SourceFiles
#include "mixedFvPatchFields.H"
#include "temperatureCoupledBase.H"
#include "scalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -91,6 +113,15 @@ class turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
//- Name of field on the neighbour region
const word TnbrName_;
//- Thickness of layers
scalarList thicknessLayers_;
//- Conductivity of layers
scalarList kappaLayers_;
//- Total contact resistance
scalar contactRes_;
public:

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) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -49,7 +49,10 @@ turbulentTemperatureRadCoupledMixedFvPatchScalarField
temperatureCoupledBase(patch(), "undefined", "undefined-K"),
TnbrName_("undefined-Tnbr"),
QrNbrName_("undefined-QrNbr"),
QrName_("undefined-Qr")
QrName_("undefined-Qr"),
thicknessLayers_(0),
kappaLayers_(0),
contactRes_(0)
{
this->refValue() = 0.0;
this->refGrad() = 0.0;
@ -70,7 +73,10 @@ turbulentTemperatureRadCoupledMixedFvPatchScalarField
temperatureCoupledBase(patch(), psf.KMethod(), psf.kappaName()),
TnbrName_(psf.TnbrName_),
QrNbrName_(psf.QrNbrName_),
QrName_(psf.QrName_)
QrName_(psf.QrName_),
thicknessLayers_(psf.thicknessLayers_),
kappaLayers_(psf.kappaLayers_),
contactRes_(psf.contactRes_)
{}
@ -86,7 +92,10 @@ turbulentTemperatureRadCoupledMixedFvPatchScalarField
temperatureCoupledBase(patch(), dict),
TnbrName_(dict.lookupOrDefault<word>("Tnbr", "T")),
QrNbrName_(dict.lookupOrDefault<word>("QrNbr", "none")),
QrName_(dict.lookupOrDefault<word>("Qr", "none"))
QrName_(dict.lookupOrDefault<word>("Qr", "none")),
thicknessLayers_(0),
kappaLayers_(0),
contactRes_(0.0)
{
if (!isA<mappedPatchBase>(this->patch().patch()))
{
@ -107,6 +116,24 @@ turbulentTemperatureRadCoupledMixedFvPatchScalarField
<< exit(FatalError);
}
if (dict.found("thicknessLayers"))
{
dict.lookup("thicknessLayers") >> thicknessLayers_;
dict.lookup("kappaLayers") >> kappaLayers_;
if (thicknessLayers_.size() > 0)
{
forAll (thicknessLayers_, iLayer)
{
const scalar l = thicknessLayers_[iLayer];
if (l > 0.0)
{
contactRes_ += kappaLayers_[iLayer]/l;
}
}
}
}
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
if (dict.found("refValue"))
@ -137,7 +164,10 @@ turbulentTemperatureRadCoupledMixedFvPatchScalarField
temperatureCoupledBase(patch(), psf.KMethod(), psf.kappaName()),
TnbrName_(psf.TnbrName_),
QrNbrName_(psf.QrNbrName_),
QrName_(psf.QrName_)
QrName_(psf.QrName_),
thicknessLayers_(psf.thicknessLayers_),
kappaLayers_(psf.kappaLayers_),
contactRes_(psf.contactRes_)
{}
@ -180,9 +210,17 @@ void turbulentTemperatureRadCoupledMixedFvPatchScalarField::updateCoeffs()
// Swap to obtain full local values of neighbour K*delta
scalarField KDeltaNbr(nbrField.kappa(nbrField)*nbrPatch.deltaCoeffs());
mpp.distribute(KDeltaNbr);
tmp<scalarField> KDeltaNbr(new scalarField(TcNbr.size(), 0.0));
if (contactRes_ == 0.0)
{
// Swap to obtain full local values of neighbour K*delta
KDeltaNbr() = nbrField.kappa(nbrField)*nbrPatch.deltaCoeffs();
}
else
{
KDeltaNbr() = contactRes_;
}
mpp.distribute(KDeltaNbr());
scalarField KDelta(kappa(*this)*patch().deltaCoeffs());
@ -199,16 +237,34 @@ void turbulentTemperatureRadCoupledMixedFvPatchScalarField::updateCoeffs()
mpp.distribute(QrNbr);
}
scalarField alpha(KDeltaNbr - (Qr + QrNbr)/Tp);
scalarField alpha(KDeltaNbr() - (Qr + QrNbr)/Tp);
valueFraction() = alpha/(alpha + KDelta);
refValue() = (KDeltaNbr*TcNbr)/alpha;
refValue() = (KDeltaNbr()*TcNbr)/alpha;
mixedFvPatchScalarField::updateCoeffs();
if (debug)
{
scalar Q = gSum(kappa(*this)*patch().magSf()*snGrad());
Info<< patch().boundaryMesh().mesh().name() << ':'
<< patch().name() << ':'
<< this->dimensionedInternalField().name() << " <- "
<< nbrMesh.name() << ':'
<< nbrPatch.name() << ':'
<< this->dimensionedInternalField().name() << " :"
<< " heat transfer rate:" << Q
<< " walltemperature "
<< " min:" << gMin(*this)
<< " max:" << gMax(*this)
<< " avg:" << gAverage(*this)
<< endl;
}
// Restore tag
UPstream::msgType() = oldTag;
mixedFvPatchScalarField::updateCoeffs();
}
@ -221,6 +277,10 @@ void turbulentTemperatureRadCoupledMixedFvPatchScalarField::write
os.writeKeyword("Tnbr")<< TnbrName_ << token::END_STATEMENT << nl;
os.writeKeyword("QrNbr")<< QrNbrName_ << token::END_STATEMENT << nl;
os.writeKeyword("Qr")<< QrName_ << token::END_STATEMENT << nl;
os.writeKeyword("Qr")<< QrName_ << token::END_STATEMENT << nl;
thicknessLayers_.writeEntry("thicknessLayers", os);
thicknessLayers_.writeEntry("kappaLayers", os);
temperatureCoupledBase::write(os);
}

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) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -28,23 +28,45 @@ Class
Description
Mixed boundary condition for temperature and radiation heat transfer
to be used for in multiregion cases
to be used for in multiregion cases. Optional thin thermal layer
resistances can be specified through thicknessLayers and kappaLayers
entries.
Example usage:
myInterfacePatchName
{
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T; // name of T field on neighbour region
kappa lookup;
KappaName kappa;
QrNbr Qr; // or none. Name of Qr field on neighbour region
Qr Qr; // or none. Name of Qr field on local region
value uniform 300;
}
The thermal conductivity, \c kappa, can either be retrieved from the
mesh database using the \c lookup option, or from a \c solidThermo
or \c fluidThermo thermophysical package.
\heading Patch usage
\table
Property | Description | Required | Default value
kappa | thermal conductivity option | yes |
kappaName | name of thermal conductivity field | no |
Tnbr | name of the field | no | T
QrNbr | name of the radiative flux in the nbr region | no | none
Qr | name of the radiative flux in this region | no | none
thicknessLayers | list of thicknesses per layer [m] | no |
kappaLayers | list of thermal conductivites per layer [W/m/K] | no |
\endtable
Example of the boundary condition specification:
\verbatim
myPatch
{
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappa lookup;
KappaName kappa;
QrNbr Qr; // or none. Name of Qr field on neighbour region
Qr Qr; // or none. Name of Qr field on local region
thicknessLayers (0.1 0.2 0.3 0.4);
kappaLayers (1 2 3 4)
value uniform 300;
}
Needs to be on underlying mapped(Wall)FvPatch.
Note: kappa : heat conduction at patch. Gets supplied how to
Note: kappa : heat conduction at patch. Gets supplied how to
lookup/calculate
kappa:
- 'lookup' : lookup volScalarField (or volSymmTensorField) with name
@ -52,9 +74,6 @@ Description
- 'solidThermo' : use solidThermo kappa()
- 'directionalSolidThermo' directionalKappa()
Note: runs in parallel with arbitrary decomposition. Uses mapped
functionality to calculate exchange.
SourceFiles
turbulentTemperatureRadCoupledMixedFvPatchScalarField.C
@ -65,6 +84,7 @@ SourceFiles
#include "mixedFvPatchFields.H"
#include "temperatureCoupledBase.H"
#include "scalarList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -93,6 +113,15 @@ class turbulentTemperatureRadCoupledMixedFvPatchScalarField
//- Name of the radiative heat flux in local region
const word QrName_;
//- Thickness of layers
scalarList thicknessLayers_;
//- Conductivity of layers
scalarList kappaLayers_;
//- Total contact resistance
scalar contactRes_;
public: