mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: mapFieldsPar: map (global) constraint patches
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -35,6 +35,88 @@ License
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void evaluateConstraintTypes(GeometricField<Type, fvPatchField, volMesh>& fld)
|
||||||
|
{
|
||||||
|
typename GeometricField<Type, fvPatchField, volMesh>::
|
||||||
|
GeometricBoundaryField& fldBf = fld.boundaryField();
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
Pstream::defaultCommsType == Pstream::blocking
|
||||||
|
|| Pstream::defaultCommsType == Pstream::nonBlocking
|
||||||
|
)
|
||||||
|
{
|
||||||
|
label nReq = Pstream::nRequests();
|
||||||
|
|
||||||
|
forAll(fldBf, patchi)
|
||||||
|
{
|
||||||
|
fvPatchField<Type>& tgtField = fldBf[patchi];
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
tgtField.type() == tgtField.patch().patch().type()
|
||||||
|
&& polyPatch::constraintType(tgtField.patch().patch().type())
|
||||||
|
)
|
||||||
|
{
|
||||||
|
tgtField.initEvaluate(Pstream::defaultCommsType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Block for any outstanding requests
|
||||||
|
if
|
||||||
|
(
|
||||||
|
Pstream::parRun()
|
||||||
|
&& Pstream::defaultCommsType == Pstream::nonBlocking
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Pstream::waitRequests(nReq);
|
||||||
|
}
|
||||||
|
|
||||||
|
forAll(fldBf, patchi)
|
||||||
|
{
|
||||||
|
fvPatchField<Type>& tgtField = fldBf[patchi];
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
tgtField.type() == tgtField.patch().patch().type()
|
||||||
|
&& polyPatch::constraintType(tgtField.patch().patch().type())
|
||||||
|
)
|
||||||
|
{
|
||||||
|
tgtField.evaluate(Pstream::defaultCommsType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (Pstream::defaultCommsType == Pstream::scheduled)
|
||||||
|
{
|
||||||
|
const lduSchedule& patchSchedule =
|
||||||
|
fld.mesh().globalData().patchSchedule();
|
||||||
|
|
||||||
|
forAll(patchSchedule, patchEvali)
|
||||||
|
{
|
||||||
|
label patchi = patchSchedule[patchEvali].patch;
|
||||||
|
fvPatchField<Type>& tgtField = fldBf[patchi];
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
tgtField.type() == tgtField.patch().patch().type()
|
||||||
|
&& polyPatch::constraintType(tgtField.patch().patch().type())
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (patchSchedule[patchEvali].init)
|
||||||
|
{
|
||||||
|
tgtField.initEvaluate(Pstream::scheduled);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tgtField.evaluate(Pstream::scheduled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type, class CombineOp>
|
template<class Type, class CombineOp>
|
||||||
void MapVolFields
|
void MapVolFields
|
||||||
(
|
(
|
||||||
@ -57,8 +139,6 @@ void MapVolFields
|
|||||||
|
|
||||||
if (selectedFields.empty() || selectedFields.found(fieldName))
|
if (selectedFields.empty() || selectedFields.found(fieldName))
|
||||||
{
|
{
|
||||||
Info<< " interpolating " << fieldName << endl;
|
|
||||||
|
|
||||||
const fieldType fieldSource(*fieldIter(), meshSource);
|
const fieldType fieldSource(*fieldIter(), meshSource);
|
||||||
|
|
||||||
IOobject targetIO
|
IOobject targetIO
|
||||||
@ -71,14 +151,21 @@ void MapVolFields
|
|||||||
|
|
||||||
if (targetIO.typeHeaderOk<fieldType>(true))
|
if (targetIO.typeHeaderOk<fieldType>(true))
|
||||||
{
|
{
|
||||||
|
Info<< " interpolating onto existing field "
|
||||||
|
<< fieldName << endl;
|
||||||
fieldType fieldTarget(targetIO, meshTarget);
|
fieldType fieldTarget(targetIO, meshTarget);
|
||||||
|
|
||||||
interp.mapSrcToTgt(fieldSource, cop, fieldTarget);
|
interp.mapSrcToTgt(fieldSource, cop, fieldTarget);
|
||||||
|
|
||||||
|
evaluateConstraintTypes(fieldTarget);
|
||||||
|
|
||||||
fieldTarget.write();
|
fieldTarget.write();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Info<< " creating new field "
|
||||||
|
<< fieldName << endl;
|
||||||
|
|
||||||
targetIO.readOpt() = IOobject::NO_READ;
|
targetIO.readOpt() = IOobject::NO_READ;
|
||||||
|
|
||||||
tmp<fieldType>
|
tmp<fieldType>
|
||||||
@ -86,6 +173,8 @@ void MapVolFields
|
|||||||
|
|
||||||
fieldType fieldTarget(targetIO, tfieldTarget);
|
fieldType fieldTarget(targetIO, tfieldTarget);
|
||||||
|
|
||||||
|
evaluateConstraintTypes(fieldTarget);
|
||||||
|
|
||||||
fieldTarget.write();
|
fieldTarget.write();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -121,34 +121,6 @@ void mapSubMesh
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wordList addProcessorPatches
|
|
||||||
(
|
|
||||||
const fvMesh& meshTarget,
|
|
||||||
const wordList& cuttingPatches
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// Add the processor patches to the cutting list
|
|
||||||
HashSet<word> cuttingPatchTable;
|
|
||||||
forAll(cuttingPatches, i)
|
|
||||||
{
|
|
||||||
cuttingPatchTable.insert(cuttingPatches[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
const polyBoundaryMesh& pbm = meshTarget.boundaryMesh();
|
|
||||||
|
|
||||||
forAll(pbm, patchI)
|
|
||||||
{
|
|
||||||
if (isA<processorPolyPatch>(pbm[patchI]))
|
|
||||||
{
|
|
||||||
const word& patchName = pbm[patchI].name();
|
|
||||||
cuttingPatchTable.insert(patchName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return cuttingPatchTable.toc();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
@ -369,7 +341,7 @@ int main(int argc, char *argv[])
|
|||||||
meshSource,
|
meshSource,
|
||||||
meshTarget,
|
meshTarget,
|
||||||
patchMap,
|
patchMap,
|
||||||
addProcessorPatches(meshTarget, cuttingPatches),
|
cuttingPatches,
|
||||||
mapMethod,
|
mapMethod,
|
||||||
patchMapMethod,
|
patchMapMethod,
|
||||||
subtract,
|
subtract,
|
||||||
|
|||||||
@ -713,7 +713,11 @@ void Foam::meshToMesh::constructNoCuttingPatches
|
|||||||
forAll(srcBM, patchI)
|
forAll(srcBM, patchI)
|
||||||
{
|
{
|
||||||
const polyPatch& pp = srcBM[patchI];
|
const polyPatch& pp = srcBM[patchI];
|
||||||
if (!polyPatch::constraintType(pp.type()))
|
|
||||||
|
// We want to map all the global patches, including constraint
|
||||||
|
// patches (since they might have mappable properties, e.g.
|
||||||
|
// jumpCyclic). We'll fix the value afterwards.
|
||||||
|
if (!isA<processorPolyPatch>(pp))
|
||||||
{
|
{
|
||||||
srcPatchID.append(pp.index());
|
srcPatchID.append(pp.index());
|
||||||
|
|
||||||
@ -764,7 +768,10 @@ void Foam::meshToMesh::constructFromCuttingPatches
|
|||||||
|
|
||||||
const polyPatch& srcPatch = srcRegion_.boundaryMesh()[srcPatchName];
|
const polyPatch& srcPatch = srcRegion_.boundaryMesh()[srcPatchName];
|
||||||
|
|
||||||
if (!polyPatch::constraintType(srcPatch.type()))
|
// We want to map all the global patches, including constraint
|
||||||
|
// patches (since they might have mappable properties, e.g.
|
||||||
|
// jumpCyclic). We'll fix the value afterwards.
|
||||||
|
if (!isA<processorPolyPatch>(srcPatch))
|
||||||
{
|
{
|
||||||
const polyPatch& tgtPatch = tgtRegion_.boundaryMesh()[tgtPatchName];
|
const polyPatch& tgtPatch = tgtRegion_.boundaryMesh()[tgtPatchName];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user