ENH: use readValueEntry, readMixedEntries for simpler program control

This commit is contained in:
Mark Olesen
2023-02-15 15:49:06 +01:00
parent 42dba36832
commit b17422ef1a
111 changed files with 328 additions and 677 deletions

View File

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

View File

@ -105,18 +105,15 @@ Foam::maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField
<< exit(FatalIOError);
}
if (dict.found("value"))
if (this->readValueEntry(dict))
{
fvPatchField<vector>::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
{

View File

@ -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
{

View File

@ -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<Type>::fixedValuePointPatchField
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF,
const dictionary& dict,
const bool valueRequired
IOobjectOption::readOption requireValue
)
:
valuePointPatchField<Type>(p, iF, dict, valueRequired)
valuePointPatchField<Type>(p, iF, dict, requireValue)
{}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -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<Type>
{
public:
//- Runtime type information
@ -75,9 +75,25 @@ public:
const pointPatch&,
const DimensionedField<Type, pointMesh>&,
const dictionary&,
const bool valueRequired=true
IOobjectOption::readOption requireValue = IOobjectOption::MUST_READ
);
//- Compatibility. Prefer with readOption
fixedValuePointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF,
const dictionary& dict,
const bool valueReqd
)
:
fixedValuePointPatchField
(
p, iF, dict,
(valueReqd? IOobjectOption::MUST_READ : IOobjectOption::NO_READ)
)
{}
//- Construct by mapping given patch field onto a new patch
fixedValuePointPatchField
(

View File

@ -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<Type>::codedFixedValuePointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& 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<Type>::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);

View File

@ -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<Type, pointMesh>&,
const dictionary&,
const bool valueRequired=true
const dictionary&
);
//- Construct by mapping given codedFixedValuePointPatchField

View File

@ -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.

View File

@ -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<vector>("tau", Zero))
{
fvPatchField<vector>::operator=(patchInternalField());

View File

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

View File

@ -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<scalar>::New("Cp0", dict, &db())),
q_(PatchFunction1<scalar>::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<scalar>::operator =
(
Field<scalar>("value", dict, p.size())
);
gradient() = Field<scalar>("gradient", dict, p.size());
gradient().assign(*hasGrad, p.size());
}
else
{

View File

@ -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<scalar>::operator=(pa_);
}

View File

@ -48,7 +48,7 @@ Foam::fixedValueOutflowFaPatchField<Type>::fixedValueOutflowFaPatchField
const dictionary& dict
)
:
faPatchField<Type>(p, iF, Field<Type>("value", dict, p.size()))
faPatchField<Type>(p, iF, dict, IOobjectOption::MUST_READ)
{}

View File

@ -56,14 +56,10 @@ timeVaryingUniformFixedValueFaPatchField
fixedValueFaPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ),
timeSeries_(dict)
{
if (dict.found("value"))
{
faPatchField<Type>::operator==(Field<Type>("value", dict, p.size()));
}
else
{
updateCoeffs();
}
if (!this->readValueEntry(dict))
{
updateCoeffs();
}
}

View File

@ -57,10 +57,10 @@ Foam::calculatedFvPatchField<Type>::calculatedFvPatchField
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict,
const bool valueRequired
IOobjectOption::readOption requireValue
)
:
fvPatchField<Type>(p, iF, dict, valueRequired)
fvPatchField<Type>(p, iF, dict, requireValue)
{}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -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<Type, volMesh>&,
const dictionary&,
const bool valueRequired=true
IOobjectOption::readOption requireValue = IOobjectOption::MUST_READ
);
//- Compatibility (prefer with readOption)
calculatedFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& 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
(

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -74,11 +75,11 @@ Foam::coupledFvPatchField<Type>::coupledFvPatchField
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict,
const bool valueRequired
IOobjectOption::readOption requireValue
)
:
LduInterfaceField<Type>(refCast<const lduInterface>(p, dict)),
fvPatchField<Type>(p, iF, dict, valueRequired)
fvPatchField<Type>(p, iF, dict, requireValue)
{}

View File

@ -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<Type>,
public fvPatchField<Type>
{
public:
//- Runtime type information
@ -90,9 +89,25 @@ public:
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const dictionary&,
const bool valueRequired=true
IOobjectOption::readOption requireValue = IOobjectOption::MUST_READ
);
//- Compatibility (prefer with readOption)
coupledFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& 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
(

View File

@ -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<Type>(p, iF, dict, false)
calculatedFvPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ)
{
evaluate();
}

View File

@ -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<Type>
{
public:
//- Runtime type information

View File

@ -50,7 +50,7 @@ Foam::fixedGradientFvPatchField<Type>::fixedGradientFvPatchField
const dictionary& dict
)
:
fvPatchField<Type>(p, iF, dict, false),
fvPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ),
gradient_("gradient", dict, p.size())
{
evaluate();

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -58,10 +59,10 @@ Foam::fixedValueFvPatchField<Type>::fixedValueFvPatchField
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict,
const bool valueRequired
IOobjectOption::readOption requireValue
)
:
fvPatchField<Type>(p, iF, dict, valueRequired)
fvPatchField<Type>(p, iF, dict, requireValue)
{}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -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<Type>
{
public:
//- Runtime type information
@ -102,9 +102,25 @@ public:
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const dictionary&,
const bool valueRequired=true
IOobjectOption::readOption requireValue = IOobjectOption::MUST_READ
);
//- Compatibility (prefer with readOption)
fixedValueFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& 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

View File

@ -63,7 +63,7 @@ Foam::transformFvPatchField<Type>::transformFvPatchField
const dictionary& dict
)
:
fvPatchField<Type>(p, iF, dict, false)
fvPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ)
{}

View File

@ -59,7 +59,7 @@ Foam::zeroGradientFvPatchField<Type>::zeroGradientFvPatchField
const dictionary& dict
)
:
fvPatchField<Type>(p, iF, dict, false)
fvPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ)
{
fvPatchField<Type>::operator=(this->patchInternalField());
}

View File

@ -54,7 +54,7 @@ Foam::cyclicFvPatchField<Type>::cyclicFvPatchField
const bool valueRequired
)
:
coupledFvPatchField<Type>(p, iF, dict, false), // Pass no valueRequired
coupledFvPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ),
cyclicPatch_(refCast<const cyclicFvPatch>(p, dict))
{
if (!isA<cyclicFvPatch>(p))

View File

@ -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<Type>::cyclicACMIFvPatchField
)
:
cyclicACMILduInterfaceField(),
coupledFvPatchField<Type>(p, iF, dict, dict.found("value")),
coupledFvPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ),
cyclicACMIPatch_(refCast<const cyclicACMIFvPatch>(p, dict))
{
if (!isA<cyclicACMIFvPatch>(p))
@ -68,7 +68,8 @@ Foam::cyclicACMIFvPatchField<Type>::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

View File

@ -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<Type>::cyclicAMIFvPatchField
)
:
cyclicAMILduInterfaceField(),
coupledFvPatchField<Type>(p, iF, dict, dict.found("value")),
coupledFvPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ),
cyclicAMIPatch_(refCast<const cyclicAMIFvPatch>(p, dict))
{
if (!isA<cyclicAMIFvPatch>(p))
@ -68,7 +68,8 @@ Foam::cyclicAMIFvPatchField<Type>::cyclicAMIFvPatchField
<< exit(FatalIOError);
}
if (!dict.found("value"))
// Use 'value' supplied, or set to coupled or internal field
if (!this->readValueEntry(dict))
{
if (this->coupled())
{

View File

@ -70,7 +70,7 @@ Foam::processorFvPatchField<Type>::processorFvPatchField
const dictionary& dict
)
:
coupledFvPatchField<Type>(p, iF, dict, dict.found("value")),
coupledFvPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ),
procPatch_(refCast<const processorFvPatch>(p, dict)),
sendRequest_(-1),
recvRequest_(-1)
@ -86,8 +86,8 @@ Foam::processorFvPatchField<Type>::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<Type>::operator=(this->patchInternalField());
}

View File

@ -88,7 +88,7 @@ activeBaffleVelocityFvPatchVectorField
const dictionary& dict
)
:
fixedValueFvPatchVectorField(p, iF, dict, false),
fixedValueFvPatchVectorField(p, iF, dict, IOobjectOption::NO_READ),
pName_(dict.getOrDefault<word>("p", "p")),
cyclicPatchName_(dict.lookup("cyclicPatch")),
cyclicPatchLabel_(p.patch().boundaryMesh().findPatchID(cyclicPatchName_)),

View File

@ -94,7 +94,7 @@ activePressureForceBaffleVelocityFvPatchVectorField
const dictionary& dict
)
:
fixedValueFvPatchVectorField(p, iF, dict, false),
fixedValueFvPatchVectorField(p, iF, dict, IOobjectOption::NO_READ),
pName_(dict.getOrDefault<word>("p", "p")),
cyclicPatchName_(dict.lookup("cyclicPatch")),
cyclicPatchLabel_(p.patch().boundaryMesh().findPatchID(cyclicPatchName_)),

View File

@ -88,14 +88,8 @@ Foam::advectiveFvPatchField<Type>::advectiveFvPatchField
fieldInf_(Zero),
lInf_(-GREAT)
{
if (dict.found("value"))
{
fvPatchField<Type>::operator=
(
Field<Type>("value", dict, p.size())
);
}
else
// Use 'value' supplied, or set to internal field
if (!this->readValueEntry(dict))
{
fvPatchField<Type>::operator=(this->patchInternalField());
}

View File

@ -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<Type>::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<Type>::codedFixedValueFvPatchField
{
updateLibrary(name_);
if (!dict.found("value"))
if (!this->readValueEntry(dict))
{
// Assign dummy value to get redirectPatchField not fail
this->operator==(this->patchInternalField());

View File

@ -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"

View File

@ -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<scalar>::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());
}

View File

@ -87,14 +87,7 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
this->jumpTable_ = Function1<Type>::New("jumpTable", dict, &this->db());
}
if (dict.found("value"))
{
fvPatchField<Type>::operator=
(
Field<Type>("value", dict, p.size())
);
}
else
if (!this->readValueEntry(dict))
{
this->evaluate(Pstream::commsTypes::blocking);
}

View File

@ -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<scalar>::operator=
(
scalarField("value", dict, p.size())
);
gradient() = scalarField("gradient", dict, p.size());
gradient().assign(*hasGrad, p.size());
}
else
{
fvPatchField<scalar>::operator=(patchInternalField());
gradient() = 0.0;
gradient() = Zero;
}
}

View File

@ -84,25 +84,15 @@ Foam::fixedJumpFvPatchField<Type>::fixedJumpFvPatchField
{
if (valueRequired)
{
jump_ = Field<Type>("jump", dict, p.size());
jump_.assign("jump", dict, p.size(), IOobjectOption::MUST_READ);
}
if (dict.found("jump0"))
{
jump0_ = Field<Type>("jump0", dict, p.size());
}
jump0_.assign("jump0", dict, p.size(), IOobjectOption::LAZY_READ);
}
if (valueRequired)
{
if (dict.found("value"))
{
fvPatchField<Type>::operator=
(
Field<Type>("value", dict, p.size())
);
}
else
if (!this->readValueEntry(dict))
{
this->evaluate(Pstream::commsTypes::blocking);
}

View File

@ -68,17 +68,10 @@ Foam::fixedJumpAMIFvPatchField<Type>::fixedJumpAMIFvPatchField
{
if (this->cyclicAMIPatch().owner())
{
jump_ = Field<Type>("jump", dict, p.size());
jump_.assign("jump", dict, p.size(), IOobjectOption::MUST_READ);
}
if (dict.found("value"))
{
fvPatchField<Type>::operator=
(
Field<Type>("value", dict, p.size())
);
}
else
if (!this->readValueEntry(dict))
{
this->evaluate(Pstream::commsTypes::blocking);
}

View File

@ -57,10 +57,7 @@ Foam::fixedMeanOutletInletFvPatchField<Type>::fixedMeanOutletInletFvPatchField
{
this->phiName_ = dict.getOrDefault<word>("phi", "phi");
fvPatchField<Type>::operator=
(
Field<Type>("value", dict, p.size())
);
this->readValueEntry(dict, IOobjectOption::MUST_READ);
this->refValue() = *this;
this->refGrad() = Zero;

View File

@ -67,7 +67,7 @@ Foam::fixedProfileFvPatchField<Type>::fixedProfileFvPatchField
const dictionary& dict
)
:
fixedValueFvPatchField<Type>(p, iF, dict, false),
fixedValueFvPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ),
profile_(Function1<Type>::New("profile", dict, &this->db())),
dir_(dict.lookup("direction")),
origin_(dict.get<scalar>("origin"))

View File

@ -58,7 +58,7 @@ flowRateInletVelocityFvPatchVectorField
const dictionary& dict
)
:
fixedValueFvPatchField<vector>(p, iF, dict, false),
fixedValueFvPatchField<vector>(p, iF, dict, IOobjectOption::NO_READ),
flowRate_(nullptr),
rhoName_("rho"),
rhoInlet_(dict.getOrDefault<scalar>("rhoInlet", -VGREAT)),
@ -90,15 +90,8 @@ flowRateInletVelocityFvPatchVectorField
<< exit(FatalIOError);
}
// Value field require if mass based
if (dict.found("value"))
{
fvPatchField<vector>::operator=
(
vectorField("value", dict, p.size())
);
}
else
// Value field required if mass based
if (!this->readValueEntry(dict))
{
evaluate(Pstream::commsTypes::blocking);
}

View File

@ -56,7 +56,7 @@ flowRateOutletVelocityFvPatchVectorField
const dictionary& dict
)
:
fixedValueFvPatchField<vector>(p, iF, dict, false),
fixedValueFvPatchField<vector>(p, iF, dict, IOobjectOption::NO_READ),
flowRate_(nullptr),
rhoName_("rho"),
rhoOutlet_(dict.getOrDefault<scalar>("rhoOutlet", -VGREAT)),
@ -84,15 +84,8 @@ flowRateOutletVelocityFvPatchVectorField
<< exit(FatalIOError);
}
// Value field require if mass based
if (dict.found("value"))
{
fvPatchField<vector>::operator=
(
vectorField("value", dict, p.size())
);
}
else
// Value field required if mass based
if (!this->readValueEntry(dict))
{
evaluate(Pstream::commsTypes::blocking);
}

View File

@ -57,19 +57,15 @@ Foam::freestreamFvPatchField<Type>::freestreamFvPatchField
this->phiName_ = dict.getOrDefault<word>("phi", "phi");
if (dict.found("freestreamValue"))
if
(
freestreamValue().assign
(
"freestreamValue", dict, p.size(), IOobjectOption::LAZY_READ
)
)
{
freestreamValue() =
Field<Type>("freestreamValue", dict, p.size());
if (dict.found("value"))
{
fvPatchField<Type>::operator=
(
Field<Type>("value", dict, p.size())
);
}
else
if (!this->readValueEntry(dict))
{
fvPatchField<Type>::operator=(freestreamValue());
}
@ -82,10 +78,7 @@ Foam::freestreamFvPatchField<Type>::freestreamFvPatchField
// Force user to supply an initial value
// - we do not know if the supplied BC has all dependencies available
fvPatchField<Type>::operator=
(
Field<Type>("value", dict, p.size())
);
this->readValueEntry(dict, IOobjectOption::MUST_READ);
}
}

View File

@ -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());
}

View File

@ -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());
}

View File

@ -89,14 +89,8 @@ inletOutletTotalTemperatureFvPatchScalarField
this->phiName_ = dict.getOrDefault<word>("phi", "phi");
this->refValue() = Zero;
if (dict.found("value"))
{
fvPatchField<scalar>::operator=
(
scalarField("value", dict, p.size())
);
}
else
if (!this->readValueEntry(dict))
{
fvPatchField<scalar>::operator=(T0_);
}

View File

@ -61,7 +61,8 @@ Foam::mappedMixedFvPatchField<Type>::mappedMixedFvPatchField
const dictionary& dict
)
:
mixedFvPatchField<Type>(p, iF, dict),
// Reading of mixed entries handled later...
mixedFvPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ),
mappedPatchFieldBase<Type>
(
mappedFixedValueFvPatchField<Type>::mapper(p, iF),
@ -70,17 +71,11 @@ Foam::mappedMixedFvPatchField<Type>::mappedMixedFvPatchField
),
weightFieldName_(dict.getOrDefault<word>("weightField", word::null))
{
mixedFvPatchField<Type>::operator=
(
Field<Type>("value", dict, p.size())
);
this->readValueEntry(dict, IOobjectOption::MUST_READ);
if (dict.found("refValue"))
if (this->readMixedEntries(dict))
{
// Full restart
this->refValue() = Field<Type>("refValue", dict, p.size());
this->refGrad() = Field<Type>("refGradient", dict, p.size());
this->valueFraction() = scalarField("valueFraction", dict, p.size());
}
else
{

View File

@ -42,8 +42,8 @@ matchedFlowRateOutletVelocityFvPatchVectorField
:
fixedValueFvPatchField<vector>(p, iF),
inletPatchName_(),
volumetric_(false),
rhoName_("rho")
rhoName_("rho"),
volumetric_(false)
{}
@ -55,8 +55,9 @@ matchedFlowRateOutletVelocityFvPatchVectorField
const dictionary& dict
)
:
fixedValueFvPatchField<vector>(p, iF, dict, false),
fixedValueFvPatchField<vector>(p, iF, dict, IOobjectOption::NO_READ),
inletPatchName_(dict.get<word>("inletPatch")),
rhoName_(),
volumetric_(dict.getOrDefault("volumetric", true))
{
if (volumetric_)
@ -68,15 +69,8 @@ matchedFlowRateOutletVelocityFvPatchVectorField
rhoName_ = dict.getOrDefault<word>("rho", "rho");
}
// Value field require if mass based
if (dict.found("value"))
{
fvPatchField<vector>::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<vector>(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<vector>(ptf),
inletPatchName_(ptf.inletPatchName_),
volumetric_(ptf.volumetric_),
rhoName_(ptf.rhoName_)
rhoName_(ptf.rhoName_),
volumetric_(ptf.volumetric_)
{}
@ -121,8 +115,8 @@ matchedFlowRateOutletVelocityFvPatchVectorField
:
fixedValueFvPatchField<vector>(ptf, iF),
inletPatchName_(ptf.inletPatchName_),
volumetric_(ptf.volumetric_),
rhoName_(ptf.rhoName_)
rhoName_(ptf.rhoName_),
volumetric_(ptf.volumetric_)
{}

View File

@ -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

View File

@ -168,14 +168,7 @@ outletMappedUniformInletFvPatchField
}
if (dict.found("value"))
{
fvPatchField<Type>::operator=
(
Field<Type>("value", dict, p.size())
);
}
else
if (!this->readValueEntry(dict))
{
fvPatchField<Type>::operator=(this->patchInternalField());
}

View File

@ -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());
}

View File

@ -77,10 +77,7 @@ Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
fvPatchFieldBase::readDict(dict);
// Backwards compatibility - leave refValue as zero unless specified
if (dict.found("refValue"))
{
refValue_ = Field<Type>("refValue", dict, p.size());
}
refValue_.assign("refValue", dict, p.size(), IOobjectOption::LAZY_READ);
evaluate();
}

View File

@ -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());
}

View File

@ -75,14 +75,7 @@ prghPermeableAlphaTotalPressureFvPatchScalarField
refGrad() = 0.0;
valueFraction() = 0.0;
if (dict.found("value"))
{
fvPatchField<scalar>::operator=
(
Field<scalar>("value", dict, p.size())
);
}
else
if (!this->readValueEntry(dict))
{
fvPatchField<scalar>::operator=(refValue());
}

View File

@ -55,18 +55,11 @@ prghPressureFvPatchScalarField
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF, dict, false),
fixedValueFvPatchScalarField(p, iF, dict, IOobjectOption::NO_READ),
rhoName_(dict.getOrDefault<word>("rho", "rho")),
p_("p", dict, p.size())
{
if (dict.found("value"))
{
fvPatchScalarField::operator=
(
scalarField("value", dict, p.size())
);
}
else
if (!this->readValueEntry(dict))
{
fvPatchField<scalar>::operator=(p_);
}

View File

@ -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<word>("U", "U")),
phiName_(dict.getOrDefault<word>("phi", "phi")),
rhoName_(dict.getOrDefault<word>("rho", "rho")),
p0_("p0", dict, p.size())
{
if (dict.found("value"))
{
fvPatchScalarField::operator=
(
scalarField("value", dict, p.size())
);
}
else
if (!this->readValueEntry(dict))
{
fvPatchField<scalar>::operator=(p0_);
}

View File

@ -55,19 +55,12 @@ rotatingWallVelocityFvPatchVectorField
const dictionary& dict
)
:
fixedValueFvPatchField<vector>(p, iF, dict, false),
fixedValueFvPatchField<vector>(p, iF, dict, IOobjectOption::NO_READ),
origin_(dict.lookup("origin")),
axis_(dict.lookup("axis")),
omega_(Function1<scalar>::New("omega", dict, &db()))
{
if (dict.found("value"))
{
fvPatchField<vector>::operator=
(
vectorField("value", dict, p.size())
);
}
else
if (!this->readValueEntry(dict))
{
// Evaluate the wall velocity
updateCoeffs();

View File

@ -52,7 +52,7 @@ Foam::scaledFixedValueFvPatchField<Type>::scaledFixedValueFvPatchField
const dictionary& dict
)
:
fixedValueFvPatchField<Type>(p, iF, dict, false),
fixedValueFvPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ),
scalePtr_(PatchFunction1<scalar>::New(p.patch(), "scale", dict)),
refValuePtr_(fvPatchField<Type>::New(p, iF, dict.subDict("refValue")))
{

View File

@ -74,14 +74,7 @@ supersonicFreestreamFvPatchVectorField
{
fvPatchFieldBase::readDict(dict);
if (dict.found("value"))
{
fvPatchField<vector>::operator=
(
vectorField("value", dict, p.size())
);
}
else
if (!this->readValueEntry(dict))
{
fvPatchField<vector>::operator=(patchInternalField());
}

View File

@ -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<scalar>::NewIfPresent("ramp", dict, word::null, &db()))
{

View File

@ -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<scalar>("Ap")),
Sp_(dict.get<scalar>("Sp")),
VsI_(dict.get<scalar>("VsI")),

View File

@ -53,7 +53,7 @@ timeVaryingMappedFixedValueFvPatchField
const dictionary& dict
)
:
fixedValueFvPatchField<Type>(p, iF, dict, false),
fixedValueFvPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ),
uniformValue_
(
new PatchFunction1Types::MappedFile<Type>
@ -66,11 +66,7 @@ timeVaryingMappedFixedValueFvPatchField
)
)
{
if (dict.found("value"))
{
fvPatchField<Type>::operator==(Field<Type>("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

View File

@ -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<word>("U", "U")),
phiName_(dict.getOrDefault<word>("phi", "phi")),
rhoName_(dict.getOrDefault<word>("rho", "rho")),
@ -66,14 +66,7 @@ Foam::totalPressureFvPatchScalarField::totalPressureFvPatchScalarField
gamma_(psiName_ != "none" ? dict.get<scalar>("gamma") : 1),
p0_("p0", dict, p.size())
{
if (dict.found("value"))
{
fvPatchField<scalar>::operator=
(
scalarField("value", dict, p.size())
);
}
else
if (!this->readValueEntry(dict))
{
fvPatchField<scalar>::operator=(p0_);
}

View File

@ -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<word>("U", "U")),
phiName_(dict.getOrDefault<word>("phi", "phi")),
psiName_(dict.getOrDefault<word>("psi", "thermo:psi")),
gamma_(dict.get<scalar>("gamma")),
T0_("T0", dict, p.size())
{
if (dict.found("value"))
{
fvPatchField<scalar>::operator=
(
scalarField("value", dict, p.size())
);
}
else
if (!this->readValueEntry(dict))
{
fvPatchField<scalar>::operator=(T0_);
}

View File

@ -52,7 +52,7 @@ translatingWallVelocityFvPatchVectorField
const dictionary& dict
)
:
fixedValueFvPatchField<vector>(p, iF, dict, false),
fixedValueFvPatchField<vector>(p, iF, dict, IOobjectOption::NO_READ),
U_(Function1<vector>::New("U", dict, &db()))
{
// Evaluate the wall velocity

View File

@ -53,21 +53,14 @@ Foam::turbulentInletFvPatchField<Type>::turbulentInletFvPatchField
const dictionary& dict
)
:
fixedValueFvPatchField<Type>(p, iF, dict, false),
fixedValueFvPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ),
ranGen_(label(0)),
fluctuationScale_(dict.get<Type>("fluctuationScale")),
referenceField_("referenceField", dict, p.size()),
alpha_(dict.getOrDefault<scalar>("alpha", 0.1)),
curTimeIndex_(-1)
{
if (dict.found("value"))
{
fixedValueFvPatchField<Type>::operator==
(
Field<Type>("value", dict, p.size())
);
}
else
if (!this->readValueEntry(dict))
{
fixedValueFvPatchField<Type>::operator==(referenceField_);
}

View File

@ -56,19 +56,12 @@ uniformDensityHydrostaticPressureFvPatchScalarField
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF, dict, false),
fixedValueFvPatchScalarField(p, iF, dict, IOobjectOption::NO_READ),
rho_(dict.get<scalar>("rho")),
pRefValue_(dict.get<scalar>("pRefValue")),
pRefPoint_(dict.lookup("pRefPoint"))
{
if (dict.found("value"))
{
fvPatchField<scalar>::operator=
(
scalarField("value", dict, p.size())
);
}
else
if (!this->readValueEntry(dict))
{
evaluate();
}

View File

@ -63,7 +63,7 @@ Foam::uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField
const dictionary& dict
)
:
fixedGradientFvPatchField<Type>(p, iF),
fixedGradientFvPatchField<Type>(p, iF), // Bypass dictionary constructor
uniformGradient_
(
PatchFunction1<Type>::New(p.patch(), "uniformGradient", dict)

View File

@ -63,17 +63,10 @@ Foam::uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
const dictionary& dict
)
:
fixedValueFvPatchField<Type>(p, iF, dict, false),
fixedValueFvPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ),
uniformValue_(PatchFunction1<Type>::New(p.patch(), "uniformValue", dict))
{
if (dict.found("value"))
{
fvPatchField<Type>::operator=
(
Field<Type>("value", dict, p.size())
);
}
else
if (!this->readValueEntry(dict))
{
this->evaluate();
}

View File

@ -66,14 +66,7 @@ Foam::uniformInletOutletFvPatchField<Type>::uniformInletOutletFvPatchField
this->refValue() =
uniformInletValue_->value(this->db().time().timeOutputValue());
if (dict.found("value"))
{
fvPatchField<Type>::operator=
(
Field<Type>("value", dict, p.size())
);
}
else
if (!this->readValueEntry(dict))
{
fvPatchField<Type>::operator=(this->refValue());
}

View File

@ -75,14 +75,7 @@ Foam::uniformJumpFvPatchField<Type>::uniformJumpFvPatchField
jumpTable_ = Function1<Type>::New("jumpTable", dict, &this->db());
}
if (dict.found("value"))
{
fvPatchField<Type>::operator=
(
Field<Type>("value", dict, p.size())
);
}
else
if (!this->readValueEntry(dict))
{
this->evaluate(Pstream::commsTypes::blocking);
}

View File

@ -72,11 +72,7 @@ Foam::uniformJumpAMIFvPatchField<Type>::uniformJumpAMIFvPatchField
jumpTable_ = Function1<Type>::New("jumpTable", dict, &this->db());
}
if (dict.found("value"))
{
fvPatchField<Type>::operator=(Field<Type>("value", dict, p.size()));
}
else
if (!this->readValueEntry(dict))
{
this->evaluate(Pstream::commsTypes::blocking);
}

View File

@ -53,18 +53,11 @@ uniformNormalFixedValueFvPatchVectorField
const dictionary& dict
)
:
fixedValueFvPatchVectorField(p, iF, dict, false),
fixedValueFvPatchVectorField(p, iF, dict, IOobjectOption::NO_READ),
uniformValue_(PatchFunction1<scalar>::New(p.patch(), "uniformValue", dict)),
ramp_(Function1<scalar>::NewIfPresent("ramp", dict, word::null, &db()))
{
if (dict.found("value"))
{
fvPatchVectorField::operator=
(
vectorField("value", dict, p.size())
);
}
else
if (!this->readValueEntry(dict))
{
this->evaluate();
}

View File

@ -59,7 +59,7 @@ uniformTotalPressureFvPatchScalarField
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF, dict, false),
fixedValueFvPatchScalarField(p, iF, dict, IOobjectOption::NO_READ),
UName_(dict.getOrDefault<word>("U", "U")),
phiName_(dict.getOrDefault<word>("phi", "phi")),
rhoName_(dict.getOrDefault<word>("rho", "rho")),
@ -67,14 +67,7 @@ uniformTotalPressureFvPatchScalarField
gamma_(psiName_ != "none" ? dict.get<scalar>("gamma") : 1),
p0_(Function1<scalar>::New("p0", dict, &db()))
{
if (dict.found("value"))
{
fvPatchField<scalar>::operator=
(
scalarField("value", dict, p.size())
);
}
else
if (!this->readValueEntry(dict))
{
const scalar t = this->db().time().timeOutputValue();
fvPatchScalarField::operator==(p0_->value(t));

View File

@ -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());
}

View File

@ -122,6 +122,7 @@ protected:
manipulatedMatrix_ = state;
}
public:
//- Debug switch to disallow the use of generic fvPatchField

View File

@ -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.

View File

@ -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<Type>::calculatedFvsPatchField
const dictionary& dict
)
:
fvsPatchField<Type>(p, iF, Field<Type>("value", dict, p.size()))
fvsPatchField<Type>(p, iF, dict, IOobjectOption::MUST_READ)
{}

View File

@ -48,7 +48,7 @@ Foam::fixedValueFvsPatchField<Type>::fixedValueFvsPatchField
const dictionary& dict
)
:
fvsPatchField<Type>(p, iF, Field<Type>("value", dict, p.size()))
fvsPatchField<Type>(p, iF, dict, IOobjectOption::MUST_READ)
{}

View File

@ -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.

View File

@ -149,27 +149,16 @@ externalCoupledTemperatureMixedFvPatchScalarField
Tref_ = Function1<scalar>::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<scalar>::operator=
(
scalarField("value", dict, p.size())
);
}
else
if (!this->readValueEntry(dict))
{
fvPatchField<scalar>::operator=(this->patchInternalField());
}

View File

@ -101,14 +101,7 @@ timeVaryingMappedFixedValuePointPatchField
fieldTableName_
);
if (dict.found("value"))
{
fixedValuePointPatchField<Type>::operator==
(
Field<Type>("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

View File

@ -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);
}

View File

@ -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<Type>(p, iF, dict, false),
fixedValuePointPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ),
uniformValue_
(
PatchFunction1<Type>::New
@ -85,14 +85,7 @@ uniformFixedValuePointPatchField
)
)
{
if (dict.found("value"))
{
fixedValuePointPatchField<Type>::operator==
(
Field<Type>("value", dict, p.size())
);
}
else
if (!this->readValueEntry(dict))
{
this->evaluate();
}

View File

@ -65,13 +65,8 @@ Foam::adjointOutletFluxFvPatchField<Type>::adjointOutletFluxFvPatchField
const dictionary& dict
)
:
fixedValueFvPatchField<Type>(p, iF)
{
fvPatchField<Type>::operator=
(
Field<Type>("value", dict, p.size())
);
}
fixedValueFvPatchField<Type>(p, iF, dict, IOobjectOption::MUST_READ)
{}
template<class Type>

View File

@ -83,7 +83,7 @@ Foam::oversetFvPatchField<Type>::oversetFvPatchField
const dictionary& dict
)
:
coupledFvPatchField<Type>(p, iF, dict, false),
coupledFvPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ),
oversetPatch_(refCast<const oversetFvPatch>(p, dict)),
setHoleCellValue_(dict.getOrDefault("setHoleCellValue", false)),
fluxCorrection_
@ -110,14 +110,8 @@ Foam::oversetFvPatchField<Type>::oversetFvPatchField
fringeFaces_(),
zoneId_(dict.getOrDefault<label>("zone", -1))
{
if (dict.found("value"))
{
Field<Type>::operator=
(
Field<Type>("value", dict, p.size())
);
}
else
// Use 'value' supplied, or set to internal field
if (!this->readValueEntry(dict))
{
Field<Type>::operator=(this->patchInternalField());
}

View File

@ -85,14 +85,7 @@ timeVaryingMassSorptionFvPatchScalarField
max_(dict.getCheck<scalar>("max", scalarMinMax::ge(0))),
kdes_(dict.getCheckOrDefault<scalar>("kdes", 0, scalarMinMax::ge(0)))
{
if (dict.found("value"))
{
fvPatchScalarField::operator=
(
scalarField("value", dict, p.size())
);
}
else
if (!this->readValueEntry(dict))
{
fvPatchField<scalar>::operator=(Zero);
}

View File

@ -102,14 +102,11 @@ velocityFilmShellFvPatchVectorField::velocityFilmShellFvPatchVectorField
curTimeIndex_(-1),
zeroWallVelocity_(dict.getOrDefault<bool>("zeroWallVelocity", true))
{
fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
this->readValueEntry(dict, IOobjectOption::MUST_READ);
if (dict.found("refValue"))
if (this->readMixedEntries(dict))
{
// Full restart
refValue() = vectorField("refValue", dict, p.size());
refGrad() = vectorField("refGradient", dict, p.size());
valueFraction() = scalarField("valueFraction", dict, p.size());
}
else
{

View File

@ -96,14 +96,11 @@ vibrationShellFvPatchScalarField::vibrationShellFvPatchScalarField
)
)
{
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
this->readValueEntry(dict, IOobjectOption::MUST_READ);
if (dict.found("refValue"))
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
{

View File

@ -178,14 +178,11 @@ filmPyrolysisRadiativeCoupledMixedFvPatchScalarField
<< exit(FatalError);
}
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
this->readValueEntry(dict, IOobjectOption::MUST_READ);
if (dict.found("refValue"))
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
{

View File

@ -136,8 +136,6 @@ externalWallHeatFluxTemperatureFvPatchScalarField
}
}
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
if (qrName_ != "none")
{
if (dict.found("qrPrevious"))
@ -150,12 +148,11 @@ externalWallHeatFluxTemperatureFvPatchScalarField
}
}
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
{

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2019,2021 OpenCFD Ltd.
Copyright (C) 2016-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -73,14 +73,15 @@ fixedIncidentRadiationFvPatchScalarField
const dictionary& dict
)
:
fixedGradientFvPatchScalarField(p, iF),
fixedGradientFvPatchScalarField(p, iF), // Bypass dictionary constructor
temperatureCoupledBase(patch(), dict),
qrIncident_("qrIncident", dict, p.size())
{
if (dict.found("value") && dict.found("gradient"))
const auto* hasGrad = dict.findEntry("gradient", keyType::LITERAL);
if (hasGrad && this->readValueEntry(dict))
{
fvPatchField<scalar>::operator=(Field<scalar>("value", dict, p.size()));
gradient() = Field<scalar>("gradient", dict, p.size());
gradient().assign(*hasGrad, p.size());
}
else
{

View File

@ -248,7 +248,7 @@ humidityTemperatureCoupledMixedFvPatchScalarField
<< exit(FatalIOError);
}
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
this->readValueEntry(dict, IOobjectOption::MUST_READ);
if (massModeTypeNames_.readIfPresent("mode", dict, mode_))
{
@ -315,13 +315,9 @@ humidityTemperatureCoupledMixedFvPatchScalarField
}
if (dict.found("refValue"))
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
{

View File

@ -100,7 +100,7 @@ thermalBaffle1DFvPatchScalarField
TName_("T"),
baffleActivated_(dict.getOrDefault("baffleActivated", true)),
thickness_(),
qs_(p.size(), 0),
qs_(p.size(), Zero),
solidDict_(dict),
solidPtr_(),
qrPrevious_(p.size(), Zero),
@ -110,7 +110,7 @@ thermalBaffle1DFvPatchScalarField
),
qrName_(dict.getOrDefault<word>("qr", "none"))
{
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
this->readValueEntry(dict, IOobjectOption::MUST_READ);
if (dict.found("thickness"))
{
@ -127,12 +127,9 @@ thermalBaffle1DFvPatchScalarField
qrPrevious_ = scalarField("qrPrevious", dict, p.size());
}
if (dict.found("refValue") && baffleActivated_)
if (baffleActivated_ && this->readMixedEntries(dict))
{
// Full restart
refValue() = scalarField("refValue", dict, p.size());
refGrad() = scalarField("refGradient", dict, p.size());
valueFraction() = scalarField("valueFraction", dict, p.size());
}
else
{

View File

@ -71,14 +71,7 @@ totalFlowRateAdvectiveDiffusiveFvPatchScalarField
refGrad() = 0.0;
valueFraction() = 0.0;
if (dict.found("value"))
{
fvPatchField<scalar>::operator=
(
Field<scalar>("value", dict, p.size())
);
}
else
if (!this->readValueEntry(dict))
{
fvPatchField<scalar>::operator=(refValue());
}

View File

@ -143,14 +143,11 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
);
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
this->readValueEntry(dict, IOobjectOption::MUST_READ);
if (dict.found("refValue"))
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
{

View File

@ -191,14 +191,11 @@ turbulentTemperatureRadCoupledMixedFvPatchScalarField
);
}
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
this->readValueEntry(dict, IOobjectOption::MUST_READ);
if (dict.found("refValue"))
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
{

View File

@ -274,7 +274,7 @@ sorptionWallFunctionFvPatchScalarField::sorptionWallFunctionFvPatchScalarField
const dictionary& dict
)
:
fixedGradientFvPatchScalarField(p, iF),
fixedGradientFvPatchScalarField(p, iF), // Bypass dictionary constructor
wallFunctionBlenders(dict, blenderType::STEPWISE, scalar(2)),
laminar_(dict.getOrDefault<bool>("laminar", false)),
kAbsPtr_(PatchFunction1<scalar>::New(p.patch(), "kAbs", dict)),
@ -303,13 +303,11 @@ sorptionWallFunctionFvPatchScalarField::sorptionWallFunctionFvPatchScalarField
<< exit(FatalIOError);
}
if (dict.found("value") && dict.found("gradient"))
const auto* hasGrad = dict.findEntry("gradient", keyType::LITERAL);
if (hasGrad && this->readValueEntry(dict))
{
fvPatchField<scalar>::operator =
(
Field<scalar>("value", dict, p.size())
);
gradient() = Field<scalar>("gradient", dict, p.size());
gradient().assign(*hasGrad, p.size());
}
else
{

View File

@ -77,14 +77,7 @@ Foam::wallHeatTransferFvPatchScalarField::wallHeatTransferFvPatchScalarField
refGrad() = 0.0;
valueFraction() = 0.0;
if (dict.found("value"))
{
fvPatchField<scalar>::operator=
(
scalarField("value", dict, p.size())
);
}
else
if (!this->readValueEntry(dict))
{
evaluate();
}

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