ENH: Making agglomeration optional for viewFactor model

This commit is contained in:
sergio
2022-06-28 16:04:14 -07:00
committed by Kutalmis Bercin
parent 457979a7b7
commit f5598706c5
2 changed files with 68 additions and 37 deletions

View File

@ -57,7 +57,36 @@ const Foam::word Foam::radiation::viewFactor::viewFactorWalls
void Foam::radiation::viewFactor::initialise() void Foam::radiation::viewFactor::initialise()
{ {
const polyBoundaryMesh& coarsePatches = coarseMesh_.boundaryMesh(); const polyBoundaryMesh& patches = mesh_.boundaryMesh();
if (!finalAgglom_.typeHeaderOk<labelListIOList>())
{
finalAgglom_.setSize(patches.size());
for (label patchi=0; patchi < patches.size(); patchi++)
{
finalAgglom_[patchi] = identity(patches[patchi].size());
}
}
coarseMesh_.reset
(
new singleCellFvMesh
(
IOobject
(
"coarse:" + mesh_.name(),
mesh_.polyMesh::instance(),
mesh_.time(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
mesh_,
finalAgglom_
)
);
const polyBoundaryMesh& coarsePatches = coarseMesh_->boundaryMesh();
selectedPatches_ = mesh_.boundaryMesh().indices(viewFactorWalls); selectedPatches_ = mesh_.boundaryMesh().indices(viewFactorWalls);
@ -82,6 +111,8 @@ void Foam::radiation::viewFactor::initialise()
useDirect_ = coeffs_.getOrDefault<bool>("useDirectSolver", true); useDirect_ = coeffs_.getOrDefault<bool>("useDirectSolver", true);
map_.reset map_.reset
( (
new IOmapDistribute new IOmapDistribute
@ -512,26 +543,26 @@ Foam::radiation::viewFactor::viewFactor(const volScalarField& T)
"finalAgglom", "finalAgglom",
mesh_.facesInstance(), mesh_.facesInstance(),
mesh_, mesh_,
IOobject::MUST_READ, IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false
) )
), ),
map_(), map_(),
coarseMesh_ coarseMesh_(),
( // (
IOobject // IOobject
( // (
"coarse:" + mesh_.name(), // "coarse:" + mesh_.name(),
mesh_.polyMesh::instance(), // mesh_.polyMesh::instance(),
mesh_.time(), // mesh_.time(),
IOobject::NO_READ, // IOobject::NO_READ,
IOobject::NO_WRITE, // IOobject::NO_WRITE,
false // false
), // ),
mesh_, // mesh_,
finalAgglom_ // finalAgglom_
), // ),
qr_ qr_
( (
IOobject IOobject
@ -575,26 +606,26 @@ Foam::radiation::viewFactor::viewFactor
"finalAgglom", "finalAgglom",
mesh_.facesInstance(), mesh_.facesInstance(),
mesh_, mesh_,
IOobject::MUST_READ, IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false
) )
), ),
map_(), map_(),
coarseMesh_ coarseMesh_(),
( // (
IOobject // IOobject
( // (
"coarse:" + mesh_.name(), // "coarse:" + mesh_.name(),
mesh_.polyMesh::instance(), // mesh_.polyMesh::instance(),
mesh_.time(), // mesh_.time(),
IOobject::NO_READ, // IOobject::NO_READ,
IOobject::NO_WRITE, // IOobject::NO_WRITE,
false // false
), // ),
mesh_, // mesh_,
finalAgglom_ // finalAgglom_
), // ),
qr_ qr_
( (
IOobject IOobject
@ -721,10 +752,10 @@ void Foam::radiation::viewFactor::calculate()
const tmp<scalarField> tHoi = qrp.qro(bandI); const tmp<scalarField> tHoi = qrp.qro(bandI);
const scalarField& Hoi = tHoi(); const scalarField& Hoi = tHoi();
const polyPatch& pp = coarseMesh_.boundaryMesh()[patchID]; const polyPatch& pp = coarseMesh_->boundaryMesh()[patchID];
const labelList& coarsePatchFace = const labelList& coarsePatchFace =
coarseMesh_.patchFaceMap()[patchID]; coarseMesh_->patchFaceMap()[patchID];
scalarList T4ave(pp.size(), 0.0); scalarList T4ave(pp.size(), 0.0);
scalarList Eave(pp.size(), 0.0); scalarList Eave(pp.size(), 0.0);
@ -1046,7 +1077,7 @@ void Foam::radiation::viewFactor::calculate()
label globCoarseId = 0; label globCoarseId = 0;
for (const label patchID : selectedPatches_) for (const label patchID : selectedPatches_)
{ {
const polyPatch& pp = coarseMesh_.boundaryMesh()[patchID]; const polyPatch& pp = coarseMesh_->boundaryMesh()[patchID];
if (pp.size() > 0) if (pp.size() > 0)
{ {
@ -1058,7 +1089,7 @@ void Foam::radiation::viewFactor::calculate()
labelListList coarseToFine(invertOneToMany(nAgglom, agglom)); labelListList coarseToFine(invertOneToMany(nAgglom, agglom));
const labelList& coarsePatchFace = const labelList& coarsePatchFace =
coarseMesh_.patchFaceMap()[patchID]; coarseMesh_->patchFaceMap()[patchID];
//scalar heatFlux = 0.0; //scalar heatFlux = 0.0;
forAll(coarseToFine, coarseI) forAll(coarseToFine, coarseI)

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd. Copyright (C) 2018-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -107,7 +107,7 @@ protected:
autoPtr<IOmapDistribute> map_; autoPtr<IOmapDistribute> map_;
//- Coarse mesh //- Coarse mesh
singleCellFvMesh coarseMesh_; autoPtr<singleCellFvMesh> coarseMesh_;
//- Net radiative heat flux [W/m2] //- Net radiative heat flux [W/m2]
volScalarField qr_; volScalarField qr_;