Compare commits

..

2 Commits

Author SHA1 Message Date
c66993e288 Revert "Merge branch 'primitiveMeshOptimization' into 'develop'"
This reverts merge request !596
2023-03-03 16:34:40 +00:00
61d610574c ENH: improved point-cell and cell-point topology methods (#2715)
- for OpenFOAM-v2212 and earlier cellPoints() were constructed
  from pointCells(), but this is slower than constructing
  pointCells() from cellPoints().

  Some of the slowness is due to allocations associated with
  cells::labels(), but a large amount of slowness is the duplicate
  point avoidance. Since this is being done for many points/cells
  at once, using a bitSet for managing the duplicates amortizes
  quickly

- now construct cellPoints() from cached pointCells(), otherwise
  construct manually (using bitSet/DynamicList for bookkeeping)

- construct pointCells() from cached cellPoints(), or cached
  pointFaces(), otherwise manually.

Code Contribution: Alon Zameret

Co-authored-by: Mark Olesen
2023-03-03 16:23:42 +01:00
322 changed files with 1924 additions and 4589 deletions

View File

@ -103,7 +103,14 @@ Foam::smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField
<< exit(FatalIOError);
}
if (!this->readValueEntry(dict))
if (dict.found("value"))
{
fvPatchField<scalar>::operator=
(
scalarField("value", dict, p.size())
);
}
else
{
fvPatchField<scalar>::operator=(patchInternalField());
}

View File

@ -105,15 +105,18 @@ Foam::maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField
<< exit(FatalIOError);
}
if (this->readValueEntry(dict))
if (dict.found("value"))
{
const auto* hasRefValue = dict.findEntry("refValue", keyType::LITERAL);
const auto* hasFrac = dict.findEntry("valueFraction", keyType::LITERAL);
fvPatchField<vector>::operator=
(
vectorField("value", dict, p.size())
);
if (hasRefValue && hasFrac)
if (dict.found("refValue") && dict.found("valueFraction"))
{
this->refValue().assign(*hasRefValue, p.size());
this->valueFraction().assign(*hasFrac, p.size());
this->refValue() = vectorField("refValue", dict, p.size());
this->valueFraction() =
scalarField("valueFraction", dict, p.size());
}
else
{

View File

@ -243,12 +243,14 @@ turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField
<< exit(FatalError);
}
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
this->readValueEntry(dict, IOobjectOption::MUST_READ);
if (this->readMixedEntries(dict))
if (dict.found("refValue"))
{
// Full restart
refValue() = scalarField("refValue", dict, p.size());
refGrad() = scalarField("refGradient", dict, p.size());
valueFraction() = scalarField("valueFraction", dict, p.size());
}
else
{

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2022-2023 OpenCFD Ltd.
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -51,7 +51,7 @@ void printInfo(const label comm)
<< " sub:" << UPstream::subProcs(comm) << nl;
if (UPstream::commSelf() == comm)
if (UPstream::selfComm == comm)
{
Pout<< "self all:" << UPstream::allProcs(comm)
<< " sub:" << UPstream::subProcs(comm) << nl;
@ -86,32 +86,32 @@ int main(int argc, char *argv[])
<< "nProcs = " << UPstream::nProcs()
<< " with " << UPstream::nComms() << " predefined comm(s)" << nl;
Info<< "comm-world : ";
printInfo(UPstream::commWorld());
Info<< "worldComm : ";
printInfo(UPstream::worldComm);
Info<< "comm-self : ";
printInfo(UPstream::commSelf());
Info<< "selfComm : ";
printInfo(UPstream::selfComm);
Info<< nl;
// Reductions (using MPI intrinsics)
{
label val = Pstream::myProcNo(UPstream::commWorld());
label val = Pstream::myProcNo(UPstream::worldComm);
label worldVal = returnReduce
(
val,
sumOp<label>(),
UPstream::msgType(),
UPstream::commWorld()
Pstream::msgType(),
UPstream::worldComm
);
label selfVal = returnReduce
(
val,
sumOp<label>(),
UPstream::msgType(),
UPstream::commSelf()
Pstream::msgType(),
UPstream::selfComm
);
Pout<< "value " << val
@ -123,8 +123,8 @@ int main(int argc, char *argv[])
{
Pair<label> val
(
Pstream::myProcNo(UPstream::commWorld()),
Pstream::myProcNo(UPstream::commWorld())
Pstream::myProcNo(UPstream::worldComm),
Pstream::myProcNo(UPstream::worldComm)
);
Pair<label> worldVal = val;
@ -133,8 +133,8 @@ int main(int argc, char *argv[])
(
worldVal,
minFirstEqOp<label>(),
UPstream::msgType(),
UPstream::commWorld()
Pstream::msgType(),
UPstream::worldComm
);
Pair<label> selfVal = val;
@ -143,8 +143,8 @@ int main(int argc, char *argv[])
(
worldVal,
minFirstEqOp<label>(),
UPstream::msgType(),
UPstream::commSelf()
Pstream::msgType(),
UPstream::selfComm
);
Pout<< "value " << val

View File

@ -150,7 +150,11 @@ int main(int argc, char *argv[])
Pout<< "localValue :" << localValue << endl;
label comm = UPstream::allocateCommunicator(UPstream::worldComm, top);
label comm = Pstream::allocateCommunicator
(
UPstream::worldComm,
top
);
Pout<< "allocated comm :" << comm << endl;
Pout<< "comm myproc :" << Pstream::myProcNo(comm)
@ -169,7 +173,7 @@ int main(int argc, char *argv[])
Pout<< "sum :" << sum << endl;
}
UPstream::freeCommunicator(comm);
Pstream::freeCommunicator(comm);
Pout<< "End\n" << endl;

View File

@ -88,12 +88,12 @@ int main(int argc, char *argv[])
//- Process IDs within a given communicator
Info<< "procIDs: "
<< flatOutput(UPstream::procID(UPstream::commWorld())) << endl;
<< flatOutput(UPstream::procID(UPstream::worldComm)) << endl;
rankInfo(UPstream::commWorld());
rankInfo(UPstream::worldComm);
Pout<< endl;
const int myProci = UPstream::myProcNo(UPstream::commWorld());
const int myProci = UPstream::myProcNo(UPstream::worldComm);
int localRanki = myProci;
labelList subRanks;
@ -101,9 +101,9 @@ int main(int argc, char *argv[])
#if 1
// With first ranks
subRanks = identity(UPstream::nProcs(UPstream::commWorld()) / 2);
subRanks = identity(UPstream::nProcs(UPstream::worldComm) / 2);
newComm.reset(UPstream::commWorld(), subRanks);
newComm.reset(UPstream::worldComm, subRanks);
localRanki = UPstream::myProcNo(newComm);
Pout.prefix() =
@ -120,14 +120,14 @@ int main(int argc, char *argv[])
#if 1
// With every other rank
subRanks = identity(UPstream::nProcs(UPstream::commWorld()));
subRanks = identity(UPstream::nProcs(UPstream::worldComm));
for (label& val : subRanks)
{
if (val % 2) val = -1;
}
newComm.reset(UPstream::commWorld(), subRanks);
newComm.reset(UPstream::worldComm, subRanks);
localRanki = UPstream::myProcNo(newComm);
Pout.prefix() =
@ -165,19 +165,19 @@ int main(int argc, char *argv[])
}
if (Pstream::parRun() && args.found("host-comm"))
{
// Host communicator, based on the current world communicator
// Host communicator, based on the current worldComm
// Use hostname
// Lowest rank per hostname is the IO rank
label numprocs = UPstream::nProcs(UPstream::commGlobal());
label numprocs = UPstream::nProcs(UPstream::globalComm);
stringList hosts(numprocs);
hosts[Pstream::myProcNo(UPstream::commGlobal())] = hostName();
hosts[Pstream::myProcNo(UPstream::globalComm)] = hostName();
labelList hostIDs_;
// Compact
if (Pstream::master(UPstream::commGlobal()))
if (Pstream::master(UPstream::globalComm))
{
DynamicList<word> hostNames(numprocs);
hostIDs_.resize_nocopy(numprocs);
@ -196,10 +196,10 @@ int main(int argc, char *argv[])
}
}
Pstream::broadcasts(UPstream::commGlobal(), hostIDs_);
Pstream::broadcasts(UPstream::globalComm, hostIDs_);
const label myHostId =
hostIDs_[Pstream::myProcNo(UPstream::commGlobal())];
hostIDs_[Pstream::myProcNo(UPstream::globalComm)];
DynamicList<label> subRanks;
forAll(hostIDs_, proci)
@ -210,11 +210,11 @@ int main(int argc, char *argv[])
}
}
// Allocate new communicator with global communicator as its parent
// Allocate new communicator with globalComm as its parent
const label hostComm =
UPstream::allocateCommunicator
(
UPstream::commGlobal(),
UPstream::globalComm, // parent
subRanks,
true
);

View File

@ -39,6 +39,7 @@ Description
int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createTime.H"
@ -46,42 +47,11 @@ 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
(
"test-U",
"U",
runTime.timeName(),
mesh,
IOobject::NO_READ,
@ -92,8 +62,6 @@ int main(int argc, char *argv[])
pointPatchVectorField::calculatedType()
);
U.write();
pointVectorField V(U + 2*U);
Info<< "End\n" << endl;

View File

@ -224,21 +224,73 @@ 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

@ -58,7 +58,7 @@ void reduce
const label comm
)
{
if (UPstream::warnComm >= 0 && comm != UPstream::warnComm)
if (UPstream::warnComm != -1 && comm != UPstream::warnComm)
{
Pout<< "** reducing:" << value << " with comm:" << comm << endl;
error::printStack(Pout);

View File

@ -284,52 +284,24 @@ public:
// Standard Communicators
//- Communicator for all ranks.
//- Default world communicator (all processors).
//- May differ from globalComm if local worlds are in use
static label worldComm;
//- Debugging: warn for use of any communicator differing from warnComm
static label warnComm;
//- Communicator for all ranks, irrespective of any local worlds
//- Communicator for all processors, irrespective of any local worlds
static constexpr label globalComm = 0;
//- A communicator within the current rank only
static constexpr label selfComm = 1;
//- Communicator for all ranks, irrespective of any local worlds
static constexpr label commGlobal() noexcept { return 0; }
//- Communicator within the current rank only
static constexpr label commSelf() noexcept { return 1; }
//- Communicator for all ranks (respecting any local worlds)
static label commWorld() noexcept { return worldComm; }
//- Alter value of world communicator
// \returns the previous value
static label commWorld(const label communicator) noexcept
{
label old(worldComm);
worldComm = communicator;
return old;
}
//- Alter communicator debugging setting.
//- Warns for use of any communicator differing from specified.
// \returns the previous warn communicator
static label commWarn(const label communicator) noexcept
{
label old(warnComm);
warnComm = communicator;
return old;
}
//- Number of currently defined communicators
static label nComms() noexcept { return parentComm_.size(); }
//- True if communicator appears to be user-allocated
static bool isUserComm(const label communicator) noexcept
static bool isUserComm(label communicator) noexcept
{
return (communicator > worldComm && communicator > selfComm);
}

View File

@ -143,7 +143,7 @@ Foam::OSstream& Foam::messageStream::stream(OSstream* alternative)
Foam::OSstream& Foam::messageStream::masterStream(const label communicator)
{
if (UPstream::warnComm >= 0 && communicator != UPstream::warnComm)
if (UPstream::warnComm != -1 && communicator != UPstream::warnComm)
{
Pout<< "** messageStream with comm:" << communicator << endl;
error::printStack(Pout);

View File

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

View File

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

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2018-2023 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -80,7 +80,6 @@ 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,7 +6,6 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -30,6 +29,7 @@ License
#include "transformField.H"
#include "symmTransformField.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
@ -87,17 +87,15 @@ void Foam::basicSymmetryPointPatchField<Type>::evaluate
const Pstream::commsTypes
)
{
if (pTraits<Type>::rank == 0)
{
// Transform-invariant types
return;
}
const vectorField& nHat = this->patch().pointNormals();
Field<Type> pif(this->patchInternalField());
symmTensorField rot(I - 2.0*sqr(this->patch().pointNormals()));
tmp<Field<Type>> tvalues = (pif + transform(rot, pif))/2.0;
tmp<Field<Type>> tvalues =
(
(
this->patchInternalField()
+ transform(I - 2.0*sqr(nHat), this->patchInternalField())
)/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 Foam_basicSymmetryPointPatchField_H
#define Foam_basicSymmetryPointPatchField_H
#ifndef basicSymmetryPointPatchField_H
#define basicSymmetryPointPatchField_H
#include "pointPatchField.H"
#include "symmetryPointPatch.H"
@ -54,6 +54,7 @@ class basicSymmetryPointPatchField
:
public pointPatchField<Type>
{
public:
// Constructors

View File

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

View File

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

View File

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

View File

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

View File

@ -6,7 +6,6 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -27,6 +26,7 @@ License
\*---------------------------------------------------------------------------*/
#include "fixedValuePointPatchField.H"
#include "boolList.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -47,10 +47,10 @@ Foam::fixedValuePointPatchField<Type>::fixedValuePointPatchField
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF,
const dictionary& dict,
IOobjectOption::readOption requireValue
const bool valueRequired
)
:
valuePointPatchField<Type>(p, iF, dict, requireValue)
valuePointPatchField<Type>(p, iF, dict, valueRequired)
{}

View File

@ -6,7 +6,6 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -35,8 +34,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef Foam_fixedValuePointPatchField_H
#define Foam_fixedValuePointPatchField_H
#ifndef fixedValuePointPatchField_H
#define fixedValuePointPatchField_H
#include "valuePointPatchField.H"
@ -54,6 +53,7 @@ class fixedValuePointPatchField
:
public valuePointPatchField<Type>
{
public:
//- Runtime type information
@ -75,25 +75,9 @@ public:
const pointPatch&,
const DimensionedField<Type, pointMesh>&,
const dictionary&,
IOobjectOption::readOption requireValue = IOobjectOption::MUST_READ
const bool valueRequired=true
);
//- Compatibility. Prefer with readOption
fixedValuePointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF,
const dictionary& dict,
const bool valueReqd
)
:
fixedValuePointPatchField
(
p, iF, dict,
(valueReqd? IOobjectOption::MUST_READ : IOobjectOption::NO_READ)
)
{}
//- Construct by mapping given patch field onto a new patch
fixedValuePointPatchField
(

View File

@ -84,17 +84,29 @@ Foam::valuePointPatchField<Type>::valuePointPatchField
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF,
const dictionary& dict,
IOobjectOption::readOption requireValue
const bool valueRequired
)
:
pointPatchField<Type>(p, iF, dict),
Field<Type>(p.size())
{
if (!readValueEntry(dict, requireValue))
const auto* hasValue = dict.findEntry("value", keyType::LITERAL);
if (hasValue)
{
Field<Type>::assign(*hasValue, p.size());
}
else if (!valueRequired)
{
// Not read (eg, optional and missing): define zero
Field<Type>::operator=(Zero);
}
else
{
FatalIOErrorInFunction(dict)
<< "Essential entry 'value' missing on patch "
<< p.name() << endl
<< exit(FatalIOError);
}
}

View File

@ -101,27 +101,10 @@ public:
(
const pointPatch&,
const DimensionedField<Type, pointMesh>&,
const dictionary& dict,
//! The "value" entry (default: mandatory)
IOobjectOption::readOption requireValue = IOobjectOption::MUST_READ
const dictionary&,
const bool valueRequired=true
);
//- Construct, forwarding to readOption variant
valuePointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF,
const dictionary& dict,
const bool valueReqd
)
:
valuePointPatchField
(
p, iF, dict,
(valueReqd? IOobjectOption::MUST_READ : IOobjectOption::NO_READ)
)
{}
//- Construct by mapping given patch field onto a new patch
valuePointPatchField
(

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -28,6 +28,7 @@ License
#include "wedgePointPatchField.H"
#include "transformField.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
@ -100,18 +101,12 @@ 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];
symmTensor rot(I - sqr(this->patch().pointNormals()[0]));
tmp<Field<Type>> tvalues = transform(rot, this->patchInternalField());
tmp<Field<Type>> tvalues =
transform(I - nHat*nHat, this->patchInternalField());
// Get internal field to insert values into
Field<Type>& iF = const_cast<Field<Type>&>(this->primitiveField());

View File

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

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2016-2023 OpenCFD Ltd.
Copyright (C) 2016-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -161,11 +161,11 @@ Foam::codedFixedValuePointPatchField<Type>::codedFixedValuePointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF,
const dictionary& dict
const dictionary& dict,
const bool valueRequired
)
:
// The 'value' is optional (handled below)
parent_bctype(p, iF, dict, IOobjectOption::NO_READ),
parent_bctype(p, iF, dict, false),
codedBase(),
dict_
(
@ -186,7 +186,10 @@ Foam::codedFixedValuePointPatchField<Type>::codedFixedValuePointPatchField
{
updateLibrary(name_);
if (!this->readValueEntry(dict))
// Note: 'value' is used even with valueRequired = false ! This is
// inconsistent with fixedValueFvPatchField behaviour.
if (!dict.found("value")) // Q: check for valueRequired?
{
// Evaluate to assign a value
this->evaluate(Pstream::commsTypes::blocking);

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2017 OpenFOAM Foundation
Copyright (C) 2019-2023 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -100,8 +100,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef Foam_codedFixedValuePointPatchField_H
#define Foam_codedFixedValuePointPatchField_H
#ifndef codedFixedValuePointPatchField_H
#define codedFixedValuePointPatchField_H
#include "fixedValuePointPatchFields.H"
#include "codedBase.H"
@ -187,7 +187,8 @@ public:
(
const pointPatch&,
const DimensionedField<Type, pointMesh>&,
const dictionary&
const dictionary&,
const bool valueRequired=true
);
//- Construct by mapping given codedFixedValuePointPatchField

View File

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

View File

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

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2022-2023 OpenCFD Ltd.
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.

View File

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

View File

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

View File

@ -6,7 +6,6 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -40,7 +39,6 @@ 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

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2023 OpenCFD Ltd.
Copyright (C) 2015-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -2721,7 +2721,8 @@ void Foam::globalMeshData::updateMesh()
identity(UPstream::nProcs(UPstream::worldComm)),
true
);
const label oldWarnComm = UPstream::commWarn(comm);
const label oldWarnComm = UPstream::warnComm;
UPstream::warnComm = comm;
// Total number of faces.
@ -2759,9 +2760,8 @@ void Foam::globalMeshData::updateMesh()
comm
);
// Restore communicator settings
UPstream::freeCommunicator(comm);
UPstream::commWarn(oldWarnComm);
UPstream::warnComm = oldWarnComm;
if (debug)
{

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2023 OpenCFD Ltd.
Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -29,7 +29,6 @@ License
#include "primitiveMesh.H"
#include "cell.H"
#include "bitSet.H"
#include "DynamicList.H"
#include "ListOps.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -58,51 +57,12 @@ void Foam::primitiveMesh::calcCellPoints() const
<< "cellPoints already calculated"
<< abort(FatalError);
}
else if (hasPointCells())
else
{
// Invert pointCells
cpPtr_ = new labelListList(nCells());
invertManyToMany(nCells(), pointCells(), *cpPtr_);
}
else
{
// Calculate cell-point topology
cpPtr_ = new labelListList(nCells());
auto& cellPointAddr = *cpPtr_;
const cellList& cellLst = cells();
const faceList& faceLst = faces();
// Tracking (only use each point id once)
bitSet usedPoints(nPoints());
// Vertex labels for the current cell
DynamicList<label> currPoints(256);
const label loopLen = nCells();
for (label celli = 0; celli < loopLen; ++celli)
{
// Clear any previous contents
usedPoints.unset(currPoints);
currPoints.clear();
for (const label facei : cellLst[celli])
{
for (const label pointi : faceLst[facei])
{
// Only once for each point id
if (usedPoints.set(pointi))
{
currPoints.push_back(pointi);
}
}
}
cellPointAddr[celli] = currPoints; // NB: unsorted
}
}
}

View File

@ -6,7 +6,6 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -29,13 +28,14 @@ License
#include "primitiveMesh.H"
#include "cell.H"
#include "bitSet.H"
#include "DynamicList.H"
#include "ListOps.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::primitiveMesh::calcPointCells() const
{
// Loop through cells and mark up points
if (debug)
{
Pout<< "primitiveMesh::calcPointCells() : "
@ -59,128 +59,48 @@ void Foam::primitiveMesh::calcPointCells() const
<< "pointCells already calculated"
<< abort(FatalError);
}
else if (hasCellPoints())
{
// Invert cellPoints
pcPtr_ = new labelListList(nPoints());
invertManyToMany(nPoints(), cellPoints(), *pcPtr_);
}
else if (hasPointFaces())
{
// Calculate point-cell from point-face information
const labelList& own = faceOwner();
const labelList& nei = faceNeighbour();
const labelListList& pFaces = pointFaces();
// Tracking (only use each cell id once)
bitSet usedCells(nCells());
// Cell ids for the point currently being processed
DynamicList<label> currCells(256);
const label loopLen = nPoints();
pcPtr_ = new labelListList(nPoints());
auto& pointCellAddr = *pcPtr_;
for (label pointi = 0; pointi < loopLen; ++pointi)
{
// Clear any previous contents
usedCells.unset(currCells);
currCells.clear();
for (const label facei : pFaces[pointi])
{
// Owner cell - only allow one occurance
if (usedCells.set(own[facei]))
{
currCells.push_back(own[facei]);
}
// Neighbour cell - only allow one occurance
if (facei < nInternalFaces())
{
if (usedCells.set(nei[facei]))
{
currCells.push_back(nei[facei]);
}
}
}
pointCellAddr[pointi] = currCells; // NB: unsorted
}
}
else
{
// Calculate point-cell topology
const cellList& cf = cells();
const cellList& cellLst = cells();
const faceList& faceLst = faces();
// Count number of cells per point
// Tracking (only use each point id once)
bitSet usedPoints(nPoints());
labelList npc(nPoints(), Zero);
// Which of usedPoints needs to be unset [faster]
DynamicList<label> currPoints(256);
const label loopLen = nCells();
// Step 1: count number of cells per point
labelList pointCount(nPoints(), Zero);
for (label celli = 0; celli < loopLen; ++celli)
forAll(cf, celli)
{
// Clear any previous contents
usedPoints.unset(currPoints);
currPoints.clear();
const labelList curPoints = cf[celli].labels(faces());
for (const label facei : cellLst[celli])
forAll(curPoints, pointi)
{
for (const label pointi : faceLst[facei])
{
// Only once for each point id
if (usedPoints.set(pointi))
{
currPoints.push_back(pointi); // Needed for cleanup
++pointCount[pointi];
}
}
label ptI = curPoints[pointi];
npc[ptI]++;
}
}
// Step 2: set sizing, reset counters
// Size and fill cells per point
pcPtr_ = new labelListList(nPoints());
auto& pointCellAddr = *pcPtr_;
pcPtr_ = new labelListList(npc.size());
labelListList& pointCellAddr = *pcPtr_;
forAll(pointCellAddr, pointi)
{
pointCellAddr[pointi].resize_nocopy(pointCount[pointi]);
pointCount[pointi] = 0;
pointCellAddr[pointi].setSize(npc[pointi]);
}
npc = 0;
// Step 3: fill in values. Logic as per step 1
for (label celli = 0; celli < loopLen; ++celli)
forAll(cf, celli)
{
// Clear any previous contents
usedPoints.unset(currPoints);
currPoints.clear();
const labelList curPoints = cf[celli].labels(faces());
for (const label facei : cellLst[celli])
forAll(curPoints, pointi)
{
for (const label pointi : faceLst[facei])
{
// Only once for each point id
if (usedPoints.set(pointi))
{
currPoints.push_back(pointi); // Needed for cleanup
pointCellAddr[pointi][pointCount[pointi]++] = celli;
}
}
label ptI = curPoints[pointi];
pointCellAddr[ptI][npc[ptI]++] = celli;
}
}
}
@ -234,8 +154,12 @@ const Foam::labelList& Foam::primitiveMesh::pointCells
if (storage.size() > 1)
{
std::sort(storage.begin(), storage.end());
auto last = std::unique(storage.begin(), storage.end());
storage.resize(label(last - storage.begin()));
const label newLen = label(last - storage.begin());
storage.resize(newLen);
}
return storage;

View File

@ -114,7 +114,7 @@ Foam::label Foam::UIPstream::read
<< " commsType:" << UPstream::commsTypeNames[commsType]
<< Foam::endl;
}
if (UPstream::warnComm >= 0 && communicator != UPstream::warnComm)
if (UPstream::warnComm != -1 && communicator != UPstream::warnComm)
{
Pout<< "UIPstream::read : starting read from:" << fromProcNo
<< " tag:" << tag << " comm:" << communicator

View File

@ -68,7 +68,7 @@ bool Foam::UOPstream::write
<< " commType:" << UPstream::commsTypeNames[commsType]
<< Foam::endl;
}
if (UPstream::warnComm >= 0 && communicator != UPstream::warnComm)
if (UPstream::warnComm != -1 && communicator != UPstream::warnComm)
{
Pout<< "UOPstream::write : starting write to:" << toProcNo
<< " tag:" << tag

View File

@ -54,7 +54,7 @@ bool Foam::UPstream::broadcast
<< " size:" << label(bufSize)
<< Foam::endl;
}
if (UPstream::warnComm >= 0 && comm != UPstream::warnComm)
if (UPstream::warnComm != -1 && comm != UPstream::warnComm)
{
Pout<< "UPstream::broadcast : root:" << rootProcNo
<< " comm:" << comm

View File

@ -78,7 +78,7 @@ void Foam::PstreamDetail::reduce0
return;
}
if (UPstream::warnComm >= 0 && comm != UPstream::warnComm)
if (UPstream::warnComm != -1 && comm != UPstream::warnComm)
{
Pout<< "** reducing:";
if (count == 1)
@ -135,7 +135,7 @@ void Foam::PstreamDetail::allReduce
const bool immediate = (req || requestID);
if (UPstream::warnComm >= 0 && comm != UPstream::warnComm)
if (UPstream::warnComm != -1 && comm != UPstream::warnComm)
{
if (immediate)
{
@ -246,7 +246,7 @@ void Foam::PstreamDetail::allToAll
const label numProc = UPstream::nProcs(comm);
if (UPstream::warnComm >= 0 && comm != UPstream::warnComm)
if (UPstream::warnComm != -1 && comm != UPstream::warnComm)
{
if (immediate)
{
@ -383,7 +383,7 @@ void Foam::PstreamDetail::allToAllv
const label np = UPstream::nProcs(comm);
if (UPstream::warnComm >= 0 && comm != UPstream::warnComm)
if (UPstream::warnComm != -1 && comm != UPstream::warnComm)
{
if (immediate)
{
@ -531,7 +531,7 @@ void Foam::PstreamDetail::allToAllConsensus
const label myProci = UPstream::myProcNo(comm);
const label numProc = UPstream::nProcs(comm);
if (UPstream::warnComm >= 0 && comm != UPstream::warnComm)
if (UPstream::warnComm != -1 && comm != UPstream::warnComm)
{
Pout<< "** non-blocking consensus Alltoall (list):";
Pout<< " numProc:" << numProc
@ -717,7 +717,7 @@ void Foam::PstreamDetail::allToAllConsensus
const label myProci = UPstream::myProcNo(comm);
const label numProc = UPstream::nProcs(comm);
if (UPstream::warnComm >= 0 && comm != UPstream::warnComm)
if (UPstream::warnComm != -1 && comm != UPstream::warnComm)
{
Pout<< "** non-blocking consensus Alltoall (map):";
Pout<< " numProc:" << numProc
@ -911,7 +911,7 @@ void Foam::PstreamDetail::gather
const label np = UPstream::nProcs(comm);
if (UPstream::warnComm >= 0 && comm != UPstream::warnComm)
if (UPstream::warnComm != -1 && comm != UPstream::warnComm)
{
if (immediate)
{
@ -1037,7 +1037,7 @@ void Foam::PstreamDetail::scatter
const label np = UPstream::nProcs(comm);
if (UPstream::warnComm >= 0 && comm != UPstream::warnComm)
if (UPstream::warnComm != -1 && comm != UPstream::warnComm)
{
if (immediate)
{
@ -1165,7 +1165,7 @@ void Foam::PstreamDetail::gatherv
const label np = UPstream::nProcs(comm);
if (UPstream::warnComm >= 0 && comm != UPstream::warnComm)
if (UPstream::warnComm != -1 && comm != UPstream::warnComm)
{
if (immediate)
{
@ -1317,7 +1317,7 @@ void Foam::PstreamDetail::scatterv
const label np = UPstream::nProcs(comm);
if (UPstream::warnComm >= 0 && comm != UPstream::warnComm)
if (UPstream::warnComm != -1 && comm != UPstream::warnComm)
{
if (immediate)
{

View File

@ -53,7 +53,7 @@ Foam::fixedShearStressFvPatchVectorField::fixedShearStressFvPatchVectorField
const dictionary& dict
)
:
fixedValueFvPatchVectorField(p, iF, dict, IOobjectOption::NO_READ),
fixedValueFvPatchVectorField(p, iF, dict, false),
tau0_(dict.getOrDefault<vector>("tau", Zero))
{
fvPatchField<vector>::operator=(patchInternalField());

View File

@ -67,7 +67,14 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
{
if (valueRequired)
{
if (!this->readValueEntry(dict))
if (dict.found("value"))
{
fvPatchField<scalar>::operator=
(
Field<scalar>("value", dict, p.size())
);
}
else
{
this->evaluate(Pstream::commsTypes::blocking);
}

View File

@ -92,7 +92,7 @@ atmTurbulentHeatFluxTemperatureFvPatchScalarField
const dictionary& dict
)
:
fixedGradientFvPatchScalarField(p, iF), // Bypass dictionary constructor
fixedGradientFvPatchScalarField(p, iF),
heatSource_
(
heatSourceTypeNames.getOrDefault
@ -106,11 +106,13 @@ atmTurbulentHeatFluxTemperatureFvPatchScalarField
Cp0_(Function1<scalar>::New("Cp0", dict, &db())),
q_(PatchFunction1<scalar>::New(p.patch(), "q", dict))
{
const auto* hasGrad = dict.findEntry("gradient", keyType::LITERAL);
if (hasGrad && this->readValueEntry(dict))
if (dict.found("value") && dict.found("gradient"))
{
gradient().assign(*hasGrad, p.size());
fvPatchField<scalar>::operator =
(
Field<scalar>("value", dict, p.size())
);
gradient() = Field<scalar>("gradient", dict, p.size());
}
else
{

View File

@ -56,10 +56,17 @@ freeSurfacePressureFvPatchScalarField
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF, dict, IOobjectOption::NO_READ),
fixedValueFvPatchScalarField(p, iF, dict, false),
pa_("pa", dict, p.size())
{
if (!this->readValueEntry(dict))
if (dict.found("value"))
{
fvPatchScalarField::operator=
(
scalarField("value", dict, p.size())
);
}
else
{
fvPatchField<scalar>::operator=(pa_);
}

View File

@ -44,7 +44,6 @@ $(faPatchFields)/faPatchField/faPatchFields.C
basicFaPatchFields = $(faPatchFields)/basic
$(basicFaPatchFields)/basicSymmetry/basicSymmetryFaPatchFields.C
$(basicFaPatchFields)/calculated/calculatedFaPatchFields.C
$(basicFaPatchFields)/extrapolatedCalculated/extrapolatedCalculatedFaPatchFields.C
$(basicFaPatchFields)/coupled/coupledFaPatchFields.C
$(basicFaPatchFields)/zeroGradient/zeroGradientFaPatchFields.C
$(basicFaPatchFields)/fixedValue/fixedValueFaPatchFields.C
@ -63,13 +62,9 @@ $(constraintFaPatchFields)/symmetry/symmetryFaPatchFields.C
derivedFaPatchFields = $(faPatchFields)/derived
$(derivedFaPatchFields)/fixedValueOutflow/fixedValueOutflowFaPatchFields.C
$(derivedFaPatchFields)/inletOutlet/inletOutletFaPatchFields.C
$(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-2023 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -34,14 +34,12 @@ 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-2023 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -75,7 +75,6 @@ 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,7 +6,6 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -34,14 +33,12 @@ 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,7 +60,6 @@ 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,7 +6,6 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -96,23 +95,13 @@ template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::basicSymmetryFaPatchField<Type>::snGrad() const
{
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()));
const vectorField nHat(this->patch().edgeNormals());
Field<Type> pif(this->patchInternalField());
return
(
(transform(rot, pif) - pif)
* (this->patch().deltaCoeffs()/2.0)
);
}
return
(
transform(I - 2.0*sqr(nHat), this->patchInternalField())
- this->patchInternalField()
)*(this->patch().deltaCoeffs()/2.0);
}
@ -124,19 +113,14 @@ void Foam::basicSymmetryFaPatchField<Type>::evaluate(const Pstream::commsTypes)
this->updateCoeffs();
}
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);
}
const vectorField nHat(this->patch().edgeNormals());
Field<Type>::operator=
(
(
this->patchInternalField()
+ transform(I - 2.0*sqr(nHat), this->patchInternalField())
)/2.0
);
transformFaPatchField<Type>::evaluate();
}

View File

@ -38,8 +38,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef Foam_basicSymmetryFaPatchField_H
#define Foam_basicSymmetryFaPatchField_H
#ifndef basicSymmetryFaPatchField_H
#define basicSymmetryFaPatchField_H
#include "transformFaPatchField.H"
#include "symmetryFaPatch.H"
@ -58,6 +58,7 @@ class basicSymmetryFaPatchField
:
public transformFaPatchField<Type>
{
public:
// Constructors
@ -70,7 +71,6 @@ public:
);
//- Construct from patch, internal field and dictionary
// The "value" entry: NO_READ
basicSymmetryFaPatchField
(
const faPatch&,
@ -78,8 +78,7 @@ public:
const dictionary&
);
//- Construct by mapping given basicSymmetryFaPatchField
//- onto a new patch
//- Construct by mapping given basicSymmetryFaPatchField onto a new patch
basicSymmetryFaPatchField
(
const basicSymmetryFaPatchField<Type>&,
@ -131,6 +130,8 @@ 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
@ -141,6 +142,18 @@ 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,4 +32,28 @@ 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

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2021-2023 OpenCFD Ltd.
Copyright (C) 2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -38,7 +38,7 @@ const Foam::word& Foam::faPatchField<Type>::calculatedType()
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Foam::calculatedFaPatchField<Type>::calculatedFaPatchField
@ -51,19 +51,6 @@ Foam::calculatedFaPatchField<Type>::calculatedFaPatchField
{}
template<class Type>
Foam::calculatedFaPatchField<Type>::calculatedFaPatchField
(
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF,
const dictionary& dict,
IOobjectOption::readOption valueRequired
)
:
faPatchField<Type>(p, iF, dict, valueRequired)
{}
template<class Type>
Foam::calculatedFaPatchField<Type>::calculatedFaPatchField
(
@ -77,6 +64,18 @@ Foam::calculatedFaPatchField<Type>::calculatedFaPatchField
{}
template<class Type>
Foam::calculatedFaPatchField<Type>::calculatedFaPatchField
(
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF,
const dictionary& dict
)
:
faPatchField<Type>(p, iF, Field<Type>("value", dict, p.size()))
{}
template<class Type>
Foam::calculatedFaPatchField<Type>::calculatedFaPatchField
(
@ -99,10 +98,10 @@ Foam::calculatedFaPatchField<Type>::calculatedFaPatchField
template<class Type>
template<class AnyType>
template<class Type2>
Foam::tmp<Foam::faPatchField<Type>> Foam::faPatchField<Type>::NewCalculatedType
(
const faPatchField<AnyType>& pf
const faPatchField<Type2>& pf
)
{
auto* patchTypeCtor = patchConstructorTable(pf.patch().type());

View File

@ -6,7 +6,6 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -38,8 +37,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef Foam_calculatedFaPatchField_H
#define Foam_calculatedFaPatchField_H
#ifndef calculatedFaPatchField_H
#define calculatedFaPatchField_H
#include "faPatchField.H"
@ -57,6 +56,7 @@ class calculatedFaPatchField
:
public faPatchField<Type>
{
public:
//- Runtime type information
@ -77,9 +77,7 @@ public:
(
const faPatch&,
const DimensionedField<Type, areaMesh>&,
const dictionary& dict,
//! The "value" entry (default: optional)
IOobjectOption::readOption valueRequired = IOobjectOption::LAZY_READ
const dictionary&
);
//- Construct by mapping given patch field onto a new patch

View File

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

View File

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

View File

@ -73,12 +73,11 @@ Foam::coupledFaPatchField<Type>::coupledFaPatchField
(
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF,
const dictionary& dict,
IOobjectOption::readOption valueRequired
const dictionary& dict
)
:
lduInterfaceField(refCast<const lduInterface>(p, dict)),
faPatchField<Type>(p, iF, dict, valueRequired)
faPatchField<Type>(p, iF, dict)
{}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2019-2023 OpenCFD Ltd.
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -38,8 +38,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef Foam_coupledFaPatchField_H
#define Foam_coupledFaPatchField_H
#ifndef coupledFaPatchField_H
#define coupledFaPatchField_H
#include "lduInterfaceField.H"
#include "faPatchField.H"
@ -60,6 +60,7 @@ class coupledFaPatchField
public lduInterfaceField,
public faPatchField<Type>
{
public:
//- Runtime type information
@ -88,9 +89,7 @@ public:
(
const faPatch&,
const DimensionedField<Type, areaMesh>&,
const dictionary& dict,
//! The "value" entry (default: mandatory)
IOobjectOption::readOption valueRequired = IOobjectOption::MUST_READ
const dictionary&
);
//- Construct by mapping the given coupledFaPatchField onto a new patch
@ -212,27 +211,6 @@ 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,70 +29,17 @@ License
#include "coupledFaPatchFields.H"
#include "areaFields.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makeFaPatchFieldsTypeName(coupled);
makeFaPatchFieldTypeName(label, coupled);
}
// * * * * * * * * * * * * * * * Specialisations * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
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);
}
makeFaPatchFieldsTypeName(coupled);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
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);
}
} // End namespace Foam
// ************************************************************************* //

View File

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

View File

@ -1,117 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "extrapolatedCalculatedFaPatchField.H"
#include "faPatchFieldMapper.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::extrapolatedCalculatedFaPatchField<Type>::
extrapolatedCalculatedFaPatchField
(
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF
)
:
calculatedFaPatchField<Type>(p, iF)
{}
template<class Type>
Foam::extrapolatedCalculatedFaPatchField<Type>::
extrapolatedCalculatedFaPatchField
(
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF,
const dictionary& dict
)
:
calculatedFaPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ)
{
calculatedFaPatchField<Type>::operator==(this->patchInternalField());
}
template<class Type>
Foam::extrapolatedCalculatedFaPatchField<Type>::
extrapolatedCalculatedFaPatchField
(
const extrapolatedCalculatedFaPatchField<Type>& ptf,
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF,
const faPatchFieldMapper& mapper
)
:
calculatedFaPatchField<Type>(ptf, p, iF, mapper)
{}
template<class Type>
Foam::extrapolatedCalculatedFaPatchField<Type>::
extrapolatedCalculatedFaPatchField
(
const extrapolatedCalculatedFaPatchField<Type>& ptf
)
:
calculatedFaPatchField<Type>(ptf)
{}
template<class Type>
Foam::extrapolatedCalculatedFaPatchField<Type>::
extrapolatedCalculatedFaPatchField
(
const extrapolatedCalculatedFaPatchField<Type>& ptf,
const DimensionedField<Type, areaMesh>& iF
)
:
calculatedFaPatchField<Type>(ptf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::extrapolatedCalculatedFaPatchField<Type>::evaluate
(
const Pstream::commsTypes
)
{
if (!this->updated())
{
this->updateCoeffs();
}
// Set to the internal field
faPatchField<Type>::patchInternalField(*this);
calculatedFaPatchField<Type>::evaluate();
}
// ************************************************************************* //

View File

@ -1,163 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::extrapolatedCalculatedFaPatchField
Group
grpGenericBoundaryConditions
Description
This boundary condition applies a zero-gradient condition from the patch
internal field onto the patch faces when \c evaluated but may also be
assigned. \c snGrad returns the patch gradient evaluated from the current
internal and patch field values rather than returning zero.
Usage
Example of the boundary condition specification:
\verbatim
<patchName>
{
type extrapolatedCalculated;
}
\endverbatim
SourceFiles
extrapolatedCalculatedFaPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef Foam_extrapolatedCalculatedFaPatchField_H
#define Foam_extrapolatedCalculatedFaPatchField_H
#include "calculatedFaPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class extrapolatedCalculatedFaPatchField Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class extrapolatedCalculatedFaPatchField
:
public calculatedFaPatchField<Type>
{
public:
//- Runtime type information
TypeName("extrapolatedCalculated");
// Constructors
//- Construct from patch and internal field
extrapolatedCalculatedFaPatchField
(
const faPatch&,
const DimensionedField<Type, areaMesh>&
);
//- Construct from patch, internal field and dictionary
extrapolatedCalculatedFaPatchField
(
const faPatch&,
const DimensionedField<Type, areaMesh>&,
const dictionary&
);
//- Construct by mapping given patchField onto a new patch
extrapolatedCalculatedFaPatchField
(
const extrapolatedCalculatedFaPatchField<Type>&,
const faPatch&,
const DimensionedField<Type, areaMesh>&,
const faPatchFieldMapper&
);
//- Construct as copy
extrapolatedCalculatedFaPatchField
(
const extrapolatedCalculatedFaPatchField<Type>&
);
//- Construct and return a clone
virtual tmp<faPatchField<Type>> clone() const
{
return tmp<faPatchField<Type>>
(
new extrapolatedCalculatedFaPatchField<Type>(*this)
);
}
//- Construct as copy setting internal field reference
extrapolatedCalculatedFaPatchField
(
const extrapolatedCalculatedFaPatchField<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 extrapolatedCalculatedFaPatchField<Type>(*this, iF)
);
}
// Member Functions
//- Evaluate the patch field
virtual void evaluate
(
const Pstream::commsTypes commsType=Pstream::commsTypes::blocking
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "extrapolatedCalculatedFaPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,46 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "extrapolatedCalculatedFaPatchFields.H"
#include "faPatchFields.H"
#include "areaFaMesh.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makeFaPatchFields(extrapolatedCalculated);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,50 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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_extrapolatedCalculatedFaPatchFields_H
#define Foam_extrapolatedCalculatedFaPatchFields_H
#include "extrapolatedCalculatedFaPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeFaPatchTypeFieldTypedefs(extrapolatedCalculated);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -26,7 +26,6 @@ License
\*---------------------------------------------------------------------------*/
#include "fixedGradientFaPatchField.H"
#include "dictionary.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -64,7 +63,7 @@ Foam::fixedGradientFaPatchField<Type>::fixedGradientFaPatchField
const dictionary& dict
)
:
faPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ),
faPatchField<Type>(p, iF),
gradient_("gradient", dict, p.size())
{
evaluate();

View File

@ -129,19 +129,20 @@ public:
}
// Member Functions
// Member functions
//- The reference gradient at boundary
virtual Field<Type>& gradient() noexcept
{
return gradient_;
}
// Return defining fields
//- The reference gradient at boundary
virtual const Field<Type>& gradient() const noexcept
{
return gradient_;
}
//- Return gradient at boundary
virtual Field<Type>& gradient()
{
return gradient_;
}
virtual const Field<Type>& gradient() const
{
return gradient_;
}
// Mapping functions

View File

@ -45,11 +45,10 @@ Foam::fixedValueFaPatchField<Type>::fixedValueFaPatchField
(
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF,
const dictionary& dict,
IOobjectOption::readOption valueRequired
const dictionary& dict
)
:
faPatchField<Type>(p, iF, dict, valueRequired)
faPatchField<Type>(p, iF, Field<Type>("value", dict, p.size()))
{}
@ -138,4 +137,5 @@ void Foam::fixedValueFaPatchField<Type>::write(Ostream& os) const
}
// ************************************************************************* //

View File

@ -6,7 +6,6 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -38,8 +37,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef Foam_fixedValueFaPatchField_H
#define Foam_fixedValueFaPatchField_H
#ifndef fixedValueFaPatchField_H
#define fixedValueFaPatchField_H
#include "faPatchField.H"
@ -57,6 +56,7 @@ class fixedValueFaPatchField
:
public faPatchField<Type>
{
public:
//- Runtime type information
@ -77,9 +77,7 @@ public:
(
const faPatch&,
const DimensionedField<Type, areaMesh>&,
const dictionary&,
//! The "value" entry (default: mandatory)
IOobjectOption::readOption valueRequired = IOobjectOption::MUST_READ
const dictionary&
);
//- Construct by mapping the given fixedValue patch field

View File

@ -95,32 +95,6 @@ Foam::mixedFaPatchField<Type>::mixedFaPatchField
{}
template<class Type>
Foam::mixedFaPatchField<Type>::mixedFaPatchField
(
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF,
const dictionary& dict,
IOobjectOption::readOption requireMixed
)
:
// The "value" entry is not required
faPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ),
refValue_(p.size()),
refGrad_(p.size()),
valueFraction_(p.size())
{
if (!readMixedEntries(dict, requireMixed))
{
// Not read (eg, optional and missing): no evaluate possible/need
return;
}
// Could also check/clamp fraction to 0-1 range
evaluate();
}
template<class Type>
Foam::mixedFaPatchField<Type>::mixedFaPatchField
(
@ -137,6 +111,23 @@ Foam::mixedFaPatchField<Type>::mixedFaPatchField
{}
template<class Type>
Foam::mixedFaPatchField<Type>::mixedFaPatchField
(
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF,
const dictionary& dict
)
:
faPatchField<Type>(p, iF),
refValue_("refValue", dict, p.size()),
refGrad_("refGradient", dict, p.size()),
valueFraction_("valueFraction", dict, p.size())
{
evaluate();
}
template<class Type>
Foam::mixedFaPatchField<Type>::mixedFaPatchField
(
@ -188,7 +179,8 @@ void Foam::mixedFaPatchField<Type>::rmap
{
faPatchField<Type>::rmap(ptf, addr);
const auto& mptf = refCast<const mixedFaPatchField<Type>>(ptf);
const mixedFaPatchField<Type>& mptf =
refCast<const mixedFaPatchField<Type>>(ptf);
refValue_.rmap(mptf.refValue_, addr);
refGrad_.rmap(mptf.refGrad_, addr);

View File

@ -79,6 +79,7 @@ class mixedFaPatchField
//- Fraction (0-1) of value used for boundary condition
scalarField valueFraction_;
protected:
//- Read the "refValue", "refGradient" and "valueFraction" entries
@ -114,10 +115,7 @@ public:
(
const faPatch&,
const DimensionedField<Type, areaMesh>&,
const dictionary&,
//! The "refValue", "refGradient", "valueFraction" entries
//! (default: mandatory)
IOobjectOption::readOption requireMixed = IOobjectOption::MUST_READ
const dictionary&
);
//- Construct by mapping the given mixedFaPatchField onto a new patch
@ -234,8 +232,7 @@ public:
//- Evaluate the patch field
virtual void evaluate
(
const Pstream::commsTypes commsType =
Pstream::commsTypes::blocking
const Pstream::commsTypes commsType = Pstream::commsTypes::blocking
);
//- Return the matrix diagonal coefficients corresponding to the
@ -265,7 +262,7 @@ public:
virtual void write(Ostream&) const;
// Member Operators
// Member operators
virtual void operator=(const UList<Type>&) {}

View File

@ -62,7 +62,7 @@ Foam::transformFaPatchField<Type>::transformFaPatchField
const dictionary& dict
)
:
faPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ)
faPatchField<Type>(p, iF, dict)
{}
@ -86,12 +86,6 @@ 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();
}
@ -117,12 +111,6 @@ 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 Foam_transformFaPatchField_H
#define Foam_transformFaPatchField_H
#ifndef transformFaPatchField_H
#define transformFaPatchField_H
#include "faPatchField.H"
#include "areaFaMesh.H"
@ -73,8 +73,7 @@ public:
const DimensionedField<Type, areaMesh>&
);
//- Construct from patch, internal field and dictionary.
// The "value" entry: NO_READ
//- Construct from patch, internal field and dictionary
transformFaPatchField
(
const faPatch&,
@ -142,12 +141,18 @@ 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,4 +37,14 @@ namespace Foam
}
// * * * * * * * * * * * * * * * Specialisations * * * * * * * * * * * * * * //
template<>
Foam::tmp<Foam::scalarField>
Foam::transformFaPatchField<Foam::scalar>::gradientInternalCoeffs() const
{
return tmp<scalarField>::New(size(), Zero);
}
// ************************************************************************* //

View File

@ -68,13 +68,12 @@ Foam::zeroGradientFaPatchField<Type>::zeroGradientFaPatchField
(
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF,
const dictionary& dict
const dictionary&
)
:
faPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ)
faPatchField<Type>(p, iF)
{
// Set to the internal field
faPatchField<Type>::patchInternalField(*this);
faPatchField<Type>::operator=(this->patchInternalField());
}

View File

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

View File

@ -72,11 +72,10 @@ Foam::cyclicFaPatchField<Type>::cyclicFaPatchField
(
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF,
const dictionary& dict,
IOobjectOption::readOption valueRequired
const dictionary& dict
)
:
coupledFaPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ),
coupledFaPatchField<Type>(p, iF, dict),
cyclicPatch_(refCast<const cyclicFaPatch>(p, dict))
{
if (!isA<cyclicFaPatch>(p))
@ -90,10 +89,7 @@ Foam::cyclicFaPatchField<Type>::cyclicFaPatchField
<< exit(FatalIOError);
}
if (IOobjectOption::isReadRequired(valueRequired))
{
this->evaluate(Pstream::commsTypes::blocking);
}
this->evaluate(Pstream::commsTypes::blocking);
}

View File

@ -62,7 +62,7 @@ class cyclicFaPatchField
virtual public cyclicLduInterfaceField,
public coupledFaPatchField<Type>
{
// Private Data
// Private data
//- Local reference cast into the cyclic patch
const cyclicFaPatch& cyclicPatch_;
@ -98,9 +98,7 @@ public:
(
const faPatch&,
const DimensionedField<Type, areaMesh>&,
const dictionary& dict,
//! Evaluate (default: mandatory)
IOobjectOption::readOption valueRequired = IOobjectOption::MUST_READ
const dictionary&
);
//- Construct by mapping given cyclicFaPatchField onto a new patch

View File

@ -38,7 +38,7 @@ Foam::emptyFaPatchField<Type>::emptyFaPatchField
const DimensionedField<Type, areaMesh>& iF
)
:
faPatchField<Type>(p, iF, Field<Type>())
faPatchField<Type>(p, iF, Field<Type>(0))
{}
@ -51,7 +51,7 @@ Foam::emptyFaPatchField<Type>::emptyFaPatchField
const faPatchFieldMapper&
)
:
faPatchField<Type>(p, iF, Field<Type>())
faPatchField<Type>(p, iF, Field<Type>(0))
{
if (!isType<emptyFaPatch>(p))
{
@ -74,7 +74,7 @@ Foam::emptyFaPatchField<Type>::emptyFaPatchField
const dictionary& dict
)
:
faPatchField<Type>(p, iF, Field<Type>())
faPatchField<Type>(p, iF, Field<Type>(0))
{
if (!isA<emptyFaPatch>(p))
{
@ -95,7 +95,12 @@ Foam::emptyFaPatchField<Type>::emptyFaPatchField
const emptyFaPatchField<Type>& ptf
)
:
faPatchField<Type>(ptf.patch(), ptf.internalField(), Field<Type>())
faPatchField<Type>
(
ptf.patch(),
ptf.internalField(),
Field<Type>(0)
)
{}
@ -106,7 +111,7 @@ Foam::emptyFaPatchField<Type>::emptyFaPatchField
const DimensionedField<Type, areaMesh>& iF
)
:
faPatchField<Type>(ptf.patch(), iF, Field<Type>())
faPatchField<Type>(ptf.patch(), iF, Field<Type>(0))
{}

View File

@ -101,7 +101,7 @@ Foam::processorFaPatchField<Type>::processorFaPatchField
const dictionary& dict
)
:
coupledFaPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ),
coupledFaPatchField<Type>(p, iF, dict),
procPatch_(refCast<const processorFaPatch>(p, dict)),
sendRequest_(-1),
recvRequest_(-1)
@ -116,12 +116,6 @@ Foam::processorFaPatchField<Type>::processorFaPatchField
<< " in file " << this->internalField().objectPath()
<< exit(FatalIOError);
}
// Use 'value' supplied, or set to internal field
if (!this->readValueEntry(dict))
{
faPatchField<Type>::patchInternalField(*this);
}
}

View File

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

View File

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

View File

@ -38,8 +38,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef Foam_symmetryFaPatchField_H
#define Foam_symmetryFaPatchField_H
#ifndef symmetryFaPatchField_H
#define symmetryFaPatchField_H
#include "basicSymmetryFaPatchField.H"
#include "symmetryFaPatch.H"
@ -58,6 +58,7 @@ class symmetryFaPatchField
:
public basicSymmetryFaPatchField<Type>
{
public:
//- Runtime type information
@ -74,7 +75,6 @@ public:
);
//- Construct from patch, internal field and dictionary
// The "value" entry: NO_READ
symmetryFaPatchField
(
const faPatch&,

View File

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

View File

@ -37,8 +37,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef Foam_wedgeFaPatchField_H
#define Foam_wedgeFaPatchField_H
#ifndef wedgeFaPatchField_H
#define wedgeFaPatchField_H
#include "transformFaPatchField.H"
#include "wedgeFaPatch.H"
@ -58,6 +58,7 @@ class wedgeFaPatchField
:
public transformFaPatchField<Type>
{
public:
//- Runtime type information
@ -74,7 +75,6 @@ public:
);
//- Construct from patch, internal field and dictionary
// The "value" entry: NO_READ
wedgeFaPatchField
(
const faPatch&,
@ -139,6 +139,18 @@ public:
};
// * * * * * * * * * * * Template Specialisations * * * * * * * * * * * * * //
template<>
tmp<scalarField> wedgeFaPatchField<scalar>::snGrad() const;
template<>
void wedgeFaPatchField<scalar>::evaluate
(
const Pstream::commsTypes commsType
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

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