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/)
-   -   solver twoLiquidMixingFoam: from transient to steady state (https://www.cfd-online.com/Forums/openfoam-programming-development/197621-solver-twoliquidmixingfoam-transient-steady-state.html)

Triggin January 11, 2018 07:27

solver twoLiquidMixingFoam: from transient to steady state
 
I have the following problem:
I have a domain (at the beginning filled with air), which is flooded with nitrogen. Hence the setup is as followed:
  • Inlet with 100% nitrogen
  • Domain (internalField) will create a balance between nitrogen and oxygen.
  • At the outlet the nitrogen is released and oxygen flows in at the same time (different partial pressures, probably by diffusion).

The flow speeds are low (Re < 900), so I assume laminar flow behaviour.

Transient works so far (solver: twoLiquidMixingFoam).

My question now: Is it possible to rewrite the solver, or even solver, from transient to steady-state? I couldn't find a thread for it. Probably you have to compile some stuff, etc.

I'm currently working with OF 3.0.1 but will change within the next days to OF 5.0

Thank you very much - if you need more information, please ask me.
Greetings
Triggin

Triggin January 14, 2018 09:26

Update
 
Hi everyone

Before ready everything: If you are very familiar with error message, please jump directly to the error message i've implemented at the end.

Ok, i managed it to compile a new "myTwoLiquidMixingFoam"-solver (based on the common tutorials). More interesting are probably the changes i did:

Solver

UEqn & pEqn
I switched UEqn.H and pEqn.H based on the SIMPLE-solver from the sources and therefore deleted the time derivative.

myTwoLiquidMixingFoam.C
Switched from pimpleControl pimple(mesh) to simpleControl simple(mesh); and deleted the while (runTime.run()) loop as well as the .correct() and .turbCorr() subs.

createFields.H
switched from pimple.dict() to simple.dict().

The compiling of the solver worked and i'm able to run the solver (what doesn't literally mean that i did everything correct). Well then, lets talk about the case:

Case

0-Folder
I dont think i made any mistake. It contains anyway only three files: "alpha.air", "p_rgh" and "U".

constant-Folder
Same here. I think there isn't any fault within the containing files.

system-Folder
Contains all the common files. Lets go through those:
controlDict: Change the application and switched to the general settings for steady-state solvers.

fvSchemes:
Code:

ddtSchemes
{
 default          steadyState; // Euler;
}
gradSchemes
{
 default          Gauss linear;
}
divSchemes
{
    default        none;
    div(rhoPhi,U)  bounded Gauss linear;
    div(phi,alpha)  bounded Gauss vanLeer;
    div(phi,k)      bounded Gauss limitedLinear 1;
    div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
    default        Gauss linear corrected;
}
interpolationSchemes
{
    default        linear;
}
snGradSchemes
{
    default        corrected;
}

fvSolutions:
Code:

solvers
{
    "alpha.air.*"
    {
        nAlphaSubCycles    2;
        nAlphaCorr          1;
        solver          smoothSolver;
        smoother        GaussSeidel;
        tolerance      1e-9;
        relTol          0;
        nSweeps        1;
    }
    p_rgh
    {
        solver          GAMG;
        tolerance      1e-06;
        relTol          0.01;
        smoother        GaussSeidel;
        cacheAgglomeration true;
        nCellsInCoarsestLevel 10;
        agglomerator    faceAreaPair;
        mergeLevels    1;
    }
    p_rghFinal
    {
        $p_rgh;
        relTol          0;
    }
    U
    {
        solver          smoothSolver;
        smoother        GaussSeidel;
        tolerance      1e-05;
        relTol          0.1;
        nSweeps        1;
    }
    UFinal
    {
        $U;
        relTol          0;
    }
}

SIMPLE
{
    nNonOrthogonalCorrectors 0;
    consistent      yes;
    residualControl
    {
        p              1e-4;
        U              1e-4;
        "(k|epsilon|omega|f|v2)" 1e-3;
    }
}

Error
At the moment i get the following error:
Code:

smoothSolver:  Solving for Ux, Initial residual = 0.474873, Final residual = 0.0471319, No Iterations 5
smoothSolver:  Solving for Uy, Initial residual = 0.490154, Final residual = 0.0385122, No Iterations 7
smoothSolver:  Solving for Uz, Initial residual = 0.705268, Final residual = 0.0532092, No Iterations 8
Foam::error::printStack(Foam::Ostream&) at ??:?
Foam::sigFpe::sigHandler(int) at ??:?
? in "/lib64/libc.so.6"
double Foam::sumProd<double>(Foam::UList<double> const&, Foam::UList<double> const&) at ??:?
Foam::PCG::solve(Foam::Field<double>&, Foam::Field<double> const&, unsigned char) const at ??:?
Foam::GAMGSolver::solveCoarsestLevel(Foam::Field<double>&, Foam::Field<double> const&) const at ??:?
Foam::GAMGSolver::Vcycle(Foam::PtrList<Foam::lduMatrix::smoother>  const&, Foam::Field<double>&, Foam::Field<double>  const&, Foam::Field<double>&,  Foam::Field<double>&, Foam::Field<double>&,  Foam::Field<double>&, Foam::Field<double>&,  Foam::PtrList<Foam::Field<double> >&,  Foam::PtrList<Foam::Field<double> >&, unsigned char)  const at ??:?
Foam::GAMGSolver::solve(Foam::Field<double>&, Foam::Field<double> const&, unsigned char) const at ??:?
Foam::fvMatrix<double>::solveSegregated(Foam::dictionary const&) at ??:?

Beforehand: I cannot use the OF-Debug mode, since I'm working on a cluster and do not have the permissions to compile OF or install packages.

Ok, back to the error message:
It states to me that there is an error withing the PCG-Solver which I actually don't even use. Next is the GAMGSolver mentioned...but this is from my point of view the standard solver. I also added the smoother, so...what could be the error?

I hope this helps to get at least one reply :o

Best wishes to everyone

isaac_w21 April 27, 2019 13:27

Hi Folks,

I also need the steadyState twoLiquidMixingFoam solver, has anyone made the solver?
or does anyone know how to rewrite a transient solver to steady?

I hope somebody reply
thanks in advance


All times are GMT -4. The time now is 17:21.