mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: volSurfaceMapping: new mapToField and mapToSurface funcs
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -65,6 +65,36 @@ Foam::tmp<Foam::Field<Type>> Foam::volSurfaceMapping::mapToSurface
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>> Foam::volSurfaceMapping::mapToSurface
|
||||
(
|
||||
const Field<Type>& f
|
||||
) const
|
||||
{
|
||||
const labelList& faceLabels = mesh_.faceLabels();
|
||||
|
||||
auto tresult = tmp<Field<Type>>::New(faceLabels.size(), Zero);
|
||||
auto& result = tresult.ref();
|
||||
|
||||
const polyMesh& pMesh = mesh_();
|
||||
const polyBoundaryMesh& bm = pMesh.boundaryMesh();
|
||||
label patchID, faceID;
|
||||
|
||||
forAll(faceLabels, i)
|
||||
{
|
||||
if (faceLabels[i] < pMesh.nFaces())
|
||||
{
|
||||
patchID = bm.whichPatch(faceLabels[i]);
|
||||
faceID = bm[patchID].whichFace(faceLabels[i]);
|
||||
|
||||
result[i] = f[faceID];
|
||||
}
|
||||
}
|
||||
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>> Foam::volSurfaceMapping::mapInternalToSurface
|
||||
(
|
||||
@ -151,6 +181,19 @@ void Foam::volSurfaceMapping::mapToField
|
||||
const GeometricField<Type, faPatchField, areaMesh>& af,
|
||||
Field<Type>& f
|
||||
) const
|
||||
{
|
||||
const Field<Type>& afi = af.internalField();
|
||||
|
||||
mapToField(afi, f);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::volSurfaceMapping::mapToField
|
||||
(
|
||||
const Field<Type>& af,
|
||||
Field<Type>& f
|
||||
) const
|
||||
{
|
||||
const labelList& faceLabels = mesh_.faceLabels();
|
||||
|
||||
@ -158,15 +201,13 @@ void Foam::volSurfaceMapping::mapToField
|
||||
const polyBoundaryMesh& bm = pMesh.boundaryMesh();
|
||||
label patchID, faceID;
|
||||
|
||||
const Field<Type>& afi = af.internalField();
|
||||
|
||||
forAll(faceLabels, i)
|
||||
{
|
||||
if (faceLabels[i] < pMesh.nFaces())
|
||||
{
|
||||
patchID = bm.whichPatch(faceLabels[i]);
|
||||
faceID = bm[patchID].whichFace(faceLabels[i]);
|
||||
f[faceID] = afi[i];
|
||||
f[faceID] = af[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -42,6 +42,7 @@ SourceFiles
|
||||
#define volSurfaceMapping_H
|
||||
|
||||
#include "faMesh.H"
|
||||
#include "volMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -85,7 +86,7 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Map droplet cloud sources to surface
|
||||
//- Map Boundary field to surface
|
||||
template<class Type>
|
||||
tmp<Field<Type>> mapToSurface
|
||||
(
|
||||
@ -93,6 +94,9 @@ public:
|
||||
GeometricField<Type, fvPatchField, volMesh>::Boundary& df
|
||||
) const;
|
||||
|
||||
//- Map vol Field to surface Field
|
||||
template<class Type>
|
||||
tmp<Field<Type>> mapToSurface(const Field<Type>& f) const;
|
||||
|
||||
//- Map patch internal field to surface
|
||||
template<class Type>
|
||||
@ -118,14 +122,23 @@ public:
|
||||
typename GeometricField<Type, fvPatchField, volMesh>::Boundary& bf
|
||||
) const;
|
||||
|
||||
//- Map surface field to field assumes Field
|
||||
//- faces in the same order as Boundary
|
||||
//- Map surface field to field
|
||||
// Assumes Field faces in the same order as Boundary
|
||||
template<class Type>
|
||||
void mapToField
|
||||
(
|
||||
const GeometricField<Type, faPatchField, areaMesh>& af,
|
||||
Field<Type>& f
|
||||
) const;
|
||||
|
||||
//- Map surface field to volume field
|
||||
// Assumes Field faces in the same order as Boundary
|
||||
template<class Type>
|
||||
void mapToField
|
||||
(
|
||||
const Field<Type>& af,
|
||||
Field<Type>& f
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user