mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
general update
This commit is contained in:
@ -26,7 +26,7 @@ License
|
||||
|
||||
#include "directMappedFixedValueFvPatchField.H"
|
||||
#include "directMappedFvPatch.H"
|
||||
#include "fvBoundaryMesh.H"
|
||||
#include "volFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -164,6 +164,38 @@ void directMappedFixedValueFvPatchField<Type>::updateCoeffs()
|
||||
|
||||
|
||||
Field<Type> newValues(this->size());
|
||||
Field<Type> sendValues(this->size());
|
||||
|
||||
switch(mpp.mode())
|
||||
{
|
||||
case directMappedPolyPatch::NEARESTCELL:
|
||||
{
|
||||
sendValues = this->internalField();
|
||||
break;
|
||||
}
|
||||
case directMappedPolyPatch::NEARESTPATCHFACE:
|
||||
{
|
||||
const label patchID =
|
||||
this->patch().patch().boundaryMesh().findPatchID
|
||||
(
|
||||
mpp.samplePatch()
|
||||
);
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
|
||||
const word& fieldName = this->dimensionedInternalField().name();
|
||||
const fieldType& sendField =
|
||||
this->db().objectRegistry::lookupObject<fieldType>(fieldName);
|
||||
sendValues = sendField.boundaryField()[patchID];
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"directMappedFixedValueFvPatchField<Type>::updateCoeffs()"
|
||||
)<< "patch can only be used in NEARESTCELL or NEARESTPATCHFACE "
|
||||
<< "mode" << nl << abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
forAll(schedule, i)
|
||||
{
|
||||
@ -174,11 +206,7 @@ void directMappedFixedValueFvPatchField<Type>::updateCoeffs()
|
||||
if (Pstream::myProcNo() == sendProc)
|
||||
{
|
||||
OPstream toProc(Pstream::blocking, recvProc);
|
||||
toProc<< IndirectList<Type>
|
||||
(
|
||||
this->internalField(),
|
||||
sendLabels[recvProc]
|
||||
)();
|
||||
toProc<< IndirectList<Type>(sendValues, sendLabels[recvProc])();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -201,12 +229,8 @@ void directMappedFixedValueFvPatchField<Type>::updateCoeffs()
|
||||
|
||||
// Do data from myself
|
||||
{
|
||||
IndirectList<Type> fromFld
|
||||
(
|
||||
this->internalField(),
|
||||
sendLabels[Pstream::myProcNo()]
|
||||
);
|
||||
|
||||
IndirectList<Type> fromFld(sendValues, sendLabels[Pstream::myProcNo()]);
|
||||
|
||||
// Destination faces
|
||||
const labelList& faceLabels = receiveFaceLabels[Pstream::myProcNo()];
|
||||
|
||||
@ -220,7 +244,7 @@ void directMappedFixedValueFvPatchField<Type>::updateCoeffs()
|
||||
|
||||
if (setAverage_)
|
||||
{
|
||||
Type averagePsi =
|
||||
Type averagePsi =
|
||||
gSum(this->patch().magSf()*newValues)
|
||||
/gSum(this->patch().magSf());
|
||||
|
||||
|
||||
@ -271,7 +271,19 @@ public:
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Offset vector (from patch faces to internal cells)
|
||||
//- What to sample
|
||||
const sampleMode& mode() const
|
||||
{
|
||||
return mode_;
|
||||
}
|
||||
|
||||
//- Patch (only if NEARESTBOUNDARY)
|
||||
const word& samplePatch() const
|
||||
{
|
||||
return samplePatch_;
|
||||
}
|
||||
|
||||
//- Offset vector (from patch faces to destination mesh objects)
|
||||
const vector& offset() const
|
||||
{
|
||||
return offset_;
|
||||
@ -290,11 +302,18 @@ public:
|
||||
//- Cells/faces to sample per processor
|
||||
const labelListList& sendLabels() const
|
||||
{
|
||||
Pout<< "Asking for sendLabels." << endl;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Asking for sendLabels." << endl;
|
||||
}
|
||||
|
||||
if (!sendLabelsPtr_.valid())
|
||||
{
|
||||
Pout<< "Calculating mapping." << endl;
|
||||
calcMapping();
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Calculating mapping." << endl;
|
||||
calcMapping();
|
||||
}
|
||||
}
|
||||
return sendLabelsPtr_();
|
||||
}
|
||||
@ -302,11 +321,18 @@ public:
|
||||
//- Patch faces to receive per processor
|
||||
const labelListList& receiveFaceLabels() const
|
||||
{
|
||||
Pout<< "Asking for receiveFaceLabels." << endl;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Asking for receiveFaceLabels." << endl;
|
||||
}
|
||||
|
||||
if (!receiveFaceLabelsPtr_.valid())
|
||||
{
|
||||
Pout<< "Calculating mapping." << endl;
|
||||
calcMapping();
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Calculating mapping." << endl;
|
||||
calcMapping();
|
||||
}
|
||||
}
|
||||
return receiveFaceLabelsPtr_();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user