mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: simplify objectRegistry access names (issue #322)
New name: findObject(), cfindObject()
Old name: lookupObjectPtr()
Return a const pointer or nullptr on failure.
New name: findObject()
Old name: --
Return a non-const pointer or nullptr on failure.
New name: getObjectPtr()
Old name: lookupObjectRefPtr()
Return a non-const pointer or nullptr on failure.
Can be called on a const object and it will perform a
const_cast.
- use these updated names and functionality in more places
NB: The older methods names are deprecated, but continue to be defined.
This commit is contained in:
@ -260,13 +260,7 @@ public:
|
|||||||
virtual volScalarField& he()
|
virtual volScalarField& he()
|
||||||
{
|
{
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
return
|
return const_cast<volScalarField&>(volScalarField::null());
|
||||||
(
|
|
||||||
const_cast<volScalarField&>
|
|
||||||
(
|
|
||||||
volScalarField::null()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return access to the inernal energy field [J/Kg]
|
//- Return access to the inernal energy field [J/Kg]
|
||||||
@ -274,10 +268,7 @@ public:
|
|||||||
virtual const volScalarField& he() const
|
virtual const volScalarField& he() const
|
||||||
{
|
{
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
return
|
return volScalarField::null();
|
||||||
(
|
|
||||||
volScalarField::null()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Enthalpy/Internal energy
|
//- Enthalpy/Internal energy
|
||||||
|
|||||||
@ -131,19 +131,15 @@ Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::heatTransfer() const
|
|||||||
dimensionedScalar(dimensionSet(1,-1,-3,0,0), Zero)
|
dimensionedScalar(dimensionSet(1,-1,-3,0,0), Zero)
|
||||||
);
|
);
|
||||||
|
|
||||||
if
|
const volScalarField* alphatPtr =
|
||||||
(
|
otherPhase.mesh().findObject<volScalarField>
|
||||||
otherPhase.mesh().foundObject<volScalarField>
|
|
||||||
(
|
(
|
||||||
"alphat." + otherPhase.name()
|
"alphat." + otherPhase.name()
|
||||||
)
|
);
|
||||||
)
|
|
||||||
|
if (alphatPtr)
|
||||||
{
|
{
|
||||||
const volScalarField& alphat =
|
const volScalarField& alphat = *alphatPtr;
|
||||||
otherPhase.mesh().lookupObject<volScalarField>
|
|
||||||
(
|
|
||||||
"alphat." + otherPhase.name()
|
|
||||||
);
|
|
||||||
|
|
||||||
const fvPatchList& patches = this->mesh().boundary();
|
const fvPatchList& patches = this->mesh().boundary();
|
||||||
forAll(patches, patchi)
|
forAll(patches, patchi)
|
||||||
@ -427,19 +423,15 @@ void Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::correctThermo()
|
|||||||
dimensionedScalar(dimDensity/dimTime, Zero)
|
dimensionedScalar(dimDensity/dimTime, Zero)
|
||||||
);
|
);
|
||||||
|
|
||||||
if
|
const volScalarField* alphatPtr =
|
||||||
(
|
phase2.mesh().findObject<volScalarField>
|
||||||
phase2.mesh().foundObject<volScalarField>
|
|
||||||
(
|
(
|
||||||
"alphat." + phase2.name()
|
"alphat." + phase2.name()
|
||||||
)
|
);
|
||||||
)
|
|
||||||
|
if (alphatPtr)
|
||||||
{
|
{
|
||||||
const volScalarField& alphat =
|
const volScalarField& alphat = *alphatPtr;
|
||||||
phase2.mesh().lookupObject<volScalarField>
|
|
||||||
(
|
|
||||||
"alphat." + phase2.name()
|
|
||||||
);
|
|
||||||
|
|
||||||
const fvPatchList& patches = this->mesh().boundary();
|
const fvPatchList& patches = this->mesh().boundary();
|
||||||
forAll(patches, patchi)
|
forAll(patches, patchi)
|
||||||
|
|||||||
@ -52,10 +52,8 @@ Foam::functionObjects::regionFunctionObject::whichSubRegistry
|
|||||||
{
|
{
|
||||||
return obr.lookupObject<objectRegistry>(subName);
|
return obr.lookupObject<objectRegistry>(subName);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return obr;
|
||||||
return obr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -71,22 +69,19 @@ bool Foam::functionObjects::regionFunctionObject::writeObject
|
|||||||
const word& fieldName
|
const word& fieldName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const regIOobject* objPtr =
|
const regIOobject* obj = this->findObject<regIOobject>(fieldName);
|
||||||
this->lookupObjectPtr<regIOobject>(fieldName);
|
|
||||||
|
|
||||||
if (objPtr)
|
if (obj)
|
||||||
{
|
{
|
||||||
Log << " functionObjects::" << type() << " " << name()
|
Log << " functionObjects::" << type() << " " << name()
|
||||||
<< " writing field: " << objPtr->name() << endl;
|
<< " writing field: " << obj->name() << endl;
|
||||||
|
|
||||||
objPtr->write();
|
obj->write();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -95,12 +90,14 @@ bool Foam::functionObjects::regionFunctionObject::clearObject
|
|||||||
const word& fieldName
|
const word& fieldName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
regIOobject* objPtr = lookupObjectRefPtr<regIOobject>(fieldName);
|
// Same as getObjectPtr, since the object is already non-const
|
||||||
if (objPtr)
|
regIOobject* obj = this->findObject<regIOobject>(fieldName);
|
||||||
|
|
||||||
|
if (obj)
|
||||||
{
|
{
|
||||||
if (objPtr->ownedByRegistry())
|
if (obj->ownedByRegistry())
|
||||||
{
|
{
|
||||||
return objPtr->checkOut();
|
return obj->checkOut();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -94,6 +94,35 @@ protected:
|
|||||||
template<class ObjectType>
|
template<class ObjectType>
|
||||||
bool foundObject(const word& fieldName) const;
|
bool foundObject(const word& fieldName) const;
|
||||||
|
|
||||||
|
//- Return const pointer to the object (eg, a field) in the
|
||||||
|
//- (sub) objectRegistry.
|
||||||
|
//
|
||||||
|
// \return nullptr if the object was not found or had incorrect type.
|
||||||
|
template<class ObjectType>
|
||||||
|
const ObjectType* cfindObject(const word& fieldName) const;
|
||||||
|
|
||||||
|
//- Return const pointer to the object (eg, a field) in the
|
||||||
|
//- (sub) objectRegistry.
|
||||||
|
//
|
||||||
|
// \return nullptr if the object was not found or had incorrect type.
|
||||||
|
template<class ObjectType>
|
||||||
|
const ObjectType* findObject(const word& fieldName) const;
|
||||||
|
|
||||||
|
//- Return non-const pointer to the object of the given Type,
|
||||||
|
//- (sub) objectRegistry.
|
||||||
|
//
|
||||||
|
// \return nullptr if the object was not found or had incorrect type.
|
||||||
|
template<class ObjectType>
|
||||||
|
ObjectType* findObject(const word& fieldName);
|
||||||
|
|
||||||
|
//- Return non-const pointer to the object of the given Type,
|
||||||
|
//- using a const-cast to have it behave like a mutable.
|
||||||
|
// Exercise caution when using.
|
||||||
|
//
|
||||||
|
// \return nullptr if the object was not found or had incorrect type.
|
||||||
|
template<class ObjectType>
|
||||||
|
ObjectType* getObjectPtr(const word& fieldName) const;
|
||||||
|
|
||||||
//- Lookup and return object (eg, a field) from the (sub) objectRegistry
|
//- Lookup and return object (eg, a field) from the (sub) objectRegistry
|
||||||
template<class ObjectType>
|
template<class ObjectType>
|
||||||
const ObjectType& lookupObject(const word& fieldName) const;
|
const ObjectType& lookupObject(const word& fieldName) const;
|
||||||
@ -102,18 +131,6 @@ protected:
|
|||||||
template<class ObjectType>
|
template<class ObjectType>
|
||||||
ObjectType& lookupObjectRef(const word& fieldName) const;
|
ObjectType& lookupObjectRef(const word& fieldName) const;
|
||||||
|
|
||||||
//- Lookup and return pointer to the object,
|
|
||||||
// otherwise nullptr if the object was not found,
|
|
||||||
// or had the incorrect type.
|
|
||||||
template<class ObjectType>
|
|
||||||
const ObjectType* lookupObjectPtr(const word& fieldName) const;
|
|
||||||
|
|
||||||
//- Lookup and return non-const pointer to the object,
|
|
||||||
// otherwise nullptr if the object was not found,
|
|
||||||
// or had the incorrect type.
|
|
||||||
template<class ObjectType>
|
|
||||||
ObjectType* lookupObjectRefPtr(const word& fieldName) const;
|
|
||||||
|
|
||||||
//- Store the field in the (sub) objectRegistry under the given name
|
//- Store the field in the (sub) objectRegistry under the given name
|
||||||
// Note: sets the fieldName to tfield().name() if not already set
|
// Note: sets the fieldName to tfield().name() if not already set
|
||||||
template<class ObjectType>
|
template<class ObjectType>
|
||||||
@ -177,6 +194,25 @@ public:
|
|||||||
|
|
||||||
//- Read optional controls
|
//- Read optional controls
|
||||||
virtual bool read(const dictionary& dict);
|
virtual bool read(const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
|
// Housekeeping
|
||||||
|
|
||||||
|
//- Same as findObject
|
||||||
|
// \deprecated use findObject (OCT-2018)
|
||||||
|
template<class ObjectType>
|
||||||
|
const ObjectType* lookupObjectPtr(const word& fieldName) const
|
||||||
|
{
|
||||||
|
return this->cfindObject<ObjectType>(fieldName);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Same as getObjectPtr
|
||||||
|
// \deprecated use getObjectPtr (OCT-2018)
|
||||||
|
template<class ObjectType>
|
||||||
|
ObjectType* lookupObjectRefPtr(const word& fieldName) const
|
||||||
|
{
|
||||||
|
return this->getObjectPtr<ObjectType>(fieldName);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -38,6 +38,47 @@ bool Foam::functionObjects::regionFunctionObject::foundObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ObjectType>
|
||||||
|
const ObjectType* Foam::functionObjects::regionFunctionObject::cfindObject
|
||||||
|
(
|
||||||
|
const word& fieldName
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return obr().cfindObject<ObjectType>(fieldName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ObjectType>
|
||||||
|
const ObjectType* Foam::functionObjects::regionFunctionObject::findObject
|
||||||
|
(
|
||||||
|
const word& fieldName
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return obr().findObject<ObjectType>(fieldName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ObjectType>
|
||||||
|
ObjectType* Foam::functionObjects::regionFunctionObject::findObject
|
||||||
|
(
|
||||||
|
const word& fieldName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Need getObjectPtr to bypass const access on the objectRegistry
|
||||||
|
return obr().getObjectPtr<ObjectType>(fieldName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ObjectType>
|
||||||
|
ObjectType* Foam::functionObjects::regionFunctionObject::getObjectPtr
|
||||||
|
(
|
||||||
|
const word& fieldName
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return obr().getObjectPtr<ObjectType>(fieldName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ObjectType>
|
template<class ObjectType>
|
||||||
const ObjectType& Foam::functionObjects::regionFunctionObject::lookupObject
|
const ObjectType& Foam::functionObjects::regionFunctionObject::lookupObject
|
||||||
(
|
(
|
||||||
@ -58,26 +99,6 @@ ObjectType& Foam::functionObjects::regionFunctionObject::lookupObjectRef
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ObjectType>
|
|
||||||
const ObjectType* Foam::functionObjects::regionFunctionObject::lookupObjectPtr
|
|
||||||
(
|
|
||||||
const word& fieldName
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return obr().lookupObjectPtr<ObjectType>(fieldName);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class ObjectType>
|
|
||||||
ObjectType* Foam::functionObjects::regionFunctionObject::lookupObjectRefPtr
|
|
||||||
(
|
|
||||||
const word& fieldName
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return obr().lookupObjectRefPtr<ObjectType>(fieldName);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class ObjectType>
|
template<class ObjectType>
|
||||||
bool Foam::functionObjects::regionFunctionObject::store
|
bool Foam::functionObjects::regionFunctionObject::store
|
||||||
(
|
(
|
||||||
|
|||||||
@ -231,8 +231,9 @@ public:
|
|||||||
// Lookup
|
// Lookup
|
||||||
|
|
||||||
//- Lookup and return a const sub-objectRegistry.
|
//- Lookup and return a const sub-objectRegistry.
|
||||||
// Optionally create it if it does not exist.
|
//
|
||||||
// If recursive, search parent registries.
|
// \param forceCreate create it if it does not exist.
|
||||||
|
// \param recursive search parent registries.
|
||||||
const objectRegistry& subRegistry
|
const objectRegistry& subRegistry
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
@ -250,7 +251,8 @@ public:
|
|||||||
HashTable<Type*> lookupClass(const bool strict = false);
|
HashTable<Type*> lookupClass(const bool strict = false);
|
||||||
|
|
||||||
//- Is the named Type found?
|
//- Is the named Type found?
|
||||||
// If recursive, search parent registries.
|
//
|
||||||
|
// \param recursive search parent registries
|
||||||
template<class Type>
|
template<class Type>
|
||||||
bool foundObject
|
bool foundObject
|
||||||
(
|
(
|
||||||
@ -258,8 +260,60 @@ public:
|
|||||||
const bool recursive = false
|
const bool recursive = false
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Lookup and return the object of the given Type.
|
//- Find const pointer to the object of the given Type.
|
||||||
// If recursive, search parent registries.
|
//
|
||||||
|
// \param recursive search parent registries
|
||||||
|
//
|
||||||
|
// \return nullptr if the object was not found or had incorrect type.
|
||||||
|
template<class Type>
|
||||||
|
const Type* cfindObject
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const bool recursive = false
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Return const pointer to the object of the given Type.
|
||||||
|
//
|
||||||
|
// \param recursive search parent registries
|
||||||
|
//
|
||||||
|
// \return nullptr if the object was not found or had incorrect type.
|
||||||
|
template<class Type>
|
||||||
|
const Type* findObject
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const bool recursive = false
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Return non-const pointer to the object of the given Type.
|
||||||
|
//
|
||||||
|
// \param recursive search parent registries
|
||||||
|
//
|
||||||
|
// \return nullptr if the object was not found or had incorrect type.
|
||||||
|
template<class Type>
|
||||||
|
Type* findObject
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const bool recursive = false
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Return non-const pointer to the object of the given Type,
|
||||||
|
//- using a const-cast to have it behave like a mutable.
|
||||||
|
// Exercise caution when using.
|
||||||
|
//
|
||||||
|
// \param recursive search parent registries.
|
||||||
|
//
|
||||||
|
// \return nullptr if the object was not found or had incorrect type.
|
||||||
|
template<class Type>
|
||||||
|
Type* getObjectPtr
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const bool recursive = false
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Lookup and return const reference to the object
|
||||||
|
//- of the given Type. Fatal if not found or the wrong type.
|
||||||
|
//
|
||||||
|
// \param recursive search parent registries.
|
||||||
template<class Type>
|
template<class Type>
|
||||||
const Type& lookupObject
|
const Type& lookupObject
|
||||||
(
|
(
|
||||||
@ -267,8 +321,10 @@ public:
|
|||||||
const bool recursive = false
|
const bool recursive = false
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Lookup and return the object of the given Type.
|
//- Lookup and return non-const reference to the object
|
||||||
// If recursive, search parent registries.
|
//- of the given Type. Fatal if not found or the wrong type.
|
||||||
|
//
|
||||||
|
// \param recursive search parent registries.
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Type& lookupObjectRef
|
Type& lookupObjectRef
|
||||||
(
|
(
|
||||||
@ -276,30 +332,6 @@ public:
|
|||||||
const bool recursive = false
|
const bool recursive = false
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Lookup and return pointer to the object of the given Type,
|
|
||||||
// otherwise nullptr if the object was not found,
|
|
||||||
// or had the incorrect type.
|
|
||||||
// If recursive, search parent registries.
|
|
||||||
template<class Type>
|
|
||||||
const Type* lookupObjectPtr
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const bool recursive = false
|
|
||||||
) const;
|
|
||||||
|
|
||||||
|
|
||||||
//- Lookup and return non-const pointer to the object
|
|
||||||
// of the given Type,
|
|
||||||
// otherwise nullptr if the object was not found,
|
|
||||||
// or had the incorrect type.
|
|
||||||
// If recursive, search parent registries.
|
|
||||||
template<class Type>
|
|
||||||
Type* lookupObjectRefPtr
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const bool recursive = false
|
|
||||||
) const;
|
|
||||||
|
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
|
|
||||||
@ -349,6 +381,34 @@ public:
|
|||||||
IOstream::compressionType cmp,
|
IOstream::compressionType cmp,
|
||||||
const bool valid
|
const bool valid
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
// Housekeeping
|
||||||
|
|
||||||
|
//- Same as findObject
|
||||||
|
// \deprecated use findObject (OCT-2018)
|
||||||
|
template<class Type>
|
||||||
|
const Type* lookupObjectPtr
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
bool recursive = false
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return this->cfindObject<Type>(name, recursive);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Same as getObjectPtr
|
||||||
|
//
|
||||||
|
// \deprecated use getObjectPtr (OCT-2018)
|
||||||
|
template<class Type>
|
||||||
|
Type* lookupObjectRefPtr
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
bool recursive = false
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return this->getObjectPtr<Type>(name, recursive);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -156,7 +156,7 @@ Foam::HashTable<const Type*> Foam::objectRegistry::lookupClass
|
|||||||
|
|
||||||
forAllConstIters(*this, iter)
|
forAllConstIters(*this, iter)
|
||||||
{
|
{
|
||||||
if (strict ? isType<Type>(*iter()) : isA<Type>(*iter()))
|
if (strict ? isType<Type>(*iter()) : bool(isA<Type>(*iter())))
|
||||||
{
|
{
|
||||||
objectsOfClass.insert
|
objectsOfClass.insert
|
||||||
(
|
(
|
||||||
@ -180,7 +180,7 @@ Foam::HashTable<Type*> Foam::objectRegistry::lookupClass
|
|||||||
|
|
||||||
forAllIters(*this, iter)
|
forAllIters(*this, iter)
|
||||||
{
|
{
|
||||||
if (strict ? isType<Type>(*iter()) : isA<Type>(*iter()))
|
if (strict ? isType<Type>(*iter()) : bool(isA<Type>(*iter())))
|
||||||
{
|
{
|
||||||
objectsOfClass.insert
|
objectsOfClass.insert
|
||||||
(
|
(
|
||||||
@ -201,14 +201,71 @@ bool Foam::objectRegistry::foundObject
|
|||||||
const bool recursive
|
const bool recursive
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const Type* ptr = this->lookupObjectPtr<Type>(name, recursive);
|
return this->cfindObject<Type>(name, recursive);
|
||||||
|
}
|
||||||
|
|
||||||
if (ptr)
|
|
||||||
|
template<class Type>
|
||||||
|
const Type* Foam::objectRegistry::cfindObject
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const bool recursive
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const_iterator iter = cfind(name);
|
||||||
|
|
||||||
|
if (iter.found())
|
||||||
{
|
{
|
||||||
return true;
|
const Type* ptr = dynamic_cast<const Type*>(iter());
|
||||||
|
|
||||||
|
if (ptr)
|
||||||
|
{
|
||||||
|
return ptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (recursive && this->parentNotTime())
|
||||||
|
{
|
||||||
|
return parent_.cfindObject<Type>(name, recursive);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
const Type* Foam::objectRegistry::findObject
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const bool recursive
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return this->cfindObject<Type>(name, recursive);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Type* Foam::objectRegistry::findObject
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const bool recursive
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const Type* ptr = this->cfindObject<Type>(name, recursive);
|
||||||
|
|
||||||
|
return const_cast<Type*>(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Type* Foam::objectRegistry::getObjectPtr
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const bool recursive
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const Type* ptr = this->cfindObject<Type>(name, recursive);
|
||||||
|
|
||||||
|
return const_cast<Type*>(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -219,7 +276,7 @@ const Type& Foam::objectRegistry::lookupObject
|
|||||||
const bool recursive
|
const bool recursive
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const_iterator iter = find(name);
|
const_iterator iter = cfind(name);
|
||||||
|
|
||||||
if (iter.found())
|
if (iter.found())
|
||||||
{
|
{
|
||||||
@ -270,44 +327,4 @@ Type& Foam::objectRegistry::lookupObjectRef
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
const Type* Foam::objectRegistry::lookupObjectPtr
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const bool recursive
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
const_iterator iter = find(name);
|
|
||||||
|
|
||||||
if (iter.found())
|
|
||||||
{
|
|
||||||
const Type* ptr = dynamic_cast<const Type*>(iter());
|
|
||||||
|
|
||||||
if (ptr)
|
|
||||||
{
|
|
||||||
return ptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (recursive && this->parentNotTime())
|
|
||||||
{
|
|
||||||
return parent_.lookupObjectPtr<Type>(name, recursive);
|
|
||||||
}
|
|
||||||
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Type* Foam::objectRegistry::lookupObjectRefPtr
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const bool recursive
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
const Type* ptr = this->lookupObjectPtr<Type>(name, recursive);
|
|
||||||
|
|
||||||
return const_cast<Type*>(ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -338,12 +338,12 @@ void Foam::lduMatrix::setResidualField
|
|||||||
}
|
}
|
||||||
|
|
||||||
IOField<scalar>* residualPtr =
|
IOField<scalar>* residualPtr =
|
||||||
lduMesh_.thisDb().lookupObjectRefPtr<IOField<scalar>>(lookupName);
|
lduMesh_.thisDb().getObjectPtr<IOField<scalar>>(lookupName);
|
||||||
|
|
||||||
if (residualPtr)
|
if (residualPtr)
|
||||||
{
|
{
|
||||||
const IOdictionary* dataPtr =
|
const IOdictionary* dataPtr =
|
||||||
lduMesh_.thisDb().lookupObjectPtr<IOdictionary>("data");
|
lduMesh_.thisDb().findObject<IOdictionary>("data");
|
||||||
|
|
||||||
if (dataPtr)
|
if (dataPtr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -165,7 +165,7 @@ void Foam::outletMachNumberPressureFvPatchScalarField::updateCoeffs()
|
|||||||
}
|
}
|
||||||
|
|
||||||
const fluidThermo* thermoPtr =
|
const fluidThermo* thermoPtr =
|
||||||
db().lookupObjectPtr<fluidThermo>(basicThermo::dictName);
|
db().findObject<fluidThermo>(basicThermo::dictName);
|
||||||
|
|
||||||
const volVectorField& U = db().lookupObject<volVectorField>(UName_);
|
const volVectorField& U = db().lookupObject<volVectorField>(UName_);
|
||||||
|
|
||||||
|
|||||||
@ -240,7 +240,7 @@ void turbulentTemperatureRadCoupledMixedFvPatchScalarField::updateCoeffs()
|
|||||||
|
|
||||||
{
|
{
|
||||||
const basicThermo* thermo =
|
const basicThermo* thermo =
|
||||||
nbrMesh.lookupObjectPtr<basicThermo>(basicThermo::dictName);
|
nbrMesh.findObject<basicThermo>(basicThermo::dictName);
|
||||||
|
|
||||||
if (thermo)
|
if (thermo)
|
||||||
{
|
{
|
||||||
@ -269,7 +269,7 @@ void turbulentTemperatureRadCoupledMixedFvPatchScalarField::updateCoeffs()
|
|||||||
// Local inertia therm
|
// Local inertia therm
|
||||||
{
|
{
|
||||||
const basicThermo* thermo =
|
const basicThermo* thermo =
|
||||||
mesh.lookupObjectPtr<basicThermo>(basicThermo::dictName);
|
mesh.findObject<basicThermo>(basicThermo::dictName);
|
||||||
|
|
||||||
if (thermo)
|
if (thermo)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -448,11 +448,7 @@ void Foam::epsilonWallFunctionFvPatchScalarField::updateCoeffs()
|
|||||||
|
|
||||||
typedef DimensionedField<scalar, volMesh> FieldType;
|
typedef DimensionedField<scalar, volMesh> FieldType;
|
||||||
|
|
||||||
FieldType& G =
|
FieldType& G = db().lookupObjectRef<FieldType>(turbModel.GName());
|
||||||
const_cast<FieldType&>
|
|
||||||
(
|
|
||||||
db().lookupObject<FieldType>(turbModel.GName())
|
|
||||||
);
|
|
||||||
|
|
||||||
FieldType& epsilon = const_cast<FieldType&>(internalField());
|
FieldType& epsilon = const_cast<FieldType&>(internalField());
|
||||||
|
|
||||||
|
|||||||
@ -117,9 +117,7 @@ bool Foam::dynamicInkJetFvMesh::update()
|
|||||||
|
|
||||||
fvMesh::movePoints(newPoints);
|
fvMesh::movePoints(newPoints);
|
||||||
|
|
||||||
volVectorField& U =
|
lookupObjectRef<volVectorField>("U").correctBoundaryConditions();
|
||||||
const_cast<volVectorField&>(lookupObject<volVectorField>("U"));
|
|
||||||
U.correctBoundaryConditions();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -91,10 +91,11 @@ bool Foam::dynamicMotionSolverListFvMesh::update()
|
|||||||
|
|
||||||
fvMesh::movePoints(points() + disp);
|
fvMesh::movePoints(points() + disp);
|
||||||
|
|
||||||
if (foundObject<volVectorField>("U"))
|
volVectorField* Uptr = getObjectPtr<volVectorField>("U");
|
||||||
|
|
||||||
|
if (Uptr)
|
||||||
{
|
{
|
||||||
const_cast<volVectorField&>(lookupObject<volVectorField>("U"))
|
Uptr->correctBoundaryConditions();
|
||||||
.correctBoundaryConditions();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -182,8 +182,7 @@ bool Foam::dynamicMultiMotionSolverFvMesh::update()
|
|||||||
|
|
||||||
if (foundObject<volVectorField>("U"))
|
if (foundObject<volVectorField>("U"))
|
||||||
{
|
{
|
||||||
const_cast<volVectorField&>(lookupObject<volVectorField>("U"))
|
lookupObjectRef<volVectorField>("U").correctBoundaryConditions();
|
||||||
.correctBoundaryConditions();
|
|
||||||
}
|
}
|
||||||
else if (!hasWarned)
|
else if (!hasWarned)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -91,8 +91,7 @@ void Foam::fvMotionSolverEngineMesh::move()
|
|||||||
if (engineDB_.foundObject<surfaceScalarField>("phi"))
|
if (engineDB_.foundObject<surfaceScalarField>("phi"))
|
||||||
{
|
{
|
||||||
surfaceScalarField& phi =
|
surfaceScalarField& phi =
|
||||||
const_cast<surfaceScalarField&>
|
engineDB_.lookupObjectRef<surfaceScalarField>("phi");
|
||||||
(engineDB_.lookupObject<surfaceScalarField>("phi"));
|
|
||||||
|
|
||||||
const volScalarField& rho =
|
const volScalarField& rho =
|
||||||
engineDB_.lookupObject<volScalarField>("rho");
|
engineDB_.lookupObject<volScalarField>("rho");
|
||||||
|
|||||||
@ -86,8 +86,7 @@ void Foam::layeredEngineMesh::move()
|
|||||||
if (engineDB_.foundObject<surfaceScalarField>("phi"))
|
if (engineDB_.foundObject<surfaceScalarField>("phi"))
|
||||||
{
|
{
|
||||||
surfaceScalarField& phi =
|
surfaceScalarField& phi =
|
||||||
const_cast<surfaceScalarField&>
|
engineDB_.lookupObjectRef<surfaceScalarField>("phi");
|
||||||
(engineDB_.lookupObject<surfaceScalarField>("phi"));
|
|
||||||
|
|
||||||
const volScalarField& rho =
|
const volScalarField& rho =
|
||||||
engineDB_.lookupObject<volScalarField>("rho");
|
engineDB_.lookupObject<volScalarField>("rho");
|
||||||
|
|||||||
@ -37,27 +37,19 @@ License
|
|||||||
const Foam::surfaceScalarField&
|
const Foam::surfaceScalarField&
|
||||||
Foam::pressurePIDControlInletVelocityFvPatchVectorField::facePressure() const
|
Foam::pressurePIDControlInletVelocityFvPatchVectorField::facePressure() const
|
||||||
{
|
{
|
||||||
const volScalarField& p(db().lookupObject<volScalarField>(pName_));
|
|
||||||
|
|
||||||
const word pfName(pName_ + "f");
|
const word pfName(pName_ + "f");
|
||||||
|
|
||||||
if (!db().foundObject<surfaceScalarField>(pfName))
|
const volScalarField& p = db().lookupObject<volScalarField>(pName_);
|
||||||
{
|
|
||||||
surfaceScalarField* pfPtr
|
|
||||||
(
|
|
||||||
new surfaceScalarField(pfName, linearInterpolate(p))
|
|
||||||
);
|
|
||||||
|
|
||||||
|
surfaceScalarField* pfPtr = db().getObjectPtr<surfaceScalarField>(pfName);
|
||||||
|
|
||||||
|
if (!pfPtr)
|
||||||
|
{
|
||||||
|
pfPtr = new surfaceScalarField(pfName, linearInterpolate(p));
|
||||||
pfPtr->store();
|
pfPtr->store();
|
||||||
}
|
}
|
||||||
|
|
||||||
surfaceScalarField& pf
|
surfaceScalarField& pf = *pfPtr;
|
||||||
(
|
|
||||||
const_cast<surfaceScalarField&>
|
|
||||||
(
|
|
||||||
db().lookupObject<surfaceScalarField>(pfName)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!pf.upToDate(p))
|
if (!pf.upToDate(p))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -144,11 +144,7 @@ void Foam::waveSurfacePressureFvPatchScalarField::updateCoeffs()
|
|||||||
const scalar dt = db().time().deltaTValue();
|
const scalar dt = db().time().deltaTValue();
|
||||||
|
|
||||||
// retrieve non-const access to zeta field from the database
|
// retrieve non-const access to zeta field from the database
|
||||||
volVectorField& zeta =
|
volVectorField& zeta = db().lookupObjectRef<volVectorField>(zetaName_);
|
||||||
const_cast<volVectorField&>
|
|
||||||
(
|
|
||||||
db().lookupObject<volVectorField>(zetaName_)
|
|
||||||
);
|
|
||||||
vectorField& zetap = zeta.boundaryFieldRef()[patchi];
|
vectorField& zetap = zeta.boundaryFieldRef()[patchi];
|
||||||
|
|
||||||
// lookup d/dt scheme from database for zeta
|
// lookup d/dt scheme from database for zeta
|
||||||
|
|||||||
@ -171,10 +171,7 @@ CrankNicolsonDdtScheme<Type>::ddt0_
|
|||||||
|
|
||||||
DDt0Field<GeoField>& ddt0 = static_cast<DDt0Field<GeoField>&>
|
DDt0Field<GeoField>& ddt0 = static_cast<DDt0Field<GeoField>&>
|
||||||
(
|
(
|
||||||
const_cast<GeoField&>
|
mesh().objectRegistry::template lookupObjectRef<GeoField>(name)
|
||||||
(
|
|
||||||
mesh().objectRegistry::template lookupObject<GeoField>(name)
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return ddt0;
|
return ddt0;
|
||||||
|
|||||||
@ -103,10 +103,11 @@ Foam::fv::gradScheme<Type>::grad
|
|||||||
}
|
}
|
||||||
|
|
||||||
solution::cachePrintMessage("Retrieving", name, vsf);
|
solution::cachePrintMessage("Retrieving", name, vsf);
|
||||||
GradFieldType& gGrad = const_cast<GradFieldType&>
|
GradFieldType& gGrad =
|
||||||
(
|
mesh().objectRegistry::template lookupObjectRef<GradFieldType>
|
||||||
mesh().objectRegistry::template lookupObject<GradFieldType>(name)
|
(
|
||||||
);
|
name
|
||||||
|
);
|
||||||
|
|
||||||
if (gGrad.upToDate(vsf))
|
if (gGrad.upToDate(vsf))
|
||||||
{
|
{
|
||||||
@ -123,13 +124,11 @@ Foam::fv::gradScheme<Type>::grad
|
|||||||
|
|
||||||
solution::cachePrintMessage("Storing", name, vsf);
|
solution::cachePrintMessage("Storing", name, vsf);
|
||||||
regIOobject::store(tgGrad.ptr());
|
regIOobject::store(tgGrad.ptr());
|
||||||
GradFieldType& gGrad = const_cast<GradFieldType&>
|
GradFieldType& gGrad =
|
||||||
(
|
mesh().objectRegistry::template lookupObjectRef<GradFieldType>
|
||||||
mesh().objectRegistry::template lookupObject<GradFieldType>
|
|
||||||
(
|
(
|
||||||
name
|
name
|
||||||
)
|
);
|
||||||
);
|
|
||||||
|
|
||||||
return gGrad;
|
return gGrad;
|
||||||
}
|
}
|
||||||
@ -138,13 +137,11 @@ Foam::fv::gradScheme<Type>::grad
|
|||||||
{
|
{
|
||||||
if (mesh().objectRegistry::template foundObject<GradFieldType>(name))
|
if (mesh().objectRegistry::template foundObject<GradFieldType>(name))
|
||||||
{
|
{
|
||||||
GradFieldType& gGrad = const_cast<GradFieldType&>
|
GradFieldType& gGrad =
|
||||||
(
|
mesh().objectRegistry::template lookupObjectRef<GradFieldType>
|
||||||
mesh().objectRegistry::template lookupObject<GradFieldType>
|
|
||||||
(
|
(
|
||||||
name
|
name
|
||||||
)
|
);
|
||||||
);
|
|
||||||
|
|
||||||
if (gGrad.ownedByRegistry())
|
if (gGrad.ownedByRegistry())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -171,13 +171,7 @@ Foam::LimitedScheme<Type, Limiter, LimitFunc>::limiter
|
|||||||
}
|
}
|
||||||
|
|
||||||
surfaceScalarField& limiterField =
|
surfaceScalarField& limiterField =
|
||||||
const_cast<surfaceScalarField&>
|
mesh.lookupObjectRef<surfaceScalarField>(limiterFieldName);
|
||||||
(
|
|
||||||
mesh.lookupObject<surfaceScalarField>
|
|
||||||
(
|
|
||||||
limiterFieldName
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
calcLimiter(phi, limiterField);
|
calcLimiter(phi, limiterField);
|
||||||
|
|
||||||
|
|||||||
@ -372,20 +372,17 @@ Foam::volPointInterpolation::interpolate
|
|||||||
const pointMesh& pm = pointMesh::New(vf.mesh());
|
const pointMesh& pm = pointMesh::New(vf.mesh());
|
||||||
|
|
||||||
// Construct tmp<pointField>
|
// Construct tmp<pointField>
|
||||||
tmp<GeometricField<Type, pointPatchField, pointMesh>> tpf
|
auto tpf = tmp<GeometricField<Type, pointPatchField, pointMesh>>::New
|
||||||
(
|
(
|
||||||
new GeometricField<Type, pointPatchField, pointMesh>
|
IOobject
|
||||||
(
|
(
|
||||||
IOobject
|
"volPointInterpolate(" + vf.name() + ')',
|
||||||
(
|
vf.instance(),
|
||||||
"volPointInterpolate(" + vf.name() + ')',
|
pm.thisDb()
|
||||||
vf.instance(),
|
),
|
||||||
pm.thisDb()
|
pm,
|
||||||
),
|
vf.dimensions(),
|
||||||
pm,
|
patchFieldTypes
|
||||||
vf.dimensions(),
|
|
||||||
patchFieldTypes
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
interpolateInternalField(vf, tpf.ref());
|
interpolateInternalField(vf, tpf.ref());
|
||||||
@ -427,73 +424,60 @@ Foam::volPointInterpolation::interpolate
|
|||||||
const pointMesh& pm = pointMesh::New(vf.mesh());
|
const pointMesh& pm = pointMesh::New(vf.mesh());
|
||||||
const objectRegistry& db = pm.thisDb();
|
const objectRegistry& db = pm.thisDb();
|
||||||
|
|
||||||
|
PointFieldType* pfPtr =
|
||||||
|
db.objectRegistry::template getObjectPtr<PointFieldType>(name);
|
||||||
|
|
||||||
if (!cache || vf.mesh().changing())
|
if (!cache || vf.mesh().changing())
|
||||||
{
|
{
|
||||||
// Delete any old occurrences to avoid double registration
|
// Delete any old occurrences to avoid double registration
|
||||||
if (db.objectRegistry::template foundObject<PointFieldType>(name))
|
if (pfPtr && pfPtr->ownedByRegistry())
|
||||||
{
|
{
|
||||||
PointFieldType& pf = const_cast<PointFieldType&>
|
solution::cachePrintMessage("Deleting", name, vf);
|
||||||
(
|
pfPtr->release();
|
||||||
db.objectRegistry::template lookupObject<PointFieldType>(name)
|
delete pfPtr;
|
||||||
);
|
|
||||||
|
|
||||||
if (pf.ownedByRegistry())
|
|
||||||
{
|
|
||||||
solution::cachePrintMessage("Deleting", name, vf);
|
|
||||||
pf.release();
|
|
||||||
delete &pf;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto tpf = tmp<GeometricField<Type, pointPatchField, pointMesh>>::New
|
||||||
tmp<GeometricField<Type, pointPatchField, pointMesh>> tpf
|
|
||||||
(
|
(
|
||||||
new GeometricField<Type, pointPatchField, pointMesh>
|
IOobject
|
||||||
(
|
(
|
||||||
IOobject
|
name,
|
||||||
(
|
vf.instance(),
|
||||||
name,
|
pm.thisDb()
|
||||||
vf.instance(),
|
),
|
||||||
pm.thisDb()
|
pm,
|
||||||
),
|
vf.dimensions()
|
||||||
pm,
|
|
||||||
vf.dimensions()
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
interpolate(vf, tpf.ref());
|
interpolate(vf, tpf.ref());
|
||||||
|
|
||||||
return tpf;
|
return tpf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!pfPtr)
|
||||||
|
{
|
||||||
|
solution::cachePrintMessage("Calculating and caching", name, vf);
|
||||||
|
|
||||||
|
pfPtr = interpolate(vf, name, false).ptr();
|
||||||
|
regIOobject::store(pfPtr);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!db.objectRegistry::template foundObject<PointFieldType>(name))
|
PointFieldType& pf = *pfPtr;
|
||||||
|
|
||||||
|
if (pf.upToDate(vf)) //TBD: , vf.mesh().points()))
|
||||||
{
|
{
|
||||||
solution::cachePrintMessage("Calculating and caching", name, vf);
|
solution::cachePrintMessage("Reusing", name, vf);
|
||||||
tmp<PointFieldType> tpf = interpolate(vf, name, false);
|
|
||||||
PointFieldType* pfPtr = tpf.ptr();
|
|
||||||
regIOobject::store(pfPtr);
|
|
||||||
return *pfPtr;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PointFieldType& pf = const_cast<PointFieldType&>
|
solution::cachePrintMessage("Updating", name, vf);
|
||||||
(
|
interpolate(vf, pf);
|
||||||
db.objectRegistry::template lookupObject<PointFieldType>(name)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (pf.upToDate(vf)) //TBD: , vf.mesh().points()))
|
|
||||||
{
|
|
||||||
solution::cachePrintMessage("Reusing", name, vf);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
solution::cachePrintMessage("Updating", name, vf);
|
|
||||||
interpolate(vf, pf);
|
|
||||||
}
|
|
||||||
return pf;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return *pfPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -537,74 +521,61 @@ Foam::volPointInterpolation::interpolate
|
|||||||
const pointMesh& pm = pointMesh::New(vf.mesh());
|
const pointMesh& pm = pointMesh::New(vf.mesh());
|
||||||
const objectRegistry& db = pm.thisDb();
|
const objectRegistry& db = pm.thisDb();
|
||||||
|
|
||||||
|
|
||||||
|
PointFieldType* pfPtr =
|
||||||
|
db.objectRegistry::template getObjectPtr<PointFieldType>(name);
|
||||||
|
|
||||||
if (!cache || vf.mesh().changing())
|
if (!cache || vf.mesh().changing())
|
||||||
{
|
{
|
||||||
// Delete any old occurrences to avoid double registration
|
// Delete any old occurrences to avoid double registration
|
||||||
if (db.objectRegistry::template foundObject<PointFieldType>(name))
|
if (pfPtr && pfPtr->ownedByRegistry())
|
||||||
{
|
{
|
||||||
PointFieldType& pf = const_cast<PointFieldType&>
|
solution::cachePrintMessage("Deleting", name, vf);
|
||||||
(
|
pfPtr->release();
|
||||||
db.objectRegistry::template lookupObject<PointFieldType>(name)
|
delete pfPtr;
|
||||||
);
|
|
||||||
|
|
||||||
if (pf.ownedByRegistry())
|
|
||||||
{
|
|
||||||
solution::cachePrintMessage("Deleting", name, vf);
|
|
||||||
pf.release();
|
|
||||||
delete &pf;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto tpf = tmp<DimensionedField<Type, pointMesh>>::New
|
||||||
tmp<DimensionedField<Type, pointMesh>> tpf
|
|
||||||
(
|
(
|
||||||
new DimensionedField<Type, pointMesh>
|
IOobject
|
||||||
(
|
(
|
||||||
IOobject
|
name,
|
||||||
(
|
vf.instance(),
|
||||||
name,
|
pm.thisDb()
|
||||||
vf.instance(),
|
),
|
||||||
pm.thisDb()
|
pm,
|
||||||
),
|
vf.dimensions()
|
||||||
pm,
|
|
||||||
vf.dimensions()
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
interpolateDimensionedInternalField(vf, tpf.ref());
|
interpolateDimensionedInternalField(vf, tpf.ref());
|
||||||
|
|
||||||
return tpf;
|
return tpf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!pfPtr)
|
||||||
|
{
|
||||||
|
solution::cachePrintMessage("Calculating and caching", name, vf);
|
||||||
|
pfPtr = interpolate(vf, name, false).ptr();
|
||||||
|
|
||||||
|
regIOobject::store(pfPtr);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!db.objectRegistry::template foundObject<PointFieldType>(name))
|
PointFieldType& pf = *pfPtr;
|
||||||
|
|
||||||
|
if (pf.upToDate(vf)) //TBD: , vf.mesh().points()))
|
||||||
{
|
{
|
||||||
solution::cachePrintMessage("Calculating and caching", name, vf);
|
solution::cachePrintMessage("Reusing", name, vf);
|
||||||
tmp<PointFieldType> tpf = interpolate(vf, name, false);
|
|
||||||
PointFieldType* pfPtr = tpf.ptr();
|
|
||||||
regIOobject::store(pfPtr);
|
|
||||||
return *pfPtr;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PointFieldType& pf = const_cast<PointFieldType&>
|
solution::cachePrintMessage("Updating", name, vf);
|
||||||
(
|
interpolateDimensionedInternalField(vf, pf);
|
||||||
db.objectRegistry::template lookupObject<PointFieldType>(name)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (pf.upToDate(vf)) //TBD: , vf.mesh().points()))
|
|
||||||
{
|
|
||||||
solution::cachePrintMessage("Reusing", name, vf);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
solution::cachePrintMessage("Updating", name, vf);
|
|
||||||
interpolateDimensionedInternalField(vf, pf);
|
|
||||||
}
|
|
||||||
|
|
||||||
return pf;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return *pfPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -415,7 +415,7 @@ void Foam::functionObjects::externalCoupled::initCoupling()
|
|||||||
UPtrList<const fvMesh> meshes(regionNames.size());
|
UPtrList<const fvMesh> meshes(regionNames.size());
|
||||||
forAll(regionNames, regi)
|
forAll(regionNames, regi)
|
||||||
{
|
{
|
||||||
meshes.set(regi, time_.lookupObjectPtr<fvMesh>(regionNames[regi]));
|
meshes.set(regi, time_.findObject<fvMesh>(regionNames[regi]));
|
||||||
}
|
}
|
||||||
|
|
||||||
const labelList& groups = regionToGroups_[compName];
|
const labelList& groups = regionToGroups_[compName];
|
||||||
@ -692,7 +692,7 @@ void Foam::functionObjects::externalCoupled::readDataMaster()
|
|||||||
UPtrList<const fvMesh> meshes(regionNames.size());
|
UPtrList<const fvMesh> meshes(regionNames.size());
|
||||||
forAll(regionNames, regi)
|
forAll(regionNames, regi)
|
||||||
{
|
{
|
||||||
meshes.set(regi, time_.lookupObjectPtr<fvMesh>(regionNames[regi]));
|
meshes.set(regi, time_.findObject<fvMesh>(regionNames[regi]));
|
||||||
}
|
}
|
||||||
|
|
||||||
const labelList& groups = regionToGroups_[compName];
|
const labelList& groups = regionToGroups_[compName];
|
||||||
@ -736,7 +736,7 @@ void Foam::functionObjects::externalCoupled::writeDataMaster() const
|
|||||||
UPtrList<const fvMesh> meshes(regionNames.size());
|
UPtrList<const fvMesh> meshes(regionNames.size());
|
||||||
forAll(regionNames, regi)
|
forAll(regionNames, regi)
|
||||||
{
|
{
|
||||||
meshes.set(regi, time_.lookupObjectPtr<fvMesh>(regionNames[regi]));
|
meshes.set(regi, time_.findObject<fvMesh>(regionNames[regi]));
|
||||||
}
|
}
|
||||||
|
|
||||||
const labelList& groups = regionToGroups_[compName];
|
const labelList& groups = regionToGroups_[compName];
|
||||||
|
|||||||
@ -82,8 +82,7 @@ bool Foam::functionObjects::externalCoupled::readData
|
|||||||
label nFound = 0;
|
label nFound = 0;
|
||||||
for (const fvMesh& mesh : meshes)
|
for (const fvMesh& mesh : meshes)
|
||||||
{
|
{
|
||||||
const volFieldType* vfptr =
|
const volFieldType* vfptr = mesh.findObject<volFieldType>(fieldName);
|
||||||
mesh.lookupObjectPtr<volFieldType>(fieldName);
|
|
||||||
|
|
||||||
if (!vfptr)
|
if (!vfptr)
|
||||||
{
|
{
|
||||||
@ -358,8 +357,7 @@ bool Foam::functionObjects::externalCoupled::writeData
|
|||||||
|
|
||||||
for (const fvMesh& mesh : meshes)
|
for (const fvMesh& mesh : meshes)
|
||||||
{
|
{
|
||||||
const volFieldType* vfptr =
|
const volFieldType* vfptr = mesh.findObject<volFieldType>(fieldName);
|
||||||
mesh.lookupObjectPtr<volFieldType>(fieldName);
|
|
||||||
|
|
||||||
if (!vfptr)
|
if (!vfptr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -37,7 +37,7 @@ bool Foam::functionObjects::fieldAverageItem::calculateMeanField
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Type* baseFieldPtr = obr.lookupObjectPtr<Type>(fieldName_);
|
const Type* baseFieldPtr = obr.findObject<Type>(fieldName_);
|
||||||
|
|
||||||
if (!baseFieldPtr)
|
if (!baseFieldPtr)
|
||||||
{
|
{
|
||||||
@ -122,7 +122,7 @@ bool Foam::functionObjects::fieldAverageItem::calculateMeanField
|
|||||||
{
|
{
|
||||||
const word& fieldName = nameIter();
|
const word& fieldName = nameIter();
|
||||||
const scalar dt = timeIter();
|
const scalar dt = timeIter();
|
||||||
const Type* w = obr.lookupObjectPtr<Type>(fieldName);
|
const Type* w = obr.findObject<Type>(fieldName);
|
||||||
|
|
||||||
meanField += dt*(*w);
|
meanField += dt*(*w);
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ bool Foam::functionObjects::fieldAverageItem::calculatePrime2MeanField
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Type1* baseFieldPtr = obr.lookupObjectPtr<Type1>(fieldName_);
|
const Type1* baseFieldPtr = obr.findObject<Type1>(fieldName_);
|
||||||
|
|
||||||
if (!baseFieldPtr)
|
if (!baseFieldPtr)
|
||||||
{
|
{
|
||||||
@ -258,7 +258,7 @@ bool Foam::functionObjects::fieldAverageItem::calculatePrime2MeanField
|
|||||||
{
|
{
|
||||||
const word& fieldName = nameIter();
|
const word& fieldName = nameIter();
|
||||||
const scalar dt = timeIter();
|
const scalar dt = timeIter();
|
||||||
const Type1* w = obr.lookupObjectPtr<Type1>(fieldName);
|
const Type1* w = obr.findObject<Type1>(fieldName);
|
||||||
|
|
||||||
prime2MeanField += dt*(sqr((*w) - meanField));
|
prime2MeanField += dt*(sqr((*w) - meanField));
|
||||||
|
|
||||||
|
|||||||
@ -119,7 +119,7 @@ void Foam::functionObjects::fieldAverage::restoreWindowFieldsType
|
|||||||
|
|
||||||
const word& fieldName = item.fieldName();
|
const word& fieldName = item.fieldName();
|
||||||
|
|
||||||
const Type* fieldPtr = lookupObjectPtr<Type>(fieldName);
|
const Type* fieldPtr = findObject<Type>(fieldName);
|
||||||
|
|
||||||
if (!fieldPtr)
|
if (!fieldPtr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -54,7 +54,7 @@ void Foam::functionObjects::fieldExtents::calcFieldExtents
|
|||||||
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
||||||
|
|
||||||
const VolFieldType* fieldPtr =
|
const VolFieldType* fieldPtr =
|
||||||
obr_.lookupObjectPtr<VolFieldType>(fieldName);
|
obr_.findObject<VolFieldType>(fieldName);
|
||||||
|
|
||||||
if (!fieldPtr)
|
if (!fieldPtr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -129,7 +129,7 @@ void Foam::functionObjects::fluxSummary::initialiseSurface
|
|||||||
DynamicList<boolList>& faceFlip
|
DynamicList<boolList>& faceFlip
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const surfMesh* sPtr = mesh_.lookupObjectPtr<surfMesh>(surfName);
|
const surfMesh* sPtr = mesh_.findObject<surfMesh>(surfName);
|
||||||
if (!sPtr)
|
if (!sPtr)
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
@ -154,7 +154,7 @@ void Foam::functionObjects::fluxSummary::initialiseSurfaceAndDirection
|
|||||||
DynamicList<boolList>& faceFlip
|
DynamicList<boolList>& faceFlip
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const surfMesh* sPtr = mesh_.lookupObjectPtr<surfMesh>(surfName);
|
const surfMesh* sPtr = mesh_.findObject<surfMesh>(surfName);
|
||||||
if (!sPtr)
|
if (!sPtr)
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
|
|||||||
@ -47,13 +47,15 @@ bool Foam::functionObjects::readFields::loadField(const word& fieldName)
|
|||||||
}
|
}
|
||||||
else if (foundObject<SurfaceFieldType>(fieldName))
|
else if (foundObject<SurfaceFieldType>(fieldName))
|
||||||
{
|
{
|
||||||
DebugInfo<< "readFields: " << SurfaceFieldType::typeName
|
DebugInfo
|
||||||
|
<< "readFields: " << SurfaceFieldType::typeName
|
||||||
<< " " << fieldName << " already exists in database"
|
<< " " << fieldName << " already exists in database"
|
||||||
<< " already in database" << endl;
|
<< " already in database" << endl;
|
||||||
}
|
}
|
||||||
else if (foundObject<SurfFieldType>(fieldName))
|
else if (foundObject<SurfFieldType>(fieldName))
|
||||||
{
|
{
|
||||||
DebugInfo<< "readFields: " << SurfFieldType::typeName
|
DebugInfo
|
||||||
|
<< "readFields: " << SurfFieldType::typeName
|
||||||
<< " " << fieldName << " already exists in database"
|
<< " " << fieldName << " already exists in database"
|
||||||
<< " already in database" << endl;
|
<< " already in database" << endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,7 +30,7 @@ bool Foam::functionObjects::reference::calcType()
|
|||||||
{
|
{
|
||||||
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
||||||
|
|
||||||
const VolFieldType* vfPtr = lookupObjectPtr<VolFieldType>(fieldName_);
|
const VolFieldType* vfPtr = findObject<VolFieldType>(fieldName_);
|
||||||
|
|
||||||
if (vfPtr)
|
if (vfPtr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -66,7 +66,7 @@ Foam::functionObjects::setFlow::modeTypeNames
|
|||||||
void Foam::functionObjects::setFlow::setPhi(const volVectorField& U)
|
void Foam::functionObjects::setFlow::setPhi(const volVectorField& U)
|
||||||
{
|
{
|
||||||
surfaceScalarField* phiptr =
|
surfaceScalarField* phiptr =
|
||||||
mesh_.lookupObjectRefPtr<surfaceScalarField>(phiName_);
|
mesh_.getObjectPtr<surfaceScalarField>(phiName_);
|
||||||
|
|
||||||
if (!phiptr)
|
if (!phiptr)
|
||||||
{
|
{
|
||||||
@ -76,7 +76,7 @@ void Foam::functionObjects::setFlow::setPhi(const volVectorField& U)
|
|||||||
if (rhoName_ != "none")
|
if (rhoName_ != "none")
|
||||||
{
|
{
|
||||||
const volScalarField* rhoptr =
|
const volScalarField* rhoptr =
|
||||||
mesh_.lookupObjectPtr<volScalarField>(rhoName_);
|
mesh_.findObject<volScalarField>(rhoName_);
|
||||||
|
|
||||||
if (rhoptr)
|
if (rhoptr)
|
||||||
{
|
{
|
||||||
@ -207,10 +207,11 @@ bool Foam::functionObjects::setFlow::read(const dictionary& dict)
|
|||||||
|
|
||||||
bool Foam::functionObjects::setFlow::execute()
|
bool Foam::functionObjects::setFlow::execute()
|
||||||
{
|
{
|
||||||
volVectorField* Uptr = mesh_.lookupObjectRefPtr<volVectorField>(UName_);
|
volVectorField* Uptr =
|
||||||
|
mesh_.getObjectPtr<volVectorField>(UName_);
|
||||||
|
|
||||||
surfaceScalarField* phiptr =
|
surfaceScalarField* phiptr =
|
||||||
mesh_.lookupObjectRefPtr<surfaceScalarField>(phiName_);
|
mesh_.getObjectPtr<surfaceScalarField>(phiName_);
|
||||||
|
|
||||||
Log << nl << name() << ":" << nl;
|
Log << nl << name() << ":" << nl;
|
||||||
|
|
||||||
@ -431,13 +432,13 @@ bool Foam::functionObjects::setFlow::execute()
|
|||||||
|
|
||||||
bool Foam::functionObjects::setFlow::write()
|
bool Foam::functionObjects::setFlow::write()
|
||||||
{
|
{
|
||||||
const auto& Uptr = mesh_.lookupObjectRefPtr<volVectorField>(UName_);
|
const auto* Uptr = mesh_.findObject<volVectorField>(UName_);
|
||||||
if (Uptr)
|
if (Uptr)
|
||||||
{
|
{
|
||||||
Uptr->write();
|
Uptr->write();
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& phiptr = mesh_.lookupObjectRefPtr<surfaceScalarField>(phiName_);
|
const auto* phiptr = mesh_.findObject<surfaceScalarField>(phiName_);
|
||||||
if (phiptr)
|
if (phiptr)
|
||||||
{
|
{
|
||||||
phiptr->write();
|
phiptr->write();
|
||||||
|
|||||||
@ -102,8 +102,7 @@ bool Foam::functionObjects::stabilityBlendingFactor::calc()
|
|||||||
|
|
||||||
bool Foam::functionObjects::stabilityBlendingFactor::init(bool first)
|
bool Foam::functionObjects::stabilityBlendingFactor::init(bool first)
|
||||||
{
|
{
|
||||||
const IOField<scalar>* residualPtr =
|
const auto* residualPtr = mesh_.findObject<IOField<scalar>>(residualName_);
|
||||||
mesh_.lookupObjectPtr<IOField<scalar>>(residualName_);
|
|
||||||
|
|
||||||
if (residuals_)
|
if (residuals_)
|
||||||
{
|
{
|
||||||
@ -164,7 +163,7 @@ bool Foam::functionObjects::stabilityBlendingFactor::init(bool first)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const volScalarField* nonOrthPtr =
|
const volScalarField* nonOrthPtr =
|
||||||
mesh_.lookupObjectPtr<volScalarField>(nonOrthogonalityName_);
|
mesh_.findObject<volScalarField>(nonOrthogonalityName_);
|
||||||
|
|
||||||
if (nonOrthogonality_)
|
if (nonOrthogonality_)
|
||||||
{
|
{
|
||||||
@ -200,7 +199,7 @@ bool Foam::functionObjects::stabilityBlendingFactor::init(bool first)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const volScalarField* skewnessPtr =
|
const volScalarField* skewnessPtr =
|
||||||
mesh_.lookupObjectPtr<volScalarField>(skewnessName_);
|
mesh_.findObject<volScalarField>(skewnessName_);
|
||||||
|
|
||||||
if (skewness_)
|
if (skewness_)
|
||||||
{
|
{
|
||||||
@ -235,7 +234,7 @@ bool Foam::functionObjects::stabilityBlendingFactor::init(bool first)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const volScalarField* faceWeightsPtr =
|
const volScalarField* faceWeightsPtr =
|
||||||
mesh_.lookupObjectPtr<volScalarField>(faceWeightName_);
|
mesh_.findObject<volScalarField>(faceWeightName_);
|
||||||
|
|
||||||
if (faceWeight_)
|
if (faceWeight_)
|
||||||
{
|
{
|
||||||
@ -342,7 +341,7 @@ bool Foam::functionObjects::stabilityBlendingFactor::init(bool first)
|
|||||||
|
|
||||||
|
|
||||||
const volVectorField* UNamePtr =
|
const volVectorField* UNamePtr =
|
||||||
mesh_.lookupObjectPtr<volVectorField>(UName_);
|
mesh_.findObject<volVectorField>(UName_);
|
||||||
|
|
||||||
if (Co_)
|
if (Co_)
|
||||||
{
|
{
|
||||||
@ -520,7 +519,7 @@ Foam::functionObjects::stabilityBlendingFactor::stabilityBlendingFactor
|
|||||||
store(resultName_, faceBlendedPtr);
|
store(resultName_, faceBlendedPtr);
|
||||||
|
|
||||||
const volScalarField* nonOrthPtr =
|
const volScalarField* nonOrthPtr =
|
||||||
mesh_.lookupObjectPtr<volScalarField>(nonOrthogonalityName_);
|
mesh_.findObject<volScalarField>(nonOrthogonalityName_);
|
||||||
|
|
||||||
if (nonOrthogonality_)
|
if (nonOrthogonality_)
|
||||||
{
|
{
|
||||||
@ -552,7 +551,7 @@ Foam::functionObjects::stabilityBlendingFactor::stabilityBlendingFactor
|
|||||||
|
|
||||||
|
|
||||||
const volScalarField* faceWeightsPtr =
|
const volScalarField* faceWeightsPtr =
|
||||||
mesh_.lookupObjectPtr<volScalarField>(faceWeightName_);
|
mesh_.findObject<volScalarField>(faceWeightName_);
|
||||||
|
|
||||||
if (faceWeight_)
|
if (faceWeight_)
|
||||||
{
|
{
|
||||||
@ -583,7 +582,7 @@ Foam::functionObjects::stabilityBlendingFactor::stabilityBlendingFactor
|
|||||||
}
|
}
|
||||||
|
|
||||||
const volScalarField* skewnessPtr =
|
const volScalarField* skewnessPtr =
|
||||||
mesh_.lookupObjectPtr<volScalarField>(skewnessName_);
|
mesh_.findObject<volScalarField>(skewnessName_);
|
||||||
|
|
||||||
if (skewness_)
|
if (skewness_)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -107,14 +107,12 @@ bool Foam::functionObjects::surfaceInterpolate::write()
|
|||||||
{
|
{
|
||||||
const word& fieldName = fieldSet_[i].second();
|
const word& fieldName = fieldSet_[i].second();
|
||||||
|
|
||||||
if (mesh_.foundObject<regIOobject>(fieldName))
|
const regIOobject* ioptr = obr_.findObject<regIOobject>(fieldName);
|
||||||
|
|
||||||
|
if (ioptr)
|
||||||
{
|
{
|
||||||
Log << " " << fieldName << nl;
|
Log << " " << fieldName << nl;
|
||||||
|
ioptr->write();
|
||||||
const regIOobject& field =
|
|
||||||
obr_.lookupObject<regIOobject>(fieldName);
|
|
||||||
|
|
||||||
field.write();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -103,12 +103,10 @@ bool Foam::functionObjects::turbulenceFields::compressible()
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
FatalErrorInFunction
|
||||||
FatalErrorInFunction
|
<< "Turbulence model not found in database, deactivating"
|
||||||
<< "Turbulence model not found in database, deactivating"
|
<< exit(FatalError);
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,10 +38,11 @@ void Foam::functionObjects::turbulenceFields::processField
|
|||||||
|
|
||||||
const word scopedName = modelName + ':' + fieldName;
|
const word scopedName = modelName + ':' + fieldName;
|
||||||
|
|
||||||
if (obr_.foundObject<FieldType>(scopedName))
|
FieldType* fldPtr = obr_.getObjectPtr<FieldType>(scopedName);
|
||||||
|
|
||||||
|
if (fldPtr)
|
||||||
{
|
{
|
||||||
FieldType& fld = obr_.lookupObjectRef<FieldType>(scopedName);
|
(*fldPtr) == tvalue();
|
||||||
fld == tvalue();
|
|
||||||
}
|
}
|
||||||
else if (obr_.found(scopedName))
|
else if (obr_.found(scopedName))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -57,12 +57,8 @@ bool Foam::functionObjects::vorticity::calc()
|
|||||||
fvc::curl(lookupObject<volVectorField>(fieldName_))
|
fvc::curl(lookupObject<volVectorField>(fieldName_))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -183,28 +183,48 @@ bool Foam::functionObjects::wallShearStress::execute()
|
|||||||
volVectorField& wallShearStress =
|
volVectorField& wallShearStress =
|
||||||
mesh_.lookupObjectRef<volVectorField>(type());
|
mesh_.lookupObjectRef<volVectorField>(type());
|
||||||
|
|
||||||
const word& turbModelName = turbulenceModel::propertiesName;
|
bool ok = false;
|
||||||
auto cmpModelPtr =
|
|
||||||
mesh_.lookupObjectPtr<compressible::turbulenceModel>(turbModelName);
|
|
||||||
auto icoModelPtr =
|
|
||||||
mesh_.lookupObjectPtr<incompressible::turbulenceModel>(turbModelName);
|
|
||||||
|
|
||||||
if (cmpModelPtr)
|
// compressible
|
||||||
|
if (!ok)
|
||||||
{
|
{
|
||||||
calcShearStress(cmpModelPtr->devRhoReff(), wallShearStress);
|
typedef compressible::turbulenceModel turbType;
|
||||||
|
|
||||||
|
const turbType* modelPtr =
|
||||||
|
findObject<turbType>(turbulenceModel::propertiesName);
|
||||||
|
|
||||||
|
ok = modelPtr;
|
||||||
|
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
calcShearStress(modelPtr->devRhoReff(), wallShearStress);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (icoModelPtr)
|
|
||||||
|
// incompressible
|
||||||
|
if (!ok)
|
||||||
{
|
{
|
||||||
calcShearStress(icoModelPtr->devReff(), wallShearStress);
|
typedef incompressible::turbulenceModel turbType;
|
||||||
|
|
||||||
|
const turbType* modelPtr =
|
||||||
|
findObject<turbType>(turbulenceModel::propertiesName);
|
||||||
|
|
||||||
|
ok = modelPtr;
|
||||||
|
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
calcShearStress(modelPtr->devReff(), wallShearStress);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (!ok)
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Unable to find turbulence model in the "
|
<< "Unable to find turbulence model in the "
|
||||||
<< "database" << exit(FatalError);
|
<< "database" << exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -176,16 +176,15 @@ bool Foam::functionObjects::zeroGradient::write()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Consistent output order
|
// Consistent output order
|
||||||
const wordList outputList = results_.sortedToc();
|
for (const word& fieldName : results_.sortedToc())
|
||||||
for (const word& fieldName : outputList)
|
|
||||||
{
|
{
|
||||||
if (foundObject<regIOobject>(fieldName))
|
const regIOobject* ioptr = findObject<regIOobject>(fieldName);
|
||||||
{
|
|
||||||
const regIOobject& io = lookupObject<regIOobject>(fieldName);
|
|
||||||
|
|
||||||
|
if (ioptr)
|
||||||
|
{
|
||||||
Log << " " << fieldName << endl;
|
Log << " " << fieldName << endl;
|
||||||
|
|
||||||
io.write();
|
ioptr->write();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -106,7 +106,7 @@ bool Foam::functionObjects::vtkCloud::writeCloud
|
|||||||
const word& cloudName
|
const word& cloudName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const auto* objPtr = mesh_.lookupObjectPtr<cloud>(cloudName);
|
const auto* objPtr = mesh_.findObject<cloud>(cloudName);
|
||||||
if (!objPtr)
|
if (!objPtr)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -127,7 +127,7 @@ bool Foam::functionObjects::vtkCloud::writeCloud
|
|||||||
|
|
||||||
objPtr->writeObjects(obrTmp);
|
objPtr->writeObjects(obrTmp);
|
||||||
|
|
||||||
const auto* pointsPtr = obrTmp.lookupObjectPtr<vectorField>("position");
|
const auto* pointsPtr = obrTmp.findObject<vectorField>("position");
|
||||||
|
|
||||||
if (!pointsPtr)
|
if (!pointsPtr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -52,7 +52,7 @@ Foam::wordList Foam::functionObjects::vtkCloud::writeFields
|
|||||||
|
|
||||||
for (const word& fieldName : fieldNames)
|
for (const word& fieldName : fieldNames)
|
||||||
{
|
{
|
||||||
const auto* fldPtr = obrTmp.lookupObjectPtr<IOField<Type>>(fieldName);
|
const auto* fldPtr = obrTmp.findObject<IOField<Type>>(fieldName);
|
||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -83,7 +83,7 @@ Foam::functionObjects::energyTransport::kappaEff() const
|
|||||||
{
|
{
|
||||||
typedef incompressible::turbulenceModel turbType;
|
typedef incompressible::turbulenceModel turbType;
|
||||||
|
|
||||||
const turbType* turbPtr = lookupObjectPtr<turbType>
|
const turbType* turbPtr = findObject<turbType>
|
||||||
(
|
(
|
||||||
turbulenceModel::propertiesName
|
turbulenceModel::propertiesName
|
||||||
);
|
);
|
||||||
@ -305,7 +305,7 @@ Foam::functionObjects::energyTransport::energyTransport
|
|||||||
phases_.set
|
phases_.set
|
||||||
(
|
(
|
||||||
i,
|
i,
|
||||||
mesh_.lookupObjectRefPtr<volScalarField>(phaseNames_[i])
|
mesh_.getObjectPtr<volScalarField>(phaseNames_[i])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -88,10 +88,7 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::scalarTransport::D
|
|||||||
const surfaceScalarField& phi
|
const surfaceScalarField& phi
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
typedef incompressible::turbulenceModel icoModel;
|
const word Dname("D" + s.name());
|
||||||
typedef compressible::turbulenceModel cmpModel;
|
|
||||||
|
|
||||||
word Dname("D" + s.name());
|
|
||||||
|
|
||||||
if (constantD_)
|
if (constantD_)
|
||||||
{
|
{
|
||||||
@ -109,38 +106,49 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::scalarTransport::D
|
|||||||
dimensionedScalar(Dname, phi.dimensions()/dimLength, D_)
|
dimensionedScalar(Dname, phi.dimensions()/dimLength, D_)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (nutName_ != "none")
|
|
||||||
|
if (nutName_ != "none")
|
||||||
{
|
{
|
||||||
const volScalarField& nutMean =
|
const volScalarField& nutMean =
|
||||||
mesh_.lookupObject<volScalarField>(nutName_);
|
mesh_.lookupObject<volScalarField>(nutName_);
|
||||||
|
|
||||||
return tmp<volScalarField>::New(Dname, nutMean);
|
return tmp<volScalarField>::New(Dname, nutMean);
|
||||||
}
|
}
|
||||||
else if (foundObject<icoModel>(turbulenceModel::propertiesName))
|
|
||||||
{
|
|
||||||
const icoModel& model = lookupObject<icoModel>
|
|
||||||
(
|
|
||||||
turbulenceModel::propertiesName
|
|
||||||
);
|
|
||||||
|
|
||||||
return tmp<volScalarField>::New
|
// Incompressible
|
||||||
(
|
{
|
||||||
Dname,
|
const auto* turb =
|
||||||
alphaD_*model.nu() + alphaDt_*model.nut()
|
findObject<incompressible::turbulenceModel>
|
||||||
);
|
(
|
||||||
|
turbulenceModel::propertiesName
|
||||||
|
);
|
||||||
|
|
||||||
|
if (turb)
|
||||||
|
{
|
||||||
|
return tmp<volScalarField>::New
|
||||||
|
(
|
||||||
|
Dname,
|
||||||
|
alphaD_ * turb->nu() + alphaDt_ * turb->nut()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (foundObject<cmpModel>(turbulenceModel::propertiesName))
|
|
||||||
{
|
|
||||||
const cmpModel& model = lookupObject<cmpModel>
|
|
||||||
(
|
|
||||||
turbulenceModel::propertiesName
|
|
||||||
);
|
|
||||||
|
|
||||||
return tmp<volScalarField>::New
|
// Compressible
|
||||||
(
|
{
|
||||||
Dname,
|
const auto* turb =
|
||||||
alphaD_*model.mu() + alphaDt_*model.mut()
|
findObject<compressible::turbulenceModel>
|
||||||
);
|
(
|
||||||
|
turbulenceModel::propertiesName
|
||||||
|
);
|
||||||
|
|
||||||
|
if (turb)
|
||||||
|
{
|
||||||
|
return tmp<volScalarField>::New
|
||||||
|
(
|
||||||
|
Dname,
|
||||||
|
alphaD_ * turb->mu() + alphaDt_ * turb->mut()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -38,10 +38,16 @@ int Foam::functionObjects::ensightWrite::writeVolField
|
|||||||
// State: return 0 (not-processed), -1 (skip), +1 ok
|
// State: return 0 (not-processed), -1 (skip), +1 ok
|
||||||
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
||||||
|
|
||||||
const VolFieldType* fldPtr;
|
// Already done
|
||||||
|
if (state)
|
||||||
|
{
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
// Already done, or not available
|
const VolFieldType* fldPtr = findObject<VolFieldType>(inputName);
|
||||||
if (state || !(fldPtr = lookupObjectPtr<VolFieldType>(inputName)))
|
|
||||||
|
// Not available
|
||||||
|
if (!fldPtr)
|
||||||
{
|
{
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -82,22 +82,18 @@ bool Foam::functionObjects::removeRegisteredObject::read(const dictionary& dict)
|
|||||||
|
|
||||||
bool Foam::functionObjects::removeRegisteredObject::execute()
|
bool Foam::functionObjects::removeRegisteredObject::execute()
|
||||||
{
|
{
|
||||||
forAll(objectNames_, i)
|
for (const word& objName : objectNames_)
|
||||||
{
|
{
|
||||||
if (foundObject<regIOobject>(objectNames_[i]))
|
regIOobject* ptr = getObjectPtr<regIOobject>(objName);
|
||||||
|
|
||||||
|
if (ptr && ptr->ownedByRegistry())
|
||||||
{
|
{
|
||||||
const regIOobject& obj =
|
Log << type() << " " << name() << " output:" << nl
|
||||||
lookupObject<regIOobject>(objectNames_[i]);
|
<< " removing object " << ptr->name() << nl
|
||||||
|
<< endl;
|
||||||
|
|
||||||
if (obj.ownedByRegistry())
|
ptr->release();
|
||||||
{
|
delete ptr;
|
||||||
Log << type() << " " << name() << " output:" << nl
|
|
||||||
<< " removing object " << obj.name() << nl
|
|
||||||
<< endl;
|
|
||||||
|
|
||||||
const_cast<regIOobject&>(obj).release();
|
|
||||||
delete &obj;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -113,8 +113,7 @@ void Foam::functionObjects::residuals::writeField(const word& fieldName) const
|
|||||||
{
|
{
|
||||||
const word residualName("initialResidual:" + fieldName);
|
const word residualName("initialResidual:" + fieldName);
|
||||||
|
|
||||||
const IOField<scalar>* residualPtr =
|
const auto* residualPtr = mesh_.findObject<IOField<scalar>>(residualName);
|
||||||
mesh_.lookupObjectPtr<IOField<scalar>>(residualName);
|
|
||||||
|
|
||||||
if (residualPtr)
|
if (residualPtr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -160,10 +160,12 @@ bool Foam::functionObjects::writeDictionary::write()
|
|||||||
bool firstDict = true;
|
bool firstDict = true;
|
||||||
forAll(dictNames_, i)
|
forAll(dictNames_, i)
|
||||||
{
|
{
|
||||||
if (obr_.foundObject<dictionary>(dictNames_[i]))
|
const dictionary* dictptr =
|
||||||
|
obr_.findObject<dictionary>(dictNames_[i]);
|
||||||
|
|
||||||
|
if (dictptr)
|
||||||
{
|
{
|
||||||
const dictionary& dict =
|
const dictionary& dict = *dictptr;
|
||||||
obr_.lookupObject<dictionary>(dictNames_[i]);
|
|
||||||
|
|
||||||
if (dict.digest() != digests_[i])
|
if (dict.digest() != digests_[i])
|
||||||
{
|
{
|
||||||
|
|||||||
@ -211,13 +211,9 @@ void uniformInterpolatedDisplacementPointPatchVectorField::updateCoeffs()
|
|||||||
>(*fieldsCacheIter());
|
>(*fieldsCacheIter());
|
||||||
|
|
||||||
|
|
||||||
pointVectorField& d = const_cast<pointVectorField&>
|
pointVectorField& d =
|
||||||
(
|
timeCache.lookupObjectRef<pointVectorField>(fieldName_);
|
||||||
timeCache.lookupObject<pointVectorField>
|
|
||||||
(
|
|
||||||
fieldName_
|
|
||||||
)
|
|
||||||
);
|
|
||||||
d.correctBoundaryConditions();
|
d.correctBoundaryConditions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -106,7 +106,7 @@ Foam::fv::viscousDissipation::viscousDissipation
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
const basicThermo* thermoPtr =
|
const basicThermo* thermoPtr =
|
||||||
mesh_.lookupObjectPtr<basicThermo>(basicThermo::dictName);
|
mesh_.findObject<basicThermo>(basicThermo::dictName);
|
||||||
|
|
||||||
if (thermoPtr)
|
if (thermoPtr)
|
||||||
{
|
{
|
||||||
@ -136,7 +136,7 @@ Foam::fv::viscousDissipation::devRhoReff() const
|
|||||||
// Incompressible
|
// Incompressible
|
||||||
{
|
{
|
||||||
const auto* turbPtr =
|
const auto* turbPtr =
|
||||||
mesh_.lookupObjectPtr<incompressible::turbulenceModel>
|
mesh_.findObject<incompressible::turbulenceModel>
|
||||||
(
|
(
|
||||||
turbulenceModel::propertiesName
|
turbulenceModel::propertiesName
|
||||||
);
|
);
|
||||||
@ -150,7 +150,7 @@ Foam::fv::viscousDissipation::devRhoReff() const
|
|||||||
// Compressible
|
// Compressible
|
||||||
{
|
{
|
||||||
const auto* turbPtr =
|
const auto* turbPtr =
|
||||||
mesh_.lookupObjectPtr<compressible::turbulenceModel>
|
mesh_.findObject<compressible::turbulenceModel>
|
||||||
(
|
(
|
||||||
turbulenceModel::propertiesName
|
turbulenceModel::propertiesName
|
||||||
);
|
);
|
||||||
@ -196,8 +196,7 @@ void Foam::fv::viscousDissipation::addSup
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Cached?
|
// Cached?
|
||||||
const GradFieldType* gradUPtr =
|
const GradFieldType* gradUPtr = mesh_.findObject<GradFieldType>(gradUName);
|
||||||
mesh_.lookupObjectPtr<GradFieldType>(gradUName);
|
|
||||||
|
|
||||||
if (gradUPtr)
|
if (gradUPtr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -206,10 +206,12 @@ void Foam::fv::interRegionHeatTransferModel::addSup
|
|||||||
{
|
{
|
||||||
if (he.dimensions() == dimEnergy/dimMass)
|
if (he.dimensions() == dimEnergy/dimMass)
|
||||||
{
|
{
|
||||||
if (mesh_.foundObject<basicThermo>(basicThermo::dictName))
|
const basicThermo* thermoPtr =
|
||||||
|
mesh_.findObject<basicThermo>(basicThermo::dictName);
|
||||||
|
|
||||||
|
if (thermoPtr)
|
||||||
{
|
{
|
||||||
const basicThermo& thermo =
|
const basicThermo& thermo = *thermoPtr;
|
||||||
mesh_.lookupObject<basicThermo>(basicThermo::dictName);
|
|
||||||
|
|
||||||
volScalarField htcByCpv(htc_/thermo.Cpv());
|
volScalarField htcByCpv(htc_/thermo.Cpv());
|
||||||
|
|
||||||
|
|||||||
@ -101,10 +101,10 @@ void Foam::InterfaceForce<CloudType>::cacheFields(const bool store)
|
|||||||
|
|
||||||
if (fieldExists)
|
if (fieldExists)
|
||||||
{
|
{
|
||||||
const volVectorField& gradInterForce = this->mesh().template
|
volVectorField& gradInterForce =
|
||||||
lookupObject<volVectorField>(fName);
|
this->mesh().template lookupObjectRef<volVectorField>(fName);
|
||||||
|
|
||||||
const_cast<volVectorField&>(gradInterForce).checkOut();
|
gradInterForce.checkOut();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -116,10 +116,10 @@ void Foam::LiftForce<CloudType>::cacheFields(const bool store)
|
|||||||
|
|
||||||
if (fieldExists)
|
if (fieldExists)
|
||||||
{
|
{
|
||||||
const volVectorField& curlUc = this->mesh().template
|
volVectorField& curlUc =
|
||||||
lookupObject<volVectorField>(fName);
|
this->mesh().template lookupObjectRef<volVectorField>(fName);
|
||||||
|
|
||||||
const_cast<volVectorField&>(curlUc).checkOut();
|
curlUc.checkOut();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -106,10 +106,10 @@ void Foam::PressureGradientForce<CloudType>::cacheFields(const bool store)
|
|||||||
|
|
||||||
if (fieldExists)
|
if (fieldExists)
|
||||||
{
|
{
|
||||||
const volVectorField& DUcDt = this->mesh().template
|
volVectorField& DUcDt =
|
||||||
lookupObject<volVectorField>(fName);
|
this->mesh().template lookupObjectRef<volVectorField>(fName);
|
||||||
|
|
||||||
const_cast<volVectorField&>(DUcDt).checkOut();
|
DUcDt.checkOut();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,11 +41,11 @@ Foam::DispersionRASModel<CloudType>::kModel() const
|
|||||||
this->owner().U().group()
|
this->owner().U().group()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (obr.foundObject<turbulenceModel>(turbName))
|
const turbulenceModel* turb = obr.findObject<turbulenceModel>(turbName);
|
||||||
|
|
||||||
|
if (turb)
|
||||||
{
|
{
|
||||||
const turbulenceModel& model =
|
return turb->k();
|
||||||
obr.lookupObject<turbulenceModel>(turbName);
|
|
||||||
return model.k();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
@ -69,11 +69,11 @@ Foam::DispersionRASModel<CloudType>::epsilonModel() const
|
|||||||
this->owner().U().group()
|
this->owner().U().group()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (obr.foundObject<turbulenceModel>(turbName))
|
const turbulenceModel* turb = obr.findObject<turbulenceModel>(turbName);
|
||||||
|
|
||||||
|
if (turb)
|
||||||
{
|
{
|
||||||
const turbulenceModel& model =
|
return turb->epsilon();
|
||||||
obr.lookupObject<turbulenceModel>(turbName);
|
|
||||||
return model.epsilon();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
|
|||||||
@ -64,11 +64,11 @@ Foam::BrownianMotionForce<CloudType>::kModel() const
|
|||||||
this->owner().U().group()
|
this->owner().U().group()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (obr.foundObject<turbulenceModel>(turbName))
|
const turbulenceModel* turb = obr.findObject<turbulenceModel>(turbName);
|
||||||
|
|
||||||
|
if (turb)
|
||||||
{
|
{
|
||||||
const turbulenceModel& model =
|
return turb->k();
|
||||||
obr.lookupObject<turbulenceModel>(turbName);
|
|
||||||
return model.k();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
|
|||||||
@ -39,7 +39,7 @@ namespace Foam
|
|||||||
const Foam::lumpedPointIOMovement*
|
const Foam::lumpedPointIOMovement*
|
||||||
Foam::lumpedPointIOMovement::lookupInRegistry(const objectRegistry& obr)
|
Foam::lumpedPointIOMovement::lookupInRegistry(const objectRegistry& obr)
|
||||||
{
|
{
|
||||||
return obr.lookupObjectPtr<lumpedPointIOMovement>
|
return obr.findObject<lumpedPointIOMovement>
|
||||||
(
|
(
|
||||||
lumpedPointMovement::canonicalName
|
lumpedPointMovement::canonicalName
|
||||||
);
|
);
|
||||||
|
|||||||
@ -495,7 +495,7 @@ bool Foam::lumpedPointMovement::forcesAndMoments
|
|||||||
// Calculated force per patch - cache
|
// Calculated force per patch - cache
|
||||||
PtrMap<vectorField> forceOnPatches;
|
PtrMap<vectorField> forceOnPatches;
|
||||||
|
|
||||||
const volScalarField* pPtr = pmesh.lookupObjectPtr<volScalarField>(pName);
|
const volScalarField* pPtr = pmesh.findObject<volScalarField>(pName);
|
||||||
|
|
||||||
// fvMesh and has pressure field
|
// fvMesh and has pressure field
|
||||||
if (isA<fvMesh>(pmesh) && pPtr)
|
if (isA<fvMesh>(pmesh) && pPtr)
|
||||||
|
|||||||
@ -240,8 +240,7 @@ const Foam::coordinateSystems& Foam::coordinateSystems::New
|
|||||||
{
|
{
|
||||||
// Previously registered?
|
// Previously registered?
|
||||||
|
|
||||||
const coordinateSystems* ptr =
|
const coordinateSystems* ptr = obr.findObject<coordinateSystems>(typeName);
|
||||||
obr.lookupObjectPtr<coordinateSystems>(typeName);
|
|
||||||
|
|
||||||
if (ptr)
|
if (ptr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -100,19 +100,16 @@ Foam::regionCoupledBaseGAMGInterface::regionCoupledBaseGAMGInterface
|
|||||||
const polyMesh& nbrMesh =
|
const polyMesh& nbrMesh =
|
||||||
fineRegionCoupledLduInterface_.nbrMesh();
|
fineRegionCoupledLduInterface_.nbrMesh();
|
||||||
|
|
||||||
if
|
const GAMGAgglomeration* nbrAggPtr = nbrMesh.thisDb().findObject
|
||||||
(
|
<GAMGAgglomeration>
|
||||||
nbrMesh.foundObject<GAMGAgglomeration>(GAMGAgglomeration::typeName)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const GAMGAgglomeration& nbrAgg = nbrMesh.thisDb().lookupObject
|
|
||||||
<
|
|
||||||
GAMGAgglomeration
|
|
||||||
>
|
|
||||||
(
|
(
|
||||||
GAMGAgglomeration::typeName
|
GAMGAgglomeration::typeName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (nbrAggPtr)
|
||||||
|
{
|
||||||
|
const GAMGAgglomeration& nbrAgg = *nbrAggPtr;
|
||||||
|
|
||||||
label nbrLevel(-1);
|
label nbrLevel(-1);
|
||||||
if (nbrAgg.size() > fineLevelIndex)
|
if (nbrAgg.size() > fineLevelIndex)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -187,19 +187,15 @@ Foam::label Foam::regionCoupledBase::neighbPatchID() const
|
|||||||
{
|
{
|
||||||
if (nbrPatchID_ == -1)
|
if (nbrPatchID_ == -1)
|
||||||
{
|
{
|
||||||
if
|
const polyMesh* meshPtr =
|
||||||
(
|
patch_.boundaryMesh().mesh().time().findObject<polyMesh>
|
||||||
patch_.boundaryMesh().mesh().time().foundObject<polyMesh>
|
|
||||||
(
|
(
|
||||||
nbrRegionName_
|
nbrRegionName_
|
||||||
)
|
);
|
||||||
)
|
|
||||||
|
if (meshPtr)
|
||||||
{
|
{
|
||||||
const polyMesh& mesh =
|
const polyMesh& mesh = *meshPtr;
|
||||||
patch_.boundaryMesh().mesh().time().lookupObject<polyMesh>
|
|
||||||
(
|
|
||||||
nbrRegionName_
|
|
||||||
);
|
|
||||||
|
|
||||||
nbrPatchID_ = mesh.boundaryMesh().findPatchID(nbrPatchName_);
|
nbrPatchID_ = mesh.boundaryMesh().findPatchID(nbrPatchName_);
|
||||||
|
|
||||||
|
|||||||
@ -205,8 +205,8 @@ Foam::searchableSurfaceCollection::searchableSurfaceCollection
|
|||||||
const word subGeomName(subDict.get<word>("surface"));
|
const word subGeomName(subDict.get<word>("surface"));
|
||||||
//Pout<< "Trying to find " << subGeomName << endl;
|
//Pout<< "Trying to find " << subGeomName << endl;
|
||||||
|
|
||||||
const searchableSurface& s =
|
searchableSurface& s =
|
||||||
io.db().lookupObject<searchableSurface>(subGeomName);
|
io.db().lookupObjectRef<searchableSurface>(subGeomName);
|
||||||
|
|
||||||
// I don't know yet how to handle the globalSize combined with
|
// I don't know yet how to handle the globalSize combined with
|
||||||
// regionOffset. Would cause non-consecutive indices locally
|
// regionOffset. Would cause non-consecutive indices locally
|
||||||
@ -218,7 +218,7 @@ Foam::searchableSurfaceCollection::searchableSurfaceCollection
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
subGeom_.set(surfI, &(const_cast<searchableSurface&>(s)));
|
subGeom_.set(surfI, &s);
|
||||||
|
|
||||||
indexOffset_[surfI] = startIndex;
|
indexOffset_[surfI] = startIndex;
|
||||||
startIndex += subGeom_[surfI].size();
|
startIndex += subGeom_[surfI].size();
|
||||||
|
|||||||
@ -189,7 +189,7 @@ Foam::searchableSurfaceWithGaps::searchableSurfaceWithGaps
|
|||||||
subGeom_.set
|
subGeom_.set
|
||||||
(
|
(
|
||||||
0,
|
0,
|
||||||
io.db().lookupObjectRefPtr<searchableSurface>(subGeomName)
|
io.db().getObjectPtr<searchableSurface>(subGeomName)
|
||||||
);
|
);
|
||||||
|
|
||||||
bounds() = subGeom_[0].bounds();
|
bounds() = subGeom_[0].bounds();
|
||||||
|
|||||||
@ -803,14 +803,15 @@ void Foam::triSurfaceMesh::getNormal
|
|||||||
|
|
||||||
void Foam::triSurfaceMesh::setField(const labelList& values)
|
void Foam::triSurfaceMesh::setField(const labelList& values)
|
||||||
{
|
{
|
||||||
|
auto* fldPtr = getObjectPtr<triSurfaceLabelField>("values");
|
||||||
|
|
||||||
if (foundObject<triSurfaceLabelField>("values"))
|
if (fldPtr)
|
||||||
{
|
{
|
||||||
lookupObjectRef<triSurfaceLabelField>("values").field() = values;
|
(*fldPtr).field() = values;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto fldPtr = autoPtr<triSurfaceLabelField>::New
|
fldPtr = new triSurfaceLabelField
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
@ -827,7 +828,7 @@ void Foam::triSurfaceMesh::setField(const labelList& values)
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Store field on triMesh
|
// Store field on triMesh
|
||||||
fldPtr.ptr()->store();
|
fldPtr->store();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -838,9 +839,11 @@ void Foam::triSurfaceMesh::getField
|
|||||||
labelList& values
|
labelList& values
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (foundObject<triSurfaceLabelField>("values"))
|
const auto* fldPtr = getObjectPtr<triSurfaceLabelField>("values");
|
||||||
|
|
||||||
|
if (fldPtr)
|
||||||
{
|
{
|
||||||
const auto& fld = lookupObject<triSurfaceLabelField>("values");
|
const auto& fld = *fldPtr;
|
||||||
|
|
||||||
values.setSize(info.size());
|
values.setSize(info.size());
|
||||||
|
|
||||||
|
|||||||
@ -84,24 +84,13 @@ void Foam::refinementHistoryConstraint::add
|
|||||||
List<labelPair>& explicitConnections
|
List<labelPair>& explicitConnections
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
autoPtr<const refinementHistory> storagePtr;
|
const refinementHistory* refPtr =
|
||||||
refinementHistory const* refPtr = nullptr;
|
mesh.findObject<refinementHistory>("refinementHistory");
|
||||||
|
|
||||||
if (mesh.foundObject<refinementHistory>("refinementHistory"))
|
autoPtr<const refinementHistory> storagePtr;
|
||||||
|
|
||||||
|
if (!refPtr)
|
||||||
{
|
{
|
||||||
if (decompositionConstraint::debug)
|
|
||||||
{
|
|
||||||
Info<< type() << " : found refinementHistory" << endl;
|
|
||||||
}
|
|
||||||
refPtr = &mesh.lookupObject<refinementHistory>("refinementHistory");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (decompositionConstraint::debug)
|
|
||||||
{
|
|
||||||
Info<< type() << " : reading refinementHistory from time "
|
|
||||||
<< mesh.facesInstance() << endl;
|
|
||||||
}
|
|
||||||
storagePtr.reset
|
storagePtr.reset
|
||||||
(
|
(
|
||||||
new refinementHistory
|
new refinementHistory
|
||||||
@ -120,6 +109,19 @@ void Foam::refinementHistoryConstraint::add
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (decompositionConstraint::debug)
|
||||||
|
{
|
||||||
|
if (refPtr)
|
||||||
|
{
|
||||||
|
Info<< type() << " : found refinementHistory" << nl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< type() << " : reading refinementHistory from time "
|
||||||
|
<< mesh.facesInstance() << nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const refinementHistory& history =
|
const refinementHistory& history =
|
||||||
(
|
(
|
||||||
storagePtr.valid()
|
storagePtr.valid()
|
||||||
@ -151,24 +153,13 @@ void Foam::refinementHistoryConstraint::apply
|
|||||||
labelList& decomposition
|
labelList& decomposition
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
autoPtr<const refinementHistory> storagePtr;
|
const refinementHistory* refPtr =
|
||||||
refinementHistory const* refPtr = nullptr;
|
mesh.findObject<refinementHistory>("refinementHistory");
|
||||||
|
|
||||||
if (mesh.foundObject<refinementHistory>("refinementHistory"))
|
autoPtr<const refinementHistory> storagePtr;
|
||||||
|
|
||||||
|
if (!refPtr)
|
||||||
{
|
{
|
||||||
//if (decompositionConstraint::debug)
|
|
||||||
//{
|
|
||||||
// Info<< type() << " : found refinementHistory" << endl;
|
|
||||||
//}
|
|
||||||
refPtr = &mesh.lookupObject<refinementHistory>("refinementHistory");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//if (decompositionConstraint::debug)
|
|
||||||
//{
|
|
||||||
// Info<< type() << " : reading refinementHistory from time "
|
|
||||||
// << mesh.facesInstance() << endl;
|
|
||||||
//}
|
|
||||||
storagePtr.reset
|
storagePtr.reset
|
||||||
(
|
(
|
||||||
new refinementHistory
|
new refinementHistory
|
||||||
|
|||||||
@ -808,7 +808,7 @@ Foam::distributedTriSurfaceMesh::independentlyDistributedBbs
|
|||||||
// here since we've only got Time and not a mesh.
|
// here since we've only got Time and not a mesh.
|
||||||
|
|
||||||
const auto* dictPtr =
|
const auto* dictPtr =
|
||||||
searchableSurface::time().lookupObjectPtr<IOdictionary>
|
searchableSurface::time().findObject<IOdictionary>
|
||||||
(
|
(
|
||||||
// == decompositionModel::canonicalName
|
// == decompositionModel::canonicalName
|
||||||
"decomposeParDict"
|
"decomposeParDict"
|
||||||
@ -1914,13 +1914,11 @@ void Foam::distributedTriSurfaceMesh::getField
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (foundObject<triSurfaceLabelField>("values"))
|
const auto* fldPtr = findObject<triSurfaceLabelField>("values");
|
||||||
{
|
|
||||||
const triSurfaceLabelField& fld = lookupObject<triSurfaceLabelField>
|
|
||||||
(
|
|
||||||
"values"
|
|
||||||
);
|
|
||||||
|
|
||||||
|
if (fldPtr)
|
||||||
|
{
|
||||||
|
const triSurfaceLabelField& fld = *fldPtr;
|
||||||
|
|
||||||
// Get query data (= local index of triangle)
|
// Get query data (= local index of triangle)
|
||||||
// ~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~
|
||||||
|
|||||||
@ -67,23 +67,19 @@ void Foam::energyRegionCoupledFvPatchScalarField::setMethod() const
|
|||||||
if (!nbrThermoPtr_)
|
if (!nbrThermoPtr_)
|
||||||
{
|
{
|
||||||
nbrThermoPtr_ =
|
nbrThermoPtr_ =
|
||||||
(
|
regionCoupledPatch_.nbrMesh().findObject<basicThermo>
|
||||||
®ionCoupledPatch_.nbrMesh().lookupObject<basicThermo>
|
|
||||||
(
|
(
|
||||||
basicThermo::dictName
|
basicThermo::dictName
|
||||||
)
|
);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!thermoPtr_)
|
if (!thermoPtr_)
|
||||||
{
|
{
|
||||||
thermoPtr_ =
|
thermoPtr_ =
|
||||||
(
|
this->db().findObject<basicThermo>
|
||||||
&this->db().lookupObject<basicThermo>
|
|
||||||
(
|
(
|
||||||
basicThermo::dictName
|
basicThermo::dictName
|
||||||
)
|
);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -123,35 +123,37 @@ void Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::updateCoeffs()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef regionModels::surfaceFilmModels::surfaceFilmRegionModel
|
// Film model
|
||||||
filmModelType;
|
const auto* filmModelPtr = db().time().findObject
|
||||||
|
<regionModels::surfaceFilmModels::surfaceFilmRegionModel>
|
||||||
|
(filmRegionName_);
|
||||||
|
|
||||||
|
// Pyrolysis model
|
||||||
|
const auto* pyrModelPtr = db().time().findObject
|
||||||
|
<regionModels::pyrolysisModels::pyrolysisModel>
|
||||||
|
(pyrolysisRegionName_);
|
||||||
|
|
||||||
|
if (!filmModelPtr || !pyrModelPtr)
|
||||||
|
{
|
||||||
|
// Do nothing on construction - film model doesn't exist yet
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto& filmModel = *filmModelPtr;
|
||||||
|
const auto& pyrModel = *pyrModelPtr;
|
||||||
|
|
||||||
typedef regionModels::pyrolysisModels::pyrolysisModel pyrModelType;
|
|
||||||
|
|
||||||
// Since we're inside initEvaluate/evaluate there might be processor
|
// Since we're inside initEvaluate/evaluate there might be processor
|
||||||
// comms underway. Change the tag we use.
|
// comms underway. Change the tag we use.
|
||||||
int oldTag = UPstream::msgType();
|
int oldTag = UPstream::msgType();
|
||||||
UPstream::msgType() = oldTag+1;
|
UPstream::msgType() = oldTag+1;
|
||||||
|
|
||||||
bool filmOk = db().time().foundObject<filmModelType>(filmRegionName_);
|
|
||||||
|
|
||||||
|
|
||||||
bool pyrOk = db().time().foundObject<pyrModelType>(pyrolysisRegionName_);
|
|
||||||
|
|
||||||
if (!filmOk || !pyrOk)
|
|
||||||
{
|
|
||||||
// Do nothing on construction - film model doesn't exist yet
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
scalarField& Tp = *this;
|
scalarField& Tp = *this;
|
||||||
|
|
||||||
const label patchi = patch().index();
|
const label patchi = patch().index();
|
||||||
|
|
||||||
// Retrieve film model
|
// The film model
|
||||||
const filmModelType& filmModel =
|
|
||||||
db().time().lookupObject<filmModelType>(filmRegionName_);
|
|
||||||
|
|
||||||
const label filmPatchi = filmModel.regionPatchID(patchi);
|
const label filmPatchi = filmModel.regionPatchID(patchi);
|
||||||
|
|
||||||
scalarField alphaFilm = filmModel.alpha().boundaryField()[filmPatchi];
|
scalarField alphaFilm = filmModel.alpha().boundaryField()[filmPatchi];
|
||||||
@ -160,10 +162,7 @@ void Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::updateCoeffs()
|
|||||||
scalarField TFilm = filmModel.Ts().boundaryField()[filmPatchi];
|
scalarField TFilm = filmModel.Ts().boundaryField()[filmPatchi];
|
||||||
filmModel.toPrimary(filmPatchi, TFilm);
|
filmModel.toPrimary(filmPatchi, TFilm);
|
||||||
|
|
||||||
// Retrieve pyrolysis model
|
// The pyrolysis model
|
||||||
const pyrModelType& pyrModel =
|
|
||||||
db().time().lookupObject<pyrModelType>(pyrolysisRegionName_);
|
|
||||||
|
|
||||||
const label pyrPatchi = pyrModel.regionPatchID(patchi);
|
const label pyrPatchi = pyrModel.regionPatchID(patchi);
|
||||||
|
|
||||||
scalarField TPyr = pyrModel.T().boundaryField()[pyrPatchi];
|
scalarField TPyr = pyrModel.T().boundaryField()[pyrPatchi];
|
||||||
|
|||||||
@ -123,35 +123,38 @@ void Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::updateCoeffs()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef regionModels::surfaceFilmModels::surfaceFilmRegionModel
|
// Film model
|
||||||
filmModelType;
|
const auto* filmModelPtr = db().time().findObject
|
||||||
|
<regionModels::surfaceFilmModels::surfaceFilmRegionModel>
|
||||||
|
(filmRegionName_);
|
||||||
|
|
||||||
|
// Pyrolysis model
|
||||||
|
const auto* pyrModelPtr = db().time().findObject
|
||||||
|
<regionModels::pyrolysisModels::pyrolysisModel>
|
||||||
|
(pyrolysisRegionName_);
|
||||||
|
|
||||||
|
|
||||||
|
if (!filmModelPtr || !pyrModelPtr)
|
||||||
|
{
|
||||||
|
// Do nothing on construction - film model doesn't exist yet
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto& filmModel = *filmModelPtr;
|
||||||
|
const auto& pyrModel = *pyrModelPtr;
|
||||||
|
|
||||||
typedef regionModels::pyrolysisModels::pyrolysisModel pyrModelType;
|
|
||||||
|
|
||||||
// Since we're inside initEvaluate/evaluate there might be processor
|
// Since we're inside initEvaluate/evaluate there might be processor
|
||||||
// comms underway. Change the tag we use.
|
// comms underway. Change the tag we use.
|
||||||
int oldTag = UPstream::msgType();
|
int oldTag = UPstream::msgType();
|
||||||
UPstream::msgType() = oldTag+1;
|
UPstream::msgType() = oldTag+1;
|
||||||
|
|
||||||
bool foundFilm = db().time().foundObject<filmModelType>(filmRegionName_);
|
|
||||||
|
|
||||||
bool foundPyrolysis =
|
|
||||||
db().time().foundObject<pyrModelType>(pyrolysisRegionName_);
|
|
||||||
|
|
||||||
if (!foundFilm || !foundPyrolysis)
|
|
||||||
{
|
|
||||||
// Do nothing on construction - film model doesn't exist yet
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
vectorField& Up = *this;
|
vectorField& Up = *this;
|
||||||
|
|
||||||
const label patchi = patch().index();
|
const label patchi = patch().index();
|
||||||
|
|
||||||
// Retrieve film model
|
// The film model
|
||||||
const filmModelType& filmModel =
|
|
||||||
db().time().lookupObject<filmModelType>(filmRegionName_);
|
|
||||||
|
|
||||||
const label filmPatchi = filmModel.regionPatchID(patchi);
|
const label filmPatchi = filmModel.regionPatchID(patchi);
|
||||||
|
|
||||||
scalarField alphaFilm = filmModel.alpha().boundaryField()[filmPatchi];
|
scalarField alphaFilm = filmModel.alpha().boundaryField()[filmPatchi];
|
||||||
@ -160,10 +163,7 @@ void Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::updateCoeffs()
|
|||||||
vectorField UFilm = filmModel.Us().boundaryField()[filmPatchi];
|
vectorField UFilm = filmModel.Us().boundaryField()[filmPatchi];
|
||||||
filmModel.toPrimary(filmPatchi, UFilm);
|
filmModel.toPrimary(filmPatchi, UFilm);
|
||||||
|
|
||||||
// Retrieve pyrolysis model
|
// The pyrolysis model
|
||||||
const pyrModelType& pyrModel =
|
|
||||||
db().time().lookupObject<pyrModelType>(pyrolysisRegionName_);
|
|
||||||
|
|
||||||
const label pyrPatchi = pyrModel.regionPatchID(patchi);
|
const label pyrPatchi = pyrModel.regionPatchID(patchi);
|
||||||
|
|
||||||
scalarField phiPyr = pyrModel.phiGas().boundaryField()[pyrPatchi];
|
scalarField phiPyr = pyrModel.phiGas().boundaryField()[pyrPatchi];
|
||||||
|
|||||||
@ -60,14 +60,16 @@ inline const Foam::word& Foam::regionModels::regionModel::modelName() const
|
|||||||
|
|
||||||
inline const Foam::fvMesh& Foam::regionModels::regionModel::regionMesh() const
|
inline const Foam::fvMesh& Foam::regionModels::regionModel::regionMesh() const
|
||||||
{
|
{
|
||||||
if (time_.foundObject<fvMesh>(regionName_))
|
const fvMesh* regionPtr = time_.findObject<fvMesh>(regionName_);
|
||||||
|
|
||||||
|
if (regionPtr)
|
||||||
{
|
{
|
||||||
return time_.lookupObject<fvMesh>(regionName_);
|
return *regionPtr;
|
||||||
}
|
}
|
||||||
else if (!regionMeshPtr_.valid())
|
else if (!regionMeshPtr_.valid())
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Region mesh not available" << abort(FatalError);
|
<< "Region mesh not available" << abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
return *regionMeshPtr_;
|
return *regionMeshPtr_;
|
||||||
@ -76,17 +78,16 @@ inline const Foam::fvMesh& Foam::regionModels::regionModel::regionMesh() const
|
|||||||
|
|
||||||
inline Foam::fvMesh& Foam::regionModels::regionModel::regionMesh()
|
inline Foam::fvMesh& Foam::regionModels::regionModel::regionMesh()
|
||||||
{
|
{
|
||||||
if (time_.foundObject<fvMesh>(regionName_))
|
fvMesh* regionPtr = time_.getObjectPtr<fvMesh>(regionName_);
|
||||||
|
|
||||||
|
if (regionPtr)
|
||||||
{
|
{
|
||||||
return const_cast<fvMesh&>
|
return *regionPtr;
|
||||||
(
|
|
||||||
time_.lookupObject<fvMesh>(regionName_)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else if (!regionMeshPtr_.valid())
|
else if (!regionMeshPtr_.valid())
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Region mesh not available" << abort(FatalError);
|
<< "Region mesh not available" << abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
return *regionMeshPtr_;
|
return *regionMeshPtr_;
|
||||||
|
|||||||
@ -87,15 +87,7 @@ Foam::regionModels::regionModel::mapRegionPatchField
|
|||||||
{
|
{
|
||||||
const polyPatch& p = regionMesh().boundaryMesh()[regionPatchi];
|
const polyPatch& p = regionMesh().boundaryMesh()[regionPatchi];
|
||||||
|
|
||||||
return
|
return tmp<Field<Type>>::New(p.size(), Zero);
|
||||||
tmp<Field<Type>>
|
|
||||||
(
|
|
||||||
new Field<Type>
|
|
||||||
(
|
|
||||||
p.size(),
|
|
||||||
Zero
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,15 +135,7 @@ Foam::regionModels::regionModel::mapRegionPatchInternalField
|
|||||||
{
|
{
|
||||||
const polyPatch& p = regionMesh().boundaryMesh()[regionPatchi];
|
const polyPatch& p = regionMesh().boundaryMesh()[regionPatchi];
|
||||||
|
|
||||||
return
|
return tmp<Field<Type>>::New(p.size(), Zero);
|
||||||
tmp<Field<Type>>
|
|
||||||
(
|
|
||||||
new Field<Type>
|
|
||||||
(
|
|
||||||
p.size(),
|
|
||||||
Zero
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -142,27 +142,27 @@ void alphatFilmWallFunctionFvPatchScalarField::updateCoeffs()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef regionModels::surfaceFilmModels::surfaceFilmRegionModel modelType;
|
const auto* filmModelPtr = db().time().findObject
|
||||||
|
<regionModels::surfaceFilmModels::surfaceFilmRegionModel>
|
||||||
|
(filmRegionName_);
|
||||||
|
|
||||||
|
if (!filmModelPtr)
|
||||||
|
{
|
||||||
|
// Do nothing on construction - film model doesn't exist yet
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto& filmModel = *filmModelPtr;
|
||||||
|
|
||||||
|
|
||||||
// Since we're inside initEvaluate/evaluate there might be processor
|
// Since we're inside initEvaluate/evaluate there might be processor
|
||||||
// comms underway. Change the tag we use.
|
// comms underway. Change the tag we use.
|
||||||
int oldTag = UPstream::msgType();
|
int oldTag = UPstream::msgType();
|
||||||
UPstream::msgType() = oldTag+1;
|
UPstream::msgType() = oldTag+1;
|
||||||
|
|
||||||
bool foundFilm = db().time().foundObject<modelType>(filmRegionName_);
|
|
||||||
|
|
||||||
if (!foundFilm)
|
|
||||||
{
|
|
||||||
// Do nothing on construction - film model doesn't exist yet
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const label patchi = patch().index();
|
const label patchi = patch().index();
|
||||||
|
|
||||||
// Retrieve phase change mass from surface film model
|
// Retrieve phase change mass from surface film model
|
||||||
const modelType& filmModel =
|
|
||||||
db().time().lookupObject<modelType>(filmRegionName_);
|
|
||||||
|
|
||||||
const label filmPatchi = filmModel.regionPatchID(patchi);
|
const label filmPatchi = filmModel.regionPatchID(patchi);
|
||||||
|
|
||||||
tmp<volScalarField> mDotFilm(filmModel.primaryMassTrans());
|
tmp<volScalarField> mDotFilm(filmModel.primaryMassTrans());
|
||||||
|
|||||||
@ -48,14 +48,14 @@ tmp<scalarField> nutkFilmWallFunctionFvPatchScalarField::calcUTau
|
|||||||
const scalarField& magGradU
|
const scalarField& magGradU
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
tmp<scalarField> tuTau(new scalarField(patch().size(), 0.0));
|
tmp<scalarField> tuTau(new scalarField(patch().size(), Zero));
|
||||||
scalarField& uTau = tuTau.ref();
|
scalarField& uTau = tuTau.ref();
|
||||||
|
|
||||||
typedef regionModels::surfaceFilmModels::surfaceFilmRegionModel modelType;
|
const auto* filmModelPtr = db().time().findObject
|
||||||
|
<regionModels::surfaceFilmModels::surfaceFilmRegionModel>
|
||||||
|
(filmRegionName_);
|
||||||
|
|
||||||
bool foundFilm = db().time().foundObject<modelType>(filmRegionName_);
|
if (!filmModelPtr)
|
||||||
|
|
||||||
if (!foundFilm)
|
|
||||||
{
|
{
|
||||||
// Do nothing on construction - film model doesn't exist yet
|
// Do nothing on construction - film model doesn't exist yet
|
||||||
return tuTau;
|
return tuTau;
|
||||||
@ -64,8 +64,7 @@ tmp<scalarField> nutkFilmWallFunctionFvPatchScalarField::calcUTau
|
|||||||
const label patchi = patch().index();
|
const label patchi = patch().index();
|
||||||
|
|
||||||
// Retrieve phase change mass from surface film model
|
// Retrieve phase change mass from surface film model
|
||||||
const modelType& filmModel =
|
const auto& filmModel = *filmModelPtr;
|
||||||
db().time().lookupObject<modelType>(filmRegionName_);
|
|
||||||
|
|
||||||
const label filmPatchi = filmModel.regionPatchID(patchi);
|
const label filmPatchi = filmModel.regionPatchID(patchi);
|
||||||
|
|
||||||
|
|||||||
@ -78,19 +78,23 @@ void liquidFilmThermo::initLiquid(const dictionary& dict)
|
|||||||
|
|
||||||
dict.readEntry("liquid", name_);
|
dict.readEntry("liquid", name_);
|
||||||
|
|
||||||
if (filmModel_.primaryMesh().foundObject<SLGThermo>("SLGThermo"))
|
const SLGThermo* thermoPtr =
|
||||||
|
filmModel_.primaryMesh().findObject<SLGThermo>("SLGThermo");
|
||||||
|
|
||||||
|
if (thermoPtr)
|
||||||
{
|
{
|
||||||
// retrieve from film thermo
|
// Retrieve from film thermo
|
||||||
ownLiquid_ = false;
|
ownLiquid_ = false;
|
||||||
|
|
||||||
const SLGThermo& thermo =
|
const SLGThermo& thermo = *thermoPtr;
|
||||||
filmModel_.primaryMesh().lookupObject<SLGThermo>("SLGThermo");
|
|
||||||
label id = thermo.liquidId(name_);
|
const label id = thermo.liquidId(name_);
|
||||||
|
|
||||||
liquidPtr_ = &thermo.liquids().properties()[id];
|
liquidPtr_ = &thermo.liquids().properties()[id];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// new liquid create
|
// New liquid create
|
||||||
ownLiquid_ = true;
|
ownLiquid_ = true;
|
||||||
|
|
||||||
liquidPtr_ =
|
liquidPtr_ =
|
||||||
|
|||||||
@ -52,27 +52,22 @@ void Foam::sampledIsoSurface::getIsoFields() const
|
|||||||
// Get volField
|
// Get volField
|
||||||
// ~~~~~~~~~~~~
|
// ~~~~~~~~~~~~
|
||||||
|
|
||||||
if (fvm.foundObject<volScalarField>(isoField_))
|
volFieldPtr_ = fvm.getObjectPtr<volScalarField>(isoField_);
|
||||||
|
|
||||||
|
if (volFieldPtr_)
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInFunction
|
||||||
{
|
<< "Lookup volField " << isoField_ << endl;
|
||||||
InfoInFunction
|
|
||||||
<< "Lookup volField " << isoField_ << endl;
|
|
||||||
}
|
|
||||||
storedVolFieldPtr_.clear();
|
storedVolFieldPtr_.clear();
|
||||||
volFieldPtr_ = &fvm.lookupObject<volScalarField>(isoField_);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Bit of a hack. Read field and store.
|
// Bit of a hack. Read field and store.
|
||||||
|
|
||||||
if (debug)
|
DebugInFunction
|
||||||
{
|
<< "Checking " << isoField_
|
||||||
InfoInFunction
|
<< " for same time " << fvm.time().timeName() << endl;
|
||||||
<< "Checking " << isoField_
|
|
||||||
<< " for same time " << fvm.time().timeName()
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
@ -80,13 +75,9 @@ void Foam::sampledIsoSurface::getIsoFields() const
|
|||||||
|| (fvm.time().timeName() != storedVolFieldPtr_().instance())
|
|| (fvm.time().timeName() != storedVolFieldPtr_().instance())
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInFunction
|
||||||
{
|
<< "Reading volField " << isoField_
|
||||||
InfoInFunction
|
<< " from time " << fvm.time().timeName() << endl;
|
||||||
<< "Reading volField " << isoField_
|
|
||||||
<< " from time " << fvm.time().timeName()
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
IOobject vfHeader
|
IOobject vfHeader
|
||||||
(
|
(
|
||||||
@ -141,61 +132,45 @@ void Foam::sampledIsoSurface::getIsoFields() const
|
|||||||
+ isoField_
|
+ isoField_
|
||||||
+ ')';
|
+ ')';
|
||||||
|
|
||||||
if (fvm.foundObject<pointScalarField>(pointFldName))
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
InfoInFunction
|
|
||||||
<< "lookup pointField " << pointFldName << endl;
|
|
||||||
}
|
|
||||||
const pointScalarField& pfld = fvm.lookupObject<pointScalarField>
|
|
||||||
(
|
|
||||||
pointFldName
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!pfld.upToDate(*volFieldPtr_))
|
pointFieldPtr_ = fvm.getObjectPtr<pointScalarField>(pointFldName);
|
||||||
|
|
||||||
|
if (pointFieldPtr_)
|
||||||
|
{
|
||||||
|
DebugInFunction
|
||||||
|
<< "lookup pointField " << pointFldName << endl;
|
||||||
|
|
||||||
|
if (!pointFieldPtr_->upToDate(*volFieldPtr_))
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInFunction
|
||||||
{
|
<< "updating pointField " << pointFldName << endl;
|
||||||
InfoInFunction
|
|
||||||
<< "updating pointField "
|
|
||||||
<< pointFldName << endl;
|
|
||||||
}
|
|
||||||
// Update the interpolated value
|
// Update the interpolated value
|
||||||
volPointInterpolation::New(fvm).interpolate
|
volPointInterpolation::New(fvm).interpolate
|
||||||
(
|
(
|
||||||
*volFieldPtr_,
|
*volFieldPtr_,
|
||||||
const_cast<pointScalarField&>(pfld)
|
const_cast<pointScalarField&>(*pointFieldPtr_)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pointFieldPtr_ = &pfld;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Not in registry. Interpolate.
|
// Not in registry. Interpolate.
|
||||||
|
|
||||||
if (debug)
|
DebugInFunction
|
||||||
{
|
<< "creating pointField " << pointFldName << endl;
|
||||||
InfoInFunction
|
|
||||||
<< "Checking pointField " << pointFldName
|
|
||||||
<< " for same time " << fvm.time().timeName()
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Interpolate without cache. Note that we're registering it
|
// Interpolate without cache. Note that we're registering it
|
||||||
// below so next time round it goes into the condition
|
// below so next time round it goes into the condition
|
||||||
// above.
|
// above.
|
||||||
tmp<pointScalarField> tpfld
|
pointFieldPtr_ =
|
||||||
(
|
|
||||||
volPointInterpolation::New(fvm).interpolate
|
volPointInterpolation::New(fvm).interpolate
|
||||||
(
|
(
|
||||||
*volFieldPtr_,
|
*volFieldPtr_,
|
||||||
pointFldName,
|
pointFldName,
|
||||||
false
|
false
|
||||||
)
|
).ptr();
|
||||||
);
|
|
||||||
pointFieldPtr_ = tpfld.ptr();
|
|
||||||
const_cast<pointScalarField*>(pointFieldPtr_)->store();
|
const_cast<pointScalarField*>(pointFieldPtr_)->store();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,17 +187,13 @@ void Foam::sampledIsoSurface::getIsoFields() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (debug)
|
DebugInFunction
|
||||||
{
|
<< "volField " << volFieldPtr_->name()
|
||||||
InfoInFunction
|
<< " min:" << min(*volFieldPtr_).value()
|
||||||
<< "volField " << volFieldPtr_->name()
|
<< " max:" << max(*volFieldPtr_).value() << nl
|
||||||
<< " min:" << min(*volFieldPtr_).value()
|
<< "pointField " << pointFieldPtr_->name()
|
||||||
<< " max:" << max(*volFieldPtr_).value() << endl;
|
<< " min:" << gMin(pointFieldPtr_->primitiveField())
|
||||||
InfoInFunction
|
<< " max:" << gMax(pointFieldPtr_->primitiveField()) << endl;
|
||||||
<< "pointField " << pointFieldPtr_->name()
|
|
||||||
<< " min:" << gMin(pointFieldPtr_->primitiveField())
|
|
||||||
<< " max:" << gMax(pointFieldPtr_->primitiveField()) << endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -231,24 +202,20 @@ void Foam::sampledIsoSurface::getIsoFields() const
|
|||||||
|
|
||||||
// Either lookup on the submesh or subset the whole-mesh volField
|
// Either lookup on the submesh or subset the whole-mesh volField
|
||||||
|
|
||||||
if (subFvm.foundObject<volScalarField>(isoField_))
|
volSubFieldPtr_ = subFvm.getObjectPtr<volScalarField>(isoField_);
|
||||||
|
|
||||||
|
if (volSubFieldPtr_)
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInFunction
|
||||||
{
|
<< "Sub-mesh lookup volField " << isoField_ << endl;
|
||||||
InfoInFunction
|
|
||||||
<< "Sub-mesh lookup volField "
|
|
||||||
<< isoField_ << endl;
|
|
||||||
}
|
|
||||||
storedVolSubFieldPtr_.clear();
|
storedVolSubFieldPtr_.clear();
|
||||||
volSubFieldPtr_ = &subFvm.lookupObject<volScalarField>(isoField_);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInFunction
|
||||||
{
|
<< "Sub-setting volField " << isoField_ << endl;
|
||||||
InfoInFunction
|
|
||||||
<< "Sub-setting volField " << isoField_ << endl;
|
|
||||||
}
|
|
||||||
storedVolSubFieldPtr_.reset
|
storedVolSubFieldPtr_.reset
|
||||||
(
|
(
|
||||||
subMeshPtr_().interpolate
|
subMeshPtr_().interpolate
|
||||||
@ -270,53 +237,40 @@ void Foam::sampledIsoSurface::getIsoFields() const
|
|||||||
+ volSubFieldPtr_->name()
|
+ volSubFieldPtr_->name()
|
||||||
+ ')';
|
+ ')';
|
||||||
|
|
||||||
if (subFvm.foundObject<pointScalarField>(pointFldName))
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
InfoInFunction
|
|
||||||
<< "Sub-mesh lookup pointField " << pointFldName << endl;
|
|
||||||
}
|
|
||||||
const pointScalarField& pfld = subFvm.lookupObject<pointScalarField>
|
|
||||||
(
|
|
||||||
pointFldName
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!pfld.upToDate(*volSubFieldPtr_))
|
pointFieldPtr_ = subFvm.getObjectPtr<pointScalarField>(pointFldName);
|
||||||
|
|
||||||
|
if (pointFieldPtr_)
|
||||||
|
{
|
||||||
|
DebugInFunction
|
||||||
|
<< "Sub-mesh lookup pointField " << pointFldName << endl;
|
||||||
|
|
||||||
|
if (!pointFieldPtr_->upToDate(*volSubFieldPtr_))
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInFunction
|
||||||
{
|
<< "Updating submesh pointField " << pointFldName << endl;
|
||||||
Info<< "sampledIsoSurface::getIsoFields() :"
|
|
||||||
<< " updating submesh pointField "
|
|
||||||
<< pointFldName << endl;
|
|
||||||
}
|
|
||||||
// Update the interpolated value
|
// Update the interpolated value
|
||||||
volPointInterpolation::New(subFvm).interpolate
|
volPointInterpolation::New(subFvm).interpolate
|
||||||
(
|
(
|
||||||
*volSubFieldPtr_,
|
*volSubFieldPtr_,
|
||||||
const_cast<pointScalarField&>(pfld)
|
const_cast<pointScalarField&>(*pointFieldPtr_)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pointFieldPtr_ = &pfld;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInFunction
|
||||||
{
|
<< "Interpolating submesh volField "
|
||||||
InfoInFunction
|
<< volSubFieldPtr_->name()
|
||||||
<< "Interpolating submesh volField "
|
<< " to get submesh pointField " << pointFldName << endl;
|
||||||
<< volSubFieldPtr_->name()
|
|
||||||
<< " to get submesh pointField " << pointFldName << endl;
|
pointSubFieldPtr_ =
|
||||||
}
|
|
||||||
tmp<pointScalarField> tpfld
|
|
||||||
(
|
|
||||||
volPointInterpolation::New
|
volPointInterpolation::New
|
||||||
(
|
(
|
||||||
subFvm
|
subFvm
|
||||||
).interpolate(*volSubFieldPtr_)
|
).interpolate(*volSubFieldPtr_).ptr();
|
||||||
);
|
|
||||||
pointSubFieldPtr_ = tpfld.ptr();
|
|
||||||
const_cast<pointScalarField*>(pointSubFieldPtr_)->store();
|
const_cast<pointScalarField*>(pointSubFieldPtr_)->store();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,19 +287,15 @@ void Foam::sampledIsoSurface::getIsoFields() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (debug)
|
DebugInFunction
|
||||||
{
|
<< "volSubField "
|
||||||
InfoInFunction
|
<< volSubFieldPtr_->name()
|
||||||
<< "volSubField "
|
<< " min:" << min(*volSubFieldPtr_).value()
|
||||||
<< volSubFieldPtr_->name()
|
<< " max:" << max(*volSubFieldPtr_).value() << nl
|
||||||
<< " min:" << min(*volSubFieldPtr_).value()
|
<< "pointSubField "
|
||||||
<< " max:" << max(*volSubFieldPtr_).value() << endl;
|
<< pointSubFieldPtr_->name()
|
||||||
InfoInFunction
|
<< " min:" << gMin(pointSubFieldPtr_->primitiveField())
|
||||||
<< "pointSubField "
|
<< " max:" << gMax(pointSubFieldPtr_->primitiveField()) << endl;
|
||||||
<< pointSubFieldPtr_->name()
|
|
||||||
<< " min:" << gMin(pointSubFieldPtr_->primitiveField())
|
|
||||||
<< " max:" << gMax(pointSubFieldPtr_->primitiveField()) << endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -64,7 +64,7 @@ bool Foam::sampledIsoSurfaceCell::updateGeometry() const
|
|||||||
|
|
||||||
// Use field from database, or try to read it in
|
// Use field from database, or try to read it in
|
||||||
|
|
||||||
const auto* cellFldPtr = fvm.lookupObjectPtr<volScalarField>(isoField_);
|
const auto* cellFldPtr = fvm.findObject<volScalarField>(isoField_);
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -61,7 +61,7 @@ bool Foam::sampledThresholdCellFaces::updateGeometry() const
|
|||||||
|
|
||||||
// Use volField from database, or try to read it in
|
// Use volField from database, or try to read it in
|
||||||
|
|
||||||
const auto* cellFldPtr = fvm.lookupObjectPtr<volScalarField>(fieldName_);
|
const auto* cellFldPtr = fvm.findObject<volScalarField>(fieldName_);
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -53,7 +53,7 @@ bool Foam::surfMeshSampleDistanceSurface::sampleType
|
|||||||
{
|
{
|
||||||
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
||||||
|
|
||||||
const auto* volFldPtr = mesh().lookupObjectPtr<VolFieldType>(fieldName);
|
const auto* volFldPtr = mesh().findObject<VolFieldType>(fieldName);
|
||||||
|
|
||||||
if (!volFldPtr)
|
if (!volFldPtr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -53,7 +53,7 @@ bool Foam::surfMeshSamplePlane::sampleType
|
|||||||
{
|
{
|
||||||
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
||||||
|
|
||||||
const auto* volFldPtr = mesh().lookupObjectPtr<VolFieldType>(fieldName);
|
const auto* volFldPtr = mesh().findObject<VolFieldType>(fieldName);
|
||||||
|
|
||||||
if (!volFldPtr)
|
if (!volFldPtr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -76,7 +76,7 @@ Foam::surfMeshSample::getOrCreateSurfField
|
|||||||
const surfMesh& surf = surface();
|
const surfMesh& surf = surface();
|
||||||
const word& fieldName = vField.name();
|
const word& fieldName = vField.name();
|
||||||
|
|
||||||
SurfFieldType* ptr = surf.lookupObjectRefPtr<SurfFieldType>(fieldName);
|
SurfFieldType* ptr = surf.getObjectPtr<SurfFieldType>(fieldName);
|
||||||
if (!ptr)
|
if (!ptr)
|
||||||
{
|
{
|
||||||
ptr = new SurfFieldType
|
ptr = new SurfFieldType
|
||||||
|
|||||||
@ -109,7 +109,7 @@ bool Foam::surfMeshSamplers::add_rhoU(const word& derivedName)
|
|||||||
|
|
||||||
// rhoU = rho * U
|
// rhoU = rho * U
|
||||||
|
|
||||||
const auto* rhoPtr = mesh_.lookupObjectPtr<volScalarField>("rho");
|
const auto* rhoPtr = mesh_.findObject<volScalarField>("rho");
|
||||||
const volVectorField& U = mesh_.lookupObject<volVectorField>("U");
|
const volVectorField& U = mesh_.lookupObject<volVectorField>("U");
|
||||||
|
|
||||||
tmp<volVectorField> tresult;
|
tmp<volVectorField> tresult;
|
||||||
@ -152,7 +152,7 @@ bool Foam::surfMeshSamplers::add_pTotal(const word& derivedName)
|
|||||||
|
|
||||||
// pTotal = p + rho * U^2 / 2
|
// pTotal = p + rho * U^2 / 2
|
||||||
|
|
||||||
const auto* rhoPtr = mesh_.lookupObjectPtr<volScalarField>("rho");
|
const auto* rhoPtr = mesh_.findObject<volScalarField>("rho");
|
||||||
const volScalarField& p = mesh_.lookupObject<volScalarField>("p");
|
const volScalarField& p = mesh_.lookupObject<volScalarField>("p");
|
||||||
const volVectorField& U = mesh_.lookupObject<volVectorField>("U");
|
const volVectorField& U = mesh_.lookupObject<volVectorField>("U");
|
||||||
|
|
||||||
|
|||||||
@ -60,7 +60,7 @@ bool Foam::surfMeshSampleDiscrete::sampleType
|
|||||||
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
||||||
|
|
||||||
const auto* volFldPtr =
|
const auto* volFldPtr =
|
||||||
SurfaceSource::mesh().lookupObjectPtr<VolFieldType>(fieldName);
|
SurfaceSource::mesh().findObject<VolFieldType>(fieldName);
|
||||||
|
|
||||||
if (!volFldPtr)
|
if (!volFldPtr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -40,7 +40,7 @@ bool Foam::discreteSurface::sampleType
|
|||||||
typedef DimensionedField<Type, surfGeoMesh> SurfFieldType;
|
typedef DimensionedField<Type, surfGeoMesh> SurfFieldType;
|
||||||
typedef IOField<Type> TmpFieldType;
|
typedef IOField<Type> TmpFieldType;
|
||||||
|
|
||||||
const auto* volFldPtr = mesh().lookupObjectPtr<VolFieldType>(fieldName);
|
const auto* volFldPtr = mesh().findObject<VolFieldType>(fieldName);
|
||||||
|
|
||||||
if (!volFldPtr)
|
if (!volFldPtr)
|
||||||
{
|
{
|
||||||
@ -57,7 +57,7 @@ bool Foam::discreteSurface::sampleType
|
|||||||
{
|
{
|
||||||
const surfMesh& surf = dynamicCast<const surfMesh>(obr);
|
const surfMesh& surf = dynamicCast<const surfMesh>(obr);
|
||||||
|
|
||||||
SurfFieldType* ptr = surf.lookupObjectRefPtr<SurfFieldType>(fieldName);
|
SurfFieldType* ptr = surf.getObjectPtr<SurfFieldType>(fieldName);
|
||||||
if (!ptr)
|
if (!ptr)
|
||||||
{
|
{
|
||||||
// Doesn't exist or the wrong type
|
// Doesn't exist or the wrong type
|
||||||
@ -83,7 +83,7 @@ bool Foam::discreteSurface::sampleType
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TmpFieldType* ptr = obr.lookupObjectRefPtr<TmpFieldType>(fieldName);
|
TmpFieldType* ptr = obr.getObjectPtr<TmpFieldType>(fieldName);
|
||||||
if (!ptr)
|
if (!ptr)
|
||||||
{
|
{
|
||||||
// Doesn't exist or the wrong type
|
// Doesn't exist or the wrong type
|
||||||
@ -121,7 +121,7 @@ Foam::discreteSurface::sampleType
|
|||||||
{
|
{
|
||||||
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
||||||
|
|
||||||
const auto* volFldPtr = mesh().lookupObjectPtr<VolFieldType>(fieldName);
|
const auto* volFldPtr = mesh().findObject<VolFieldType>(fieldName);
|
||||||
|
|
||||||
if (volFldPtr)
|
if (volFldPtr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -165,7 +165,7 @@ void uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs()
|
|||||||
if (db().foundObject<uniformDimensionedVectorField>("g"))
|
if (db().foundObject<uniformDimensionedVectorField>("g"))
|
||||||
{
|
{
|
||||||
uniformDimensionedVectorField g =
|
uniformDimensionedVectorField g =
|
||||||
db().lookupObject<uniformDimensionedVectorField>("g");
|
db().lookupObject<uniformDimensionedVectorField>("g");
|
||||||
|
|
||||||
gravity = g.value();
|
gravity = g.value();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -147,7 +147,7 @@ bool Foam::fileFormats::VTKsurfaceFormat<Face>::read
|
|||||||
for (auto fieldName : { "region", "STLSolidLabeling" })
|
for (auto fieldName : { "region", "STLSolidLabeling" })
|
||||||
{
|
{
|
||||||
const labelIOField* lptr =
|
const labelIOField* lptr =
|
||||||
reader.cellData().lookupObjectPtr<labelIOField>(fieldName);
|
reader.cellData().findObject<labelIOField>(fieldName);
|
||||||
|
|
||||||
if (lptr)
|
if (lptr)
|
||||||
{
|
{
|
||||||
@ -160,7 +160,7 @@ bool Foam::fileFormats::VTKsurfaceFormat<Face>::read
|
|||||||
}
|
}
|
||||||
|
|
||||||
const scalarIOField* sptr =
|
const scalarIOField* sptr =
|
||||||
reader.cellData().lookupObjectPtr<scalarIOField>(fieldName);
|
reader.cellData().findObject<scalarIOField>(fieldName);
|
||||||
|
|
||||||
if (sptr)
|
if (sptr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -130,37 +130,31 @@ Foam::volScalarField& Foam::basicThermo::lookupOrConstruct
|
|||||||
bool& isOwner
|
bool& isOwner
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const volScalarField* p =
|
volScalarField* ptr =
|
||||||
mesh.objectRegistry::lookupObjectPtr<volScalarField>(name);
|
mesh.objectRegistry::getObjectPtr<volScalarField>(name);
|
||||||
|
|
||||||
isOwner = !p;
|
isOwner = !ptr;
|
||||||
|
|
||||||
if (!p)
|
if (!ptr)
|
||||||
{
|
{
|
||||||
volScalarField* fPtr
|
ptr = new volScalarField
|
||||||
(
|
(
|
||||||
new volScalarField
|
IOobject
|
||||||
(
|
(
|
||||||
IOobject
|
name,
|
||||||
(
|
mesh.time().timeName(),
|
||||||
name,
|
mesh,
|
||||||
mesh.time().timeName(),
|
IOobject::MUST_READ,
|
||||||
mesh,
|
IOobject::AUTO_WRITE
|
||||||
IOobject::MUST_READ,
|
),
|
||||||
IOobject::AUTO_WRITE
|
mesh
|
||||||
),
|
|
||||||
mesh
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Transfer ownership of this object to the objectRegistry
|
// Transfer ownership of this object to the objectRegistry
|
||||||
fPtr->store(fPtr);
|
ptr->store(ptr);
|
||||||
return *fPtr;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return const_cast<volScalarField&>(*p);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return *ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -341,30 +335,25 @@ const Foam::basicThermo& Foam::basicThermo::lookupThermo
|
|||||||
const fvPatchScalarField& pf
|
const fvPatchScalarField& pf
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (pf.db().foundObject<basicThermo>(dictName))
|
const basicThermo* thermo = pf.db().findObject<basicThermo>(dictName);
|
||||||
{
|
|
||||||
return pf.db().lookupObject<basicThermo>(dictName);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
HashTable<const basicThermo*> thermos =
|
|
||||||
pf.db().lookupClass<basicThermo>();
|
|
||||||
|
|
||||||
for
|
if (thermo)
|
||||||
|
{
|
||||||
|
return *thermo;
|
||||||
|
}
|
||||||
|
|
||||||
|
HashTable<const basicThermo*> thermos =
|
||||||
|
pf.db().lookupClass<basicThermo>();
|
||||||
|
|
||||||
|
forAllConstIters(thermos, iter)
|
||||||
|
{
|
||||||
|
if
|
||||||
(
|
(
|
||||||
HashTable<const basicThermo*>::iterator iter = thermos.begin();
|
&(iter()->he().internalField())
|
||||||
iter != thermos.end();
|
== &(pf.internalField())
|
||||||
++iter
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if
|
return *iter();
|
||||||
(
|
|
||||||
&(iter()->he().internalField())
|
|
||||||
== &(pf.internalField())
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return *iter();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -118,58 +118,53 @@ Foam::radiation::greyMeanAbsorptionEmission::greyMeanAbsorptionEmission
|
|||||||
// look-up table and save the corresponding indices of the look-up table
|
// look-up table and save the corresponding indices of the look-up table
|
||||||
|
|
||||||
label j = 0;
|
label j = 0;
|
||||||
forAllConstIter(HashTable<label>, speciesNames_, iter)
|
forAllConstIters(speciesNames_, iter)
|
||||||
{
|
{
|
||||||
|
const word& specieName = iter.key();
|
||||||
|
const label index = iter.object();
|
||||||
|
|
||||||
|
volScalarField* fldPtr = mesh.getObjectPtr<volScalarField>(specieName);
|
||||||
|
|
||||||
if (!lookUpTablePtr_.empty())
|
if (!lookUpTablePtr_.empty())
|
||||||
{
|
{
|
||||||
if (lookUpTablePtr_().found(iter.key()))
|
if (lookUpTablePtr_().found(specieName))
|
||||||
{
|
{
|
||||||
label index = lookUpTablePtr_().findFieldIndex(iter.key());
|
const label fieldIndex =
|
||||||
|
lookUpTablePtr_().findFieldIndex(specieName);
|
||||||
|
|
||||||
Info<< "specie: " << iter.key() << " found on look-up table "
|
Info<< "specie: " << specieName << " found on look-up table "
|
||||||
<< " with index: " << index << endl;
|
<< " with index: " << fieldIndex << endl;
|
||||||
|
|
||||||
specieIndex_[iter()] = index;
|
specieIndex_[index] = fieldIndex;
|
||||||
}
|
}
|
||||||
else if (mesh.foundObject<volScalarField>(iter.key()))
|
else if (fldPtr)
|
||||||
{
|
{
|
||||||
volScalarField& Y =
|
Yj_.set(j, fldPtr);
|
||||||
const_cast<volScalarField&>
|
specieIndex_[index] = 0;
|
||||||
(
|
|
||||||
mesh.lookupObject<volScalarField>(iter.key())
|
|
||||||
);
|
|
||||||
Yj_.set(j, &Y);
|
|
||||||
specieIndex_[iter()] = 0;
|
|
||||||
j++;
|
j++;
|
||||||
Info<< "specie: " << iter.key() << " is being solved" << endl;
|
Info<< "specie: " << iter.key() << " is being solved" << endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "specie: " << iter.key()
|
<< "specie: " << specieName
|
||||||
<< " is neither in look-up table: "
|
<< " is neither in look-up table: "
|
||||||
<< lookUpTablePtr_().tableName()
|
<< lookUpTablePtr_().tableName()
|
||||||
<< " nor is being solved" << nl
|
<< " nor is being solved" << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (mesh.foundObject<volScalarField>(iter.key()))
|
else if (fldPtr)
|
||||||
{
|
{
|
||||||
volScalarField& Y =
|
Yj_.set(j, fldPtr);
|
||||||
const_cast<volScalarField&>
|
specieIndex_[index] = 0;
|
||||||
(
|
|
||||||
mesh.lookupObject<volScalarField>(iter.key())
|
|
||||||
);
|
|
||||||
|
|
||||||
Yj_.set(j, &Y);
|
|
||||||
specieIndex_[iter()] = 0;
|
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< " there is not lookup table and the specie" << nl
|
<< "There is no lookup table and the specie" << nl
|
||||||
<< iter.key() << nl
|
<< specieName << nl
|
||||||
<< " is not found " << nl
|
<< " is not found " << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
@ -292,10 +287,11 @@ Foam::radiation::greyMeanAbsorptionEmission::ECont(const label bandI) const
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (mesh_.foundObject<volScalarField>("Qdot"))
|
const volScalarField* QdotPtr = mesh_.findObject<volScalarField>("Qdot");
|
||||||
|
|
||||||
|
if (QdotPtr)
|
||||||
{
|
{
|
||||||
const volScalarField& Qdot =
|
const volScalarField& Qdot = *QdotPtr;
|
||||||
mesh_.lookupObject<volScalarField>("Qdot");
|
|
||||||
|
|
||||||
if (Qdot.dimensions() == dimEnergy/dimTime)
|
if (Qdot.dimensions() == dimEnergy/dimTime)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -132,48 +132,53 @@ Foam::radiation::wideBandAbsorptionEmission::wideBandAbsorptionEmission
|
|||||||
// look-up table and save the corresponding indices of the look-up table
|
// look-up table and save the corresponding indices of the look-up table
|
||||||
|
|
||||||
label j = 0;
|
label j = 0;
|
||||||
forAllConstIter(HashTable<label>, speciesNames_, iter)
|
forAllConstIters(speciesNames_, iter)
|
||||||
{
|
{
|
||||||
|
const word& specieName = iter.key();
|
||||||
|
const label index = iter.object();
|
||||||
|
|
||||||
|
volScalarField* fldPtr = mesh.getObjectPtr<volScalarField>(specieName);
|
||||||
|
|
||||||
if (!lookUpTablePtr_.empty())
|
if (!lookUpTablePtr_.empty())
|
||||||
{
|
{
|
||||||
if (lookUpTablePtr_().found(iter.key()))
|
if (lookUpTablePtr_().found(specieName))
|
||||||
{
|
{
|
||||||
const label index =
|
const label fieldIndex =
|
||||||
lookUpTablePtr_().findFieldIndex(iter.key());
|
lookUpTablePtr_().findFieldIndex(specieName);
|
||||||
|
|
||||||
Info<< "specie: " << iter.key() << " found on look-up table "
|
Info<< "specie: " << specieName << " found on look-up table "
|
||||||
<< " with index: " << index << endl;
|
<< " with index: " << fieldIndex << endl;
|
||||||
|
|
||||||
specieIndex_[iter()] = index;
|
specieIndex_[index] = fieldIndex;
|
||||||
}
|
}
|
||||||
else if (mesh.foundObject<volScalarField>(iter.key()))
|
else if (fldPtr)
|
||||||
{
|
{
|
||||||
Yj_.set(j, &mesh.lookupObjectRef<volScalarField>(iter.key()));
|
Yj_.set(j, fldPtr);
|
||||||
specieIndex_[iter()] = 0;
|
specieIndex_[index] = 0;
|
||||||
j++;
|
j++;
|
||||||
Info<< "specie: " << iter.key() << " is being solved" << endl;
|
Info<< "specie: " << specieName << " is being solved" << endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "specie: " << iter.key()
|
<< "specie: " << specieName
|
||||||
<< " is neither in look-up table: "
|
<< " is neither in look-up table: "
|
||||||
<< lookUpTablePtr_().tableName()
|
<< lookUpTablePtr_().tableName()
|
||||||
<< " nor is being solved" << nl
|
<< " nor is being solved" << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (mesh.foundObject<volScalarField>(iter.key()))
|
else if (fldPtr)
|
||||||
{
|
{
|
||||||
Yj_.set(j, &mesh.lookupObjectRef<volScalarField>(iter.key()));
|
Yj_.set(j, fldPtr);
|
||||||
specieIndex_[iter()] = 0;
|
specieIndex_[index] = 0;
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< " there is no lookup table and the specie" << nl
|
<< "There is no lookup table and the specie" << nl
|
||||||
<< iter.key() << nl
|
<< specieName << nl
|
||||||
<< " is not found " << nl
|
<< " is not found " << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
|
|
||||||
@ -300,10 +305,11 @@ Foam::radiation::wideBandAbsorptionEmission::ECont(const label bandi) const
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (mesh().foundObject<volScalarField>("Qdot"))
|
const volScalarField* QdotPtr = mesh().findObject<volScalarField>("Qdot");
|
||||||
|
|
||||||
|
if (QdotPtr)
|
||||||
{
|
{
|
||||||
const volScalarField& Qdot =
|
const volScalarField& Qdot = *QdotPtr;
|
||||||
mesh().lookupObject<volScalarField>("Qdot");
|
|
||||||
|
|
||||||
if (Qdot.dimensions() == dimEnergy/dimTime)
|
if (Qdot.dimensions() == dimEnergy/dimTime)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -64,12 +64,12 @@ Foam::moleFractions<ThermoType>::moleFractions
|
|||||||
:
|
:
|
||||||
fvMeshFunctionObject(name, runTime, dict)
|
fvMeshFunctionObject(name, runTime, dict)
|
||||||
{
|
{
|
||||||
if (mesh_.foundObject<ThermoType>(basicThermo::dictName))
|
const ThermoType* thermo =
|
||||||
{
|
mesh_.findObject<ThermoType>(basicThermo::dictName);
|
||||||
const ThermoType& thermo =
|
|
||||||
mesh_.lookupObject<ThermoType>(basicThermo::dictName);
|
|
||||||
|
|
||||||
const PtrList<volScalarField>& Y = thermo.composition().Y();
|
if (thermo)
|
||||||
|
{
|
||||||
|
const PtrList<volScalarField>& Y = thermo->composition().Y();
|
||||||
|
|
||||||
X_.setSize(Y.size());
|
X_.setSize(Y.size());
|
||||||
|
|
||||||
|
|||||||
@ -93,33 +93,28 @@ Foam::humidityTemperatureCoupledMixedFvPatchScalarField::thicknessField
|
|||||||
const fvMesh& mesh
|
const fvMesh& mesh
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (!mesh.foundObject<volScalarField>(fieldName))
|
volScalarField* ptr = mesh.getObjectPtr<volScalarField>(fieldName);
|
||||||
|
|
||||||
|
if (!ptr)
|
||||||
{
|
{
|
||||||
tmp<volScalarField> tField
|
ptr = new volScalarField
|
||||||
(
|
(
|
||||||
new volScalarField
|
IOobject
|
||||||
(
|
(
|
||||||
IOobject
|
fieldName,
|
||||||
(
|
mesh.time().timeName(),
|
||||||
fieldName,
|
|
||||||
mesh.time().timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
mesh,
|
mesh,
|
||||||
dimensionedScalar(dimLength, Zero)
|
IOobject::NO_READ,
|
||||||
)
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensionedScalar(dimLength, Zero)
|
||||||
);
|
);
|
||||||
|
|
||||||
tField.ptr()->store();
|
ptr->store();
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return *ptr;
|
||||||
const_cast<volScalarField&>
|
|
||||||
(
|
|
||||||
mesh.lookupObject<volScalarField>(fieldName)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -141,11 +141,10 @@ bool Foam::rawTopoChangerFvMesh::update()
|
|||||||
// Special handling for phi: set unmapped faces to recreated phi
|
// Special handling for phi: set unmapped faces to recreated phi
|
||||||
Info<< "rawTopoChangerFvMesh :"
|
Info<< "rawTopoChangerFvMesh :"
|
||||||
<< " recreating phi for unmapped boundary values." << endl;
|
<< " recreating phi for unmapped boundary values." << endl;
|
||||||
|
|
||||||
const volVectorField& U = lookupObject<volVectorField>("U");
|
const volVectorField& U = lookupObject<volVectorField>("U");
|
||||||
surfaceScalarField& phi = const_cast<surfaceScalarField&>
|
surfaceScalarField& phi = lookupObjectRef<surfaceScalarField>("phi");
|
||||||
(
|
|
||||||
lookupObject<surfaceScalarField>("phi")
|
|
||||||
);
|
|
||||||
setUnmappedValues
|
setUnmappedValues
|
||||||
(
|
(
|
||||||
phi,
|
phi,
|
||||||
|
|||||||
@ -75,10 +75,7 @@ void Foam::rawTopoChangerFvMesh::zeroUnmappedValues
|
|||||||
{
|
{
|
||||||
//Pout<< "Checking field " << fldNames[i] << endl;
|
//Pout<< "Checking field " << fldNames[i] << endl;
|
||||||
|
|
||||||
FieldType& fld = const_cast<FieldType&>
|
FieldType& fld = lookupObjectRef<FieldType>(fldNames[i]);
|
||||||
(
|
|
||||||
lookupObject<FieldType>(fldNames[i])
|
|
||||||
);
|
|
||||||
|
|
||||||
setUnmappedValues
|
setUnmappedValues
|
||||||
(
|
(
|
||||||
|
|||||||
@ -60,12 +60,11 @@ Foam::viscosityModels::Arrhenius<ViscousModel>::Arrhenius
|
|||||||
fieldName_(ArrheniusCoeffs_.lookupOrDefault<word>("field","T")),
|
fieldName_(ArrheniusCoeffs_.lookupOrDefault<word>("field","T")),
|
||||||
mesh_(U.mesh())
|
mesh_(U.mesh())
|
||||||
{
|
{
|
||||||
const volScalarField* fieldPtr =
|
const auto* fldPtr = mesh_.findObject<volScalarField>(fieldName_);
|
||||||
mesh_.lookupObjectPtr<volScalarField>(fieldName_);
|
|
||||||
|
|
||||||
if (fieldPtr)
|
if (fldPtr)
|
||||||
{
|
{
|
||||||
this->nu_ *= calcNu(*fieldPtr);
|
this->nu_ *= calcNu(*fldPtr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -113,12 +113,11 @@ public:
|
|||||||
{
|
{
|
||||||
ViscousModel::correct();
|
ViscousModel::correct();
|
||||||
|
|
||||||
const volScalarField* fieldPtr =
|
const auto* fldPtr = mesh_.findObject<volScalarField>(fieldName_);
|
||||||
mesh_.lookupObjectPtr<volScalarField>(fieldName_);
|
|
||||||
|
|
||||||
if (fieldPtr)
|
if (fldPtr)
|
||||||
{
|
{
|
||||||
this->nu_ *= calcNu(*fieldPtr);
|
this->nu_ *= calcNu(*fldPtr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -87,15 +87,16 @@ Foam::tmp<Foam::waveModel> Foam::waveModel::lookupOrCreate
|
|||||||
{
|
{
|
||||||
const word modelName = waveModel::modelName(patch.name());
|
const word modelName = waveModel::modelName(patch.name());
|
||||||
|
|
||||||
if (!mesh.foundObject<waveModel>(modelName))
|
waveModel* modelPtr = mesh.getObjectPtr<waveModel>(modelName);
|
||||||
|
|
||||||
|
if (!modelPtr)
|
||||||
{
|
{
|
||||||
autoPtr<waveModel> model(waveModel::New(waveDictName, mesh, patch));
|
modelPtr = waveModel::New(waveDictName, mesh, patch).ptr();
|
||||||
waveModel* waveModelPtr = model.ptr();
|
modelPtr->store();
|
||||||
waveModelPtr->store();
|
modelPtr->info(Info);
|
||||||
waveModelPtr->info(Info);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return mesh.lookupObject<waveModel>(modelName);
|
return *modelPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -38,8 +38,7 @@ functions
|
|||||||
scalar gamma = 1.4;
|
scalar gamma = 1.4;
|
||||||
scalar A = -0.3*D*UInf;
|
scalar A = -0.3*D*UInf;
|
||||||
const dimensionedScalar rhoRef("rhoRef", dimDensity, 1);
|
const dimensionedScalar rhoRef("rhoRef", dimDensity, 1);
|
||||||
const volScalarField& rho =
|
const auto& rho = mesh().lookupObject<volScalarField>("rho");
|
||||||
mesh().lookupObject<volScalarField>("rho");
|
|
||||||
|
|
||||||
const vectorField& C = mesh().C();
|
const vectorField& C = mesh().C();
|
||||||
const scalarField x(C.component(0));
|
const scalarField x(C.component(0));
|
||||||
@ -47,19 +46,15 @@ functions
|
|||||||
const scalar r2 = sqr(0.5*D/(Foam::sqrt(Foam::log(10.0))));
|
const scalar r2 = sqr(0.5*D/(Foam::sqrt(Foam::log(10.0))));
|
||||||
const scalarField Psi(A*exp(-0.5/r2*(sqr(x) + sqr(y))));
|
const scalarField Psi(A*exp(-0.5/r2*(sqr(x) + sqr(y))));
|
||||||
|
|
||||||
volVectorField* Uptr =
|
auto* Uptr = mesh().getObjectPtr<volVectorField>("U");
|
||||||
mesh().lookupObjectRefPtr<volVectorField>("U");
|
auto* pPtr = mesh().getObjectPtr<volScalarField>("p");
|
||||||
volScalarField* pPtr =
|
auto* TPtr = mesh().getObjectPtr<volScalarField>("T");
|
||||||
mesh().lookupObjectRefPtr<volScalarField>("p");
|
|
||||||
volScalarField* TPtr =
|
|
||||||
mesh().lookupObjectRefPtr<volScalarField>("T");
|
|
||||||
|
|
||||||
|
|
||||||
if (Uptr && pPtr && TPtr)
|
if (Uptr && pPtr && TPtr)
|
||||||
{
|
{
|
||||||
volVectorField& U = *Uptr;
|
auto& U = *Uptr;
|
||||||
volScalarField& p = *pPtr;
|
auto& p = *pPtr;
|
||||||
volScalarField& T = *TPtr;
|
auto& T = *TPtr;
|
||||||
|
|
||||||
vectorField& Uc = U.primitiveFieldRef();
|
vectorField& Uc = U.primitiveFieldRef();
|
||||||
Uc.replace(0, UInf - rhoRef/rho()*Psi/r2*y);
|
Uc.replace(0, UInf - rhoRef/rho()*Psi/r2*y);
|
||||||
|
|||||||
Reference in New Issue
Block a user