Skip to content
Snippets Groups Projects
Commit 49130c84 authored by andy's avatar andy
Browse files

ENH: Updated min/max function object to include boundary values

parent 459aa318
Branches
Tags
No related merge requests found
......@@ -45,31 +45,56 @@ void Foam::fieldMinMax::calcMinMaxFields
const label procI = Pstream::myProcNo();
const fieldType& field = obr_.lookupObject<fieldType>(fieldName);
const fvMesh& mesh = field.mesh();
const volVectorField::GeometricBoundaryField& CfBoundary =
mesh.C().boundaryField();
switch (mode)
{
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());
List<vector> minCs(Pstream::nProcs());
minIs[procI] = findMin(magField);
minVs[procI] = magField[minIs[procI]];
minCs[procI] = field.mesh().C()[minIs[procI]];
label minProcI = findMin(magField);
minVs[procI] = magField[minProcI];
minCs[procI] = field.mesh().C()[minProcI];
Pstream::gatherList(minIs);
Pstream::gatherList(minVs);
Pstream::gatherList(minCs);
labelList maxIs(Pstream::nProcs());
scalarList maxVs(Pstream::nProcs());
List<vector> maxCs(Pstream::nProcs());
maxIs[procI] = findMax(magField);
maxVs[procI] = magField[maxIs[procI]];
maxCs[procI] = field.mesh().C()[maxIs[procI]];
label maxProcI = findMax(magField);
maxVs[procI] = magField[maxProcI];
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(maxCs);
......@@ -127,25 +152,47 @@ void Foam::fieldMinMax::calcMinMaxFields
}
case mdCmpt:
{
const typename fieldType::GeometricBoundaryField&
fieldBoundary = field.boundaryField();
List<Type> minVs(Pstream::nProcs());
labelList minIs(Pstream::nProcs());
List<vector> minCs(Pstream::nProcs());
minIs[procI] = findMin(field);
minVs[procI] = field[minIs[procI]];
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(minCs);
List<Type> maxVs(Pstream::nProcs());
labelList maxIs(Pstream::nProcs());
List<vector> maxCs(Pstream::nProcs());
maxIs[procI] = findMax(field);
maxVs[procI] = field[maxIs[procI]];
maxCs[procI] = field.mesh().C()[maxIs[procI]];
label maxProcI = findMax(field);
maxVs[procI] = field[maxProcI];
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(maxCs);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment