mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: redistributePar: suppress warning. Fixes #1937.
This commit is contained in:
@ -372,7 +372,9 @@ void Foam::fvMeshDistribute::sendFields
|
||||
const GeoField& fld =
|
||||
subsetter.baseMesh().lookupObject<GeoField>(fieldName);
|
||||
|
||||
tmp<GeoField> tsubfld = subsetter.interpolate(fld);
|
||||
// Note: use subsetter to get sub field. Override default behaviour
|
||||
// to warn for unset fields since they will be reset later on
|
||||
tmp<GeoField> tsubfld = subsetter.interpolate(fld, true);
|
||||
|
||||
toNbr
|
||||
<< fieldName << token::NL << token::BEGIN_BLOCK
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -339,7 +339,8 @@ public:
|
||||
|
||||
// Field Mapping
|
||||
|
||||
//- Map volume field
|
||||
//- Map volume field. Optionally allow unmapped faces not to produce
|
||||
// a warning
|
||||
template<class Type>
|
||||
static tmp<GeometricField<Type, fvPatchField, volMesh>>
|
||||
interpolate
|
||||
@ -348,14 +349,16 @@ public:
|
||||
const fvMesh& sMesh,
|
||||
const labelUList& patchMap,
|
||||
const labelUList& cellMap,
|
||||
const labelUList& faceMap
|
||||
const labelUList& faceMap,
|
||||
const bool allowUnmapped = false
|
||||
);
|
||||
|
||||
template<class Type>
|
||||
tmp<GeometricField<Type, fvPatchField, volMesh>>
|
||||
interpolate
|
||||
(
|
||||
const GeometricField<Type, fvPatchField, volMesh>&
|
||||
const GeometricField<Type, fvPatchField, volMesh>&,
|
||||
const bool allowUnmapped = false
|
||||
) const;
|
||||
|
||||
//- Map surface field. Optionally negates value if flipping
|
||||
@ -371,11 +374,14 @@ public:
|
||||
const labelUList& faceMap
|
||||
);
|
||||
|
||||
//- Map surface field. Optionally allow unmapped faces not to produce
|
||||
// a warning (not currently used)
|
||||
template<class Type>
|
||||
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>
|
||||
interpolate
|
||||
(
|
||||
const GeometricField<Type, fvsPatchField, surfaceMesh>&
|
||||
const GeometricField<Type, fvsPatchField, surfaceMesh>&,
|
||||
const bool allowUnmapped = false
|
||||
) const;
|
||||
|
||||
//- Map point field
|
||||
@ -389,11 +395,14 @@ public:
|
||||
const labelUList& pointMap
|
||||
);
|
||||
|
||||
//- Map point field. Optionally allow unmapped points not to produce
|
||||
// a warning (not currently used)
|
||||
template<class Type>
|
||||
tmp<GeometricField<Type, pointPatchField, pointMesh>>
|
||||
interpolate
|
||||
(
|
||||
const GeometricField<Type, pointPatchField, pointMesh>&
|
||||
const GeometricField<Type, pointPatchField, pointMesh>&,
|
||||
const bool allowUnmapped = false
|
||||
) const;
|
||||
|
||||
//- Map dimensioned field
|
||||
@ -406,9 +415,14 @@ public:
|
||||
const labelUList& cellMap
|
||||
);
|
||||
|
||||
//- Map Dimensioned. Optional unmapped argument not used
|
||||
template<class Type>
|
||||
tmp<DimensionedField<Type, volMesh>>
|
||||
interpolate(const DimensionedField<Type, volMesh>&) const;
|
||||
interpolate
|
||||
(
|
||||
const DimensionedField<Type, volMesh>&,
|
||||
const bool allowUnmapped = false
|
||||
) const;
|
||||
|
||||
|
||||
// Compatibility
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -47,7 +47,8 @@ Foam::fvMeshSubset::interpolate
|
||||
const fvMesh& sMesh,
|
||||
const labelUList& patchMap,
|
||||
const labelUList& cellMap,
|
||||
const labelUList& faceMap
|
||||
const labelUList& faceMap,
|
||||
const bool allowUnmapped
|
||||
)
|
||||
{
|
||||
// 1. Create the complete field with dummy patch fields
|
||||
@ -139,6 +140,17 @@ Foam::fvMeshSubset::interpolate
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
directFvPatchFieldMapper mapper(directAddressing);
|
||||
|
||||
// allowUnmapped : special mode for if we do not want to be
|
||||
// warned for unmapped faces (e.g. from fvMeshDistribute).
|
||||
const bool hasUnmapped = mapper.hasUnmapped();
|
||||
if (allowUnmapped)
|
||||
{
|
||||
mapper.hasUnmapped() = false;
|
||||
}
|
||||
|
||||
bf.set
|
||||
(
|
||||
patchi,
|
||||
@ -147,9 +159,30 @@ Foam::fvMeshSubset::interpolate
|
||||
vf.boundaryField()[basePatchId],
|
||||
subPatch,
|
||||
result(),
|
||||
directFvPatchFieldMapper(directAddressing)
|
||||
mapper
|
||||
)
|
||||
);
|
||||
|
||||
if (allowUnmapped && hasUnmapped)
|
||||
{
|
||||
// Set unmapped values to zeroGradient. This is the default
|
||||
// action for unmapped fvPatchFields. Note that this bypasses
|
||||
// any special logic for handling unmapped fvPatchFields but
|
||||
// since this is only used inside fvMeshDistribute ...
|
||||
|
||||
tmp<Field<Type>> tfld(bf[patchi].patchInternalField());
|
||||
const Field<Type>& fld = tfld();
|
||||
|
||||
Field<Type> value(bf[patchi]);
|
||||
forAll(directAddressing, i)
|
||||
{
|
||||
if (directAddressing[i] == -1)
|
||||
{
|
||||
value[i] = fld[i];
|
||||
}
|
||||
}
|
||||
bf[patchi].fvPatchField<Type>::operator=(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -164,7 +197,8 @@ Foam::tmp
|
||||
>
|
||||
Foam::fvMeshSubset::interpolate
|
||||
(
|
||||
const GeometricField<Type, fvPatchField, volMesh>& vf
|
||||
const GeometricField<Type, fvPatchField, volMesh>& vf,
|
||||
const bool allowUnmapped
|
||||
) const
|
||||
{
|
||||
return interpolate
|
||||
@ -173,7 +207,8 @@ Foam::fvMeshSubset::interpolate
|
||||
subMesh(),
|
||||
patchMap(),
|
||||
cellMap(),
|
||||
faceMap()
|
||||
faceMap(),
|
||||
allowUnmapped
|
||||
);
|
||||
}
|
||||
|
||||
@ -347,7 +382,8 @@ Foam::tmp
|
||||
>
|
||||
Foam::fvMeshSubset::interpolate
|
||||
(
|
||||
const GeometricField<Type, fvsPatchField, surfaceMesh>& sf
|
||||
const GeometricField<Type, fvsPatchField, surfaceMesh>& sf,
|
||||
const bool allowUnmapped
|
||||
) const
|
||||
{
|
||||
return interpolate
|
||||
@ -499,7 +535,8 @@ Foam::tmp
|
||||
>
|
||||
Foam::fvMeshSubset::interpolate
|
||||
(
|
||||
const GeometricField<Type, pointPatchField, pointMesh>& sf
|
||||
const GeometricField<Type, pointPatchField, pointMesh>& sf,
|
||||
const bool allowUnmapped
|
||||
) const
|
||||
{
|
||||
return interpolate
|
||||
@ -551,7 +588,8 @@ Foam::tmp
|
||||
>
|
||||
Foam::fvMeshSubset::interpolate
|
||||
(
|
||||
const DimensionedField<Type, volMesh>& df
|
||||
const DimensionedField<Type, volMesh>& df,
|
||||
const bool allowUnmapped
|
||||
) const
|
||||
{
|
||||
return interpolate(df, subMesh(), cellMap());
|
||||
|
||||
Reference in New Issue
Block a user