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

residual controls in chtMultiRegionSimpleFoam

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By karlli
  • 1 Post By andre.weiner

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 17, 2013, 06:14
Default residual controls in chtMultiRegionSimpleFoam
  #1
New Member
 
Andre Weiner
Join Date: Aug 2012
Posts: 29
Rep Power: 13
andre.weiner is on a distinguished road
Hello!

I set up a chtMultiRegionSimpleFoam-case in OpenFOAM 2.2.2 .
After everything was working fine, i tried to apply residual control in the typical way:

Code:
    residualControl 
    { 
        p               1e-2; 
        U               1e-3; 
        "(k|omega)"   1e-3; 
    }
I defined this in the SIMPLE sub-dictionary of each regions fvSolution-file and also in the global fvSolution file, just to see what happens.

After trying some konfigurations i noticed that it doesn't work.
So i took a look at the sources of chtMultiRegionSimpleFoam and compared them to simpleFoam.C:

  • chtMultiRegionSimpleFoam does runTime.loop() while simpleFoam does simple.loop() for the global loop.
  • the .h-files readFluidMultiRegionSIMPLEControls and readFluidMultiRegionSIMPLEControls are just looking for nNonOrthogonalCorrectors in the SIMPLE sub-dictionary of each region
So, to my understanding it obviously can't work and i think it's not possible to make it work just with a few changes in the sources of chtMultiRegionSimpleFoam. (for instance the residual of a field that is present in multiple regions has to be checked region by region and this would require changes in simpleControl.C).


Are my assumptions right so far? If yes, is there any workaround?
Thanks for your answers :-)


Best regards Andre
andre.weiner is offline   Reply With Quote

Old   April 23, 2015, 20:53
Default
  #2
New Member
 
Dan
Join Date: Jan 2014
Location: Australia
Posts: 2
Rep Power: 0
scintilla is on a distinguished road
bump... I'm having the same problem, residual controls still (2.3.X.git) do not seem to work for chtMultiRegionSimpleFoam.
scintilla is offline   Reply With Quote

Old   April 24, 2015, 14:23
Default
  #3
Senior Member
 
Alex
Join Date: Oct 2013
Posts: 337
Rep Power: 21
zfaraday will become famous soon enough
Residual controls don't work in OF 2.2.x nor in 2.3.x either. It's a shame that such tool is not implemented to work in multi region cases. I hope that some day this issue will be fixed so that we will be able to control multi region runs and make them stop once the final solution is reached...

Best regards,

Alex
__________________
Web site where I present my Master's Thesis: foamingtime.wordpress.com

The case I talk about in this site was solved with chtMultiRegionSimpleFoam solver and involves radiation. Some basic tutorials are also resolved step by step in the web. If you are interested in these matters, you are invited to come in!
zfaraday is offline   Reply With Quote

Old   April 24, 2015, 15:03
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings to all!

I've had a look into the source code for OpenFOAM 2.3.x and Andre's original diagnosis is still correct and accurate.

It's not exactly easy to implement this feature in chtMultiRegionSimpleFoam, due to the fact that each region has its own levels of residual values, therefore it would be necessary to implement a special class derived from solutionControl specifically for multi-region cases, which would check for the residuals for all regions and see if all are below the desired values.
My guess is that if someone reports this on the bug tracker for OpenFOAM, either one of the following scenarios might occur:
  • The report is closed stating that such a feature can only be implemented if someone sponsors it.
  • And/or they ask for source code contribution with such a new feature.
Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   May 14, 2016, 07:44
Default
  #5
New Member
 
Karl Lindqvist
Join Date: Jul 2012
Posts: 21
Rep Power: 13
karlli is on a distinguished road
Dear all,
I have made some modifications to the original multi-region solvers (steady state and transient) to incorporate residuals checking in ONE fluid region. This can be useful for those of you working on heat transfer between a solid and a single fluid region, where the solid residuals can be managed separately.

The code is available at https://github.com/kelindqv/chtMultiRegionResFoam

Best regards,
Karl
Nomitude likes this.
karlli is offline   Reply With Quote

Old   May 16, 2016, 05:14
Thumbs up
  #6
New Member
 
Andre Weiner
Join Date: Aug 2012
Posts: 29
Rep Power: 13
andre.weiner is on a distinguished road
Thanks for sharing your approach!

Cheers Andre
andre.weiner is offline   Reply With Quote

Old   June 2, 2016, 06:00
Default
  #7
New Member
 
Stephan Derkohlkopf
Join Date: Feb 2016
Posts: 2
Rep Power: 0
Nomitude is on a distinguished road
Hello Karl,

I find your code very interesting since residual control would speed up my simulations a lot. thanks for sharing
Just to be sure - is it intended for 2.3.x or 3.0.x? I'm running 3.0.1 and it's crashing after the mesh creation

greetings
Stephan
Nomitude is offline   Reply With Quote

Old   December 1, 2016, 10:26
Default
  #8
Member
 
Andrea Di Ronco
Join Date: Nov 2016
Location: Milano, Italy
Posts: 56
Rep Power: 9
Diro7 is on a distinguished road
Hello everyone,

I'm basically new to openfoam and I'm trying to use chtmultiregionsimplefoam to simulate a problem related to my thesis work.

Everything seems to work (more or less), except for residual control which apparently is not providing sensible effect on the simulation.

This seems the only thread on the topic and I see that it was created quite long time ago: does anyone know wheter this feature is now implemented in chtmultiregionsimplefoam or not?

Thank you very much.
Greetings to everyone,

Andrea
Diro7 is offline   Reply With Quote

Old   December 2, 2016, 07:38
Default
  #9
New Member
 
Andre Weiner
Join Date: Aug 2012
Posts: 29
Rep Power: 13
andre.weiner is on a distinguished road
Quote:
Originally Posted by Diro7 View Post
Hello everyone,

I'm basically new to openfoam and I'm trying to use chtmultiregionsimplefoam to simulate a problem related to my thesis work.

Everything seems to work (more or less), except for residual control which apparently is not providing sensible effect on the simulation.

This seems the only thread on the topic and I see that it was created quite long time ago: does anyone know wheter this feature is now implemented in chtmultiregionsimplefoam or not?

Thank you very much.
Greetings to everyone,

Andrea
Hello Andrea:

I just checked the chtMultiRegionSimpleFoam solver in openfoam-dev and there is still no residual control. The easiest way is currently to check the residuals manually.

Cheers Andre
Diro7 likes this.
andre.weiner is offline   Reply With Quote

Old   December 2, 2016, 07:56
Default
  #10
Member
 
Andrea Di Ronco
Join Date: Nov 2016
Location: Milano, Italy
Posts: 56
Rep Power: 9
Diro7 is on a distinguished road
Quote:
Originally Posted by andre.weiner View Post
Hello Andrea:

I just checked the chtMultiRegionSimpleFoam solver in openfoam-dev and there is still no residual control. The easiest way is currently to check the residuals manually.

Cheers Andre
Hi Andre,

thank you so much for your quick reply.
I'll just continue checking manually the residuals, it's not such a big problem

Have a nice day,
Andrea
Diro7 is offline   Reply With Quote

Old   March 12, 2020, 02:19
Default h residual goes on increasing
  #11
Member
 
Vishnu
Join Date: May 2019
Location: Tamilnadu, India
Posts: 55
Rep Power: 6
Vishsel is on a distinguished road
Hello everyone,

I'm using chtMultiRegionSimpleFoam and in the attached residual image, h residual are goes on increasing after even stopping the solver at 16000 iterations..
Could anyone please provide any solution or suggestion for this issue ?

This is the Residuals file i'm using:

Code:
set logscale y
set title "Residuals"
set ylabel 'Residual'
set xlabel 'Iteration'
plot "< cat log | grep 'Solving for Ux' | cut -d' ' -f9 | tr -d ','" title 'Ux' with lines,\
     "< cat log | grep 'Solving for Uy' | cut -d' ' -f9 | tr -d ','" title 'Uy' with lines,\
     "< cat log | grep 'Solving for Uz' | cut -d' ' -f9 | tr -d ','" title 'Uz' with lines,\
     "< cat log | grep 'Solving for epsilon' | cut -d' ' -f9 | tr -d ','" title 'epsilon' with lines,\
     "< cat log | grep 'Solving for k' | cut -d' ' -f9 | tr -d ','" title 'k' with lines,\
     "< cat log | grep 'Solving for h' | cut -d' ' -f9 | tr -d ','" title 'h' with lines,\
     "< cat log | grep 'Solving for p_rgh' | cut -d' ' -f9 | tr -d ','" title 'p_rgh' with lines
pause 1
reread
controlDict file

Code:
application     chtMultiRegionSimpleFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime         50000;

deltaT          1;

writeControl    timeStep;

writeInterval   1000;

purgeWrite      0;

writeFormat     binary;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

graphFormat     raw;

runTimeModifiable true;
fvSchemes for fluid

Code:
ddtSchemes
{
    default         steadyState;
}

gradSchemes
{
    default         cellLimited leastSquares 1.0;
}

divSchemes
{
    //default         none;
    div(phi,U)      bounded Gauss upwind;
    div(phi,h)      bounded Gauss upwind;
    div(phi,e)      bounded Gauss upwind;
    div(phi,K)      bounded Gauss upwind;
    div(phi,k)      bounded Gauss upwind;
    div(phi,epsilon) bounded Gauss upwind;
    div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
}

laplacianSchemes
{
    default         Gauss linear corrected;
}

interpolationSchemes
{
    default         linear;
}

snGradSchemes
{
    default         corrected;
}

fluxRequired
{
    default         no;
    p_rgh;
}
fvSolution for fluid

Code:
solvers
{
    p_rgh
    {
        solver           GAMG;
        tolerance        1e-7;
        relTol           0.1;
        smoother         DIC;
        cacheAgglomeration true;
        nCellsInCoarsestLevel 10;
        agglomerator     faceAreaPair;
        mergeLevels      1;
    }

    "(U|e|k|h|epsilon)"
    {
        solver          PBiCG;
        preconditioner  DILU;
        tolerance       1e-7;
        relTol          0.1;
    } 
}

SIMPLE
{
    nNonOrthogonalCorrectors 0;
    rhoMin          rhoMin [1 -3 0 0 0] ****;
    rhoMax          rhoMax [1 -3 0 0 0] ****;
    residualControl
    {
        h
        {
            tolerance 1e-7;
        }
    }   
}

relaxationFactors
{
    fields
    {
        p_rgh           0.7;
    }
    equations
    {
        h                0.95;
        U               0.3;
        k               0.8;
        epsilon         0.8;
    }
}
fvSchemes for solid

Code:
ddtSchemes 
{ 
    default         steadyState; 
} 

gradSchemes 
{ 
    default         cellLimited leastSquares 1.0;
} 

divSchemes 
{ 
    default         none;
} 

laplacianSchemes 
{ 
    //default             none;
    laplacian(alpha,h)  Gauss linear limited corrected 0.33; 
} 

interpolationSchemes 
{ 
    default         linear; 
} 

snGradSchemes 
{ 
    default         corrected; 
} 

fluxRequired 
{ 
    default         no; 
}
fvSolution for solid

Code:
solvers 
{ 
    h 
    { 
        solver          PCG;
        preconditioner  DIC;
        tolerance       1e-7;
        relTol          0.1;
    } 
} 

SIMPLE 
{ 
    nNonOrthogonalCorrectors 0;
    residualControl
    {
        h
        {
            tolerance 1e-7;
        }
    }      
} 

relaxationFactors 
{ 
    fields 
    { 
    } 
    equations 
    { 
        h               0.95; 
    } 
}
Thank you in advance
Vishsel
Attached Images
File Type: jpg Residual.jpg (52.2 KB, 45 views)

Last edited by Vishsel; March 12, 2020 at 05:46. Reason: Adding of solver setting files
Vishsel is offline   Reply With Quote

Reply


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
Unstabil Simulation with chtMultiRegionFoam mbay101 OpenFOAM Running, Solving & CFD 13 December 28, 2013 13:12
Micro Scale Pore, icoFoam gooya_kabir OpenFOAM Running, Solving & CFD 2 November 2, 2013 13:58
pimpleFoam: turbulence->correct(); is not executed when using residualControl hfs OpenFOAM Running, Solving & CFD 3 October 29, 2013 08:35
calculation stops after few time steps sivakumar OpenFOAM Running, Solving & CFD 7 March 17, 2013 06:37
Orifice Plate with a fully developed flow - Problems with convergence jonmec OpenFOAM Running, Solving & CFD 3 July 28, 2011 05:24


All times are GMT -4. The time now is 10:48.