mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
averaging in isoSurfaces
This commit is contained in:
@ -40,7 +40,7 @@ surfaceFormat vtk;
|
|||||||
// 1] vertex values determined from neighbouring cell-centre values
|
// 1] vertex values determined from neighbouring cell-centre values
|
||||||
// 2] face values determined using the current face interpolation scheme
|
// 2] face values determined using the current face interpolation scheme
|
||||||
// for the field (linear, gamma, etc.)
|
// for the field (linear, gamma, etc.)
|
||||||
interpolationScheme cellPointFace;
|
interpolationScheme cellPoint;
|
||||||
|
|
||||||
// Fields to sample.
|
// Fields to sample.
|
||||||
fields
|
fields
|
||||||
@ -155,21 +155,21 @@ surfaces
|
|||||||
// Optional: whether to leave as faces (=default) or triangulate
|
// Optional: whether to leave as faces (=default) or triangulate
|
||||||
}
|
}
|
||||||
|
|
||||||
/* not yet (re)implemented --
|
|
||||||
constantIso
|
constantIso
|
||||||
{
|
{
|
||||||
name iso;
|
name isoSurface;
|
||||||
field rho;
|
isoField rho;
|
||||||
value 0.5;
|
isoValue 0.5;
|
||||||
|
interpolate false
|
||||||
}
|
}
|
||||||
someIso
|
interpolatedIso
|
||||||
{
|
{
|
||||||
type iso;
|
name isoSurface;
|
||||||
field rho;
|
isoField rho;
|
||||||
value 0.5;
|
isoValue 0.5;
|
||||||
interpolate true;
|
interpolate true;
|
||||||
|
//regularise false; //optional: do not simplify
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -105,6 +105,44 @@ void Foam::sampledIsoSurface::createGeometry() const
|
|||||||
volPointInterpolation::New(fvm).interpolate(cellFld)
|
volPointInterpolation::New(fvm).interpolate(cellFld)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (average_)
|
||||||
|
{
|
||||||
|
//- From point field and interpolated cell.
|
||||||
|
scalarField cellAvg(fvm.nCells(), scalar(0.0));
|
||||||
|
labelField nPointCells(fvm.nCells(), 0);
|
||||||
|
{
|
||||||
|
for (label pointI = 0; pointI < fvm.nPoints(); pointI++)
|
||||||
|
{
|
||||||
|
const labelList& pCells = fvm.pointCells(pointI);
|
||||||
|
|
||||||
|
forAll(pCells, i)
|
||||||
|
{
|
||||||
|
label cellI = pCells[i];
|
||||||
|
|
||||||
|
cellAvg[cellI] += pointFld().internalField()[pointI];
|
||||||
|
nPointCells[cellI]++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
forAll(cellAvg, cellI)
|
||||||
|
{
|
||||||
|
cellAvg[cellI] /= nPointCells[cellI];
|
||||||
|
}
|
||||||
|
|
||||||
|
const isoSurface iso
|
||||||
|
(
|
||||||
|
fvm,
|
||||||
|
cellAvg,
|
||||||
|
pointFld().internalField(),
|
||||||
|
isoVal_,
|
||||||
|
regularise_
|
||||||
|
);
|
||||||
|
|
||||||
|
const_cast<sampledIsoSurface&>(*this).triSurface::operator=(iso);
|
||||||
|
meshCells_ = iso.meshCells();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
//- Direct from cell field and point field. Gives bad continuity.
|
//- Direct from cell field and point field. Gives bad continuity.
|
||||||
const isoSurface iso
|
const isoSurface iso
|
||||||
(
|
(
|
||||||
@ -115,45 +153,17 @@ void Foam::sampledIsoSurface::createGeometry() const
|
|||||||
regularise_
|
regularise_
|
||||||
);
|
);
|
||||||
|
|
||||||
////- From point field and interpolated cell.
|
|
||||||
//scalarField cellAvg(fvm.nCells(), scalar(0.0));
|
|
||||||
//labelField nPointCells(fvm.nCells(), 0);
|
|
||||||
//{
|
|
||||||
// for (label pointI = 0; pointI < fvm.nPoints(); pointI++)
|
|
||||||
// {
|
|
||||||
// const labelList& pCells = fvm.pointCells(pointI);
|
|
||||||
//
|
|
||||||
// forAll(pCells, i)
|
|
||||||
// {
|
|
||||||
// label cellI = pCells[i];
|
|
||||||
//
|
|
||||||
// cellAvg[cellI] += pointFld().internalField()[pointI];
|
|
||||||
// nPointCells[cellI]++;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//forAll(cellAvg, cellI)
|
|
||||||
//{
|
|
||||||
// cellAvg[cellI] /= nPointCells[cellI];
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//const isoSurface iso
|
|
||||||
//(
|
|
||||||
// fvm,
|
|
||||||
// cellAvg,
|
|
||||||
// pointFld().internalField(),
|
|
||||||
// isoVal_,
|
|
||||||
// regularise_
|
|
||||||
//);
|
|
||||||
|
|
||||||
|
|
||||||
const_cast<sampledIsoSurface&>(*this).triSurface::operator=(iso);
|
const_cast<sampledIsoSurface&>(*this).triSurface::operator=(iso);
|
||||||
meshCells_ = iso.meshCells();
|
meshCells_ = iso.meshCells();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Pout<< "sampledIsoSurface::createGeometry() : constructed iso:"
|
Pout<< "sampledIsoSurface::createGeometry() : constructed iso:"
|
||||||
<< nl
|
<< nl
|
||||||
|
<< " regularise : " << regularise_ << nl
|
||||||
|
<< " average : " << average_ << nl
|
||||||
<< " isoField : " << isoField_ << nl
|
<< " isoField : " << isoField_ << nl
|
||||||
<< " isoValue : " << isoVal_ << nl
|
<< " isoValue : " << isoVal_ << nl
|
||||||
<< " points : " << points().size() << nl
|
<< " points : " << points().size() << nl
|
||||||
@ -177,6 +187,7 @@ Foam::sampledIsoSurface::sampledIsoSurface
|
|||||||
isoField_(dict.lookup("isoField")),
|
isoField_(dict.lookup("isoField")),
|
||||||
isoVal_(readScalar(dict.lookup("isoValue"))),
|
isoVal_(readScalar(dict.lookup("isoValue"))),
|
||||||
regularise_(dict.lookupOrDefault("regularise", true)),
|
regularise_(dict.lookupOrDefault("regularise", true)),
|
||||||
|
average_(dict.lookupOrDefault("average", true)),
|
||||||
zoneName_(word::null),
|
zoneName_(word::null),
|
||||||
facesPtr_(NULL),
|
facesPtr_(NULL),
|
||||||
storedTimeIndex_(-1),
|
storedTimeIndex_(-1),
|
||||||
|
|||||||
@ -66,6 +66,9 @@ class sampledIsoSurface
|
|||||||
//- Whether to coarse
|
//- Whether to coarse
|
||||||
const Switch regularise_;
|
const Switch regularise_;
|
||||||
|
|
||||||
|
//- Whether to recalculate cell values as average of point values
|
||||||
|
const Switch average_;
|
||||||
|
|
||||||
//- zone name (if restricted to zones)
|
//- zone name (if restricted to zones)
|
||||||
word zoneName_;
|
word zoneName_;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user