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

This commit is contained in:
andy
2011-12-08 12:30:02 +00:00
42 changed files with 788 additions and 438 deletions

View File

@ -1,105 +0,0 @@
surfaceScalarField alphaPhi1("alphaPhi1", phi1);
surfaceScalarField alphaPhi2("alphaPhi2", phi2);
{
word scheme("div(phi,alpha1)");
word schemer("div(phir,alpha1)");
surfaceScalarField phic("phic", phi);
surfaceScalarField phir("phir", phi1 - phi2);
if (g0.value() > 0.0)
{
surfaceScalarField alpha1f = fvc::interpolate(alpha1);
surfaceScalarField phipp = ppMagf*fvc::snGrad(alpha1)*mesh.magSf();
phir += phipp;
phic += fvc::interpolate(alpha1)*phipp;
}
for (int acorr=0; acorr<nAlphaCorr; acorr++)
{
volScalarField::DimensionedInternalField Sp
(
IOobject
(
"Sp",
runTime.timeName(),
mesh
),
mesh,
dimensionedScalar("Sp", dgdt.dimensions(), 0.0)
);
volScalarField::DimensionedInternalField Su
(
IOobject
(
"Su",
runTime.timeName(),
mesh
),
// Divergence term is handled explicitly to be
// consistent with the explicit transport solution
fvc::div(phi)*min(alpha1, scalar(1))
);
forAll(dgdt, celli)
{
if (dgdt[celli] > 0.0 && alpha1[celli] > 0.0)
{
Sp[celli] -= dgdt[celli]*alpha1[celli];
Su[celli] += dgdt[celli]*alpha1[celli];
}
else if (dgdt[celli] < 0.0 && alpha1[celli] < 1.0)
{
Sp[celli] += dgdt[celli]*(1.0 - alpha1[celli]);
}
}
fvScalarMatrix alpha1Eqn
(
fvm::ddt(alpha1)
+ fvm::div(phic, alpha1, scheme)
+ fvm::div(-fvc::flux(-phir, alpha2, schemer), alpha1, schemer)
==
fvm::Sp(Sp, alpha1) + Su
);
if (g0.value() > 0.0)
{
ppMagf = rU1Af*fvc::interpolate
(
(1.0/(rho1*(alpha1 + scalar(0.0001))))
*g0*min(exp(preAlphaExp*(alpha1 - alphaMax)), expMax)
);
alpha1Eqn -= fvm::laplacian
(
(fvc::interpolate(alpha1) + scalar(0.0001))*ppMagf,
alpha1,
"laplacian(alphaPpMag,alpha1)"
);
}
alpha1Eqn.relax();
alpha1Eqn.solve();
//***HGW temporary boundedness-fix pending the introduction of MULES
alpha1 = max(min(alpha1, 1.0), 0.0);
#include "packingLimiter.H"
alphaPhi1 = alpha1Eqn.flux();
alphaPhi2 = phi - alphaPhi1;
alpha2 = scalar(1) - alpha1;
Info<< "Dispersed phase volume fraction = "
<< alpha1.weightedAverage(mesh.V()).value()
<< " Min(alpha1) = " << min(alpha1).value()
<< " Max(alpha1) = " << max(alpha1).value()
<< endl;
}
}
rho = alpha1*rho1 + alpha2*rho2;

View File

@ -46,11 +46,17 @@ Foam::dragModel::dragModel
interfaceDict_(interfaceDict),
phase1_(phase1),
phase2_(phase2),
residualDrag_
residualPhaseFraction_
(
"residualDrag",
dimensionSet(1, -3, -1, 0, 0),
interfaceDict.lookup("residualDrag")
"residualPhaseFraction",
dimless,
interfaceDict.lookup("residualPhaseFraction")
),
residualSlip_
(
"residualSlip",
dimVelocity,
interfaceDict.lookup("residualSlip")
)
{}

View File

@ -57,7 +57,8 @@ protected:
const dictionary& interfaceDict_;
const phaseModel& phase1_;
const phaseModel& phase2_;
dimensionedScalar residualDrag_;
dimensionedScalar residualPhaseFraction_;
dimensionedScalar residualSlip_;
public:
@ -117,9 +118,14 @@ public:
return phase2_;
}
const dimensionedScalar& residualDrag() const
const dimensionedScalar& residualPhaseFraction() const
{
return residualDrag_;
return residualPhaseFraction_;
}
const dimensionedScalar& residualSlip() const
{
return residualSlip_;
}
//- the dragfunction K used in the momentum eq.

View File

@ -30,6 +30,7 @@ License
#include "MULES.H"
#include "fvcSnGrad.H"
#include "fvcFlux.H"
#include "fvcAverage.H"
// * * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * //
@ -626,9 +627,20 @@ Foam::multiphaseSystem::dragCoeffs() const
(
iter.key(),
(
dm.phase1()*dm.phase2()
*dm.K(mag(dm.phase1().U() - dm.phase2().U()))
+ dm.residualDrag()
max
(
fvc::average(dm.phase1())*fvc::average(dm.phase2()),
//dm.phase1()*dm.phase2(),
dm.residualPhaseFraction()
)
*dm.K
(
max
(
mag(dm.phase1().U() - dm.phase2().U()),
dm.residualSlip()
)
)
).ptr()
);
}

View File

@ -146,6 +146,9 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
decompositionMethod& decomposer = decomposerPtr_();
volScalarField::InternalField& icellWeights = cellWeights.internalField();
// For each cell in the mesh has it been determined if it is fully
// inside, outside, or overlaps the surface
labelList volumeStatus
@ -214,10 +217,10 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
volumeStatus[cellI] = searchableSurface::UNKNOWN;
}
cellWeights.internalField()[cellI] = max
icellWeights[cellI] = max
(
1.0,
cellWeights.internalField()[cellI]/8.0
icellWeights[cellI]/8.0
);
}
@ -405,7 +408,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
(
mesh_,
mesh_.cellCentres(),
cellWeights
icellWeights
);
fvMeshDistribute distributor(mesh_, mergeDist_);
@ -629,6 +632,8 @@ Foam::labelList Foam::backgroundMeshDecomposition::selectRefinementCells
volScalarField& cellWeights
) const
{
volScalarField::InternalField& icellWeights = cellWeights.internalField();
labelHashSet cellsToRefine;
// Determine/update the status of each cell
@ -650,7 +655,7 @@ Foam::labelList Foam::backgroundMeshDecomposition::selectRefinementCells
(
cellI,
volumeStatus[cellI],
cellWeights.internalField()[cellI]
icellWeights[cellI]
)
)
{
@ -871,15 +876,17 @@ Foam::backgroundMeshDecomposition::distribute
mesh_.write();
}
volScalarField::InternalField& icellWeights = cellWeights.internalField();
while (true)
{
// Refine large cells if necessary
label nOccupiedCells = 0;
forAll(cellWeights.internalField(), cI)
forAll(icellWeights, cI)
{
if (cellWeights.internalField()[cI] > 1 - SMALL)
if (icellWeights[cI] > 1 - SMALL)
{
nOccupiedCells++;
}
@ -910,9 +917,9 @@ Foam::backgroundMeshDecomposition::distribute
labelHashSet cellsToRefine;
forAll(cellWeights, cWI)
forAll(icellWeights, cWI)
{
if (cellWeights.internalField()[cWI] > cellWeightLimit)
if (icellWeights[cWI] > cellWeightLimit)
{
cellsToRefine.insert(cWI);
}
@ -943,7 +950,7 @@ Foam::backgroundMeshDecomposition::distribute
{
label cellI = newCellsToRefine[nCTRI];
cellWeights.internalField()[cellI] /= 8.0;
icellWeights[cellI] /= 8.0;
}
// Mesh changing engine.
@ -1075,9 +1082,9 @@ Foam::backgroundMeshDecomposition::distribute
printMeshData(mesh_);
Pout<< " Pre distribute sum(cellWeights) "
<< sum(cellWeights.internalField())
<< sum(icellWeights)
<< " max(cellWeights) "
<< max(cellWeights.internalField())
<< max(icellWeights)
<< endl;
}
@ -1085,7 +1092,7 @@ Foam::backgroundMeshDecomposition::distribute
(
mesh_,
mesh_.cellCentres(),
cellWeights
icellWeights
);
Info<< " Redistributing background mesh cells" << endl;
@ -1101,9 +1108,9 @@ Foam::backgroundMeshDecomposition::distribute
printMeshData(mesh_);
Pout<< " Post distribute sum(cellWeights) "
<< sum(cellWeights.internalField())
<< sum(icellWeights)
<< " max(cellWeights) "
<< max(cellWeights.internalField())
<< max(icellWeights)
<< endl;
// const_cast<Time&>(mesh_.time())++;

View File

@ -87,8 +87,6 @@ void Foam::vtkPV3Foam::reduceMemory()
}
int Foam::vtkPV3Foam::setTime(int nRequest, const double requestTimes[])
{
Time& runTime = dbPtr_();
@ -214,6 +212,7 @@ void Foam::vtkPV3Foam::updateMeshPartsStatus()
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::vtkPV3Foam::vtkPV3Foam
@ -378,7 +377,7 @@ void Foam::vtkPV3Foam::updateInfo()
// Update mesh parts list - add Lagrangian at the bottom
updateInfoInternalMesh(partSelection);
updateInfoPatches(partSelection);
updateInfoPatches(partSelection, enabledEntries);
updateInfoSets(partSelection);
updateInfoZones(partSelection);
updateInfoLagrangian(partSelection);

View File

@ -347,7 +347,7 @@ class vtkPV3Foam
void updateInfoLagrangian(vtkDataArraySelection*);
//- Patch info
void updateInfoPatches(vtkDataArraySelection*);
void updateInfoPatches(vtkDataArraySelection*, stringList&);
//- Set info
void updateInfoSets(vtkDataArraySelection*);
@ -554,18 +554,6 @@ class vtkPV3Foam
const labelList& faceLabels
);
//- face set/zone field
template<class Type>
void convertFaceField
(
const GeometricField<Type, fvPatchField, volMesh>&,
vtkMultiBlockDataSet* output,
const arrayRange&,
const label datasetNo,
const fvMesh&,
const faceSet&
);
//- Lagrangian fields - all types
template<class Type>
void convertLagrangianFields

View File

@ -110,79 +110,6 @@ void Foam::vtkPV3Foam::convertFaceField
}
template<class Type>
void Foam::vtkPV3Foam::convertFaceField
(
const GeometricField<Type, fvPatchField, volMesh>& tf,
vtkMultiBlockDataSet* output,
const arrayRange& range,
const label datasetNo,
const fvMesh& mesh,
const faceSet& fSet
)
{
const label nComp = pTraits<Type>::nComponents;
const label nInternalFaces = mesh.nInternalFaces();
const labelList& faceOwner = mesh.faceOwner();
const labelList& faceNeigh = mesh.faceNeighbour();
vtkFloatArray* cellData = vtkFloatArray::New();
cellData->SetNumberOfTuples(fSet.size());
cellData->SetNumberOfComponents(nComp);
cellData->Allocate(nComp*fSet.size());
cellData->SetName(tf.name().c_str());
if (debug)
{
Info<< "convert convertFaceField: "
<< tf.name()
<< " size = " << tf.size()
<< " nComp=" << nComp
<< " nTuples = " << fSet.size() << endl;
}
float vec[nComp];
// for interior faces: average owner/neighbour
// for boundary faces: owner
label faceI = 0;
forAllConstIter(faceSet, fSet, iter)
{
const label faceNo = iter.key();
if (faceNo < nInternalFaces)
{
Type t = 0.5*(tf[faceOwner[faceNo]] + tf[faceNeigh[faceNo]]);
for (direction d=0; d<nComp; ++d)
{
vec[d] = component(t, d);
}
}
else
{
const Type& t = tf[faceOwner[faceNo]];
for (direction d=0; d<nComp; ++d)
{
vec[d] = component(t, d);
}
}
vtkOpenFOAMTupleRemap<Type>(vec);
cellData->InsertTuple(faceI, vec);
++faceI;
}
vtkPolyData::SafeDownCast
(
GetDataSetFromBlock(output, range, datasetNo)
) ->GetCellData()
->AddArray(cellData);
cellData->Delete();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif

View File

@ -221,7 +221,8 @@ void Foam::vtkPV3Foam::updateInfoLagrangian
void Foam::vtkPV3Foam::updateInfoPatches
(
vtkDataArraySelection* arraySelection
vtkDataArraySelection* arraySelection,
stringList& enabledEntries
)
{
if (debug)
@ -230,12 +231,63 @@ void Foam::vtkPV3Foam::updateInfoPatches
<< " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]" << endl;
}
HashSet<string> enabledEntriesSet(enabledEntries);
arrayRangePatches_.reset(arraySelection->GetNumberOfArrays());
int nPatches = 0;
if (meshPtr_)
{
const polyBoundaryMesh& patches = meshPtr_->boundaryMesh();
const HashTable<labelList, word>& groups = patches.groupPatchIDs();
const wordList allPatchNames = patches.names();
// Add patch groups
// ~~~~~~~~~~~~~~~~
for
(
HashTable<labelList, word>::const_iterator iter = groups.begin();
iter != groups.end();
++iter
)
{
const word& groupName = iter.key();
const labelList& patchIDs = iter();
label nFaces = 0;
forAll(patchIDs, i)
{
nFaces += patches[patchIDs[i]].size();
}
// Valid patch if nFace > 0 - add patch to GUI list
if (nFaces)
{
string vtkGrpName = groupName + " - group";
arraySelection->AddArray(vtkGrpName.c_str());
++nPatches;
if (enabledEntriesSet.found(vtkGrpName))
{
forAll(patchIDs, i)
{
const polyPatch& pp = patches[patchIDs[i]];
string vtkPatchName = pp.name() + " - patch";
enabledEntriesSet.insert(vtkPatchName);
}
enabledEntriesSet.erase(vtkGrpName);
}
}
}
// Add patches
// ~~~~~~~~~~~
forAll(patches, patchI)
{
const polyPatch& pp = patches[patchI];
@ -277,20 +329,101 @@ void Foam::vtkPV3Foam::updateInfoPatches
{
polyBoundaryMeshEntries patchEntries(ioObj);
// Add (non-zero) patches to the list of mesh parts
forAll(patchEntries, entryI)
// Read patches and determine sizes
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
wordList names(patchEntries.size());
labelList sizes(patchEntries.size());
forAll(patchEntries, patchI)
{
label nFaces
(
readLabel(patchEntries[entryI].dict().lookup("nFaces"))
);
const dictionary& patchDict = patchEntries[patchI].dict();
sizes[patchI] = readLabel(patchDict.lookup("nFaces"));
names[patchI] = patchEntries[patchI].keyword();
}
// Add (non-zero) patch groups to the list of mesh parts
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HashTable<labelList, word> groups(patchEntries.size());
forAll(patchEntries, patchI)
{
const dictionary& patchDict = patchEntries[patchI].dict();
wordList groupNames;
patchDict.readIfPresent("inGroups", groupNames);
forAll(groupNames, groupI)
{
HashTable<labelList, word>::iterator iter = groups.find
(
groupNames[groupI]
);
if (iter != groups.end())
{
iter().append(patchI);
}
else
{
groups.insert(groupNames[groupI], labelList(1, patchI));
}
}
}
for
(
HashTable<labelList, word>::const_iterator iter =
groups.begin();
iter != groups.end();
++iter
)
{
const word& groupName = iter.key();
const labelList& patchIDs = iter();
label nFaces = 0;
forAll(patchIDs, i)
{
nFaces += sizes[patchIDs[i]];
}
// Valid patch if nFace > 0 - add patch to GUI list
if (nFaces)
{
string vtkGrpName = groupName + " - group";
arraySelection->AddArray(vtkGrpName.c_str());
++nPatches;
if (enabledEntriesSet.found(vtkGrpName))
{
forAll(patchIDs, i)
{
string vtkPatchName =
names[patchIDs[i]] + " - patch";
enabledEntriesSet.insert(vtkPatchName);
}
enabledEntriesSet.erase(vtkGrpName);
}
}
}
// Add (non-zero) patches to the list of mesh parts
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
forAll(names, patchI)
{
// Valid patch if nFace > 0 - add patch to GUI list
if (sizes[patchI])
{
arraySelection->AddArray
(
(patchEntries[entryI].keyword() + " - patch").c_str()
(names[patchI] + " - patch").c_str()
);
++nPatches;
@ -300,6 +433,9 @@ void Foam::vtkPV3Foam::updateInfoPatches
}
arrayRangePatches_ += nPatches;
// Update enabled entries in case of group selection
enabledEntries = enabledEntriesSet.toc();
if (debug)
{
// just for debug info

View File

@ -271,7 +271,7 @@ void Foam::vtkPV3Foam::convertVolFields
arrayRangeFaceSets_,
datasetNo,
mesh,
fSet
fSet.toc()
);
// TODO: points

View File

@ -120,11 +120,17 @@ do
-archOption | --archOption)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
archOption="$2"
# replace WM_ARCH_OPTION=...
_inlineSed \
etc/bashrc \
'/^[^#]/s@WM_ARCH_OPTION=.*@WM_ARCH_OPTION='"$archOption@" \
"Replacing WM_ARCH_OPTION setting by '$archOption'"
current_archOption=`grep WM_ARCH_OPTION= etc/bashrc | sed "s/export WM_ARCH_OPTION=//"`
if [ "$archOption" != "$current_archOption" ]
then
# replace WM_ARCH_OPTION=...
_inlineSed \
etc/bashrc \
'/^[^#]/s@WM_ARCH_OPTION=.*@WM_ARCH_OPTION='"$archOption@" \
"Replacing WM_ARCH_OPTION setting by '$archOption'"
else
echo "WM_ARCH_OPTION already set to $archOption"
fi
shift 2
;;
-paraviewInstall | --paraviewInstall)

View File

@ -248,15 +248,81 @@ GeometricBoundaryField
<< endl;
}
// Patch or patch-groups. (using non-wild card entries of dictionaries)
forAllConstIter(dictionary, dict, iter)
{
if (iter().isDict())
{
const labelList patchIDs = bmesh_.findIndices
(
iter().keyword(),
true
);
forAll(patchIDs, i)
{
label patchi = patchIDs[i];
this->set
(
patchi,
PatchField<Type>::New
(
bmesh_[patchi],
field,
iter().dict()
)
);
}
}
}
// Check for wildcard patch overrides
forAll(bmesh_, patchi)
{
if (bmesh_[patchi].type() != emptyPolyPatch::typeName)
if (!this->set(patchi))
{
if
(
bmesh_[patchi].type() == cyclicPolyPatch::typeName
&& !dict.found(bmesh_[patchi].name())
)
if (bmesh_[patchi].type() == emptyPolyPatch::typeName)
{
this->set
(
patchi,
PatchField<Type>::New
(
emptyPolyPatch::typeName,
bmesh_[patchi],
field
)
);
}
else
{
bool found = dict.found(bmesh_[patchi].name());
if (found)
{
this->set
(
patchi,
PatchField<Type>::New
(
bmesh_[patchi],
field,
dict.subDict(bmesh_[patchi].name())
)
);
}
}
}
}
// Check for any unset patches
forAll(bmesh_, patchi)
{
if (!this->set(patchi))
{
if (bmesh_[patchi].type() == cyclicPolyPatch::typeName)
{
FatalIOErrorIn
(
@ -274,30 +340,21 @@ GeometricBoundaryField
<< "Run foamUpgradeCyclics to convert mesh and fields"
<< " to split cyclics." << exit(FatalIOError);
}
this->set
(
patchi,
PatchField<Type>::New
else
{
FatalIOErrorIn
(
bmesh_[patchi],
field,
dict.subDict(bmesh_[patchi].name())
)
);
}
else
{
this->set
(
patchi,
PatchField<Type>::New
(
emptyPolyPatch::typeName,
bmesh_[patchi],
field
)
);
"GeometricField<Type, PatchField, GeoMesh>::\n"
"GeometricBoundaryField::GeometricBoundaryField\n"
"(\n"
" const BoundaryMesh&,\n"
" const DimensionedField<Type, GeoMesh>&,\n"
" const dictionary&\n"
")",
dict
) << "Cannot find patchField entry for "
<< bmesh_[patchi].name() << exit(FatalIOError);
}
}
}
}

View File

@ -131,17 +131,16 @@ void MapGeometricFields
);
// Map the patch fields
forAll(field.boundaryField(), patchi)
typename GeometricField<Type, PatchField, GeoMesh>
::GeometricBoundaryField& bfield = field.boundaryField();
forAll(bfield, patchi)
{
// Cannot check sizes for patch fields because of
// empty fields in FV and because point fields get their size
// from the patch which has already been resized
//
field.boundaryField()[patchi].autoMap
(
mapper.boundaryMap()[patchi]
);
bfield[patchi].autoMap(mapper.boundaryMap()[patchi]);
}
field.instance() = field.time().timeName();

View File

@ -32,12 +32,14 @@ Foam::patchIdentifier::patchIdentifier
(
const word& name,
const label index,
const word& physicalType
const word& physicalType,
const wordList& inGroups
)
:
name_(name),
index_(index),
physicalType_(physicalType)
physicalType_(physicalType),
inGroups_(inGroups)
{}
@ -52,6 +54,7 @@ Foam::patchIdentifier::patchIdentifier
index_(index)
{
dict.readIfPresent("physicalType", physicalType_);
dict.readIfPresent("inGroups", inGroups_);
}
@ -63,7 +66,8 @@ Foam::patchIdentifier::patchIdentifier
:
name_(p.name_),
index_(index),
physicalType_(p.physicalType_)
physicalType_(p.physicalType_),
inGroups_(p.inGroups_)
{}
@ -82,6 +86,11 @@ void Foam::patchIdentifier::write(Ostream& os) const
os.writeKeyword("physicalType") << physicalType_
<< token::END_STATEMENT << nl;
}
if (inGroups_.size())
{
os.writeKeyword("inGroups") << inGroups_
<< token::END_STATEMENT << nl;
}
}

View File

@ -35,7 +35,7 @@ SourceFiles
#ifndef patchIdentifier_H
#define patchIdentifier_H
#include "word.H"
#include "wordList.H"
#include "label.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -68,6 +68,8 @@ class patchIdentifier
//- Optional physical type
mutable word physicalType_;
//- Optional groups patch belongs to
wordList inGroups_;
public:
@ -78,7 +80,8 @@ public:
(
const word& name,
const label index,
const word& physicalType = word::null
const word& physicalType = word::null,
const wordList& inGroups = wordList()
);
//- Construct from dictionary
@ -139,6 +142,19 @@ public:
return index_;
}
//- Return the optional groups patch belongs to
const wordList& inGroups() const
{
return inGroups_;
}
//- Return the optional groups patch belongs to for modification
wordList& inGroups()
{
return inGroups_;
}
//- Write patchIdentifier as a dictionary
void write(Ostream&) const;

View File

@ -58,6 +58,16 @@ Foam::pointBoundaryMesh::pointBoundaryMesh
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::labelList Foam::pointBoundaryMesh::findIndices
(
const keyType& key,
const bool usePatchGroups
) const
{
return mesh()().boundaryMesh().findIndices(key, usePatchGroups);
}
void Foam::pointBoundaryMesh::calcGeometry()
{
PstreamBuffers pBufs(Pstream::defaultCommsType);

View File

@ -96,6 +96,9 @@ public:
return mesh_;
}
//- Find patch indices given a name
labelList findIndices(const keyType&, const bool useGroups) const;
//- Correct polyBoundaryMesh after moving points
void movePoints(const pointField&);

View File

@ -151,6 +151,7 @@ void Foam::polyBoundaryMesh::clearAddressing()
{
neighbourEdgesPtr_.clear();
patchIDPtr_.clear();
groupPatchIDsPtr_.clear();
forAll(*this, patchI)
{
@ -369,6 +370,54 @@ const Foam::labelList& Foam::polyBoundaryMesh::patchID() const
}
const Foam::HashTable<Foam::labelList, Foam::word>&
Foam::polyBoundaryMesh::groupPatchIDs() const
{
if (!groupPatchIDsPtr_.valid())
{
groupPatchIDsPtr_.reset(new HashTable<labelList, word>(10));
HashTable<labelList, word>& groupPatchIDs = groupPatchIDsPtr_();
const polyBoundaryMesh& bm = *this;
forAll(bm, patchI)
{
const wordList& groups = bm[patchI].inGroups();
forAll(groups, i)
{
const word& name = groups[i];
if (findPatchID(name) != -1)
{
WarningIn("polyBoundaryMesh::groupPatchIDs() const")
<< "Patch " << bm[patchI].name()
<< " specifies a group " << name
<< " which is also a patch name."
<< " This might give problems later on." << endl;
}
HashTable<labelList, word>::iterator iter = groupPatchIDs.find
(
name
);
if (iter != groupPatchIDs.end())
{
iter().append(patchI);
}
else
{
groupPatchIDs.insert(name, labelList(1, patchI));
}
}
}
}
return groupPatchIDsPtr_();
}
Foam::wordList Foam::polyBoundaryMesh::names() const
{
const polyPatchList& patches = *this;
@ -414,28 +463,74 @@ Foam::wordList Foam::polyBoundaryMesh::physicalTypes() const
}
Foam::labelList Foam::polyBoundaryMesh::findIndices(const keyType& key) const
Foam::labelList Foam::polyBoundaryMesh::findIndices
(
const keyType& key,
const bool usePatchGroups
) const
{
labelList indices;
DynamicList<label> indices;
if (!key.empty())
{
if (key.isPattern())
{
indices = findStrings(key, this->names());
if (usePatchGroups && groupPatchIDs().size())
{
labelHashSet indexSet(indices);
const wordList allGroupNames = groupPatchIDs().toc();
labelList groupIDs = findStrings(key, allGroupNames);
forAll(groupIDs, i)
{
const word& grpName = allGroupNames[groupIDs[i]];
const labelList& patchIDs = groupPatchIDs()[grpName];
forAll(patchIDs, j)
{
if (indexSet.insert(patchIDs[j]))
{
indices.append(patchIDs[j]);
}
}
}
}
}
else
{
indices.setSize(this->size());
label nFound = 0;
// Literal string. Special version of above to avoid
// unnecessary memory allocations
indices.setCapacity(1);
forAll(*this, i)
{
if (key == operator[](i).name())
{
indices[nFound++] = i;
indices.append(i);
break;
}
}
if (usePatchGroups && groupPatchIDs().size())
{
const HashTable<labelList, word>::const_iterator iter =
groupPatchIDs().find(key);
if (iter != groupPatchIDs().end())
{
labelHashSet indexSet(indices);
const labelList& patchIDs = iter();
forAll(patchIDs, j)
{
if (indexSet.insert(patchIDs[j]))
{
indices.append(patchIDs[j]);
}
}
}
}
indices.setSize(nFound);
}
}
@ -552,7 +647,8 @@ Foam::label Foam::polyBoundaryMesh::whichPatch(const label faceIndex) const
Foam::labelHashSet Foam::polyBoundaryMesh::patchSet
(
const UList<wordRe>& patchNames,
const bool warnNotFound
const bool warnNotFound,
const bool usePatchGroups
) const
{
const wordList allPatchNames(this->names());
@ -560,24 +656,58 @@ Foam::labelHashSet Foam::polyBoundaryMesh::patchSet
forAll(patchNames, i)
{
const word& patchName = patchNames[i];
// Treat the given patch names as wild-cards and search the set
// of all patch names for matches
labelList patchIDs = findStrings(patchNames[i], allPatchNames);
if (patchIDs.empty() && warnNotFound)
{
WarningIn
(
"polyBoundaryMesh::patchSet"
"(const wordReList&, const bool) const"
) << "Cannot find any patch names matching " << patchNames[i]
<< endl;
}
labelList patchIDs = findStrings(patchName, allPatchNames);
forAll(patchIDs, j)
{
ids.insert(patchIDs[j]);
}
if (patchIDs.empty())
{
if (usePatchGroups)
{
const wordList allGroupNames = groupPatchIDs().toc();
// Regard as group name
labelList groupIDs = findStrings(patchName, allGroupNames);
forAll(groupIDs, i)
{
const word& name = allGroupNames[groupIDs[i]];
const labelList& extraPatchIDs = groupPatchIDs()[name];
forAll(extraPatchIDs, extraI)
{
ids.insert(extraPatchIDs[extraI]);
}
}
if (groupIDs.empty() && warnNotFound)
{
WarningIn
(
"polyBoundaryMesh::patchSet"
"(const wordReList&, const bool, const bool) const"
) << "Cannot find any patch or group names matching "
<< patchName
<< endl;
}
}
else if (warnNotFound)
{
WarningIn
(
"polyBoundaryMesh::patchSet"
"(const wordReList&, const bool, const bool) const"
) << "Cannot find any patch names matching " << patchName
<< endl;
}
}
}
return ids;
@ -778,6 +908,7 @@ void Foam::polyBoundaryMesh::updateMesh()
{
neighbourEdgesPtr_.clear();
patchIDPtr_.clear();
groupPatchIDsPtr_.clear();
PstreamBuffers pBufs(Pstream::defaultCommsType);

View File

@ -70,6 +70,8 @@ class polyBoundaryMesh
mutable autoPtr<labelList> patchIDPtr_;
mutable autoPtr<HashTable<labelList, word> > groupPatchIDsPtr_;
//- Edges of neighbouring patches
mutable autoPtr<List<labelPairList> > neighbourEdgesPtr_;
@ -153,8 +155,12 @@ public:
//- Return a list of physical types
wordList physicalTypes() const;
//- Return patch indices for all matches
labelList findIndices(const keyType&) const;
//- Return patch indices for all matches. Optionally matches patchGroups
labelList findIndices
(
const keyType&,
const bool usePatchGroups = false
) const;
//- Return patch index for the first match, return -1 if not found
label findIndex(const keyType&) const;
@ -168,12 +174,17 @@ public:
//- Per boundary face label the patch index
const labelList& patchID() const;
//- Per patch group the patch indices
const HashTable<labelList, word>& groupPatchIDs() const;
//- Return the set of patch IDs corresponding to the given names
// By default warns if given names are not found.
// By default warns if given names are not found. Optionally
// matches to patchGroups as well as patchNames
labelHashSet patchSet
(
const UList<wordRe>& patchNames,
const bool warnNotFound = true
const bool warnNotFound = true,
const bool usePatchGroups = false
) const;
//- Check whether all procs have all patches and in same order. Return

View File

@ -703,11 +703,11 @@ void Foam::polyMesh::resetPrimitives
{
boundary_[patchI] = polyPatch
(
boundary_[patchI].name(),
patchSizes[patchI],
patchStarts[patchI],
boundary_[patchI],
boundary_,
patchI,
boundary_
patchSizes[patchI],
patchStarts[patchI]
);
}

View File

@ -104,16 +104,20 @@ Foam::tmp<Foam::volScalarField> Foam::consumptionSpeed::omega0Sigma
volScalarField& omega0 = tomega0();
forAll(omega0, celli)
volScalarField::InternalField& iomega0 = omega0.internalField();
forAll(iomega0, celli)
{
omega0[celli] = omega0Sigma(sigma[celli], 1.0);
iomega0[celli] = omega0Sigma(sigma[celli], 1.0);
}
forAll(omega0.boundaryField(), patchi)
volScalarField::GeometricBoundaryField& bomega0 = omega0.boundaryField();
forAll(bomega0, patchi)
{
forAll(omega0.boundaryField()[patchi], facei)
forAll(bomega0[patchi], facei)
{
omega0.boundaryField()[patchi][facei] =
bomega0[patchi][facei] =
omega0Sigma
(
sigma.boundaryField()[patchi][facei],

View File

@ -360,9 +360,11 @@ Foam::dynamicRefineFvMesh::refine
}
// Recalculate new boundary faces.
forAll(phi.boundaryField(), patchI)
surfaceScalarField::GeometricBoundaryField& bphi =
phi.boundaryField();
forAll(bphi, patchI)
{
fvsPatchScalarField& patchPhi = phi.boundaryField()[patchI];
fvsPatchScalarField& patchPhi = bphi[patchI];
const fvsPatchScalarField& patchPhiU =
phiU.boundaryField()[patchI];
@ -404,8 +406,7 @@ Foam::dynamicRefineFvMesh::refine
const fvsPatchScalarField& patchPhiU =
phiU.boundaryField()[patchI];
fvsPatchScalarField& patchPhi =
phi.boundaryField()[patchI];
fvsPatchScalarField& patchPhi = bphi[patchI];
patchPhi[i] = patchPhiU[i];
}
@ -549,6 +550,9 @@ Foam::dynamicRefineFvMesh::unrefine
}
surfaceScalarField& phi = const_cast<surfaceScalarField&>(*iter());
surfaceScalarField::GeometricBoundaryField& bphi =
phi.boundaryField();
const surfaceScalarField phiU
(
fvc::interpolate
@ -582,10 +586,7 @@ Foam::dynamicRefineFvMesh::unrefine
const fvsPatchScalarField& patchPhiU =
phiU.boundaryField()[patchI];
fvsPatchScalarField& patchPhi =
phi.boundaryField()[patchI];
fvsPatchScalarField& patchPhi = bphi[patchI];
patchPhi[i] = patchPhiU[i];
}
}

View File

@ -81,6 +81,9 @@ void Foam::fvMeshAdder::MapVolField
// Patch fields from old mesh
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
typename GeometricField<Type, fvPatchField, volMesh>::
GeometricBoundaryField& bfld = fld.boundaryField();
{
const labelList& oldPatchMap = meshMap.oldPatchMap();
const labelList& oldPatchStarts = meshMap.oldPatchStarts();
@ -121,18 +124,18 @@ void Foam::fvMeshAdder::MapVolField
// Sort deleted ones last so is now in newPatch ordering
fld.boundaryField().reorder(oldToNew);
bfld.reorder(oldToNew);
// Extend to covers all patches
fld.boundaryField().setSize(mesh.boundaryMesh().size());
bfld.setSize(mesh.boundaryMesh().size());
// Delete unused patches
for
(
label newPatchI = nUsedPatches;
newPatchI < fld.boundaryField().size();
newPatchI < bfld.size();
newPatchI++
)
{
fld.boundaryField().set(newPatchI, NULL);
bfld.set(newPatchI, NULL);
}
@ -167,12 +170,12 @@ void Foam::fvMeshAdder::MapVolField
// value
// - hope that field mapping allows aliasing since old and new
// are same memory!
fld.boundaryField().set
bfld.set
(
newPatchI,
fvPatchField<Type>::New
(
fld.boundaryField()[newPatchI], // old field
bfld[newPatchI], // old field
mesh.boundary()[newPatchI], // new fvPatch
fld.dimensionedInternalField(), // new internal field
patchMapper // mapper (new to old)
@ -201,7 +204,7 @@ void Foam::fvMeshAdder::MapVolField
const polyPatch& oldPatch =
fldToAdd.mesh().boundaryMesh()[patchI];
if (!fld.boundaryField()(newPatchI))
if (!bfld(newPatchI))
{
// First occurrence of newPatchI. Map from existing
// patchField
@ -221,7 +224,7 @@ void Foam::fvMeshAdder::MapVolField
directFvPatchFieldMapper patchMapper(newToAdded);
fld.boundaryField().set
bfld.set
(
newPatchI,
fvPatchField<Type>::New
@ -255,7 +258,7 @@ void Foam::fvMeshAdder::MapVolField
const fvPatchField<Type>& addedFld =
fldToAdd.boundaryField()[patchI];
fvPatchField<Type>& newFld = fld.boundaryField()[newPatchI];
fvPatchField<Type>& newFld = bfld[newPatchI];
forAll(newFld, i)
{
@ -357,6 +360,9 @@ void Foam::fvMeshAdder::MapSurfaceField
const fvMesh& mesh = fld.mesh();
const labelList& oldPatchStarts = meshMap.oldPatchStarts();
typename GeometricField<Type, fvsPatchField, surfaceMesh>::
GeometricBoundaryField& bfld = fld.boundaryField();
// Internal field
// ~~~~~~~~~~~~~~
@ -375,9 +381,9 @@ void Foam::fvMeshAdder::MapSurfaceField
// Faces that were boundary faces but are not anymore.
// Use owner value (so lowest numbered cell, i.e. from 'old' not 'added'
// mesh)
forAll(fld.boundaryField(), patchI)
forAll(bfld, patchI)
{
const fvsPatchField<Type>& pf = fld.boundaryField()[patchI];
const fvsPatchField<Type>& pf = bfld[patchI];
label start = oldPatchStarts[patchI];
@ -436,18 +442,18 @@ void Foam::fvMeshAdder::MapSurfaceField
// Sort deleted ones last so is now in newPatch ordering
fld.boundaryField().reorder(oldToNew);
bfld.reorder(oldToNew);
// Extend to covers all patches
fld.boundaryField().setSize(mesh.boundaryMesh().size());
bfld.setSize(mesh.boundaryMesh().size());
// Delete unused patches
for
(
label newPatchI = nUsedPatches;
newPatchI < fld.boundaryField().size();
newPatchI < bfld.size();
newPatchI++
)
{
fld.boundaryField().set(newPatchI, NULL);
bfld.set(newPatchI, NULL);
}
@ -478,16 +484,16 @@ void Foam::fvMeshAdder::MapSurfaceField
// Create new patchField with same type as existing one.
// Note:
// - boundaryField already in new order so access with newPatchI
// - fld.boundaryField()[newPatchI] both used for type and old
// - bfld[newPatchI] both used for type and old
// value
// - hope that field mapping allows aliasing since old and new
// are same memory!
fld.boundaryField().set
bfld.set
(
newPatchI,
fvsPatchField<Type>::New
(
fld.boundaryField()[newPatchI], // old field
bfld[newPatchI], // old field
mesh.boundary()[newPatchI], // new fvPatch
fld.dimensionedInternalField(), // new internal field
patchMapper // mapper (new to old)
@ -516,7 +522,7 @@ void Foam::fvMeshAdder::MapSurfaceField
const polyPatch& oldPatch =
fldToAdd.mesh().boundaryMesh()[patchI];
if (!fld.boundaryField()(newPatchI))
if (!bfld(newPatchI))
{
// First occurrence of newPatchI. Map from existing
// patchField
@ -536,7 +542,7 @@ void Foam::fvMeshAdder::MapSurfaceField
directFvPatchFieldMapper patchMapper(newToAdded);
fld.boundaryField().set
bfld.set
(
newPatchI,
fvsPatchField<Type>::New
@ -570,8 +576,7 @@ void Foam::fvMeshAdder::MapSurfaceField
const fvsPatchField<Type>& addedFld =
fldToAdd.boundaryField()[patchI];
fvsPatchField<Type>& newFld =
fld.boundaryField()[newPatchI];
fvsPatchField<Type>& newFld = bfld[newPatchI];
forAll(newFld, i)
{

View File

@ -47,10 +47,12 @@ bool Foam::adjustPhi
scalar fixedMassOut = 0.0;
scalar adjustableMassOut = 0.0;
forAll(phi.boundaryField(), patchi)
surfaceScalarField::GeometricBoundaryField& bphi = phi.boundaryField();
forAll(bphi, patchi)
{
const fvPatchVectorField& Up = U.boundaryField()[patchi];
const fvsPatchScalarField& phip = phi.boundaryField()[patchi];
const fvsPatchScalarField& phip = bphi[patchi];
if (!isA<processorFvsPatchScalarField>(phip))
{
@ -123,10 +125,10 @@ bool Foam::adjustPhi
<< exit(FatalError);
}
forAll(phi.boundaryField(), patchi)
forAll(bphi, patchi)
{
const fvPatchVectorField& Up = U.boundaryField()[patchi];
fvsPatchScalarField& phip = phi.boundaryField()[patchi];
fvsPatchScalarField& phip = bphi[patchi];
if (!isA<processorFvsPatchScalarField>(phip))
{

View File

@ -75,7 +75,10 @@ tmp<volScalarField> CoEulerDdtScheme<Type>::CorDeltaT() const
max(corDeltaT[neighbour[faceI]], cofrDeltaT[faceI]);
}
forAll(corDeltaT.boundaryField(), patchi)
volScalarField::GeometricBoundaryField& bcorDeltaT =
corDeltaT.boundaryField();
forAll(bcorDeltaT, patchi)
{
const fvsPatchScalarField& pcofrDeltaT =
cofrDeltaT.boundaryField()[patchi];

View File

@ -73,9 +73,12 @@ average
surfaceSum(mesh.magSf()*ssf)/surfaceSum(mesh.magSf())
)().internalField();
forAll(av.boundaryField(), patchi)
typename GeometricField<Type, fvPatchField, volMesh>::
GeometricBoundaryField& bav = av.boundaryField();
forAll(bav, patchi)
{
av.boundaryField()[patchi] = ssf.boundaryField()[patchi];
bav[patchi] = ssf.boundaryField()[patchi];
}
av.correctBoundaryConditions();

View File

@ -130,9 +130,11 @@ void Foam::extendedLeastSquaresVectors::makeLeastSquaresVectors() const
// Visit the boundaries. Coupled boundaries are taken into account
// in the construction of d vectors.
forAll(lsP.boundaryField(), patchi)
surfaceVectorField::GeometricBoundaryField& blsP = lsP.boundaryField();
forAll(blsP, patchi)
{
const fvPatch& p = lsP.boundaryField()[patchi].patch();
const fvPatch& p = blsP[patchi].patch();
const labelUList& faceCells = p.faceCells();
// Build the d-vectors
@ -242,9 +244,9 @@ void Foam::extendedLeastSquaresVectors::makeLeastSquaresVectors() const
((-1.0)/magSqr(d[facei]))*(invDd[neighbour[facei]] & d);
}
forAll(lsP.boundaryField(), patchI)
forAll(blsP, patchI)
{
fvsPatchVectorField& patchLsP = lsP.boundaryField()[patchI];
fvsPatchVectorField& patchLsP = blsP[patchI];
const fvPatch& p = patchLsP.patch();
const labelUList& faceCells = p.faceCells();

View File

@ -121,7 +121,9 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const
}
forAll(lsP.boundaryField(), patchi)
surfaceVectorField::GeometricBoundaryField& blsP = lsP.boundaryField();
forAll(blsP, patchi)
{
const fvsPatchScalarField& pw = w.boundaryField()[patchi];
const fvsPatchScalarField& pMagSf = magSf.boundaryField()[patchi];
@ -172,9 +174,9 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const
lsN[facei] = -w[facei]*magSfByMagSqrd*(invDd[nei] & d);
}
forAll(lsP.boundaryField(), patchi)
forAll(blsP, patchi)
{
fvsPatchVectorField& patchLsP = lsP.boundaryField()[patchi];
fvsPatchVectorField& patchLsP = blsP[patchi];
const fvsPatchScalarField& pw = w.boundaryField()[patchi];
const fvsPatchScalarField& pMagSf = magSf.boundaryField()[patchi];

View File

@ -125,13 +125,6 @@ void Foam::MULES::limitSum(UPtrList<scalarField>& phiPsiCorrs)
}
}
}
else
{
for (int phasei=0; phasei<phiPsiCorrs.size(); phasei++)
{
phiPsiCorrs[phasei][facei] = 0;
}
}
}
}

View File

@ -668,9 +668,12 @@ void Foam::MULES::limitSum(SurfaceScalarFieldList& phiPsiCorrs)
limitSum(phiPsiCorrsInternal);
}
forAll(phiPsiCorrs[0].boundaryField(), patchi)
surfaceScalarField::GeometricBoundaryField& bfld =
phiPsiCorrs[0].boundaryField();
forAll(bfld, patchi)
{
if (phiPsiCorrs[0].boundaryField()[patchi].coupled())
if (bfld[patchi].coupled())
{
UPtrList<scalarField> phiPsiCorrsPatch(phiPsiCorrs.size());
forAll(phiPsiCorrs, phasei)

View File

@ -23,8 +23,8 @@ License
\*---------------------------------------------------------------------------*/
#include "fvMesh.H"
#include "fvBoundaryMesh.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -87,6 +87,16 @@ Foam::label Foam::fvBoundaryMesh::findPatchID(const word& patchName) const
}
Foam::labelList Foam::fvBoundaryMesh::findIndices
(
const keyType& key,
const bool usePatchGroups
) const
{
return mesh().boundaryMesh().findIndices(key, usePatchGroups);
}
void Foam::fvBoundaryMesh::movePoints()
{
forAll(*this, patchI)

View File

@ -109,6 +109,9 @@ public:
//- Find patch index given a name
label findPatchID(const word& patchName) const;
//- Find patch indices given a name
labelList findIndices(const keyType&, const bool useGroups) const;
//- Correct patches after moving points
void movePoints();

View File

@ -76,18 +76,18 @@ if (runTime.outputTime())
}
}
forAll(totalVelocity.internalField(), tV)
volVectorField::InternalField& itotalVelocity =
totalVelocity.internalField();
forAll(itotalVelocity, tV)
{
if (totalMass_sum[tV] > VSMALL)
{
totalVelocity.internalField()[tV] =
totalMomentum_sum[tV]
/totalMass_sum[tV];
itotalVelocity[tV] = totalMomentum_sum[tV]/totalMass_sum[tV];
}
else
{
totalVelocity.internalField()[tV] =
vector::zero;
itotalVelocity[tV] = vector::zero;
}
}
@ -150,17 +150,20 @@ if (runTime.outputTime())
}
}
forAll(totalTemperature.internalField(), tT)
volScalarField::InternalField& itotalTemperature =
totalTemperature.internalField();
forAll(itotalTemperature, tT)
{
if (totalN_sum[tT] > 0)
{
totalTemperature.internalField()[tT] =
itotalTemperature[tT] =
totalTemperatureVTerms_sum[tT]
/(3.0 * moleculeCloud::kb * totalN_sum[tT]);
}
else
{
totalTemperature.internalField()[tT] = 0.0;
itotalTemperature[tT] = 0.0;
}
}
@ -206,17 +209,19 @@ if (runTime.outputTime())
}
}
forAll(totalMeanKE.internalField(), tMKE)
volScalarField::InternalField& itotalMeanKE = totalMeanKE.internalField();
forAll(itotalMeanKE, tMKE)
{
if (totalN_sum[tMKE] > 0)
{
totalMeanKE.internalField()[tMKE] =
itotalMeanKE[tMKE] =
totalKE_sum[tMKE]
/totalN_sum[tMKE];
}
else
{
totalMeanKE.internalField()[tMKE] = 0.0;
itotalMeanKE[tMKE] = 0.0;
}
}
}

View File

@ -76,18 +76,18 @@ if (runTime.outputTime())
}
}
forAll(totalVelocity.internalField(), tV)
volVectorField::InternalField& itotalVelocity =
totalVelocity.internalField();
forAll(itotalVelocity, tV)
{
if (totalMass_sum[tV] > VSMALL)
{
totalVelocity.internalField()[tV] =
totalMomentum_sum[tV]
/totalMass_sum[tV];
itotalVelocity[tV] = totalMomentum_sum[tV]/totalMass_sum[tV];
}
else
{
totalVelocity.internalField()[tV] =
vector::zero;
itotalVelocity[tV] = vector::zero;
}
}
@ -150,17 +150,20 @@ if (runTime.outputTime())
}
}
forAll(totalTemperature.internalField(), tT)
volScalarField::InternalField& itotalTemperature =
totalTemperature.internalField();
forAll(itotalTemperature, tT)
{
if (totalN_sum[tT] > 0)
{
totalTemperature.internalField()[tT] =
itotalTemperature[tT] =
totalTemperatureVTerms_sum[tT]
/(3.0 * moleculeCloud::kb * totalN_sum[tT]);
}
else
{
totalTemperature.internalField()[tT] = 0.0;
itotalTemperature[tT] = 0.0;
}
}
@ -206,18 +209,19 @@ if (runTime.outputTime())
}
}
forAll(totalMeanKE.internalField(), tMKE)
volScalarField::InternalField& itotalMeanKE = totalMeanKE.internalField();
forAll(itotalMeanKE, tMKE)
{
if (totalN_sum[tMKE] > 0)
{
totalMeanKE.internalField()[tMKE] =
itotalMeanKE[tMKE] =
totalKE_sum[tMKE]
/totalN_sum[tMKE];
}
else
{
totalMeanKE.internalField()[tMKE] = 0.0;
itotalMeanKE[tMKE] = 0.0;
}
}
}

View File

@ -39,16 +39,20 @@ void Foam::solidMixtureThermo<MixtureType>::calculate()
scalarField& sigmaSCells = sigmaS_.internalField();
scalarField& emissivityCells = emissivity_.internalField();
forAll(T_.internalField(), celli)
const volScalarField::InternalField& iT = T_.internalField();
forAll(iT, celli)
{
rhoCells[celli] = MixtureType::rho(T_[celli], celli);
kappaCells[celli] = MixtureType::kappa(T_[celli], celli);
sigmaSCells[celli] = MixtureType::sigmaS(T_[celli], celli);
KCells[celli] = MixtureType::K(T_[celli], celli);
emissivityCells[celli] = MixtureType::emissivity(T_[celli], celli);
rhoCells[celli] = MixtureType::rho(iT[celli], celli);
kappaCells[celli] = MixtureType::kappa(iT[celli], celli);
sigmaSCells[celli] = MixtureType::sigmaS(iT[celli], celli);
KCells[celli] = MixtureType::K(iT[celli], celli);
emissivityCells[celli] = MixtureType::emissivity(iT[celli], celli);
}
forAll(T_.boundaryField(), patchI)
const volScalarField::GeometricBoundaryField& bT = T_.boundaryField();
forAll(bT, patchI)
{
rho_.boundaryField()[patchI] == this->rho(patchI)();
K_.boundaryField()[patchI] == this->K(patchI)();
@ -158,14 +162,18 @@ Foam::solidMixtureThermo<MixtureType>::Cp() const
);
volScalarField& Cp = tCp();
forAll(T_.internalField(), celli)
const volScalarField::InternalField& iT = T_.internalField();
forAll(iT, celli)
{
Cp[celli] = MixtureType::Cp(T_[celli], celli);
}
forAll(Cp.boundaryField(), patchI)
volScalarField::GeometricBoundaryField& bCp = Cp.boundaryField();
forAll(bCp, patchI)
{
Cp.boundaryField()[patchI] == this->Cp(patchI)();
bCp[patchI] == this->Cp(patchI)();
}
return tCp;
@ -194,14 +202,18 @@ Foam::solidMixtureThermo<MixtureType>::hs() const
);
volScalarField& hs = ths();
forAll(T_.internalField(), celli)
const volScalarField::InternalField& iT = T_.internalField();
forAll(iT, celli)
{
hs[celli] = MixtureType::hs(T_[celli], celli);
}
forAll(hs.boundaryField(), patchI)
volScalarField::GeometricBoundaryField& bHs = hs.boundaryField();
forAll(bHs, patchI)
{
hs.boundaryField()[patchI] == this->hs(patchI)();
bHs[patchI] == this->hs(patchI)();
}
return ths;
@ -230,14 +242,18 @@ Foam::solidMixtureThermo<MixtureType>::Hf() const
);
volScalarField& hf = thF();
forAll(T_.internalField(), celli)
const volScalarField::InternalField& iT = T_.internalField();
forAll(iT, celli)
{
hf[celli] = MixtureType::hf(T_[celli], celli);
}
forAll(hf.boundaryField(), patchI)
volScalarField::GeometricBoundaryField& bhf = hf.boundaryField();
forAll(bhf, patchI)
{
hf.boundaryField()[patchI] == this->Hf(patchI)();
bhf[patchI] == this->Hf(patchI)();
}
return thF;

View File

@ -760,11 +760,11 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::gasHs
)
);
volScalarField& gasHs = tHs();
volScalarField::InternalField& gasHs = tHs().internalField();
const GasThermo& mixture = gasThermo_[index];
forAll(gasHs.internalField(), cellI)
forAll(gasHs, cellI)
{
gasHs[cellI] = mixture.Hs(T[cellI]);
}

View File

@ -32,12 +32,12 @@ divSchemes
div(phi,k) Gauss limitedLinear 1;
div(phi,Yi_hs) Gauss multivariateSelection
{
O2 limitedLinear01 1;
N2 limitedLinear01 1;
C3H8 limitedLinear01 1;
H2O limitedLinear01 1;
CO2 limitedLinear01 1;
hs limitedLinear 1;
O2 linearUpwind grad(O2);
N2 linearUpwind grad(N2);
C3H8 linearUpwind grad(C3H8);
H2O linearUpwind grad(H2O);
CO2 linearUpwind grad(CO2);
hs linearUpwind grad(hs);
};
div((muEff*dev2(T(grad(U))))) Gauss linear;
div(phi,K) Gauss limitedLinear 1;

View File

@ -15,61 +15,117 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
7
9
(
floor
{
type wall;
nFaces 50;
startFace 3896;
startFace 3882;
}
ceiling
{
type wall;
nFaces 50;
startFace 3946;
startFace 3932;
}
inlet
{
type patch;
nFaces 40;
startFace 3996;
startFace 3982;
}
outlet
{
type patch;
nFaces 40;
startFace 4036;
startFace 4022;
}
fixedWalls
{
type empty;
nFaces 4000;
startFace 4076;
startFace 4062;
}
baffle1Wall_0
{
type directMappedWall;
type mappedWall;
nFaces 14;
startFace 8076;
startFace 8062;
sampleMode nearestPatchFace;
sampleRegion region0;
samplePatch baffle1Wall_1;
offsetMode uniform;
offset ( 0 0 0 );
faces ( );
offset (0 0 0);
}
baffle1Wall_1
{
type directMappedWall;
type mappedWall;
nFaces 14;
startFace 8090;
startFace 8076;
sampleMode nearestPatchFace;
sampleRegion region0;
samplePatch baffle1Wall_0;
offsetMode uniform;
offset ( 0 0 0 );
faces ( );
offset (0 0 0);
}
region0_to_baffleRegion_baffleFaces2_top
{
type mappedWall;
nFaces 14;
startFace 8090;
sampleMode nearestPatchFace;
sampleRegion baffleRegion;
samplePatch region0_to_baffleRegion_baffleFaces2_top;
offsetMode nonuniform;
offsets
14
(
(0.02 8.67362e-19 -0)
(0.02 -0 -0)
(0.02 -0 -0)
(0.02 -6.93889e-18 -0)
(0.02 -6.93889e-18 -0)
(0.02 -0 -0)
(0.02 -0 -0)
(0.02 -0 -0)
(0.02 -0 -0)
(0.02 -0 -0)
(0.02 -0 -0)
(0.02 -0 -0)
(0.02 -0 -0)
(0.02 -2.77556e-17 -0)
)
;
}
region0_to_baffleRegion_baffleFaces2_bottom
{
type mappedWall;
nFaces 14;
startFace 8104;
sampleMode nearestPatchFace;
sampleRegion baffleRegion;
samplePatch region0_to_baffleRegion_baffleFaces2_bottom;
offsetMode nonuniform;
offsets
14
(
(1.11022e-16 8.67362e-19 -0)
(1.11022e-16 -3.46945e-18 -0)
(-1.11022e-16 -0 -0)
(-1.11022e-16 -6.93889e-18 1.11022e-16)
(-1.11022e-16 -1.38778e-17 -0)
(-1.11022e-16 1.38778e-17 -0)
(-1.11022e-16 -0 -0)
(-0 -0 -0)
(-1.11022e-16 -0 -0)
(-1.11022e-16 -0 -0)
(-0 -0 -0)
(-0 -2.77556e-17 -0)
(-0 -0 -0)
(-0 -2.77556e-17 -0)
)
;
}
)

View File

@ -113,6 +113,14 @@ castellatedMeshControls
{
// Surface-wise min and max refinement level
level (5 6);
// Optional specification of patch type (default is wall). No
// constraint types (cyclic, symmetry) etc. are allowed.
patchInfo
{
type wall;
inGroups (motorBike);
}
}
}

View File

@ -15,37 +15,43 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
5
6
(
outlet
{
type patch;
nFaces 600;
startFace 51900;
nFaces 922;
startFace 364825;
}
sides
{
type patch;
nFaces 1200;
startFace 52500;
nFaces 1834;
startFace 365747;
}
inlet
{
type patch;
nFaces 600;
startFace 53700;
nFaces 923;
startFace 367581;
}
ground
{
type wall;
nFaces 900;
startFace 54300;
nFaces 0;
startFace 368504;
}
top
{
type patch;
nFaces 900;
startFace 55200;
startFace 368504;
}
terrain_patch0
{
type wall;
nFaces 16037;
startFace 369404;
}
)

View File

@ -71,16 +71,19 @@ drag
air
{
type SchillerNaumann;
residualDrag 0;
residualPhaseFraction 0;
residualSlip 0;
}
water
{
type SchillerNaumann;
residualDrag 0;
residualPhaseFraction 0;
residualSlip 0;
}
residualDrag 1;
residualPhaseFraction 1e-3;
residualSlip 1e-3;
}
);

View File

@ -79,9 +79,9 @@ sigmas
(air water) 0.07
(air oil) 0.07
(air mercury) 0.07
(water oil) 0.07
(water mercury) 0.07
(oil mercury) 0.07
(water oil) 0
(water mercury) 0
(oil mercury) 0
);
interfaceCompression
@ -109,19 +109,22 @@ drag
(air water)
{
type SchillerNaumann;
residualDrag 100;
residualPhaseFraction 1e-3;
residualSlip 1e-3;
}
(air oil)
{
type SchillerNaumann;
residualDrag 100;
residualPhaseFraction 1e-3;
residualSlip 1e-3;
}
(air mercury)
{
type SchillerNaumann;
residualDrag 100;
residualPhaseFraction 1e-3;
residualSlip 1e-3;
}
);