Commit 4c70e983 authored by andy's avatar andy

ENH: Updated mapped boundary types

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