ENH: support slicing for finiteArea fields
This commit is contained in:
parent
c206b12c80
commit
0190fed56b
@ -1,7 +1,9 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/finiteArea/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lfiniteArea \
|
||||
-lmeshTools
|
||||
|
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -34,31 +35,86 @@ Description
|
||||
#include "SlicedGeometricField.H"
|
||||
#include "slicedFvPatchFields.H"
|
||||
#include "slicedSurfaceFields.H"
|
||||
#include "slicedVolFields.H"
|
||||
|
||||
#include "areaFaMesh.H"
|
||||
#include "areaFields.H"
|
||||
#include "edgeFields.H"
|
||||
#include "slicedAreaFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::addBoolOption
|
||||
(
|
||||
"finite-area",
|
||||
"Test finite-area mesh/fields"
|
||||
);
|
||||
#include "setRootCase.H"
|
||||
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
|
||||
Info<< "Reading field p\n" << endl;
|
||||
volScalarField p
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
if (args.found("finite-area"))
|
||||
{
|
||||
autoPtr<faMesh> faMeshPtr(faMesh::TryNew(mesh));
|
||||
|
||||
//Info<< min(p, p);
|
||||
if (!faMeshPtr)
|
||||
{
|
||||
Info<< "Stop: no finiteArea" << nl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto& aMesh = faMeshPtr();
|
||||
|
||||
Info<< "Test with finiteArea" << nl;
|
||||
|
||||
(void)aMesh.areaCentres(),
|
||||
(void)aMesh.faceAreaNormals();
|
||||
|
||||
vectorField flatBoundary(aMesh.nBoundaryEdges(), Zero);
|
||||
|
||||
{
|
||||
const auto& bfld = aMesh.faceAreaNormals().boundaryField();
|
||||
|
||||
forAll(aMesh.boundary(), patchi)
|
||||
{
|
||||
const auto& src = bfld[patchi];
|
||||
const auto& p = aMesh.boundary()[patchi];
|
||||
|
||||
vectorList::subList out = p.boundarySlice(flatBoundary);
|
||||
|
||||
if (out.size() == src.size())
|
||||
{
|
||||
out = src;
|
||||
}
|
||||
}
|
||||
}
|
||||
flatBoundary *= 100;
|
||||
|
||||
|
||||
slicedAreaVectorField foo
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"centres",
|
||||
runTime.timeName(),
|
||||
aMesh.thisDb(),
|
||||
IOobject::NO_REGISTER
|
||||
),
|
||||
aMesh,
|
||||
dimLength,
|
||||
aMesh.areaCentres(),
|
||||
flatBoundary
|
||||
);
|
||||
|
||||
Info<< "Weird combination of centres and normals!" << nl << nl;
|
||||
foo.writeData(Info.stream());
|
||||
|
||||
Info<< "Done" << nl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Info<< "Reading field U\n" << endl;
|
||||
volVectorField U
|
||||
@ -67,15 +123,13 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
mesh.thisDb(),
|
||||
IOobject::MUST_READ
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
SlicedGeometricField<vector, fvPatchField, slicedFvPatchField, volMesh>
|
||||
C
|
||||
slicedVolVectorField C
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -92,14 +146,7 @@ int main(int argc, char *argv[])
|
||||
Info<< C << endl;
|
||||
Info<< (C & U) << endl;
|
||||
|
||||
SlicedGeometricField
|
||||
<
|
||||
vector,
|
||||
fvsPatchField,
|
||||
slicedFvsPatchField,
|
||||
surfaceMesh
|
||||
>
|
||||
Sf
|
||||
slicedSurfaceVectorField Sf
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
Copyright (C) 2022-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -27,7 +27,6 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "SlicedGeometricField.H"
|
||||
#include "processorFvPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
@ -38,41 +37,67 @@ template
|
||||
template<class> class SlicedPatchField,
|
||||
class GeoMesh
|
||||
>
|
||||
Foam::tmp<Foam::FieldField<PatchField, Type>>
|
||||
bool
|
||||
Foam::SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>::
|
||||
slicedBoundaryField
|
||||
isBoundaryAddressing
|
||||
(
|
||||
const Mesh& mesh,
|
||||
const Field<Type>& completeField,
|
||||
const bool preserveCouples,
|
||||
const bool preserveProcessorOnly
|
||||
const label fieldSize
|
||||
)
|
||||
{
|
||||
label maxAddress(0);
|
||||
|
||||
if (!mesh.boundary().empty())
|
||||
{
|
||||
const auto& p = mesh.boundary().back();
|
||||
maxAddress = (p.start() + p.size());
|
||||
}
|
||||
|
||||
// If field size appear to not include internal field
|
||||
return (fieldSize < maxAddress);
|
||||
}
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
class Type,
|
||||
template<class> class PatchField,
|
||||
template<class> class SlicedPatchField,
|
||||
class GeoMesh
|
||||
>
|
||||
Foam::tmp<Foam::FieldField<PatchField, Type>>
|
||||
Foam::SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>::
|
||||
makeBoundary
|
||||
(
|
||||
const Mesh& mesh,
|
||||
const Field<Type>& completeOrBoundaryField,
|
||||
const bool preserveCouples,
|
||||
const bool preserveProcessorOnly,
|
||||
const bool isBoundaryOnly
|
||||
) const
|
||||
{
|
||||
typedef typename
|
||||
SlicedPatchField<Type>::processorPatchType
|
||||
processorPatchType;
|
||||
|
||||
auto tbf = tmp<FieldField<PatchField, Type>>::New(mesh.boundary().size());
|
||||
auto& bf = tbf.ref();
|
||||
|
||||
forAll(mesh.boundary(), patchi)
|
||||
{
|
||||
const auto& p = mesh.boundary()[patchi];
|
||||
|
||||
if
|
||||
(
|
||||
preserveCouples
|
||||
&& mesh.boundary()[patchi].coupled()
|
||||
&& (
|
||||
!preserveProcessorOnly
|
||||
|| isA<processorFvPatch>(mesh.boundary()[patchi])
|
||||
)
|
||||
preserveCouples && p.coupled()
|
||||
&& (!preserveProcessorOnly || isA<processorPatchType>(p))
|
||||
)
|
||||
{
|
||||
// For coupled patched construct the correct patch field type
|
||||
bf.set
|
||||
(
|
||||
patchi,
|
||||
PatchField<Type>::New
|
||||
(
|
||||
mesh.boundary()[patchi].type(),
|
||||
mesh.boundary()[patchi],
|
||||
*this
|
||||
)
|
||||
PatchField<Type>::New(p.type(), p, *this)
|
||||
);
|
||||
|
||||
// Initialize the values on the coupled patch to those of the slice
|
||||
@ -81,9 +106,10 @@ slicedBoundaryField
|
||||
// evaluation e.g. in the case of processor and cyclic patches.
|
||||
bf[patchi] = SlicedPatchField<Type>
|
||||
(
|
||||
mesh.boundary()[patchi],
|
||||
p,
|
||||
DimensionedField<Type, GeoMesh>::null(),
|
||||
completeField
|
||||
completeOrBoundaryField,
|
||||
isBoundaryOnly
|
||||
);
|
||||
}
|
||||
else
|
||||
@ -93,9 +119,10 @@ slicedBoundaryField
|
||||
patchi,
|
||||
new SlicedPatchField<Type>
|
||||
(
|
||||
mesh.boundary()[patchi],
|
||||
p,
|
||||
DimensionedField<Type, GeoMesh>::null(),
|
||||
completeField
|
||||
completeOrBoundaryField,
|
||||
isBoundaryOnly
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -114,30 +141,27 @@ template
|
||||
>
|
||||
Foam::tmp<Foam::FieldField<PatchField, Type>>
|
||||
Foam::SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>::
|
||||
slicedBoundaryField
|
||||
makeBoundary
|
||||
(
|
||||
const Mesh& mesh,
|
||||
const FieldField<PatchField, Type>& bField,
|
||||
const bool preserveCouples
|
||||
)
|
||||
) const
|
||||
{
|
||||
auto tbf = tmp<FieldField<PatchField, Type>>::New(mesh.boundary().size());
|
||||
auto& bf = tbf.ref();
|
||||
|
||||
forAll(mesh.boundary(), patchi)
|
||||
{
|
||||
if (preserveCouples && mesh.boundary()[patchi].coupled())
|
||||
const auto& p = mesh.boundary()[patchi];
|
||||
|
||||
if (preserveCouples && p.coupled())
|
||||
{
|
||||
// For coupled patched construct the correct patch field type
|
||||
bf.set
|
||||
(
|
||||
patchi,
|
||||
PatchField<Type>::New
|
||||
(
|
||||
mesh.boundary()[patchi].type(),
|
||||
mesh.boundary()[patchi],
|
||||
*this
|
||||
)
|
||||
PatchField<Type>::New(p.type(), p, *this)
|
||||
);
|
||||
|
||||
// Assign field
|
||||
@ -151,7 +175,7 @@ slicedBoundaryField
|
||||
patchi,
|
||||
new SlicedPatchField<Type>
|
||||
(
|
||||
mesh.boundary()[patchi],
|
||||
p,
|
||||
DimensionedField<Type, GeoMesh>::null(),
|
||||
bField[patchi]
|
||||
)
|
||||
@ -188,7 +212,9 @@ SlicedGeometricField
|
||||
mesh,
|
||||
ds,
|
||||
Field<Type>(),
|
||||
slicedBoundaryField(mesh, completeField, preserveCouples)
|
||||
// preserveProcessorOnly = false
|
||||
// isBoundaryOnly = false
|
||||
makeBoundary(mesh, completeField, preserveCouples)
|
||||
)
|
||||
{
|
||||
// Set internalField to the slice of the complete field
|
||||
@ -226,12 +252,13 @@ SlicedGeometricField
|
||||
mesh,
|
||||
ds,
|
||||
Field<Type>(),
|
||||
slicedBoundaryField
|
||||
makeBoundary
|
||||
(
|
||||
mesh,
|
||||
completeBField,
|
||||
preserveCouples,
|
||||
preserveProcessorOnly
|
||||
preserveProcessorOnly,
|
||||
isBoundaryAddressing(mesh, completeBField.size())
|
||||
)
|
||||
)
|
||||
{
|
||||
@ -266,7 +293,7 @@ SlicedGeometricField
|
||||
gf.mesh(),
|
||||
gf.dimensions(),
|
||||
Field<Type>(),
|
||||
slicedBoundaryField(gf.mesh(), gf.boundaryField(), preserveCouples)
|
||||
makeBoundary(gf.mesh(), gf.boundaryField(), preserveCouples)
|
||||
)
|
||||
{
|
||||
// Set internalField to the internal field
|
||||
@ -295,7 +322,8 @@ SlicedGeometricField
|
||||
gf.mesh(),
|
||||
gf.dimensions(),
|
||||
Field<Type>(),
|
||||
slicedBoundaryField(gf.mesh(), gf.boundaryField(), true)
|
||||
// preserveCouples = true
|
||||
makeBoundary(gf.mesh(), gf.boundaryField(), true)
|
||||
)
|
||||
{
|
||||
// Set internalField to the internal field
|
||||
|
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017,2022 OpenFOAM Foundation
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -83,26 +84,32 @@ private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Slice the given field and a create a PtrList of SlicedPatchField
|
||||
// from which the boundary field is built
|
||||
tmp<FieldField<PatchField, Type>>
|
||||
slicedBoundaryField
|
||||
(
|
||||
const Mesh& mesh,
|
||||
const Field<Type>& completeField,
|
||||
const bool preserveCouples,
|
||||
const bool preserveProcessorOnly = false
|
||||
);
|
||||
//- Return true if field size is too small to be the complete field
|
||||
//- (ie, it must be boundary field addressing)
|
||||
static bool
|
||||
isBoundaryAddressing(const Mesh& mesh, const label fieldSize);
|
||||
|
||||
//- Slice the given field and a create a PtrList of SlicedPatchField
|
||||
// from which the boundary field is built
|
||||
tmp<FieldField<PatchField, Type>>
|
||||
slicedBoundaryField
|
||||
makeBoundary
|
||||
(
|
||||
const Mesh& mesh,
|
||||
const Field<Type>& completeOrBoundaryField,
|
||||
const bool preserveCouples,
|
||||
const bool preserveProcessorOnly = false,
|
||||
const bool isBoundaryOnly = false
|
||||
) const;
|
||||
|
||||
//- Slice the given field and a create a PtrList of SlicedPatchField
|
||||
// from which the boundary field is built
|
||||
tmp<FieldField<PatchField, Type>>
|
||||
makeBoundary
|
||||
(
|
||||
const Mesh& mesh,
|
||||
const FieldField<PatchField, Type>& bField,
|
||||
const bool preserveCouples
|
||||
);
|
||||
) const;
|
||||
|
||||
// Note - copy construct allowed
|
||||
|
||||
@ -135,7 +142,7 @@ public:
|
||||
const Mesh&,
|
||||
const dimensionSet&,
|
||||
const Field<Type>& completeField,
|
||||
const bool preserveCouples=true
|
||||
const bool preserveCouples = true
|
||||
);
|
||||
|
||||
//- Construct from components and separate fields to slice for the
|
||||
@ -147,7 +154,7 @@ public:
|
||||
const dimensionSet&,
|
||||
const Field<Type>& completeIField,
|
||||
const Field<Type>& completeBField,
|
||||
const bool preserveCouples=true,
|
||||
const bool preserveCouples = true,
|
||||
const bool preserveProcessorOnly = false
|
||||
);
|
||||
|
||||
@ -157,7 +164,7 @@ public:
|
||||
(
|
||||
const IOobject&,
|
||||
const GeometricField<Type, PatchField, GeoMesh>&,
|
||||
const bool preserveCouples=true
|
||||
const bool preserveCouples = true
|
||||
);
|
||||
|
||||
//- Copy construct
|
||||
|
@ -49,6 +49,7 @@ $(basicFaPatchFields)/zeroGradient/zeroGradientFaPatchFields.C
|
||||
$(basicFaPatchFields)/fixedValue/fixedValueFaPatchFields.C
|
||||
$(basicFaPatchFields)/fixedGradient/fixedGradientFaPatchFields.C
|
||||
$(basicFaPatchFields)/mixed/mixedFaPatchFields.C
|
||||
$(basicFaPatchFields)/sliced/slicedFaPatchFields.C
|
||||
$(basicFaPatchFields)/transform/transformFaPatchFields.C
|
||||
|
||||
constraintFaPatchFields = $(faPatchFields)/constraint
|
||||
@ -74,6 +75,7 @@ basicFaePatchFields = $(faePatchFields)/basic
|
||||
$(basicFaePatchFields)/calculated/calculatedFaePatchFields.C
|
||||
$(basicFaePatchFields)/coupled/coupledFaePatchFields.C
|
||||
$(basicFaePatchFields)/fixedValue/fixedValueFaePatchFields.C
|
||||
$(basicFaePatchFields)/sliced/slicedFaePatchFields.C
|
||||
|
||||
constraintFaePatchFields = $(faePatchFields)/constraint
|
||||
$(constraintFaePatchFields)/empty/emptyFaePatchFields.C
|
||||
|
41
src/finiteArea/fields/areaFields/slicedAreaFields.H
Normal file
41
src/finiteArea/fields/areaFields/slicedAreaFields.H
Normal file
@ -0,0 +1,41 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
InClass
|
||||
Foam::slicedAreaFields
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Foam_slicedAreaFields_H
|
||||
#define Foam_slicedAreaFields_H
|
||||
|
||||
#include "SlicedGeometricField.H"
|
||||
#include "slicedFaPatchField.H"
|
||||
#include "areaFaMesh.H"
|
||||
#include "slicedAreaFieldsFwd.H"
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
99
src/finiteArea/fields/areaFields/slicedAreaFieldsFwd.H
Normal file
99
src/finiteArea/fields/areaFields/slicedAreaFieldsFwd.H
Normal file
@ -0,0 +1,99 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
Forwards and collection of common sliced area field types
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Foam_slicedAreaFieldsFwd_H
|
||||
#define Foam_slicedAreaFieldsFwd_H
|
||||
|
||||
#include "fieldTypes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
template
|
||||
<
|
||||
class Type,
|
||||
template<class> class PatchField,
|
||||
template<class> class SlicedPatchField,
|
||||
class GeoMesh
|
||||
>
|
||||
class SlicedGeometricField;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Forward Declarations
|
||||
class areaMesh;
|
||||
template<class Type> class faPatchField;
|
||||
template<class Type> class slicedFaPatchField;
|
||||
|
||||
//- An aree field slice for a given type
|
||||
template<class Type>
|
||||
using AreaSliceField =
|
||||
SlicedGeometricField<Type, faPatchField, slicedFaPatchField, areaMesh>;
|
||||
|
||||
|
||||
// Typedefs
|
||||
|
||||
typedef
|
||||
SlicedGeometricField
|
||||
<scalar, faPatchField, slicedFaPatchField, areaMesh>
|
||||
slicedAreaScalarField;
|
||||
|
||||
typedef
|
||||
SlicedGeometricField
|
||||
<vector, faPatchField, slicedFaPatchField, areaMesh>
|
||||
slicedAreaVectorField;
|
||||
|
||||
typedef
|
||||
SlicedGeometricField
|
||||
<sphericalTensor, faPatchField, slicedFaPatchField, areaMesh>
|
||||
slicedAreaSphericalTensorField;
|
||||
|
||||
typedef
|
||||
SlicedGeometricField
|
||||
<symmTensor, faPatchField, slicedFaPatchField, areaMesh>
|
||||
slicedAreaSymmTensorField;
|
||||
|
||||
typedef
|
||||
SlicedGeometricField
|
||||
<tensor, faPatchField, slicedFaPatchField, areaMesh>
|
||||
slicedAreaTensorField;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
98
src/finiteArea/fields/edgeFields/slicedEdgeFields.H
Normal file
98
src/finiteArea/fields/edgeFields/slicedEdgeFields.H
Normal file
@ -0,0 +1,98 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
InClass
|
||||
Foam::slicedEdgeFields
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Foam_slicedEdgeFields_H
|
||||
#define Foam_slicedEdgeFields_H
|
||||
|
||||
#include "SlicedGeometricField.H"
|
||||
#include "slicedFaePatchField.H"
|
||||
#include "edgeFaMesh.H"
|
||||
#include "slicedEdgeFieldsFwd.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<>
|
||||
inline void
|
||||
SlicedGeometricField<scalar, faePatchField, slicedFaePatchField, edgeMesh>::
|
||||
correctBoundaryConditions()
|
||||
{}
|
||||
|
||||
template<>
|
||||
inline void
|
||||
SlicedGeometricField<vector, faePatchField, slicedFaePatchField, edgeMesh>::
|
||||
correctBoundaryConditions()
|
||||
{}
|
||||
|
||||
template<>
|
||||
inline void
|
||||
SlicedGeometricField
|
||||
<
|
||||
sphericalTensor,
|
||||
faePatchField,
|
||||
slicedFaePatchField,
|
||||
edgeMesh
|
||||
>::
|
||||
correctBoundaryConditions()
|
||||
{}
|
||||
|
||||
template<>
|
||||
inline void
|
||||
SlicedGeometricField
|
||||
<
|
||||
symmTensor,
|
||||
faePatchField,
|
||||
slicedFaePatchField,
|
||||
edgeMesh
|
||||
>::
|
||||
correctBoundaryConditions()
|
||||
{}
|
||||
|
||||
template<>
|
||||
inline void
|
||||
SlicedGeometricField<tensor, faePatchField, slicedFaePatchField, edgeMesh>::
|
||||
correctBoundaryConditions()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
101
src/finiteArea/fields/edgeFields/slicedEdgeFieldsFwd.H
Normal file
101
src/finiteArea/fields/edgeFields/slicedEdgeFieldsFwd.H
Normal file
@ -0,0 +1,101 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
Forwards and collection of common sliced edge field types
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Foam_slicedEdgeFieldsFwd_H
|
||||
#define Foam_slicedEdgeFieldsFwd_H
|
||||
|
||||
#include "fieldTypes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
template
|
||||
<
|
||||
class Type,
|
||||
template<class> class PatchField,
|
||||
template<class> class SlicedPatchField,
|
||||
class GeoMesh
|
||||
>
|
||||
class SlicedGeometricField;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Forward Declarations
|
||||
class edgeMesh;
|
||||
template<class Type> class faePatchField;
|
||||
template<class Type> class slicedFaePatchField;
|
||||
|
||||
|
||||
//- A (volume) surface field slice for a given type
|
||||
template<class Type>
|
||||
using EdgeSliceField =
|
||||
SlicedGeometricField<Type, faePatchField, slicedFaePatchField, edgeMesh>;
|
||||
|
||||
|
||||
// Typedefs
|
||||
|
||||
typedef
|
||||
SlicedGeometricField
|
||||
<scalar, faePatchField, slicedFaePatchField, edgeMesh>
|
||||
slicedEdgeScalarField;
|
||||
|
||||
typedef
|
||||
SlicedGeometricField
|
||||
<vector, faePatchField, slicedFaePatchField, edgeMesh>
|
||||
slicedEdgeVectorField;
|
||||
|
||||
typedef
|
||||
SlicedGeometricField
|
||||
<sphericalTensor, faePatchField, slicedFaePatchField, edgeMesh>
|
||||
slicedEdgeSphericalTensorField;
|
||||
|
||||
typedef
|
||||
SlicedGeometricField
|
||||
<symmTensor, faePatchField, slicedFaePatchField, edgeMesh>
|
||||
slicedEdgeSymmTensorField;
|
||||
|
||||
typedef
|
||||
SlicedGeometricField
|
||||
<tensor, faePatchField, slicedFaePatchField, edgeMesh>
|
||||
slicedEdgeTensorField;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,272 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "slicedFaPatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::slicedFaPatchField<Type>::slicedFaPatchField
|
||||
(
|
||||
const faPatch& p,
|
||||
const DimensionedField<Type, areaMesh>& iF,
|
||||
const Field<Type>& completeOrBoundaryField,
|
||||
const bool isBoundaryOnly
|
||||
)
|
||||
:
|
||||
faPatchField<Type>(p, iF, Field<Type>())
|
||||
{
|
||||
if (isBoundaryOnly)
|
||||
{
|
||||
// Set to a slice of the boundary field
|
||||
UList<Type>::shallowCopy(p.boundarySlice(completeOrBoundaryField));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set to a slice of the complete field
|
||||
UList<Type>::shallowCopy(p.patchSlice(completeOrBoundaryField));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::slicedFaPatchField<Type>::slicedFaPatchField
|
||||
(
|
||||
const faPatch& p,
|
||||
const DimensionedField<Type, areaMesh>& iF
|
||||
)
|
||||
:
|
||||
faPatchField<Type>(p, iF, Field<Type>())
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::slicedFaPatchField<Type>::slicedFaPatchField
|
||||
(
|
||||
const faPatch& p,
|
||||
const DimensionedField<Type, areaMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
faPatchField<Type>(p, iF) // bypass dictionary constructor
|
||||
{
|
||||
faPatchFieldBase::readDict(dict);
|
||||
// Read "value" if present...
|
||||
|
||||
NotImplemented;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::slicedFaPatchField<Type>::slicedFaPatchField
|
||||
(
|
||||
const slicedFaPatchField<Type>& ptf,
|
||||
const faPatch& p,
|
||||
const DimensionedField<Type, areaMesh>& iF,
|
||||
const faPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
faPatchField<Type>(ptf, p, iF, mapper)
|
||||
{
|
||||
NotImplemented;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::slicedFaPatchField<Type>::slicedFaPatchField
|
||||
(
|
||||
const slicedFaPatchField<Type>& ptf,
|
||||
const DimensionedField<Type, areaMesh>& iF
|
||||
)
|
||||
:
|
||||
faPatchField<Type>(ptf.patch(), iF, Field<Type>())
|
||||
{
|
||||
// Transfer the slice from the argument
|
||||
UList<Type>::shallowCopy(ptf);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::faPatchField<Type>>
|
||||
Foam::slicedFaPatchField<Type>::clone() const
|
||||
{
|
||||
return tmp<faPatchField<Type>>
|
||||
(
|
||||
new slicedFaPatchField<Type>(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::slicedFaPatchField<Type>::slicedFaPatchField
|
||||
(
|
||||
const slicedFaPatchField<Type>& ptf
|
||||
)
|
||||
:
|
||||
faPatchField<Type>
|
||||
(
|
||||
ptf.patch(),
|
||||
ptf.internalField(),
|
||||
Field<Type>()
|
||||
)
|
||||
{
|
||||
// Transfer the slice from the argument
|
||||
UList<Type>::shallowCopy(ptf);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::faPatchField<Type>>
|
||||
Foam::slicedFaPatchField<Type>::clone
|
||||
(
|
||||
const DimensionedField<Type, areaMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<faPatchField<Type>>
|
||||
(
|
||||
new slicedFaPatchField<Type>(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::slicedFaPatchField<Type>::~slicedFaPatchField()
|
||||
{
|
||||
// Set to nullptr to avoid deletion of underlying field
|
||||
UList<Type>::shallowCopy(UList<Type>());
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>> Foam::slicedFaPatchField<Type>::snGrad() const
|
||||
{
|
||||
NotImplemented;
|
||||
|
||||
return Field<Type>::null();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>>
|
||||
Foam::slicedFaPatchField<Type>::patchInternalField() const
|
||||
{
|
||||
NotImplemented;
|
||||
|
||||
return Field<Type>::null();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::slicedFaPatchField<Type>::patchInternalField(Field<Type>&) const
|
||||
{
|
||||
NotImplemented;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>>
|
||||
Foam::slicedFaPatchField<Type>::patchNeighbourField
|
||||
(
|
||||
const Field<Type>& iField
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
|
||||
return Field<Type>::null();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>>
|
||||
Foam::slicedFaPatchField<Type>::patchNeighbourField() const
|
||||
{
|
||||
NotImplemented;
|
||||
|
||||
return Field<Type>::null();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>>
|
||||
Foam::slicedFaPatchField<Type>::valueInternalCoeffs
|
||||
(
|
||||
const tmp<scalarField>&
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
|
||||
return Field<Type>::null();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>>
|
||||
Foam::slicedFaPatchField<Type>::valueBoundaryCoeffs
|
||||
(
|
||||
const tmp<scalarField>&
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
|
||||
return Field<Type>::null();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>>
|
||||
Foam::slicedFaPatchField<Type>::gradientInternalCoeffs() const
|
||||
{
|
||||
NotImplemented;
|
||||
|
||||
return Field<Type>::null();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>>
|
||||
Foam::slicedFaPatchField<Type>::gradientBoundaryCoeffs() const
|
||||
{
|
||||
NotImplemented;
|
||||
|
||||
return Field<Type>::null();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::slicedFaPatchField<Type>::write(Ostream& os) const
|
||||
{
|
||||
faPatchField<Type>::write(os);
|
||||
this->writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,253 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::slicedFaPatchField
|
||||
|
||||
Group
|
||||
grpGenericBoundaryConditions
|
||||
|
||||
Description
|
||||
Specialization of faPatchField which creates the underlying
|
||||
faPatchField as a slice of the given complete field.
|
||||
|
||||
The destructor is wrapped to avoid deallocation of the storage of the
|
||||
complete fields when this is destroyed.
|
||||
|
||||
Should only used as a template argument for SlicedGeometricField.
|
||||
|
||||
See also
|
||||
Foam::faPatchField
|
||||
|
||||
SourceFiles
|
||||
slicedFaPatchField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Foam_slicedFaPatchField_H
|
||||
#define Foam_slicedFaPatchField_H
|
||||
|
||||
#include "faPatchField.H"
|
||||
#include "processorFaPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class slicedFaPatchField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
class slicedFaPatchField
|
||||
:
|
||||
public faPatchField<Type>
|
||||
{
|
||||
public:
|
||||
|
||||
//- Type for the mesh processor patch
|
||||
typedef processorFaPatch processorPatchType;
|
||||
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("sliced");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch, internal field and field to slice
|
||||
slicedFaPatchField
|
||||
(
|
||||
const faPatch&,
|
||||
const DimensionedField<Type, areaMesh>&,
|
||||
const Field<Type>& completeOrBoundaryField,
|
||||
const bool isBoundaryOnly = false
|
||||
);
|
||||
|
||||
//- Construct from patch and internal field. Assign value later.
|
||||
slicedFaPatchField
|
||||
(
|
||||
const faPatch&,
|
||||
const DimensionedField<Type, areaMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
slicedFaPatchField
|
||||
(
|
||||
const faPatch&,
|
||||
const DimensionedField<Type, areaMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping the given slicedFaPatchField<Type>
|
||||
// onto a new patch
|
||||
slicedFaPatchField
|
||||
(
|
||||
const slicedFaPatchField<Type>&,
|
||||
const faPatch&,
|
||||
const DimensionedField<Type, areaMesh>&,
|
||||
const faPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
slicedFaPatchField(const slicedFaPatchField<Type>&);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<faPatchField<Type>> clone() const;
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
slicedFaPatchField
|
||||
(
|
||||
const slicedFaPatchField<Type>&,
|
||||
const DimensionedField<Type, areaMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<faPatchField<Type>> clone
|
||||
(
|
||||
const DimensionedField<Type, areaMesh>& iF
|
||||
) const;
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~slicedFaPatchField<Type>();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Attributes
|
||||
|
||||
//- True: this patch field fixes a value.
|
||||
virtual bool fixesValue() const { return true; }
|
||||
|
||||
//- False: this patch field is not altered by assignment
|
||||
virtual bool assignable() const { return false; }
|
||||
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Return patch-normal gradient
|
||||
virtual tmp<Field<Type>> snGrad() const;
|
||||
|
||||
//- Return internal field next to patch as patch field
|
||||
virtual tmp<Field<Type>> patchInternalField() const;
|
||||
|
||||
//- Return internal field next to patch as patch field
|
||||
virtual void patchInternalField(Field<Type>&) const;
|
||||
|
||||
//- Return neighbour coupled given internal cell data
|
||||
virtual tmp<Field<Type>> patchNeighbourField
|
||||
(
|
||||
const Field<Type>& iField
|
||||
) const;
|
||||
|
||||
//- Return patchField of the values on the patch or on the
|
||||
// opposite patch
|
||||
virtual tmp<Field<Type>> patchNeighbourField() const;
|
||||
|
||||
//- Initialise the evaluation of the patch field
|
||||
virtual void initEvaluate
|
||||
(
|
||||
const Pstream::commsTypes commsType =
|
||||
Pstream::commsTypes::blocking
|
||||
)
|
||||
{}
|
||||
|
||||
//- Evaluate the patch field, sets Updated to false
|
||||
virtual void evaluate
|
||||
(
|
||||
const Pstream::commsTypes commsType =
|
||||
Pstream::commsTypes::blocking
|
||||
)
|
||||
{}
|
||||
|
||||
//- Return the matrix diagonal coefficients corresponding to the
|
||||
// evaluation of the value of this patchField with given weights
|
||||
virtual tmp<Field<Type>> valueInternalCoeffs
|
||||
(
|
||||
const tmp<scalarField>&
|
||||
) const;
|
||||
|
||||
//- Return the matrix source coefficients corresponding to the
|
||||
// evaluation of the value of this patchField with given weights
|
||||
virtual tmp<Field<Type>> valueBoundaryCoeffs
|
||||
(
|
||||
const tmp<scalarField>&
|
||||
) const;
|
||||
|
||||
//- Return the matrix diagonal coefficients corresponding to the
|
||||
// evaluation of the gradient of this patchField
|
||||
virtual tmp<Field<Type>> gradientInternalCoeffs() const;
|
||||
|
||||
//- Return the matrix source coefficients corresponding to the
|
||||
// evaluation of the gradient of this patchField
|
||||
virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
|
||||
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
virtual void operator=(const UList<Type>&) {}
|
||||
|
||||
virtual void operator=(const faPatchField<Type>&) {}
|
||||
virtual void operator+=(const faPatchField<Type>&) {}
|
||||
virtual void operator-=(const faPatchField<Type>&) {}
|
||||
virtual void operator*=(const faPatchField<scalar>&) {}
|
||||
virtual void operator/=(const faPatchField<scalar>&) {}
|
||||
|
||||
virtual void operator+=(const Field<Type>&) {}
|
||||
virtual void operator-=(const Field<Type>&) {}
|
||||
|
||||
virtual void operator*=(const Field<scalar>&) {}
|
||||
virtual void operator/=(const Field<scalar>&) {}
|
||||
|
||||
virtual void operator=(const Type&) {}
|
||||
virtual void operator+=(const Type&) {}
|
||||
virtual void operator-=(const Type&) {}
|
||||
virtual void operator*=(const scalar) {}
|
||||
virtual void operator/=(const scalar) {}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "slicedFaPatchField.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,39 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "slicedFaPatchFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "areaFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makeFaPatchFieldsTypeName(sliced);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,50 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Foam_slicedFaPatchFields_H
|
||||
#define Foam_slicedFaPatchFields_H
|
||||
|
||||
#include "slicedFaPatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makeFaPatchTypeFieldTypedefs(sliced);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,167 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "slicedFaePatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::slicedFaePatchField<Type>::slicedFaePatchField
|
||||
(
|
||||
const faPatch& p,
|
||||
const DimensionedField<Type, edgeMesh>& iF,
|
||||
const Field<Type>& completeOrBoundaryField,
|
||||
const bool isBoundaryOnly
|
||||
)
|
||||
:
|
||||
faePatchField<Type>(p, iF, Field<Type>())
|
||||
{
|
||||
if (isBoundaryOnly)
|
||||
{
|
||||
// Set to a slice of the boundary field
|
||||
UList<Type>::shallowCopy(p.boundarySlice(completeOrBoundaryField));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set to a slice of the complete field
|
||||
UList<Type>::shallowCopy(p.patchSlice(completeOrBoundaryField));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::slicedFaePatchField<Type>::slicedFaePatchField
|
||||
(
|
||||
const faPatch& p,
|
||||
const DimensionedField<Type, edgeMesh>& iF
|
||||
)
|
||||
:
|
||||
faePatchField<Type>(p, iF)
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::slicedFaePatchField<Type>::slicedFaePatchField
|
||||
(
|
||||
const faPatch& p,
|
||||
const DimensionedField<Type, edgeMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
faePatchField<Type>(p, iF) // bypass dictionary constructor
|
||||
{
|
||||
faePatchFieldBase::readDict(dict);
|
||||
// Read "value" if present...
|
||||
|
||||
NotImplemented;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::slicedFaePatchField<Type>::slicedFaePatchField
|
||||
(
|
||||
const slicedFaePatchField<Type>& ptf,
|
||||
const faPatch& p,
|
||||
const DimensionedField<Type, edgeMesh>& iF,
|
||||
const faPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
faePatchField<Type>(ptf, p, iF, mapper)
|
||||
{
|
||||
NotImplemented;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::slicedFaePatchField<Type>::slicedFaePatchField
|
||||
(
|
||||
const slicedFaePatchField<Type>& ptf,
|
||||
const DimensionedField<Type, edgeMesh>& iF
|
||||
)
|
||||
:
|
||||
faePatchField<Type>(ptf.patch(), iF, Field<Type>())
|
||||
{
|
||||
// Transfer the slice from the argument
|
||||
UList<Type>::shallowCopy(ptf);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::faePatchField<Type>>
|
||||
Foam::slicedFaePatchField<Type>::clone() const
|
||||
{
|
||||
return tmp<faePatchField<Type>>
|
||||
(
|
||||
new slicedFaePatchField<Type>(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::slicedFaePatchField<Type>::slicedFaePatchField
|
||||
(
|
||||
const slicedFaePatchField<Type>& ptf
|
||||
)
|
||||
:
|
||||
faePatchField<Type>
|
||||
(
|
||||
ptf.patch(),
|
||||
ptf.internalField(),
|
||||
Field<Type>()
|
||||
)
|
||||
{
|
||||
// Transfer the slice from the argument
|
||||
UList<Type>::shallowCopy(ptf);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::faePatchField<Type>>
|
||||
Foam::slicedFaePatchField<Type>::clone
|
||||
(
|
||||
const DimensionedField<Type, edgeMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<faePatchField<Type>>
|
||||
(
|
||||
new slicedFaePatchField<Type>(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::slicedFaePatchField<Type>::~slicedFaePatchField()
|
||||
{
|
||||
// Set to nullptr to avoid deletion of underlying field
|
||||
UList<Type>::shallowCopy(UList<Type>());
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,180 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::slicedFaePatchField
|
||||
|
||||
Description
|
||||
Specialization of faePatchField which creates the underlying
|
||||
faePatchField as a slice of the given complete field.
|
||||
|
||||
The destructor is wrapped to avoid deallocation of the storage of the
|
||||
complete fields when this is destroyed.
|
||||
|
||||
Should only used as a template argument for SlicedGeometricField.
|
||||
|
||||
SourceFiles
|
||||
slicedFaePatchField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Foam_slicedFaePatchField_H
|
||||
#define Foam_slicedFaePatchField_H
|
||||
|
||||
#include "faePatchField.H"
|
||||
#include "processorFaPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class slicedFaePatchField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
class slicedFaePatchField
|
||||
:
|
||||
public faePatchField<Type>
|
||||
{
|
||||
public:
|
||||
|
||||
//- Type for the mesh processor patch
|
||||
typedef processorFaPatch processorPatchType;
|
||||
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("sliced");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch, internal field and field to slice
|
||||
slicedFaePatchField
|
||||
(
|
||||
const faPatch&,
|
||||
const DimensionedField<Type, edgeMesh>&,
|
||||
const Field<Type>& completeOrBoundaryField,
|
||||
const bool isBoundaryOnly = false
|
||||
);
|
||||
|
||||
//- Construct from patch and internal field
|
||||
slicedFaePatchField
|
||||
(
|
||||
const faPatch&,
|
||||
const DimensionedField<Type, edgeMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
slicedFaePatchField
|
||||
(
|
||||
const faPatch&,
|
||||
const DimensionedField<Type, edgeMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping the given slicedFaePatchField<Type>
|
||||
// onto a new patch
|
||||
slicedFaePatchField
|
||||
(
|
||||
const slicedFaePatchField<Type>&,
|
||||
const faPatch&,
|
||||
const DimensionedField<Type, edgeMesh>&,
|
||||
const faPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
slicedFaePatchField(const slicedFaePatchField<Type>&);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<faePatchField<Type>> clone() const;
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
slicedFaePatchField
|
||||
(
|
||||
const slicedFaePatchField<Type>&,
|
||||
const DimensionedField<Type, edgeMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<faePatchField<Type>> clone
|
||||
(
|
||||
const DimensionedField<Type, edgeMesh>& iF
|
||||
) const;
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~slicedFaePatchField<Type>();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Attributes
|
||||
|
||||
//- True: this patch field fixes a value.
|
||||
virtual bool fixesValue() const { return true; }
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
virtual void operator=(const UList<Type>&) {}
|
||||
|
||||
virtual void operator=(const faePatchField<Type>&) {}
|
||||
virtual void operator+=(const faePatchField<Type>&) {}
|
||||
virtual void operator-=(const faePatchField<Type>&) {}
|
||||
virtual void operator*=(const faePatchField<scalar>&) {}
|
||||
virtual void operator/=(const faePatchField<scalar>&) {}
|
||||
|
||||
virtual void operator+=(const Field<Type>&) {}
|
||||
virtual void operator-=(const Field<Type>&) {}
|
||||
|
||||
virtual void operator*=(const Field<scalar>&) {}
|
||||
virtual void operator/=(const Field<scalar>&) {}
|
||||
|
||||
virtual void operator=(const Type&) {}
|
||||
virtual void operator+=(const Type&) {}
|
||||
virtual void operator-=(const Type&) {}
|
||||
virtual void operator*=(const scalar) {}
|
||||
virtual void operator/=(const scalar) {}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "slicedFaePatchField.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,39 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "slicedFaePatchFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "faePatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makeFaePatchFields(sliced);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,58 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
InClass
|
||||
Foam::slicedFaePatchFields
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
slicedFaePatchFields.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Foam_slicedFaePatchFields_H
|
||||
#define Foam_slicedFaePatchFields_H
|
||||
|
||||
#include "slicedFaePatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makeFaePatchTypeFieldTypedefs(sliced);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
Loading…
Reference in New Issue
Block a user