CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   conjugateHeatFoam with arbitrary number of region (http://www.cfd-online.com/Forums/openfoam/89684-conjugateheatfoam-arbitrary-number-region.html)

maddalena June 20, 2011 05:25

conjugateHeatFoam with arbitrary number of region
 
Hello all,
is there anyone which has a conjugateHeatFoam version modified in such a way that an arbitrary number of solid and fluid regions are allowed? I need something like chtMultiRegionFoam which includes features of conjugateHeatFoam...

Thank you!


mad

kamkari June 20, 2011 08:53

Hi mad
I am currently working with conjugateHeatFoam but with two regions, solid and fluid. You could have two solid parts simply by selecting velocity equal to zero. I have to add that if you want to calculate the gradient of a variable on the interface (coupled boundry) you will face with problem. For more information about this defect have look to the following link:
http://www.cfd-online.com/Forums/ope...6-ext.htmlBest

Best Regards

maddalena June 20, 2011 09:06

Quote:

Originally Posted by kamkari (Post 312718)
conjugateHeatFoam but with two regions, solid and fluid. You could have two solid parts simply by selecting velocity equal to zero.

well... that seems to be not enough for me: I need n solids and 2 fluids at least :D ! It does not seem to difficult to modify the solver though. Before try by myself, I would like to know if someone else has a piece of code which can be shared...

mad

benk June 20, 2011 21:46

The hardest part when adding more than 2 regions is just editing attachPatches.H. Here's an example for 3 regions:


Code:

{
    const polyPatchList& patches = mesh1.boundaryMesh();

    forAll (patches, patchI)
    {
        if (isType<regionCouplePolyPatch>(patches[patchI]))
        {
            const regionCouplePolyPatch& rcp =
                refCast<const regionCouplePolyPatch>(patches[patchI]);

            // Attach it here
            rcp.attach();
        }
    }

    // Force recalculation of weights
    mesh1.surfaceInterpolation::movePoints();
   
    const polyPatchList& patches1 = mesh2.boundaryMesh();

    forAll (patches1, patchI)
    {
        if (isType<regionCouplePolyPatch>(patches1[patchI]))
        {
            const regionCouplePolyPatch& rcp =
                refCast<const regionCouplePolyPatch>(patches1[patchI]);

            // Attach it here
            rcp.attach();
        }
    }

    // Force recalculation of weights
    mesh2.surfaceInterpolation::movePoints();
   
    const polyPatchList& patches2 = mesh3.boundaryMesh();

    forAll (patches2, patchI)
    {
        if (isType<regionCouplePolyPatch>(patches2[patchI]))
        {
            const regionCouplePolyPatch& rcp =
                refCast<const regionCouplePolyPatch>(patches2[patchI]);

            // Attach it here
            rcp.attach();
        }
    }

    // Force recalculation of weights
    mesh3.surfaceInterpolation::movePoints();
}

And then you do something similar for detatchPatches.H
After this, all you have to do is make sure you have the right directory structure.

maddalena August 29, 2011 11:11

some more questions
 
Hello,
I am still planning how to make conjugateHeatFoam adjustable for an arbitrary number of regions. unfortunately I cannot work on the subject in a continuous way :o ...
According to what Henrik said on 2009 here:
Quote:

Originally Posted by henrik (Post 214429)
you can solve on three regions, but you need to duplicate the flow physics which is not natural unless the physics is actually different, e.g. turbulent on one side and visco-elastic on the other. [...] Then [...] coupledFvScalarMatrix TEqns(2)

Questions:
  1. Is the information given above a little bit outdated or the modification suggested by Benk (Hi!) is not the only one I need to implement?
  2. If Henrik's information is correct, then I need to duplicate the physics of the problem for n times, where n are the number of regions with different properties I have. Let us say I implement the solver to handle 20 regions. What if my case has only 5 regions?
  3. May be possible to implement a "for loop" for regions working in the same way the "for loop" works for patches on attachPatches and detachPatches? Does this make any sense?
Any opinion / suggestion you can give me may be useful... thank you

mad

helmut December 1, 2011 14:46

Hi Mad,

Have your questions been answered?
I borrowed some ideas from chtMultiRegionFoam and created pointerLists to my regions.
In my master case constant directory I have a regionProperties file listing my fluid and solid region names. See for example $FOAM_TUTORIALS//heatTransfer/chtMultiRegionFoam/multiRegionHeater/constant/regionProperties

My createSolidMeshes.H looks like this:
forAll(rp.solidRegionNames(), i)
{
Info<< "Create solid mesh for region " << rp.solidRegionNames()[i]
<< " for time = " << runTime.timeName() << nl << endl;
solidRegions.set
(
i,
new fvMesh
(
IOobject
(
rp.solidRegionNames()[i],
runTime.timeName(),
runTime,
IOobject::MUST_READ
)
)
);
}
Similarly for the fluid meshes.

In attachPatches.H I have for the solid side:
// solid regions
forAll(solidRegions, i)
{
//Info<< "attaching patches for solid region i =" << i << endl;
const polyPatchList& patches = solidRegions[i].boundaryMesh();
forAll (patches, patchI)
{
if (isType<regionCouplePolyPatch>(patches[patchI]))
{
const regionCouplePolyPatch& rcp =
refCast<const regionCouplePolyPatch>(patches[patchI]);
// Attach it here
rcp.attach();
}
}
// Force recalculation of weights
//mesh.surfaceInterpolation::movePoints();
solidRegions[i].surfaceInterpolation::movePoints();
}
Similarly for the fluid side


All times are GMT -4. The time now is 06:43.