diff --git a/src/thermophysicalModels/radiation/radiationModels/viewFactor/viewFactor.C b/src/thermophysicalModels/radiation/radiationModels/viewFactor/viewFactor.C index cbfa9005beac9453964f88f541d16d0603507870..4d8dfb3c8706c3363f305babb521ea9514d794c9 100644 --- a/src/thermophysicalModels/radiation/radiationModels/viewFactor/viewFactor.C +++ b/src/thermophysicalModels/radiation/radiationModels/viewFactor/viewFactor.C @@ -57,7 +57,36 @@ const Foam::word Foam::radiation::viewFactor::viewFactorWalls 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); @@ -82,6 +111,8 @@ void Foam::radiation::viewFactor::initialise() useDirect_ = coeffs_.getOrDefault<bool>("useDirectSolver", true); + + map_.reset ( new IOmapDistribute @@ -512,26 +543,26 @@ Foam::radiation::viewFactor::viewFactor(const volScalarField& T) "finalAgglom", mesh_.facesInstance(), mesh_, - IOobject::MUST_READ, + IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false ) ), map_(), - coarseMesh_ - ( - IOobject - ( - "coarse:" + mesh_.name(), - mesh_.polyMesh::instance(), - mesh_.time(), - IOobject::NO_READ, - IOobject::NO_WRITE, - false - ), - mesh_, - finalAgglom_ - ), + coarseMesh_(), +// ( +// IOobject +// ( +// "coarse:" + mesh_.name(), +// mesh_.polyMesh::instance(), +// mesh_.time(), +// IOobject::NO_READ, +// IOobject::NO_WRITE, +// false +// ), +// mesh_, +// finalAgglom_ +// ), qr_ ( IOobject @@ -575,26 +606,26 @@ Foam::radiation::viewFactor::viewFactor "finalAgglom", mesh_.facesInstance(), mesh_, - IOobject::MUST_READ, + IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false ) ), map_(), - coarseMesh_ - ( - IOobject - ( - "coarse:" + mesh_.name(), - mesh_.polyMesh::instance(), - mesh_.time(), - IOobject::NO_READ, - IOobject::NO_WRITE, - false - ), - mesh_, - finalAgglom_ - ), + coarseMesh_(), +// ( +// IOobject +// ( +// "coarse:" + mesh_.name(), +// mesh_.polyMesh::instance(), +// mesh_.time(), +// IOobject::NO_READ, +// IOobject::NO_WRITE, +// false +// ), +// mesh_, +// finalAgglom_ +// ), qr_ ( IOobject @@ -721,10 +752,10 @@ void Foam::radiation::viewFactor::calculate() const tmp<scalarField> tHoi = qrp.qro(bandI); const scalarField& Hoi = tHoi(); - const polyPatch& pp = coarseMesh_.boundaryMesh()[patchID]; + const polyPatch& pp = coarseMesh_->boundaryMesh()[patchID]; const labelList& coarsePatchFace = - coarseMesh_.patchFaceMap()[patchID]; + coarseMesh_->patchFaceMap()[patchID]; scalarList T4ave(pp.size(), 0.0); scalarList Eave(pp.size(), 0.0); @@ -1046,7 +1077,7 @@ void Foam::radiation::viewFactor::calculate() label globCoarseId = 0; for (const label patchID : selectedPatches_) { - const polyPatch& pp = coarseMesh_.boundaryMesh()[patchID]; + const polyPatch& pp = coarseMesh_->boundaryMesh()[patchID]; if (pp.size() > 0) { @@ -1058,7 +1089,7 @@ void Foam::radiation::viewFactor::calculate() labelListList coarseToFine(invertOneToMany(nAgglom, agglom)); const labelList& coarsePatchFace = - coarseMesh_.patchFaceMap()[patchID]; + coarseMesh_->patchFaceMap()[patchID]; //scalar heatFlux = 0.0; forAll(coarseToFine, coarseI) diff --git a/src/thermophysicalModels/radiation/radiationModels/viewFactor/viewFactor.H b/src/thermophysicalModels/radiation/radiationModels/viewFactor/viewFactor.H index 662c6586beeedf10bd3537041f4c3a580328833b..ec685cc8819e43f3e8a996aced2e5c9f29f8bb48 100644 --- a/src/thermophysicalModels/radiation/radiationModels/viewFactor/viewFactor.H +++ b/src/thermophysicalModels/radiation/radiationModels/viewFactor/viewFactor.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -107,7 +107,7 @@ protected: autoPtr<IOmapDistribute> map_; //- Coarse mesh - singleCellFvMesh coarseMesh_; + autoPtr<singleCellFvMesh> coarseMesh_; //- Net radiative heat flux [W/m2] volScalarField qr_;