mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Adding patchProbes to named Patch and Qr and Qe to fvDOM
This commit is contained in:
@ -28,7 +28,9 @@ License
|
|||||||
#include "IOmanip.H"
|
#include "IOmanip.H"
|
||||||
// For 'nearInfo' helper class only
|
// For 'nearInfo' helper class only
|
||||||
#include "directMappedPatchBase.H"
|
#include "directMappedPatchBase.H"
|
||||||
#include "meshSearch.H"
|
//#include "meshSearch.H"
|
||||||
|
#include "treeBoundBox.H"
|
||||||
|
#include "treeDataFace.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -41,27 +43,116 @@ namespace Foam
|
|||||||
|
|
||||||
void Foam::patchProbes::findElements(const fvMesh& mesh)
|
void Foam::patchProbes::findElements(const fvMesh& mesh)
|
||||||
{
|
{
|
||||||
elementList_.clear();
|
|
||||||
elementList_.setSize(size());
|
const polyBoundaryMesh& bm = mesh.boundaryMesh();
|
||||||
|
|
||||||
|
label patchI = bm.findPatchID(patchName_);
|
||||||
|
|
||||||
|
if (patchI == -1)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
" Foam::patchProbes::findElements(const fvMesh&)"
|
||||||
|
) << " Unknown patch name "
|
||||||
|
<< patchName_ << endl
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
// All the info for nearest. Construct to miss
|
// All the info for nearest. Construct to miss
|
||||||
List<directMappedPatchBase::nearInfo> nearest(this->size());
|
List<directMappedPatchBase::nearInfo> nearest(this->size());
|
||||||
|
|
||||||
// Octree based search engine
|
const polyPatch& pp = bm[patchI];
|
||||||
meshSearch meshSearchEngine(mesh, false);
|
|
||||||
|
|
||||||
forAll(*this, probeI)
|
if (pp.size() > 0)
|
||||||
|
{
|
||||||
|
labelList bndFaces(pp.size());
|
||||||
|
forAll(bndFaces, i)
|
||||||
|
{
|
||||||
|
bndFaces[i] = pp.start() + i;
|
||||||
|
}
|
||||||
|
|
||||||
|
treeBoundBox overallBb(pp.points());
|
||||||
|
Random rndGen(123456);
|
||||||
|
overallBb = overallBb.extend(rndGen, 1E-4);
|
||||||
|
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||||
|
overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||||
|
|
||||||
|
const indexedOctree<treeDataFace> boundaryTree
|
||||||
|
(
|
||||||
|
treeDataFace // all information needed to search faces
|
||||||
|
(
|
||||||
|
false, // do not cache bb
|
||||||
|
mesh,
|
||||||
|
bndFaces // patch faces only
|
||||||
|
),
|
||||||
|
overallBb, // overall search domain
|
||||||
|
8, // maxLevel
|
||||||
|
10, // leafsize
|
||||||
|
3.0 // duplicity
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
if (elementList_.empty())
|
||||||
|
{
|
||||||
|
elementList_.setSize(probeLocations().size());
|
||||||
|
|
||||||
|
forAll(probeLocations(), probeI)
|
||||||
|
{
|
||||||
|
const point sample = probeLocations()[probeI];
|
||||||
|
|
||||||
|
scalar span = boundaryTree.bb().mag();
|
||||||
|
|
||||||
|
pointIndexHit info = boundaryTree.findNearest
|
||||||
|
(
|
||||||
|
sample,
|
||||||
|
Foam::sqr(span)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!info.hit())
|
||||||
|
{
|
||||||
|
info = boundaryTree.findNearest
|
||||||
|
(
|
||||||
|
sample,
|
||||||
|
Foam::sqr(GREAT)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
label faceI = boundaryTree.shapes().faceLabels()[info.index()];
|
||||||
|
|
||||||
|
const label patchi = bm.whichPatch(faceI);
|
||||||
|
|
||||||
|
if (isA<emptyPolyPatch>(bm[patchi]))
|
||||||
|
{
|
||||||
|
WarningIn
|
||||||
|
(
|
||||||
|
" Foam::patchProbes::findElements(const fvMesh&)"
|
||||||
|
)
|
||||||
|
<< " The sample point: " << sample
|
||||||
|
<< " belongs to " << patchi
|
||||||
|
<< " which is an empty patch. This is not permitted. "
|
||||||
|
<< " This sample will not be included "
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
const vector& sample = operator[](probeI);
|
|
||||||
label faceI = meshSearchEngine.findNearestBoundaryFace(sample);
|
|
||||||
const point& fc = mesh.faceCentres()[faceI];
|
const point& fc = mesh.faceCentres()[faceI];
|
||||||
nearest[probeI].first() = pointIndexHit
|
|
||||||
|
directMappedPatchBase::nearInfo sampleInfo;
|
||||||
|
|
||||||
|
sampleInfo.first() = pointIndexHit
|
||||||
(
|
(
|
||||||
true,
|
true,
|
||||||
fc,
|
fc,
|
||||||
faceI
|
faceI
|
||||||
);
|
);
|
||||||
nearest[probeI].second().first() = magSqr(fc-sample);
|
|
||||||
nearest[probeI].second().second() = Pstream::myProcNo();
|
sampleInfo.second().first() = magSqr(fc-sample);
|
||||||
|
sampleInfo.second().second() = Pstream::myProcNo();
|
||||||
|
|
||||||
|
nearest[probeI]= sampleInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -93,6 +184,11 @@ void Foam::patchProbes::findElements(const fvMesh& mesh)
|
|||||||
localI = nearest[sampleI].first().index();
|
localI = nearest[sampleI].first().index();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (elementList_.empty())
|
||||||
|
{
|
||||||
|
elementList_.setSize(probeLocations().size());
|
||||||
|
}
|
||||||
|
|
||||||
elementList_[sampleI] = localI;
|
elementList_[sampleI] = localI;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,6 +58,11 @@ class patchProbes
|
|||||||
:
|
:
|
||||||
public probes
|
public probes
|
||||||
{
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Patch name
|
||||||
|
word patchName_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
|||||||
@ -221,6 +221,10 @@ updateCoeffs()
|
|||||||
+ emissivity()()[faceI]*physicoChemical::sigma.value()
|
+ emissivity()()[faceI]*physicoChemical::sigma.value()
|
||||||
* pow4(Tp[faceI])
|
* pow4(Tp[faceI])
|
||||||
)/pi;
|
)/pi;
|
||||||
|
|
||||||
|
// Emmited heat flux from this ray direction
|
||||||
|
ray.Qem().boundaryField()[patchI][faceI] =
|
||||||
|
refValue()[faceI]*(n[faceI] & ray.dAve());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -228,6 +232,10 @@ updateCoeffs()
|
|||||||
valueFraction()[faceI] = 0.0;
|
valueFraction()[faceI] = 0.0;
|
||||||
refGrad()[faceI] = 0.0;
|
refGrad()[faceI] = 0.0;
|
||||||
refValue()[faceI] = 0.0; //not used
|
refValue()[faceI] = 0.0; //not used
|
||||||
|
|
||||||
|
// Incident heat flux on this ray direction
|
||||||
|
ray.Qin().boundaryField()[patchI][faceI] =
|
||||||
|
Iw[faceI]*(n[faceI] & ray.dAve());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -82,6 +82,32 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T)
|
|||||||
mesh_,
|
mesh_,
|
||||||
dimensionedScalar("Qr", dimMass/pow3(dimTime), 0.0)
|
dimensionedScalar("Qr", dimMass/pow3(dimTime), 0.0)
|
||||||
),
|
),
|
||||||
|
Qem_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"Qem",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedScalar("Qem", dimMass/pow3(dimTime), 0.0)
|
||||||
|
),
|
||||||
|
Qin_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"Qin",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedScalar("Qin", dimMass/pow3(dimTime), 0.0)
|
||||||
|
),
|
||||||
a_
|
a_
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
@ -366,13 +392,16 @@ void Foam::radiation::fvDOM::updateG()
|
|||||||
{
|
{
|
||||||
G_ = dimensionedScalar("zero",dimMass/pow3(dimTime), 0.0);
|
G_ = dimensionedScalar("zero",dimMass/pow3(dimTime), 0.0);
|
||||||
Qr_ = dimensionedScalar("zero",dimMass/pow3(dimTime), 0.0);
|
Qr_ = dimensionedScalar("zero",dimMass/pow3(dimTime), 0.0);
|
||||||
|
Qem_ = dimensionedScalar("zero", dimMass/pow3(dimTime), 0.0);
|
||||||
|
Qin_ = dimensionedScalar("zero", dimMass/pow3(dimTime), 0.0);
|
||||||
|
|
||||||
forAll(IRay_, rayI)
|
forAll(IRay_, rayI)
|
||||||
{
|
{
|
||||||
IRay_[rayI].addIntensity();
|
IRay_[rayI].addIntensity();
|
||||||
G_ += IRay_[rayI].I()*IRay_[rayI].omega();
|
G_ += IRay_[rayI].I()*IRay_[rayI].omega();
|
||||||
//Qr_ += IRay_[rayI].Qr();
|
|
||||||
Qr_.boundaryField() += IRay_[rayI].Qr().boundaryField();
|
Qr_.boundaryField() += IRay_[rayI].Qr().boundaryField();
|
||||||
|
Qem_.boundaryField() += IRay_[rayI].Qem().boundaryField();
|
||||||
|
Qin_.boundaryField() += IRay_[rayI].Qin().boundaryField();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -83,6 +83,12 @@ class fvDOM
|
|||||||
//- Total radiative heat flux [W/m2]
|
//- Total radiative heat flux [W/m2]
|
||||||
volScalarField Qr_;
|
volScalarField Qr_;
|
||||||
|
|
||||||
|
//- Emmited radiative heat flux [W/m2]
|
||||||
|
volScalarField Qem_;
|
||||||
|
|
||||||
|
//- Incidet radiative heat flux [W/m2]
|
||||||
|
volScalarField Qin_;
|
||||||
|
|
||||||
//- Total absorption coefficient [1/m]
|
//- Total absorption coefficient [1/m]
|
||||||
volScalarField a_;
|
volScalarField a_;
|
||||||
|
|
||||||
@ -213,6 +219,12 @@ public:
|
|||||||
//- Const access to total radiative heat flux field
|
//- Const access to total radiative heat flux field
|
||||||
inline const volScalarField& Qr() const;
|
inline const volScalarField& Qr() const;
|
||||||
|
|
||||||
|
//- Const access to incident radiative heat flux field
|
||||||
|
inline const volScalarField& Qin() const;
|
||||||
|
|
||||||
|
//- Const access to emitted radiative heat flux field
|
||||||
|
inline const volScalarField& Qem() const;
|
||||||
|
|
||||||
//- Const access to black body
|
//- Const access to black body
|
||||||
inline const blackBodyEmission& blackBody() const;
|
inline const blackBodyEmission& blackBody() const;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -91,6 +91,16 @@ inline const Foam::volScalarField& Foam::radiation::fvDOM::Qr() const
|
|||||||
return Qr_;
|
return Qr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const Foam::volScalarField& Foam::radiation::fvDOM::Qin() const
|
||||||
|
{
|
||||||
|
return Qin_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::volScalarField& Foam::radiation::fvDOM::Qem() const
|
||||||
|
{
|
||||||
|
return Qem_;
|
||||||
|
}
|
||||||
|
|
||||||
inline const Foam::radiation::blackBodyEmission&
|
inline const Foam::radiation::blackBodyEmission&
|
||||||
Foam::radiation::fvDOM::blackBody() const
|
Foam::radiation::fvDOM::blackBody() const
|
||||||
|
|||||||
@ -81,6 +81,32 @@ Foam::radiation::radiativeIntensityRay::radiativeIntensityRay
|
|||||||
mesh_,
|
mesh_,
|
||||||
dimensionedScalar("Qr", dimMass/pow3(dimTime), 0.0)
|
dimensionedScalar("Qr", dimMass/pow3(dimTime), 0.0)
|
||||||
),
|
),
|
||||||
|
Qin_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"Qin" + name(rayId),
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedScalar("Qin", dimMass/pow3(dimTime), 0.0)
|
||||||
|
),
|
||||||
|
Qem_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"Qem" + name(rayId),
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedScalar("Qem", dimMass/pow3(dimTime), 0.0)
|
||||||
|
),
|
||||||
d_(vector::zero),
|
d_(vector::zero),
|
||||||
dAve_(vector::zero),
|
dAve_(vector::zero),
|
||||||
theta_(theta),
|
theta_(theta),
|
||||||
|
|||||||
@ -81,6 +81,12 @@ private:
|
|||||||
//- Total radiative heat flux on boundary
|
//- Total radiative heat flux on boundary
|
||||||
volScalarField Qr_;
|
volScalarField Qr_;
|
||||||
|
|
||||||
|
//- Incident radiative heat flux on boundary
|
||||||
|
volScalarField Qin_;
|
||||||
|
|
||||||
|
//- Emitted radiative heat flux on boundary
|
||||||
|
volScalarField Qem_;
|
||||||
|
|
||||||
//- Direction
|
//- Direction
|
||||||
vector d_;
|
vector d_;
|
||||||
|
|
||||||
@ -171,6 +177,18 @@ public:
|
|||||||
//- Return non-const access to the boundary heat flux
|
//- Return non-const access to the boundary heat flux
|
||||||
inline volScalarField& Qr();
|
inline volScalarField& Qr();
|
||||||
|
|
||||||
|
//- Return non-const access to the boundary incident heat flux
|
||||||
|
inline volScalarField& Qin();
|
||||||
|
|
||||||
|
//- Return non-const access to the boundary emmited heat flux
|
||||||
|
inline volScalarField& Qem();
|
||||||
|
|
||||||
|
//- Return const access to the boundary incident heat flux
|
||||||
|
inline const volScalarField& Qin() const;
|
||||||
|
|
||||||
|
//- Return const access to the boundary emmited heat flux
|
||||||
|
inline const volScalarField& Qem() const;
|
||||||
|
|
||||||
//- Return direction
|
//- Return direction
|
||||||
inline const vector& d() const;
|
inline const vector& d() const;
|
||||||
|
|
||||||
|
|||||||
@ -42,6 +42,31 @@ inline Foam::volScalarField& Foam::radiation::radiativeIntensityRay::Qr()
|
|||||||
return Qr_;
|
return Qr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const Foam::volScalarField& Foam::radiation::
|
||||||
|
radiativeIntensityRay::Qin() const
|
||||||
|
{
|
||||||
|
return Qin_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::volScalarField& Foam::radiation::radiativeIntensityRay::Qin()
|
||||||
|
{
|
||||||
|
return Qin_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::volScalarField& Foam::radiation::
|
||||||
|
radiativeIntensityRay::Qem() const
|
||||||
|
{
|
||||||
|
return Qem_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::volScalarField& Foam::radiation::radiativeIntensityRay::Qem()
|
||||||
|
{
|
||||||
|
return Qem_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const Foam::vector& Foam::radiation::radiativeIntensityRay::d() const
|
inline const Foam::vector& Foam::radiation::radiativeIntensityRay::d() const
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user