benk |
March 29, 2010 12:19 |
How to add 3rd region to chtMultiRegionFoam
Has anybody tried to extend chtMultiRegionFoam to 3 regions? For example, in the current chtMultiRegionFoam example, there are 2 regions: a fluidRegion and a solidRegion. I'm trying to make a third region (let's just call it fluidRegion2).
I don't know how to modify the coupleManager files though. Specifically this part in chtMultiRegionFoam/coupleManager/coupleManager.C:
Code:
bool Foam::coupleManager::regionOwner() const
{
const fvMesh& nbrRegion = neighbourRegion();
const regionProperties& props =
localRegion_.objectRegistry::parent().lookupObject<regionProperties>
(
"regionProperties"
);
label myIndex = findIndex(props.fluidRegionNames(), localRegion_.name());
if (myIndex == -1)
{
label i = findIndex(props.solidRegionNames(), localRegion_.name());
if (i == -1)
{
FatalErrorIn("coupleManager::regionOwner() const")
<< "Cannot find region " << localRegion_.name()
<< " neither in fluids " << props.fluidRegionNames()
<< " nor in solids " << props.solidRegionNames()
<< exit(FatalError);
}
myIndex = props.fluidRegionNames().size() + i;
}
label nbrIndex = findIndex(props.fluidRegionNames(), nbrRegion.name());
if (nbrIndex == -1)
{
label i = findIndex(props.solidRegionNames(), nbrRegion.name());
if (i == -1)
{
FatalErrorIn("coupleManager::regionOwner() const")
<< "Cannot find region " << nbrRegion.name()
<< " neither in fluids " << props.fluidRegionNames()
<< " nor in solids " << props.solidRegionNames()
<< exit(FatalError);
}
nbrIndex = props.fluidRegionNames().size() + i;
}
return myIndex < nbrIndex;
}
At the moment my C++/OpenFOAM knowledge isn't good enough to figure out what's going on here, but I'm sure that this has to be modified if a third region is to be implemented. Has anybody done this or help me out?
|