functionObjects/field: Simplified code using the VolField and SurfaceField partial specialisations
replacing the inconsistently named local typedefs and direct use of the more complex GeometricField template types.
This commit is contained in:
@ -32,14 +32,12 @@ License
|
||||
template<class Type>
|
||||
bool Foam::functionObjects::blendingFactor::calcBF()
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> FieldType;
|
||||
|
||||
if (!foundObject<FieldType>(fieldName_))
|
||||
if (!foundObject<VolField<Type>>(fieldName_))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const FieldType& field = lookupObject<FieldType>(fieldName_);
|
||||
const VolField<Type>& field = lookupObject<VolField<Type>>(fieldName_);
|
||||
|
||||
const word divScheme("div(" + phiName_ + ',' + fieldName_ + ')');
|
||||
ITstream& its = mesh_.schemes().div(divScheme);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -52,16 +52,13 @@ bool Foam::functionObjects::components::calcFieldComponents()
|
||||
template<class Type>
|
||||
bool Foam::functionObjects::components::calcComponents()
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
||||
typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
|
||||
|
||||
if (foundObject<VolFieldType>(fieldName_))
|
||||
if (foundObject<VolField<Type>>(fieldName_))
|
||||
{
|
||||
return calcFieldComponents<VolFieldType>();
|
||||
return calcFieldComponents<VolField<Type>>();
|
||||
}
|
||||
else if (foundObject<SurfaceFieldType>(fieldName_))
|
||||
else if (foundObject<SurfaceField<Type>>(fieldName_))
|
||||
{
|
||||
return calcFieldComponents<SurfaceFieldType>();
|
||||
return calcFieldComponents<SurfaceField<Type>>();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2017-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2017-2022 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -30,14 +30,12 @@ License
|
||||
template<class Type>
|
||||
bool Foam::functionObjects::ddt::calcDdt()
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
||||
|
||||
if (foundObject<VolFieldType>(fieldName_))
|
||||
if (foundObject<VolField<Type>>(fieldName_))
|
||||
{
|
||||
return store
|
||||
(
|
||||
resultName_,
|
||||
fvc::ddt(lookupObject<VolFieldType>(fieldName_))
|
||||
fvc::ddt(lookupObject<VolField<Type>>(fieldName_))
|
||||
);
|
||||
}
|
||||
else
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -36,7 +36,7 @@ void Foam::functionObjects::fieldCoordinateSystemTransform::transformField
|
||||
const FieldType& field
|
||||
)
|
||||
{
|
||||
word transFieldName(transformFieldName(field.name()));
|
||||
const word transFieldName(transformFieldName(field.name()));
|
||||
|
||||
store
|
||||
(
|
||||
@ -52,25 +52,22 @@ void Foam::functionObjects::fieldCoordinateSystemTransform::transform
|
||||
const word& fieldName
|
||||
)
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
||||
typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
|
||||
|
||||
if (mesh_.foundObject<VolFieldType>(fieldName))
|
||||
if (mesh_.foundObject<VolField<Type>>(fieldName))
|
||||
{
|
||||
DebugInfo << type() << ": Field " << fieldName << endl;
|
||||
|
||||
transformField<VolFieldType>
|
||||
transformField<VolField<Type>>
|
||||
(
|
||||
mesh_.lookupObject<VolFieldType>(fieldName)
|
||||
mesh_.lookupObject<VolField<Type>>(fieldName)
|
||||
);
|
||||
}
|
||||
else if (mesh_.foundObject<SurfaceFieldType>(fieldName))
|
||||
else if (mesh_.foundObject<SurfaceField<Type>>(fieldName))
|
||||
{
|
||||
DebugInfo << type() << ": Field " << fieldName << endl;
|
||||
|
||||
transformField<SurfaceFieldType>
|
||||
transformField<SurfaceField<Type>>
|
||||
(
|
||||
mesh_.lookupObject<SurfaceFieldType>(fieldName)
|
||||
mesh_.lookupObject<SurfaceField<Type>>(fieldName)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2021 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -84,9 +84,6 @@ void Foam::functionObjects::fieldValues::fieldValueDelta::processFields
|
||||
bool& found
|
||||
)
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> vf;
|
||||
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sf;
|
||||
|
||||
const wordList fields1 = region1Ptr_->fields();
|
||||
|
||||
const dictionary& results1 = region1Ptr_->resultDict();
|
||||
@ -101,7 +98,10 @@ void Foam::functionObjects::fieldValues::fieldValueDelta::processFields
|
||||
|
||||
if
|
||||
(
|
||||
(obr_.foundObject<vf>(fieldName) || obr_.foundObject<sf>(fieldName))
|
||||
(
|
||||
obr_.foundObject<VolField<Type>>(fieldName)
|
||||
|| obr_.foundObject<SurfaceField<Type>>(fieldName)
|
||||
)
|
||||
&& results2.found(fieldName)
|
||||
)
|
||||
{
|
||||
|
||||
@ -474,14 +474,14 @@ public:
|
||||
template<class Type>
|
||||
tmp<Field<Type>> filterField
|
||||
(
|
||||
const GeometricField<Type, fvsPatchField, surfaceMesh>& field
|
||||
const SurfaceField<Type>& field
|
||||
) const;
|
||||
|
||||
//- Filter a volume field according to faceIds
|
||||
template<class Type>
|
||||
tmp<Field<Type>> filterField
|
||||
(
|
||||
const GeometricField<Type, fvPatchField, volMesh>& field
|
||||
const VolField<Type>& field
|
||||
) const;
|
||||
|
||||
//- Read from dictionary
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -38,18 +38,15 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::validField
|
||||
const word& fieldName
|
||||
) const
|
||||
{
|
||||
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sf;
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> vf;
|
||||
|
||||
if
|
||||
(
|
||||
regionType_ != regionTypes::sampledSurface
|
||||
&& obr_.foundObject<sf>(fieldName)
|
||||
&& obr_.foundObject<SurfaceField<Type>>(fieldName)
|
||||
)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (obr_.foundObject<vf>(fieldName))
|
||||
else if (obr_.foundObject<VolField<Type>>(fieldName))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -65,14 +62,12 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::getFieldValues
|
||||
const word& fieldName
|
||||
) const
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> vf;
|
||||
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sf;
|
||||
|
||||
if (regionType_ == regionTypes::sampledSurface)
|
||||
{
|
||||
if (obr_.foundObject<vf>(fieldName))
|
||||
if (obr_.foundObject<VolField<Type>>(fieldName))
|
||||
{
|
||||
const vf& fld = obr_.lookupObject<vf>(fieldName);
|
||||
const VolField<Type>& fld =
|
||||
obr_.lookupObject<VolField<Type>>(fieldName);
|
||||
|
||||
if (surfacePtr_().interpolate())
|
||||
{
|
||||
@ -102,7 +97,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::getFieldValues
|
||||
return surfacePtr_().sample(fld);
|
||||
}
|
||||
}
|
||||
else if (obr_.foundObject<sf>(fieldName))
|
||||
else if (obr_.foundObject<SurfaceField<Type>>(fieldName))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Surface field " << fieldName
|
||||
@ -113,14 +108,16 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::getFieldValues
|
||||
}
|
||||
else
|
||||
{
|
||||
if (obr_.foundObject<vf>(fieldName))
|
||||
if (obr_.foundObject<VolField<Type>>(fieldName))
|
||||
{
|
||||
const vf& fld = obr_.lookupObject<vf>(fieldName);
|
||||
const VolField<Type>& fld =
|
||||
obr_.lookupObject<VolField<Type>>(fieldName);
|
||||
return filterField(fld);
|
||||
}
|
||||
else if (obr_.foundObject<sf>(fieldName))
|
||||
else if (obr_.foundObject<SurfaceField<Type>>(fieldName))
|
||||
{
|
||||
const sf& fld = obr_.lookupObject<sf>(fieldName);
|
||||
const SurfaceField<Type>& fld =
|
||||
obr_.lookupObject<SurfaceField<Type>>(fieldName);
|
||||
return filterField(fld);
|
||||
}
|
||||
}
|
||||
@ -408,7 +405,7 @@ template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>>
|
||||
Foam::functionObjects::fieldValues::surfaceFieldValue::filterField
|
||||
(
|
||||
const GeometricField<Type, fvPatchField, volMesh>& field
|
||||
const VolField<Type>& field
|
||||
) const
|
||||
{
|
||||
tmp<Field<Type>> tvalues(new Field<Type>(faceId_.size()));
|
||||
@ -442,7 +439,7 @@ template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>>
|
||||
Foam::functionObjects::fieldValues::surfaceFieldValue::filterField
|
||||
(
|
||||
const GeometricField<Type, fvsPatchField, surfaceMesh>& field
|
||||
const SurfaceField<Type>& field
|
||||
) const
|
||||
{
|
||||
tmp<Field<Type>> tvalues(new Field<Type>(faceId_.size()));
|
||||
|
||||
@ -34,9 +34,7 @@ bool Foam::functionObjects::fieldValues::volFieldValue::validField
|
||||
const word& fieldName
|
||||
) const
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> vf;
|
||||
|
||||
if (obr_.foundObject<vf>(fieldName))
|
||||
if (obr_.foundObject<VolField<Type>>(fieldName))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -52,11 +50,9 @@ Foam::functionObjects::fieldValues::volFieldValue::getFieldValues
|
||||
const word& fieldName
|
||||
) const
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> vf;
|
||||
|
||||
if (obr_.foundObject<vf>(fieldName))
|
||||
if (obr_.foundObject<VolField<Type>>(fieldName))
|
||||
{
|
||||
return filterField(obr_.lookupObject<vf>(fieldName));
|
||||
return filterField(obr_.lookupObject<VolField<Type>>(fieldName));
|
||||
}
|
||||
|
||||
FatalErrorInFunction
|
||||
|
||||
@ -30,24 +30,21 @@ License
|
||||
template<class Type>
|
||||
bool Foam::functionObjects::grad::calcGrad()
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
||||
typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
|
||||
|
||||
if (foundObject<VolFieldType>(fieldName_))
|
||||
if (foundObject<VolField<Type>>(fieldName_))
|
||||
{
|
||||
return store
|
||||
(
|
||||
resultName_,
|
||||
fvc::grad(lookupObject<VolFieldType>(fieldName_)),
|
||||
fvc::grad(lookupObject<VolField<Type>>(fieldName_)),
|
||||
mesh_.changing() && mesh_.solution().cache(resultName_)
|
||||
);
|
||||
}
|
||||
else if (foundObject<SurfaceFieldType>(fieldName_))
|
||||
else if (foundObject<SurfaceField<Type>>(fieldName_))
|
||||
{
|
||||
return store
|
||||
(
|
||||
resultName_,
|
||||
fvc::grad(lookupObject<SurfaceFieldType>(fieldName_)),
|
||||
fvc::grad(lookupObject<SurfaceField<Type>>(fieldName_)),
|
||||
mesh_.changing() && mesh_.solution().cache(resultName_)
|
||||
);
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -31,23 +31,20 @@ License
|
||||
template<class Type>
|
||||
bool Foam::functionObjects::mag::calcMag()
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
||||
typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
|
||||
|
||||
if (foundObject<VolFieldType>(fieldName_))
|
||||
if (foundObject<VolField<Type>>(fieldName_))
|
||||
{
|
||||
return store
|
||||
(
|
||||
resultName_,
|
||||
Foam::mag(lookupObject<VolFieldType>(fieldName_))
|
||||
Foam::mag(lookupObject<VolField<Type>>(fieldName_))
|
||||
);
|
||||
}
|
||||
else if (foundObject<SurfaceFieldType>(fieldName_))
|
||||
else if (foundObject<SurfaceField<Type>>(fieldName_))
|
||||
{
|
||||
return store
|
||||
(
|
||||
resultName_,
|
||||
Foam::mag(lookupObject<SurfaceFieldType>(fieldName_))
|
||||
Foam::mag(lookupObject<SurfaceField<Type>>(fieldName_))
|
||||
);
|
||||
}
|
||||
else
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -31,23 +31,20 @@ License
|
||||
template<class Type>
|
||||
bool Foam::functionObjects::magSqr::calcMagSqr()
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
||||
typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
|
||||
|
||||
if (foundObject<VolFieldType>(fieldName_))
|
||||
if (foundObject<VolField<Type>>(fieldName_))
|
||||
{
|
||||
return store
|
||||
(
|
||||
resultName_,
|
||||
Foam::magSqr(lookupObject<VolFieldType>(fieldName_))
|
||||
Foam::magSqr(lookupObject<VolField<Type>>(fieldName_))
|
||||
);
|
||||
}
|
||||
else if (foundObject<SurfaceFieldType>(fieldName_))
|
||||
else if (foundObject<SurfaceField<Type>>(fieldName_))
|
||||
{
|
||||
return store
|
||||
(
|
||||
resultName_,
|
||||
Foam::magSqr(lookupObject<SurfaceFieldType>(fieldName_))
|
||||
Foam::magSqr(lookupObject<SurfaceField<Type>>(fieldName_))
|
||||
);
|
||||
}
|
||||
else
|
||||
|
||||
@ -147,7 +147,7 @@ protected:
|
||||
template<class Type>
|
||||
void createFields
|
||||
(
|
||||
PtrList<GeometricField<Type, fvPatchField, volMesh>>&
|
||||
PtrList<VolField<Type>>&
|
||||
) const;
|
||||
|
||||
//- Override boundary fields with sampled values
|
||||
@ -155,13 +155,13 @@ protected:
|
||||
void sampleBoundaryField
|
||||
(
|
||||
const interpolationCellPoint<Type>& interpolator,
|
||||
GeometricField<Type, fvPatchField, volMesh>& fld
|
||||
VolField<Type>& fld
|
||||
) const;
|
||||
|
||||
template<class Type>
|
||||
void sampleFields
|
||||
(
|
||||
PtrList<GeometricField<Type, fvPatchField, volMesh>>&
|
||||
PtrList<VolField<Type>>&
|
||||
) const;
|
||||
|
||||
|
||||
|
||||
@ -30,16 +30,14 @@ License
|
||||
template<class Type>
|
||||
void Foam::functionObjects::nearWallFields::createFields
|
||||
(
|
||||
PtrList<GeometricField<Type, fvPatchField, volMesh>>& sflds
|
||||
PtrList<VolField<Type>>& sflds
|
||||
) const
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
||||
HashTable<const VolField<Type>*> flds(obr_.lookupClass<VolField<Type>>());
|
||||
|
||||
HashTable<const VolFieldType*> flds(obr_.lookupClass<VolFieldType>());
|
||||
|
||||
forAllConstIter(typename HashTable<const VolFieldType*>, flds, iter)
|
||||
forAllConstIter(typename HashTable<const VolField<Type>*>, flds, iter)
|
||||
{
|
||||
const VolFieldType& fld = *iter();
|
||||
const VolField<Type>& fld = *iter();
|
||||
|
||||
if (fieldMap_.found(fld.name()))
|
||||
{
|
||||
@ -59,7 +57,7 @@ void Foam::functionObjects::nearWallFields::createFields
|
||||
sflds.set
|
||||
(
|
||||
sz,
|
||||
new VolFieldType
|
||||
new VolField<Type>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -84,7 +82,7 @@ template<class Type>
|
||||
void Foam::functionObjects::nearWallFields::sampleBoundaryField
|
||||
(
|
||||
const interpolationCellPoint<Type>& interpolator,
|
||||
GeometricField<Type, fvPatchField, volMesh>& fld
|
||||
VolField<Type>& fld
|
||||
) const
|
||||
{
|
||||
// Construct flat fields for all patch faces to be sampled
|
||||
@ -108,7 +106,7 @@ void Foam::functionObjects::nearWallFields::sampleBoundaryField
|
||||
sampledValues
|
||||
);
|
||||
|
||||
typename GeometricField<Type, fvPatchField, volMesh>::
|
||||
typename VolField<Type>::
|
||||
Boundary& fldBf = fld.boundaryFieldRef();
|
||||
|
||||
// Pick up data
|
||||
@ -133,15 +131,13 @@ void Foam::functionObjects::nearWallFields::sampleBoundaryField
|
||||
template<class Type>
|
||||
void Foam::functionObjects::nearWallFields::sampleFields
|
||||
(
|
||||
PtrList<GeometricField<Type, fvPatchField, volMesh>>& sflds
|
||||
PtrList<VolField<Type>>& sflds
|
||||
) const
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
||||
|
||||
forAll(sflds, i)
|
||||
{
|
||||
const word& fldName = reverseFieldMap_[sflds[i].name()];
|
||||
const VolFieldType& fld = obr_.lookupObject<VolFieldType>(fldName);
|
||||
const VolField<Type>& fld = obr_.lookupObject<VolField<Type>>(fldName);
|
||||
|
||||
// Take over internal and boundary values
|
||||
sflds[i] == fld;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -31,14 +31,12 @@ License
|
||||
template<class Type>
|
||||
bool Foam::functionObjects::randomise::calcRandomised()
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
||||
|
||||
if (foundObject<VolFieldType>(fieldName_))
|
||||
if (foundObject<VolField<Type>>(fieldName_))
|
||||
{
|
||||
const VolFieldType& field = lookupObject<VolFieldType>(fieldName_);
|
||||
const VolField<Type>& field = lookupObject<VolField<Type>>(fieldName_);
|
||||
|
||||
tmp<VolFieldType> rfieldt(new VolFieldType(field));
|
||||
VolFieldType& rfield = rfieldt.ref();
|
||||
tmp<VolField<Type>> rfieldt(new VolField<Type>(field));
|
||||
VolField<Type>& rfield = rfieldt.ref();
|
||||
|
||||
Random rand(1234567);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -107,8 +107,8 @@ protected:
|
||||
void loadField
|
||||
(
|
||||
const word&,
|
||||
PtrList<GeometricField<Type, fvPatchField, volMesh>>&,
|
||||
PtrList<GeometricField<Type, fvsPatchField, surfaceMesh>>&
|
||||
PtrList<VolField<Type>>&,
|
||||
PtrList<SurfaceField<Type>>&
|
||||
) const;
|
||||
|
||||
|
||||
|
||||
@ -34,20 +34,17 @@ template<class Type>
|
||||
void Foam::functionObjects::readFields::loadField
|
||||
(
|
||||
const word& fieldName,
|
||||
PtrList<GeometricField<Type, fvPatchField, volMesh>>& vflds,
|
||||
PtrList<GeometricField<Type, fvsPatchField, surfaceMesh>>& sflds
|
||||
PtrList<VolField<Type>>& vflds,
|
||||
PtrList<SurfaceField<Type>>& sflds
|
||||
) const
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
||||
typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
|
||||
|
||||
if (obr_.foundObject<VolFieldType>(fieldName))
|
||||
if (obr_.foundObject<VolField<Type>>(fieldName))
|
||||
{
|
||||
DebugInfo
|
||||
<< "readFields : Field " << fieldName << " already in database"
|
||||
<< endl;
|
||||
}
|
||||
else if (obr_.foundObject<SurfaceFieldType>(fieldName))
|
||||
else if (obr_.foundObject<SurfaceField<Type>>(fieldName))
|
||||
{
|
||||
DebugInfo
|
||||
<< "readFields : Field " << fieldName
|
||||
@ -67,7 +64,7 @@ void Foam::functionObjects::readFields::loadField
|
||||
if
|
||||
(
|
||||
fieldHeader.headerOk()
|
||||
&& fieldHeader.headerClassName() == VolFieldType::typeName
|
||||
&& fieldHeader.headerClassName() == VolField<Type>::typeName
|
||||
)
|
||||
{
|
||||
// Store field locally
|
||||
@ -75,12 +72,12 @@ void Foam::functionObjects::readFields::loadField
|
||||
|
||||
label sz = vflds.size();
|
||||
vflds.setSize(sz+1);
|
||||
vflds.set(sz, new VolFieldType(fieldHeader, mesh_));
|
||||
vflds.set(sz, new VolField<Type>(fieldHeader, mesh_));
|
||||
}
|
||||
else if
|
||||
(
|
||||
fieldHeader.headerOk()
|
||||
&& fieldHeader.headerClassName() == SurfaceFieldType::typeName
|
||||
&& fieldHeader.headerClassName() == SurfaceField<Type>::typeName
|
||||
)
|
||||
{
|
||||
// Store field locally
|
||||
@ -88,7 +85,7 @@ void Foam::functionObjects::readFields::loadField
|
||||
|
||||
label sz = sflds.size();
|
||||
sflds.setSize(sz+1);
|
||||
sflds.set(sz, new SurfaceFieldType(fieldHeader, mesh_));
|
||||
sflds.set(sz, new SurfaceField<Type>(fieldHeader, mesh_));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,14 +44,12 @@ namespace functionObjects
|
||||
template<class Type>
|
||||
bool Foam::functionObjects::reconstruct::calcReconstruction()
|
||||
{
|
||||
typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
|
||||
|
||||
if (foundObject<SurfaceFieldType>(fieldName_))
|
||||
if (foundObject<SurfaceField<Type>>(fieldName_))
|
||||
{
|
||||
return store
|
||||
(
|
||||
resultName_,
|
||||
fvc::reconstruct(lookupObject<SurfaceFieldType>(fieldName_)),
|
||||
fvc::reconstruct(lookupObject<SurfaceField<Type>>(fieldName_)),
|
||||
mesh_.changing() && mesh_.solution().cache(resultName_)
|
||||
);
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2022 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -31,23 +31,20 @@ License
|
||||
template<class Type>
|
||||
bool Foam::functionObjects::scale::calcScale()
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
||||
typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
|
||||
|
||||
if (foundObject<VolFieldType>(fieldName_))
|
||||
if (foundObject<VolField<Type>>(fieldName_))
|
||||
{
|
||||
return store
|
||||
(
|
||||
resultName_,
|
||||
scale_*lookupObject<VolFieldType>(fieldName_)
|
||||
scale_*lookupObject<VolField<Type>>(fieldName_)
|
||||
);
|
||||
}
|
||||
else if (foundObject<SurfaceFieldType>(fieldName_))
|
||||
else if (foundObject<SurfaceField<Type>>(fieldName_))
|
||||
{
|
||||
return store
|
||||
(
|
||||
resultName_,
|
||||
scale_*lookupObject<SurfaceFieldType>(fieldName_)
|
||||
scale_*lookupObject<SurfaceField<Type>>(fieldName_)
|
||||
);
|
||||
}
|
||||
else
|
||||
|
||||
@ -158,7 +158,7 @@ protected:
|
||||
void processField
|
||||
(
|
||||
const word& fieldName,
|
||||
const tmp<GeometricField<Type, fvPatchField, volMesh>>& tvalue
|
||||
const tmp<VolField<Type>>& tvalue
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -31,19 +31,17 @@ template<class Type>
|
||||
void Foam::functionObjects::turbulenceFields::processField
|
||||
(
|
||||
const word& fieldName,
|
||||
const tmp<GeometricField<Type, fvPatchField, volMesh>>& tvalue
|
||||
const tmp<VolField<Type>>& tvalue
|
||||
)
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> FieldType;
|
||||
|
||||
const word scopedName
|
||||
(
|
||||
IOobject::groupName(prefix_ + fieldName, phaseName_)
|
||||
);
|
||||
|
||||
if (obr_.foundObject<FieldType>(scopedName))
|
||||
if (obr_.foundObject<VolField<Type>>(scopedName))
|
||||
{
|
||||
obr_.lookupObjectRef<FieldType>(scopedName) == tvalue();
|
||||
obr_.lookupObjectRef<VolField<Type>>(scopedName) == tvalue();
|
||||
}
|
||||
else if (obr_.found(scopedName))
|
||||
{
|
||||
@ -56,7 +54,7 @@ void Foam::functionObjects::turbulenceFields::processField
|
||||
{
|
||||
obr_.store
|
||||
(
|
||||
new FieldType
|
||||
new VolField<Type>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2015-2022 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -33,9 +33,7 @@ License
|
||||
template<class Type>
|
||||
void Foam::functionObjects::residuals::writeFileHeader(const word& fieldName)
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
|
||||
|
||||
if (obr_.foundObject<fieldType>(fieldName))
|
||||
if (obr_.foundObject<VolField<Type>>(fieldName))
|
||||
{
|
||||
typename pTraits<Type>::labelType validComponents
|
||||
(
|
||||
@ -60,9 +58,7 @@ void Foam::functionObjects::residuals::writeFileHeader(const word& fieldName)
|
||||
template<class Type>
|
||||
void Foam::functionObjects::residuals::writeResidual(const word& fieldName)
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
|
||||
|
||||
if (obr_.foundObject<fieldType>(fieldName))
|
||||
if (obr_.foundObject<VolField<Type>>(fieldName))
|
||||
{
|
||||
if (Residuals<Type>::found(mesh_, fieldName))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user