From 188e61af164125824866dfd95de1775f5dc2d3fb Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@esi-group.com> Date: Tue, 14 Mar 2023 17:39:28 +0100 Subject: [PATCH] STYLE: use readValueEntry in BCs. Assign Zero for refValue/refGrad --- etc/codeTemplates/BC/BC.C | 5 +--- ...thDissipationRateInletFvPatchScalarField.C | 10 +++---- ...ngLengthFrequencyInletFvPatchScalarField.C | 10 +++---- ...ndaryLayerInletEpsilonFvPatchScalarField.C | 2 +- ...atmBoundaryLayerInletKFvPatchScalarField.C | 2 +- ...oundaryLayerInletOmegaFvPatchScalarField.C | 2 +- ...daryLayerInletVelocityFvPatchVectorField.C | 2 +- .../displacementLayeredMotionMotionSolver.C | 2 +- .../SRFFreestreamVelocityFvPatchVectorField.C | 3 +-- ...malInletOutletVelocityFvPatchVectorField.C | 2 +- .../freestream/freestreamFvPatchField.H | 23 ++++++++-------- .../freestreamPressureFvPatchScalarField.C | 8 +++--- .../freestreamPressureFvPatchScalarField.H | 21 +++++---------- .../freestreamVelocityFvPatchVectorField.C | 8 +++--- .../freestreamVelocityFvPatchVectorField.H | 21 +++++---------- ...tedInletOutletVelocityFvPatchVectorField.C | 2 +- ...tOutletParSlipVelocityFvPatchVectorField.C | 2 +- ...ureInletOutletVelocityFvPatchVectorField.C | 2 +- ...malInletOutletVelocityFvPatchVectorField.C | 2 +- ...phaInletOutletVelocityFvPatchVectorField.C | 2 +- ...sityKineticEnergyInletFvPatchScalarField.C | 10 +++---- .../mappedVariableThicknessWallPolyPatch.C | 9 +------ .../mappedVariableThicknessWallPolyPatch.H | 26 ++++++------------- ...djointFarFieldPressureFvPatchScalarField.C | 5 +--- ...djointFarFieldVelocityFvPatchVectorField.C | 5 +--- .../adjointInletVelocityFvPatchVectorField.C | 5 +--- .../adjointOutletPressureFvPatchScalarField.C | 5 +--- .../adjointOutletVelocityFvPatchVectorField.C | 5 +--- ...ointOutletVelocityFluxFvPatchVectorField.C | 5 +--- .../adjointWallVelocityFvPatchVectorField.C | 5 +--- ...jointWallVelocityLowReFvPatchVectorField.C | 5 +--- ...djointFarFieldNuaTildaFvPatchScalarField.C | 5 +--- .../adjointFarFieldTMVar1FvPatchScalarField.C | 5 +--- .../adjointFarFieldTMVar2FvPatchScalarField.C | 5 +--- .../adjointOutletKaFvPatchScalarField.C | 5 +--- .../adjointOutletNuaTildaFvPatchScalarField.C | 5 +--- ...ointOutletNuaTildaFluxFvPatchScalarField.C | 5 +--- .../adjointOutletWaFvPatchScalarField.C | 5 +--- ...haseChangeWallFunctionFvPatchScalarField.C | 20 ++++---------- ...sonJacksonParticleSlipFvPatchVectorField.C | 5 +--- ...onJacksonParticleThetaFvPatchScalarField.C | 5 +--- ...sonJacksonParticleSlipFvPatchVectorField.C | 5 +--- ...onJacksonParticleThetaFvPatchScalarField.C | 5 +--- ...pedMassWallTemperatureFvPatchScalarField.C | 8 +++--- ...ableBaffleMassFractionFvPatchScalarField.C | 2 +- ...ermeableBaffleVelocityFvPatchVectorField.C | 2 +- ...tureCoupledBaffleMixedFvPatchScalarField.C | 8 +++--- ...eratureRadCoupledMixedFvPatchScalarField.C | 6 ++--- .../wallHeatTransferFvPatchScalarField.C | 6 ++--- .../mixedEnergyFvPatchScalarField.C | 4 +-- ...iffusiveRadiationMixedFvPatchScalarField.C | 8 +++--- ...iffusiveRadiationMixedFvPatchScalarField.C | 4 +-- .../enthalpySorptionFvPatchScalarField.C | 7 +---- .../mixedUnburntEnthalpyFvPatchScalarField.C | 4 +-- .../speciesSorptionFvPatchScalarField.C | 14 ++-------- 55 files changed, 124 insertions(+), 240 deletions(-) diff --git a/etc/codeTemplates/BC/BC.C b/etc/codeTemplates/BC/BC.C index 7dc8098b375..045b57b8006 100644 --- a/etc/codeTemplates/BC/BC.C +++ b/etc/codeTemplates/BC/BC.C @@ -93,10 +93,7 @@ CONSTRUCT /* //Initialise with the value entry if evaluation is not possible - FVPATCHF::operator= - ( - FIELD("value", dict, p.size()) - ); + this->readValueEntry(dict, IOobjectOption::MUST_READ); this->refValue() = *this; */ } diff --git a/src/TurbulenceModels/turbulenceModels/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C b/src/TurbulenceModels/turbulenceModels/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C index dfdff556155..0ef4be29a2e 100644 --- a/src/TurbulenceModels/turbulenceModels/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C +++ b/src/TurbulenceModels/turbulenceModels/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C @@ -52,8 +52,8 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField mixingLength_(0.0), Cmu_(0.0) { - this->refValue() = 0.0; - this->refGrad() = 0.0; + this->refValue() = Zero; + this->refGrad() = Zero; this->valueFraction() = 0.0; } @@ -92,10 +92,10 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField { this->phiName_ = dict.getOrDefault<word>("phi", "phi"); - fvPatchScalarField::operator=(scalarField("value", dict, p.size())); + this->readValueEntry(dict, IOobjectOption::MUST_READ); - this->refValue() = 0.0; - this->refGrad() = 0.0; + this->refValue() = Zero; + this->refGrad() = Zero; this->valueFraction() = 0.0; } diff --git a/src/TurbulenceModels/turbulenceModels/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C b/src/TurbulenceModels/turbulenceModels/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C index 1fec48c218b..0869cb37245 100644 --- a/src/TurbulenceModels/turbulenceModels/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C +++ b/src/TurbulenceModels/turbulenceModels/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C @@ -51,8 +51,8 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField mixingLength_(0.0), kName_("undefined-k") { - this->refValue() = 0.0; - this->refGrad() = 0.0; + this->refValue() = Zero; + this->refGrad() = Zero; this->valueFraction() = 0.0; } @@ -84,10 +84,10 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField { this->phiName_ = dict.getOrDefault<word>("phi", "phi"); - fvPatchScalarField::operator=(scalarField("value", dict, p.size())); + this->readValueEntry(dict, IOobjectOption::MUST_READ); - this->refValue() = 0.0; - this->refGrad() = 0.0; + this->refValue() = Zero; + this->refGrad() = Zero; this->valueFraction() = 0.0; } diff --git a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C index 1c4216ed16a..9250dec1374 100644 --- a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C +++ b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C @@ -71,7 +71,7 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField if (!initABL_) { - scalarField::operator=(scalarField("value", dict, p.size())); + this->readValueEntry(dict, IOobjectOption::MUST_READ); } else { diff --git a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletK/atmBoundaryLayerInletKFvPatchScalarField.C b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletK/atmBoundaryLayerInletKFvPatchScalarField.C index 1590676c7b3..1bda2bbd544 100644 --- a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletK/atmBoundaryLayerInletKFvPatchScalarField.C +++ b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletK/atmBoundaryLayerInletKFvPatchScalarField.C @@ -70,7 +70,7 @@ atmBoundaryLayerInletKFvPatchScalarField if (!initABL_) { - scalarField::operator=(scalarField("value", dict, p.size())); + this->readValueEntry(dict, IOobjectOption::MUST_READ); } else { diff --git a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletOmega/atmBoundaryLayerInletOmegaFvPatchScalarField.C b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletOmega/atmBoundaryLayerInletOmegaFvPatchScalarField.C index 12aff016737..4d46621c3b3 100644 --- a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletOmega/atmBoundaryLayerInletOmegaFvPatchScalarField.C +++ b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletOmega/atmBoundaryLayerInletOmegaFvPatchScalarField.C @@ -69,7 +69,7 @@ atmBoundaryLayerInletOmegaFvPatchScalarField if (!initABL_) { - scalarField::operator=(scalarField("value", dict, p.size())); + this->readValueEntry(dict, IOobjectOption::MUST_READ); } else { diff --git a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C index 51eacba6a09..43177f1bf95 100644 --- a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C +++ b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C @@ -70,7 +70,7 @@ atmBoundaryLayerInletVelocityFvPatchVectorField if (!initABL_) { - vectorField::operator=(vectorField("value", dict, p.size())); + this->readValueEntry(dict, IOobjectOption::MUST_READ); } else { diff --git a/src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C b/src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C index fefa520f887..5b88d28c572 100644 --- a/src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C +++ b/src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C @@ -242,7 +242,7 @@ Foam::displacementLayeredMotionMotionSolver::faceZoneEvaluate if (type == "fixedValue") { - fld = vectorField("value", dict, meshPoints.size()); + fld.assign("value", dict, meshPoints.size()); } else if (type == "timeVaryingUniformFixedValue") { diff --git a/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFFreestreamVelocityFvPatchVectorField/SRFFreestreamVelocityFvPatchVectorField.C b/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFFreestreamVelocityFvPatchVectorField/SRFFreestreamVelocityFvPatchVectorField.C index da50a57f7eb..b2f876dffe9 100644 --- a/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFFreestreamVelocityFvPatchVectorField/SRFFreestreamVelocityFvPatchVectorField.C +++ b/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFFreestreamVelocityFvPatchVectorField/SRFFreestreamVelocityFvPatchVectorField.C @@ -77,8 +77,7 @@ SRFFreestreamVelocityFvPatchVectorField UInf_(dict.get<vector>("UInf")) { this->phiName_ = dict.getOrDefault<word>("phi", "phi"); - - fvPatchVectorField::operator=(vectorField("value", dict, p.size())); + this->readValueEntry(dict, IOobjectOption::MUST_READ); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalInletOutletVelocity/fixedNormalInletOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalInletOutletVelocity/fixedNormalInletOutletVelocityFvPatchVectorField.C index bb58e321233..cc33808dd12 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalInletOutletVelocity/fixedNormalInletOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalInletOutletVelocity/fixedNormalInletOutletVelocityFvPatchVectorField.C @@ -72,7 +72,7 @@ fixedNormalInletOutletVelocityFvPatchVectorField ) { fvPatchFieldBase::readDict(dict); - fvPatchVectorField::operator=(vectorField("value", dict, p.size())); + this->readValueEntry(dict, IOobjectOption::MUST_READ); refValue() = normalVelocity(); refGrad() = Zero; valueFraction() = Zero; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/freestream/freestreamFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/freestream/freestreamFvPatchField.H index 7a86c6db2e9..76f5707391d 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/freestream/freestreamFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/freestream/freestreamFvPatchField.H @@ -177,23 +177,24 @@ public: // Member Functions - // Access - + //- Same as refValue() const Field<Type>& freestreamValue() const { return this->refValue(); } + + //- Same as refValue() Field<Type>& freestreamValue() { return this->refValue(); } - // Mapping functions + // Mapping Functions - //- Map (and resize as needed) from self given a mapping object - virtual void autoMap(const fvPatchFieldMapper& mapper); + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap(const fvPatchFieldMapper& mapper); - //- Reverse map the given fvPatchField onto this fvPatchField - virtual void rmap - ( - const fvPatchField<Type>& ptf, - const labelList& addr - ); + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchField<Type>& ptf, + const labelList& addr + ); //- Update the coefficients associated with the patch field diff --git a/src/finiteVolume/fields/fvPatchFields/derived/freestreamPressure/freestreamPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/freestreamPressure/freestreamPressureFvPatchScalarField.C index aafa59a625a..c75f5add6ba 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/freestreamPressure/freestreamPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/freestreamPressure/freestreamPressureFvPatchScalarField.C @@ -55,15 +55,15 @@ freestreamPressureFvPatchScalarField mixedFvPatchScalarField(p, iF), UName_(dict.getOrDefault<word>("U", "U")) { - freestreamValue() = scalarField("freestreamValue", dict, p.size()); + // freestreamValue() and refValue() are identical + freestreamValue().assign("freestreamValue", dict, p.size()); + refGrad() = Zero; + valueFraction() = 0; if (!this->readValueEntry(dict)) { fvPatchScalarField::operator=(freestreamValue()); } - - refGrad() = Zero; - valueFraction() = 0; } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/freestreamPressure/freestreamPressureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/freestreamPressure/freestreamPressureFvPatchScalarField.H index e93b26223a4..1922113c0b7 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/freestreamPressure/freestreamPressureFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/freestreamPressure/freestreamPressureFvPatchScalarField.H @@ -157,24 +157,17 @@ public: } - // Member functions + // Member Functions - const scalarField& freestreamValue() const - { - return refValue(); - } + //- Same as refValue() + const scalarField& freestreamValue() const { return refValue(); } - scalarField& freestreamValue() - { - return refValue(); - } + //- Same as refValue() + scalarField& freestreamValue() { return refValue(); } - // Evaluation functions - - //- Update the coefficients associated with the patch field - virtual void updateCoeffs(); - + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); //- Write virtual void write(Ostream&) const; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/freestreamVelocity/freestreamVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/freestreamVelocity/freestreamVelocityFvPatchVectorField.C index 3a147e98868..0a0af10b84d 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/freestreamVelocity/freestreamVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/freestreamVelocity/freestreamVelocityFvPatchVectorField.C @@ -49,15 +49,15 @@ Foam::freestreamVelocityFvPatchVectorField::freestreamVelocityFvPatchVectorField : mixedFvPatchVectorField(p, iF) { - freestreamValue() = vectorField("freestreamValue", dict, p.size()); + // freestreamValue() and refValue() are identical + freestreamValue().assign("freestreamValue", dict, p.size()); + refGrad() = Zero; + valueFraction() = 1; if (!this->readValueEntry(dict)) { fvPatchVectorField::operator=(freestreamValue()); } - - refGrad() = Zero; - valueFraction() = 1; } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/freestreamVelocity/freestreamVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/freestreamVelocity/freestreamVelocityFvPatchVectorField.H index 26bf7ee809d..aadeeb81c20 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/freestreamVelocity/freestreamVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/freestreamVelocity/freestreamVelocityFvPatchVectorField.H @@ -151,24 +151,17 @@ public: } - // Member functions + // Member Functions - const vectorField& freestreamValue() const - { - return refValue(); - } + //- Same as refValue() + const vectorField& freestreamValue() const { return refValue(); } - vectorField& freestreamValue() - { - return refValue(); - } + //- Same as refValue() + vectorField& freestreamValue() { return refValue(); } - // Evaluation functions - - //- Update the coefficients associated with the patch field - virtual void updateCoeffs(); - + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); //- Write virtual void write(Ostream&) const; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.C index b2cef93cf2b..fa386466a5e 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.C @@ -82,7 +82,7 @@ pressureDirectedInletOutletVelocityFvPatchVectorField inletDir_("inletDirection", dict, p.size()) { fvPatchFieldBase::readDict(dict); - fvPatchVectorField::operator=(vectorField("value", dict, p.size())); + this->readValueEntry(dict, IOobjectOption::MUST_READ); refValue() = *this; refGrad() = Zero; valueFraction() = 0.0; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.C index d3b21000803..f7d0249a658 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.C @@ -80,7 +80,7 @@ pressureInletOutletParSlipVelocityFvPatchVectorField rhoName_(dict.getOrDefault<word>("rho", "rho")) { fvPatchFieldBase::readDict(dict); - fvPatchVectorField::operator=(vectorField("value", dict, p.size())); + this->readValueEntry(dict, IOobjectOption::MUST_READ); refValue() = *this; refGrad() = Zero; valueFraction() = 0.0; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C index 94d7392f311..b158e6bce45 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C @@ -81,7 +81,7 @@ pressureInletOutletVelocityFvPatchVectorField phiName_(dict.getOrDefault<word>("phi", "phi")) { fvPatchFieldBase::readDict(dict); - fvPatchVectorField::operator=(vectorField("value", dict, p.size())); + this->readValueEntry(dict, IOobjectOption::MUST_READ); if (dict.found("tangentialVelocity")) { diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureNormalInletOutletVelocity/pressureNormalInletOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureNormalInletOutletVelocity/pressureNormalInletOutletVelocityFvPatchVectorField.C index e0ea49b05dc..32be116c66d 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureNormalInletOutletVelocity/pressureNormalInletOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureNormalInletOutletVelocity/pressureNormalInletOutletVelocityFvPatchVectorField.C @@ -80,7 +80,7 @@ pressureNormalInletOutletVelocityFvPatchVectorField rhoName_(dict.getOrDefault<word>("rho", "rho")) { fvPatchFieldBase::readDict(dict); - fvPatchVectorField::operator=(vectorField("value", dict, p.size())); + this->readValueEntry(dict, IOobjectOption::MUST_READ); refValue() = *this; refGrad() = Zero; valueFraction() = 0.0; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressurePermeableAlphaInletOutletVelocity/pressurePermeableAlphaInletOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressurePermeableAlphaInletOutletVelocity/pressurePermeableAlphaInletOutletVelocityFvPatchVectorField.C index 0a23414a40b..21e8dab8e6d 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressurePermeableAlphaInletOutletVelocity/pressurePermeableAlphaInletOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressurePermeableAlphaInletOutletVelocity/pressurePermeableAlphaInletOutletVelocityFvPatchVectorField.C @@ -84,7 +84,7 @@ pressurePermeableAlphaInletOutletVelocityFvPatchVectorField alphaMin_(dict.getOrDefault<scalar>("alphaMin", 1)) { fvPatchFieldBase::readDict(dict); - fvPatchVectorField::operator=(vectorField("value", dict, p.size())); + this->readValueEntry(dict, IOobjectOption::MUST_READ); refValue() = Zero; refGrad() = Zero; valueFraction() = 1.0; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.C index 06f5809c0de..1f92652f093 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.C @@ -45,8 +45,8 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField intensity_(0.0), UName_("U") { - this->refValue() = 0.0; - this->refGrad() = 0.0; + this->refValue() = Zero; + this->refGrad() = Zero; this->valueFraction() = 0.0; } @@ -91,10 +91,10 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField << exit(FatalError); } - fvPatchScalarField::operator=(scalarField("value", dict, p.size())); + this->readValueEntry(dict, IOobjectOption::MUST_READ); - this->refValue() = 0.0; - this->refGrad() = 0.0; + this->refValue() = Zero; + this->refGrad() = Zero; this->valueFraction() = 0.0; } diff --git a/src/meshTools/mappedPatches/mappedPolyPatch/mappedVariableThicknessWallPolyPatch.C b/src/meshTools/mappedPatches/mappedPolyPatch/mappedVariableThicknessWallPolyPatch.C index ca9193e569b..8107096ab0c 100644 --- a/src/meshTools/mappedPatches/mappedPolyPatch/mappedVariableThicknessWallPolyPatch.C +++ b/src/meshTools/mappedPatches/mappedPolyPatch/mappedVariableThicknessWallPolyPatch.C @@ -113,7 +113,7 @@ Foam::mappedVariableThicknessWallPolyPatch::mappedVariableThicknessWallPolyPatch ) : mappedWallPolyPatch(name, dict, index, bm, patchType), - thickness_(scalarField("thickness", dict, this->size())) + thickness_("thickness", dict, this->size()) {} @@ -157,13 +157,6 @@ Foam::mappedVariableThicknessWallPolyPatch::mappedVariableThicknessWallPolyPatch {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::mappedVariableThicknessWallPolyPatch:: -~mappedVariableThicknessWallPolyPatch() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // void Foam::mappedVariableThicknessWallPolyPatch:: diff --git a/src/meshTools/mappedPatches/mappedPolyPatch/mappedVariableThicknessWallPolyPatch.H b/src/meshTools/mappedPatches/mappedPolyPatch/mappedVariableThicknessWallPolyPatch.H index ac97145f35a..e089e28526f 100644 --- a/src/meshTools/mappedPatches/mappedPolyPatch/mappedVariableThicknessWallPolyPatch.H +++ b/src/meshTools/mappedPatches/mappedPolyPatch/mappedVariableThicknessWallPolyPatch.H @@ -37,17 +37,15 @@ SourceFiles #ifndef mappedVariableThicknessWallPolyPatch_H #define mappedVariableThicknessWallPolyPatch_H +#include "scalarField.H" #include "wallPolyPatch.H" #include "mappedWallPolyPatch.H" - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -class polyMesh; - /*---------------------------------------------------------------------------*\ Class mappedVariableThicknessWallPolyPatch Declaration \*---------------------------------------------------------------------------*/ @@ -60,7 +58,7 @@ class mappedVariableThicknessWallPolyPatch // Private data //- Thickness - scalarList thickness_; + scalarField thickness_; public: @@ -205,24 +203,16 @@ public: //- Destructor - virtual ~mappedVariableThicknessWallPolyPatch(); - - - // Member functions + virtual ~mappedVariableThicknessWallPolyPatch() = default; - //- Return non const thickness - scalarList& thickness() - { - return thickness_; - } + // Member Functions - //- Return const thickness - const scalarList& thickness() const - { - return thickness_; - } + //- Return thickness (non-const access) + scalarField& thickness() noexcept { return thickness_; } + //- Return thickness (const access) + const scalarField& thickness() const noexcept { return thickness_; } //- Write the polyPatch data as a dictionary void write(Ostream&) const; diff --git a/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointFarFieldPressure/adjointFarFieldPressureFvPatchScalarField.C b/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointFarFieldPressure/adjointFarFieldPressureFvPatchScalarField.C index c4dea30df3d..7f40afe8a4d 100644 --- a/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointFarFieldPressure/adjointFarFieldPressureFvPatchScalarField.C +++ b/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointFarFieldPressure/adjointFarFieldPressureFvPatchScalarField.C @@ -73,10 +73,7 @@ adjointFarFieldPressureFvPatchScalarField fixedValueFvPatchScalarField(p, iF), adjointScalarBoundaryCondition(p, iF, dict.get<word>("solverName")) { - fvPatchField<scalar>::operator= - ( - scalarField("value", dict, p.size()) - ); + this->readValueEntry(dict, IOobjectOption::MUST_READ); } diff --git a/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointFarFieldVelocity/adjointFarFieldVelocityFvPatchVectorField.C b/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointFarFieldVelocity/adjointFarFieldVelocityFvPatchVectorField.C index 71e56b53594..b39a0a2c97c 100644 --- a/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointFarFieldVelocity/adjointFarFieldVelocityFvPatchVectorField.C +++ b/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointFarFieldVelocity/adjointFarFieldVelocityFvPatchVectorField.C @@ -69,10 +69,7 @@ adjointFarFieldVelocityFvPatchVectorField fixedValueFvPatchVectorField(p, iF), adjointVectorBoundaryCondition(p, iF, dict.get<word>("solverName")) { - fvPatchField<vector>::operator= - ( - vectorField("value", dict, p.size()) - ); + this->readValueEntry(dict, IOobjectOption::MUST_READ); } diff --git a/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointInletVelocity/adjointInletVelocityFvPatchVectorField.C b/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointInletVelocity/adjointInletVelocityFvPatchVectorField.C index 869b4c9dec5..d6a6d3fa437 100644 --- a/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointInletVelocity/adjointInletVelocityFvPatchVectorField.C +++ b/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointInletVelocity/adjointInletVelocityFvPatchVectorField.C @@ -71,10 +71,7 @@ adjointInletVelocityFvPatchVectorField fixedValueFvPatchVectorField(p, iF), adjointVectorBoundaryCondition(p, iF, dict.get<word>("solverName")) { - fvPatchField<vector>::operator= - ( - vectorField("value", dict, p.size()) - ); + this->readValueEntry(dict, IOobjectOption::MUST_READ); } diff --git a/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointOutletPressure/adjointOutletPressureFvPatchScalarField.C b/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointOutletPressure/adjointOutletPressureFvPatchScalarField.C index 0e80d181e24..b0bf3c563e6 100644 --- a/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointOutletPressure/adjointOutletPressureFvPatchScalarField.C +++ b/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointOutletPressure/adjointOutletPressureFvPatchScalarField.C @@ -74,10 +74,7 @@ adjointOutletPressureFvPatchScalarField fixedValueFvPatchScalarField(p, iF), adjointScalarBoundaryCondition(p, iF, dict.get<word>("solverName")) { - fvPatchField<scalar>::operator= - ( - scalarField("value", dict, p.size()) - ); + this->readValueEntry(dict, IOobjectOption::MUST_READ); } diff --git a/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointOutletVelocity/adjointOutletVelocityFvPatchVectorField.C b/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointOutletVelocity/adjointOutletVelocityFvPatchVectorField.C index 49adb64b193..41d715afa4c 100644 --- a/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointOutletVelocity/adjointOutletVelocityFvPatchVectorField.C +++ b/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointOutletVelocity/adjointOutletVelocityFvPatchVectorField.C @@ -131,10 +131,7 @@ adjointOutletVelocityFvPatchVectorField fixedValueFvPatchVectorField(p, iF), adjointVectorBoundaryCondition(p, iF, dict.get<word>("solverName")) { - fvPatchField<vector>::operator= - ( - vectorField("value", dict, p.size()) - ); + this->readValueEntry(dict, IOobjectOption::MUST_READ); } diff --git a/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointOutletVelocityFlux/adjointOutletVelocityFluxFvPatchVectorField.C b/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointOutletVelocityFlux/adjointOutletVelocityFluxFvPatchVectorField.C index dd385480e3e..597cc61d62c 100644 --- a/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointOutletVelocityFlux/adjointOutletVelocityFluxFvPatchVectorField.C +++ b/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointOutletVelocityFlux/adjointOutletVelocityFluxFvPatchVectorField.C @@ -71,10 +71,7 @@ adjointOutletVelocityFluxFvPatchVectorField fixedValueFvPatchVectorField(p, iF), adjointVectorBoundaryCondition(p, iF, dict.get<word>("solverName")) { - fvPatchField<vector>::operator= - ( - vectorField("value", dict, p.size()) - ); + this->readValueEntry(dict, IOobjectOption::MUST_READ); } diff --git a/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointWallVelocity/adjointWallVelocityFvPatchVectorField.C b/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointWallVelocity/adjointWallVelocityFvPatchVectorField.C index 2ee1f2a8483..0172840bb03 100644 --- a/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointWallVelocity/adjointWallVelocityFvPatchVectorField.C +++ b/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointWallVelocity/adjointWallVelocityFvPatchVectorField.C @@ -77,10 +77,7 @@ adjointWallVelocityFvPatchVectorField kappa_(dict.getOrDefault<scalar>("kappa", 0.41)), E_(dict.getOrDefault<scalar>("E", 9.8)) { - fvPatchField<vector>::operator= - ( - vectorField("value", dict, p.size()) - ); + this->readValueEntry(dict, IOobjectOption::MUST_READ); } diff --git a/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointWallVelocityLowRe/adjointWallVelocityLowReFvPatchVectorField.C b/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointWallVelocityLowRe/adjointWallVelocityLowReFvPatchVectorField.C index fb54a88b1a2..bc4e70af268 100644 --- a/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointWallVelocityLowRe/adjointWallVelocityLowReFvPatchVectorField.C +++ b/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointWallVelocityLowRe/adjointWallVelocityLowReFvPatchVectorField.C @@ -70,10 +70,7 @@ adjointWallVelocityLowReFvPatchVectorField fixedValueFvPatchVectorField(p, iF), adjointVectorBoundaryCondition(p, iF, dict.get<word>("solverName")) { - fvPatchField<vector>::operator= - ( - vectorField("value", dict, p.size()) - ); + this->readValueEntry(dict, IOobjectOption::MUST_READ); } diff --git a/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/adjointFarFieldNuaTilda/adjointFarFieldNuaTildaFvPatchScalarField.C b/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/adjointFarFieldNuaTilda/adjointFarFieldNuaTildaFvPatchScalarField.C index 13340dc1b60..05dd9aba11c 100644 --- a/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/adjointFarFieldNuaTilda/adjointFarFieldNuaTildaFvPatchScalarField.C +++ b/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/adjointFarFieldNuaTilda/adjointFarFieldNuaTildaFvPatchScalarField.C @@ -77,10 +77,7 @@ adjointFarFieldNuaTildaFvPatchScalarField fixedValueFvPatchScalarField(p, iF), adjointScalarBoundaryCondition(p, iF, dict.get<word>("solverName")) { - fvPatchField<scalar>::operator= - ( - scalarField("value", dict, p.size()) - ); + this->readValueEntry(dict, IOobjectOption::MUST_READ); } diff --git a/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/adjointFarFieldTMVar1/adjointFarFieldTMVar1FvPatchScalarField.C b/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/adjointFarFieldTMVar1/adjointFarFieldTMVar1FvPatchScalarField.C index 35d9034a0c8..13db68bb898 100644 --- a/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/adjointFarFieldTMVar1/adjointFarFieldTMVar1FvPatchScalarField.C +++ b/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/adjointFarFieldTMVar1/adjointFarFieldTMVar1FvPatchScalarField.C @@ -76,10 +76,7 @@ adjointFarFieldTMVar1FvPatchScalarField fixedValueFvPatchScalarField(p, iF), adjointScalarBoundaryCondition(p, iF, dict.get<word>("solverName")) { - fvPatchField<scalar>::operator= - ( - scalarField("value", dict, p.size()) - ); + this->readValueEntry(dict, IOobjectOption::MUST_READ); } diff --git a/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/adjointFarFieldTMVar2/adjointFarFieldTMVar2FvPatchScalarField.C b/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/adjointFarFieldTMVar2/adjointFarFieldTMVar2FvPatchScalarField.C index b51d8be8124..7f269509aea 100644 --- a/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/adjointFarFieldTMVar2/adjointFarFieldTMVar2FvPatchScalarField.C +++ b/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/adjointFarFieldTMVar2/adjointFarFieldTMVar2FvPatchScalarField.C @@ -76,10 +76,7 @@ adjointFarFieldTMVar2FvPatchScalarField fixedValueFvPatchScalarField(p, iF), adjointScalarBoundaryCondition(p, iF, dict.get<word>("solverName")) { - fvPatchField<scalar>::operator= - ( - scalarField("value", dict, p.size()) - ); + this->readValueEntry(dict, IOobjectOption::MUST_READ); } diff --git a/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/adjointOutletKa/adjointOutletKaFvPatchScalarField.C b/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/adjointOutletKa/adjointOutletKaFvPatchScalarField.C index dbbfac54511..4c49cb09b1e 100644 --- a/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/adjointOutletKa/adjointOutletKaFvPatchScalarField.C +++ b/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/adjointOutletKa/adjointOutletKaFvPatchScalarField.C @@ -72,10 +72,7 @@ adjointOutletKaFvPatchScalarField::adjointOutletKaFvPatchScalarField fixedValueFvPatchScalarField(p, iF), adjointScalarBoundaryCondition(p, iF, dict.get<word>("solverName")) { - fvPatchField<scalar>::operator= - ( - scalarField("value", dict, p.size()) - ); + this->readValueEntry(dict, IOobjectOption::MUST_READ); } diff --git a/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/adjointOutletNuaTilda/adjointOutletNuaTildaFvPatchScalarField.C b/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/adjointOutletNuaTilda/adjointOutletNuaTildaFvPatchScalarField.C index 32cc4f76c9b..78c4b1dae61 100644 --- a/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/adjointOutletNuaTilda/adjointOutletNuaTildaFvPatchScalarField.C +++ b/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/adjointOutletNuaTilda/adjointOutletNuaTildaFvPatchScalarField.C @@ -73,10 +73,7 @@ adjointOutletNuaTildaFvPatchScalarField::adjointOutletNuaTildaFvPatchScalarField fixedValueFvPatchScalarField(p, iF), adjointScalarBoundaryCondition(p, iF, dict.get<word>("solverName")) { - fvPatchField<scalar>::operator= - ( - scalarField("value", dict, p.size()) - ); + this->readValueEntry(dict, IOobjectOption::MUST_READ); } diff --git a/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/adjointOutletNuaTildaFlux/adjointOutletNuaTildaFluxFvPatchScalarField.C b/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/adjointOutletNuaTildaFlux/adjointOutletNuaTildaFluxFvPatchScalarField.C index 2382fa4e17b..758b23c65d8 100644 --- a/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/adjointOutletNuaTildaFlux/adjointOutletNuaTildaFluxFvPatchScalarField.C +++ b/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/adjointOutletNuaTildaFlux/adjointOutletNuaTildaFluxFvPatchScalarField.C @@ -76,10 +76,7 @@ adjointOutletNuaTildaFluxFvPatchScalarField fixedValueFvPatchScalarField(p, iF), adjointScalarBoundaryCondition(p, iF, dict.get<word>("solverName")) { - fvPatchField<scalar>::operator= - ( - scalarField("value", dict, p.size()) - ); + this->readValueEntry(dict, IOobjectOption::MUST_READ); } diff --git a/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/adjointOutletWa/adjointOutletWaFvPatchScalarField.C b/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/adjointOutletWa/adjointOutletWaFvPatchScalarField.C index 68fab059d3e..0809fc0b256 100644 --- a/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/adjointOutletWa/adjointOutletWaFvPatchScalarField.C +++ b/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/adjointOutletWa/adjointOutletWaFvPatchScalarField.C @@ -72,10 +72,7 @@ adjointOutletWaFvPatchScalarField::adjointOutletWaFvPatchScalarField fixedValueFvPatchScalarField(p, iF), adjointScalarBoundaryCondition(p, iF, dict.get<word>("solverName")) { - fvPatchField<scalar>::operator= - ( - scalarField("value", dict, p.size()) - ); + this->readValueEntry(dict, IOobjectOption::MUST_READ); } diff --git a/src/phaseSystemModels/reactingEuler/multiphaseSystem/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C b/src/phaseSystemModels/reactingEuler/multiphaseSystem/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C index dae81c48d9f..21d19c3bcb2 100644 --- a/src/phaseSystemModels/reactingEuler/multiphaseSystem/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C +++ b/src/phaseSystemModels/reactingEuler/multiphaseSystem/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C @@ -51,8 +51,8 @@ alphatPhaseChangeWallFunctionFvPatchScalarField ) : fixedValueFvPatchScalarField(p, iF), - dmdt_(p.size(), 0), - mDotL_(p.size(), 0) + dmdt_(p.size(), Zero), + mDotL_(p.size(), Zero) {} @@ -65,19 +65,9 @@ alphatPhaseChangeWallFunctionFvPatchScalarField ) : fixedValueFvPatchScalarField(p, iF, dict), - dmdt_(p.size(), 0), - mDotL_(p.size(), 0) -{ - if (dict.found("dmdt")) - { - dmdt_ = scalarField("dmdt", dict, p.size()); - } - - if (dict.found("mDotL")) - { - dmdt_ = scalarField("mDotL", dict, p.size()); - } -} + dmdt_("dmdt", dict, p.size(), IOobjectOption::LAZY_READ), + mDotL_("mDotL", dict, p.size(), IOobjectOption::LAZY_READ) +{} alphatPhaseChangeWallFunctionFvPatchScalarField:: diff --git a/src/phaseSystemModels/reactingEuler/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C b/src/phaseSystemModels/reactingEuler/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C index a1d4580da78..add9f321a1f 100644 --- a/src/phaseSystemModels/reactingEuler/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C +++ b/src/phaseSystemModels/reactingEuler/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C @@ -91,10 +91,7 @@ JohnsonJacksonParticleSlipFvPatchVectorField << abort(FatalError); } - fvPatchVectorField::operator= - ( - vectorField("value", dict, p.size()) - ); + this->readValueEntry(dict, IOobjectOption::MUST_READ); } diff --git a/src/phaseSystemModels/reactingEuler/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C b/src/phaseSystemModels/reactingEuler/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C index d46037600c9..ce782fc7627 100644 --- a/src/phaseSystemModels/reactingEuler/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C +++ b/src/phaseSystemModels/reactingEuler/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C @@ -105,10 +105,7 @@ JohnsonJacksonParticleThetaFvPatchScalarField << abort(FatalError); } - fvPatchScalarField::operator= - ( - scalarField("value", dict, p.size()) - ); + this->readValueEntry(dict, IOobjectOption::MUST_READ); } diff --git a/src/phaseSystemModels/twoPhaseEuler/phaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C b/src/phaseSystemModels/twoPhaseEuler/phaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C index 84d56ae6361..8c4d5335be6 100644 --- a/src/phaseSystemModels/twoPhaseEuler/phaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C +++ b/src/phaseSystemModels/twoPhaseEuler/phaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C @@ -91,10 +91,7 @@ JohnsonJacksonParticleSlipFvPatchVectorField << abort(FatalError); } - fvPatchVectorField::operator= - ( - vectorField("value", dict, p.size()) - ); + this->readValueEntry(dict, IOobjectOption::MUST_READ); } diff --git a/src/phaseSystemModels/twoPhaseEuler/phaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C b/src/phaseSystemModels/twoPhaseEuler/phaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C index 69472671352..a073bada84d 100644 --- a/src/phaseSystemModels/twoPhaseEuler/phaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C +++ b/src/phaseSystemModels/twoPhaseEuler/phaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C @@ -105,10 +105,7 @@ JohnsonJacksonParticleThetaFvPatchScalarField << abort(FatalError); } - fvPatchScalarField::operator= - ( - scalarField("value", dict, p.size()) - ); + this->readValueEntry(dict, IOobjectOption::MUST_READ); } diff --git a/src/thermoTools/derivedFvPatchFields/lumpedMassWallTemperature/lumpedMassWallTemperatureFvPatchScalarField.C b/src/thermoTools/derivedFvPatchFields/lumpedMassWallTemperature/lumpedMassWallTemperatureFvPatchScalarField.C index 2d1ecc121ce..d2ddbbe2e20 100644 --- a/src/thermoTools/derivedFvPatchFields/lumpedMassWallTemperature/lumpedMassWallTemperatureFvPatchScalarField.C +++ b/src/thermoTools/derivedFvPatchFields/lumpedMassWallTemperature/lumpedMassWallTemperatureFvPatchScalarField.C @@ -83,11 +83,11 @@ lumpedMassWallTemperatureFvPatchScalarField mass_(dict.get<scalar>("mass")), curTimeIndex_(-1) { - refGrad() = 0.0; + fvPatchFieldBase::readDict(dict); + this->readValueEntry(dict, IOobjectOption::MUST_READ); + refValue() = *this; + refGrad() = Zero; valueFraction() = 1.0; - refValue() = scalarField("value", dict, p.size()); - - fvPatchScalarField::operator=(scalarField("value", dict, p.size())); } diff --git a/src/thermoTools/derivedFvPatchFields/semiPermeableBaffle/semiPermeableBaffleMassFraction/semiPermeableBaffleMassFractionFvPatchScalarField.C b/src/thermoTools/derivedFvPatchFields/semiPermeableBaffle/semiPermeableBaffleMassFraction/semiPermeableBaffleMassFractionFvPatchScalarField.C index d9d00a8bd3f..ce75942e27a 100644 --- a/src/thermoTools/derivedFvPatchFields/semiPermeableBaffle/semiPermeableBaffleMassFraction/semiPermeableBaffleMassFractionFvPatchScalarField.C +++ b/src/thermoTools/derivedFvPatchFields/semiPermeableBaffle/semiPermeableBaffleMassFraction/semiPermeableBaffleMassFractionFvPatchScalarField.C @@ -66,7 +66,7 @@ semiPermeableBaffleMassFractionFvPatchScalarField c_(dict.getOrDefault<scalar>("c", 0)), phiName_(dict.getOrDefault<word>("phi", "phi")) { - fvPatchScalarField::operator=(scalarField("value", dict, p.size())); + this->readValueEntry(dict, IOobjectOption::MUST_READ); refValue() = Zero; refGrad() = Zero; diff --git a/src/thermoTools/derivedFvPatchFields/semiPermeableBaffle/semiPermeableBaffleVelocity/semiPermeableBaffleVelocityFvPatchVectorField.C b/src/thermoTools/derivedFvPatchFields/semiPermeableBaffle/semiPermeableBaffleVelocity/semiPermeableBaffleVelocityFvPatchVectorField.C index 579989b7f16..a4d24cead9f 100644 --- a/src/thermoTools/derivedFvPatchFields/semiPermeableBaffle/semiPermeableBaffleVelocity/semiPermeableBaffleVelocityFvPatchVectorField.C +++ b/src/thermoTools/derivedFvPatchFields/semiPermeableBaffle/semiPermeableBaffleVelocity/semiPermeableBaffleVelocityFvPatchVectorField.C @@ -86,7 +86,7 @@ semiPermeableBaffleVelocityFvPatchVectorField fixedValueFvPatchVectorField(p, iF), rhoName_(dict.getOrDefault<word>("rho", "rho")) { - fvPatchVectorField::operator==(vectorField("value", dict, p.size())); + this->readValueEntry(dict, IOobjectOption::MUST_READ); } diff --git a/src/thermoTools/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C b/src/thermoTools/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C index e23e941453f..379eb0b991e 100644 --- a/src/thermoTools/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C +++ b/src/thermoTools/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C @@ -57,8 +57,8 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField ), TnbrName_("undefined-Tnbr") { - this->refValue() = 0.0; - this->refGrad() = 0.0; + this->refValue() = Zero; + this->refGrad() = Zero; this->valueFraction() = 1.0; } @@ -153,7 +153,7 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField { // Start from user entered data. Assume fixedValue. refValue() = *this; - refGrad() = 0.0; + refGrad() = Zero; valueFraction() = 1.0; } @@ -377,7 +377,7 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs() // - mixFraction = nbrKDelta / (nbrKDelta + myKDelta()) this->refValue() = nbrIntFld; - this->refGrad() = 0.0; + this->refGrad() = Zero; this->valueFraction() = nbrKDelta/(nbrKDelta + myKDelta()); mixedFvPatchScalarField::updateCoeffs(); diff --git a/src/thermoTools/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C b/src/thermoTools/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C index ced3437922a..7e5da847ca9 100644 --- a/src/thermoTools/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C +++ b/src/thermoTools/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C @@ -62,8 +62,8 @@ turbulentTemperatureRadCoupledMixedFvPatchScalarField qrName_("undefined-qr"), thermalInertia_(false) { - this->refValue() = 0.0; - this->refGrad() = 0.0; + this->refValue() = Zero; + this->refGrad() = Zero; this->valueFraction() = 1.0; this->source() = 0.0; } @@ -201,7 +201,7 @@ turbulentTemperatureRadCoupledMixedFvPatchScalarField { // Start from user entered data. Assume fixedValue. refValue() = *this; - refGrad() = 0.0; + refGrad() = Zero; valueFraction() = 1.0; } diff --git a/src/thermoTools/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C b/src/thermoTools/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C index d8862abdad2..2c435144f05 100644 --- a/src/thermoTools/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C +++ b/src/thermoTools/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C @@ -42,8 +42,8 @@ Foam::wallHeatTransferFvPatchScalarField::wallHeatTransferFvPatchScalarField Tinf_(p.size(), Zero), alphaWall_(p.size(), Zero) { - refValue() = 0.0; - refGrad() = 0.0; + refValue() = Zero; + refGrad() = Zero; valueFraction() = 0.0; } @@ -74,7 +74,7 @@ Foam::wallHeatTransferFvPatchScalarField::wallHeatTransferFvPatchScalarField alphaWall_("alphaWall", dict, p.size()) { refValue() = Tinf_; - refGrad() = 0.0; + refGrad() = Zero; valueFraction() = 0.0; if (!this->readValueEntry(dict)) diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyFvPatchScalarField.C index 4e0a680fb28..0f755657ed9 100644 --- a/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyFvPatchScalarField.C +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyFvPatchScalarField.C @@ -46,8 +46,8 @@ mixedEnergyFvPatchScalarField mixedFvPatchScalarField(p, iF) { valueFraction() = 0.0; - refValue() = 0.0; - refGrad() = 0.0; + refValue() = Zero; + refGrad() = Zero; source() = 0.0; } diff --git a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C index ccf1d365ad7..cb6dc1b7c7e 100644 --- a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C +++ b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C @@ -53,8 +53,8 @@ greyDiffusiveRadiationMixedFvPatchScalarField qRadExt_(0), qRadExtDir_(Zero) { - refValue() = 0.0; - refGrad() = 0.0; + refValue() = Zero; + refGrad() = Zero; valueFraction() = 1.0; } @@ -95,8 +95,8 @@ greyDiffusiveRadiationMixedFvPatchScalarField } else { - refValue() = 0.0; - refGrad() = 0.0; + refValue() = Zero; + refGrad() = Zero; valueFraction() = 1.0; fvPatchScalarField::operator=(refValue()); diff --git a/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C b/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C index 0c4c68caf39..b6ae35082aa 100644 --- a/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C +++ b/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C @@ -50,8 +50,8 @@ wideBandDiffusiveRadiationMixedFvPatchScalarField : mixedFvPatchScalarField(p, iF) { - refValue() = 0.0; - refGrad() = 0.0; + refValue() = Zero; + refGrad() = Zero; valueFraction() = 1.0; } diff --git a/src/thermophysicalModels/reactionThermo/derivedFvPatchFields/enthalpySorption/enthalpySorptionFvPatchScalarField.C b/src/thermophysicalModels/reactionThermo/derivedFvPatchFields/enthalpySorption/enthalpySorptionFvPatchScalarField.C index 9cf248c50da..a3caadc95aa 100644 --- a/src/thermophysicalModels/reactionThermo/derivedFvPatchFields/enthalpySorption/enthalpySorptionFvPatchScalarField.C +++ b/src/thermophysicalModels/reactionThermo/derivedFvPatchFields/enthalpySorption/enthalpySorptionFvPatchScalarField.C @@ -82,12 +82,7 @@ Foam::enthalpySorptionFvPatchScalarField::enthalpySorptionFvPatchScalarField speciesName_(dict.get<word>("species")), pName_(dict.getOrDefault<word>("p", "p")), TName_(dict.getOrDefault<word>("T", "T")), - dhdt_ - ( - dict.found("dhdt") - ? scalarField("dhdt", dict, p.size()) - : scalarField(p.size(), 0) - ) + dhdt_("dhdt", dict, p.size(), IOobjectOption::LAZY_READ) { switch (enthalpyModel_) { diff --git a/src/thermophysicalModels/reactionThermo/derivedFvPatchFields/mixedUnburntEnthalpy/mixedUnburntEnthalpyFvPatchScalarField.C b/src/thermophysicalModels/reactionThermo/derivedFvPatchFields/mixedUnburntEnthalpy/mixedUnburntEnthalpyFvPatchScalarField.C index ab14754c6cd..b0c64d90fed 100644 --- a/src/thermophysicalModels/reactionThermo/derivedFvPatchFields/mixedUnburntEnthalpy/mixedUnburntEnthalpyFvPatchScalarField.C +++ b/src/thermophysicalModels/reactionThermo/derivedFvPatchFields/mixedUnburntEnthalpy/mixedUnburntEnthalpyFvPatchScalarField.C @@ -42,9 +42,9 @@ mixedUnburntEnthalpyFvPatchScalarField : mixedFvPatchScalarField(p, iF) { + refValue() = Zero; + refGrad() = Zero; valueFraction() = 0.0; - refValue() = 0.0; - refGrad() = 0.0; } diff --git a/src/thermophysicalModels/reactionThermo/derivedFvPatchFields/speciesSorption/speciesSorptionFvPatchScalarField.C b/src/thermophysicalModels/reactionThermo/derivedFvPatchFields/speciesSorption/speciesSorptionFvPatchScalarField.C index efbce74bae9..f1275de1bcb 100644 --- a/src/thermophysicalModels/reactionThermo/derivedFvPatchFields/speciesSorption/speciesSorptionFvPatchScalarField.C +++ b/src/thermophysicalModels/reactionThermo/derivedFvPatchFields/speciesSorption/speciesSorptionFvPatchScalarField.C @@ -174,18 +174,8 @@ Foam::speciesSorptionFvPatchScalarField::speciesSorptionFvPatchScalarField max_(dict.getCheck<scalar>("max", scalarMinMax::ge(0))), rhoS_(dict.get<scalar>("rhoS")), pName_(dict.getOrDefault<word>("p", "p")), - dfldp_ - ( - dict.found("dfldp") - ? scalarField("dfldp", dict, p.size()) - : scalarField(p.size(), 0) - ), - mass_ - ( - dict.found("mass") - ? scalarField("mass", dict, p.size()) - : scalarField(p.size(), 0) - ) + dfldp_("dfldp", dict, p.size(), IOobjectOption::LAZY_READ), + mass_("mass", dict, p.size(), IOobjectOption::LAZY_READ) { if (!this->readValueEntry(dict)) { -- GitLab