mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Updated min/max function object to include boundary values
This commit is contained in:
@ -45,31 +45,56 @@ void Foam::fieldMinMax::calcMinMaxFields
|
|||||||
const label procI = Pstream::myProcNo();
|
const label procI = Pstream::myProcNo();
|
||||||
|
|
||||||
const fieldType& field = obr_.lookupObject<fieldType>(fieldName);
|
const fieldType& field = obr_.lookupObject<fieldType>(fieldName);
|
||||||
|
const fvMesh& mesh = field.mesh();
|
||||||
|
|
||||||
|
const volVectorField::GeometricBoundaryField& CfBoundary =
|
||||||
|
mesh.C().boundaryField();
|
||||||
|
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case mdMag:
|
case mdMag:
|
||||||
{
|
{
|
||||||
const scalarField magField(mag(field));
|
const volScalarField magField(mag(field));
|
||||||
|
const volScalarField::GeometricBoundaryField& magFieldBoundary =
|
||||||
|
magField.boundaryField();
|
||||||
|
|
||||||
labelList minIs(Pstream::nProcs());
|
|
||||||
scalarList minVs(Pstream::nProcs());
|
scalarList minVs(Pstream::nProcs());
|
||||||
List<vector> minCs(Pstream::nProcs());
|
List<vector> minCs(Pstream::nProcs());
|
||||||
minIs[procI] = findMin(magField);
|
label minProcI = findMin(magField);
|
||||||
minVs[procI] = magField[minIs[procI]];
|
minVs[procI] = magField[minProcI];
|
||||||
minCs[procI] = field.mesh().C()[minIs[procI]];
|
minCs[procI] = field.mesh().C()[minProcI];
|
||||||
|
|
||||||
Pstream::gatherList(minIs);
|
|
||||||
Pstream::gatherList(minVs);
|
|
||||||
Pstream::gatherList(minCs);
|
|
||||||
|
|
||||||
labelList maxIs(Pstream::nProcs());
|
labelList maxIs(Pstream::nProcs());
|
||||||
scalarList maxVs(Pstream::nProcs());
|
scalarList maxVs(Pstream::nProcs());
|
||||||
List<vector> maxCs(Pstream::nProcs());
|
List<vector> maxCs(Pstream::nProcs());
|
||||||
maxIs[procI] = findMax(magField);
|
label maxProcI = findMax(magField);
|
||||||
maxVs[procI] = magField[maxIs[procI]];
|
maxVs[procI] = magField[maxProcI];
|
||||||
maxCs[procI] = field.mesh().C()[maxIs[procI]];
|
maxCs[procI] = field.mesh().C()[maxProcI];
|
||||||
|
|
||||||
|
forAll(magFieldBoundary, patchI)
|
||||||
|
{
|
||||||
|
const scalarField& mfp = magFieldBoundary[patchI];
|
||||||
|
const vectorField& Cfp = CfBoundary[patchI];
|
||||||
|
|
||||||
|
label minPI = findMin(mfp);
|
||||||
|
if (mfp[minPI] < minVs[procI])
|
||||||
|
{
|
||||||
|
minVs[procI] = mfp[minPI];
|
||||||
|
minCs[procI] = Cfp[minPI];
|
||||||
|
}
|
||||||
|
|
||||||
|
label maxPI = findMax(mfp);
|
||||||
|
if (mfp[maxPI] > maxVs[procI])
|
||||||
|
{
|
||||||
|
maxVs[procI] = mfp[maxPI];
|
||||||
|
maxCs[procI] = Cfp[maxPI];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Pstream::gatherList(minVs);
|
||||||
|
Pstream::gatherList(minCs);
|
||||||
|
|
||||||
Pstream::gatherList(maxIs);
|
|
||||||
Pstream::gatherList(maxVs);
|
Pstream::gatherList(maxVs);
|
||||||
Pstream::gatherList(maxCs);
|
Pstream::gatherList(maxCs);
|
||||||
|
|
||||||
@ -127,25 +152,47 @@ void Foam::fieldMinMax::calcMinMaxFields
|
|||||||
}
|
}
|
||||||
case mdCmpt:
|
case mdCmpt:
|
||||||
{
|
{
|
||||||
List<Type> minVs(Pstream::nProcs());
|
const typename fieldType::GeometricBoundaryField&
|
||||||
labelList minIs(Pstream::nProcs());
|
fieldBoundary = field.boundaryField();
|
||||||
List<vector> minCs(Pstream::nProcs());
|
|
||||||
minIs[procI] = findMin(field);
|
List<Type> minVs(Pstream::nProcs());
|
||||||
minVs[procI] = field[minIs[procI]];
|
List<vector> minCs(Pstream::nProcs());
|
||||||
minCs[procI] = field.mesh().C()[minIs[procI]];
|
label minProcI = findMin(field);
|
||||||
|
minVs[procI] = field[minProcI];
|
||||||
|
minCs[procI] = field.mesh().C()[minProcI];
|
||||||
|
|
||||||
Pstream::gatherList(minIs);
|
|
||||||
Pstream::gatherList(minVs);
|
Pstream::gatherList(minVs);
|
||||||
Pstream::gatherList(minCs);
|
Pstream::gatherList(minCs);
|
||||||
|
|
||||||
List<Type> maxVs(Pstream::nProcs());
|
List<Type> maxVs(Pstream::nProcs());
|
||||||
labelList maxIs(Pstream::nProcs());
|
|
||||||
List<vector> maxCs(Pstream::nProcs());
|
List<vector> maxCs(Pstream::nProcs());
|
||||||
maxIs[procI] = findMax(field);
|
label maxProcI = findMax(field);
|
||||||
maxVs[procI] = field[maxIs[procI]];
|
maxVs[procI] = field[maxProcI];
|
||||||
maxCs[procI] = field.mesh().C()[maxIs[procI]];
|
maxCs[procI] = field.mesh().C()[maxProcI];
|
||||||
|
|
||||||
|
forAll(fieldBoundary, patchI)
|
||||||
|
{
|
||||||
|
const Field<Type>& fp = fieldBoundary[patchI];
|
||||||
|
const vectorField& Cfp = CfBoundary[patchI];
|
||||||
|
|
||||||
|
label minPI = findMin(fp);
|
||||||
|
if (fp[minPI] < minVs[procI])
|
||||||
|
{
|
||||||
|
minVs[procI] = fp[minPI];
|
||||||
|
minCs[procI] = Cfp[minPI];
|
||||||
|
}
|
||||||
|
|
||||||
|
label maxPI = findMax(fp);
|
||||||
|
if (fp[maxPI] > maxVs[procI])
|
||||||
|
{
|
||||||
|
maxVs[procI] = fp[maxPI];
|
||||||
|
maxCs[procI] = Cfp[maxPI];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Pstream::gatherList(minVs);
|
||||||
|
Pstream::gatherList(minCs);
|
||||||
|
|
||||||
Pstream::gatherList(maxIs);
|
|
||||||
Pstream::gatherList(maxVs);
|
Pstream::gatherList(maxVs);
|
||||||
Pstream::gatherList(maxCs);
|
Pstream::gatherList(maxCs);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user