ENH: Removed view factor hard-coding from faceAgglomerate utility

This commit is contained in:
andy
2011-06-14 13:45:30 +01:00
parent cb684c42ba
commit b4230fa874
2 changed files with 31 additions and 23 deletions

View File

@ -43,16 +43,26 @@ Description
using namespace Foam; using namespace Foam;
// Main program: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#include "addRegionOption.H" #include "addRegionOption.H"
argList::addOption
(
"dict",
"word",
"name of dictionary to provide patch agglomeration controls"
);
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
#include "createNamedMesh.H" #include "createNamedMesh.H"
word agglomDictName
(
args.optionLookupOrDefault<word>("dict", "faceAgglomerateDict")
);
const polyBoundaryMesh& patches = mesh.boundaryMesh(); const polyBoundaryMesh& patches = mesh.boundaryMesh();
labelListIOList finalAgglom labelListIOList finalAgglom
@ -70,12 +80,12 @@ int main(int argc, char *argv[])
); );
// Read view factor dictionary // Read control dictionary
IOdictionary viewFactorDict IOdictionary agglomDict
( (
IOobject IOobject
( (
"viewFactorsDict", agglomDictName,
runTime.constant(), runTime.constant(),
mesh, mesh,
IOobject::MUST_READ, IOobject::MUST_READ,
@ -83,8 +93,7 @@ int main(int argc, char *argv[])
) )
); );
bool writeAgglo = bool writeAgglom = readBool(agglomDict.lookup("writeFacesAgglomeration"));
readBool(viewFactorDict.lookup("writeFacesAgglomeration"));
const polyBoundaryMesh& boundary = mesh.boundaryMesh(); const polyBoundaryMesh& boundary = mesh.boundaryMesh();
@ -97,13 +106,13 @@ int main(int argc, char *argv[])
if (pp.size() > 0 && !pp.coupled()) if (pp.size() > 0 && !pp.coupled())
{ {
if (viewFactorDict.found(pp.name())) if (agglomDict.found(pp.name()))
{ {
Info << "\nAgglomerating name : " << pp.name() << endl; Info << "\nAgglomerating patch : " << pp.name() << endl;
pairPatchAgglomeration agglomObject pairPatchAgglomeration agglomObject
( (
pp, pp,
viewFactorDict.subDict(pp.name()) agglomDict.subDict(pp.name())
); );
agglomObject.agglomerate(); agglomObject.agglomerate();
finalAgglom[patchI] = finalAgglom[patchI] =
@ -111,19 +120,15 @@ int main(int argc, char *argv[])
} }
else else
{ {
FatalErrorIn FatalErrorIn(args.executable())
( << "Patch " << pp.name() << " not found in dictionary: "
"main(int argc, char *argv[])" << agglomDict.name() << exit(FatalError);
) << pp.name()
<< " not found in dictionary : "
<< viewFactorDict.name()
<< exit(FatalError);
} }
} }
} }
// Sync agglomeration across coupled patches // Sync agglomeration across coupled patches
labelList nbrAgglom(mesh.nFaces()-mesh.nInternalFaces(), -1); labelList nbrAgglom(mesh.nFaces() - mesh.nInternalFaces(), -1);
forAll(boundary, patchId) forAll(boundary, patchId)
{ {
@ -133,7 +138,7 @@ int main(int argc, char *argv[])
finalAgglom[patchId] = identity(pp.size()); finalAgglom[patchId] = identity(pp.size());
forAll(pp, i) forAll(pp, i)
{ {
nbrAgglom[pp.start()-mesh.nInternalFaces()+i] = nbrAgglom[pp.start() - mesh.nInternalFaces() + i] =
finalAgglom[patchId][i]; finalAgglom[patchId][i];
} }
} }
@ -148,14 +153,14 @@ int main(int argc, char *argv[])
forAll(pp, i) forAll(pp, i)
{ {
finalAgglom[patchId][i] = finalAgglom[patchId][i] =
nbrAgglom[pp.start()-mesh.nInternalFaces()+i]; nbrAgglom[pp.start() - mesh.nInternalFaces() + i];
} }
} }
} }
finalAgglom.write(); finalAgglom.write();
if (writeAgglo) if (writeAgglom)
{ {
volScalarField facesAgglomeration volScalarField facesAgglomeration
( (
@ -183,10 +188,13 @@ int main(int argc, char *argv[])
} }
} }
Info << "\nWriting facesAgglomeration..." << endl; Info << "\nWriting facesAgglomeration" << endl;
facesAgglomeration.write(); facesAgglomeration.write();
} }
Info<< "End\n" << endl; Info<< "End\n" << endl;
return 0; return 0;
} }
// ************************************************************************* //

View File

@ -29,7 +29,7 @@ done
for i in bottomAir topAir for i in bottomAir topAir
do do
faceAgglomerate -region $i > log.faceAgglomerate.$i 2>&1 faceAgglomerate -region $i -dict viewFactorsDict > log.faceAgglomerate.$i 2>&1
done done
for i in bottomAir topAir for i in bottomAir topAir