mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -92,65 +92,60 @@ void Foam::patchProbes::findElements(const fvMesh& mesh)
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
if (elementList_.empty())
|
forAll(probeLocations(), probeI)
|
||||||
{
|
{
|
||||||
elementList_.setSize(probeLocations().size());
|
const point sample = probeLocations()[probeI];
|
||||||
|
|
||||||
forAll(probeLocations(), probeI)
|
scalar span = boundaryTree.bb().mag();
|
||||||
|
|
||||||
|
pointIndexHit info = boundaryTree.findNearest
|
||||||
|
(
|
||||||
|
sample,
|
||||||
|
Foam::sqr(span)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!info.hit())
|
||||||
{
|
{
|
||||||
const point sample = probeLocations()[probeI];
|
info = boundaryTree.findNearest
|
||||||
|
|
||||||
scalar span = boundaryTree.bb().mag();
|
|
||||||
|
|
||||||
pointIndexHit info = boundaryTree.findNearest
|
|
||||||
(
|
(
|
||||||
sample,
|
sample,
|
||||||
Foam::sqr(span)
|
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 point& fc = mesh.faceCentres()[faceI];
|
||||||
|
|
||||||
|
directMappedPatchBase::nearInfo sampleInfo;
|
||||||
|
|
||||||
|
sampleInfo.first() = pointIndexHit
|
||||||
|
(
|
||||||
|
true,
|
||||||
|
fc,
|
||||||
|
faceI
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!info.hit())
|
sampleInfo.second().first() = magSqr(fc-sample);
|
||||||
{
|
sampleInfo.second().second() = Pstream::myProcNo();
|
||||||
info = boundaryTree.findNearest
|
|
||||||
(
|
|
||||||
sample,
|
|
||||||
Foam::sqr(GREAT)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
label faceI = boundaryTree.shapes().faceLabels()[info.index()];
|
nearest[probeI]= sampleInfo;
|
||||||
|
|
||||||
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 point& fc = mesh.faceCentres()[faceI];
|
|
||||||
|
|
||||||
directMappedPatchBase::nearInfo sampleInfo;
|
|
||||||
|
|
||||||
sampleInfo.first() = pointIndexHit
|
|
||||||
(
|
|
||||||
true,
|
|
||||||
fc,
|
|
||||||
faceI
|
|
||||||
);
|
|
||||||
|
|
||||||
sampleInfo.second().first() = magSqr(fc-sample);
|
|
||||||
sampleInfo.second().second() = Pstream::myProcNo();
|
|
||||||
|
|
||||||
nearest[probeI]= sampleInfo;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -171,25 +166,21 @@ void Foam::patchProbes::findElements(const fvMesh& mesh)
|
|||||||
Info<< " " << sampleI << " coord:"<< operator[](sampleI)
|
Info<< " " << sampleI << " coord:"<< operator[](sampleI)
|
||||||
<< " found on processor:" << procI
|
<< " found on processor:" << procI
|
||||||
<< " in local cell/face:" << localI
|
<< " in local cell/face:" << localI
|
||||||
<< " with cc:" << nearest[sampleI].first().rawPoint() << endl;
|
<< " with fc:" << nearest[sampleI].first().rawPoint() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if all patchProbes have been found.
|
|
||||||
|
// Extract any local faces to sample
|
||||||
|
elementList_.setSize(nearest.size(), -1);
|
||||||
|
|
||||||
forAll(nearest, sampleI)
|
forAll(nearest, sampleI)
|
||||||
{
|
{
|
||||||
label localI = -1;
|
|
||||||
if (nearest[sampleI].second().second() == Pstream::myProcNo())
|
if (nearest[sampleI].second().second() == Pstream::myProcNo())
|
||||||
{
|
{
|
||||||
localI = nearest[sampleI].first().index();
|
// Store the face to sample
|
||||||
|
elementList_[sampleI] = nearest[sampleI].first().index();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elementList_.empty())
|
|
||||||
{
|
|
||||||
elementList_.setSize(probeLocations().size());
|
|
||||||
}
|
|
||||||
|
|
||||||
elementList_[sampleI] = localI;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,6 +197,12 @@ Foam::patchProbes::patchProbes
|
|||||||
:
|
:
|
||||||
probes(name, obr, dict, loadFromFiles)
|
probes(name, obr, dict, loadFromFiles)
|
||||||
{
|
{
|
||||||
|
// When constructing probes above it will have called the
|
||||||
|
// probes::findElements (since the virtual mechanism not yet operating).
|
||||||
|
// Not easy to workaround (apart from feeding through flag into constructor)
|
||||||
|
// so clear out any cells found for now.
|
||||||
|
elementList_.clear();
|
||||||
|
|
||||||
read(dict);
|
read(dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,6 +227,7 @@ void Foam::patchProbes::write()
|
|||||||
|
|
||||||
void Foam::patchProbes::read(const dictionary& dict)
|
void Foam::patchProbes::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
|
dict.lookup("patchName") >> patchName_;
|
||||||
probes::read(dict);
|
probes::read(dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -206,7 +206,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- Cells to be probed (obtained from the locations)
|
//- Cells to be probed (obtained from the locations)
|
||||||
const labelList& elemets() const
|
const labelList& elements() const
|
||||||
{
|
{
|
||||||
return elementList_;
|
return elementList_;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -175,7 +175,9 @@ void Foam::MarshakRadiationFvPatchScalarField::updateCoeffs()
|
|||||||
const scalarField& gamma =
|
const scalarField& gamma =
|
||||||
patch().lookupPatchField<volScalarField, scalar>("gammaRad");
|
patch().lookupPatchField<volScalarField, scalar>("gammaRad");
|
||||||
|
|
||||||
const scalarField Ep(emissivity()/(2.0*(2.0 - emissivity())));
|
const scalarField temissivity = emissivity();
|
||||||
|
|
||||||
|
const scalarField Ep(temissivity/(2.0*(2.0 - temissivity)));
|
||||||
|
|
||||||
// Set value fraction
|
// Set value fraction
|
||||||
valueFraction() = 1.0/(1.0 + gamma*patch().deltaCoeffs()/Ep);
|
valueFraction() = 1.0/(1.0 + gamma*patch().deltaCoeffs()/Ep);
|
||||||
|
|||||||
@ -176,7 +176,9 @@ void Foam::MarshakRadiationFixedTMixedFvPatchScalarField::updateCoeffs()
|
|||||||
const scalarField& gamma =
|
const scalarField& gamma =
|
||||||
patch().lookupPatchField<volScalarField, scalar>("gammaRad");
|
patch().lookupPatchField<volScalarField, scalar>("gammaRad");
|
||||||
|
|
||||||
const scalarField Ep(emissivity()/(2.0*(scalar(2.0) - emissivity())));
|
const scalarField temissivity = emissivity();
|
||||||
|
|
||||||
|
const scalarField Ep(temissivity/(2.0*(scalar(2.0) - temissivity)));
|
||||||
|
|
||||||
// Set value fraction
|
// Set value fraction
|
||||||
valueFraction() = 1.0/(1.0 + gamma*patch().deltaCoeffs()/Ep);
|
valueFraction() = 1.0/(1.0 + gamma*patch().deltaCoeffs()/Ep);
|
||||||
|
|||||||
@ -194,7 +194,7 @@ updateCoeffs()
|
|||||||
|
|
||||||
ray.Qr().boundaryField()[patchI] += Iw*(n & ray.dAve());
|
ray.Qr().boundaryField()[patchI] += Iw*(n & ray.dAve());
|
||||||
|
|
||||||
scalarList temissivity = emissivity();
|
scalarField temissivity = emissivity();
|
||||||
|
|
||||||
forAll(Iw, faceI)
|
forAll(Iw, faceI)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -194,7 +194,7 @@ updateCoeffs()
|
|||||||
dom.blackBody().bLambda(lambdaId).boundaryField()[patchI]
|
dom.blackBody().bLambda(lambdaId).boundaryField()[patchI]
|
||||||
);
|
);
|
||||||
|
|
||||||
scalarList temissivity = emissivity();
|
scalarField temissivity = emissivity();
|
||||||
|
|
||||||
forAll(Iw, faceI)
|
forAll(Iw, faceI)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user