Compare commits

...

10 Commits

Author SHA1 Message Date
Mark Olesen
c3aecfab81 WIP: fv fields 2023-03-09 17:55:32 +00:00
Mark Olesen
e655231e24 WIP ENH: base infrastructure for label point fields 2023-03-09 17:55:32 +00:00
Mark Olesen
7cf553ca00 WIP ENH: core-level definitions for geometric label fields
- this are to be used for bookkeeping purposes, not to solve on
2023-03-09 17:55:32 +00:00
Mark Olesen
64d1bd7488 WIP: edge field 2023-03-09 17:55:32 +00:00
Mark Olesen
ce602d340b WIP area fields 2023-03-09 17:55:32 +00:00
Mark Olesen
64e5b7f626 WIP: surface (fvs) fields 2023-03-09 17:55:32 +00:00
Mark Olesen
b36c9897b2 ...ENH: base support for volume label fields
- for bookkeeping purposes (not to solve on), and thus only basic
  types: (calculated empty processor symmetry zeroGradient)
2023-03-09 17:55:32 +00:00
Mark Olesen
e505abfb30 ENH: base support for point label fields
- for bookkeeping purposes (not to solve on), and thus only basic
  types: (calculated empty processor symmetry zeroGradient)
2023-03-09 17:55:32 +00:00
Mark Olesen
2ec8a44fad WIP: uniformMixed + finiteArea uniformFixedGradient 2023-03-09 17:55:32 +00:00
Mark Olesen
2ea26ffadf ENH: remove specialisations for scalar symmetry/transform patch fields
- previously used template specialisations, but now simply check
  pTrait<Type>::rank == 0. This aids for future extension to support
  other scalar-like fields.
2023-03-09 17:55:32 +00:00
125 changed files with 2247 additions and 662 deletions

View File

@ -39,7 +39,6 @@ Description
int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createTime.H"
@ -47,11 +46,42 @@ int main(int argc, char *argv[])
const pointMesh& pMesh = pointMesh::New(mesh);
#if 1
pointLabelField state
(
IOobject
(
"test-state",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
pMesh
);
#else
pointLabelField state
(
IOobject
(
"test-state",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
pMesh,
dimensioned<label>(dimLength, 1),
pointPatchLabelField::calculatedType()
);
state.write();
#endif
pointVectorField U
(
IOobject
(
"U",
"test-U",
runTime.timeName(),
mesh,
IOobject::NO_READ,
@ -62,6 +92,8 @@ int main(int argc, char *argv[])
pointPatchVectorField::calculatedType()
);
U.write();
pointVectorField V(U + 2*U);
Info<< "End\n" << endl;

View File

@ -224,73 +224,21 @@ int main(int argc, char *argv[])
<< lerp(vector::uniform(0), vector::uniform(100), 0.5) << nl;
}
{
const lerpOp1<vector> half(0.5);
const vector a(vector::uniform(20));
const vector b(vector::uniform(100));
Info<< "lerp half: "
<< a << " : " << b << " => " << half(a, b) << nl;
}
{
const labelVector a(labelVector::uniform(10000));
const labelVector b(labelVector::uniform(1));
Info<< "lerp (labelVector) = "
Info<<"lerp (labelVector) = "
<< lerp(a, b, 0.1) << nl;
}
{
const scalar a(0);
const scalar b(100);
Info<< "lerp of " << a << " : " << b << nl;
for (const double t : { 0.0, 0.5, 1.0, -0.5, 1.5 })
{
Info<< " " << t << " = " << lerp(a, b, t) << nl;
}
}
// No yet
#if 0
{
const label a(10000);
const label b(1);
Info<<"lerp (label) = "
<< label(lerp(a, b, 0.1)) << nl;
}
{
const bool a(true);
const bool b(false);
Info<<"lerp (bool) = "
<< (lerp(a, b, 0.5)) << nl;
}
#endif
{
const sphericalTensor a(10), b(20);
Info<<"lerp exact: "
<< (a == lerp(a, b, 0.0f)) << " "
<< (b == lerp(a, b, 1.0f)) << nl;
// Info<< "lerp: "
// << lerp(vector::uniform(0), vector::uniform(100), 0.5) << nl;
}
{
const tensor a(tensor::uniform(1e24));
const tensor b(tensor::uniform(0));
Info<<"lerp exact: "
<< (a == lerp(a, b, 0.0f)) << " "
<< (b == lerp(a, b, 1.0f)) << nl;
//
// Info<< "lerp: "
// << lerp(vector::uniform(0), vector::uniform(100), 0.5) << nl;
}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -33,12 +34,14 @@ License
namespace Foam
{
defineTemplateTypeNameAndDebug(pointLabelField::Internal, 0);
defineTemplateTypeNameAndDebug(pointScalarField::Internal, 0);
defineTemplateTypeNameAndDebug(pointVectorField::Internal, 0);
defineTemplateTypeNameAndDebug(pointSphericalTensorField::Internal, 0);
defineTemplateTypeNameAndDebug(pointSymmTensorField::Internal, 0);
defineTemplateTypeNameAndDebug(pointTensorField::Internal, 0);
defineTemplateTypeNameAndDebug(pointLabelField, 0);
defineTemplateTypeNameAndDebug(pointScalarField, 0);
defineTemplateTypeNameAndDebug(pointVectorField, 0);
defineTemplateTypeNameAndDebug(pointSphericalTensorField, 0);
@ -54,6 +57,7 @@ defineTemplateTypeNameAndDebug(pointTensorField, 0);
const Foam::wordList Foam::fieldTypes::point
({
"pointLabelField",
"pointScalarField",
"pointVectorField",
"pointSphericalTensorField",

View File

@ -33,8 +33,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef pointFields_H
#define pointFields_H
#ifndef Foam_pointFields_H
#define Foam_pointFields_H
#include "GeometricFields.H"
#include "pointMesh.H"

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2018-2022 OpenCFD Ltd.
Copyright (C) 2018-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -80,6 +80,7 @@ using PointInternalField = DimensionedField<Type, pointMesh>;
// Typedefs
typedef GeometricField<label, pointPatchField, pointMesh> pointLabelField;
typedef GeometricField<scalar, pointPatchField, pointMesh> pointScalarField;
typedef GeometricField<vector, pointPatchField, pointMesh> pointVectorField;
typedef GeometricField<sphericalTensor, pointPatchField, pointMesh>

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -29,7 +30,6 @@ License
#include "transformField.H"
#include "symmTransformField.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
@ -87,15 +87,17 @@ void Foam::basicSymmetryPointPatchField<Type>::evaluate
const Pstream::commsTypes
)
{
const vectorField& nHat = this->patch().pointNormals();
if (pTraits<Type>::rank == 0)
{
// Transform-invariant types
return;
}
tmp<Field<Type>> tvalues =
(
(
this->patchInternalField()
+ transform(I - 2.0*sqr(nHat), this->patchInternalField())
)/2.0
);
Field<Type> pif(this->patchInternalField());
symmTensorField rot(I - 2.0*sqr(this->patch().pointNormals()));
tmp<Field<Type>> tvalues = (pif + transform(rot, pif))/2.0;
// Get internal field to insert values into
Field<Type>& iF = const_cast<Field<Type>&>(this->primitiveField());

View File

@ -34,8 +34,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef basicSymmetryPointPatchField_H
#define basicSymmetryPointPatchField_H
#ifndef Foam_basicSymmetryPointPatchField_H
#define Foam_basicSymmetryPointPatchField_H
#include "pointPatchField.H"
#include "symmetryPointPatch.H"
@ -54,7 +54,6 @@ class basicSymmetryPointPatchField
:
public pointPatchField<Type>
{
public:
// Constructors

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -29,17 +30,12 @@ License
#include "pointPatchFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePointPatchFields(calculated);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
makePointPatchFields(calculated);
makePointPatchFieldType(label, calculated);
}
// ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -25,11 +26,10 @@ License
\*---------------------------------------------------------------------------*/
#ifndef calculatedPointPatchFields_H
#define calculatedPointPatchFields_H
#ifndef Foam_calculatedPointPatchFields_H
#define Foam_calculatedPointPatchFields_H
#include "calculatedPointPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -39,6 +39,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePointPatchFieldTypedefs(calculated);
makePointPatchFieldTypedef(label, calculated);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -26,18 +27,15 @@ License
\*---------------------------------------------------------------------------*/
#include "coupledPointPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
#include "pointPatchFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePointPatchFieldsTypeName(coupled);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
namespace Foam
{
makePointPatchFieldsTypeName(coupled);
makePointPatchFieldTypeName(label, coupled);
}
// ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -25,12 +26,10 @@ License
\*---------------------------------------------------------------------------*/
#ifndef coupledPointPatchFields_H
#define coupledPointPatchFields_H
#ifndef Foam_coupledPointPatchFields_H
#define Foam_coupledPointPatchFields_H
#include "coupledPointPatchField.H"
#include "coupledPointPatch.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -40,6 +39,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePointPatchFieldTypedefs(coupled);
makePointPatchFieldTypedef(label, coupled);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -27,7 +27,6 @@ License
\*---------------------------------------------------------------------------*/
#include "fixedValuePointPatchField.H"
#include "boolList.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -29,17 +30,12 @@ License
#include "pointPatchFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePointPatchFields(value);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
makePointPatchFields(value);
makePointPatchFieldTypeName(label, value);
}
// ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -25,11 +26,10 @@ License
\*---------------------------------------------------------------------------*/
#ifndef valuePointPatchFields_H
#define valuePointPatchFields_H
#ifndef Foam_valuePointPatchFields_H
#define Foam_valuePointPatchFields_H
#include "valuePointPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -39,6 +39,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePointPatchFieldTypedefs(value);
makePointPatchFieldTypedef(label, value);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -29,17 +30,12 @@ License
#include "pointPatchFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePointPatchFields(zeroGradient);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
makePointPatchFields(zeroGradient);
makePointPatchFieldType(label, zeroGradient);
}
// ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -25,11 +26,10 @@ License
\*---------------------------------------------------------------------------*/
#ifndef zeroGradientPointPatchFields_H
#define zeroGradientPointPatchFields_H
#ifndef Foam_zeroGradientPointPatchFields_H
#define Foam_zeroGradientPointPatchFields_H
#include "zeroGradientPointPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -39,6 +39,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePointPatchFieldTypedefs(zeroGradient);
makePointPatchFieldTypedef(label, zeroGradient);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -29,17 +30,12 @@ License
#include "pointPatchFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePointPatchFields(empty);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
makePointPatchFieldsTypeName(empty);
makePointPatchFieldTypeName(label, empty);
}
// ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -25,11 +26,10 @@ License
\*---------------------------------------------------------------------------*/
#ifndef emptyPointPatchFields_H
#define emptyPointPatchFields_H
#ifndef Foam_emptyPointPatchFields_H
#define Foam_emptyPointPatchFields_H
#include "emptyPointPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -39,6 +39,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePointPatchFieldTypedefs(empty);
makePointPatchFieldTypedef(label, empty);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -29,17 +30,12 @@ License
#include "pointPatchFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePointPatchFields(processor);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
makePointPatchFields(processor);
makePointPatchFieldType(label, processor);
}
// ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -25,11 +26,10 @@ License
\*---------------------------------------------------------------------------*/
#ifndef processorPointPatchFields_H
#define processorPointPatchFields_H
#ifndef Foam_processorPointPatchFields_H
#define Foam_processorPointPatchFields_H
#include "processorPointPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -39,6 +39,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePointPatchFieldTypedefs(processor);
makePointPatchFieldTypedef(label, processor);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -29,17 +30,12 @@ License
#include "pointPatchFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePointPatchFields(symmetry);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
makePointPatchFields(symmetry);
makePointPatchFieldType(label, symmetry);
}
// ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -25,11 +26,10 @@ License
\*---------------------------------------------------------------------------*/
#ifndef symmetryPointPatchFields_H
#define symmetryPointPatchFields_H
#ifndef Foam_symmetryPointPatchFields_H
#define Foam_symmetryPointPatchFields_H
#include "symmetryPointPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -39,6 +39,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePointPatchFieldTypedefs(symmetry);
makePointPatchFieldTypedef(label, symmetry);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -106,15 +107,17 @@ void Foam::symmetryPlanePointPatchField<Type>::evaluate
const Pstream::commsTypes
)
{
vector nHat = symmetryPlanePatch_.n();
if (pTraits<Type>::rank == 0)
{
// Transform-invariant types
return;
}
tmp<Field<Type>> tvalues =
(
(
this->patchInternalField()
+ transform(I - 2.0*sqr(nHat), this->patchInternalField())
)/2.0
);
Field<Type> pif(this->patchInternalField());
symmTensor rot(I - 2.0*sqr(symmetryPlanePatch_.n()));
tmp<Field<Type>> tvalues = (pif + transform(rot, pif))/2.0;
// Get internal field to insert values into
Field<Type>& iF = const_cast<Field<Type>&>(this->primitiveField());

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013-2017 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -34,8 +35,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef symmetryPlanePointPatchField_H
#define symmetryPlanePointPatchField_H
#ifndef Foam_symmetryPlanePointPatchField_H
#define Foam_symmetryPlanePointPatchField_H
#include "basicSymmetryPointPatchField.H"
#include "symmetryPlanePointPatch.H"
@ -54,7 +55,7 @@ class symmetryPlanePointPatchField
:
public basicSymmetryPointPatchField<Type>
{
// Private data
// Private Data
//- Local reference cast into the symmetryPlane patch
const symmetryPlanePointPatch& symmetryPlanePatch_;

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -29,17 +30,13 @@ License
#include "pointPatchFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
makePointPatchFields(symmetryPlane);
makePointPatchFieldType(label, symmetryPlane);
}
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePointPatchFields(symmetryPlane);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -25,11 +26,10 @@ License
\*---------------------------------------------------------------------------*/
#ifndef symmetryPlanePointPatchFields_H
#define symmetryPlanePointPatchFields_H
#ifndef Foam_symmetryPlanePointPatchFields_H
#define Foam_symmetryPlanePointPatchFields_H
#include "symmetryPlanePointPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -39,6 +39,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePointPatchFieldTypedefs(symmetryPlane);
makePointPatchFieldTypedef(label, symmetryPlane);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -28,7 +28,6 @@ License
#include "wedgePointPatchField.H"
#include "transformField.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
@ -101,12 +100,18 @@ Foam::wedgePointPatchField<Type>::wedgePointPatchField
template<class Type>
void Foam::wedgePointPatchField<Type>::evaluate(const Pstream::commsTypes)
{
// label, scalar, sphericalTensor are rotationally invariant
if (pTraits<Type>::rank == 0 || std::is_same<sphericalTensor, Type>::value)
{
return;
}
// In order to ensure that the wedge patch is always flat, take the
// normal vector from the first point
const vector& nHat = this->patch().pointNormals()[0];
tmp<Field<Type>> tvalues =
transform(I - nHat*nHat, this->patchInternalField());
symmTensor rot(I - sqr(this->patch().pointNormals()[0]));
tmp<Field<Type>> tvalues = transform(rot, this->patchInternalField());
// Get internal field to insert values into
Field<Type>& iF = const_cast<Field<Type>&>(this->primitiveField());

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -29,17 +30,13 @@ License
#include "pointPatchFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
makePointPatchFields(wedge);
makePointPatchFieldType(label, wedge);
}
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePointPatchFields(wedge);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -25,11 +26,10 @@ License
\*---------------------------------------------------------------------------*/
#ifndef wedgePointPatchFields_H
#define wedgePointPatchFields_H
#ifndef Foam_wedgePointPatchFields_H
#define Foam_wedgePointPatchFields_H
#include "wedgePointPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -39,6 +39,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePointPatchFieldTypedefs(wedge);
makePointPatchFieldTypedef(label, wedge);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -29,17 +30,12 @@ License
#include "pointPatchFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePointPatchFields(slip);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
makePointPatchFields(slip);
makePointPatchFieldType(label, slip);
}
// ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -25,11 +26,10 @@ License
\*---------------------------------------------------------------------------*/
#ifndef slipPointPatchFields_H
#define slipPointPatchFields_H
#ifndef Foam_slipPointPatchFields_H
#define Foam_slipPointPatchFields_H
#include "slipPointPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -39,6 +39,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePointPatchFieldTypedefs(slip);
makePointPatchFieldTypedef(label, slip);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -37,6 +37,7 @@ namespace Foam
defineTemplateRunTimeSelectionTable(PatchTypeField, patchMapper); \
defineTemplateRunTimeSelectionTable(PatchTypeField, dictionary);
makePointPatchField(pointPatchLabelField);
makePointPatchField(pointPatchScalarField);
makePointPatchField(pointPatchVectorField);
makePointPatchField(pointPatchSphericalTensorField);

View File

@ -31,8 +31,6 @@ License
#include "pointPatchField.H"
#include "pointPatchFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -39,6 +40,7 @@ namespace Foam
template<class Type> class pointPatchField;
typedef pointPatchField<label> pointPatchLabelField;
typedef pointPatchField<scalar> pointPatchScalarField;
typedef pointPatchField<vector> pointPatchVectorField;
typedef pointPatchField<sphericalTensor> pointPatchSphericalTensorField;

View File

@ -67,7 +67,9 @@ $(derivedFaPatchFields)/outletInlet/outletInletFaPatchFields.C
$(derivedFaPatchFields)/slip/slipFaPatchFields.C
$(derivedFaPatchFields)/edgeNormalFixedValue/edgeNormalFixedValueFaPatchVectorField.C
$(derivedFaPatchFields)/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFields.C
$(derivedFaPatchFields)/uniformFixedGradient/uniformFixedGradientFaPatchFields.C
$(derivedFaPatchFields)/uniformFixedValue/uniformFixedValueFaPatchFields.C
$(derivedFaPatchFields)/uniformMixed/uniformMixedFaPatchFields.C
$(derivedFaPatchFields)/clampedPlate/clampedPlateFaPatchFields.C
faePatchFields = fields/faePatchFields

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2018-2022 OpenCFD Ltd.
Copyright (C) 2018-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -34,12 +34,14 @@ License
namespace Foam
{
defineTemplateTypeNameAndDebug(areaLabelField::Internal, 0);
defineTemplateTypeNameAndDebug(areaScalarField::Internal, 0);
defineTemplateTypeNameAndDebug(areaVectorField::Internal, 0);
defineTemplateTypeNameAndDebug(areaSphericalTensorField::Internal, 0);
defineTemplateTypeNameAndDebug(areaSymmTensorField::Internal, 0);
defineTemplateTypeNameAndDebug(areaTensorField::Internal, 0);
defineTemplateTypeNameAndDebug(areaLabelField, 0);
defineTemplateTypeNameAndDebug(areaScalarField, 0);
defineTemplateTypeNameAndDebug(areaVectorField, 0);
defineTemplateTypeNameAndDebug(areaSphericalTensorField, 0);

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2018-2022 OpenCFD Ltd.
Copyright (C) 2018-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -75,6 +75,7 @@ using AreaInternalField = DimensionedField<Type, areaMesh>;
// Typedefs
typedef GeometricField<label, faPatchField, areaMesh> areaLabelField;
typedef GeometricField<scalar, faPatchField, areaMesh> areaScalarField;
typedef GeometricField<vector, faPatchField, areaMesh> areaVectorField;
typedef GeometricField<sphericalTensor, faPatchField, areaMesh>

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -33,12 +34,14 @@ License
namespace Foam
{
defineTemplateTypeNameAndDebug(edgeLabelField::Internal, 0);
defineTemplateTypeNameAndDebug(edgeScalarField::Internal, 0);
defineTemplateTypeNameAndDebug(edgeVectorField::Internal, 0);
defineTemplateTypeNameAndDebug(edgeSphericalTensorField::Internal, 0);
defineTemplateTypeNameAndDebug(edgeSymmTensorField::Internal, 0);
defineTemplateTypeNameAndDebug(edgeTensorField::Internal, 0);
defineTemplateTypeNameAndDebug(edgeLabelField, 0);
defineTemplateTypeNameAndDebug(edgeScalarField, 0);
defineTemplateTypeNameAndDebug(edgeVectorField, 0);
defineTemplateTypeNameAndDebug(edgeSphericalTensorField, 0);

View File

@ -60,6 +60,7 @@ template<class Type> class faePatchField;
// Typedefs
typedef GeometricField<label, faePatchField, edgeMesh> edgeLabelField;
typedef GeometricField<scalar, faePatchField, edgeMesh> edgeScalarField;
typedef GeometricField<vector, faePatchField, edgeMesh> edgeVectorField;
typedef GeometricField<sphericalTensor, faePatchField, edgeMesh>

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -95,13 +96,23 @@ template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::basicSymmetryFaPatchField<Type>::snGrad() const
{
const vectorField nHat(this->patch().edgeNormals());
if (pTraits<Type>::rank == 0)
{
// Transform-invariant types
return tmp<Field<Type>>::New(this->size(), Zero);
}
else
{
symmTensorField rot(I - 2.0*sqr(this->patch().edgeNormals()));
return
(
transform(I - 2.0*sqr(nHat), this->patchInternalField())
- this->patchInternalField()
)*(this->patch().deltaCoeffs()/2.0);
Field<Type> pif(this->patchInternalField());
return
(
(transform(rot, pif) - pif)
* (this->patch().deltaCoeffs()/2.0)
);
}
}
@ -113,14 +124,19 @@ void Foam::basicSymmetryFaPatchField<Type>::evaluate(const Pstream::commsTypes)
this->updateCoeffs();
}
const vectorField nHat(this->patch().edgeNormals());
Field<Type>::operator=
(
(
this->patchInternalField()
+ transform(I - 2.0*sqr(nHat), this->patchInternalField())
)/2.0
);
if (pTraits<Type>::rank == 0)
{
// Transform-invariant types
Field<Type>::operator=(this->patchInternalField());
}
else
{
symmTensorField rot(I - 2.0*sqr(this->patch().edgeNormals()));
Field<Type> pif(this->patchInternalField());
Field<Type>::operator=((pif + transform(rot, pif))/2.0);
}
transformFaPatchField<Type>::evaluate();
}

View File

@ -38,8 +38,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef basicSymmetryFaPatchField_H
#define basicSymmetryFaPatchField_H
#ifndef Foam_basicSymmetryFaPatchField_H
#define Foam_basicSymmetryFaPatchField_H
#include "transformFaPatchField.H"
#include "symmetryFaPatch.H"
@ -58,7 +58,6 @@ class basicSymmetryFaPatchField
:
public transformFaPatchField<Type>
{
public:
// Constructors
@ -132,8 +131,6 @@ public:
virtual tmp<Field<Type>> snGrad() const;
//- Evaluate the patch field
// Default argument needed to allow call in constructors
// HJ, 30/Jun/2009
virtual void evaluate
(
const Pstream::commsTypes commsType = Pstream::commsTypes::blocking
@ -144,18 +141,6 @@ public:
};
// * * * * * * * * * * * Template Specialisations * * * * * * * * * * * * * //
template<>
tmp<scalarField> basicSymmetryFaPatchField<scalar>::snGrad() const;
template<>
void basicSymmetryFaPatchField<scalar>::evaluate
(
const Pstream::commsTypes commsType
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -32,28 +32,4 @@ License
// * * * * * * * * * * * * * * * Specialisations * * * * * * * * * * * * * * //
template<>
Foam::tmp<Foam::scalarField>
Foam::basicSymmetryFaPatchField<Foam::scalar>::snGrad() const
{
return tmp<scalarField>::New(size(), Zero);
}
template<>
void Foam::basicSymmetryFaPatchField<Foam::scalar>::evaluate
(
const Pstream::commsTypes
)
{
if (!updated())
{
updateCoeffs();
}
scalarField::operator=(patchInternalField());
transformFaPatchField<scalar>::evaluate();
}
// ************************************************************************* //

View File

@ -30,17 +30,12 @@ License
#include "areaFaMesh.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makeFaPatchFields(calculated);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
makeFaPatchFields(calculated);
makeFaPatchFieldType(label, calculated);
}
// ************************************************************************* //

View File

@ -38,6 +38,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeFaPatchTypeFieldTypedefs(calculated);
makeFaPatchFieldTypedef(label, calculated);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -212,6 +212,27 @@ public:
};
// * * * * * * * * * * * * Template Specialisations * * * * * * * * * * * * //
template<>
tmp<Field<label>> coupledFaPatchField<label>::snGrad() const;
template<>
void coupledFaPatchField<label>::evaluate(const Pstream::commsTypes);
template<>
tmp<Field<label>>
coupledFaPatchField<label>::valueInternalCoeffs(const tmp<scalarField>&) const;
template<>
tmp<Field<label>>
coupledFaPatchField<label>::valueBoundaryCoeffs(const tmp<scalarField>&) const;
template<>
tmp<Field<label>>
coupledFaPatchField<label>::gradientInternalCoeffs() const;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -29,17 +29,70 @@ License
#include "coupledFaPatchFields.H"
#include "areaFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
makeFaPatchFieldsTypeName(coupled);
makeFaPatchFieldTypeName(label, coupled);
}
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Specialisations * * * * * * * * * * * * * * //
makeFaPatchFieldsTypeName(coupled);
template<>
Foam::tmp<Foam::Field<Foam::label>>
Foam::coupledFaPatchField<Foam::label>::snGrad() const
{
// TBD: Treat like zero-gradient
return tmp<Field<label>>::New(this->size(), Zero);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
template<>
void Foam::coupledFaPatchField<Foam::label>::evaluate(const Pstream::commsTypes)
{
if (!this->updated())
{
this->updateCoeffs();
}
// TBD: Treat like zero-gradient
faPatchField<label>::operator=(this->patchInternalField());
faPatchField<label>::evaluate();
}
template<>
Foam::tmp<Foam::Field<Foam::label>>
Foam::coupledFaPatchField<Foam::label>::valueInternalCoeffs
(
const tmp<scalarField>&
) const
{
// TBD: Treat like zero-gradient
return tmp<Field<label>>::New(this->size(), label(1));
}
template<>
Foam::tmp<Foam::Field<Foam::label>>
Foam::coupledFaPatchField<Foam::label>::valueBoundaryCoeffs
(
const tmp<scalarField>&
) const
{
// TBD: Treat like zero-gradient
return tmp<Field<label>>::New(this->size(), Zero);
}
template<>
Foam::tmp<Foam::Field<Foam::label>>
Foam::coupledFaPatchField<Foam::label>::gradientInternalCoeffs() const
{
// TBD: Treat like zero-gradient
return tmp<Field<label>>::New(this->size(), Zero);
}
// ************************************************************************* //

View File

@ -38,6 +38,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeFaPatchTypeFieldTypedefs(coupled);
makeFaPatchFieldTypedef(label, coupled);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -86,6 +86,12 @@ Foam::transformFaPatchField<Type>::valueInternalCoeffs
const tmp<scalarField>&
) const
{
if (pTraits<Type>::rank == 0)
{
// Transform-invariant types
return tmp<Field<Type>>::New(this->size(), pTraits<Type>::one);
}
return pTraits<Type>::one - snGradTransformDiag();
}
@ -111,6 +117,12 @@ template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::transformFaPatchField<Type>::gradientInternalCoeffs() const
{
if (pTraits<Type>::rank == 0)
{
// Transform-invariant types
return tmp<Field<Type>>::New(this->size(), Zero);
}
return -this->patch().deltaCoeffs()*snGradTransformDiag();
}

View File

@ -37,8 +37,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef transformFaPatchField_H
#define transformFaPatchField_H
#ifndef Foam_transformFaPatchField_H
#define Foam_transformFaPatchField_H
#include "faPatchField.H"
#include "areaFaMesh.H"
@ -142,18 +142,12 @@ public:
virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
// Member operators
// Member Operators
virtual void operator=(const faPatchField<Type>&);
};
// * * * * * * * * * * * Template Specialisations * * * * * * * * * * * * * //
template<>
tmp<scalarField> transformFaPatchField<scalar>::gradientInternalCoeffs() const;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -37,14 +37,4 @@ namespace Foam
}
// * * * * * * * * * * * * * * * Specialisations * * * * * * * * * * * * * * //
template<>
Foam::tmp<Foam::scalarField>
Foam::transformFaPatchField<Foam::scalar>::gradientInternalCoeffs() const
{
return tmp<scalarField>::New(size(), Zero);
}
// ************************************************************************* //

View File

@ -132,10 +132,7 @@ public:
//- Return gradient at boundary
virtual tmp<Field<Type>> snGrad() const
{
return tmp<Field<Type>>
(
new Field<Type>(this->size(), Zero)
);
return tmp<Field<Type>>::New(this->size(), Zero);
}
//- Evaluate the patch field

View File

@ -30,17 +30,12 @@ License
#include "areaFaMesh.H"
#include "areaFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makeFaPatchFields(processor);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
makeFaPatchFields(processor);
makeFaPatchFieldType(label, processor);
}
// ************************************************************************* //

View File

@ -38,6 +38,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeFaPatchTypeFieldTypedefs(processor);
makeFaPatchFieldTypedef(label, processor);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -105,13 +106,21 @@ Foam::wedgeFaPatchField<Type>::wedgeFaPatchField
template<class Type>
Foam::tmp<Foam::Field<Type>> Foam::wedgeFaPatchField<Type>::snGrad() const
{
const Field<Type> pif (this->patchInternalField());
if (pTraits<Type>::rank == 0)
{
// Transform-invariant types
return tmp<Field<Type>>::New(this->size(), Zero);
}
else
{
const Field<Type> pif(this->patchInternalField());
return
(
transform(refCast<const wedgeFaPatch>(this->patch()).faceT(), pif)
- pif
)*(0.5*this->patch().deltaCoeffs());
return
(
transform(refCast<const wedgeFaPatch>(this->patch()).faceT(), pif)
- pif
)*(0.5*this->patch().deltaCoeffs());
}
}
@ -123,14 +132,22 @@ void Foam::wedgeFaPatchField<Type>::evaluate(const Pstream::commsTypes)
this->updateCoeffs();
}
faPatchField<Type>::operator==
(
transform
if (pTraits<Type>::rank == 0)
{
// Transform-invariant types
Field<Type>::operator==(this->patchInternalField());
}
else
{
Field<Type>::operator==
(
refCast<const wedgeFaPatch>(this->patch()).edgeT(),
this->patchInternalField()
)
);
transform
(
refCast<const wedgeFaPatch>(this->patch()).edgeT(),
this->patchInternalField()
)
);
}
}

View File

@ -139,18 +139,6 @@ public:
};
// * * * * * * * * * * * Template Specialisations * * * * * * * * * * * * * //
template<>
tmp<scalarField> wedgeFaPatchField<scalar>::snGrad() const;
template<>
void wedgeFaPatchField<scalar>::evaluate
(
const Pstream::commsTypes commsType
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -36,26 +36,5 @@ namespace Foam
makeFaPatchFields(wedge);
}
// * * * * * * * * * * * * * * * Specialisations * * * * * * * * * * * * * * //
template<>
Foam::tmp<Foam::scalarField>
Foam::wedgeFaPatchField<Foam::scalar>::snGrad() const
{
return tmp<scalarField>::New(size(), Zero);
}
template<>
void Foam::wedgeFaPatchField<Foam::scalar>::evaluate(const Pstream::commsTypes)
{
if (!updated())
{
updateCoeffs();
}
this->operator==(patchInternalField());
}
// ************************************************************************* //

View File

@ -0,0 +1,161 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "uniformFixedGradientFaPatchField.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::uniformFixedGradientFaPatchField<Type>::uniformFixedGradientFaPatchField
(
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF
)
:
fixedGradientFaPatchField<Type>(p, iF),
refGradFunc_(nullptr)
{}
template<class Type>
Foam::uniformFixedGradientFaPatchField<Type>::uniformFixedGradientFaPatchField
(
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF,
const Field<Type>& fld
)
:
fixedGradientFaPatchField<Type>(p, iF, fld),
refGradFunc_(nullptr)
{}
template<class Type>
Foam::uniformFixedGradientFaPatchField<Type>::uniformFixedGradientFaPatchField
(
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF,
const dictionary& dict
)
:
fixedGradientFaPatchField<Type>(p, iF),
refGradFunc_
(
Function1<Type>::New
(
/* p.patch(), */
"uniformGradient",
dict
)
)
{
this->evaluate();
}
template<class Type>
Foam::uniformFixedGradientFaPatchField<Type>::uniformFixedGradientFaPatchField
(
const uniformFixedGradientFaPatchField<Type>& ptf,
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF,
const faPatchFieldMapper& mapper
)
:
fixedGradientFaPatchField<Type>(ptf, p, iF, mapper),
refGradFunc_(ptf.refGradFunc_.clone(/*p.patch()*/))
{}
template<class Type>
Foam::uniformFixedGradientFaPatchField<Type>::uniformFixedGradientFaPatchField
(
const uniformFixedGradientFaPatchField<Type>& ptf
)
:
fixedGradientFaPatchField<Type>(ptf),
refGradFunc_(ptf.refGradFunc_.clone(/*p.patch()*/))
{}
template<class Type>
Foam::uniformFixedGradientFaPatchField<Type>::uniformFixedGradientFaPatchField
(
const uniformFixedGradientFaPatchField<Type>& ptf,
const DimensionedField<Type, areaMesh>& iF
)
:
fixedGradientFaPatchField<Type>(ptf, iF),
refGradFunc_(ptf.refGradFunc_.clone(/*this->patch().patch()*/))
{
// Evaluate the profile if defined
if (ptf.refGradFunc_)
{
this->evaluate();
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::uniformFixedGradientFaPatchField<Type>::updateCoeffs()
{
if (this->updated())
{
return;
}
const scalar t = this->db().time().timeOutputValue();
// Extra safety on the evaluation
if (refGradFunc_)
{
this->gradient() = refGradFunc_->value(t);
}
else
{
this->gradient() = Zero;
}
fixedGradientFaPatchField<Type>::updateCoeffs();
}
template<class Type>
void Foam::uniformFixedGradientFaPatchField<Type>::write(Ostream& os) const
{
fixedGradientFaPatchField<Type>::write(os);
if (refGradFunc_)
{
refGradFunc_->writeData(os);
}
faPatchField<Type>::writeValueEntry(os);
}
// ************************************************************************* //

View File

@ -0,0 +1,188 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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/>.
Class
Foam::uniformFixedGradientFaPatchField
Group
grpGenericBoundaryConditions
Description
This boundary condition provides a uniform fixed gradient condition.
Usage
\table
Property | Description | Required | Default
uniformGradient | uniform gradient | yes |
\endtable
Example of the boundary condition specification:
\verbatim
<patchName>
{
type uniformFixedGradient;
uniformGradient constant 0.2;
}
\endverbatim
Note
The uniformGradient entry is a Function1 type.
The example above gives the usage for supplying a constant value.
See also
Foam::Function1Types
Foam::fixedGradientFaPatchField
SourceFiles
uniformFixedGradientFaPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef Foam_uniformFixedGradientFaPatchField_H
#define Foam_uniformFixedGradientFaPatchField_H
#include "fixedGradientFaPatchField.H"
#include "PatchFunction1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class uniformFixedGradientFaPatchField Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class uniformFixedGradientFaPatchField
:
public fixedGradientFaPatchField<Type>
{
// Private Data
//- Function providing the gradient
autoPtr<Function1<Type>> refGradFunc_;
public:
//- Runtime type information
TypeName("uniformFixedGradient");
// Constructors
//- Construct from patch and internal field
uniformFixedGradientFaPatchField
(
const faPatch&,
const DimensionedField<Type, areaMesh>&
);
//- Construct from patch and internal field and patch field
uniformFixedGradientFaPatchField
(
const faPatch&,
const DimensionedField<Type, areaMesh>&,
const Field<Type>& fld
);
//- Construct from patch, internal field and dictionary
uniformFixedGradientFaPatchField
(
const faPatch&,
const DimensionedField<Type, areaMesh>&,
const dictionary&
);
//- Construct by mapping onto a new patch
uniformFixedGradientFaPatchField
(
const uniformFixedGradientFaPatchField<Type>&,
const faPatch&,
const DimensionedField<Type, areaMesh>&,
const faPatchFieldMapper&
);
//- Construct as copy
uniformFixedGradientFaPatchField
(
const uniformFixedGradientFaPatchField<Type>&
);
//- Construct and return a clone
virtual tmp<faPatchField<Type>> clone() const
{
return tmp<faPatchField<Type>>
(
new uniformFixedGradientFaPatchField<Type>(*this)
);
}
//- Construct as copy setting internal field reference
uniformFixedGradientFaPatchField
(
const uniformFixedGradientFaPatchField<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
{
return tmp<faPatchField<Type>>
(
new uniformFixedGradientFaPatchField<Type>(*this, iF)
);
}
// Member functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "uniformFixedGradientFaPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,40 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "uniformFixedGradientFaPatchFields.H"
#include "addToRunTimeSelectionTable.H"
#include "areaFields.H"
#include "edgeFields.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
makeFaPatchFields(uniformFixedGradient);
}
// ************************************************************************* //

View File

@ -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_uniformFixedGradientFaPatchFields_H
#define Foam_uniformFixedGradientFaPatchFields_H
#include "uniformFixedGradientFaPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeFaPatchTypeFieldTypedefs(uniformFixedGradient);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,241 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "uniformMixedFaPatchField.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::uniformMixedFaPatchField<Type>::uniformMixedFaPatchField
(
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF
)
:
mixedFaPatchField<Type>(p, iF),
refValueFunc_(nullptr),
refGradFunc_(nullptr),
valueFractionFunc_(nullptr)
{}
template<class Type>
Foam::uniformMixedFaPatchField<Type>::uniformMixedFaPatchField
(
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF,
const Field<Type>& fld
)
:
mixedFaPatchField<Type>(p, iF, fld),
refValueFunc_(nullptr),
refGradFunc_(nullptr),
valueFractionFunc_(nullptr)
{}
template<class Type>
Foam::uniformMixedFaPatchField<Type>::uniformMixedFaPatchField
(
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF,
const dictionary& dict
)
:
mixedFaPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ),
refValueFunc_
(
Function1<Type>::NewIfPresent
(
/* p.patch(), */
"uniformValue",
dict
)
),
refGradFunc_
(
Function1<Type>::NewIfPresent
(
// p.patch(),
"uniformGradient",
dict
)
),
valueFractionFunc_(nullptr)
{
if (refValueFunc_)
{
if (refGradFunc_)
{
// Both value + gradient: needs valueFraction
valueFractionFunc_.reset
(
Function1<scalar>::New
(
/* p.patch(), */
"uniformValueFraction",
dict
)
);
}
}
else if (!refGradFunc_)
{
// Missing both value and gradient: FatalIOError
FatalIOErrorInFunction(dict)
<< "For " << this->internalField().name() << " on "
<< this->patch().name() << nl
<< "Require either or both: uniformValue and uniformGradient"
<< " (possibly uniformValueFraction as well)" << nl
<< exit(FatalIOError);
}
this->evaluate();
}
template<class Type>
Foam::uniformMixedFaPatchField<Type>::uniformMixedFaPatchField
(
const uniformMixedFaPatchField<Type>& ptf,
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF,
const faPatchFieldMapper& mapper
)
:
mixedFaPatchField<Type>(ptf, p, iF, mapper),
refValueFunc_(ptf.refValueFunc_.clone(/*p.patch()*/)),
refGradFunc_(ptf.refGradFunc_.clone(/*p.patch()*/)),
valueFractionFunc_(ptf.valueFractionFunc_.clone(/*p.patch()*/))
{}
template<class Type>
Foam::uniformMixedFaPatchField<Type>::uniformMixedFaPatchField
(
const uniformMixedFaPatchField<Type>& ptf
)
:
mixedFaPatchField<Type>(ptf),
refValueFunc_(ptf.refValueFunc_.clone(/*this->patch().patch()*/)),
refGradFunc_(ptf.refGradFunc_.clone(/*this->patch().patch()*/)),
valueFractionFunc_(ptf.valueFractionFunc_.clone(/*this->patch().patch()*/))
{}
template<class Type>
Foam::uniformMixedFaPatchField<Type>::uniformMixedFaPatchField
(
const uniformMixedFaPatchField<Type>& ptf,
const DimensionedField<Type, areaMesh>& iF
)
:
mixedFaPatchField<Type>(ptf, iF),
refValueFunc_(ptf.refValueFunc_.clone(/*this->patch().patch()*/)),
refGradFunc_(ptf.refGradFunc_.clone(/*this->patch().patch()*/)),
valueFractionFunc_(ptf.valueFractionFunc_.clone(/*this->patch().patch()*/))
{
// Evaluate the profile if defined
if (ptf.refValueFunc_ || ptf.refGradFunc_)
{
this->evaluate();
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::uniformMixedFaPatchField<Type>::updateCoeffs()
{
if (this->updated())
{
return;
}
const scalar t = this->db().time().timeOutputValue();
if (refValueFunc_)
{
this->refValue() = refValueFunc_->value(t);
if (refGradFunc_)
{
// Both value + gradient: has valueFraction too
this->valueFraction() = valueFractionFunc_->value(t);
}
else
{
// Has value only
this->valueFraction() = 1;
}
}
else
{
this->refValue() = Zero;
this->valueFraction() = 0;
}
if (refGradFunc_)
{
this->refGrad() = refGradFunc_->value(t);
}
else
{
this->refGrad() = Zero;
}
// Missing both value and gradient is caught as an error in
// dictionary constructor, but treated as zero-gradient here.
mixedFaPatchField<Type>::updateCoeffs();
}
template<class Type>
void Foam::uniformMixedFaPatchField<Type>::write(Ostream& os) const
{
faPatchField<Type>::write(os);
if (refValueFunc_)
{
refValueFunc_->writeData(os);
}
if (refGradFunc_)
{
refGradFunc_->writeData(os);
}
if (valueFractionFunc_)
{
valueFractionFunc_->writeData(os);
}
// Eg, for visualisation
faPatchField<Type>::writeValueEntry(os);
}
// ************************************************************************* //

View File

@ -0,0 +1,203 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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/>.
Class
Foam::uniformMixedFaPatchField
Group
grpGenericBoundaryConditions
Description
This boundary condition provides 'mixed' type boundary condition
that mix a \em uniform fixed value and a \em uniform patch-normal
gradient condition. The term "uniform" is a legacy name since the
prescribed values were previously spatially uniform across that patch.
Usage
\table
Property | Description | Required | Default
uniformValue | uniform value | partly | 0
uniformGradient | uniform gradient | partly | 0
uniformValueFraction | uniform valueFraction | partly | depends
\endtable
Example of the boundary condition specification:
\verbatim
<patchName>
{
type uniformMixed;
uniformValue constant 0.2;
uniformGradient constant 0.2;
uniformValueFraction
{
type sine;
...
}
}
\endverbatim
Note
See also
Foam::Function1Types
Foam::mixedFaPatchField
SourceFiles
uniformMixedFaPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef Foam_uniformMixedFaPatchField_H
#define Foam_uniformMixedFaPatchField_H
#include "mixedFaPatchField.H"
#include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class uniformMixedFaPatchField Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class uniformMixedFaPatchField
:
public mixedFaPatchField<Type>
{
// Private Data
//- Function providing the value
autoPtr<Function1<Type>> refValueFunc_;
//- Function providing the gradient
autoPtr<Function1<Type>> refGradFunc_;
//- Function providing the value-fraction
autoPtr<Function1<scalar>> valueFractionFunc_;
public:
//- Runtime type information
TypeName("uniformMixed");
// Constructors
//- Construct from patch and internal field
uniformMixedFaPatchField
(
const faPatch&,
const DimensionedField<Type, areaMesh>&
);
//- Construct from patch and internal field and patch field
uniformMixedFaPatchField
(
const faPatch&,
const DimensionedField<Type, areaMesh>&,
const Field<Type>& fld
);
//- Construct from patch, internal field and dictionary
uniformMixedFaPatchField
(
const faPatch&,
const DimensionedField<Type, areaMesh>&,
const dictionary&
);
//- Construct by mapping onto a new patch
uniformMixedFaPatchField
(
const uniformMixedFaPatchField<Type>&,
const faPatch&,
const DimensionedField<Type, areaMesh>&,
const faPatchFieldMapper&
);
//- Construct as copy
uniformMixedFaPatchField
(
const uniformMixedFaPatchField<Type>&
);
//- Construct and return a clone
virtual tmp<faPatchField<Type>> clone() const
{
return tmp<faPatchField<Type>>
(
new uniformMixedFaPatchField<Type>(*this)
);
}
//- Construct as copy setting internal field reference
uniformMixedFaPatchField
(
const uniformMixedFaPatchField<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
{
return tmp<faPatchField<Type>>
(
new uniformMixedFaPatchField<Type>(*this, iF)
);
}
// Member Functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "uniformMixedFaPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,40 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "uniformMixedFaPatchFields.H"
#include "addToRunTimeSelectionTable.H"
#include "areaFields.H"
#include "edgeFields.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
makeFaPatchFields(uniformMixed);
}
// ************************************************************************* //

View File

@ -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_uniformMixedFaPatchFields_H
#define Foam_uniformMixedFaPatchFields_H
#include "uniformMixedFaPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeFaPatchTypeFieldTypedefs(uniformMixed);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -38,6 +38,7 @@ namespace Foam
defineTemplateRunTimeSelectionTable(PatchTypeField, patchMapper); \
defineTemplateRunTimeSelectionTable(PatchTypeField, dictionary);
makeFaPatchField(faPatchLabelField);
makeFaPatchField(faPatchScalarField);
makeFaPatchField(faPatchVectorField);
makeFaPatchField(faPatchSphericalTensorField);

View File

@ -42,6 +42,7 @@ namespace Foam
template<class Type> class faPatchField;
typedef faPatchField<label> faPatchLabelField;
typedef faPatchField<scalar> faPatchScalarField;
typedef faPatchField<vector> faPatchVectorField;
typedef faPatchField<sphericalTensor> faPatchSphericalTensorField;

View File

@ -29,17 +29,12 @@ License
#include "calculatedFaePatchFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makeFaePatchFields(calculated);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
makeFaePatchFields(calculated);
makeFaePatchFieldType(label, calculated);
}
// ************************************************************************* //

View File

@ -38,6 +38,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeFaePatchTypeFieldTypedefs(calculated);
makeFaePatchFieldTypedef(label, calculated);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -33,9 +33,8 @@ License
namespace Foam
{
makeFaePatchFieldsTypeName(coupled);
} // End namespace Foam
makeFaePatchFieldsTypeName(coupled);
makeFaePatchFieldTypeName(label, coupled);
}
// ************************************************************************* //

View File

@ -38,6 +38,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeFaePatchTypeFieldTypedefs(coupled);
makeFaePatchFieldTypedef(label, coupled);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -29,17 +29,12 @@ License
#include "faePatchFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makeFaePatchFields(processor);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
makeFaePatchFields(processor);
makeFaePatchFieldType(label, processor);
}
// ************************************************************************* //

View File

@ -38,6 +38,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeFaePatchTypeFieldTypedefs(processor);
makeFaePatchFieldTypedef(label, processor);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -38,6 +38,7 @@ namespace Foam
defineTemplateRunTimeSelectionTable(PatchTypeField, patchMapper); \
defineTemplateRunTimeSelectionTable(PatchTypeField, dictionary);
makeFaePatchField(faePatchLabelField);
makeFaePatchField(faePatchScalarField);
makeFaePatchField(faePatchVectorField);
makeFaePatchField(faePatchSphericalTensorField);

View File

@ -42,6 +42,7 @@ namespace Foam
template<class Type> class faePatchField;
typedef faePatchField<label> faePatchLabelField;
typedef faePatchField<scalar> faePatchScalarField;
typedef faePatchField<vector> faePatchVectorField;
typedef faePatchField<sphericalTensor> faePatchSphericalTensorField;

View File

@ -227,6 +227,7 @@ $(derivedFvPatchFields)/turbulentIntensityKineticEnergyInlet/turbulentIntensityK
$(derivedFvPatchFields)/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.C
$(derivedFvPatchFields)/uniformFixedGradient/uniformFixedGradientFvPatchFields.C
$(derivedFvPatchFields)/uniformFixedValue/uniformFixedValueFvPatchFields.C
$(derivedFvPatchFields)/uniformMixed/uniformMixedFvPatchFields.C
$(derivedFvPatchFields)/uniformInletOutlet/uniformInletOutletFvPatchFields.C
$(derivedFvPatchFields)/uniformJump/uniformJumpFvPatchFields.C
$(derivedFvPatchFields)/uniformJumpAMI/uniformJumpAMIFvPatchFields.C

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -28,7 +29,6 @@ License
#include "basicSymmetryFvPatchField.H"
#include "symmTransformField.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
@ -96,13 +96,23 @@ template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::basicSymmetryFvPatchField<Type>::snGrad() const
{
tmp<vectorField> nHat = this->patch().nf();
if (pTraits<Type>::rank == 0)
{
// Transform-invariant types
return tmp<Field<Type>>::New(this->size(), Zero);
}
else
{
symmTensorField rot(I - 2.0*sqr(this->patch().nf()));
const Field<Type> iF(this->patchInternalField());
Field<Type> pif(this->patchInternalField());
return
(transform(I - 2.0*sqr(nHat), iF) - iF)
*(this->patch().deltaCoeffs()/2.0);
return
(
(transform(rot, pif) - pif)
* (this->patch().deltaCoeffs()/2.0)
);
}
}
@ -114,14 +124,19 @@ void Foam::basicSymmetryFvPatchField<Type>::evaluate(const Pstream::commsTypes)
this->updateCoeffs();
}
tmp<vectorField> nHat = this->patch().nf();
if (pTraits<Type>::rank == 0)
{
// Transform-invariant types
Field<Type>::operator=(this->patchInternalField());
}
else
{
symmTensorField rot(I - 2.0*sqr(this->patch().nf()));
const Field<Type> iF(this->patchInternalField());
Field<Type> pif(this->patchInternalField());
Field<Type>::operator=
(
(iF + transform(I - 2.0*sqr(nHat), iF))/2.0
);
Field<Type>::operator=((pif + transform(rot, pif))/2.0);
}
transformFvPatchField<Type>::evaluate();
}

View File

@ -37,8 +37,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef basicSymmetryFvPatchField_H
#define basicSymmetryFvPatchField_H
#ifndef Foam_basicSymmetryFvPatchField_H
#define Foam_basicSymmetryFvPatchField_H
#include "transformFvPatchField.H"
#include "symmetryFvPatch.H"
@ -57,7 +57,6 @@ class basicSymmetryFvPatchField
:
public transformFvPatchField<Type>
{
public:
// Constructors
@ -138,16 +137,17 @@ public:
};
// * * * * * * * * * * * Template Specialisations * * * * * * * * * * * * * //
// * * * * * * * * * * * * Template Specialisations * * * * * * * * * * * * //
template<>
tmp<scalarField> basicSymmetryFvPatchField<scalar>::snGrad() const;
tmp<Field<label>> basicSymmetryFvPatchField<label>::snGrad() const;
template<>
void basicSymmetryFvPatchField<scalar>::evaluate
(
const Pstream::commsTypes commsType
);
void basicSymmetryFvPatchField<label>::evaluate(const Pstream::commsTypes);
template<>
tmp<Field<label>>
basicSymmetryFvPatchField<label>::snGradTransformDiag() const;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2013 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -25,7 +25,8 @@ License
\*---------------------------------------------------------------------------*/
#include "basicSymmetryFvPatchField.H"
#include "basicSymmetryFvPatchFields.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
// No run-time selection
@ -33,26 +34,37 @@ License
// * * * * * * * * * * * * * * * Specialisations * * * * * * * * * * * * * * //
template<>
Foam::tmp<Foam::scalarField>
Foam::basicSymmetryFvPatchField<Foam::scalar>::snGrad() const
Foam::tmp<Foam::Field<Foam::label>>
Foam::basicSymmetryFvPatchField<Foam::label>::snGrad() const
{
return tmp<scalarField>::New(size(), Zero);
// TBD: Treat like zero-gradient
return tmp<Field<label>>::New(this->size(), Zero);
}
template<>
void Foam::basicSymmetryFvPatchField<Foam::scalar>::evaluate
void Foam::basicSymmetryFvPatchField<Foam::label>::evaluate
(
const Pstream::commsTypes
)
{
if (!updated())
if (!this->updated())
{
updateCoeffs();
this->updateCoeffs();
}
scalarField::operator=(patchInternalField());
transformFvPatchField<scalar>::evaluate();
// TBD: Treat like zero-gradient
fvPatchField<label>::operator=(this->patchInternalField());
fvPatchField<label>::evaluate();
}
template<>
Foam::tmp<Foam::Field<Foam::label>>
Foam::basicSymmetryFvPatchField<Foam::label>::snGradTransformDiag() const
{
// dummy
return tmp<Field<label>>::New(this->size(), Zero);
}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -25,11 +26,10 @@ License
\*---------------------------------------------------------------------------*/
#ifndef basicSymmetryFvPatchFields_H
#define basicSymmetryFvPatchFields_H
#ifndef Foam_basicSymmetryFvPatchFields_H
#define Foam_basicSymmetryFvPatchFields_H
#include "basicSymmetryFvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -39,6 +39,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(basicSymmetry);
makePatchTypeFieldTypedef(label, basicSymmetry);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -30,17 +31,12 @@ License
#include "volMesh.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePatchFields(calculated);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
makePatchFields(calculated);
makePatchFieldType(label, calculated);
}
// ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -25,11 +26,10 @@ License
\*---------------------------------------------------------------------------*/
#ifndef calculatedFvPatchFields_H
#define calculatedFvPatchFields_H
#ifndef Foam_calculatedFvPatchFields_H
#define Foam_calculatedFvPatchFields_H
#include "calculatedFvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -39,6 +39,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(calculated);
makePatchTypeFieldTypedef(label, calculated);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -252,6 +252,31 @@ public:
};
// * * * * * * * * * * * * Template Specialisations * * * * * * * * * * * * //
template<>
tmp<Field<label>> coupledFvPatchField<label>::snGrad(const scalarField&) const;
template<>
void coupledFvPatchField<label>::evaluate(const Pstream::commsTypes);
template<>
tmp<Field<label>>
coupledFvPatchField<label>::valueInternalCoeffs(const tmp<scalarField>&) const;
template<>
tmp<Field<label>>
coupledFvPatchField<label>::valueBoundaryCoeffs(const tmp<scalarField>&) const;
template<>
tmp<Field<label>>
coupledFvPatchField<label>::gradientInternalCoeffs(const scalarField&) const;
template<>
tmp<Field<label>>
coupledFvPatchField<label>::gradientInternalCoeffs() const;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -29,17 +30,86 @@ License
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
makePatchFieldTypeNames(coupled);
makePatchFieldTypeName(label, coupled);
}
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePatchFieldTypeNames(coupled);
// * * * * * * * * * * * * * * * Specialisations * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<>
Foam::tmp<Foam::Field<Foam::label>>
Foam::coupledFvPatchField<Foam::label>::snGrad
(
const scalarField& deltaCoeffs
) const
{
// TBD: Treat like zero-gradient
return tmp<Field<label>>::New(this->size(), Zero);
}
template<>
void Foam::coupledFvPatchField<Foam::label>::evaluate(const Pstream::commsTypes)
{
if (!this->updated())
{
this->updateCoeffs();
}
// TBD: Treat like zero-gradient
fvPatchField<label>::operator=(this->patchInternalField());
fvPatchField<label>::evaluate();
}
template<>
Foam::tmp<Foam::Field<Foam::label>>
Foam::coupledFvPatchField<Foam::label>::valueInternalCoeffs
(
const tmp<scalarField>&
) const
{
// TBD: Treat like zero-gradient
return tmp<Field<label>>::New(this->size(), label(1));
}
template<>
Foam::tmp<Foam::Field<Foam::label>>
Foam::coupledFvPatchField<Foam::label>::valueBoundaryCoeffs
(
const tmp<scalarField>&
) const
{
// TBD: Treat like zero-gradient
return tmp<Field<label>>::New(this->size(), Zero);
}
template<>
Foam::tmp<Foam::Field<Foam::label>>
Foam::coupledFvPatchField<Foam::label>::gradientInternalCoeffs
(
const scalarField&
) const
{
// TBD: Treat like zero-gradient
return tmp<Field<label>>::New(this->size(), Zero);
}
template<>
Foam::tmp<Foam::Field<Foam::label>>
Foam::coupledFvPatchField<Foam::label>::gradientInternalCoeffs() const
{
// TBD: Treat like zero-gradient
return tmp<Field<label>>::New(this->size(), Zero);
}
} // End namespace Foam
// ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -25,11 +26,10 @@ License
\*---------------------------------------------------------------------------*/
#ifndef coupledFvPatchFields_H
#define coupledFvPatchFields_H
#ifndef Foam_coupledFvPatchFields_H
#define Foam_coupledFvPatchFields_H
#include "coupledFvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -39,6 +39,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(coupled);
makePatchTypeFieldTypedef(label, coupled);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -97,6 +97,12 @@ Foam::transformFvPatchField<Type>::valueInternalCoeffs
const tmp<scalarField>&
) const
{
if (pTraits<Type>::rank == 0)
{
// Transform-invariant types
return tmp<Field<Type>>::New(this->size(), pTraits<Type>::one);
}
return pTraits<Type>::one - snGradTransformDiag();
}
@ -122,6 +128,12 @@ template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::transformFvPatchField<Type>::gradientInternalCoeffs() const
{
if (pTraits<Type>::rank == 0)
{
// Transform-invariant types
return tmp<Field<Type>>::New(this->size(), Zero);
}
return -this->patch().deltaCoeffs()*snGradTransformDiag();
}

View File

@ -56,7 +56,6 @@ class transformFvPatchField
:
public fvPatchField<Type>
{
public:
//- Runtime type information
@ -156,22 +155,31 @@ public:
virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
// Member operators
// Member Operators
virtual void operator=(const fvPatchField<Type>&);
};
// * * * * * * * * * * * Template Specialisations * * * * * * * * * * * * * //
// * * * * * * * * * * * * Template Specialisations * * * * * * * * * * * * //
template<>
tmp<scalarField> transformFvPatchField<scalar>::valueInternalCoeffs
tmp<Field<label>> transformFvPatchField<label>::valueInternalCoeffs
(
const tmp<scalarField>&
) const;
template<>
tmp<scalarField> transformFvPatchField<scalar>::gradientInternalCoeffs() const;
tmp<Field<label>> transformFvPatchField<label>::valueBoundaryCoeffs
(
const tmp<scalarField>&
) const;
template<>
tmp<Field<label>> transformFvPatchField<label>::gradientInternalCoeffs() const;
template<>
tmp<Field<label>> transformFvPatchField<label>::gradientBoundaryCoeffs() const;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -34,27 +34,51 @@ License
namespace Foam
{
makePatchFieldTypeNames(transform);
makePatchFieldTypeName(label, transform);
}
// * * * * * * * * * * * * * * * Specialisations * * * * * * * * * * * * * * //
template<>
Foam::tmp<Foam::scalarField>
Foam::transformFvPatchField<Foam::scalar>::valueInternalCoeffs
Foam::tmp<Foam::Field<Foam::label>>
Foam::transformFvPatchField<Foam::label>::valueInternalCoeffs
(
const tmp<scalarField>&
) const
{
return tmp<scalarField>::New(size(), 1.0);
// TBD: Treat like zero-gradient
return tmp<Field<label>>::New(this->size(), label(1));
}
template<>
Foam::tmp<Foam::scalarField>
Foam::transformFvPatchField<Foam::scalar>::gradientInternalCoeffs() const
Foam::tmp<Foam::Field<Foam::label>>
Foam::transformFvPatchField<Foam::label>::valueBoundaryCoeffs
(
const tmp<scalarField>&
) const
{
return tmp<scalarField>::New(size(), Zero);
// TBD: Treat like zero-gradient
return tmp<Field<label>>::New(this->size(), Zero);
}
template<>
Foam::tmp<Foam::Field<Foam::label>>
Foam::transformFvPatchField<Foam::label>::gradientInternalCoeffs() const
{
// TBD: Treat like zero-gradient
return tmp<Field<label>>::New(this->size(), Zero);
}
template<>
Foam::tmp<Foam::Field<Foam::label>>
Foam::transformFvPatchField<Foam::label>::gradientBoundaryCoeffs() const
{
// TBD: Treat like zero-gradient
return tmp<Field<label>>::New(this->size(), Zero);
}

View File

@ -39,6 +39,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(transform);
makePatchTypeFieldTypedef(label, transform);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -28,7 +28,6 @@ License
#include "zeroGradientFvPatchField.H"
#include "fvPatchFieldMapper.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
@ -121,10 +120,7 @@ Foam::zeroGradientFvPatchField<Type>::valueInternalCoeffs
const tmp<scalarField>&
) const
{
return tmp<Field<Type>>
(
new Field<Type>(this->size(), pTraits<Type>::one)
);
return tmp<Field<Type>>::New(this->size(), pTraits<Type>::one);
}
@ -135,10 +131,7 @@ Foam::zeroGradientFvPatchField<Type>::valueBoundaryCoeffs
const tmp<scalarField>&
) const
{
return tmp<Field<Type>>
(
new Field<Type>(this->size(), Zero)
);
return tmp<Field<Type>>::New(this->size(), Zero);
}
@ -146,10 +139,7 @@ template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::zeroGradientFvPatchField<Type>::gradientInternalCoeffs() const
{
return tmp<Field<Type>>
(
new Field<Type>(this->size(), Zero)
);
return tmp<Field<Type>>::New(this->size(), Zero);
}
@ -157,10 +147,7 @@ template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::zeroGradientFvPatchField<Type>::gradientBoundaryCoeffs() const
{
return tmp<Field<Type>>
(
new Field<Type>(this->size(), Zero)
);
return tmp<Field<Type>>::New(this->size(), Zero);
}

View File

@ -142,10 +142,7 @@ public:
//- Return gradient at boundary
virtual tmp<Field<Type>> snGrad() const
{
return tmp<Field<Type>>
(
new Field<Type>(this->size(), Zero)
);
return tmp<Field<Type>>::New(this->size(), Zero);
}
//- Evaluate the patch field

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -30,17 +31,13 @@ License
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
makePatchFields(zeroGradient);
makePatchFieldType(label, zeroGradient);
}
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePatchFields(zeroGradient);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -25,11 +26,10 @@ License
\*---------------------------------------------------------------------------*/
#ifndef zeroGradientFvPatchFields_H
#define zeroGradientFvPatchFields_H
#ifndef Foam_zeroGradientFvPatchFields_H
#define Foam_zeroGradientFvPatchFields_H
#include "zeroGradientFvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -39,6 +39,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(zeroGradient);
makePatchTypeFieldTypedef(label, zeroGradient);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -37,7 +37,7 @@ Foam::emptyFvPatchField<Type>::emptyFvPatchField
const DimensionedField<Type, volMesh>& iF
)
:
fvPatchField<Type>(p, iF, Field<Type>(0))
fvPatchField<Type>(p, iF, Field<Type>())
{}
@ -50,7 +50,7 @@ Foam::emptyFvPatchField<Type>::emptyFvPatchField
const fvPatchFieldMapper&
)
:
fvPatchField<Type>(p, iF, Field<Type>(0))
fvPatchField<Type>(p, iF, Field<Type>())
{
if (!isType<emptyFvPatch>(p))
{
@ -72,7 +72,7 @@ Foam::emptyFvPatchField<Type>::emptyFvPatchField
const dictionary& dict
)
:
fvPatchField<Type>(p, iF, Field<Type>(0))
fvPatchField<Type>(p, iF, Field<Type>())
{
if (!isType<emptyFvPatch>(p))
{
@ -97,7 +97,7 @@ Foam::emptyFvPatchField<Type>::emptyFvPatchField
(
ptf.patch(),
ptf.internalField(),
Field<Type>(0)
Field<Type>()
)
{}
@ -109,7 +109,7 @@ Foam::emptyFvPatchField<Type>::emptyFvPatchField
const DimensionedField<Type, volMesh>& iF
)
:
fvPatchField<Type>(ptf.patch(), iF, Field<Type>(0))
fvPatchField<Type>(ptf.patch(), iF, Field<Type>())
{}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -29,17 +30,12 @@ License
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePatchFields(empty);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
makePatchFields(empty);
makePatchFieldType(label, empty);
}
// ************************************************************************* //

View File

@ -25,11 +25,10 @@ License
\*---------------------------------------------------------------------------*/
#ifndef emptyFvPatchFields_H
#define emptyFvPatchFields_H
#ifndef Foam_emptyFvPatchFields_H
#define Foam_emptyFvPatchFields_H
#include "emptyFvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -39,6 +38,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(empty);
makePatchTypeFieldTypedef(label, empty);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -29,17 +30,12 @@ License
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePatchFields(processor);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
makePatchFields(processor);
makePatchFieldType(label, processor);
}
// ************************************************************************* //

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -26,11 +26,10 @@ License
\*---------------------------------------------------------------------------*/
#ifndef processorFvPatchFields_H
#define processorFvPatchFields_H
#ifndef Foam_processorFvPatchFields_H
#define Foam_processorFvPatchFields_H
#include "processorFvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -40,6 +39,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(processor);
makePatchTypeFieldTypedef(label, processor);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -29,17 +30,12 @@ License
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePatchFields(symmetry);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
makePatchFields(symmetry);
makePatchFieldType(label, symmetry);
}
// ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -25,11 +26,10 @@ License
\*---------------------------------------------------------------------------*/
#ifndef symmetryFvPatchFields_H
#define symmetryFvPatchFields_H
#ifndef Foam_symmetryFvPatchFields_H
#define Foam_symmetryFvPatchFields_H
#include "symmetryFvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -39,6 +39,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(symmetry);
makePatchTypeFieldTypedef(label, symmetry);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -27,7 +28,6 @@ License
#include "symmetryPlaneFvPatchField.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
@ -119,13 +119,23 @@ template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::symmetryPlaneFvPatchField<Type>::snGrad() const
{
vector nHat(symmetryPlanePatch_.n());
if (pTraits<Type>::rank == 0)
{
// Transform-invariant types
return tmp<Field<Type>>::New(this->size(), Zero);
}
else
{
symmTensor rot(I - 2.0*sqr(symmetryPlanePatch_.n()));
const Field<Type> iF(this->patchInternalField());
Field<Type> pif(this->patchInternalField());
return
(transform(I - 2.0*sqr(nHat), iF) - iF)
*(this->patch().deltaCoeffs()/2.0);
return
(
(transform(rot, pif) - pif)
* (this->patch().deltaCoeffs()/2.0)
);
}
}
@ -137,14 +147,19 @@ void Foam::symmetryPlaneFvPatchField<Type>::evaluate(const Pstream::commsTypes)
this->updateCoeffs();
}
vector nHat(symmetryPlanePatch_.n());
if (pTraits<Type>::rank == 0)
{
// Transform-invariant types
Field<Type>::operator=(this->patchInternalField());
}
else
{
symmTensor rot(I - 2.0*sqr(symmetryPlanePatch_.n()));
const Field<Type> iF(this->patchInternalField());
Field<Type> pif(this->patchInternalField());
Field<Type>::operator=
(
(iF + transform(I - 2.0*sqr(nHat), iF))/2.0
);
Field<Type>::operator=((pif + transform(rot, pif))/2.0);
}
transformFvPatchField<Type>::evaluate();
}
@ -156,12 +171,7 @@ Foam::symmetryPlaneFvPatchField<Type>::snGradTransformDiag() const
{
vector nHat(symmetryPlanePatch_.n());
const vector diag
(
mag(nHat.component(vector::X)),
mag(nHat.component(vector::Y)),
mag(nHat.component(vector::Z))
);
const vector diag(mag(nHat.x()), mag(nHat.y()), mag(nHat.z()));
return tmp<Field<Type>>
(

Some files were not shown because too many files have changed in this diff Show More