Commit 4c70e983 authored by andy's avatar andy
Browse files

ENH: Updated mapped boundary types

parent 5deeeda0
...@@ -204,14 +204,13 @@ void mappedFieldFvPatchField<Type>::updateCoeffs() ...@@ -204,14 +204,13 @@ void mappedFieldFvPatchField<Type>::updateCoeffs()
{ {
case NEARESTCELL: case NEARESTCELL:
{ {
const mapDistribute& distMap = mappedPatchBase::map();
newValues = sampleField(); newValues = sampleField();
distMap.distribute(newValues); this->distribute(newValues);
break; break;
} }
case NEARESTPATCHFACE: case NEARESTPATCHFACE: case NEARESTPATCHFACEAMI:
{ {
const label nbrPatchID = const label nbrPatchID =
nbrMesh.boundaryMesh().findPatchID(samplePatch()); nbrMesh.boundaryMesh().findPatchID(samplePatch());
...@@ -230,34 +229,7 @@ void mappedFieldFvPatchField<Type>::updateCoeffs() ...@@ -230,34 +229,7 @@ void mappedFieldFvPatchField<Type>::updateCoeffs()
const mapDistribute& distMap = mappedPatchBase::map(); const mapDistribute& distMap = mappedPatchBase::map();
newValues = nbrField.boundaryField()[nbrPatchID]; newValues = nbrField.boundaryField()[nbrPatchID];
distMap.distribute(newValues); this->distribute(newValues);
break;
}
case mappedPatchBase::NEARESTPATCHFACEAMI:
{
const label nbrPatchID =
nbrMesh.boundaryMesh().findPatchID(samplePatch());
if (nbrPatchID < 0)
{
FatalErrorIn
(
"void mappedFixedValueFvPatchField<Type>::updateCoeffs()"
)<< "Unable to find sample patch " << samplePatch()
<< " in region " << sampleRegion()
<< " for patch " << this->patch().name() << nl
<< abort(FatalError);
}
// const fieldType& nbrField = sampleField();
// newValues = mpp.AMI().interpolateToSource(nbrField);
notImplemented
(
"void mappedFieldFvPatchField<Type>::updateCoeffs() "
"with mappedPatchBase::NEARESTPATCHFACEAMI"
);
break; break;
} }
...@@ -279,9 +251,7 @@ void mappedFieldFvPatchField<Type>::updateCoeffs() ...@@ -279,9 +251,7 @@ void mappedFieldFvPatchField<Type>::updateCoeffs()
} }
} }
const mapDistribute& distMap = mappedPatchBase::map(); this->distribute(allValues);
distMap.distribute(allValues);
newValues.transfer(allValues); newValues.transfer(allValues);
break; break;
......
...@@ -127,31 +127,7 @@ void Foam::mappedFixedInternalValueFvPatchField<Type>::updateCoeffs() ...@@ -127,31 +127,7 @@ void Foam::mappedFixedInternalValueFvPatchField<Type>::updateCoeffs()
// Retrieve the neighbour patch internal field // Retrieve the neighbour patch internal field
Field<Type> nbrIntFld(nbrField.patchInternalField()); Field<Type> nbrIntFld(nbrField.patchInternalField());
mpp.distribute(nbrIntFld);
switch (mpp.mode())
{
case (mappedPatchBase::NEARESTPATCHFACEAMI):
{
// Retrieve the neighbour patch internal field
nbrIntFld = mpp.AMI().interpolateToSource(nbrIntFld);
break;
}
default:
{
const mapDistribute& distMap = mpp.map();
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
distMap.constructMap(), // what to receive
nbrIntFld
);
break;
}
}
// Restore tag // Restore tag
UPstream::msgType() = oldTag; UPstream::msgType() = oldTag;
......
...@@ -283,30 +283,6 @@ void mappedFixedValueFvPatchField<Type>::updateCoeffs() ...@@ -283,30 +283,6 @@ void mappedFixedValueFvPatchField<Type>::updateCoeffs()
break; break;
} }
case mappedPatchBase::NEARESTPATCHFACE: case mappedPatchBase::NEARESTPATCHFACE:
{
const mapDistribute& distMap = mpp.map();
const label nbrPatchID =
nbrMesh.boundaryMesh().findPatchID(mpp.samplePatch());
if (nbrPatchID < 0)
{
FatalErrorIn
(
"void mappedFixedValueFvPatchField<Type>::updateCoeffs()"
)<< "Unable to find sample patch " << mpp.samplePatch()
<< " in region " << mpp.sampleRegion()
<< " for patch " << this->patch().name() << nl
<< abort(FatalError);
}
const fieldType& nbrField = sampleField();
newValues = nbrField.boundaryField()[nbrPatchID];
distMap.distribute(newValues);
break;
}
case mappedPatchBase::NEARESTPATCHFACEAMI: case mappedPatchBase::NEARESTPATCHFACEAMI:
{ {
const label nbrPatchID = const label nbrPatchID =
...@@ -324,9 +300,9 @@ void mappedFixedValueFvPatchField<Type>::updateCoeffs() ...@@ -324,9 +300,9 @@ void mappedFixedValueFvPatchField<Type>::updateCoeffs()
} }
const fieldType& nbrField = sampleField(); const fieldType& nbrField = sampleField();
newValues = nbrField.boundaryField()[nbrPatchID];
newValues = mpp.AMI().interpolateToSource(newValues); newValues = nbrField.boundaryField()[nbrPatchID];
mpp.distribute(newValues);
break; break;
} }
......
...@@ -28,7 +28,6 @@ License ...@@ -28,7 +28,6 @@ License
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H" #include "fvPatchFieldMapper.H"
#include "mappedPatchBase.H" #include "mappedPatchBase.H"
#include "mapDistribute.H"
#include "surfaceFields.H" #include "surfaceFields.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
...@@ -128,7 +127,7 @@ void Foam::mappedFlowRateFvPatchVectorField::updateCoeffs() ...@@ -128,7 +127,7 @@ void Foam::mappedFlowRateFvPatchVectorField::updateCoeffs()
scalarList phi = scalarList phi =
nbrPatch.lookupPatchField<surfaceScalarField, scalar>(nbrPhiName_); nbrPatch.lookupPatchField<surfaceScalarField, scalar>(nbrPhiName_);
mpp.map().distribute(phi); mpp.distribute(phi);
const surfaceScalarField& phiName = const surfaceScalarField& phiName =
......
...@@ -176,13 +176,10 @@ void Foam::mappedVelocityFluxFixedValueFvPatchField::updateCoeffs() ...@@ -176,13 +176,10 @@ void Foam::mappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
( (
mappedVelocityFluxFixedValueFvPatchField::patch().patch() mappedVelocityFluxFixedValueFvPatchField::patch().patch()
); );
const mapDistribute& distMap = mpp.map();
const fvMesh& nbrMesh = refCast<const fvMesh>(mpp.sampleMesh()); const fvMesh& nbrMesh = refCast<const fvMesh>(mpp.sampleMesh());
const word& fieldName = dimensionedInternalField().name(); const word& fieldName = dimensionedInternalField().name();
const volVectorField& UField = nbrMesh.lookupObject<volVectorField> const volVectorField& UField =
( nbrMesh.lookupObject<volVectorField>(fieldName);
fieldName
);
surfaceScalarField& phiField = const_cast<surfaceScalarField&> surfaceScalarField& phiField = const_cast<surfaceScalarField&>
( (
...@@ -213,26 +210,25 @@ void Foam::mappedVelocityFluxFixedValueFvPatchField::updateCoeffs() ...@@ -213,26 +210,25 @@ void Foam::mappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
} }
} }
distMap.distribute(allUValues); mpp.distribute(allUValues);
newUValues.transfer(allUValues); newUValues.transfer(allUValues);
distMap.distribute(allPhiValues); mpp.distribute(allPhiValues);
newPhiValues.transfer(allPhiValues); newPhiValues.transfer(allPhiValues);
break; break;
} }
case mappedPolyPatch::NEARESTPATCHFACE: case mappedPolyPatch::NEARESTPATCHFACE:
case mappedPolyPatch::NEARESTPATCHFACEAMI:
{ {
const label nbrPatchID = nbrMesh.boundaryMesh().findPatchID const label nbrPatchID =
( nbrMesh.boundaryMesh().findPatchID(mpp.samplePatch());
mpp.samplePatch()
);
newUValues = UField.boundaryField()[nbrPatchID]; newUValues = UField.boundaryField()[nbrPatchID];
distMap.distribute(newUValues); mpp.distribute(newUValues);
newPhiValues = phiField.boundaryField()[nbrPatchID]; newPhiValues = phiField.boundaryField()[nbrPatchID];
distMap.distribute(newPhiValues); mpp.distribute(newPhiValues);
break; break;
} }
...@@ -242,8 +238,9 @@ void Foam::mappedVelocityFluxFixedValueFvPatchField::updateCoeffs() ...@@ -242,8 +238,9 @@ void Foam::mappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
( (
"mappedVelocityFluxFixedValueFvPatchField::" "mappedVelocityFluxFixedValueFvPatchField::"
"updateCoeffs()" "updateCoeffs()"
) << "patch can only be used in NEARESTPATCHFACE or NEARESTFACE " ) << "patch can only be used in NEARESTPATCHFACE, "
<< "mode" << nl << abort(FatalError); << "NEARESTPATCHFACEAMI or NEARESTFACE mode" << nl
<< abort(FatalError);
} }
} }
......
...@@ -229,7 +229,6 @@ void selfContainedMappedFixedValueFvPatchField<Type>::updateCoeffs() ...@@ -229,7 +229,6 @@ void selfContainedMappedFixedValueFvPatchField<Type>::updateCoeffs()
const fvMesh& thisMesh = this->patch().boundaryMesh().mesh(); const fvMesh& thisMesh = this->patch().boundaryMesh().mesh();
const fvMesh& nbrMesh = refCast<const fvMesh>(sampleMesh()); const fvMesh& nbrMesh = refCast<const fvMesh>(sampleMesh());
const mapDistribute& distMap = mappedPatchBase::map();
// Result of obtaining remote values // Result of obtaining remote values
Field<Type> newValues; Field<Type> newValues;
...@@ -238,6 +237,8 @@ void selfContainedMappedFixedValueFvPatchField<Type>::updateCoeffs() ...@@ -238,6 +237,8 @@ void selfContainedMappedFixedValueFvPatchField<Type>::updateCoeffs()
{ {
case NEARESTCELL: case NEARESTCELL:
{ {
const mapDistribute& distMap = mappedPatchBase::map();
if (interpolationScheme_ != interpolationCell<Type>::typeName) if (interpolationScheme_ != interpolationCell<Type>::typeName)
{ {
// Need to do interpolation so need cells to sample. // Need to do interpolation so need cells to sample.
...@@ -275,12 +276,10 @@ void selfContainedMappedFixedValueFvPatchField<Type>::updateCoeffs() ...@@ -275,12 +276,10 @@ void selfContainedMappedFixedValueFvPatchField<Type>::updateCoeffs()
break; break;
} }
case NEARESTPATCHFACE: case NEARESTPATCHFACE: case NEARESTPATCHFACEAMI:
{ {
const label nbrPatchID = nbrMesh.boundaryMesh().findPatchID const label nbrPatchID =
( nbrMesh.boundaryMesh().findPatchID(samplePatch());
samplePatch()
);
if (nbrPatchID < 0) if (nbrPatchID < 0)
{ {
FatalErrorIn FatalErrorIn
...@@ -297,7 +296,7 @@ void selfContainedMappedFixedValueFvPatchField<Type>::updateCoeffs() ...@@ -297,7 +296,7 @@ void selfContainedMappedFixedValueFvPatchField<Type>::updateCoeffs()
const fieldType& nbrField = sampleField(); const fieldType& nbrField = sampleField();
newValues = nbrField.boundaryField()[nbrPatchID]; newValues = nbrField.boundaryField()[nbrPatchID];
distMap.distribute(newValues); this->distribute(newValues);
break; break;
} }
...@@ -319,7 +318,7 @@ void selfContainedMappedFixedValueFvPatchField<Type>::updateCoeffs() ...@@ -319,7 +318,7 @@ void selfContainedMappedFixedValueFvPatchField<Type>::updateCoeffs()
} }
} }
distMap.distribute(allValues); this->distribute(allValues);
newValues.transfer(allValues); newValues.transfer(allValues);
......
Markdown is supported
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