CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Combine CHTmultiRegion and InterFoam (https://www.cfd-online.com/Forums/openfoam-programming-development/127983-combine-chtmultiregion-interfoam.html)

Nazanin December 29, 2013 02:48

Combine CHTmultiRegion and InterFoam
 
Hi every Body
I want Simulate two phase flow with conjugate heat transfer.I worked with interFoam solver but I don't have any experience about CHTmultiregionFoam and how add my fluid solver instead fluid part of this solver.any body have experience about this??
or another way,just add solid region in my base solver??which way is better??
Regards,

Linse December 30, 2013 06:35

Hi Nazanin,

from my experience with the cht-family, the very basics should be rather straightforward.
In the code for the cht-solver you will find one folder called "solid" (to remain untouched) and one folder called "fluid". The latter one holds the main part of the code for the fluid.
I would suggest replacing that part of the solver with your own solver.

I do not see any critical show-stoppers at the moment, though some compilation errors should be expected in the beginning.
I do not know the code behind interFoam. But it might be necessary to think about the timestep-management, as at least part of this is done by the combination framework.

Introducing a two-region treatment into another solver I personally deem quite challenging - but I have never done that, so it could be simple as well...

Cheers,
Bernhard

Nazanin December 30, 2013 09:37

Quote:

Originally Posted by Linse (Post 468082)
Hi Nazanin,

from my experience with the cht-family, the very basics should be rather straightforward.
In the code for the cht-solver you will find one folder called "solid" (to remain untouched) and one folder called "fluid". The latter one holds the main part of the code for the fluid.
I would suggest replacing that part of the solver with your own solver.

I do not see any critical show-stoppers at the moment, though some compilation errors should be expected in the beginning.
I do not know the code behind interFoam. But it might be necessary to think about the timestep-management, as at least part of this is done by the combination framework.

Introducing a two-region treatment into another solver I personally deem quite challenging - but I have never done that, so it could be simple as well...

Cheers,
Bernhard

Hi Bernhard
Thank you very much for Reply.
I see the fluid part of CHT solver,and I think this reform is more difficult from what you said. :(
InterFoam is for incompressible fluid,but I think CHT for compressible fluid.can we change this solver for incompressible?
Best

nimasam December 31, 2013 03:54

it is possible to change the solver to satisfy your need, of course you should modify coupled BC for your applications too
1- read CHT solver
2- replace fluid solver with interFoam
3- add suitable variables
4-change the communication way of two regions

ofcourse you need to put time and effort :D , its some how time consuming for newbie

Nazanin December 31, 2013 11:48

Quote:

Originally Posted by nimasam (Post 468182)
it is possible to change the solver to satisfy your need, of course you should modify coupled BC for your applications too
1- read CHT solver
2- replace fluid solver with interFoam
3- add suitable variables
4-change the communication way of two regions

ofcourse you need to put time and effort :D , its some how time consuming for newbie

Thank you Nima
I don't have experience about CHT solver,but I worked with another solver last.
yes,I should try and I hope if I have a problem, hope help me.:p:p
Best;

Nazanin January 9, 2014 00:54

Quote:

Originally Posted by nimasam (Post 468182)
it is possible to change the solver to satisfy your need, of course you should modify coupled BC for your applications too
1- read CHT solver
2- replace fluid solver with interFoam
3- add suitable variables
4-change the communication way of two regions

ofcourse you need to put time and effort :D , its some how time consuming for newbie

Dear Nima
I could add interFoam solver to CHT and Compile without any error..But I dont know modified solver is correct or have problem.now I want test this solver with a test case,but I dont have idea how create a test case for this solver..
Do you have test case like this (for interFoam or twophase fluid and CHT),that help me how create test case??
my mail is:eli.nazanin66@gmail.com
Thank you

nimasam January 9, 2014 01:12

well, i dont have any test case, its not hard task :), if you know how to create a chtMultiregion test case, then you need only change fluid variables with two-phase variables

Nazanin February 9, 2014 08:19

Quote:

Originally Posted by nimasam (Post 469216)
well, i dont have any test case, its not hard task :), if you know how to create a chtMultiregion test case, then you need only change fluid variables with two-phase variables

Dear Nima
when I want create test case for my combine solver (and Find my mistakes) I see this error in my case:
Code:

--> FOAM FATAL ERROR:

    request for volScalarField alpha1 from objectRegistry water failed
    available objects of type volScalarField are

2
(
nu1
nu2
)

do you what is my mistake in implementation Solver??

nimasam February 9, 2014 08:42

well, it seems alpha1 variable has not been introduced in solvers and compiler suggest available variables

Nazanin February 9, 2014 13:24

Quote:

Originally Posted by nimasam (Post 474121)
well, it seems alpha1 variable has not been introduced in solvers and compiler suggest available variables

Dear Nima
Thank You For reply;
I dont good understand your guide.
well I put alphaEqn & alphaEqnSubcycle &anlphaCourant in my solver (fluid part) and define in creatFluides.h
Code:

PtrList<volScalarField> alpha1Fluid(fluidRegions.size());
 Info<< "    Adding to alpha1Fluid\n" << endl;
        alpha1Fluid.set
        (
            i,
            new volScalarField
            (
                IOobject
                (
                    "alpha1",
                    runTime.timeName(),
                    fluidRegions[i],
                    IOobject::MUST_READ,
                    IOobject::AUTO_WRITE
                ),
                fluidRegions[i]
            )
        );

So I think interdused alpha1 in my solver?? what is your opinion?

Nazanin February 9, 2014 13:38

Quote:

Originally Posted by nimasam (Post 474121)
well, it seems alpha1 variable has not been introduced in solvers and compiler suggest available variables

Dear Nima
where is define nu in interfoam?? in transportmodels/incompresible/viscosityModels/....??
am I right? this code should read nu1 and nu2 from this file,But can't???

nimasam February 9, 2014 16:50

1- its hard to say where the problem is :), as it seems you enter alpha1 variable in your code. but it seems binary code can not find alpha1 in available volScalarField, why? i dont know :)

Quote:

where is define nu in interfoam?? in transportmodels/incompresible/viscosityModels/....??
yes it is

Quote:

this code should read nu1 and nu2 from this file,But can't???
it can read nu1 and nu2 but your solver can not find alpha1

vigneshTG May 5, 2015 09:10

Hi everyone,

I would like to know if anyone was able to combine successfully the chMultiregionFoam and interFoam. If so, can you explain me the steps ....

I would like to simulate drop spreading/impact on hot/cold surfaces.

Mahdi2010 August 14, 2015 04:56

Did anybody make progress in coupling interFoam with chMultiregionFoam solver?I have tried, but since the VOF algorithm in interFoam (OF 2.3) has been changed a bit, I have seen some errors. Apart from that does anybody know how to transfer :

tmp<surfaceScalarField> tphiAlphaCorr0


from the alphaEqn.H of interFoam to the CHT? I mean every variable should be re-defined in createFluidFields.H in the form of "PtrList<...>", but the tmp variables may have different way. right?

ageorg October 30, 2015 12:45

Any Update on Coupling InterFoam with Conjugate Heat Transfer?
 
Dear All,

Is there any progress on this matter? Did anyone managed to couple the solvers?

Thanks in advance,

Ageing

ageorg February 29, 2016 19:02

Any news on CHT + IntarFoam
 
Dear All

Did anyone managed to successfully couple interFoam with chtMultiRegionFoam?
Thank you very much in advance

Ageorg

yaoyina May 11, 2016 12:29

Dear All

Did anyone managed to successfully couple the two solvers? Can you share with us if possible?
Thank you very much in advance:):)

wanghongjie August 17, 2020 11:05

Quote:

Originally Posted by Nazanin (Post 469215)
Dear Nima
I could add interFoam solver to CHT and Compile without any error..But I dont know modified solver is correct or have problem.now I want test this solver with a test case,but I dont have idea how create a test case for this solver..
Do you have test case like this (for interFoam or twophase fluid and CHT),that help me how create test case??
my mail is:eli.nazanin66@gmail.com
Thank you

Hello Nazanin, although a long time has passed, I would like to ask about the solver that couples interFoam and chtMultiRegionFoam, because I have some difficulties in compiling now, maybe you can provide some help. Thanks!

wanghongjie August 18, 2020 23:19

Quote:

Originally Posted by nimasam (Post 474160)
1- its hard to say where the problem is :), as it seems you enter alpha1 variable in your code. but it seems binary code can not find alpha1 in available volScalarField, why? i dont know :)


yes it is


it can read nu1 and nu2 but your solver can not find alpha1

Hello, although a long time has passed, I would like to ask about the solver that couples interFoam and chtMultiRegionFoam, because I have some difficulties in compiling now, maybe you can provide some help. Thanks!

Bana April 12, 2022 08:00

Quote:

Originally Posted by nimasam (Post 468182)
it is possible to change the solver to satisfy your need, of course you should modify coupled BC for your applications too
1- read CHT solver
2- replace fluid solver with interFoam
3- add suitable variables
4-change the communication way of two regions

ofcourse you need to put time and effort :D , its some how time consuming for newbie

Hello Nima,

Since I am interested in modeling one two-phase fluid region (with CavitatingFoam or InterFoam) and a multi-solid region with three different solids, I was wondering if it is possible to reduce the whole fluid part of chtMuliregionFoam to only one fluid region and get rid of the ptrLists and looping around the fluid regions in the createFluidFields File?

Thanks

Kummi April 12, 2022 10:19

Hello Bana,
I haven't worked with interFoam solver. In case of multi-region modelling, your case should be straight forward. For 3 solids, you can implement the same default solid model solving heat conduction equation. In fluid region, create your fields, meshes and respective equations. It might be hard in the beginning, but your efforts will pay off.
Good luck

Bana April 12, 2022 12:55

Quote:

Originally Posted by Kummi (Post 826116)
Hello Bana,
I haven't worked with interFoam solver. In case of multi-region modelling, your case should be straight forward. For 3 solids, you can implement the same default solid model solving heat conduction equation. In fluid region, create your fields, meshes and respective equations. It might be hard in the beginning, but your efforts will pay off.
Good luck

Thank you Kummi for your comment,

I am not using interFoam too. I am dealing with cavitatingFoam as the fluid solver.

I know that the solid part of the solver can remain untouched, but for the createFluidFields.H file I have a primary problem with converting one of the dictionaries of createFields.H of cavitatingFoam to ptrList. As you said this conversion for a lot of Models and fields were completely straightforward and I did not have any problem by using analogy.

Here is where I am currently stuck:
for baratropicCompressibilityModel in createFields.H file of cavitatingFoam we have:

PHP Code:

 autoPtr<barotropicCompressibilityModelpsiModel =
        
barotropicCompressibilityModel::New
        (
            
thermodynamicProperties,
            
gamma
        
); 

thermodynamicProperties is defined in readThermodynamicProperties.H of cavitatingFoam as an IOdictionary:

PHP Code:

IOdictionary thermodynamicProperties
    
(
        
IOobject
        
(
            
"thermodynamicProperties",
            
runTime.constant(),
            
mesh,
            
IOobject::MUST_READ_IF_MODIFIED,
            
IOobject::NO_WRITE
        
)
    ); 


to incorporate these two in createFluidFields of chtMultiRegionFoam, I need to create something like PtrList<...>thermodynamicPropertiesFluid and then pass it to barotropicCompressibilityModel in forAll loop.

clearly the following line produces error:

PHP Code:

PtrList<IOdictionarythermodynamicPropertiesFluid(fluidRegions.size()); 

PHP Code:

errorno matching function for call to ‘Foam::PtrList<Foam::dictionary>::set(Foam::label&, Foam::IOobject)
        
); 

I searched to find how to pass IOdictionary to ptrList but did not find anything yet.

Then I think I should add following code to the forAll loop of createFluidFields.H too:

PHP Code:

thermodynamicPropertiesFluid.set
       
(
         
i,
         
IOobject
         
(
             
"thermodynamicProperties",
             
runTime.constant(),
             
fluidRegions[i],
             
IOobject::MUST_READ_IF_MODIFIED,
             
IOobject::NO_WRITE
         
)
       );

       
compressibility.set  //added
       
(
         
i,
         new 
barotropicCompressibilityModel
         
(
           
thermodynamicPropertiesFluid[i],
           
gammaFluid[i]
         )
       ); 


I appreciate it if you or anyone who has a similar experience in dealing with this solver can suggest an idea about this coding problem.

**Note: I am using Foam-Extend 4.1.

With thanks and appreciation,
Bana

Kummi April 13, 2022 00:44

Hi, I have one major thing to comment here.
Quote:

PtrList<basicSolidThermo> thermos(solidRegions.size());
PtrList<basicRhoThermo> thermoFluid(fluidRegions.size());
Here basicSolidThermo and basicRhoThermo are classes.
If you pass IOdictionary, OpenFOAM have no clue to access your solver. The reason why you get the error.
I hope this first step will get rid of your half of a problem atleast.
Thank you

Bana April 13, 2022 12:23

Quote:

Originally Posted by Kummi (Post 826155)
Hi, I have one major thing to comment here.
Here basicSolidThermo and basicRhoThermo are classes.
If you pass IOdictionary, OpenFOAM have no clue to access your solver. The reason why you get the error.
I hope this first step will get rid of your half of a problem atleast.
Thank you

But IOdictionary is a class too, Isn't it? like BasicPsiThermo and etc.
I do not know how to make a PtrList of IOdictionary:( ...

Kummi April 13, 2022 14:10

1 Attachment(s)
Hello Bana,
Sorry I didn't mention clearly.
In my case, I have implemented pyrolysis (solid with reaction), so I have used Ptrlist as,
Quote:

PtrList<regionModels:: pyrolysisModels:: pyrolysisModel>tpyrolysis(pyrosolidRegions.size());
// Populate pyrosolid field pointer lists
forAll(pyrosolidRegions, i)
{
Info<< " Adding Pyrolysis model\n" << endl;
tpyrolysis.set (i, regionModels:: pyrolysisModels:: pyrolysisModel:: New(pyrosolidRegions[i]));
}
regionModels:: pyrolysisModels:: pyrolysisModel ==> Pointer ACCESS my source file.
I'm attaching the snap of my header file here. You may get the clear idea. Hope this is useful. And give such a try too.
Thank you

Bana April 14, 2022 07:59

Quote:

Originally Posted by Kummi (Post 826209)
Hello Bana,
Sorry I didn't mention clearly.
In my case, I have implemented pyrolysis (solid with reaction), so I have used Ptrlist as,

regionModels:: pyrolysisModels:: pyrolysisModel ==> Pointer ACCESS my source file.
I'm attaching the snap of my header file here. You may get the clear idea. Hope this is useful. And give such a try too.
Thank you

Tnak you Kummi.

I found the source of error.

I didn't pay attention to the line of error! In fact the declaration of PtrList was ok and I needed to change the following in forAll loop:

PHP Code:

thermodynamicPropertiesFluid.set
      
(
          
i,
          new 
IOdictionary
          
(
              
IOobject
              
(
                  
"thermodynamicProperties",
                  
runTime.constant(),
                  
fluidRegions[i],
                  
IOobject::MUST_READ_IF_MODIFIED,
                  
IOobject::NO_WRITE
              
)
          )
      ); 


khaoula louali June 16, 2022 06:15

coupling icoFoam (plus energy equation) solver with CHT multiregion
 
Hello everyone,

I would like to ask about a solver that can couple coFoam (after introducing the energy equation in this solver) and chtMultiRegionFoam, because I want to add a solid part to the studied model. i have some difficulties in compiling , any body have experience about this?? or another way,just add solid region in my base solver??which way is better??

Regards, [/QUOTE]

Kummi June 16, 2022 07:43

Quote:

Originally Posted by khaoula louali (Post 829909)
Hello everyone,

I would like to ask about a solver that can couple coFoam (after introducing the energy equation in this solver) and chtMultiRegionFoam, because I want to add a solid part to the studied model. i have some difficulties in compiling , any body have experience about this?? or another way,just add solid region in my base solver??which way is better??

Regards,

Kindly keep your questions straight and clear.
Thank you

khaoula louali June 16, 2022 09:56

coupling icoFoam solver with chtMultiRegionFoam
 
Hello,
I am studying on regenerator which consists of two regions solid and fluid.So, I'm trying to develop new solver which combines two preexisting solvers (icoFoam and chtMultiRegionFoam) for solving a system of equations : Continuity, momentum and energy equations of fluid and solid. if someone could help me i will be grateful.
Best Regards



Kummi June 17, 2022 00:02

Hello khaoula,
Let me know how far you struggled to combine two solvers. Have you checked any forum pages related to this and given a try ? If then, kindly update what you have tried and if any error post it here. I believe helping you along from the efforts you made is worth enough. These posts might be helpful to you.
https://www.cfd-online.com/Forums/op...terfoam-2.html
https://www.cfd-online.com/Forums/op...o-regions.html
Feel free to ask !
Thank you

theBananaTrick June 17, 2022 04:41

Hi,

What boundary condition would you use to couple the phases? compressible::turbulentTemperatureCoupledBaffleMix ed[https://www.openfoam.com/documentati...ield_8H.html]? Or something similar to turbulentTemperatureTwoPhaseRadCoupledMixedFvPatch ScalarField.H [https://www.openfoam.com/documentati...Field_8H.html]


Best Regards


All times are GMT -4. The time now is 09:32.