CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

conjugateHeatFoam with arbitrary number of region

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 20, 2011, 06:25
Default conjugateHeatFoam with arbitrary number of region
  #1
Senior Member
 
maddalena's Avatar
 
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 23
maddalena will become famous soon enough
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
maddalena is offline   Reply With Quote

Old   June 20, 2011, 09:53
Default
  #2
New Member
 
babak kamkari
Join Date: Dec 2010
Posts: 26
Rep Power: 16
kamkari is on a distinguished road
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
kamkari is offline   Reply With Quote

Old   June 20, 2011, 10:06
Default
  #3
Senior Member
 
maddalena's Avatar
 
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 23
maddalena will become famous soon enough
Quote:
Originally Posted by kamkari View Post
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 ! 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
maddalena is offline   Reply With Quote

Old   June 20, 2011, 22:46
Default
  #4
Senior Member
 
Ben K
Join Date: Feb 2010
Location: Ottawa, Canada
Posts: 140
Rep Power: 19
benk is on a distinguished road
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.
benk is offline   Reply With Quote

Old   August 29, 2011, 12:11
Question some more questions
  #5
Senior Member
 
maddalena's Avatar
 
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 23
maddalena will become famous soon enough
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 ...
According to what Henrik said on 2009 here:
Quote:
Originally Posted by henrik View Post
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
maddalena is offline   Reply With Quote

Old   December 1, 2011, 14:46
Default
  #6
New Member
 
Helmut Roth
Join Date: Mar 2009
Posts: 23
Rep Power: 17
helmut is on a distinguished road
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
helmut is offline   Reply With Quote

Old   July 30, 2020, 23:10
Default
  #7
New Member
 
Hailong
Join Date: Sep 2019
Posts: 8
Rep Power: 7
nilvxingren is on a distinguished road
Quote:
Originally Posted by helmut View Post
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
Hi, helmut
I modified my code like your method, but the error occurred when I compile it

Code:
In file included from conjugateHeatMulSimpleFoam.C(56):
createSolidFields.H(37): error: a reference of type "Foam::Istream &" (not const-qualified) cannot be initialized with a value of type "Foam::fvMesh"
         thermalModel::New(solidRegions[i])
                           ^

In file included from conjugateHeatMulSimpleFoam.C(56):
createSolidFields.H(34): error: no instance of overloaded function "Foam::PtrList<T>::set [with T=Foam::thermalModel]" matches the argument list
In file included from conjugateHeatMulSimpleFoam.C(56):
            argument types are: (Foam::label, Foam::autoPtr<Foam::dictionary>)
In file included from conjugateHeatMulSimpleFoam.C(56):
            object type is: Foam::PtrList<Foam::thermalModel>
In file included from conjugateHeatMulSimpleFoam.C(56):
      solidThermo.set
                  ^

conjugateHeatMulSimpleFoam.C(87): error: class "Foam::PtrList<Foam::thermalModel>" has no member "correct"
          solidThermo.correct();
                      ^

conjugateHeatMulSimpleFoam.C(88): error: identifier "ksolid" is undefined
          ksolid = solidThermo.k();
          ^

conjugateHeatMulSimpleFoam.C(88): error: class "Foam::PtrList<Foam::thermalModel>" has no member "k"
          ksolid = solidThermo.k();
                               ^

conjugateHeatMulSimpleFoam.C(97): error: no instance of overloaded function "Foam::fvc::interpolate" matches the argument list
            argument types are: (<error-type>)
          surfaceScalarField ksolidf = fvc::interpolate(ksolid);
                                       ^

conjugateHeatMulSimpleFoam.C(98): error: class "Foam::PtrList<Foam::thermalModel>" has no member "modifyResistance"
          solidThermo.modifyResistance(ksolidf);
                      ^

In file included from solveEnergy.H(3),
                 from conjugateHeatMulSimpleFoam.C(100):
readSolidControls.H(1): error: identifier "solidMesh" is undefined
      const dictionary& simple = solidMesh.solutionDict().subDict("SIMPLE");
                                 ^

In file included from conjugateHeatMulSimpleFoam.C(100):
solveEnergy.H(29): error: identifier "Tsolid" is undefined
            - fvm::laplacian(ksolidf, Tsolid, "laplacian(k,T)")
                                      ^

In file included from conjugateHeatMulSimpleFoam.C(100):
solveEnergy.H(29): error: no instance of overloaded function "Foam::fvm::laplacian" matches the argument list
In file included from conjugateHeatMulSimpleFoam.C(100):
            argument types are: (Foam::surfaceScalarField, <error-type>, const char [15])
In file included from conjugateHeatMulSimpleFoam.C(100):
            - fvm::laplacian(ksolidf, Tsolid, "laplacian(k,T)")
              ^

In file included from conjugateHeatMulSimpleFoam.C(100):
solveEnergy.H(30): error: class "Foam::PtrList<Foam::thermalModel>" has no member "S"
            + fvm::SuSp(-solidThermo.S()/Tsolid, Tsolid)
                                     ^

In file included from conjugateHeatMulSimpleFoam.C(100):
solveEnergy.H(30): error: no instance of overloaded function "Foam::fvm::SuSp" matches the argument list
In file included from conjugateHeatMulSimpleFoam.C(100):
            argument types are: (<error-type>, <error-type>)
In file included from conjugateHeatMulSimpleFoam.C(100):
            + fvm::SuSp(-solidThermo.S()/Tsolid, Tsolid)
              ^

compilation aborted for conjugateHeatMulSimpleFoam.C (code 2)
I modified the creatSolidField.h like this:

Code:
PtrList<thermalModel> solidThermo(solidRegions.size());
PtrList<volScalarField> Ts(solidRegions.size());
PtrList<volScalarField> ks(solidRegions.size());


forAll(solidRegions, i)
{
    Info<< "*** Reading solid mesh thermophysical properties for region "
        << solidRegions[i].name() << nl << endl;

    Info<< "Reading field Tsolid\n" << endl;

    Ts.set
    (
        i,
        new volScalarField
        (
            IOobject
            (
                "T",
                runTime.timeName(),
                //solidMesh,
                solidRegions[i],
                IOobject::MUST_READ,
                IOobject::AUTO_WRITE
            ),
            //solidMesh
            solidRegions[i]
        )

    );

    Info<< "Reading solid thermal properties" << endl;
    solidThermo.set
    (
       i,
       thermalModel::New(solidRegions[i])
    );

    Info<< "Reading solid diffusivity k\n" << endl;

    ks.set
    (
       i,
       new volScalarField
       (
           IOobject
           (
               "k",
               runTime.timeName(),
               //solidMesh,
               solidRegions[i],
               IOobject::MUST_READ,
               IOobject::AUTO_WRITE
           ),
           //solidMesh
           solidRegions[i]
       )
    );
}
I don't know the solidThermo.set is right, mybe that's reason the error
nilvxingren is offline   Reply With Quote

Old   July 31, 2020, 05:14
Default
  #8
New Member
 
Hailong
Join Date: Sep 2019
Posts: 8
Rep Power: 7
nilvxingren is on a distinguished road
Quote:
Originally Posted by maddalena View Post
well... that seems to be not enough for me: I need n solids and 2 fluids at least ! 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
Hi mad,
Do you modified the solver fot n solids? I've been doing this lately, but I've had some difficulties, can you give some suggstion?
nilvxingren is offline   Reply With Quote

Reply

Tags
conjugateheatfoam, multiple regions


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
DecomposePar unequal number of shared faces maka OpenFOAM Pre-Processing 6 August 12, 2010 10:01
[blockMesh] BlockMeshmergePatchPairs hjasak OpenFOAM Meshing & Mesh Conversion 11 August 15, 2008 08:36
Smooth Grid Error! Help seasoul FLUENT 1 March 24, 2008 11:56
Stanton Number and Arbitrary Surface Temperature Boris Vaisman Main CFD Forum 1 March 9, 2006 05:43
[Gmsh] Import gmsh msh to Foam adorean OpenFOAM Meshing & Mesh Conversion 24 April 27, 2005 09:19


All times are GMT -4. The time now is 15:11.