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/)
-   -   residual controls in chtMultiRegionSimpleFoam (https://www.cfd-online.com/Forums/openfoam-programming-development/127669-residual-controls-chtmultiregionsimplefoam.html)

andre.weiner December 17, 2013 06:14

residual controls in chtMultiRegionSimpleFoam
 
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

scintilla April 23, 2015 20:53

bump... I'm having the same problem, residual controls still (2.3.X.git) do not seem to work for chtMultiRegionSimpleFoam.

zfaraday April 24, 2015 14:23

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

wyldckat April 24, 2015 15:03

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

karlli May 14, 2016 07:44

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

andre.weiner May 16, 2016 05:14

Thanks for sharing your approach!

Cheers Andre

Nomitude June 2, 2016 06:00

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

Diro7 December 1, 2016 10:26

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

andre.weiner December 2, 2016 07:38

Quote:

Originally Posted by Diro7 (Post 627792)
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 December 2, 2016 07:56

Quote:

Originally Posted by andre.weiner (Post 627950)
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 :D

Have a nice day,
Andrea

Vishsel March 12, 2020 02:19

h residual goes on increasing
 
1 Attachment(s)
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


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