mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
reactingEulerFoam: Order-independent lookup of unordered pair models
Lookup of models associated with unordered phase pairs now searches for both possible pair names; e.g. gasAndLiquid and liquidAndGas. Patch contributed by Institute of Fluid Dynamics, Helmholtz-Zentrum Dresden - Rossendorf (HZDR)
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2014-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2014-2018 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -71,6 +71,16 @@ Foam::word Foam::orderedPhasePair::name() const
|
||||
}
|
||||
|
||||
|
||||
Foam::word Foam::orderedPhasePair::otherName() const
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Requested other name phase from an ordered pair."
|
||||
<< exit(FatalError);
|
||||
|
||||
return word::null;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::orderedPhasePair::E() const
|
||||
{
|
||||
return phase1().fluid().E(*this);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2014-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2014-2018 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -77,6 +77,9 @@ public:
|
||||
//- Pair name
|
||||
virtual word name() const;
|
||||
|
||||
//- Other pair name
|
||||
virtual word otherName() const;
|
||||
|
||||
//- Aspect ratio
|
||||
virtual tmp<volScalarField> E() const;
|
||||
};
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2014-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2014-2018 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -93,6 +93,14 @@ Foam::word Foam::phasePair::name() const
|
||||
}
|
||||
|
||||
|
||||
Foam::word Foam::phasePair::otherName() const
|
||||
{
|
||||
word name1(first());
|
||||
name1[0] = toupper(name1[0]);
|
||||
return second() + "And" + name1;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::phasePair::rho() const
|
||||
{
|
||||
return phase1()*phase1().rho() + phase2()*phase2().rho();
|
||||
|
||||
@ -112,6 +112,9 @@ public:
|
||||
//- Pair name
|
||||
virtual word name() const;
|
||||
|
||||
//- Other pair name
|
||||
virtual word otherName() const;
|
||||
|
||||
//- Average density
|
||||
tmp<volScalarField> rho() const;
|
||||
|
||||
|
||||
@ -83,6 +83,10 @@ public:
|
||||
|
||||
typedef UPtrList<phaseModel> phaseModelPartialList;
|
||||
|
||||
typedef
|
||||
HashTable<autoPtr<phasePair>, phasePairKey, phasePairKey::hash>
|
||||
phasePairTable;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
@ -92,10 +96,6 @@ protected:
|
||||
HashTable<dictionary, phasePairKey, phasePairKey::hash>
|
||||
dictTable;
|
||||
|
||||
typedef
|
||||
HashTable<autoPtr<phasePair>, phasePairKey, phasePairKey::hash>
|
||||
phasePairTable;
|
||||
|
||||
typedef
|
||||
HashTable<autoPtr<blendingMethod>, word, word::hash>
|
||||
blendingMethodTable;
|
||||
|
||||
@ -371,11 +371,20 @@ void Foam::phaseSystem::fillFields
|
||||
template<class modelType>
|
||||
const modelType& Foam::phaseSystem::lookupSubModel(const phasePair& key) const
|
||||
{
|
||||
return
|
||||
mesh().lookupObject<modelType>
|
||||
(
|
||||
IOobject::groupName(modelType::typeName, key.name())
|
||||
);
|
||||
const word name(IOobject::groupName(modelType::typeName, key.name()));
|
||||
|
||||
if (key.ordered() || mesh().foundObject<modelType>(name))
|
||||
{
|
||||
return mesh().lookupObject<modelType>(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
return
|
||||
mesh().lookupObject<modelType>
|
||||
(
|
||||
IOobject::groupName(modelType::typeName, key.otherName())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -394,11 +403,31 @@ template<class modelType>
|
||||
const Foam::BlendedInterfacialModel<modelType>&
|
||||
Foam::phaseSystem::lookupBlendedSubModel(const phasePair& key) const
|
||||
{
|
||||
return
|
||||
mesh().lookupObject<BlendedInterfacialModel<modelType>>
|
||||
const word name
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
IOobject::groupName(modelType::typeName, key.name())
|
||||
);
|
||||
BlendedInterfacialModel<modelType>::typeName,
|
||||
key.name()
|
||||
)
|
||||
);
|
||||
|
||||
if (mesh().foundObject<BlendedInterfacialModel<modelType>>(name))
|
||||
{
|
||||
return mesh().lookupObject<BlendedInterfacialModel<modelType>>(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
return
|
||||
mesh().lookupObject<BlendedInterfacialModel<modelType>>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
BlendedInterfacialModel<modelType>::typeName,
|
||||
key.otherName()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user