From b17422ef1a01cadd61f1cff00cd5b790482aeae2 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 15 Feb 2023 15:49:06 +0100 Subject: [PATCH] ENH: use readValueEntry, readMixedEntries for simpler program control --- .../T/smoluchowskiJumpTFvPatchScalarField.C | 9 +----- .../BCs/U/maxwellSlipUFvPatchVectorField.C | 15 ++++------ ...woPhaseRadCoupledMixedFvPatchScalarField.C | 8 ++--- .../fixedValue/fixedValuePointPatchField.C | 5 ++-- .../fixedValue/fixedValuePointPatchField.H | 24 ++++++++++++--- .../codedFixedValuePointPatchField.C | 13 ++++---- .../codedFixedValuePointPatchField.H | 9 +++--- .../pointPatchField/pointPatchFieldBase.C | 2 +- .../fixedShearStressFvPatchVectorField.C | 2 +- .../porousBafflePressureFvPatchField.C | 9 +----- ...entHeatFluxTemperatureFvPatchScalarField.C | 12 ++++---- .../freeSurfacePressureFvPatchScalarField.C | 11 ++----- .../fixedValueOutflowFaPatchField.C | 2 +- ...timeVaryingUniformFixedValueFaPatchField.C | 12 +++----- .../basic/calculated/calculatedFvPatchField.C | 4 +-- .../basic/calculated/calculatedFvPatchField.H | 23 ++++++++++++-- .../basic/coupled/coupledFvPatchField.C | 5 ++-- .../basic/coupled/coupledFvPatchField.H | 25 ++++++++++++---- .../extrapolatedCalculatedFvPatchField.C | 3 +- .../extrapolatedCalculatedFvPatchField.H | 5 ++-- .../fixedGradient/fixedGradientFvPatchField.C | 2 +- .../basic/fixedValue/fixedValueFvPatchField.C | 5 ++-- .../basic/fixedValue/fixedValueFvPatchField.H | 24 ++++++++++++--- .../basic/transform/transformFvPatchField.C | 2 +- .../zeroGradient/zeroGradientFvPatchField.C | 2 +- .../constraint/cyclic/cyclicFvPatchField.C | 2 +- .../cyclicACMI/cyclicACMIFvPatchField.C | 7 +++-- .../cyclicAMI/cyclicAMIFvPatchField.C | 7 +++-- .../processor/processorFvPatchField.C | 6 ++-- .../activeBaffleVelocityFvPatchVectorField.C | 2 +- ...ureForceBaffleVelocityFvPatchVectorField.C | 2 +- .../derived/advective/advectiveFvPatchField.C | 10 ++----- .../codedFixedValueFvPatchField.C | 7 +++-- .../codedFixedValueFvPatchField.H | 4 +-- ...lectrostaticDepositionFvPatchScalarField.C | 25 +++------------- .../derived/fan/fanFvPatchField.C | 9 +----- .../fixedFluxPressureFvPatchScalarField.C | 14 ++++----- .../derived/fixedJump/fixedJumpFvPatchField.C | 16 ++-------- .../fixedJumpAMI/fixedJumpAMIFvPatchField.C | 11 ++----- .../fixedMeanOutletInletFvPatchField.C | 5 +--- .../fixedProfile/fixedProfileFvPatchField.C | 2 +- .../flowRateInletVelocityFvPatchVectorField.C | 13 ++------ ...flowRateOutletVelocityFvPatchVectorField.C | 13 ++------ .../freestream/freestreamFvPatchField.C | 25 ++++++---------- .../freestreamPressureFvPatchScalarField.C | 9 +----- .../freestreamVelocityFvPatchVectorField.C | 9 +----- ...OutletTotalTemperatureFvPatchScalarField.C | 10 ++----- .../mappedMixed/mappedMixedFvPatchField.C | 13 +++----- ...FlowRateOutletVelocityFvPatchVectorField.C | 30 ++++++++----------- ...FlowRateOutletVelocityFvPatchVectorField.H | 6 ++-- .../outletMappedUniformInletFvPatchField.C | 9 +----- ...utletPhaseMeanVelocityFvPatchVectorField.C | 9 +----- .../partialSlip/partialSlipFvPatchField.C | 5 +--- ...aseHydrostaticPressureFvPatchScalarField.C | 9 +----- ...ableAlphaTotalPressureFvPatchScalarField.C | 9 +----- .../prghPressureFvPatchScalarField.C | 11 ++----- .../prghTotalPressureFvPatchScalarField.C | 11 ++----- .../rotatingWallVelocityFvPatchVectorField.C | 11 ++----- .../scaledFixedValueFvPatchField.C | 2 +- .../supersonicFreestreamFvPatchVectorField.C | 9 +----- ...urfaceNormalFixedValueFvPatchVectorField.C | 2 +- .../syringePressureFvPatchScalarField.C | 2 +- .../timeVaryingMappedFixedValueFvPatchField.C | 8 ++--- .../totalPressureFvPatchScalarField.C | 11 ++----- .../totalTemperatureFvPatchScalarField.C | 11 ++----- ...ranslatingWallVelocityFvPatchVectorField.C | 2 +- .../turbulentInletFvPatchField.C | 11 ++----- ...ityHydrostaticPressureFvPatchScalarField.C | 11 ++----- .../uniformFixedGradientFvPatchField.C | 2 +- .../uniformFixedValueFvPatchField.C | 11 ++----- .../uniformInletOutletFvPatchField.C | 9 +----- .../uniformJump/uniformJumpFvPatchField.C | 9 +----- .../uniformJumpAMIFvPatchField.C | 6 +--- ...niformNormalFixedValueFvPatchVectorField.C | 11 ++----- .../uniformTotalPressureFvPatchScalarField.C | 11 ++----- .../variableHeightFlowRateFvPatchField.C | 9 +----- .../fvPatchFields/fvPatchField/fvPatchField.H | 1 + .../fvPatchField/fvPatchFieldBase.C | 2 +- .../calculated/calculatedFvsPatchField.C | 4 +-- .../fixedValue/fixedValueFvsPatchField.C | 2 +- .../fvsPatchField/fvsPatchFieldBase.C | 2 +- ...oupledTemperatureMixedFvPatchScalarField.C | 15 ++-------- ...meVaryingMappedFixedValuePointPatchField.C | 9 +----- .../waveDisplacementPointPatchVectorField.C | 2 +- .../uniformFixedValuePointPatchField.C | 13 ++------ .../adjointOutletFluxFvPatchField.C | 9 ++---- .../oversetPolyPatch/oversetFvPatchField.C | 12 ++------ ...imeVaryingMassSorptionFvPatchScalarField.C | 9 +----- .../velocityFilmShellFvPatchVectorField.C | 7 ++--- .../vibrationShellFvPatchScalarField.C | 7 ++--- ...sRadiativeCoupledMixedFvPatchScalarField.C | 7 ++--- ...allHeatFluxTemperatureFvPatchScalarField.C | 9 ++---- ...fixedIncidentRadiationFvPatchScalarField.C | 11 +++---- ...emperatureCoupledMixedFvPatchScalarField.C | 8 ++--- .../thermalBaffle1DFvPatchScalarField.C | 9 ++---- ...RateAdvectiveDiffusiveFvPatchScalarField.C | 9 +----- ...tureCoupledBaffleMixedFvPatchScalarField.C | 7 ++--- ...eratureRadCoupledMixedFvPatchScalarField.C | 7 ++--- .../sorptionWallFunctionFvPatchScalarField.C | 12 ++++---- .../wallHeatTransferFvPatchScalarField.C | 9 +----- .../energyJump/energyJumpFvPatchScalarField.C | 9 +----- .../energyJumpAMIFvPatchScalarField.C | 9 +----- .../MarshakRadiationFvPatchScalarField.C | 18 ++++------- ...iationFixedTemperatureFvPatchScalarField.C | 9 ++---- ...iffusiveRadiationMixedFvPatchScalarField.C | 11 ++----- ...veViewFactorFixedValueFvPatchScalarField.C | 12 ++------ ...iffusiveRadiationMixedFvPatchScalarField.C | 17 ++++------- .../enthalpySorptionFvPatchScalarField.C | 9 +----- .../speciesSorptionFvPatchScalarField.C | 9 +----- ...haContactAngleTwoPhaseFvPatchScalarField.C | 10 ++++--- .../alphaFixedPressureFvPatchScalarField.C | 9 +----- 111 files changed, 328 insertions(+), 677 deletions(-) diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C b/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C index ff83ae3616..1445e56940 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C @@ -103,14 +103,7 @@ Foam::smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField << exit(FatalIOError); } - if (dict.found("value")) - { - fvPatchField::operator= - ( - scalarField("value", dict, p.size()) - ); - } - else + if (!this->readValueEntry(dict)) { fvPatchField::operator=(patchInternalField()); } diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C b/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C index 112be32386..b36732e120 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C @@ -105,18 +105,15 @@ Foam::maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField << exit(FatalIOError); } - if (dict.found("value")) + if (this->readValueEntry(dict)) { - fvPatchField::operator= - ( - vectorField("value", dict, p.size()) - ); + const auto* hasRefValue = dict.findEntry("refValue", keyType::LITERAL); + const auto* hasFrac = dict.findEntry("valueFraction", keyType::LITERAL); - if (dict.found("refValue") && dict.found("valueFraction")) + if (hasRefValue && hasFrac) { - this->refValue() = vectorField("refValue", dict, p.size()); - this->valueFraction() = - scalarField("valueFraction", dict, p.size()); + this->refValue().assign(*hasRefValue, p.size()); + this->valueFraction().assign(*hasFrac, p.size()); } else { diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionTwoPhaseEulerFoam/derivedFvPatchFields/turbulentTemperatureTwoPhaseRadCoupledMixed/turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionTwoPhaseEulerFoam/derivedFvPatchFields/turbulentTemperatureTwoPhaseRadCoupledMixed/turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField.C index b8243c017b..53213bca8b 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionTwoPhaseEulerFoam/derivedFvPatchFields/turbulentTemperatureTwoPhaseRadCoupledMixed/turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField.C +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionTwoPhaseEulerFoam/derivedFvPatchFields/turbulentTemperatureTwoPhaseRadCoupledMixed/turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField.C @@ -243,14 +243,12 @@ turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField << exit(FatalError); } - fvPatchScalarField::operator=(scalarField("value", dict, p.size())); - if (dict.found("refValue")) + this->readValueEntry(dict, IOobjectOption::MUST_READ); + + if (this->readMixedEntries(dict)) { // Full restart - refValue() = scalarField("refValue", dict, p.size()); - refGrad() = scalarField("refGradient", dict, p.size()); - valueFraction() = scalarField("valueFraction", dict, p.size()); } else { diff --git a/src/OpenFOAM/fields/pointPatchFields/basic/fixedValue/fixedValuePointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/basic/fixedValue/fixedValuePointPatchField.C index 95f87f9e74..3a7cbedfc0 100644 --- a/src/OpenFOAM/fields/pointPatchFields/basic/fixedValue/fixedValuePointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/basic/fixedValue/fixedValuePointPatchField.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2015 OpenFOAM Foundation + Copyright (C) 2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -47,10 +48,10 @@ Foam::fixedValuePointPatchField::fixedValuePointPatchField const pointPatch& p, const DimensionedField& iF, const dictionary& dict, - const bool valueRequired + IOobjectOption::readOption requireValue ) : - valuePointPatchField(p, iF, dict, valueRequired) + valuePointPatchField(p, iF, dict, requireValue) {} diff --git a/src/OpenFOAM/fields/pointPatchFields/basic/fixedValue/fixedValuePointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/basic/fixedValue/fixedValuePointPatchField.H index ed53c84404..9c7c53a45e 100644 --- a/src/OpenFOAM/fields/pointPatchFields/basic/fixedValue/fixedValuePointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/basic/fixedValue/fixedValuePointPatchField.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -34,8 +35,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef fixedValuePointPatchField_H -#define fixedValuePointPatchField_H +#ifndef Foam_fixedValuePointPatchField_H +#define Foam_fixedValuePointPatchField_H #include "valuePointPatchField.H" @@ -53,7 +54,6 @@ class fixedValuePointPatchField : public valuePointPatchField { - public: //- Runtime type information @@ -75,9 +75,25 @@ public: const pointPatch&, const DimensionedField&, const dictionary&, - const bool valueRequired=true + IOobjectOption::readOption requireValue = IOobjectOption::MUST_READ ); + //- Compatibility. Prefer with readOption + fixedValuePointPatchField + ( + const pointPatch& p, + const DimensionedField& 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 ( diff --git a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C index af6f43bd5a..0defd8cd73 100644 --- a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2016 OpenFOAM Foundation - Copyright (C) 2016-2021 OpenCFD Ltd. + Copyright (C) 2016-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -161,11 +161,11 @@ Foam::codedFixedValuePointPatchField::codedFixedValuePointPatchField ( const pointPatch& p, const DimensionedField& iF, - const dictionary& dict, - const bool valueRequired + const dictionary& dict ) : - parent_bctype(p, iF, dict, false), + // The 'value' is optional (handled below) + parent_bctype(p, iF, dict, IOobjectOption::NO_READ), codedBase(), dict_ ( @@ -186,10 +186,7 @@ Foam::codedFixedValuePointPatchField::codedFixedValuePointPatchField { updateLibrary(name_); - // Note: 'value' is used even with valueRequired = false ! This is - // inconsistent with fixedValueFvPatchField behaviour. - - if (!dict.found("value")) // Q: check for valueRequired? + if (!this->readValueEntry(dict)) { // Evaluate to assign a value this->evaluate(Pstream::commsTypes::blocking); diff --git a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.H index 6d79944f12..13b956627f 100644 --- a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2017 OpenFOAM Foundation - Copyright (C) 2019-2021 OpenCFD Ltd. + Copyright (C) 2019-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -100,8 +100,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef codedFixedValuePointPatchField_H -#define codedFixedValuePointPatchField_H +#ifndef Foam_codedFixedValuePointPatchField_H +#define Foam_codedFixedValuePointPatchField_H #include "fixedValuePointPatchFields.H" #include "codedBase.H" @@ -187,8 +187,7 @@ public: ( const pointPatch&, const DimensionedField&, - const dictionary&, - const bool valueRequired=true + const dictionary& ); //- Construct by mapping given codedFixedValuePointPatchField diff --git a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchFieldBase.C b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchFieldBase.C index 3c6db48140..3b4613866a 100644 --- a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchFieldBase.C +++ b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchFieldBase.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2022 OpenCFD Ltd. + Copyright (C) 2022-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. diff --git a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C index 286eba0bbf..744eb7df3e 100644 --- a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C +++ b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C @@ -53,7 +53,7 @@ Foam::fixedShearStressFvPatchVectorField::fixedShearStressFvPatchVectorField const dictionary& dict ) : - fixedValueFvPatchVectorField(p, iF, dict, false), + fixedValueFvPatchVectorField(p, iF, dict, IOobjectOption::NO_READ), tau0_(dict.getOrDefault("tau", Zero)) { fvPatchField::operator=(patchInternalField()); diff --git a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.C b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.C index 0f9ee0997a..da66b10349 100644 --- a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.C +++ b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.C @@ -67,14 +67,7 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField { if (valueRequired) { - if (dict.found("value")) - { - fvPatchField::operator= - ( - Field("value", dict, p.size()) - ); - } - else + if (!this->readValueEntry(dict)) { this->evaluate(Pstream::commsTypes::blocking); } diff --git a/src/atmosphericModels/derivedFvPatchFields/atmTurbulentHeatFluxTemperature/atmTurbulentHeatFluxTemperatureFvPatchScalarField.C b/src/atmosphericModels/derivedFvPatchFields/atmTurbulentHeatFluxTemperature/atmTurbulentHeatFluxTemperatureFvPatchScalarField.C index de95132cd0..cedb9bdc9a 100644 --- a/src/atmosphericModels/derivedFvPatchFields/atmTurbulentHeatFluxTemperature/atmTurbulentHeatFluxTemperatureFvPatchScalarField.C +++ b/src/atmosphericModels/derivedFvPatchFields/atmTurbulentHeatFluxTemperature/atmTurbulentHeatFluxTemperatureFvPatchScalarField.C @@ -92,7 +92,7 @@ atmTurbulentHeatFluxTemperatureFvPatchScalarField const dictionary& dict ) : - fixedGradientFvPatchScalarField(p, iF), + fixedGradientFvPatchScalarField(p, iF), // Bypass dictionary constructor heatSource_ ( heatSourceTypeNames.getOrDefault @@ -106,13 +106,11 @@ atmTurbulentHeatFluxTemperatureFvPatchScalarField Cp0_(Function1::New("Cp0", dict, &db())), q_(PatchFunction1::New(p.patch(), "q", dict)) { - if (dict.found("value") && dict.found("gradient")) + const auto* hasGrad = dict.findEntry("gradient", keyType::LITERAL); + + if (hasGrad && this->readValueEntry(dict)) { - fvPatchField::operator = - ( - Field("value", dict, p.size()) - ); - gradient() = Field("gradient", dict, p.size()); + gradient().assign(*hasGrad, p.size()); } else { diff --git a/src/dynamicFaMesh/interfaceTrackingFvMesh/fvPatchFields/freeSurfacePressure/freeSurfacePressureFvPatchScalarField.C b/src/dynamicFaMesh/interfaceTrackingFvMesh/fvPatchFields/freeSurfacePressure/freeSurfacePressureFvPatchScalarField.C index e6fdb5558d..727ffac8db 100644 --- a/src/dynamicFaMesh/interfaceTrackingFvMesh/fvPatchFields/freeSurfacePressure/freeSurfacePressureFvPatchScalarField.C +++ b/src/dynamicFaMesh/interfaceTrackingFvMesh/fvPatchFields/freeSurfacePressure/freeSurfacePressureFvPatchScalarField.C @@ -56,17 +56,10 @@ freeSurfacePressureFvPatchScalarField const dictionary& dict ) : - fixedValueFvPatchScalarField(p, iF, dict, false), + fixedValueFvPatchScalarField(p, iF, dict, IOobjectOption::NO_READ), pa_("pa", dict, p.size()) { - if (dict.found("value")) - { - fvPatchScalarField::operator= - ( - scalarField("value", dict, p.size()) - ); - } - else + if (!this->readValueEntry(dict)) { fvPatchField::operator=(pa_); } diff --git a/src/finiteArea/fields/faPatchFields/derived/fixedValueOutflow/fixedValueOutflowFaPatchField.C b/src/finiteArea/fields/faPatchFields/derived/fixedValueOutflow/fixedValueOutflowFaPatchField.C index e254e255b4..3b04c3fbbd 100644 --- a/src/finiteArea/fields/faPatchFields/derived/fixedValueOutflow/fixedValueOutflowFaPatchField.C +++ b/src/finiteArea/fields/faPatchFields/derived/fixedValueOutflow/fixedValueOutflowFaPatchField.C @@ -48,7 +48,7 @@ Foam::fixedValueOutflowFaPatchField::fixedValueOutflowFaPatchField const dictionary& dict ) : - faPatchField(p, iF, Field("value", dict, p.size())) + faPatchField(p, iF, dict, IOobjectOption::MUST_READ) {} diff --git a/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchField.C b/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchField.C index 7629080fa8..b181cab888 100644 --- a/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchField.C +++ b/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchField.C @@ -56,14 +56,10 @@ timeVaryingUniformFixedValueFaPatchField fixedValueFaPatchField(p, iF, dict, IOobjectOption::NO_READ), timeSeries_(dict) { - if (dict.found("value")) - { - faPatchField::operator==(Field("value", dict, p.size())); - } - else - { - updateCoeffs(); - } + if (!this->readValueEntry(dict)) + { + updateCoeffs(); + } } diff --git a/src/finiteVolume/fields/fvPatchFields/basic/calculated/calculatedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/calculated/calculatedFvPatchField.C index f9ecc13974..e0720407f6 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/calculated/calculatedFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/calculated/calculatedFvPatchField.C @@ -57,10 +57,10 @@ Foam::calculatedFvPatchField::calculatedFvPatchField const fvPatch& p, const DimensionedField& iF, const dictionary& dict, - const bool valueRequired + IOobjectOption::readOption requireValue ) : - fvPatchField(p, iF, dict, valueRequired) + fvPatchField(p, iF, dict, requireValue) {} diff --git a/src/finiteVolume/fields/fvPatchFields/basic/calculated/calculatedFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/basic/calculated/calculatedFvPatchField.H index 075edc9345..a97ccbdd6c 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/calculated/calculatedFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/basic/calculated/calculatedFvPatchField.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -49,8 +50,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef calculatedFvPatchField_H -#define calculatedFvPatchField_H +#ifndef Foam_calculatedFvPatchField_H +#define Foam_calculatedFvPatchField_H #include "fvPatchField.H" @@ -90,9 +91,25 @@ public: const fvPatch&, const DimensionedField&, const dictionary&, - const bool valueRequired=true + IOobjectOption::readOption requireValue = IOobjectOption::MUST_READ ); + //- Compatibility (prefer with readOption) + calculatedFvPatchField + ( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict, + const bool valueReqd + ) + : + calculatedFvPatchField + ( + p, iF, dict, + (valueReqd? IOobjectOption::MUST_READ : IOobjectOption::NO_READ) + ) + {} + //- Construct by mapping given patch field onto a new patch calculatedFvPatchField ( diff --git a/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.C index 389b562632..5fb74b5480 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -74,11 +75,11 @@ Foam::coupledFvPatchField::coupledFvPatchField const fvPatch& p, const DimensionedField& iF, const dictionary& dict, - const bool valueRequired + IOobjectOption::readOption requireValue ) : LduInterfaceField(refCast(p, dict)), - fvPatchField(p, iF, dict, valueRequired) + fvPatchField(p, iF, dict, requireValue) {} diff --git a/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.H index 968768fb5f..1a3a9cb9ba 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -38,8 +38,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef coupledFvPatchField_H -#define coupledFvPatchField_H +#ifndef Foam_coupledFvPatchField_H +#define Foam_coupledFvPatchField_H #include "LduInterfaceField.H" #include "fvPatchField.H" @@ -60,7 +60,6 @@ class coupledFvPatchField public LduInterfaceField, public fvPatchField { - public: //- Runtime type information @@ -90,9 +89,25 @@ public: const fvPatch&, const DimensionedField&, const dictionary&, - const bool valueRequired=true + IOobjectOption::readOption requireValue = IOobjectOption::MUST_READ ); + //- Compatibility (prefer with readOption) + coupledFvPatchField + ( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict, + const bool valueReqd + ) + : + coupledFvPatchField + ( + p, iF, dict, + (valueReqd? IOobjectOption::MUST_READ : IOobjectOption::NO_READ) + ) + {} + //- Construct by mapping the given coupledFvPatchField onto a new patch coupledFvPatchField ( diff --git a/src/finiteVolume/fields/fvPatchFields/basic/extrapolatedCalculated/extrapolatedCalculatedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/extrapolatedCalculated/extrapolatedCalculatedFvPatchField.C index a5e741a8dc..b6c0fa45a3 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/extrapolatedCalculated/extrapolatedCalculatedFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/extrapolatedCalculated/extrapolatedCalculatedFvPatchField.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016 OpenFOAM Foundation + Copyright (C) 2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -51,7 +52,7 @@ extrapolatedCalculatedFvPatchField const dictionary& dict ) : - calculatedFvPatchField(p, iF, dict, false) + calculatedFvPatchField(p, iF, dict, IOobjectOption::NO_READ) { evaluate(); } diff --git a/src/finiteVolume/fields/fvPatchFields/basic/extrapolatedCalculated/extrapolatedCalculatedFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/basic/extrapolatedCalculated/extrapolatedCalculatedFvPatchField.H index 3429c1bbf4..6ca1a44557 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/extrapolatedCalculated/extrapolatedCalculatedFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/basic/extrapolatedCalculated/extrapolatedCalculatedFvPatchField.H @@ -49,8 +49,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef extrapolatedCalculatedFvPatchField_H -#define extrapolatedCalculatedFvPatchField_H +#ifndef Foam_extrapolatedCalculatedFvPatchField_H +#define Foam_extrapolatedCalculatedFvPatchField_H #include "calculatedFvPatchField.H" @@ -68,7 +68,6 @@ class extrapolatedCalculatedFvPatchField : public calculatedFvPatchField { - public: //- Runtime type information diff --git a/src/finiteVolume/fields/fvPatchFields/basic/fixedGradient/fixedGradientFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/fixedGradient/fixedGradientFvPatchField.C index e2c278c277..22af67b072 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/fixedGradient/fixedGradientFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/fixedGradient/fixedGradientFvPatchField.C @@ -50,7 +50,7 @@ Foam::fixedGradientFvPatchField::fixedGradientFvPatchField const dictionary& dict ) : - fvPatchField(p, iF, dict, false), + fvPatchField(p, iF, dict, IOobjectOption::NO_READ), gradient_("gradient", dict, p.size()) { evaluate(); diff --git a/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.C index f022f059db..dd3731399d 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -58,10 +59,10 @@ Foam::fixedValueFvPatchField::fixedValueFvPatchField const fvPatch& p, const DimensionedField& iF, const dictionary& dict, - const bool valueRequired + IOobjectOption::readOption requireValue ) : - fvPatchField(p, iF, dict, valueRequired) + fvPatchField(p, iF, dict, requireValue) {} diff --git a/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.H index 13f7092153..3643d82925 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -53,8 +54,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef fixedValueFvPatchField_H -#define fixedValueFvPatchField_H +#ifndef Foam_fixedValueFvPatchField_H +#define Foam_fixedValueFvPatchField_H #include "fvPatchField.H" @@ -72,7 +73,6 @@ class fixedValueFvPatchField : public fvPatchField { - public: //- Runtime type information @@ -102,9 +102,25 @@ public: const fvPatch&, const DimensionedField&, const dictionary&, - const bool valueRequired=true + IOobjectOption::readOption requireValue = IOobjectOption::MUST_READ ); + //- Compatibility (prefer with readOption) + fixedValueFvPatchField + ( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict, + const bool valueReqd + ) + : + fixedValueFvPatchField + ( + p, iF, dict, + (valueReqd? IOobjectOption::MUST_READ : IOobjectOption::NO_READ) + ) + {} + //- Construct by mapping the given fixedValue patch field //- onto a new patch fixedValueFvPatchField diff --git a/src/finiteVolume/fields/fvPatchFields/basic/transform/transformFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/transform/transformFvPatchField.C index 86b73d0302..ed48ae1f97 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/transform/transformFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/transform/transformFvPatchField.C @@ -63,7 +63,7 @@ Foam::transformFvPatchField::transformFvPatchField const dictionary& dict ) : - fvPatchField(p, iF, dict, false) + fvPatchField(p, iF, dict, IOobjectOption::NO_READ) {} diff --git a/src/finiteVolume/fields/fvPatchFields/basic/zeroGradient/zeroGradientFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/zeroGradient/zeroGradientFvPatchField.C index 7cbadacb8f..b7ee3544fe 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/zeroGradient/zeroGradientFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/zeroGradient/zeroGradientFvPatchField.C @@ -59,7 +59,7 @@ Foam::zeroGradientFvPatchField::zeroGradientFvPatchField const dictionary& dict ) : - fvPatchField(p, iF, dict, false) + fvPatchField(p, iF, dict, IOobjectOption::NO_READ) { fvPatchField::operator=(this->patchInternalField()); } diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C index 242828f5de..631665f914 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C @@ -54,7 +54,7 @@ Foam::cyclicFvPatchField::cyclicFvPatchField const bool valueRequired ) : - coupledFvPatchField(p, iF, dict, false), // Pass no valueRequired + coupledFvPatchField(p, iF, dict, IOobjectOption::NO_READ), cyclicPatch_(refCast(p, dict)) { if (!isA(p)) diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.C index 80ffb25e5c..799007022d 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2017 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -54,7 +54,7 @@ Foam::cyclicACMIFvPatchField::cyclicACMIFvPatchField ) : cyclicACMILduInterfaceField(), - coupledFvPatchField(p, iF, dict, dict.found("value")), + coupledFvPatchField(p, iF, dict, IOobjectOption::NO_READ), cyclicACMIPatch_(refCast(p, dict)) { if (!isA(p)) @@ -68,7 +68,8 @@ Foam::cyclicACMIFvPatchField::cyclicACMIFvPatchField << exit(FatalIOError); } - if (!dict.found("value") && this->coupled()) + // Use 'value' supplied, or set to coupled field + if (!this->readValueEntry(dict) && this->coupled()) { // Extra check: make sure that the non-overlap patch is before // this so it has actually been read - evaluate will crash otherwise diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C index 462335d418..7cbf4c5d53 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2019-2022 OpenCFD Ltd. + Copyright (C) 2019-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -54,7 +54,7 @@ Foam::cyclicAMIFvPatchField::cyclicAMIFvPatchField ) : cyclicAMILduInterfaceField(), - coupledFvPatchField(p, iF, dict, dict.found("value")), + coupledFvPatchField(p, iF, dict, IOobjectOption::NO_READ), cyclicAMIPatch_(refCast(p, dict)) { if (!isA(p)) @@ -68,7 +68,8 @@ Foam::cyclicAMIFvPatchField::cyclicAMIFvPatchField << exit(FatalIOError); } - if (!dict.found("value")) + // Use 'value' supplied, or set to coupled or internal field + if (!this->readValueEntry(dict)) { if (this->coupled()) { diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C index 4657035d56..eaa4786d12 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C @@ -70,7 +70,7 @@ Foam::processorFvPatchField::processorFvPatchField const dictionary& dict ) : - coupledFvPatchField(p, iF, dict, dict.found("value")), + coupledFvPatchField(p, iF, dict, IOobjectOption::NO_READ), procPatch_(refCast(p, dict)), sendRequest_(-1), recvRequest_(-1) @@ -86,8 +86,8 @@ Foam::processorFvPatchField::processorFvPatchField << exit(FatalIOError); } - // If the value is not supplied set to the internal field - if (!dict.found("value")) + // Use 'value' supplied, or set to internal field + if (!this->readValueEntry(dict)) { fvPatchField::operator=(this->patchInternalField()); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C index a72d3fcb42..8722e4b16e 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C @@ -88,7 +88,7 @@ activeBaffleVelocityFvPatchVectorField const dictionary& dict ) : - fixedValueFvPatchVectorField(p, iF, dict, false), + fixedValueFvPatchVectorField(p, iF, dict, IOobjectOption::NO_READ), pName_(dict.getOrDefault("p", "p")), cyclicPatchName_(dict.lookup("cyclicPatch")), cyclicPatchLabel_(p.patch().boundaryMesh().findPatchID(cyclicPatchName_)), diff --git a/src/finiteVolume/fields/fvPatchFields/derived/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C index a7fb3a6047..983e4f83c0 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C @@ -94,7 +94,7 @@ activePressureForceBaffleVelocityFvPatchVectorField const dictionary& dict ) : - fixedValueFvPatchVectorField(p, iF, dict, false), + fixedValueFvPatchVectorField(p, iF, dict, IOobjectOption::NO_READ), pName_(dict.getOrDefault("p", "p")), cyclicPatchName_(dict.lookup("cyclicPatch")), cyclicPatchLabel_(p.patch().boundaryMesh().findPatchID(cyclicPatchName_)), diff --git a/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C index 7090d4f49d..7e989ae29c 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C @@ -88,14 +88,8 @@ Foam::advectiveFvPatchField::advectiveFvPatchField fieldInf_(Zero), lInf_(-GREAT) { - if (dict.found("value")) - { - fvPatchField::operator= - ( - Field("value", dict, p.size()) - ); - } - else + // Use 'value' supplied, or set to internal field + if (!this->readValueEntry(dict)) { fvPatchField::operator=(this->patchInternalField()); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C index e247e42d98..59228d43b1 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2022 OpenCFD Ltd. + Copyright (C) 2016-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -164,7 +164,8 @@ Foam::codedFixedValueFvPatchField::codedFixedValueFvPatchField const dictionary& dict ) : - parent_bctype(p, iF, dict, dict.found("value")), // Note: optional 'value' + // The 'value' is optional + parent_bctype(p, iF, dict, IOobjectOption::NO_READ), codedBase(), dict_ ( @@ -185,7 +186,7 @@ Foam::codedFixedValueFvPatchField::codedFixedValueFvPatchField { updateLibrary(name_); - if (!dict.found("value")) + if (!this->readValueEntry(dict)) { // Assign dummy value to get redirectPatchField not fail this->operator==(this->patchInternalField()); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.H index 19201b6b43..a6a7be105c 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.H @@ -102,8 +102,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef codedFixedValueFvPatchField_H -#define codedFixedValueFvPatchField_H +#ifndef Foam_codedFixedValueFvPatchField_H +#define Foam_codedFixedValueFvPatchField_H #include "fixedValueFvPatchFields.H" #include "codedBase.H" diff --git a/src/finiteVolume/fields/fvPatchFields/derived/electrostaticDeposition/electrostaticDepositionFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/electrostaticDeposition/electrostaticDepositionFvPatchScalarField.C index 3a7ccee838..e4ee7dbcf1 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/electrostaticDeposition/electrostaticDepositionFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/electrostaticDeposition/electrostaticDepositionFvPatchScalarField.C @@ -172,20 +172,10 @@ electrostaticDepositionFvPatchScalarField const dictionary& dict ) : - fixedValueFvPatchScalarField(p, iF, dict, false), + fixedValueFvPatchScalarField(p, iF, dict, IOobjectOption::NO_READ), h_("h", dict, p.size()), - qcum_ - ( - dict.found("qCumulative") - ? scalarField("qCumulative", dict, p.size()) - : scalarField(p.size(), 0) - ), - Vfilm_ - ( - dict.found("Vfilm") - ? scalarField("Vfilm", dict, p.size()) - : scalarField(p.size(), 0) - ), + qcum_("qCumulative", dict, p.size(), IOobjectOption::LAZY_READ), + Vfilm_("Vfilm", dict, p.size(), IOobjectOption::LAZY_READ), Ceffptr_ ( PatchFunction1::New(p.patch(), "CoulombicEfficiency", dict) @@ -216,14 +206,7 @@ electrostaticDepositionFvPatchScalarField timei_(-1), master_(-1) { - if (dict.found("value")) - { - fvPatchScalarField::operator= - ( - scalarField("value", dict, p.size()) - ); - } - else + if (!this->readValueEntry(dict)) { fvPatchScalarField::operator=(patchInternalField()); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C index 4a5c541943..39b7394feb 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C @@ -87,14 +87,7 @@ Foam::fanFvPatchField::fanFvPatchField this->jumpTable_ = Function1::New("jumpTable", dict, &this->db()); } - if (dict.found("value")) - { - fvPatchField::operator= - ( - Field("value", dict, p.size()) - ); - } - else + if (!this->readValueEntry(dict)) { this->evaluate(Pstream::commsTypes::blocking); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C index c50dea362f..32a98f9f11 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C @@ -52,23 +52,21 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField const dictionary& dict ) : - fixedGradientFvPatchScalarField(p, iF), + fixedGradientFvPatchScalarField(p, iF), // Bypass dictionary constructor curTimeIndex_(-1) { fvPatchFieldBase::readDict(dict); - if (dict.found("value") && dict.found("gradient")) + const auto* hasGrad = dict.findEntry("gradient", keyType::LITERAL); + + if (hasGrad && this->readValueEntry(dict)) { - fvPatchField::operator= - ( - scalarField("value", dict, p.size()) - ); - gradient() = scalarField("gradient", dict, p.size()); + gradient().assign(*hasGrad, p.size()); } else { fvPatchField::operator=(patchInternalField()); - gradient() = 0.0; + gradient() = Zero; } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C index e938771640..e55831b999 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C @@ -84,25 +84,15 @@ Foam::fixedJumpFvPatchField::fixedJumpFvPatchField { if (valueRequired) { - jump_ = Field("jump", dict, p.size()); + jump_.assign("jump", dict, p.size(), IOobjectOption::MUST_READ); } - if (dict.found("jump0")) - { - jump0_ = Field("jump0", dict, p.size()); - } + jump0_.assign("jump0", dict, p.size(), IOobjectOption::LAZY_READ); } if (valueRequired) { - if (dict.found("value")) - { - fvPatchField::operator= - ( - Field("value", dict, p.size()) - ); - } - else + if (!this->readValueEntry(dict)) { this->evaluate(Pstream::commsTypes::blocking); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C index b34710df2f..b3efdea596 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C @@ -68,17 +68,10 @@ Foam::fixedJumpAMIFvPatchField::fixedJumpAMIFvPatchField { if (this->cyclicAMIPatch().owner()) { - jump_ = Field("jump", dict, p.size()); + jump_.assign("jump", dict, p.size(), IOobjectOption::MUST_READ); } - if (dict.found("value")) - { - fvPatchField::operator= - ( - Field("value", dict, p.size()) - ); - } - else + if (!this->readValueEntry(dict)) { this->evaluate(Pstream::commsTypes::blocking); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedMeanOutletInlet/fixedMeanOutletInletFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedMeanOutletInlet/fixedMeanOutletInletFvPatchField.C index 98b4a3af5b..ff40e480f1 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedMeanOutletInlet/fixedMeanOutletInletFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedMeanOutletInlet/fixedMeanOutletInletFvPatchField.C @@ -57,10 +57,7 @@ Foam::fixedMeanOutletInletFvPatchField::fixedMeanOutletInletFvPatchField { this->phiName_ = dict.getOrDefault("phi", "phi"); - fvPatchField::operator= - ( - Field("value", dict, p.size()) - ); + this->readValueEntry(dict, IOobjectOption::MUST_READ); this->refValue() = *this; this->refGrad() = Zero; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedProfile/fixedProfileFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedProfile/fixedProfileFvPatchField.C index d9237a2403..d35a4ea197 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedProfile/fixedProfileFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedProfile/fixedProfileFvPatchField.C @@ -67,7 +67,7 @@ Foam::fixedProfileFvPatchField::fixedProfileFvPatchField const dictionary& dict ) : - fixedValueFvPatchField(p, iF, dict, false), + fixedValueFvPatchField(p, iF, dict, IOobjectOption::NO_READ), profile_(Function1::New("profile", dict, &this->db())), dir_(dict.lookup("direction")), origin_(dict.get("origin")) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C index 60e974ab55..156ce0376b 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C @@ -58,7 +58,7 @@ flowRateInletVelocityFvPatchVectorField const dictionary& dict ) : - fixedValueFvPatchField(p, iF, dict, false), + fixedValueFvPatchField(p, iF, dict, IOobjectOption::NO_READ), flowRate_(nullptr), rhoName_("rho"), rhoInlet_(dict.getOrDefault("rhoInlet", -VGREAT)), @@ -90,15 +90,8 @@ flowRateInletVelocityFvPatchVectorField << exit(FatalIOError); } - // Value field require if mass based - if (dict.found("value")) - { - fvPatchField::operator= - ( - vectorField("value", dict, p.size()) - ); - } - else + // Value field required if mass based + if (!this->readValueEntry(dict)) { evaluate(Pstream::commsTypes::blocking); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/flowRateOutletVelocity/flowRateOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/flowRateOutletVelocity/flowRateOutletVelocityFvPatchVectorField.C index a13f174803..045f59e00f 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/flowRateOutletVelocity/flowRateOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/flowRateOutletVelocity/flowRateOutletVelocityFvPatchVectorField.C @@ -56,7 +56,7 @@ flowRateOutletVelocityFvPatchVectorField const dictionary& dict ) : - fixedValueFvPatchField(p, iF, dict, false), + fixedValueFvPatchField(p, iF, dict, IOobjectOption::NO_READ), flowRate_(nullptr), rhoName_("rho"), rhoOutlet_(dict.getOrDefault("rhoOutlet", -VGREAT)), @@ -84,15 +84,8 @@ flowRateOutletVelocityFvPatchVectorField << exit(FatalIOError); } - // Value field require if mass based - if (dict.found("value")) - { - fvPatchField::operator= - ( - vectorField("value", dict, p.size()) - ); - } - else + // Value field required if mass based + if (!this->readValueEntry(dict)) { evaluate(Pstream::commsTypes::blocking); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/freestream/freestreamFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/freestream/freestreamFvPatchField.C index 437e18eadf..28f6fe0d48 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/freestream/freestreamFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/freestream/freestreamFvPatchField.C @@ -57,19 +57,15 @@ Foam::freestreamFvPatchField::freestreamFvPatchField this->phiName_ = dict.getOrDefault("phi", "phi"); - if (dict.found("freestreamValue")) + if + ( + freestreamValue().assign + ( + "freestreamValue", dict, p.size(), IOobjectOption::LAZY_READ + ) + ) { - freestreamValue() = - Field("freestreamValue", dict, p.size()); - - if (dict.found("value")) - { - fvPatchField::operator= - ( - Field("value", dict, p.size()) - ); - } - else + if (!this->readValueEntry(dict)) { fvPatchField::operator=(freestreamValue()); } @@ -82,10 +78,7 @@ Foam::freestreamFvPatchField::freestreamFvPatchField // Force user to supply an initial value // - we do not know if the supplied BC has all dependencies available - fvPatchField::operator= - ( - Field("value", dict, p.size()) - ); + this->readValueEntry(dict, IOobjectOption::MUST_READ); } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/freestreamPressure/freestreamPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/freestreamPressure/freestreamPressureFvPatchScalarField.C index 148b18ad74..aafa59a625 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/freestreamPressure/freestreamPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/freestreamPressure/freestreamPressureFvPatchScalarField.C @@ -57,14 +57,7 @@ freestreamPressureFvPatchScalarField { freestreamValue() = scalarField("freestreamValue", dict, p.size()); - if (dict.found("value")) - { - fvPatchScalarField::operator= - ( - scalarField("value", dict, p.size()) - ); - } - else + if (!this->readValueEntry(dict)) { fvPatchScalarField::operator=(freestreamValue()); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/freestreamVelocity/freestreamVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/freestreamVelocity/freestreamVelocityFvPatchVectorField.C index 7953ad230d..3a147e9886 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/freestreamVelocity/freestreamVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/freestreamVelocity/freestreamVelocityFvPatchVectorField.C @@ -51,14 +51,7 @@ Foam::freestreamVelocityFvPatchVectorField::freestreamVelocityFvPatchVectorField { freestreamValue() = vectorField("freestreamValue", dict, p.size()); - if (dict.found("value")) - { - fvPatchVectorField::operator= - ( - vectorField("value", dict, p.size()) - ); - } - else + if (!this->readValueEntry(dict)) { fvPatchVectorField::operator=(freestreamValue()); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.C index 4e25428a0b..fad888ad73 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.C @@ -89,14 +89,8 @@ inletOutletTotalTemperatureFvPatchScalarField this->phiName_ = dict.getOrDefault("phi", "phi"); this->refValue() = Zero; - if (dict.found("value")) - { - fvPatchField::operator= - ( - scalarField("value", dict, p.size()) - ); - } - else + + if (!this->readValueEntry(dict)) { fvPatchField::operator=(T0_); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedMixed/mappedMixedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedMixed/mappedMixedFvPatchField.C index 216ca035fe..da6886a505 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedMixed/mappedMixedFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedMixed/mappedMixedFvPatchField.C @@ -61,7 +61,8 @@ Foam::mappedMixedFvPatchField::mappedMixedFvPatchField const dictionary& dict ) : - mixedFvPatchField(p, iF, dict), + // Reading of mixed entries handled later... + mixedFvPatchField(p, iF, dict, IOobjectOption::NO_READ), mappedPatchFieldBase ( mappedFixedValueFvPatchField::mapper(p, iF), @@ -70,17 +71,11 @@ Foam::mappedMixedFvPatchField::mappedMixedFvPatchField ), weightFieldName_(dict.getOrDefault("weightField", word::null)) { - mixedFvPatchField::operator= - ( - Field("value", dict, p.size()) - ); + this->readValueEntry(dict, IOobjectOption::MUST_READ); - if (dict.found("refValue")) + if (this->readMixedEntries(dict)) { // Full restart - this->refValue() = Field("refValue", dict, p.size()); - this->refGrad() = Field("refGradient", dict, p.size()); - this->valueFraction() = scalarField("valueFraction", dict, p.size()); } else { diff --git a/src/finiteVolume/fields/fvPatchFields/derived/matchedFlowRateOutletVelocity/matchedFlowRateOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/matchedFlowRateOutletVelocity/matchedFlowRateOutletVelocityFvPatchVectorField.C index e1806f21b7..2b895940b7 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/matchedFlowRateOutletVelocity/matchedFlowRateOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/matchedFlowRateOutletVelocity/matchedFlowRateOutletVelocityFvPatchVectorField.C @@ -42,8 +42,8 @@ matchedFlowRateOutletVelocityFvPatchVectorField : fixedValueFvPatchField(p, iF), inletPatchName_(), - volumetric_(false), - rhoName_("rho") + rhoName_("rho"), + volumetric_(false) {} @@ -55,8 +55,9 @@ matchedFlowRateOutletVelocityFvPatchVectorField const dictionary& dict ) : - fixedValueFvPatchField(p, iF, dict, false), + fixedValueFvPatchField(p, iF, dict, IOobjectOption::NO_READ), inletPatchName_(dict.get("inletPatch")), + rhoName_(), volumetric_(dict.getOrDefault("volumetric", true)) { if (volumetric_) @@ -68,15 +69,8 @@ matchedFlowRateOutletVelocityFvPatchVectorField rhoName_ = dict.getOrDefault("rho", "rho"); } - // Value field require if mass based - if (dict.found("value")) - { - fvPatchField::operator= - ( - vectorField("value", dict, p.size()) - ); - } - else + // Value field required if mass based + if (!this->readValueEntry(dict)) { evaluate(Pstream::commsTypes::blocking); } @@ -94,8 +88,8 @@ matchedFlowRateOutletVelocityFvPatchVectorField : fixedValueFvPatchField(ptf, p, iF, mapper), inletPatchName_(ptf.inletPatchName_), - volumetric_(ptf.volumetric_), - rhoName_(ptf.rhoName_) + rhoName_(ptf.rhoName_), + volumetric_(ptf.volumetric_) {} @@ -107,8 +101,8 @@ matchedFlowRateOutletVelocityFvPatchVectorField : fixedValueFvPatchField(ptf), inletPatchName_(ptf.inletPatchName_), - volumetric_(ptf.volumetric_), - rhoName_(ptf.rhoName_) + rhoName_(ptf.rhoName_), + volumetric_(ptf.volumetric_) {} @@ -121,8 +115,8 @@ matchedFlowRateOutletVelocityFvPatchVectorField : fixedValueFvPatchField(ptf, iF), inletPatchName_(ptf.inletPatchName_), - volumetric_(ptf.volumetric_), - rhoName_(ptf.rhoName_) + rhoName_(ptf.rhoName_), + volumetric_(ptf.volumetric_) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/matchedFlowRateOutletVelocity/matchedFlowRateOutletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/matchedFlowRateOutletVelocity/matchedFlowRateOutletVelocityFvPatchVectorField.H index 25f7c69759..e1af7fb531 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/matchedFlowRateOutletVelocity/matchedFlowRateOutletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/matchedFlowRateOutletVelocity/matchedFlowRateOutletVelocityFvPatchVectorField.H @@ -82,12 +82,12 @@ class matchedFlowRateOutletVelocityFvPatchVectorField //- Inlet patch name from which the corresponding flow rate is obtained word inletPatchName_; - //- Is volumetric? - bool volumetric_; - //- Name of the density field used to normalize the mass flux word rhoName_; + //- Is volumetric? + bool volumetric_; + // Private member functions diff --git a/src/finiteVolume/fields/fvPatchFields/derived/outletMappedUniformInlet/outletMappedUniformInletFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/outletMappedUniformInlet/outletMappedUniformInletFvPatchField.C index 32ea26c9fa..7a16714c53 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/outletMappedUniformInlet/outletMappedUniformInletFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/outletMappedUniformInlet/outletMappedUniformInletFvPatchField.C @@ -168,14 +168,7 @@ outletMappedUniformInletFvPatchField } - if (dict.found("value")) - { - fvPatchField::operator= - ( - Field("value", dict, p.size()) - ); - } - else + if (!this->readValueEntry(dict)) { fvPatchField::operator=(this->patchInternalField()); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/outletPhaseMeanVelocity/outletPhaseMeanVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/outletPhaseMeanVelocity/outletPhaseMeanVelocityFvPatchVectorField.C index 7f92fff288..44b8b317d3 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/outletPhaseMeanVelocity/outletPhaseMeanVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/outletPhaseMeanVelocity/outletPhaseMeanVelocityFvPatchVectorField.C @@ -84,14 +84,7 @@ Foam::outletPhaseMeanVelocityFvPatchVectorField refGrad() = Zero; valueFraction() = 0.0; - if (dict.found("value")) - { - fvPatchVectorField::operator= - ( - vectorField("value", dict, p.size()) - ); - } - else + if (!this->readValueEntry(dict)) { fvPatchVectorField::operator=(patchInternalField()); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.C index 0d343a904a..cfb77c5732 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.C @@ -77,10 +77,7 @@ Foam::partialSlipFvPatchField::partialSlipFvPatchField fvPatchFieldBase::readDict(dict); // Backwards compatibility - leave refValue as zero unless specified - if (dict.found("refValue")) - { - refValue_ = Field("refValue", dict, p.size()); - } + refValue_.assign("refValue", dict, p.size(), IOobjectOption::LAZY_READ); evaluate(); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/phaseHydrostaticPressure/phaseHydrostaticPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/phaseHydrostaticPressure/phaseHydrostaticPressureFvPatchScalarField.C index d3ddb15c90..aa4c193faf 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/phaseHydrostaticPressure/phaseHydrostaticPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/phaseHydrostaticPressure/phaseHydrostaticPressureFvPatchScalarField.C @@ -72,14 +72,7 @@ phaseHydrostaticPressureFvPatchScalarField this->refValue() = pRefValue_; - if (dict.found("value")) - { - fvPatchScalarField::operator= - ( - scalarField("value", dict, p.size()) - ); - } - else + if (!this->readValueEntry(dict)) { fvPatchScalarField::operator=(this->refValue()); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/prghPermeableAlphaTotalPressure/prghPermeableAlphaTotalPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/prghPermeableAlphaTotalPressure/prghPermeableAlphaTotalPressureFvPatchScalarField.C index ecd795af13..0297702665 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/prghPermeableAlphaTotalPressure/prghPermeableAlphaTotalPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/prghPermeableAlphaTotalPressure/prghPermeableAlphaTotalPressureFvPatchScalarField.C @@ -75,14 +75,7 @@ prghPermeableAlphaTotalPressureFvPatchScalarField refGrad() = 0.0; valueFraction() = 0.0; - if (dict.found("value")) - { - fvPatchField::operator= - ( - Field("value", dict, p.size()) - ); - } - else + if (!this->readValueEntry(dict)) { fvPatchField::operator=(refValue()); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/prghPressure/prghPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/prghPressure/prghPressureFvPatchScalarField.C index 9baf21bbba..25eac32758 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/prghPressure/prghPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/prghPressure/prghPressureFvPatchScalarField.C @@ -55,18 +55,11 @@ prghPressureFvPatchScalarField const dictionary& dict ) : - fixedValueFvPatchScalarField(p, iF, dict, false), + fixedValueFvPatchScalarField(p, iF, dict, IOobjectOption::NO_READ), rhoName_(dict.getOrDefault("rho", "rho")), p_("p", dict, p.size()) { - if (dict.found("value")) - { - fvPatchScalarField::operator= - ( - scalarField("value", dict, p.size()) - ); - } - else + if (!this->readValueEntry(dict)) { fvPatchField::operator=(p_); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/prghTotalPressure/prghTotalPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/prghTotalPressure/prghTotalPressureFvPatchScalarField.C index 4e442c6c4e..1b7d3129bf 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/prghTotalPressure/prghTotalPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/prghTotalPressure/prghTotalPressureFvPatchScalarField.C @@ -56,20 +56,13 @@ Foam::prghTotalPressureFvPatchScalarField::prghTotalPressureFvPatchScalarField const dictionary& dict ) : - fixedValueFvPatchScalarField(p, iF, dict, false), + fixedValueFvPatchScalarField(p, iF, dict, IOobjectOption::NO_READ), UName_(dict.getOrDefault("U", "U")), phiName_(dict.getOrDefault("phi", "phi")), rhoName_(dict.getOrDefault("rho", "rho")), p0_("p0", dict, p.size()) { - if (dict.found("value")) - { - fvPatchScalarField::operator= - ( - scalarField("value", dict, p.size()) - ); - } - else + if (!this->readValueEntry(dict)) { fvPatchField::operator=(p0_); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/rotatingWallVelocity/rotatingWallVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/rotatingWallVelocity/rotatingWallVelocityFvPatchVectorField.C index 91dfeebc25..095c96367f 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/rotatingWallVelocity/rotatingWallVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/rotatingWallVelocity/rotatingWallVelocityFvPatchVectorField.C @@ -55,19 +55,12 @@ rotatingWallVelocityFvPatchVectorField const dictionary& dict ) : - fixedValueFvPatchField(p, iF, dict, false), + fixedValueFvPatchField(p, iF, dict, IOobjectOption::NO_READ), origin_(dict.lookup("origin")), axis_(dict.lookup("axis")), omega_(Function1::New("omega", dict, &db())) { - if (dict.found("value")) - { - fvPatchField::operator= - ( - vectorField("value", dict, p.size()) - ); - } - else + if (!this->readValueEntry(dict)) { // Evaluate the wall velocity updateCoeffs(); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/scaledFixedValue/scaledFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/scaledFixedValue/scaledFixedValueFvPatchField.C index bd12deb83d..c1e24474e5 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/scaledFixedValue/scaledFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/scaledFixedValue/scaledFixedValueFvPatchField.C @@ -52,7 +52,7 @@ Foam::scaledFixedValueFvPatchField::scaledFixedValueFvPatchField const dictionary& dict ) : - fixedValueFvPatchField(p, iF, dict, false), + fixedValueFvPatchField(p, iF, dict, IOobjectOption::NO_READ), scalePtr_(PatchFunction1::New(p.patch(), "scale", dict)), refValuePtr_(fvPatchField::New(p, iF, dict.subDict("refValue"))) { diff --git a/src/finiteVolume/fields/fvPatchFields/derived/supersonicFreestream/supersonicFreestreamFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/supersonicFreestream/supersonicFreestreamFvPatchVectorField.C index 7c62b6b298..ec336b2354 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/supersonicFreestream/supersonicFreestreamFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/supersonicFreestream/supersonicFreestreamFvPatchVectorField.C @@ -74,14 +74,7 @@ supersonicFreestreamFvPatchVectorField { fvPatchFieldBase::readDict(dict); - if (dict.found("value")) - { - fvPatchField::operator= - ( - vectorField("value", dict, p.size()) - ); - } - else + if (!this->readValueEntry(dict)) { fvPatchField::operator=(patchInternalField()); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.C index 15208df805..581aa9baac 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.C @@ -54,7 +54,7 @@ surfaceNormalFixedValueFvPatchVectorField const dictionary& dict ) : - fixedValueFvPatchVectorField(p, iF, dict, false), + fixedValueFvPatchVectorField(p, iF, dict, IOobjectOption::NO_READ), refValue_("refValue", dict, p.size()), ramp_(Function1::NewIfPresent("ramp", dict, word::null, &db())) { diff --git a/src/finiteVolume/fields/fvPatchFields/derived/syringePressure/syringePressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/syringePressure/syringePressureFvPatchScalarField.C index f484255a08..622f4a41c4 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/syringePressure/syringePressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/syringePressure/syringePressureFvPatchScalarField.C @@ -53,7 +53,7 @@ Foam::syringePressureFvPatchScalarField::syringePressureFvPatchScalarField const dictionary& dict ) : - fixedValueFvPatchScalarField(p, iF, dict, false), + fixedValueFvPatchScalarField(p, iF, dict, IOobjectOption::NO_READ), Ap_(dict.get("Ap")), Sp_(dict.get("Sp")), VsI_(dict.get("VsI")), diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C index 184252a32c..8491516dab 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C @@ -53,7 +53,7 @@ timeVaryingMappedFixedValueFvPatchField const dictionary& dict ) : - fixedValueFvPatchField(p, iF, dict, false), + fixedValueFvPatchField(p, iF, dict, IOobjectOption::NO_READ), uniformValue_ ( new PatchFunction1Types::MappedFile @@ -66,11 +66,7 @@ timeVaryingMappedFixedValueFvPatchField ) ) { - if (dict.found("value")) - { - fvPatchField::operator==(Field("value", dict, p.size())); - } - else + if (!this->readValueEntry(dict)) { // Note: we use evaluate() here to trigger updateCoeffs followed // by re-setting of fvatchfield::updated_ flag. This is diff --git a/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.C index 0bf923b69a..168a67ef39 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.C @@ -58,7 +58,7 @@ Foam::totalPressureFvPatchScalarField::totalPressureFvPatchScalarField const dictionary& dict ) : - fixedValueFvPatchScalarField(p, iF, dict, false), + fixedValueFvPatchScalarField(p, iF, dict, IOobjectOption::NO_READ), UName_(dict.getOrDefault("U", "U")), phiName_(dict.getOrDefault("phi", "phi")), rhoName_(dict.getOrDefault("rho", "rho")), @@ -66,14 +66,7 @@ Foam::totalPressureFvPatchScalarField::totalPressureFvPatchScalarField gamma_(psiName_ != "none" ? dict.get("gamma") : 1), p0_("p0", dict, p.size()) { - if (dict.found("value")) - { - fvPatchField::operator= - ( - scalarField("value", dict, p.size()) - ); - } - else + if (!this->readValueEntry(dict)) { fvPatchField::operator=(p0_); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.C index b9cabaefc5..011adaac1f 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.C @@ -73,21 +73,14 @@ Foam::totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField const dictionary& dict ) : - fixedValueFvPatchScalarField(p, iF, dict, false), + fixedValueFvPatchScalarField(p, iF, dict, IOobjectOption::NO_READ), UName_(dict.getOrDefault("U", "U")), phiName_(dict.getOrDefault("phi", "phi")), psiName_(dict.getOrDefault("psi", "thermo:psi")), gamma_(dict.get("gamma")), T0_("T0", dict, p.size()) { - if (dict.found("value")) - { - fvPatchField::operator= - ( - scalarField("value", dict, p.size()) - ); - } - else + if (!this->readValueEntry(dict)) { fvPatchField::operator=(T0_); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/translatingWallVelocity/translatingWallVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/translatingWallVelocity/translatingWallVelocityFvPatchVectorField.C index 8071d987a0..1d95ac3add 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/translatingWallVelocity/translatingWallVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/translatingWallVelocity/translatingWallVelocityFvPatchVectorField.C @@ -52,7 +52,7 @@ translatingWallVelocityFvPatchVectorField const dictionary& dict ) : - fixedValueFvPatchField(p, iF, dict, false), + fixedValueFvPatchField(p, iF, dict, IOobjectOption::NO_READ), U_(Function1::New("U", dict, &db())) { // Evaluate the wall velocity diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet/turbulentInletFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet/turbulentInletFvPatchField.C index 8b12da4d1b..1e4b44e756 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet/turbulentInletFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet/turbulentInletFvPatchField.C @@ -53,21 +53,14 @@ Foam::turbulentInletFvPatchField::turbulentInletFvPatchField const dictionary& dict ) : - fixedValueFvPatchField(p, iF, dict, false), + fixedValueFvPatchField(p, iF, dict, IOobjectOption::NO_READ), ranGen_(label(0)), fluctuationScale_(dict.get("fluctuationScale")), referenceField_("referenceField", dict, p.size()), alpha_(dict.getOrDefault("alpha", 0.1)), curTimeIndex_(-1) { - if (dict.found("value")) - { - fixedValueFvPatchField::operator== - ( - Field("value", dict, p.size()) - ); - } - else + if (!this->readValueEntry(dict)) { fixedValueFvPatchField::operator==(referenceField_); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.C index f691d7252f..39f71250f3 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.C @@ -56,19 +56,12 @@ uniformDensityHydrostaticPressureFvPatchScalarField const dictionary& dict ) : - fixedValueFvPatchScalarField(p, iF, dict, false), + fixedValueFvPatchScalarField(p, iF, dict, IOobjectOption::NO_READ), rho_(dict.get("rho")), pRefValue_(dict.get("pRefValue")), pRefPoint_(dict.lookup("pRefPoint")) { - if (dict.found("value")) - { - fvPatchField::operator= - ( - scalarField("value", dict, p.size()) - ); - } - else + if (!this->readValueEntry(dict)) { evaluate(); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.C index f57aa6488c..9be8715829 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.C @@ -63,7 +63,7 @@ Foam::uniformFixedGradientFvPatchField::uniformFixedGradientFvPatchField const dictionary& dict ) : - fixedGradientFvPatchField(p, iF), + fixedGradientFvPatchField(p, iF), // Bypass dictionary constructor uniformGradient_ ( PatchFunction1::New(p.patch(), "uniformGradient", dict) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.C index 106737b8e7..fd74ce7f42 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.C @@ -63,17 +63,10 @@ Foam::uniformFixedValueFvPatchField::uniformFixedValueFvPatchField const dictionary& dict ) : - fixedValueFvPatchField(p, iF, dict, false), + fixedValueFvPatchField(p, iF, dict, IOobjectOption::NO_READ), uniformValue_(PatchFunction1::New(p.patch(), "uniformValue", dict)) { - if (dict.found("value")) - { - fvPatchField::operator= - ( - Field("value", dict, p.size()) - ); - } - else + if (!this->readValueEntry(dict)) { this->evaluate(); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.C index 3a54b9ce6e..34d5e05db7 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.C @@ -66,14 +66,7 @@ Foam::uniformInletOutletFvPatchField::uniformInletOutletFvPatchField this->refValue() = uniformInletValue_->value(this->db().time().timeOutputValue()); - if (dict.found("value")) - { - fvPatchField::operator= - ( - Field("value", dict, p.size()) - ); - } - else + if (!this->readValueEntry(dict)) { fvPatchField::operator=(this->refValue()); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.C index fe33dd32c5..1f117d268c 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.C @@ -75,14 +75,7 @@ Foam::uniformJumpFvPatchField::uniformJumpFvPatchField jumpTable_ = Function1::New("jumpTable", dict, &this->db()); } - if (dict.found("value")) - { - fvPatchField::operator= - ( - Field("value", dict, p.size()) - ); - } - else + if (!this->readValueEntry(dict)) { this->evaluate(Pstream::commsTypes::blocking); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.C index 45ed242bfe..c0bf9569a7 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.C @@ -72,11 +72,7 @@ Foam::uniformJumpAMIFvPatchField::uniformJumpAMIFvPatchField jumpTable_ = Function1::New("jumpTable", dict, &this->db()); } - if (dict.found("value")) - { - fvPatchField::operator=(Field("value", dict, p.size())); - } - else + if (!this->readValueEntry(dict)) { this->evaluate(Pstream::commsTypes::blocking); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformNormalFixedValue/uniformNormalFixedValueFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformNormalFixedValue/uniformNormalFixedValueFvPatchVectorField.C index 0125ba01b7..51b927a815 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformNormalFixedValue/uniformNormalFixedValueFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformNormalFixedValue/uniformNormalFixedValueFvPatchVectorField.C @@ -53,18 +53,11 @@ uniformNormalFixedValueFvPatchVectorField const dictionary& dict ) : - fixedValueFvPatchVectorField(p, iF, dict, false), + fixedValueFvPatchVectorField(p, iF, dict, IOobjectOption::NO_READ), uniformValue_(PatchFunction1::New(p.patch(), "uniformValue", dict)), ramp_(Function1::NewIfPresent("ramp", dict, word::null, &db())) { - if (dict.found("value")) - { - fvPatchVectorField::operator= - ( - vectorField("value", dict, p.size()) - ); - } - else + if (!this->readValueEntry(dict)) { this->evaluate(); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformTotalPressure/uniformTotalPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformTotalPressure/uniformTotalPressureFvPatchScalarField.C index 833c5e819b..2fa29dc4c0 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformTotalPressure/uniformTotalPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformTotalPressure/uniformTotalPressureFvPatchScalarField.C @@ -59,7 +59,7 @@ uniformTotalPressureFvPatchScalarField const dictionary& dict ) : - fixedValueFvPatchScalarField(p, iF, dict, false), + fixedValueFvPatchScalarField(p, iF, dict, IOobjectOption::NO_READ), UName_(dict.getOrDefault("U", "U")), phiName_(dict.getOrDefault("phi", "phi")), rhoName_(dict.getOrDefault("rho", "rho")), @@ -67,14 +67,7 @@ uniformTotalPressureFvPatchScalarField gamma_(psiName_ != "none" ? dict.get("gamma") : 1), p0_(Function1::New("p0", dict, &db())) { - if (dict.found("value")) - { - fvPatchField::operator= - ( - scalarField("value", dict, p.size()) - ); - } - else + if (!this->readValueEntry(dict)) { const scalar t = this->db().time().timeOutputValue(); fvPatchScalarField::operator==(p0_->value(t)); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/variableHeightFlowRate/variableHeightFlowRateFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/variableHeightFlowRate/variableHeightFlowRateFvPatchField.C index 308999acab..c7609a9053 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/variableHeightFlowRate/variableHeightFlowRateFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/variableHeightFlowRate/variableHeightFlowRateFvPatchField.C @@ -84,14 +84,7 @@ Foam::variableHeightFlowRateFvPatchScalarField fvPatchFieldBase::readDict(dict); this->refValue() = 0.0; - if (dict.found("value")) - { - fvPatchScalarField::operator= - ( - scalarField("value", dict, p.size()) - ); - } - else + if (!this->readValueEntry(dict)) { fvPatchScalarField::operator=(this->patchInternalField()); } diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H index cf4627449c..c6ab641d39 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H @@ -122,6 +122,7 @@ protected: manipulatedMatrix_ = state; } + public: //- Debug switch to disallow the use of generic fvPatchField diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFieldBase.C b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFieldBase.C index 1adbf72d62..4ff14aac3e 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFieldBase.C +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFieldBase.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2022 OpenCFD Ltd. + Copyright (C) 2022-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. diff --git a/src/finiteVolume/fields/fvsPatchFields/basic/calculated/calculatedFvsPatchField.C b/src/finiteVolume/fields/fvsPatchFields/basic/calculated/calculatedFvsPatchField.C index 210db114ac..35f82e8b04 100644 --- a/src/finiteVolume/fields/fvsPatchFields/basic/calculated/calculatedFvsPatchField.C +++ b/src/finiteVolume/fields/fvsPatchFields/basic/calculated/calculatedFvsPatchField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2021 OpenCFD Ltd. + Copyright (C) 2021-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -58,7 +58,7 @@ Foam::calculatedFvsPatchField::calculatedFvsPatchField const dictionary& dict ) : - fvsPatchField(p, iF, Field("value", dict, p.size())) + fvsPatchField(p, iF, dict, IOobjectOption::MUST_READ) {} diff --git a/src/finiteVolume/fields/fvsPatchFields/basic/fixedValue/fixedValueFvsPatchField.C b/src/finiteVolume/fields/fvsPatchFields/basic/fixedValue/fixedValueFvsPatchField.C index 885f295690..d884e73356 100644 --- a/src/finiteVolume/fields/fvsPatchFields/basic/fixedValue/fixedValueFvsPatchField.C +++ b/src/finiteVolume/fields/fvsPatchFields/basic/fixedValue/fixedValueFvsPatchField.C @@ -48,7 +48,7 @@ Foam::fixedValueFvsPatchField::fixedValueFvsPatchField const dictionary& dict ) : - fvsPatchField(p, iF, Field("value", dict, p.size())) + fvsPatchField(p, iF, dict, IOobjectOption::MUST_READ) {} diff --git a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchFieldBase.C b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchFieldBase.C index 5375772156..a55787fce0 100644 --- a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchFieldBase.C +++ b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchFieldBase.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2022 OpenCFD Ltd. + Copyright (C) 2022-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. diff --git a/src/functionObjects/field/externalCoupled/externalCoupledTemperatureMixed/externalCoupledTemperatureMixedFvPatchScalarField.C b/src/functionObjects/field/externalCoupled/externalCoupledTemperatureMixed/externalCoupledTemperatureMixedFvPatchScalarField.C index a6552c8df6..7e4af42bf4 100644 --- a/src/functionObjects/field/externalCoupled/externalCoupledTemperatureMixed/externalCoupledTemperatureMixedFvPatchScalarField.C +++ b/src/functionObjects/field/externalCoupled/externalCoupledTemperatureMixed/externalCoupledTemperatureMixedFvPatchScalarField.C @@ -149,27 +149,16 @@ externalCoupledTemperatureMixedFvPatchScalarField Tref_ = Function1::New("Tref", dict, &db()); } - if (dict.found("refValue")) + if (this->readMixedEntries(dict)) { // Initialise same way as mixed - this->refValue() = scalarField("refValue", dict, p.size()); - this->refGrad() = scalarField("refGradient", dict, p.size()); - this->valueFraction() = scalarField("valueFraction", dict, p.size()); - evaluate(); } else { // For convenience: initialise as fixedValue with either read value // or extrapolated value - if (dict.found("value")) - { - fvPatchField::operator= - ( - scalarField("value", dict, p.size()) - ); - } - else + if (!this->readValueEntry(dict)) { fvPatchField::operator=(this->patchInternalField()); } diff --git a/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C b/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C index c24a6b764e..c9618353cc 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C @@ -101,14 +101,7 @@ timeVaryingMappedFixedValuePointPatchField fieldTableName_ ); - if (dict.found("value")) - { - fixedValuePointPatchField::operator== - ( - Field("value", dict, p.size()) - ); - } - else + if (!this->readValueEntry(dict)) { // Note: use evaluate to do updateCoeffs followed by a reset // of the pointPatchField::updated_ flag. This is diff --git a/src/fvMotionSolver/pointPatchFields/derived/waveDisplacement/waveDisplacementPointPatchVectorField.C b/src/fvMotionSolver/pointPatchFields/derived/waveDisplacement/waveDisplacementPointPatchVectorField.C index ba83666650..cc7a6666e4 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/waveDisplacement/waveDisplacementPointPatchVectorField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/waveDisplacement/waveDisplacementPointPatchVectorField.C @@ -127,7 +127,7 @@ void Foam::waveDisplacementPointPatchVectorField::write(Ostream& os) const os.writeEntry("amplitude", amplitude_); os.writeEntry("omega", omega_); os.writeEntry("waveNumber", waveNumber_); - this->writeValueEntry( os); + this->writeValueEntry(os); } diff --git a/src/meshTools/fields/pointPatchFields/uniformFixedValue/uniformFixedValuePointPatchField.C b/src/meshTools/fields/pointPatchFields/uniformFixedValue/uniformFixedValuePointPatchField.C index 19d0053cf2..46f9180ee2 100644 --- a/src/meshTools/fields/pointPatchFields/uniformFixedValue/uniformFixedValuePointPatchField.C +++ b/src/meshTools/fields/pointPatchFields/uniformFixedValue/uniformFixedValuePointPatchField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -73,7 +73,7 @@ uniformFixedValuePointPatchField const dictionary& dict ) : - fixedValuePointPatchField(p, iF, dict, false), + fixedValuePointPatchField(p, iF, dict, IOobjectOption::NO_READ), uniformValue_ ( PatchFunction1::New @@ -85,14 +85,7 @@ uniformFixedValuePointPatchField ) ) { - if (dict.found("value")) - { - fixedValuePointPatchField::operator== - ( - Field("value", dict, p.size()) - ); - } - else + if (!this->readValueEntry(dict)) { this->evaluate(); } diff --git a/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/adjointOutletFlux/adjointOutletFluxFvPatchField.C b/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/adjointOutletFlux/adjointOutletFluxFvPatchField.C index 1f296db56b..d3a77d93ea 100644 --- a/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/adjointOutletFlux/adjointOutletFluxFvPatchField.C +++ b/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/adjointOutletFlux/adjointOutletFluxFvPatchField.C @@ -65,13 +65,8 @@ Foam::adjointOutletFluxFvPatchField::adjointOutletFluxFvPatchField const dictionary& dict ) : - fixedValueFvPatchField(p, iF) -{ - fvPatchField::operator= - ( - Field("value", dict, p.size()) - ); -} + fixedValueFvPatchField(p, iF, dict, IOobjectOption::MUST_READ) +{} template diff --git a/src/overset/oversetPolyPatch/oversetFvPatchField.C b/src/overset/oversetPolyPatch/oversetFvPatchField.C index bec48bb7e3..9f27a7a248 100644 --- a/src/overset/oversetPolyPatch/oversetFvPatchField.C +++ b/src/overset/oversetPolyPatch/oversetFvPatchField.C @@ -83,7 +83,7 @@ Foam::oversetFvPatchField::oversetFvPatchField const dictionary& dict ) : - coupledFvPatchField(p, iF, dict, false), + coupledFvPatchField(p, iF, dict, IOobjectOption::NO_READ), oversetPatch_(refCast(p, dict)), setHoleCellValue_(dict.getOrDefault("setHoleCellValue", false)), fluxCorrection_ @@ -110,14 +110,8 @@ Foam::oversetFvPatchField::oversetFvPatchField fringeFaces_(), zoneId_(dict.getOrDefault