Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • openfoam openfoam
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 426
    • Issues 426
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 8
    • Merge requests 8
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Development
  • openfoamopenfoam
  • Issues
  • #1860
Closed
Open
Issue created Sep 24, 2020 by Robin Kamenicky@Robin

chtMultiRegionTwoPhaseEulerFoam, Population Balance

Summary

Population balance (PPB) is not calculated when solveOnFinalIterOnly true; is used for the PPB in fvSolution of chtMultiRegionTwoPhaseEulerFoam solver.

Steps to reproduce

Use $FOAM_TUTORIALS/heatTransfer/chtMultiRegionTwoPhaseEulerFoam/solidQuenching2D. Go in constant/water/phaseProperties setup to use predefined PPB:

Change following lines of code from:

type    thermalPhaseChangeTwoPhaseSystem;   
                                                                                                                                                                                                                                                          
phases (gas liquid);                                                                                                                                                                                                                                                     

// phase change in the bulk of the fluid.                                                                                                            
phaseChange off;                                                                                                                                                      

//populationBalances (bubbles);

gas                                                                                                                                                  {                                                                                                                                                    
    type            purePhaseModel;                                                                                                                  
    diameterModel   isothermal;                                                                                                                                                                                                                                                                     

    isothermalCoeffs                                                                                                                                 
    {                                                                                                                                                
        d0               5e-3;                                                                                                                       
        p0              1e5;                                                                                                                         
    }                                                                                                                                                
    Sc              0.7;                                                                                                                             

    velocityGroupCoeffs                                                                                                                              
    {                                                                                                                                                
        populationBalance    bubbles;                                                                                                                
        formFactor      0.5235987756;                                                                                                                
        sizeGroups                                                                                                                                   
        (                                                                                                                                            
            f0  {d  0.5e-4; value   0    ;}                                                                                                          
            f1  {d  1.040e-3; value 0    ;}                                                                                                          
            f2  {d  1.640e-3; value 0    ;}                                                                                                          
            f3  {d  2.265e-3; value 0    ;}                                                                                                          
            f4  {d  2.889e-3; value 0    ;}                                                                                                          
            f5  {d  3.512e-3; value 0    ;}                                                                                                          
            f6  {d  4.141e-3; value 0    ;}                                                                                                          
            f7  {d  4.771e-3; value 1    ;}                                                                                                          
            f8  {d  5.402e-3; value 0    ;}                                                                                                          
            f9  {d  6.033e-3; value 0    ;}                                                                                                          
            f10 {d  6.665e-3; value 0    ;}                                                                                                          
            f11 {d  7.297e-3; value 0    ;}
            f12 {d  7.929e-3; value 0    ;}                                                                                                          
            f13 {d  8.562e-3; value 0    ;}                                                                                                          
            f14 {d  9.194e-3; value 0    ;}                                                                                                          
            f15 {d  1.194e-2; value 0    ;}                                                                                                          
            f16 {d  2.400e-2; value 0    ;}                                                                                                          
            f17 {d  2.700e-2; value 0    ;}                                                                                                          
            f18 {d  3.000e-2; value 0    ;}                                                                                                          
        );                                                                                                                                           
    }                                                                                                                                                                                                                                                                                                    
    residualAlpha   1e-4;   
}

into

type    thermalPhaseChangePopulationBalanceTwoPhaseSystem;                                                                                                                                                                                                                                                                

phases (gas liquid);                                                                                                                                                                                                                                                                                   

// phase change in the bulk of the fluid.                                                                                                            
phaseChange off;                                                                                                                                             

populationBalances (bubbles);

gas                                                                                                                                                  
{                                                                                                                                                    
    type            purePhaseModel;                                                                                                                  
    diameterModel   velocityGroup;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        

    velocityGroupCoeffs                                                                                                                              
    {                                                                                                                                                
        populationBalance    bubbles;                                                                                                                                                                                                                                                   
        formFactor      0.5235987756;                                                                                                                
                                                                                                                                      
        sizeGroups                                                                                                                                   
        (                                                                                                                                            
            f0  {d  0.5e-4; value   0    ;}                                                                                                          
            f1  {d  1.040e-3; value 0    ;}                                                                                                          
            f2  {d  1.640e-3; value 0    ;}                                                                                                          
            f3  {d  2.265e-3; value 0    ;}                                                                                                          
            f4  {d  2.889e-3; value 0    ;}                                                                                                          
            f5  {d  3.512e-3; value 0    ;}                                                                                                          
            f6  {d  4.141e-3; value 0    ;}                                                                                                          
            f7  {d  4.771e-3; value 1    ;}                                                                                                          
            f8  {d  5.402e-3; value 0    ;}                                                                                                          
            f9  {d  6.033e-3; value 0    ;}                                                                                                          
            f10 {d  6.665e-3; value 0    ;}                                                                                                          
            f11 {d  7.297e-3; value 0    ;}                      
            f12 {d  7.929e-3; value 0    ;}                                                                                                          
            f13 {d  8.562e-3; value 0    ;}                                                                                                          
            f14 {d  9.194e-3; value 0    ;}                                                                                                          
            f15 {d  1.194e-2; value 0    ;}                                                                                                          
            f16 {d  2.400e-2; value 0    ;}                                                                                                          
            f17 {d  2.700e-2; value 0    ;}                                                                                                          
            f18 {d  3.000e-2; value 0    ;}                                                                                                          
        );                                                                                                                                           
    }                                                                                                                                                                                                                                                                                                    
    residualAlpha   1e-4;   
}

further change lines

coalescenceModels                                                                                                                            
        (                                                                                                                                            
            PrinceBlanch                                                                                                                             
            {                                                                                                                                        
                C1  0.05;                                                                                                                            
                h0  1e-4;                                                                                                                            
                hf  1e-8;   
                turbulentCollisions     true;                                                                                                        
                buoyantCollisions       false;                                                                                                       
                laminarShearCollisions  false;
             }                                                                                                                                        
        );

into

       coalescenceModels                                                                                                                            
        (                                                                                                                                            
            PrinceBlanch                                                                                                                             
            {                                                                                                                                        
                C1  0.05;                                                                                                                            
                h0  1e-4;                                                                                                                            
                hf  1e-8;                                                                                                                            
                turbulence     true;                                                                                                                 
                buoyancy       false;                                                                                                                
                laminarShear  false;                                                                                                                 
            }                                                                                                                                        
        );                     

and

        driftModels                                                                                                                                  
        (                                                                                                                                            
            phaseChange                                                                                                                              
            {                                                                                                                                        
                pairNames (gasAndLiquid);                                                                                                            
            }                                                                                                                                        
                                                                                                                                                     
            densityChange{}                                                                                                                          
        );   

into

        driftModels                                                                                                                                  
        (                                                                                                                                            
            phaseChange                                                                                                                              
            {                                                                                                                                        
                pairs ((gas and liquid));                                                                                                            
            }                                                                                                                                        
                                                                                                                                                     
            densityChange{}                                                                                                                          
        );                        

Then change following line in constant/water/turbulenceProperties.liquid from

simulationType  laminar;

into

simulationType  RAS;

Then run

$./Allrun

When you have a look at the log.chtMultiRegionTwoPhaseEulerFoam you will see that no PPB is calculated during any iteration.

Change following lines in system/water/fvSolution

       solveOnFinalIterOnly    true;

into

       solveOnFinalIterOnly    false;

run

$./Allclean
$./Allrun

in the log.chtMultiRegionTwoPhaseEulerFoam, you can see the PPB being calculated each iteration.

Example case

Mentioned in the step to reproduce. Shown at a tutorial case

What is the current bug behaviour?

No PPB is calculated if chosen to run only during the last iteration.

What is the expected correct behavior?

User should be able to choose when the PPB runs. User might think that the PPB runs during the last iteration even though it is not apparent in the log. However, the true is it does not run at all. Explanation in the fix section.

Relevant logs and/or images

Environment information

  • OpenFOAM version : v1906
  • Operating system : Ubuntu 16.04.6 LTS
  • Hardware info :
  • Compiler : gcc

Most probably, the same issue will be also with v2006.

Possible fixes

The problem is that chtMultiRegionTwoPhaseEulerFoam does not cunstruct object of pimpleControl class and does not use it. It is rather "hard coded" in the solver to be able to do the iterations based on the user choice. However, populationBalanceModel class uses the pimpleControl class. Then it comes to line populationBalanceModel.C:1236

if (!solveOnFinalIterOnly || pimple_.finalIter())

where it decides whether to calculate the PPB. If the solveOnFinalIterOnly true, it means that this if condition should evaluate true only when pimple_.finalIter() = true, but that never happen because the function pimple_.finalIter() gives false

 inline bool Foam::pimpleControl::finalIter() const
 {
     return converged_ || (corr_ == nCorrPIMPLE_);
 }

because the corr_ is always equal to zero.

Some time ago, I worked on the same solver using the version of OpenFOAM Foundation. There is available class called pimpleMultiRegionControl, which manages the pimple logic for multiregion solvers. Having that, I only made a copy of populationBalanceModel class and changed the costructer to use pimpleMultiRegionControl instead of pimpleControl. Certainly, this leads to code duplication because majority of lines for populationBalanceModel are same. Further more if pimpleMultiRegionControl is used in ESI group version then other multiregion solvers should be adjusted adequatly.

Certainly, there might be some other ways how to pass the information about the last iteration to populationBalanceModel class.

Assignee
Assign to
Time tracking