Skip to content
Snippets Groups Projects
Commit b4230fa8 authored by andy's avatar andy
Browse files

ENH: Removed view factor hard-coding from faceAgglomerate utility

parent cb684c42
No related branches found
No related tags found
No related merge requests found
...@@ -43,16 +43,26 @@ Description ...@@ -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[]) ...@@ -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[]) ...@@ -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[]) ...@@ -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[]) ...@@ -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[]) ...@@ -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[]) ...@@ -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[]) ...@@ -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;
} }
// ************************************************************************* //
...@@ -29,7 +29,7 @@ done ...@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment