Commit 3eec5854 authored by Henry Weller's avatar Henry Weller
Browse files

Standardized the selection of required and optional fields in BCs, fvOptions, functionObjects etc.

In most boundary conditions, fvOptions etc. required and optional fields
to be looked-up from the objectRegistry are selected by setting the
keyword corresponding to the standard field name in the BC etc. to the
appropriate name in the objectRegistry.  Usually a default is provided
with sets the field name to the keyword name, e.g. in the
totalPressureFvPatchScalarField the velocity is selected by setting the
keyword 'U' to the appropriate name which defaults to 'U':

        Property     | Description             | Required    | Default value
        U            | velocity field name     | no          | U
        phi          | flux field name         | no          | phi
        .
        .
        .

However, in some BCs and functionObjects and many fvOptions another
convention is used in which the field name keyword is appended by 'Name'
e.g.

        Property     | Description             | Required    | Default value
        pName        | pressure field name     | no          | p
        UName        | velocity field name     | no          | U

This difference in convention is unnecessary and confusing, hinders code
and dictionary reuse and complicates code maintenance.  In this commit
the appended 'Name' is removed from the field selection keywords
standardizing OpenFOAM on the first convention above.
parent a84ffc39
......@@ -47,9 +47,9 @@ Description
\heading Patch usage
\table
Property | Description | Required | Default value
pName | Pressure field name | no | p
psiName | Compressibility field name | no | thermo:psi
Property | Description | Required | Default value
p | Pressure field name | no | p
psi | Compressibility field name | no | thermo:psi
\endtable
Example of the boundary condition specification:
......
......@@ -77,7 +77,7 @@ Foam::solidBodyMotionFvMesh::solidBodyMotionFvMesh(const IOobject& io)
),
pointIDs_(),
moveAllCells_(false),
UName_(dynamicMeshCoeffs_.lookupOrDefault<word>("UName", "U"))
UName_(dynamicMeshCoeffs_.lookupOrDefault<word>("U", "U"))
{
if (undisplacedPoints_.size() != nPoints())
{
......
......@@ -34,8 +34,8 @@ Description
For a mass-based flux:
- the flow rate should be provided in kg/s
- if \c rhoName is "none" the flow rate is in m3/s
- otherwise \c rhoName should correspond to the name of the density field
- if \c rho is "none" the flow rate is in m3/s
- otherwise \c rho should correspond to the name of the density field
- if the density field cannot be found in the database, the user must
specify the inlet density using the \c rhoInlet entry
......
......@@ -68,7 +68,7 @@ mappedPatchFieldBase<Type>::mappedPatchFieldBase
(
dict.template lookupOrDefault<word>
(
"fieldName",
"field",
patchField_.internalField().name()
)
),
......@@ -314,7 +314,7 @@ tmp<Field<Type>> mappedPatchFieldBase<Type>::mappedField() const
template<class Type>
void mappedPatchFieldBase<Type>::write(Ostream& os) const
{
os.writeKeyword("fieldName") << fieldName_ << token::END_STATEMENT << nl;
os.writeKeyword("field") << fieldName_ << token::END_STATEMENT << nl;
os.writeKeyword("setAverage") << setAverage_ << token::END_STATEMENT << nl;
os.writeKeyword("average") << average_ << token::END_STATEMENT << nl;
os.writeKeyword("interpolationScheme") << interpolationScheme_
......
......@@ -69,7 +69,7 @@ outletMappedUniformInletFvPatchField
)
:
fixedValueFvPatchField<Type>(p, iF, dict),
outletPatchName_(dict.lookup("outletPatchName")),
outletPatchName_(dict.lookup("outletPatch")),
phiName_(dict.lookupOrDefault<word>("phi", "phi"))
{}
......@@ -168,7 +168,7 @@ template<class Type>
void Foam::outletMappedUniformInletFvPatchField<Type>::write(Ostream& os) const
{
fvPatchField<Type>::write(os);
os.writeKeyword("outletPatchName")
os.writeKeyword("outletPatch")
<< outletPatchName_ << token::END_STATEMENT << nl;
if (phiName_ != "phi")
{
......
......@@ -40,7 +40,7 @@ phaseHydrostaticPressureFvPatchScalarField
)
:
mixedFvPatchScalarField(p, iF),
phaseName_("alpha"),
phaseFraction_("alpha"),
rho_(0.0),
pRefValue_(0.0),
pRefPoint_(Zero)
......@@ -60,7 +60,7 @@ phaseHydrostaticPressureFvPatchScalarField
)
:
mixedFvPatchScalarField(p, iF),
phaseName_(dict.lookupOrDefault<word>("phaseName", "alpha")),
phaseFraction_(dict.lookupOrDefault<word>("phaseFraction", "alpha")),
rho_(readScalar(dict.lookup("rho"))),
pRefValue_(readScalar(dict.lookup("pRefValue"))),
pRefPoint_(dict.lookup("pRefPoint"))
......@@ -94,7 +94,7 @@ phaseHydrostaticPressureFvPatchScalarField
)
:
mixedFvPatchScalarField(ptf, p, iF, mapper),
phaseName_(ptf.phaseName_),
phaseFraction_(ptf.phaseFraction_),
rho_(ptf.rho_),
pRefValue_(ptf.pRefValue_),
pRefPoint_(ptf.pRefPoint_)
......@@ -108,7 +108,7 @@ phaseHydrostaticPressureFvPatchScalarField
)
:
mixedFvPatchScalarField(ptf),
phaseName_(ptf.phaseName_)
phaseFraction_(ptf.phaseFraction_)
{}
......@@ -120,7 +120,7 @@ phaseHydrostaticPressureFvPatchScalarField
)
:
mixedFvPatchScalarField(ptf, iF),
phaseName_(ptf.phaseName_),
phaseFraction_(ptf.phaseFraction_),
rho_(ptf.rho_),
pRefValue_(ptf.pRefValue_),
pRefPoint_(ptf.pRefPoint_)
......@@ -139,7 +139,7 @@ void Foam::phaseHydrostaticPressureFvPatchScalarField::updateCoeffs()
const scalarField& alphap =
patch().lookupPatchField<volScalarField, scalar>
(
phaseName_
phaseFraction_
);
const uniformDimensionedVectorField& g =
......@@ -161,10 +161,10 @@ void Foam::phaseHydrostaticPressureFvPatchScalarField::updateCoeffs()
void Foam::phaseHydrostaticPressureFvPatchScalarField::write(Ostream& os) const
{
fvPatchScalarField::write(os);
if (phaseName_ != "alpha")
if (phaseFraction_ != "alpha")
{
os.writeKeyword("phaseName")
<< phaseName_ << token::END_STATEMENT << nl;
os.writeKeyword("phaseFraction")
<< phaseFraction_ << token::END_STATEMENT << nl;
}
os.writeKeyword("rho") << rho_ << token::END_STATEMENT << nl;
os.writeKeyword("pRefValue") << pRefValue_ << token::END_STATEMENT << nl;
......@@ -182,8 +182,7 @@ void Foam::phaseHydrostaticPressureFvPatchScalarField::operator=
{
fvPatchScalarField::operator=
(
valueFraction()*refValue()
+ (1 - valueFraction())*ptf
valueFraction()*refValue() + (1 - valueFraction())*ptf
);
}
......
......@@ -51,11 +51,11 @@ Description
\heading Patch usage
\table
Property | Description | Required | Default value
phaseName | phase field name | no | alpha
rho | density field name | no | rho
pRefValue | reference pressure [Pa] | yes |
pRefPoint | reference pressure location | yes |
Property | Description | Required | Default value
phaseFraction | phase-fraction field name | no | alpha
rho | density field name | no | rho
pRefValue | reference pressure [Pa] | yes |
pRefPoint | reference pressure location | yes |
\endtable
Example of the boundary condition specification:
......@@ -63,7 +63,7 @@ Description
myPatch
{
type phaseHydrostaticPressure;
phaseName alpha1;
phaseFraction alpha1;
rho rho;
pRefValue 1e5;
pRefPoint (0 0 0);
......@@ -103,7 +103,7 @@ protected:
// Protected data
//- Name of phase-fraction field
word phaseName_;
word phaseFraction_;
//- Constant density in the far-field
scalar rho_;
......@@ -196,16 +196,16 @@ public:
// Access
//- Return the phaseName
const word& phaseName() const
//- Return the phaseFraction
const word& phaseFraction() const
{
return phaseName_;
return phaseFraction_;
}
//- Return reference to the phaseName to allow adjustment
word& phaseName()
//- Return reference to the phaseFraction to allow adjustment
word& phaseFraction()
{
return phaseName_;
return phaseFraction_;
}
//- Return the constant density in the far-field
......
......@@ -149,7 +149,7 @@ void Foam::prghTotalHydrostaticPressureFvPatchScalarField::write
writeEntryIfDifferent<word>(os, "U", "U", UName_);
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
writeEntryIfDifferent<word>(os, "ph_rghName", "ph_rghName", ph_rghName_);
writeEntryIfDifferent<word>(os, "ph_rgh", "ph_rgh", ph_rghName_);
writeEntry("value", os);
}
......
......@@ -98,7 +98,7 @@ timeVaryingMappedFixedValueFvPatchField
}
dict.readIfPresent("fieldTableName", fieldTableName_);
dict.readIfPresent("fieldTable", fieldTableName_);
if (dict.found("value"))
{
......@@ -565,7 +565,7 @@ void Foam::timeVaryingMappedFixedValueFvPatchField<Type>::write
if (fieldTableName_ != this->internalField().name())
{
os.writeKeyword("fieldTableName") << fieldTableName_
os.writeKeyword("fieldTable") << fieldTableName_
<< token::END_STATEMENT << nl;
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -29,7 +29,7 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
Foam::word Foam::fv::localEulerDdt::rDeltaTName("rDeltaT");
Foam::word Foam::fv::localEulerDdt::rSubDeltaTName("rSubDeltaTName");
Foam::word Foam::fv::localEulerDdt::rSubDeltaTName("rSubDeltaT");
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -59,7 +59,7 @@ uniformInterpolatedDisplacementPointPatchVectorField
)
:
fixedValuePointPatchField<vector>(p, iF, dict),
fieldName_(dict.lookup("fieldName")),
fieldName_(dict.lookup("field")),
interpolationScheme_(dict.lookup("interpolationScheme"))
{
const pointMesh& pMesh = this->internalField().mesh();
......@@ -260,7 +260,7 @@ void uniformInterpolatedDisplacementPointPatchVectorField::write(Ostream& os)
const
{
pointPatchField<vector>::write(os);
os.writeKeyword("fieldName")
os.writeKeyword("field")
<< fieldName_ << token::END_STATEMENT << nl;
os.writeKeyword("interpolationScheme")
<< interpolationScheme_ << token::END_STATEMENT << nl;
......
......@@ -37,7 +37,7 @@ Description
{
type uniformInterpolatedDisplacement;
value uniform (0 0 0);
fieldName wantedDisplacement;
field wantedDisplacement;
interpolationScheme linear;
}
\endverbatim
......
......@@ -84,7 +84,7 @@ Foam::fv::fixedTemperatureConstraint::fixedTemperatureConstraint
}
case tmLookup:
{
TName_ = coeffs_.lookupOrDefault<word>("TName", "T");
TName_ = coeffs_.lookupOrDefault<word>("T", "T");
break;
}
default:
......@@ -157,7 +157,7 @@ bool Foam::fv::fixedTemperatureConstraint::read(const dictionary& dict)
);
}
coeffs_.readIfPresent("TName", TName_);
coeffs_.readIfPresent("T", TName_);
return true;
}
......
......@@ -33,11 +33,11 @@ Description
{
mode uniform; // uniform or lookup
// uniform option
// For uniform option
temperature constant 500; // fixed temperature with time [K]
// lookup option
// TName T; // optional temperature field name
// For lookup option
// T <Tname>; // optional temperature field name
}
Note:
......
......@@ -56,9 +56,9 @@ Foam::fv::buoyancyEnergy::buoyancyEnergy
)
:
option(sourceName, modelType, dict, mesh),
UName_(coeffs_.lookupOrDefault<word>("UName", "U"))
UName_(coeffs_.lookupOrDefault<word>("U", "U"))
{
coeffs_.lookup("fieldNames") >> fieldNames_;
coeffs_.lookup("fields") >> fieldNames_;
if (fieldNames_.size() != 1)
{
......
......@@ -68,7 +68,7 @@ Foam::fv::buoyancyForce::buoyancyForce
)
)
{
coeffs_.lookup("fieldNames") >> fieldNames_;
coeffs_.lookup("fields") >> fieldNames_;
if (fieldNames_.size() != 1)
{
......
......@@ -156,9 +156,9 @@ Foam::fv::effectivenessHeatExchangerSource::effectivenessHeatExchangerSource
secondaryInletT_(readScalar(coeffs_.lookup("secondaryInletT"))),
primaryInletT_(readScalar(coeffs_.lookup("primaryInletT"))),
eTable_(),
UName_(coeffs_.lookupOrDefault<word>("UName", "U")),
TName_(coeffs_.lookupOrDefault<word>("TName", "T")),
phiName_(coeffs_.lookupOrDefault<word>("phiName", "phi")),
UName_(coeffs_.lookupOrDefault<word>("U", "U")),
TName_(coeffs_.lookupOrDefault<word>("T", "T")),
phiName_(coeffs_.lookupOrDefault<word>("phi", "phi")),
faceZoneName_(coeffs_.lookup("faceZone")),
zoneID_(mesh_.faceZones().findZoneID(faceZoneName_)),
faceId_(),
......
......@@ -130,9 +130,9 @@ bool Foam::fv::explicitPorositySource::read(const dictionary& dict)
{
coeffs_.lookup("UNames") >> fieldNames_;
}
else if (coeffs_.found("UName"))
else if (coeffs_.found("U"))
{
word UName(coeffs_.lookup("UName"));
word UName(coeffs_.lookup("U"));
fieldNames_ = wordList(1, UName);
}
else
......
......@@ -93,7 +93,7 @@ Foam::fv::meanVelocityForce::meanVelocityForce
relaxation_(coeffs_.lookupOrDefault<scalar>("relaxation", 1.0)),
rAPtr_(NULL)
{
coeffs_.lookup("fieldNames") >> fieldNames_;
coeffs_.lookup("fields") >> fieldNames_;
if (fieldNames_.size() != 1)
{
......
......@@ -586,7 +586,7 @@ bool Foam::fv::rotorDiskSource::read(const dictionary& dict)
{
if (cellSetOption::read(dict))
{
coeffs_.lookup("fieldNames") >> fieldNames_;
coeffs_.lookup("fields") >> fieldNames_;
applied_.setSize(fieldNames_.size(), false);
// Read co-ordinate system/geometry invariant properties
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment