precice / tutorials

Various tutorial cases for the coupling library preCICE with real solvers. These files are meant to be rendered on precice.org, so don't look at the README files here.
https://www.precice.org/
GNU Lesser General Public License v3.0
103 stars 105 forks source link

Some FSI tutorials are not working with OpenFOAM6 #40

Closed BenjaminRodenberg closed 4 years ago

BenjaminRodenberg commented 5 years ago

What's the problem?

I am using OpenFOAM6 on my machine and the tutorial cases tutorials/FSI/cylinderFlap/* do not work. I explicitly tested the case tutorials/FSI/cylinderFlap/OpenFOAM-FEniCS while checking #38. For the other cases I tried executing runFluid and it always resulted in an error thrown by OpenFOAM (OF), even before the coupling was initialized.

My proposed workaround

Commenting out some lines in Fluid/system/fvSolution does the trick and it works:

PIMPLE
{
    nCorrectors 2;
    nNonOrthogonalCorrectors 0;
    tolerance 1.0e-14;
    relTol 5e-3;
    pisoTol 1e-6;
    consistent  true;

    nOuterCorrectors 50;

    // residualControl
    // {
    //        U
    //    {
    //        tolerance 5e-5;
    //        relTol      0;
    //    }
    //    p
    //    {
   //         tolerance 5e-4;
   //         relTol      0;
   //     }
   // }
}

Note again: I only explicitly tested the case with OpenFOAM and FEniCS. For OpenFOAM and deal.II, OpenFOAM and CalculiX respectively, I only ran runFluid and with the changes mentioned above OpenFOAM does not exit with an error, but executes until coupling is initialized and it is waiting for the second participant.

What I already did

What should we do now?

The fix I am proposing above seems to work. However, there are some more things we should do in order to improve the compatibility of the tutorials with different version of OpenFOAM (bold for important ones and italics for less important):

MakisH commented 4 years ago

I can confirm this issue: OpenFOAM.org changed the expected structure of residualControl in version 6, see e.g. this discussion on CFDOnline. The Fluid simulation exits already in the beginning of pimpleFoam:

--> FOAM FATAL ERROR: 
Solution convergence criteria specified in PIMPLE.residualControl must be given as single values. Corrector loop convergence criteria, if appropriate, are specified as dictionaries in PIMPLE.<loopName>ResidualControl.

    From function bool Foam::singleRegionConvergenceControl::readResidualControls()
    in file cfdTools/general/solutionControl/convergenceControl/singleRegionConvergenceControl/singleRegionConvergenceControl.C at line 73.

78 comments-out the residualControl and adds the OpenFOAM 6 or newer alternative.

On the rest of the comments: