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

residual control with PISO or NonOrthogonality

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 29, 2015, 09:18
Default residual control with PISO or NonOrthogonality
  #1
Senior Member
 
Daniel Witte
Join Date: Nov 2011
Posts: 148
Rep Power: 14
danny123 is on a distinguished road
Hello,

I want to change the implementation of residual control in OpenFoam somewhat (interDymFoam is used). Right now, if you add additional PISO loops or Nonorthogonal corrections, the abstol is taken from the last iteration. I want to change this that it takes always the value of corrPISO == 1 (for 0 there is no pressure equation) and NonOrthogonalCorr == 0.

In order to do this, I thought to add an object in pimpleControlI.H:

Code:
inline bool Foam::pimpleControl::firstPISONOC() const
{
    return ((corrPISO_ == 1) && (corrNonOrtho_ == 0));
}
Now, this object can be called in PimpleControl.C similar to "storeIni". My problem is, that the object needs to be stored somewhere (abstol is local). I could do something similar like defining a new object like

Code:
residualControl_[fieldI].initialabstol
But where do I have to do this? I found in the C++ guide an object in solutionControl.H:

Code:
public:

    struct fieldData
    {
        wordRe name;
        scalar absTol;
        scalar relTol;
        scalar initialResidual;
    };
Can I just add the object to this?

Thanks for the support.

Regards,

Daniel
danny123 is offline   Reply With Quote

Old   July 3, 2015, 05:26
Default
  #2
Senior Member
 
Daniel Witte
Join Date: Nov 2011
Posts: 148
Rep Power: 14
danny123 is on a distinguished road
I am kind of stuck with this and would appreciate some help. The solution sketched up below does not work. The reason why is simple: the residual control check is done after each PIMPLE loop. At this point, CorrPISO_ and corrNonOrtho_ are reset to 0 (since the loops are finished) and abstol is that of the last matrix iteration.

This means calling a procedure to check for CorrPISO_ or corrNonOrtho_ to be any number is pointless, since they are always constant (= 0) at this point.

This opens up a question: why does OpenFoam has check procedure storeInitialResiduals() specifying CorrPISO_ and corrNonOrtho_ (among others) if these numbers are 0 anyway? It would be sufficient to check for corr_.

There are two initial residuals stored, the very first one (called first) and, as said the last. I would need the first of each PIMPLE step as residual. I checked if this residual is saved somewhere or if I can save it by overwriting a number within e.g. the application solver. Unfortunatly, the residuals are protected and cannot be overwritten.

The best way to do what I want would be the use the variable sp.first().initialResidual() and update after each PIMPLE loop. But this does not seem to work. It is only saved the very first PIMPLE loop. Can anybody tell me, where this is done? I would like to change this, but I do not find any first() object in solverPerformance.C. Is there a list of residuals stored?

Regards,

Daniel
danny123 is offline   Reply With Quote

Old   July 3, 2015, 10:12
Default
  #3
Senior Member
 
Daniel Witte
Join Date: Nov 2011
Posts: 148
Rep Power: 14
danny123 is on a distinguished road
So, I figured it out finally. The solverPerformance object is a list that can be read out. So, all that was needed is to find the right row where to find the information. In pimpleControl.C instead of

Code:
            const scalar residual = = sp.last().initialResidual();
you replace by:

Code:
            scalar residual;
            label spSize = sp.size();

            if ((sp.first().fieldName() == "p_rgh") || (sp.first().fieldName() == "p"))
            {
                 residual = sp[spSize-nCorrPISO_*(nNonOrthCorr_+1)].initialResidual();
            }
            else
            {
                 residual = sp.last().initialResidual();
            }
So, the initial residual of the 1st PISO loop (no non orthogonal correction made yet), will be picked for residual control.
This works for interFoam, where the outer loop is alpha1Eqn and there inner loops are for p_rghEqn only, but should work for other solvers too (I did not test this) as long as the pressure is designated p_rgh or p.

Regards,

Daniel
danny123 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
simpleFoam error - "Floating point exception" mbcx4jc2 OpenFOAM Running, Solving & CFD 12 August 4, 2015 02:20
Unstabil Simulation with chtMultiRegionFoam mbay101 OpenFOAM Running, Solving & CFD 13 December 28, 2013 13:12
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 11:10.