CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   How to add 3rd region to chtMultiRegionFoam (https://www.cfd-online.com/Forums/openfoam/74285-how-add-3rd-region-chtmultiregionfoam.html)

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?

jonya April 3, 2010 17:22

For create a new region you don't need to modify coupleManager. Just create in your case new folder with 3rd region mesh like in tutorial. In regionPriperties you should put type of your region.


All times are GMT -4. The time now is 02:52.