ENH: patch fields writeValueEntry method (frequently used)

- add base-level readValueEntry, readMixedEntries methods
  that allow optional or mandatory reading.

STYLE: wording for patch fields comments
This commit is contained in:
Mark Olesen 2023-01-31 15:26:31 +01:00
parent b71a05a72f
commit fe4688c27f
310 changed files with 1138 additions and 648 deletions

View File

@ -203,7 +203,7 @@ void Foam::smoluchowskiJumpTFvPatchScalarField::updateCoeffs()
// Write
void Foam::smoluchowskiJumpTFvPatchScalarField::write(Ostream& os) const
{
fvPatchScalarField::write(os);
fvPatchField<scalar>::write(os);
os.writeEntryIfDifferent<word>("U", "U", UName_);
os.writeEntryIfDifferent<word>("rho", "rho", rhoName_);
@ -213,7 +213,7 @@ void Foam::smoluchowskiJumpTFvPatchScalarField::write(Ostream& os) const
os.writeEntry("accommodationCoeff", accommodationCoeff_);
Twall_.writeEntry("Twall", os);
os.writeEntry("gamma", gamma_);
writeEntry("value", os);
fvPatchField<scalar>::writeValueEntry(os);
}

View File

@ -197,7 +197,7 @@ void Foam::maxwellSlipUFvPatchVectorField::updateCoeffs()
void Foam::maxwellSlipUFvPatchVectorField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
fvPatchField<vector>::write(os);
os.writeEntryIfDifferent<word>("T", "T", TName_);
os.writeEntryIfDifferent<word>("rho", "rho", rhoName_);
os.writeEntryIfDifferent<word>("psi", "thermo:psi", psiName_);
@ -212,7 +212,7 @@ void Foam::maxwellSlipUFvPatchVectorField::write(Ostream& os) const
refValue().writeEntry("refValue", os);
valueFraction().writeEntry("valueFraction", os);
writeEntry("value", os);
fvPatchField<vector>::writeValueEntry(os);
}

View File

@ -115,11 +115,10 @@ void Foam::fixedRhoFvPatchScalarField::updateCoeffs()
void Foam::fixedRhoFvPatchScalarField::write(Ostream& os) const
{
fvPatchScalarField::write(os);
fvPatchField<scalar>::write(os);
os.writeEntryIfDifferent<word>("p", "p", pName_);
os.writeEntryIfDifferent<word>("psi", "thermo:psi", psiName_);
writeEntry("value", os);
fvPatchField<scalar>::writeValueEntry(os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -485,7 +485,7 @@ void turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField::write
Ostream& os
) const
{
mixedFvPatchScalarField::write(os);
mixedFvPatchField<scalar>::write(os);
os.writeEntry("kappaMethod", KMethodTypeNames_[method_]);
os.writeEntryIfDifferent<word>("kappa","none", kappaName_);

View File

@ -102,8 +102,8 @@ void Foam::adjointOutletPressureFvPatchScalarField::updateCoeffs()
void Foam::adjointOutletPressureFvPatchScalarField::write(Ostream& os) const
{
fvPatchScalarField::write(os);
writeEntry("value", os);
fvPatchField<scalar>::write(os);
fvPatchField<scalar>::writeValueEntry(os);
}

View File

@ -107,8 +107,8 @@ void Foam::adjointOutletVelocityFvPatchVectorField::updateCoeffs()
void Foam::adjointOutletVelocityFvPatchVectorField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
writeEntry("value", os);
fvPatchField<vector>::write(os);
fvPatchField<vector>::writeValueEntry(os);
}

View File

@ -126,9 +126,9 @@ alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField
void alphaContactAngleFvPatchScalarField::write(Ostream& os) const
{
fvPatchScalarField::write(os);
fvPatchField<scalar>::write(os);
os.writeEntry("thetaProperties", thetaProps_);
writeEntry("value", os);
fvPatchField<scalar>::writeValueEntry(os);
}

View File

@ -126,9 +126,9 @@ alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField
void alphaContactAngleFvPatchScalarField::write(Ostream& os) const
{
fvPatchScalarField::write(os);
fvPatchField<scalar>::write(os);
os.writeEntry("thetaProperties", thetaProps_);
writeEntry("value", os);
fvPatchField<scalar>::writeValueEntry(os);
}

View File

@ -195,10 +195,10 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs()
void tractionDisplacementFvPatchVectorField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
fvPatchField<vector>::write(os);
traction_.writeEntry("traction", os);
pressure_.writeEntry("pressure", os);
writeEntry("value", os);
fvPatchField<vector>::writeValueEntry(os);
}

View File

@ -182,10 +182,10 @@ void tractionDisplacementCorrectionFvPatchVectorField::updateCoeffs()
// Write
void tractionDisplacementCorrectionFvPatchVectorField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
fvPatchField<vector>::write(os);
traction_.writeEntry("traction", os);
pressure_.writeEntry("pressure", os);
writeEntry("value", os);
fvPatchField<vector>::writeValueEntry(os);
}

View File

@ -225,7 +225,7 @@ void Foam::CLASS::write
fieldData_.writeEntry("fieldData", os);
timeVsData_->writeData(os);
os.writeEntry("wordData", wordData_);
this->writeEntry("value", os);
FVPATCHF::writeValueEntry(os);
}

View File

@ -74,7 +74,7 @@ public:
const dictionary&
);
//- Construct by mapping given patchField<Type> onto a new patch
//- Construct by mapping given patch field onto a new patch
basicSymmetryPointPatchField
(
const basicSymmetryPointPatchField<Type>&,

View File

@ -77,7 +77,7 @@ public:
const dictionary&
);
//- Construct by mapping given patchField<Type> onto a new patch
//- Construct by mapping given patch field onto a new patch
calculatedPointPatchField
(
const calculatedPointPatchField<Type>&,

View File

@ -78,7 +78,7 @@ public:
const dictionary& dict
);
//- Construct by mapping given patchField<Type> onto a new patch
//- Construct by mapping given patch field onto a new patch
coupledPointPatchField
(
const coupledPointPatchField<Type>&,

View File

@ -78,7 +78,7 @@ public:
const bool valueRequired=true
);
//- Construct by mapping given patchField<Type> onto a new patch
//- Construct by mapping given patch field onto a new patch
fixedValuePointPatchField
(
const fixedValuePointPatchField<Type>&,

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019-2022 OpenCFD Ltd.
Copyright (C) 2019-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -29,6 +29,41 @@ License
#include "valuePointPatchField.H"
#include "pointPatchFieldMapper.H"
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class Type>
bool Foam::valuePointPatchField<Type>::readValueEntry
(
const dictionary& dict,
IOobjectOption::readOption readOpt
)
{
const auto& p = pointPatchFieldBase::patch();
if (!p.size()) return true; // Can be exceptionally lazy
if (!IOobjectOption::isAnyRead(readOpt)) return false;
const auto* eptr = dict.findEntry("value", keyType::LITERAL);
if (eptr)
{
Field<Type>::assign(*eptr, p.size());
return true;
}
if (IOobjectOption::isReadRequired(readOpt))
{
FatalIOErrorInFunction(dict)
<< "Required entry 'value' : missing for patch " << p.name()
<< " in dictionary " << dict.relativeName() << nl
<< exit(FatalIOError);
}
return false;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
template<class Type>
@ -164,7 +199,7 @@ template<class Type>
void Foam::valuePointPatchField<Type>::write(Ostream& os) const
{
pointPatchField<Type>::write(os);
this->writeEntry("value", os);
this->writeValueEntry(os);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
Copyright (C) 2020-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -35,8 +35,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef valuePointPatchField_H
#define valuePointPatchField_H
#ifndef Foam_valuePointPatchField_H
#define Foam_valuePointPatchField_H
#include "pointPatchField.H"
@ -55,6 +55,26 @@ class valuePointPatchField
public pointPatchField<Type>,
public Field<Type>
{
protected:
// Protected Member Functions
//- Read the "value" entry into \c *this.
// The reading can be optional (default), mandatory etc.
// \returns True on success
bool readValueEntry
(
const dictionary& dict,
IOobjectOption::readOption readOpt = IOobjectOption::LAZY_READ
);
//- Write \c *this field as a "value" entry
void writeValueEntry(Ostream& os) const
{
Field<Type>::writeEntry("value", os);
}
public:
//- Declare type-name, virtual type (with debug switch)
@ -85,7 +105,7 @@ public:
const bool valueRequired=true
);
//- Construct by mapping given patchField<Type> onto a new patch
//- Construct by mapping given patch field onto a new patch
valuePointPatchField
(
const valuePointPatchField<Type>&,

View File

@ -76,7 +76,7 @@ public:
const dictionary&
);
//- Construct by mapping given patchField<Type> onto a new patch
//- Construct by mapping given patch field onto a new patch
zeroGradientPointPatchField
(
const zeroGradientPointPatchField<Type>&,

View File

@ -83,7 +83,7 @@ public:
const dictionary&
);
//- Construct by mapping given patchField<Type> onto a new patch
//- Construct by mapping given patch field onto a new patch
cyclicPointPatchField
(
const cyclicPointPatchField<Type>&,

View File

@ -78,7 +78,7 @@ public:
const dictionary&
);
//- Construct by mapping given patchField<Type> onto a new patch
//- Construct by mapping given patch field onto a new patch
cyclicSlipPointPatchField
(
const cyclicSlipPointPatchField<Type>&,

View File

@ -78,7 +78,7 @@ public:
const dictionary&
);
//- Construct by mapping given patchField<Type> onto a new patch
//- Construct by mapping given patch field onto a new patch
emptyPointPatchField
(
const emptyPointPatchField<Type>&,

View File

@ -78,7 +78,7 @@ public:
const dictionary&
);
//- Construct by mapping given patchField<Type> onto a new patch
//- Construct by mapping given patch field onto a new patch
nonuniformTransformCyclicPointPatchField
(
const nonuniformTransformCyclicPointPatchField<Type>&,

View File

@ -82,7 +82,7 @@ public:
const dictionary&
);
//- Construct by mapping given patchField<Type> onto a new patch
//- Construct by mapping given patch field onto a new patch
processorPointPatchField
(
const processorPointPatchField<Type>&,

View File

@ -87,7 +87,7 @@ public:
const dictionary&
);
//- Construct by mapping given patchField<Type> onto a new patch
//- Construct by mapping given patch field onto a new patch
processorCyclicPointPatchField
(
const processorCyclicPointPatchField<Type>&,

View File

@ -78,7 +78,7 @@ public:
const dictionary&
);
//- Construct by mapping given patchField<Type> onto a new patch
//- Construct by mapping given patch field onto a new patch
symmetryPointPatchField
(
const symmetryPointPatchField<Type>&,

View File

@ -83,7 +83,7 @@ public:
const dictionary&
);
//- Construct by mapping given patchField<Type> onto a new patch
//- Construct by mapping given patch field onto a new patch
symmetryPlanePointPatchField
(
const symmetryPlanePointPatchField<Type>&,

View File

@ -78,7 +78,7 @@ public:
const dictionary&
);
//- Construct by mapping given patchField<Type> onto a new patch
//- Construct by mapping given patch field onto a new patch
wedgePointPatchField
(
const wedgePointPatchField<Type>&,

View File

@ -238,7 +238,7 @@ Foam::codedFixedValuePointPatchField<Type>::redirectPatchField() const
// Make sure to construct the patchfield with up-to-date value
OStringStream os;
static_cast<const Field<Type>&>(*this).writeEntry("value", os);
this->writeValueEntry(os);
IStringStream is(os.str());
dictionary constructDict(is);

View File

@ -95,7 +95,7 @@ public:
const dictionary&
);
//- Construct by mapping given patchField<Type> onto a new patch
//- Construct by mapping given patch field onto a new patch
fixedNormalSlipPointPatchField
(
const fixedNormalSlipPointPatchField<Type>&,

View File

@ -77,7 +77,7 @@ public:
const dictionary&
);
//- Construct by mapping given patchField<Type> onto a new patch
//- Construct by mapping given patch field onto a new patch
slipPointPatchField
(
const slipPointPatchField<Type>&,

View File

@ -47,6 +47,7 @@ SourceFiles
#include "pointPatch.H"
#include "DimensionedField.H"
#include "fieldTypes.H"
#include "autoPtr.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -55,8 +56,8 @@ namespace Foam
{
// Forward Declarations
class objectRegistry;
class dictionary;
class objectRegistry;
class pointPatchFieldMapper;
class pointMesh;
@ -266,7 +267,7 @@ public:
const dictionary&
);
//- Construct by mapping given patchField<Type> onto a new patch
//- Construct by mapping given patch field onto a new patch
pointPatchField
(
const pointPatchField<Type>&,
@ -361,47 +362,46 @@ public:
static const word& zeroGradientType();
// Attributes
// Attributes
//- True if this patch field fixes a value
virtual bool fixesValue() const
{
return false;
}
//- True if this patch field fixes a value
virtual bool fixesValue() const
{
return false;
}
//- True if this patch field is coupled
virtual bool coupled() const
{
return false;
}
//- True if this patch field is coupled
virtual bool coupled() const
{
return false;
}
//- The constraint type this pointPatchField implements.
virtual const word& constraintType() const
{
return word::null;
}
//- The constraint type this pointPatchField implements.
virtual const word& constraintType() const
{
return word::null;
}
// Access
// Access
//- Return the patch size
label size() const
{
return patch().size();
}
//- Return the patch size
label size() const
{
return patch().size();
}
//- Return const-reference to the dimensioned internal field
const DimensionedField<Type, pointMesh>& internalField()
const noexcept
{
return internalField_;
}
//- Return const-reference to the dimensioned internal field
const DimensionedField<Type, pointMesh>& internalField() const noexcept
{
return internalField_;
}
//- Return const-reference to the internal field values
const Field<Type>& primitiveField() const noexcept
{
return internalField_;
}
//- Return const-reference to the internal field values
const Field<Type>& primitiveField() const noexcept
{
return internalField_;
}
// Evaluation Functions
@ -537,9 +537,9 @@ public:
// By generic these do nothing unless the patch actually has boundary
// values
virtual void operator==(const pointPatchField<Type>&){}
virtual void operator==(const Field<Type>&){}
virtual void operator==(const Type&){}
virtual void operator==(const pointPatchField<Type>&){}
virtual void operator==(const Field<Type>&){}
virtual void operator==(const Type&){}
// Ostream Operator

View File

@ -292,7 +292,7 @@ void alphatJayatillekeWallFunctionFvPatchScalarField::write(Ostream& os) const
os.writeEntry("Prt", Prt_);
os.writeEntryIfDifferent<scalar>("kappa", 0.41, kappa_);
os.writeEntryIfDifferent<scalar>("E", 9.8, E_);
writeEntry("value", os);
fvPatchField<scalar>::writeValueEntry(os);
}

View File

@ -168,11 +168,11 @@ void turbulentMixingLengthDissipationRateInletFvPatchScalarField::write
Ostream& os
) const
{
fvPatchScalarField::write(os);
fvPatchField<scalar>::write(os);
os.writeEntry("mixingLength", mixingLength_);
os.writeEntry("phi", this->phiName_);
os.writeEntry("k", kName_);
writeEntry("value", os);
fvPatchField<scalar>::writeValueEntry(os);
}

View File

@ -157,11 +157,11 @@ void turbulentMixingLengthFrequencyInletFvPatchScalarField::write
Ostream& os
) const
{
fvPatchScalarField::write(os);
fvPatchField<scalar>::write(os);
os.writeEntry("mixingLength", mixingLength_);
os.writeEntry("phi", this->phiName_);
os.writeEntry("k", kName_);
writeEntry("value", os);
fvPatchField<scalar>::writeValueEntry(os);
}

View File

@ -128,9 +128,9 @@ void Foam::fixedShearStressFvPatchVectorField::updateCoeffs()
void Foam::fixedShearStressFvPatchVectorField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
fvPatchField<vector>::write(os);
os.writeEntry("tau", tau0_);
writeEntry("value", os);
fvPatchField<vector>::writeValueEntry(os);
}

View File

@ -615,7 +615,7 @@ void Foam::epsilonWallFunctionFvPatchScalarField::write
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
writeEntry("value", os);
fvPatchField<scalar>::writeValueEntry(os);
}

View File

@ -204,7 +204,7 @@ void Foam::kLowReWallFunctionFvPatchScalarField::write
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
writeEntry("value", os);
fvPatchField<scalar>::writeValueEntry(os);
}

View File

@ -103,7 +103,7 @@ template<class Type>
void Foam::kqRWallFunctionFvPatchField<Type>::write(Ostream& os) const
{
zeroGradientFvPatchField<Type>::write(os);
this->writeEntry("value", os);
fvPatchField<Type>::writeValueEntry(os);
}

View File

@ -137,7 +137,7 @@ void Foam::nutLowReWallFunctionFvPatchScalarField::write
) const
{
nutWallFunctionFvPatchScalarField::write(os);
writeEntry("value", os);
fvPatchField<scalar>::writeValueEntry(os);
}

View File

@ -232,7 +232,7 @@ void Foam::nutUBlendedWallFunctionFvPatchScalarField::write
{
nutWallFunctionFvPatchScalarField::write(os);
writeLocalEntries(os);
writeEntry("value", os);
fvPatchField<scalar>::writeValueEntry(os);
}

View File

@ -343,7 +343,7 @@ void Foam::nutURoughWallFunctionFvPatchScalarField::write
{
nutWallFunctionFvPatchScalarField::write(os);
writeLocalEntries(os);
writeEntry("value", os);
fvPatchField<scalar>::writeValueEntry(os);
}

View File

@ -350,7 +350,7 @@ void Foam::nutUSpaldingWallFunctionFvPatchScalarField::write
{
nutWallFunctionFvPatchScalarField::write(os);
writeLocalEntries(os);
writeEntry("value", os);
fvPatchField<scalar>::writeValueEntry(os);
}

View File

@ -225,7 +225,7 @@ void Foam::nutUTabulatedWallFunctionFvPatchScalarField::write
{
nutWallFunctionFvPatchScalarField::write(os);
writeLocalEntries(os);
writeEntry("value", os);
fvPatchField<scalar>::writeValueEntry(os);
}

View File

@ -313,7 +313,7 @@ void Foam::nutUWallFunctionFvPatchScalarField::write
{
nutWallFunctionFvPatchScalarField::write(os);
writeLocalEntries(os);
writeEntry("value", os);
fvPatchField<scalar>::writeValueEntry(os);
}

View File

@ -242,7 +242,7 @@ void Foam::nutkRoughWallFunctionFvPatchScalarField::write
{
nutWallFunctionFvPatchScalarField::write(os);
writeLocalEntries(os);
writeEntry("value", os);
fvPatchField<scalar>::writeValueEntry(os);
}

View File

@ -270,7 +270,7 @@ void Foam::nutkWallFunctionFvPatchScalarField::write
{
nutWallFunctionFvPatchScalarField::write(os);
writeLocalEntries(os);
writeEntry("value", os);
fvPatchField<scalar>::writeValueEntry(os);
}

View File

@ -606,7 +606,7 @@ void Foam::omegaWallFunctionFvPatchScalarField::write
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
writeEntry("value", os);
fvPatchField<scalar>::writeValueEntry(os);
}

View File

@ -149,10 +149,10 @@ void atmBoundaryLayerInletEpsilonFvPatchScalarField::rmap
void atmBoundaryLayerInletEpsilonFvPatchScalarField::write(Ostream& os) const
{
fvPatchScalarField::write(os);
fvPatchField<scalar>::write(os);
os.writeEntryIfDifferent<word>("phi", "phi", phiName_);
atmBoundaryLayer::write(os);
writeEntry("value", os);
fvPatchField<scalar>::writeValueEntry(os);
}

View File

@ -148,10 +148,10 @@ void atmBoundaryLayerInletKFvPatchScalarField::rmap
void atmBoundaryLayerInletKFvPatchScalarField::write(Ostream& os) const
{
fvPatchScalarField::write(os);
fvPatchField<scalar>::write(os);
os.writeEntryIfDifferent<word>("phi", "phi", phiName_);
atmBoundaryLayer::write(os);
writeEntry("value", os);
fvPatchField<scalar>::writeValueEntry(os);
}

View File

@ -147,10 +147,10 @@ void atmBoundaryLayerInletOmegaFvPatchScalarField::rmap
void atmBoundaryLayerInletOmegaFvPatchScalarField::write(Ostream& os) const
{
fvPatchScalarField::write(os);
fvPatchField<scalar>::write(os);
os.writeEntryIfDifferent<word>("phi", "phi", phiName_);
atmBoundaryLayer::write(os);
writeEntry("value", os);
fvPatchField<scalar>::writeValueEntry(os);
}

View File

@ -148,10 +148,10 @@ void atmBoundaryLayerInletVelocityFvPatchVectorField::rmap
void atmBoundaryLayerInletVelocityFvPatchVectorField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
fvPatchField<vector>::write(os);
os.writeEntryIfDifferent<word>("phi", "phi", phiName_);
atmBoundaryLayer::write(os);
writeEntry("value", os);
fvPatchField<vector>::writeValueEntry(os);
}

View File

@ -230,12 +230,12 @@ void atmTurbulentHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
void atmTurbulentHeatFluxTemperatureFvPatchScalarField::write(Ostream& os) const
{
fixedGradientFvPatchScalarField::write(os);
fixedGradientFvPatchField<scalar>::write(os);
os.writeEntry("heatSource", heatSourceTypeNames[heatSource_]);
os.writeEntry("alphaEff", alphaEffName_);
Cp0_->writeData(os);
q_->writeData(os);
writeEntry("value", os);
fvPatchField<scalar>::writeValueEntry(os);
}

View File

@ -321,7 +321,7 @@ void atmAlphatkWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
writeEntry("value", os);
fvPatchField<scalar>::writeValueEntry(os);
}

View File

@ -236,7 +236,7 @@ void Foam::atmEpsilonWallFunctionFvPatchScalarField::write
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
writeEntry("value", os);
fvPatchField<scalar>::writeValueEntry(os);
}

View File

@ -215,7 +215,7 @@ void atmNutUWallFunctionFvPatchScalarField::write(Ostream& os) const
{
nutWallFunctionFvPatchScalarField::write(os);
writeLocalEntries(os);
writeEntry("value", os);
fvPatchField<scalar>::writeValueEntry(os);
}

View File

@ -236,7 +236,7 @@ void atmNutWallFunctionFvPatchScalarField::write(Ostream& os) const
{
nutWallFunctionFvPatchScalarField::write(os);
writeLocalEntries(os);
writeEntry("value", os);
fvPatchField<scalar>::writeValueEntry(os);
}

View File

@ -223,7 +223,7 @@ void atmNutkWallFunctionFvPatchScalarField::write(Ostream& os) const
{
nutWallFunctionFvPatchScalarField::write(os);
writeLocalEntries(os);
writeEntry("value", os);
fvPatchField<scalar>::writeValueEntry(os);
}

View File

@ -220,7 +220,7 @@ void Foam::atmOmegaWallFunctionFvPatchScalarField::write
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
writeEntry("value", os);
fvPatchField<scalar>::writeValueEntry(os);
}

View File

@ -166,9 +166,9 @@ void Foam::freeSurfacePressureFvPatchScalarField::updateCoeffs()
void Foam::freeSurfacePressureFvPatchScalarField::write(Ostream& os) const
{
fvPatchScalarField::write(os);
fvPatchField<scalar>::write(os);
pa_.writeEntry("pa", os);
writeEntry("value", os);
fvPatchField<scalar>::writeValueEntry(os);
}

View File

@ -113,8 +113,8 @@ void Foam::freeSurfaceVelocityFvPatchVectorField::updateCoeffs()
void Foam::freeSurfaceVelocityFvPatchVectorField::write(Ostream& os) const
{
fixedGradientFvPatchVectorField::write(os);
writeEntry("value", os);
fixedGradientFvPatchField<vector>::write(os);
fvPatchField<vector>::writeValueEntry(os);
}

View File

@ -181,7 +181,7 @@ void solidBodyMotionDisplacementPointPatchVectorField::
write(Ostream& os) const
{
// Note: write value
fixedValuePointPatchVectorField::write(os);
fixedValuePointPatchField<vector>::write(os);
os.writeEntry(solidBodyMotionFunction::typeName, SBMFPtr_->type());

View File

@ -86,7 +86,7 @@ public:
const dictionary&
);
//- Construct by mapping given patchField<vector> onto a new patch
//- Construct by mapping given patch field onto a new patch
solidBodyMotionDisplacementPointPatchVectorField
(
const solidBodyMotionDisplacementPointPatchVectorField&,

View File

@ -211,7 +211,7 @@ template<class Type>
void Foam::calculatedFaPatchField<Type>::write(Ostream& os) const
{
faPatchField<Type>::write(os);
this->writeEntry("value", os);
faPatchField<Type>::writeValueEntry(os);
}

View File

@ -80,7 +80,7 @@ public:
const dictionary&
);
//- Construct by mapping given patchField<Type> onto a new patch
//- Construct by mapping given patch field onto a new patch
calculatedFaPatchField
(
const calculatedFaPatchField<Type>&,

View File

@ -178,7 +178,7 @@ template<class Type>
void Foam::coupledFaPatchField<Type>::write(Ostream& os) const
{
faPatchField<Type>::write(os);
this->writeEntry("value", os);
faPatchField<Type>::writeValueEntry(os);
}

View File

@ -84,8 +84,8 @@ public:
const dictionary&
);
//- Construct by mapping the given fixedGradientFaPatchField<Type>
// onto a new patch
//- Construct by mapping the given fixedGradient patch field
//- onto a new patch
fixedGradientFaPatchField
(
const fixedGradientFaPatchField<Type>&,

View File

@ -133,7 +133,7 @@ template<class Type>
void Foam::fixedValueFaPatchField<Type>::write(Ostream& os) const
{
faPatchField<Type>::write(os);
this->writeEntry("value", os);
faPatchField<Type>::writeValueEntry(os);
}

View File

@ -80,8 +80,8 @@ public:
const dictionary&
);
//- Construct by mapping the given fixedValueFaPatchField<Type>
// onto a new patch
//- Construct by mapping the given fixedValue patch field
//- onto a new patch
fixedValueFaPatchField
(
const fixedValueFaPatchField<Type>&,

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -27,7 +28,58 @@ License
#include "mixedFaPatchField.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class Type>
bool Foam::mixedFaPatchField<Type>::readMixedEntries
(
const dictionary& dict,
IOobjectOption::readOption readOpt
)
{
const auto& p = faPatchFieldBase::patch();
if (!p.size()) return true; // Can be exceptionally lazy
if (!IOobjectOption::isAnyRead(readOpt)) return false;
// If there is a 'refValue', also require all others
const auto* hasValue = dict.findEntry("refValue", keyType::LITERAL);
if (!hasValue && IOobjectOption::isReadOptional(readOpt))
{
return false;
}
const auto* hasGrad = dict.findEntry("refGradient", keyType::LITERAL);
const auto* hasFrac = dict.findEntry("valueFraction", keyType::LITERAL);
// Combined error message on failure
if (!hasValue || !hasGrad || !hasFrac)
{
FatalIOErrorInFunction(dict)
<< "Required entries:";
if (!hasValue) FatalIOError << " 'refValue'";
if (!hasGrad) FatalIOError << " 'refGradient'";
if (!hasFrac) FatalIOError << " 'valueFraction'";
FatalIOError
<< " : missing for patch " << p.name()
<< " : in dictionary " << dict.relativeName() << nl
<< exit(FatalIOError);
}
// Everything verified - can assign
refValue_.assign(*hasValue, p.size());
refGrad_.assign(*hasGrad, p.size());
valueFraction_.assign(*hasFrac, p.size());
return true;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::mixedFaPatchField<Type>::mixedFaPatchField
@ -217,7 +269,7 @@ void Foam::mixedFaPatchField<Type>::write(Ostream& os) const
refValue_.writeEntry("refValue", os);
refGrad_.writeEntry("refGradient", os);
valueFraction_.writeEntry("valueFraction", os);
this->writeEntry("value", os);
faPatchField<Type>::writeValueEntry(os);
}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -27,6 +28,17 @@ Class
Foam::mixedFaPatchField
Description
This boundary condition provides a base class for 'mixed' type boundary
conditions, i.e. conditions that mix fixed value and patch-normal gradient
conditions.
Usage
\table
Property | Description | Required | Default
refValue | fixed value | yes |
refGradient | patch normal gradient | yes |
valueFraction | value weighting (0-1) | yes |
\endtable
Author
Zeljko Tukovic, FMENA
@ -37,8 +49,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef mixedFaPatchField_H
#define mixedFaPatchField_H
#ifndef Foam_mixedFaPatchField_H
#define Foam_mixedFaPatchField_H
#include "faPatchField.H"
@ -56,7 +68,7 @@ class mixedFaPatchField
:
public faPatchField<Type>
{
// Private data
// Private Data
//- Value field
Field<Type> refValue_;
@ -68,6 +80,21 @@ class mixedFaPatchField
scalarField valueFraction_;
protected:
//- Read the "refValue", "refGradient" and "valueFraction" entries
//- into their respective places.
// The reading can be optional (default), mandatory etc.
// If refValue is to be read, refGradient and valueFraction must
// also exist.
// \returns True on success
bool readMixedEntries
(
const dictionary& dict,
IOobjectOption::readOption readOpt = IOobjectOption::LAZY_READ
);
public:
//- Runtime type information

View File

@ -265,7 +265,7 @@ template<class Type>
void Foam::slicedFaPatchField<Type>::write(Ostream& os) const
{
faPatchField<Type>::write(os);
this->writeEntry("value", os);
faPatchField<Type>::writeValueEntry(os);
}

View File

@ -103,8 +103,8 @@ public:
const dictionary&
);
//- Construct by mapping the given slicedFaPatchField<Type>
// onto a new patch
//- Construct by mapping the given sliced patch field
//- onto a new patch
slicedFaPatchField
(
const slicedFaPatchField<Type>&,

View File

@ -81,8 +81,8 @@ public:
const dictionary&
);
//- Construct by mapping the given transformFaPatchField<Type>
// onto a new patch
//- Construct by mapping the given transform patch field
//- onto a new patch
transformFaPatchField
(
const transformFaPatchField<Type>&,

View File

@ -80,8 +80,8 @@ public:
const dictionary&
);
//- Construct by mapping the given zeroGradientFaPatchField<Type>
// onto a new patch
//- Construct by mapping the given zeroGradient patch field
//- onto a new patch
zeroGradientFaPatchField
(
const zeroGradientFaPatchField<Type>&,

View File

@ -167,7 +167,7 @@ template<class Type>
void clampedPlateFaPatchField<Type>::write(Ostream& os) const
{
faPatchField<Type>::write(os);
this->writeEntry("value", os);
faPatchField<Type>::writeValueEntry(os);
}

View File

@ -98,7 +98,7 @@ public:
const dictionary&
);
//- Construct by mapping the given clampedPlateFaPatchField<Type>
//- Construct by mapping the given clampedPlate patch field
//- onto a new patch
clampedPlateFaPatchField
(

View File

@ -134,7 +134,7 @@ void Foam::edgeNormalFixedValueFaPatchVectorField::updateCoeffs()
void Foam::edgeNormalFixedValueFaPatchVectorField::write(Ostream& os) const
{
fixedValueFaPatchVectorField::write(os);
fixedValueFaPatchField<vector>::write(os);
refValue_.writeEntry("refValue", os);
}

View File

@ -133,7 +133,7 @@ template<class Type>
void Foam::fixedValueOutflowFaPatchField<Type>::write(Ostream& os) const
{
faPatchField<Type>::write(os);
this->writeEntry("value", os);
faPatchField<Type>::writeValueEntry(os);
}

View File

@ -80,8 +80,8 @@ public:
const dictionary&
);
//- Construct by mapping the given fixedValueOutflowFaPatchField<Type>
// onto a new patch
//- Construct by mapping the given fixedValueOutflow patch field
//- onto a new patch
fixedValueOutflowFaPatchField
(
const fixedValueOutflowFaPatchField<Type>&,

View File

@ -138,7 +138,7 @@ void Foam::inletOutletFaPatchField<Type>::write(Ostream& os) const
faPatchField<Type>::write(os);
os.writeEntryIfDifferent<word>("phi", "phi", phiName_);
this->refValue().writeEntry("inletValue", os);
this->writeEntry("value", os);
faPatchField<Type>::writeValueEntry(os);
}

View File

@ -132,7 +132,7 @@ void Foam::timeVaryingUniformFixedValueFaPatchField<Type>::write
{
faPatchField<Type>::write(os);
timeSeries_.write(os);
this->writeEntry("value", os);
faPatchField<Type>::writeValueEntry(os);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2020-2022 OpenCFD Ltd.
Copyright (C) 2020-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -26,9 +26,45 @@ License
\*---------------------------------------------------------------------------*/
#include "dictionary.H"
#include "faPatchField.H"
#include "faPatchFieldMapper.H"
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class Type>
bool Foam::faPatchField<Type>::readValueEntry
(
const dictionary& dict,
IOobjectOption::readOption readOpt
)
{
const auto& p = faPatchFieldBase::patch();
if (!p.size()) return true; // Can be exceptionally lazy
if (!IOobjectOption::isAnyRead(readOpt)) return false;
const auto* eptr = dict.findEntry("value", keyType::LITERAL);
if (eptr)
{
Field<Type>::assign(*eptr, p.size());
return true;
}
if (IOobjectOption::isReadRequired(readOpt))
{
FatalIOErrorInFunction(dict)
<< "Required entry 'value' : missing for patch " << p.name()
<< " in dictionary " << dict.relativeName() << nl
<< exit(FatalIOError);
}
return false;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
@ -49,11 +85,11 @@ Foam::faPatchField<Type>::faPatchField
(
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF,
const Field<Type>& f
const Field<Type>& pfld
)
:
faPatchFieldBase(p),
Field<Type>(f),
Field<Type>(pfld),
internalField_(iF)
{}
@ -61,14 +97,13 @@ Foam::faPatchField<Type>::faPatchField
template<class Type>
Foam::faPatchField<Type>::faPatchField
(
const faPatchField<Type>& ptf,
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF,
const faPatchFieldMapper& mapper
Field<Type>&& pfld
)
:
faPatchFieldBase(ptf, p),
Field<Type>(ptf, mapper),
faPatchFieldBase(p),
Field<Type>(std::move(pfld)),
internalField_(iF)
{}
@ -101,6 +136,21 @@ Foam::faPatchField<Type>::faPatchField
}
template<class Type>
Foam::faPatchField<Type>::faPatchField
(
const faPatchField<Type>& ptf,
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF,
const faPatchFieldMapper& mapper
)
:
faPatchFieldBase(ptf, p),
Field<Type>(ptf, mapper),
internalField_(iF)
{}
template<class Type>
Foam::faPatchField<Type>::faPatchField
(

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2019-2022 OpenCFD Ltd.
Copyright (C) 2019-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -51,6 +51,7 @@ SourceFiles
#include "faPatch.H"
#include "DimensionedField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -58,8 +59,8 @@ namespace Foam
{
// Forward Declarations
class objectRegistry;
class dictionary;
class objectRegistry;
class faPatchFieldMapper;
class areaMesh;
@ -195,6 +196,25 @@ class faPatchField
//- Reference to internal field
const DimensionedField<Type, areaMesh>& internalField_;
protected:
// Protected Member Functions
//- Read the "value" entry into \c *this.
// The reading can be optional (default), mandatory etc.
// \returns True on success
bool readValueEntry
(
const dictionary& dict,
IOobjectOption::readOption readOpt = IOobjectOption::LAZY_READ
);
//- Write *this field as a "value" entry
void writeValueEntry(Ostream& os) const
{
Field<Type>::writeEntry("value", os);
}
public:
@ -259,12 +279,20 @@ public:
const DimensionedField<Type, areaMesh>&
);
//- Construct from patch and internal field and patch field
//- Construct from patch, internal field and patch field
faPatchField
(
const faPatch&,
const DimensionedField<Type, areaMesh>&,
const Field<Type>&
const Field<Type>& pfld
);
//- Construct from patch, internal field and patch field
faPatchField
(
const faPatch&,
const DimensionedField<Type, areaMesh>&,
Field<Type>&& pfld
);
//- Construct from patch, internal field and dictionary
@ -375,37 +403,36 @@ public:
static const word& zeroGradientType();
// Attributes
// Attributes
//- True if this patch field fixes a value.
// Needed to check if a level has to be specified while solving
// Poissons equations.
virtual bool fixesValue() const
{
return false;
}
//- True if this patch field fixes a value.
// Needed to check if a level has to be specified while solving
// Poissons equations.
virtual bool fixesValue() const
{
return false;
}
//- True if this patch field is coupled
virtual bool coupled() const
{
return false;
}
//- True if this patch field is coupled
virtual bool coupled() const
{
return false;
}
// Access
// Access
//- Return const-reference to the dimensioned internal field
const DimensionedField<Type, areaMesh>& internalField()
const noexcept
{
return internalField_;
}
//- Return const-reference to the dimensioned internal field
const DimensionedField<Type, areaMesh>& internalField() const noexcept
{
return internalField_;
}
//- Return const-reference to the internal field values
const Field<Type>& primitiveField() const noexcept
{
return internalField_;
}
//- Return const-reference to the internal field values
const Field<Type>& primitiveField() const noexcept
{
return internalField_;
}
// Mapping

View File

@ -134,7 +134,7 @@ template<class Type>
void Foam::calculatedFaePatchField<Type>::write(Ostream& os) const
{
faePatchField<Type>::write(os);
this->writeEntry("value", os);
faePatchField<Type>::writeValueEntry(os);
}

View File

@ -38,8 +38,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef calculatedFaePatchField_H
#define calculatedFaePatchField_H
#ifndef Foam_calculatedFaePatchField_H
#define Foam_calculatedFaePatchField_H
#include "faePatchField.H"
@ -57,7 +57,6 @@ class calculatedFaePatchField
:
public faePatchField<Type>
{
public:
//- Runtime type information
@ -81,7 +80,7 @@ public:
const dictionary&
);
//- Construct by mapping given patchField<Type> onto a new patch
//- Construct by mapping given patch field onto a new patch
calculatedFaePatchField
(
const calculatedFaePatchField<Type>&,
@ -91,10 +90,7 @@ public:
);
//- Construct as copy
calculatedFaePatchField
(
const calculatedFaePatchField<Type>&
);
calculatedFaePatchField(const calculatedFaePatchField<Type>&);
//- Construct and return a clone
virtual tmp<faePatchField<Type>> clone() const
@ -128,7 +124,7 @@ public:
virtual ~calculatedFaePatchField() = default;
// Member functions
// Member Functions
// Access

View File

@ -104,7 +104,7 @@ template<class Type>
void Foam::coupledFaePatchField<Type>::write(Ostream& os) const
{
faePatchField<Type>::write(os);
this->writeEntry("value", os);
faePatchField<Type>::writeValueEntry(os);
}

View File

@ -38,8 +38,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef coupledFaePatchField_H
#define coupledFaePatchField_H
#ifndef Foam_coupledFaePatchField_H
#define Foam_coupledFaePatchField_H
#include "faePatchField.H"
#include "coupledFaPatch.H"
@ -58,7 +58,6 @@ class coupledFaePatchField
:
public faePatchField<Type>
{
public:
//- Runtime type information
@ -74,7 +73,7 @@ public:
const DimensionedField<Type, edgeMesh>&
);
//- Construct from patch and internal field and patch field
//- Construct from patch, internal field and patch field
coupledFaePatchField
(
const faPatch&,

View File

@ -92,7 +92,7 @@ template<class Type>
void Foam::fixedValueFaePatchField<Type>::write(Ostream& os) const
{
faePatchField<Type>::write(os);
this->writeEntry("value", os);
faePatchField<Type>::writeValueEntry(os);
}

View File

@ -38,8 +38,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef fixedValueFaePatchField_H
#define fixedValueFaePatchField_H
#ifndef Foam_fixedValueFaePatchField_H
#define Foam_fixedValueFaePatchField_H
#include "faePatchField.H"
@ -57,7 +57,6 @@ class fixedValueFaePatchField
:
public faePatchField<Type>
{
public:
//- Runtime type information
@ -81,8 +80,8 @@ public:
const dictionary&
);
//- Construct by mapping the given fixedValueFaePatchField<Type>
// onto a new patch
//- Construct by mapping the given fixedValue patch field
//- onto a new patch
fixedValueFaePatchField
(
const fixedValueFaePatchField<Type>&,

View File

@ -97,8 +97,7 @@ public:
const dictionary&
);
//- Construct by mapping the given slicedFaePatchField<Type>
// onto a new patch
//- Construct by mapping the given sliced patch field onto a new patch
slicedFaePatchField
(
const slicedFaePatchField<Type>&,

View File

@ -39,8 +39,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef cyclicFaePatchField_H
#define cyclicFaePatchField_H
#ifndef Foam_cyclicFaePatchField_H
#define Foam_cyclicFaePatchField_H
#include "coupledFaePatchField.H"
#include "cyclicFaPatch.H"
@ -85,7 +85,7 @@ public:
(
const faPatch&,
const DimensionedField<Type, edgeMesh>&,
const dictionary&
const dictionary& dict
);
//- Construct by mapping given cyclicFaePatchField onto a new patch

View File

@ -38,8 +38,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef emptyFaePatchField_H
#define emptyFaePatchField_H
#ifndef Foam_emptyFaePatchField_H
#define Foam_emptyFaePatchField_H
#include "faePatchField.H"
#include "emptyFaPatch.H"
@ -58,7 +58,6 @@ class emptyFaePatchField
:
public faePatchField<Type>
{
public:
//- Runtime type information

View File

@ -122,11 +122,4 @@ Foam::processorFaePatchField<Type>::processorFaePatchField
{}
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
template<class Type>
Foam::processorFaePatchField<Type>::~processorFaePatchField()
{}
// ************************************************************************* //

View File

@ -37,8 +37,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef processorFaePatchField_H
#define processorFaePatchField_H
#ifndef Foam_processorFaePatchField_H
#define Foam_processorFaePatchField_H
#include "coupledFaePatchField.H"
#include "processorFaPatch.H"
@ -57,7 +57,7 @@ class processorFaePatchField
:
public coupledFaePatchField<Type>
{
// Private data
// Private Data
//- Local reference cast into the processor patch
const processorFaPatch& procPatch_;
@ -135,8 +135,8 @@ public:
}
// Destructor
virtual ~processorFaePatchField();
//- Destructor
virtual ~processorFaePatchField() = default;
// Member Functions

View File

@ -39,8 +39,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef symmetryFaePatchField_H
#define symmetryFaePatchField_H
#ifndef Foam_symmetryFaePatchField_H
#define Foam_symmetryFaePatchField_H
#include "faePatchField.H"
#include "symmetryFaPatch.H"
@ -59,7 +59,6 @@ class symmetryFaePatchField
:
public faePatchField<Type>
{
public:
//- Runtime type information

View File

@ -37,8 +37,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef wedgeFaePatchField_H
#define wedgeFaePatchField_H
#ifndef Foam_wedgeFaePatchField_H
#define Foam_wedgeFaePatchField_H
#include "faePatchField.H"
#include "wedgeFaPatch.H"
@ -57,7 +57,6 @@ class wedgeFaePatchField
:
public faePatchField<Type>
{
public:
//- Runtime type information

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2022 OpenCFD Ltd.
Copyright (C) 2022-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -29,6 +29,41 @@ License
#include "faePatchField.H"
#include "faPatchFieldMapper.H"
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class Type>
bool Foam::faePatchField<Type>::readValueEntry
(
const dictionary& dict,
IOobjectOption::readOption readOpt
)
{
const auto& p = faePatchFieldBase::patch();
if (!p.size()) return true; // Can be exceptionally lazy
if (!IOobjectOption::isAnyRead(readOpt)) return false;
const auto* eptr = dict.findEntry("value", keyType::LITERAL);
if (eptr)
{
Field<Type>::assign(*eptr, p.size());
return true;
}
if (IOobjectOption::isReadRequired(readOpt))
{
FatalIOErrorInFunction(dict)
<< "Required entry 'value' : missing for patch " << p.name()
<< " in dictionary " << dict.relativeName() << nl
<< exit(FatalIOError);
}
return false;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
@ -49,11 +84,11 @@ Foam::faePatchField<Type>::faePatchField
(
const faPatch& p,
const DimensionedField<Type, edgeMesh>& iF,
const Field<Type>& f
const Field<Type>& pfld
)
:
faePatchFieldBase(p),
Field<Type>(f),
Field<Type>(pfld),
internalField_(iF)
{}
@ -61,14 +96,13 @@ Foam::faePatchField<Type>::faePatchField
template<class Type>
Foam::faePatchField<Type>::faePatchField
(
const faePatchField<Type>& ptf,
const faPatch& p,
const DimensionedField<Type, edgeMesh>& iF,
const faPatchFieldMapper& mapper
Field<Type>&& pfld
)
:
faePatchFieldBase(ptf, p),
Field<Type>(ptf, mapper),
faePatchFieldBase(p),
Field<Type>(std::move(pfld)),
internalField_(iF)
{}
@ -98,6 +132,21 @@ Foam::faePatchField<Type>::faePatchField
}
template<class Type>
Foam::faePatchField<Type>::faePatchField
(
const faePatchField<Type>& ptf,
const faPatch& p,
const DimensionedField<Type, edgeMesh>& iF,
const faPatchFieldMapper& mapper
)
:
faePatchFieldBase(ptf, p),
Field<Type>(ptf, mapper),
internalField_(iF)
{}
template<class Type>
Foam::faePatchField<Type>::faePatchField
(

View File

@ -51,6 +51,7 @@ SourceFiles
#include "faPatch.H"
#include "DimensionedField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -58,9 +59,8 @@ namespace Foam
{
// Forward Declarations
class objectRegistry;
class dictionary;
class objectRegistry;
class faPatchFieldMapper;
class edgeMesh;
@ -159,6 +159,25 @@ class faePatchField
//- Reference to internal field
const DimensionedField<Type, edgeMesh>& internalField_;
protected:
// Protected Member Functions
//- Read the "value" entry into \c *this.
// The reading can be optional (default), mandatory etc.
// \returns True on success
bool readValueEntry
(
const dictionary& dict,
IOobjectOption::readOption readOpt = IOobjectOption::LAZY_READ
);
//- Write \c *this field as a "value" entry
void writeValueEntry(Ostream& os) const
{
Field<Type>::writeEntry("value", os);
}
public:
@ -223,12 +242,20 @@ public:
const DimensionedField<Type, edgeMesh>&
);
//- Construct from patch and internal field and patch field
//- Construct from patch, internal field and patch field
faePatchField
(
const faPatch&,
const DimensionedField<Type, edgeMesh>&,
const Field<Type>&
const Field<Type>& pfld
);
//- Construct from patch, internal field and patch field
faePatchField
(
const faPatch&,
const DimensionedField<Type, edgeMesh>&,
Field<Type>&& pfld
);
//- Construct from patch, internal field and dictionary
@ -339,37 +366,36 @@ public:
static const word& calculatedType();
// Attributes
// Attributes
//- True if this patch field fixes a value.
// Needed to check if a level has to be specified while solving
// Poissons equations.
virtual bool fixesValue() const
{
return false;
}
//- True if this patch field fixes a value.
// Needed to check if a level has to be specified while solving
// Poissons equations.
virtual bool fixesValue() const
{
return false;
}
//- True if this patch field is coupled
virtual bool coupled() const
{
return false;
}
//- True if this patch field is coupled
virtual bool coupled() const
{
return false;
}
// Access
// Access
//- Return const-reference to the dimensioned internal field
const DimensionedField<Type, edgeMesh>& internalField()
const noexcept
{
return internalField_;
}
//- Return const-reference to the dimensioned internal field
const DimensionedField<Type, edgeMesh>& internalField() const noexcept
{
return internalField_;
}
//- Return const-reference to the internal field values
const Field<Type>& primitiveField() const noexcept
{
return internalField_;
}
//- Return const-reference to the internal field values
const Field<Type>& primitiveField() const noexcept
{
return internalField_;
}
// Mapping

View File

@ -160,11 +160,11 @@ void Foam::SRFFreestreamVelocityFvPatchVectorField::updateCoeffs()
void Foam::SRFFreestreamVelocityFvPatchVectorField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
fvPatchField<vector>::write(os);
os.writeEntry("relative", relative_);
os.writeEntry("UInf", UInf_);
os.writeEntry("phi", this->phiName_);
writeEntry("value", os);
fvPatchField<vector>::writeValueEntry(os);
}

View File

@ -154,10 +154,10 @@ void Foam::SRFVelocityFvPatchVectorField::updateCoeffs()
void Foam::SRFVelocityFvPatchVectorField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
fvPatchField<vector>::write(os);
os.writeEntry("relative", relative_);
inletValue_.writeEntry("inletValue", os);
writeEntry("value", os);
fvPatchField<vector>::writeValueEntry(os);
}

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