diff --git a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/laserDTRM/laserDTRM.C b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/laserDTRM/laserDTRM.C index 3a1236fa0a..fa511dcacd 100644 --- a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/laserDTRM/laserDTRM.C +++ b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/laserDTRM/laserDTRM.C @@ -533,6 +533,11 @@ bool Foam::radiation::laserDTRM::read() return false; } +Foam::label Foam::radiation::laserDTRM::nBands() const +{ + return 1; +} + void Foam::radiation::laserDTRM::calculate() { diff --git a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/laserDTRM/laserDTRM.H b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/laserDTRM/laserDTRM.H index 4bdc470ade..71d78eff7d 100644 --- a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/laserDTRM/laserDTRM.H +++ b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/laserDTRM/laserDTRM.H @@ -250,6 +250,9 @@ public: //- Read radiation properties dictionary bool read(); + //- Number of bands for this radiation model + virtual label nBands() const; + // Access diff --git a/src/meshTools/triSurface/triSurfaceTools/triSurfaceTools.C b/src/meshTools/triSurface/triSurfaceTools/triSurfaceTools.C index a207138050..67cef1ea9a 100644 --- a/src/meshTools/triSurface/triSurfaceTools/triSurfaceTools.C +++ b/src/meshTools/triSurface/triSurfaceTools/triSurfaceTools.C @@ -2191,16 +2191,36 @@ Foam::triSurface Foam::triSurfaceTools::triangulate ( const polyBoundaryMesh& bMesh, const labelHashSet& includePatches, + labelList& faceMap, const bool verbose ) { const polyMesh& mesh = bMesh.mesh(); // Storage for surfaceMesh. Size estimate. - DynamicList triangles(mesh.nBoundaryFaces()); + List triangles; + // Calculate number of faces and triangles + label nFaces = 0; + label nTris = 0; + + for (const label patchi : includePatches) + { + const polyPatch& patch = bMesh[patchi]; + const pointField& points = patch.points(); + nFaces += patch.size(); + for (const face& f : patch) + { + faceList triFaces(f.nTriangles(points)); + nTris += triFaces.size(); + } + } + + triangles.setSize(nTris); + faceMap.setSize(nTris); label newPatchi = 0; + nTris = 0; for (const label patchi : includePatches) { const polyPatch& patch = bMesh[patchi]; @@ -2208,6 +2228,7 @@ Foam::triSurface Foam::triSurfaceTools::triangulate label nTriTotal = 0; + label faceI = 0; for (const face& f : patch) { faceList triFaces(f.nTriangles(points)); @@ -2218,10 +2239,13 @@ Foam::triSurface Foam::triSurfaceTools::triangulate for (const face& f : triFaces) { - triangles.append(labelledTri(f[0], f[1], f[2], newPatchi)); + faceMap[nTris] = patch.start() + faceI; + triangles[nTris++] = labelledTri(f[0], f[1], f[2], newPatchi); ++nTriTotal; } + + faceI++; } if (verbose) @@ -2233,7 +2257,7 @@ Foam::triSurface Foam::triSurfaceTools::triangulate newPatchi++; } - triangles.shrink(); + //triangles.shrink(); // Create globally numbered tri surface triSurface rawSurface(triangles, mesh.points()); diff --git a/src/meshTools/triSurface/triSurfaceTools/triSurfaceTools.H b/src/meshTools/triSurface/triSurfaceTools/triSurfaceTools.H index 9b8ea3178d..8e00384d11 100644 --- a/src/meshTools/triSurface/triSurfaceTools/triSurfaceTools.H +++ b/src/meshTools/triSurface/triSurfaceTools/triSurfaceTools.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2018 OpenFOAM Foundation @@ -479,10 +479,12 @@ public: //- Simple triangulation of (selected patches of) boundaryMesh. Needs // polyMesh (or polyBoundaryMesh) since only at this level are the // triangles on neighbouring patches connected. + // Return faceMap from triI to faceI static triSurface triangulate ( const polyBoundaryMesh& mBesh, const labelHashSet& includePatches, + labelList& faceMap, const bool verbose = false ); diff --git a/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C b/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C index a83712886b..86379e1752 100644 --- a/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C +++ b/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C @@ -3794,7 +3794,7 @@ void Foam::distributedTriSurfaceMesh::getRegion labelList triangleIndex(info.size()); autoPtr mapPtr ( - calcLocalQueries + localQueries ( info, triangleIndex @@ -3859,7 +3859,7 @@ void Foam::distributedTriSurfaceMesh::getNormal labelList triangleIndex(info.size()); autoPtr mapPtr ( - calcLocalQueries + localQueries ( info, triangleIndex @@ -4261,7 +4261,7 @@ void Foam::distributedTriSurfaceMesh::getField labelList triangleIndex(info.size()); autoPtr mapPtr ( - calcLocalQueries + localQueries ( info, triangleIndex @@ -4352,6 +4352,128 @@ Foam::triSurface Foam::distributedTriSurfaceMesh::overlappingSurface } +// Exchanges indices to the processor they come from. +// - calculates exchange map +// - uses map to calculate local triangle index +Foam::autoPtr +Foam::distributedTriSurfaceMesh::localQueries +( + const List& info, + labelList& triangleIndex +) const +{ + triangleIndex.setSize(info.size()); + + const globalIndex& triIndexer = globalTris(); + + + // Determine send map + // ~~~~~~~~~~~~~~~~~~ + + // Since determining which processor the query should go to is + // cheap we do a multi-pass algorithm to save some memory temporarily. + + // 1. Count + labelList nSend(Pstream::nProcs(), 0); + + forAll(info, i) + { + if (info[i].hit()) + { + label proci = triIndexer.whichProcID(info[i].index()); + nSend[proci]++; + } + } + + // 2. Size sendMap + labelListList sendMap(Pstream::nProcs()); + forAll(nSend, proci) + { + sendMap[proci].setSize(nSend[proci]); + nSend[proci] = 0; + } + + // 3. Fill sendMap + forAll(info, i) + { + if (info[i].hit()) + { + label proci = triIndexer.whichProcID(info[i].index()); + triangleIndex[i] = triIndexer.toLocal(proci, info[i].index()); + sendMap[proci][nSend[proci]++] = i; + } + else + { + triangleIndex[i] = -1; + } + } + + + // Send over how many i need to receive + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + labelListList sendSizes(Pstream::nProcs()); + sendSizes[Pstream::myProcNo()].setSize(Pstream::nProcs()); + forAll(sendMap, proci) + { + sendSizes[Pstream::myProcNo()][proci] = sendMap[proci].size(); + } + Pstream::gatherList(sendSizes); + Pstream::scatterList(sendSizes); + + + // Determine receive map + // ~~~~~~~~~~~~~~~~~~~~~ + + labelListList constructMap(Pstream::nProcs()); + + // My local segments first + constructMap[Pstream::myProcNo()] = identity + ( + sendMap[Pstream::myProcNo()].size() + ); + + label segmenti = constructMap[Pstream::myProcNo()].size(); + forAll(constructMap, proci) + { + if (proci != Pstream::myProcNo()) + { + // What i need to receive is what other processor is sending to me. + label nRecv = sendSizes[proci][Pstream::myProcNo()]; + constructMap[proci].setSize(nRecv); + + for (label i = 0; i < nRecv; i++) + { + constructMap[proci][i] = segmenti++; + } + } + } + + + // Pack into distribution map + // ~~~~~~~~~~~~~~~~~~~~~~~~~~ + + autoPtr mapPtr + ( + new mapDistribute + ( + segmenti, // size after construction + std::move(sendMap), + std::move(constructMap) + ) + ); + const mapDistribute& map = mapPtr(); + + + // Send over queries + // ~~~~~~~~~~~~~~~~~ + + map.distribute(triangleIndex); + + return mapPtr; +} + + void Foam::distributedTriSurfaceMesh::distribute ( const List& bbs, diff --git a/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.H b/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.H index 95ffdce4ea..779221faa8 100644 --- a/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.H +++ b/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.H @@ -202,6 +202,7 @@ private: // Triangle index + //- Helper: convert local triangle indices to global ones void convertTriIndices(List& info) const; @@ -559,6 +560,17 @@ public: labelList& subFaceMap ); + + //- Obtains global indices from pointIndexHit and swaps them back + // to their original processor. Used to calculate local region + // and normal. + virtual autoPtr localQueries + ( + const List&, + labelList& triangleIndex + ) const; + + //- Print some stats. Parallel aware version of // triSurface::writeStats. void writeStats(Ostream& os) const; diff --git a/src/parallel/distributed/patchDistMethods/exact/exactPatchDistMethod.C b/src/parallel/distributed/patchDistMethods/exact/exactPatchDistMethod.C index be57dc7c96..671d765b44 100644 --- a/src/parallel/distributed/patchDistMethods/exact/exactPatchDistMethod.C +++ b/src/parallel/distributed/patchDistMethods/exact/exactPatchDistMethod.C @@ -77,6 +77,8 @@ Foam::patchDistMethods::exact::patchSurface() const Info<< "Triangulating local patch faces" << nl << endl; + labelList mapTriToGlobal; + patchSurfPtr_.reset ( new distributedTriSurfaceMesh @@ -93,7 +95,8 @@ Foam::patchDistMethods::exact::patchSurface() const triSurfaceTools::triangulate ( pbm, - patchIDs_ + patchIDs_, + mapTriToGlobal ), dict ) diff --git a/src/thermophysicalModels/radiation/Make/files b/src/thermophysicalModels/radiation/Make/files index bd4e985783..ef657f1c13 100644 --- a/src/thermophysicalModels/radiation/Make/files +++ b/src/thermophysicalModels/radiation/Make/files @@ -11,6 +11,7 @@ radiationModels/viewFactor/viewFactor.C radiationModels/opaqueSolid/opaqueSolid.C radiationModels/solarLoad/solarLoad.C radiationModels/solarLoad/faceShading/faceShading.C +radiationModels/solarLoad/faceReflecting/faceReflecting.C /* Scatter model */ submodels/scatterModel/scatterModel/scatterModel.C @@ -18,6 +19,18 @@ submodels/scatterModel/scatterModel/scatterModelNew.C submodels/scatterModel/noScatter/noScatter.C submodels/scatterModel/constantScatter/constantScatter.C +/* Wall sub-models */ +submodels/wallTransmissivityModel/wallTransmissivityModel/wallTransmissivityModel.C +submodels/wallTransmissivityModel/wallTransmissivityModel/wallTransmissivityModelNew.C +submodels/wallTransmissivityModel/constantTransmissivity/constantTransmissivity.C +submodels/wallTransmissivityModel/multiBandTransmissivity/multiBandTransmissivity.C + +submodels/wallAbsorptionEmissionModel/wallAbsorptionEmissionModel/wallAbsorptionEmissionModel.C +submodels/wallAbsorptionEmissionModel/wallAbsorptionEmissionModel/wallAbsorptionEmissionModelNew.C +submodels/wallAbsorptionEmissionModel/multiBandAbsorption/multiBandAbsorption.C +submodels/wallAbsorptionEmissionModel/constantAbsorption/constantAbsorption.C +submodels/wallAbsorptionEmissionModel/solidAbsorption/solidAbsorption.C + /* Absorption/Emission model */ submodels/absorptionEmissionModel/absorptionEmissionModel/absorptionEmissionModel.C submodels/absorptionEmissionModel/absorptionEmissionModel/absorptionEmissionModelNew.C @@ -31,18 +44,19 @@ submodels/absorptionEmissionModel/multiBandSolidAbsorptionEmission/multiBandSoli submodels/boundaryRadiationProperties/boundaryRadiationProperties.C submodels/boundaryRadiationProperties/boundaryRadiationPropertiesPatch.C +/* Types of radiative walls */ +submodels/boundaryRadiationProperties/transparent/transparent.C +submodels/boundaryRadiationProperties/lookup/lookup.C +submodels/boundaryRadiationProperties/opaqueDiffusive/opaqueDiffusive.C +submodels/boundaryRadiationProperties/opaqueReflective/opaqueReflective.C + /* Soot model */ submodels/sootModel/sootModel/sootModel.C submodels/sootModel/sootModel/sootModelNew.C submodels/sootModel/mixtureFractionSoot/mixtureFractionSoots.C submodels/sootModel/noSoot/noSoot.C -/* Transmissivity model */ -submodels/transmissivityModel/transmissivityModel/transmissivityModel.C -submodels/transmissivityModel/transmissivityModel/transmissivityModelNew.C -submodels/transmissivityModel/noTransmissivity/noTransmissivity.C -submodels/transmissivityModel/constantTransmissivity/constantTransmissivity.C -submodels/transmissivityModel/multiBandSolidTransmissivity/multiBandSolidTransmissivity.C + /* Solar calculator model */ submodels/solarCalculator/solarCalculator.C diff --git a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C index 29f006cd4a..8b683a4883 100644 --- a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C +++ b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C @@ -47,8 +47,7 @@ greyDiffusiveRadiationMixedFvPatchScalarField ) : mixedFvPatchScalarField(p, iF), - TName_("T"), - solarLoad_(false) + TName_("T") { refValue() = 0.0; refGrad() = 0.0; @@ -66,8 +65,7 @@ greyDiffusiveRadiationMixedFvPatchScalarField ) : mixedFvPatchScalarField(ptf, p, iF, mapper), - TName_(ptf.TName_), - solarLoad_(ptf.solarLoad_) + TName_(ptf.TName_) {} @@ -80,8 +78,7 @@ greyDiffusiveRadiationMixedFvPatchScalarField ) : mixedFvPatchScalarField(p, iF), - TName_(dict.lookupOrDefault("T", "T")), - solarLoad_(dict.lookupOrDefault("solarLoad", false)) + TName_(dict.lookupOrDefault("T", "T")) { if (dict.found("refValue")) { @@ -111,8 +108,7 @@ greyDiffusiveRadiationMixedFvPatchScalarField ) : mixedFvPatchScalarField(ptf), - TName_(ptf.TName_), - solarLoad_(ptf.solarLoad_) + TName_(ptf.TName_) {} @@ -124,8 +120,7 @@ greyDiffusiveRadiationMixedFvPatchScalarField ) : mixedFvPatchScalarField(ptf, iF), - TName_(ptf.TName_), - solarLoad_(ptf.solarLoad_) + TName_(ptf.TName_) {} @@ -197,12 +192,23 @@ updateCoeffs() Ir += dom.IRay(rayI).qin().boundaryField()[patchi]; } - if (solarLoad_) + if (dom.useSolarLoad()) { + // Looking for primary heat flux single band Ir += patch().lookupPatchField ( - dom.externalRadHeatFieldName_ + dom.primaryFluxName_ + "_0" ); + + word qSecName = dom.relfectedFluxName_ + "_0"; + + if (this->db().foundObject(qSecName)) + { + const volScalarField& qSec = + this->db().lookupObject(qSecName); + + Ir += qSec.boundaryField()[patch().index()]; + } } forAll(Iw, faceI) @@ -248,7 +254,6 @@ void Foam::radiation::greyDiffusiveRadiationMixedFvPatchScalarField::write { mixedFvPatchScalarField::write(os); os.writeEntryIfDifferent("T", "T", TName_); - os.writeEntry("solarLoad", solarLoad_); } diff --git a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.H b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.H index a8d5bdf5f9..489ac5ba7a 100644 --- a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.H +++ b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.H @@ -86,10 +86,6 @@ class greyDiffusiveRadiationMixedFvPatchScalarField //- Name of temperature field word TName_; - //- Activate solar load - bool solarLoad_; - - public: //- Runtime type information diff --git a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C index f1c94f075f..2d45075c84 100644 --- a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C +++ b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C @@ -30,6 +30,7 @@ License #include "fvPatchFieldMapper.H" #include "volFields.H" #include "radiationModel.H" +#include "viewFactor.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -41,8 +42,7 @@ greyDiffusiveViewFactorFixedValueFvPatchScalarField ) : fixedValueFvPatchScalarField(p, iF), - qro_(), - solarLoad_(false) + qro_() {} @@ -56,8 +56,7 @@ greyDiffusiveViewFactorFixedValueFvPatchScalarField ) : fixedValueFvPatchScalarField(ptf, p, iF, mapper), - qro_(ptf.qro_, mapper), - solarLoad_(ptf.solarLoad_) + qro_(ptf.qro_, mapper) {} @@ -70,8 +69,7 @@ greyDiffusiveViewFactorFixedValueFvPatchScalarField ) : fixedValueFvPatchScalarField(p, iF, dict, false), - qro_("qro", dict, p.size()), - solarLoad_(dict.lookupOrDefault("solarLoad", false)) + qro_("qro", dict, p.size()) { if (dict.found("value")) { @@ -95,8 +93,7 @@ greyDiffusiveViewFactorFixedValueFvPatchScalarField ) : fixedValueFvPatchScalarField(ptf), - qro_(ptf.qro_), - solarLoad_(ptf.solarLoad_) + qro_(ptf.qro_) {} @@ -108,8 +105,7 @@ greyDiffusiveViewFactorFixedValueFvPatchScalarField ) : fixedValueFvPatchScalarField(ptf, iF), - qro_(ptf.qro_), - solarLoad_(ptf.solarLoad_) + qro_(ptf.qro_) {} @@ -167,19 +163,29 @@ updateCoeffs() Foam::tmp Foam::radiation:: -greyDiffusiveViewFactorFixedValueFvPatchScalarField::qro() const +greyDiffusiveViewFactorFixedValueFvPatchScalarField::qro(label bandI) const { tmp tqrt(new scalarField(qro_)); - if (solarLoad_) - { - const radiationModel& radiation = - db().lookupObject("radiationProperties"); + const viewFactor& radiation = + db().lookupObject("radiationProperties"); + if (radiation.useSolarLoad()) + { tqrt.ref() += patch().lookupPatchField ( - radiation.externalRadHeatFieldName_ + radiation.primaryFluxName_ + "_" + name(bandI) ); + + word qSecName = radiation.relfectedFluxName_ + "_" + name(bandI); + + if (this->db().foundObject(qSecName)) + { + const volScalarField& qSec = + this->db().lookupObject(qSecName); + + tqrt.ref() += qSec.boundaryField()[patch().index()]; + } } return tqrt; @@ -194,7 +200,6 @@ write { fixedValueFvPatchScalarField::write(os); qro_.writeEntry("qro", os); - os.writeEntry("solarLoad", solarLoad_); } diff --git a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.H b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.H index d1008fcbdc..06091a5818 100644 --- a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.H +++ b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.H @@ -37,7 +37,6 @@ Usage \table Property | Description | Required | Default value qro | external radiative heat flux | yes | - emissivityMode | emissivity mode: solidRadiation or lookup | yes | \endtable Example of the boundary condition specification: @@ -46,8 +45,6 @@ Usage { type greyDiffusiveRadiationViewFactor; qro uniform 0; - emissivityMode solidRadiation; - value uniform 0; } \endverbatim @@ -87,9 +84,6 @@ class greyDiffusiveViewFactorFixedValueFvPatchScalarField //- External radiative heat flux scalarField qro_; - //- Activate solar load - bool solarLoad_; - public: @@ -168,7 +162,7 @@ public: // Access //- Return external + solar load radiative heat flux - tmp qro() const; + tmp qro(label bandI = 0) const; // Evaluation functions diff --git a/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C b/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C index a03437fb28..4f762f564b 100644 --- a/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C +++ b/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C @@ -213,6 +213,25 @@ updateCoeffs() } } + if (dom.useSolarLoad()) + { + // Looking for primary heat flux single band + Ir += patch().lookupPatchField + ( + dom.primaryFluxName_ + "_" + name(lambdaId - 1) + ); + + word qSecName = dom.relfectedFluxName_ + "_" + name(lambdaId - 1); + + if (this->db().foundObject(qSecName)) + { + const volScalarField& qSec = + this->db().lookupObject(qSecName); + + Ir += qSec.boundaryField()[patch().index()]; + } + } + forAll(Iw, facei) { const vector& d = dom.IRay(rayId).d(); diff --git a/src/thermophysicalModels/radiation/radiationModels/P1/P1.C b/src/thermophysicalModels/radiation/radiationModels/P1/P1.C index 606d9ecddd..e98316d0e5 100644 --- a/src/thermophysicalModels/radiation/radiationModels/P1/P1.C +++ b/src/thermophysicalModels/radiation/radiationModels/P1/P1.C @@ -292,4 +292,9 @@ Foam::radiation::P1::Ru() const } +Foam::label Foam::radiation::P1::nBands() const +{ + return absorptionEmission_->nBands(); +} + // ************************************************************************* // diff --git a/src/thermophysicalModels/radiation/radiationModels/P1/P1.H b/src/thermophysicalModels/radiation/radiationModels/P1/P1.H index b9dd4262b4..6593d4642a 100644 --- a/src/thermophysicalModels/radiation/radiationModels/P1/P1.H +++ b/src/thermophysicalModels/radiation/radiationModels/P1/P1.H @@ -128,6 +128,9 @@ public: //- Source term component (constant) virtual tmp Ru() const; + + //- Number of bands + label nBands() const; }; diff --git a/src/thermophysicalModels/radiation/radiationModels/fvDOM/fvDOM/fvDOM.C b/src/thermophysicalModels/radiation/radiationModels/fvDOM/fvDOM/fvDOM.C index 69a4eb6e30..d5eef9f0be 100644 --- a/src/thermophysicalModels/radiation/radiationModels/fvDOM/fvDOM/fvDOM.C +++ b/src/thermophysicalModels/radiation/radiationModels/fvDOM/fvDOM/fvDOM.C @@ -193,10 +193,7 @@ void Foam::radiation::fvDOM::initialise() if (useSolarLoad_) { const dictionary& solarDict = this->subDict("solarLoarCoeffs"); - solarLoad_.reset - ( - new solarLoad(solarDict, T_, externalRadHeatFieldName_) - ); + solarLoad_.reset(new solarLoad(solarDict, T_)); if (solarLoad_->nBands() > 1) { diff --git a/src/thermophysicalModels/radiation/radiationModels/fvDOM/fvDOM/fvDOM.H b/src/thermophysicalModels/radiation/radiationModels/fvDOM/fvDOM/fvDOM.H index 3543335682..d704efe9b8 100644 --- a/src/thermophysicalModels/radiation/radiationModels/fvDOM/fvDOM/fvDOM.H +++ b/src/thermophysicalModels/radiation/radiationModels/fvDOM/fvDOM/fvDOM.H @@ -244,6 +244,9 @@ public: //- Number of wavelengths inline label nLambda() const; + //- Number of bands + inline label nBands() const; + //- Const access to total absorption coefficient inline const volScalarField& a() const; @@ -270,6 +273,9 @@ public: //- Return meshOrientation inline vector meshOrientation() const; + + //- Use solar load + inline bool useSolarLoad() const; }; diff --git a/src/thermophysicalModels/radiation/radiationModels/fvDOM/fvDOM/fvDOMI.H b/src/thermophysicalModels/radiation/radiationModels/fvDOM/fvDOM/fvDOMI.H index 0532cd6992..8f8fd1161c 100644 --- a/src/thermophysicalModels/radiation/radiationModels/fvDOM/fvDOM/fvDOMI.H +++ b/src/thermophysicalModels/radiation/radiationModels/fvDOM/fvDOM/fvDOMI.H @@ -67,6 +67,11 @@ inline Foam::label Foam::radiation::fvDOM::nLambda() const } +inline Foam::label Foam::radiation::fvDOM::nBands() const +{ + return nLambda_; +} + inline const Foam::volScalarField& Foam::radiation::fvDOM::a() const { return a_; @@ -124,4 +129,9 @@ inline Foam::vector Foam::radiation::fvDOM::meshOrientation() const } +inline bool Foam::radiation::fvDOM::useSolarLoad() const +{ + return useSolarLoad_; +} + // ************************************************************************* // diff --git a/src/thermophysicalModels/radiation/radiationModels/noRadiation/noRadiation.H b/src/thermophysicalModels/radiation/radiationModels/noRadiation/noRadiation.H index c16b1243a4..3107d656ee 100644 --- a/src/thermophysicalModels/radiation/radiationModels/noRadiation/noRadiation.H +++ b/src/thermophysicalModels/radiation/radiationModels/noRadiation/noRadiation.H @@ -101,6 +101,12 @@ public: //- Source term component (constant) tmp Ru() const; + + //- Number of bands + label nBands() const + { + return 0; + } }; diff --git a/src/thermophysicalModels/radiation/radiationModels/opaqueSolid/opaqueSolid.C b/src/thermophysicalModels/radiation/radiationModels/opaqueSolid/opaqueSolid.C index 0b40a454ae..b2128c122a 100644 --- a/src/thermophysicalModels/radiation/radiationModels/opaqueSolid/opaqueSolid.C +++ b/src/thermophysicalModels/radiation/radiationModels/opaqueSolid/opaqueSolid.C @@ -121,4 +121,9 @@ Foam::radiation::opaqueSolid::Ru() const } +Foam::label Foam::radiation::opaqueSolid::nBands() const +{ + return absorptionEmission_->nBands(); +} + // ************************************************************************* // diff --git a/src/thermophysicalModels/radiation/radiationModels/opaqueSolid/opaqueSolid.H b/src/thermophysicalModels/radiation/radiationModels/opaqueSolid/opaqueSolid.H index 231cfc5078..5230b906fd 100644 --- a/src/thermophysicalModels/radiation/radiationModels/opaqueSolid/opaqueSolid.H +++ b/src/thermophysicalModels/radiation/radiationModels/opaqueSolid/opaqueSolid.H @@ -102,6 +102,9 @@ public: //- Source term component (constant) tmp Ru() const; + + //- Number of bands + label nBands() const; }; diff --git a/src/thermophysicalModels/radiation/radiationModels/radiationModel/radiationModel.C b/src/thermophysicalModels/radiation/radiationModels/radiationModel/radiationModel.C index 8c28998334..8a28b31434 100644 --- a/src/thermophysicalModels/radiation/radiationModels/radiationModel/radiationModel.C +++ b/src/thermophysicalModels/radiation/radiationModels/radiationModel/radiationModel.C @@ -47,6 +47,12 @@ namespace Foam const Foam::word Foam::radiation::radiationModel::externalRadHeatFieldName_ = "qrExt"; +const Foam::word Foam::radiation::radiationModel::primaryFluxName_ = + "qprimaryRad"; + + const Foam::word Foam::radiation::radiationModel::relfectedFluxName_ = + "qreflective"; + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // Foam::IOobject Foam::radiation::radiationModel::createIOobject @@ -90,8 +96,6 @@ void Foam::radiation::radiationModel::initialise() scatter_.reset(scatterModel::New(*this, mesh_).ptr()); soot_.reset(sootModel::New(*this, mesh_).ptr()); - - transmissivity_.reset(transmissivityModel::New(*this, mesh_).ptr()); } } @@ -120,8 +124,7 @@ Foam::radiation::radiationModel::radiationModel(const volScalarField& T) firstIter_(true), absorptionEmission_(nullptr), scatter_(nullptr), - soot_(nullptr), - transmissivity_(nullptr) + soot_(nullptr) {} @@ -141,8 +144,7 @@ Foam::radiation::radiationModel::radiationModel firstIter_(true), absorptionEmission_(nullptr), scatter_(nullptr), - soot_(nullptr), - transmissivity_(nullptr) + soot_(nullptr) { if (readOpt() == IOobject::NO_READ) { @@ -181,8 +183,7 @@ Foam::radiation::radiationModel::radiationModel firstIter_(true), absorptionEmission_(nullptr), scatter_(nullptr), - soot_(nullptr), - transmissivity_(nullptr) + soot_(nullptr) { initialise(); } @@ -319,7 +320,7 @@ Foam::radiation::radiationModel::soot() const return *soot_; } - +/* const Foam::radiation::transmissivityModel& Foam::radiation::radiationModel::transmissivity() const { @@ -332,6 +333,6 @@ Foam::radiation::radiationModel::transmissivity() const return *transmissivity_; } - +*/ // ************************************************************************* // diff --git a/src/thermophysicalModels/radiation/radiationModels/radiationModel/radiationModel.H b/src/thermophysicalModels/radiation/radiationModels/radiationModel/radiationModel.H index 695e4b86f0..94174f6bba 100644 --- a/src/thermophysicalModels/radiation/radiationModels/radiationModel/radiationModel.H +++ b/src/thermophysicalModels/radiation/radiationModels/radiationModel/radiationModel.H @@ -50,7 +50,7 @@ SourceFiles #include "volFields.H" #include "fvMatricesFwd.H" #include "Switch.H" -#include "transmissivityModel.H" +#include "absorptionEmissionModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -64,7 +64,7 @@ namespace radiation { // Forward declaration of classes -class absorptionEmissionModel; +//class absorptionEmissionModel; class scatterModel; class sootModel; @@ -83,6 +83,13 @@ public: //- Static name external radiative fluxes static const word externalRadHeatFieldName_; + //- Static name for primary solar fluxes + static const word primaryFluxName_; + + //- Static name for reflected solar fluxes + static const word relfectedFluxName_; + + protected: @@ -124,7 +131,7 @@ protected: autoPtr soot_; //- Transmissivity model - autoPtr transmissivity_; + //autoPtr transmissivity_; private: @@ -265,12 +272,11 @@ public: volScalarField& T ) const; + virtual label nBands() const = 0; + //- Access to absorptionEmission model const absorptionEmissionModel& absorptionEmission() const; - //- Access to transmissivity Model - const transmissivityModel& transmissivity() const; - //- Access to soot Model const sootModel& soot() const; diff --git a/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceReflecting/faceReflecting.C b/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceReflecting/faceReflecting.C new file mode 100644 index 0000000000..eb2b158dd3 --- /dev/null +++ b/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceReflecting/faceReflecting.C @@ -0,0 +1,572 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2018 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "faceReflecting.H" +#include "boundaryRadiationProperties.H" +#include "cyclicAMIPolyPatch.H" +#include "volFields.H" + + +using namespace Foam::constant::mathematical; + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(faceReflecting, 0); +} + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::faceReflecting::initialise(const dictionary& coeffs) +{ + + forAll(qreflective_, bandI) + { + qreflective_.set + ( + bandI, + new volScalarField + ( + IOobject + ( + "qreflective_" + Foam::name(bandI) , + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh_, + dimensionedScalar(dimMass/pow3(dimTime), Zero) + ) + ); + } + + label rayI = 0; + if (mesh_.nSolutionD() == 3) + { + nRay_ = 4*nPhi_*nTheta_; + refDiscAngles_.resize(nRay_); + const scalar deltaPhi = pi/(2.0*nPhi_); + const scalar deltaTheta = pi/nTheta_; + + for (label n = 1; n <= nTheta_; n++) + { + for (label m = 1; m <= 4*nPhi_; m++) + { + const scalar thetai = (2*n - 1)*deltaTheta/2.0; + const scalar phii = (2*m - 1)*deltaPhi/2.0; + + scalar sinTheta = Foam::sin(thetai); + scalar cosTheta = Foam::cos(thetai); + scalar sinPhi = Foam::sin(phii); + scalar cosPhi = Foam::cos(phii); + refDiscAngles_[rayI++] = + vector(sinTheta*sinPhi, sinTheta*cosPhi, cosTheta); + + } + } + + } + else if (mesh_.nSolutionD() == 2) + { + nRay_ = 4*nPhi_; + refDiscAngles_.resize(nRay_); + const scalar thetai = piByTwo; + //const scalar deltaTheta = pi; + const scalar deltaPhi = pi/(2.0*nPhi_); + for (label m = 1; m <= 4*nPhi_; m++) + { + const scalar phii = (2*m - 1)*deltaPhi/2.0; + + scalar sinTheta = Foam::sin(thetai); + scalar cosTheta = Foam::cos(thetai); + scalar sinPhi = Foam::sin(phii); + scalar cosPhi = Foam::cos(phii); + + refDiscAngles_[rayI++] = + vector(sinTheta*sinPhi, sinTheta*cosPhi, cosTheta); + } + } + else + { + FatalErrorInFunction + << "The reflected rays are available in 2D or 3D " + << abort(FatalError); + } + + const polyBoundaryMesh& patches = mesh_.boundaryMesh(); + + const radiation::boundaryRadiationProperties& boundaryRadiation = + radiation::boundaryRadiationProperties::New(mesh_); + + // global face index + globalIndex globalNumbering(mesh_.nFaces()); + + + // Collect faces with t = 0, r = 0 and a > 0 to shoot rays + // and patches to construct the triSurface + DynamicList dynCf; + DynamicList dynNf; + DynamicList