CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   solver for supersonic flow butane close to condensation (https://www.cfd-online.com/Forums/openfoam-solving/186074-solver-supersonic-flow-butane-close-condensation.html)

enginpower April 10, 2017 06:00

solver for supersonic flow butane close to condensation
 
Dear all,
I'm looking for a solver to simulate a flow through a nozzle in supersonic condition (about Mach 2) but with the possibility to evaluate the condensation of butane gas, due to conditions very close to the condensation of this gas.
As a starting point I'm considering sonicFoam solver, but I don't think it cover also the condensation possibility.
What do you suggest?

Moreover, how to implement the use of the Redlich-Kwong equation to consider the gas according to a real behaviour about calculating p, rho and T?
I read how to set a thermophysical model but it is not clear how to set a good one model for the butane. Is there a database where is possible to get a proper model for butane gas?
Moreover, I found some libraries, like this one but I don't know how to use them. Could anyone help on the way?
I'm just evaluating all possibilities I can have in OpenFOAM.

Thanks to who wants to help me!

enginpower April 18, 2017 09:05

No one can add some useful helps to this thread??!

I'm reading a lot of useful tutorials on the web but sometimes it's hard to understand how it will work in my case.
I'm focusing on the solver sonicFoam, but I've not understood how to perform a steady-state simulation. Practically, I'm not interested in the evolution of time, but I've not understood how to do that since sonicFoam is for unsteady simulation.

enginpower April 24, 2017 11:51

1 Attachment(s)
I tried to solve this case also with rhoSimpleFoam.
The problem is that it diverges but it is not clear why.
With this script:
Code:

#!/bin/bash

foamLog log >/dev/null

gnuplot -persist > /dev/null 2>&1 << EOF
        set logscale y
        set title "Residual vs. Iteration"
        set xlabel "Iteration"
        set ylabel "Residual"
        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 U' | cut -d' ' -f9 | tr -d ','" title 'U' with lines,\
        "< cat log | grep 'Solving for e' | cut -d' ' -f9 | tr -d ','" title 'e' with lines,\
            "< cat log | grep 'Solving for p' | cut -d' ' -f9 | tr -d ','" title 'p'  with lines,\
        "< cat log | grep 'Solving for k' | cut -d' ' -f9 | tr -d ','" title 'k' with lines,\
        "< cat log | grep 'Solving for epsilon' | cut -d' ' -f9 | tr -d ','" title 'epsilon' with lines,\
        "< cat log | grep 'Solving for T' | cut -d' ' -f9 | tr -d ','" title 'T' with lines,\
        "< cat log | grep 'Solving for nut' | cut -d' ' -f9 | tr -d ','" title 'nut' with lines,\
        "< cat log | grep 'Solving for alphat' | cut -d' ' -f9 | tr -d ','" title 'alphat' with lines
EOF

I tried to plot the residuals.

What I obtained is this: Attachment 55554
Not clear why does it not plot U, Ux, Uy and Uz, and the other variables, and moreover why 'e' has more iterations than other variables?

It will worthly help me to find the solution to my specific simulation

enginpower May 4, 2017 07:40

Could someone provide some useful helps to find a solution?
Mainly I don't understand why it doesn't plot all the variables and why some variables have more iterations than others.

I'll try some helpful suggestions, but now I'm stuck on this.:(:(:(

Thanks!!

enginpower May 4, 2017 08:35

This is the log file solver outputed, if it can help:
Code:

/*---------------------------------------------------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  4.1                                  |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
Build  : 4.1
Exec  : rhoSimpleFoam
Date  : May 04 2017
Time  : 14:19:39
Host  : "engine-VirtualBox"
PID    : 4696
Case  : /home/engine/OpenFoam/diffuse_rhoSimpleFoam
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0


SIMPLE: convergence criteria
    field p    tolerance 0.01
    field U    tolerance 0.0001
    field e    tolerance 0.001
    field "(k|epsilon|omega)"    tolerance 0.001

Reading thermophysical properties

Selecting thermodynamics package
{
    type            hePsiThermo;
    mixture        pureMixture;
    transport      sutherland;
    thermo          janaf;
    equationOfState PengRobinsonGas;
    specie          specie;
    energy          sensibleInternalEnergy;
}

Reading field U

Reading/calculating face flux field phi

Creating turbulence model

Selecting turbulence model type RAS
Selecting RAS turbulence model kEpsilon
kEpsilonCoeffs
{
    Cmu            0.09;
    C1              1.44;
    C2              1.92;
    C3              -0.33;
    sigmak          1;
    sigmaEps        1.3;
}

No MRF models present

No finite volume options present


Starting time loop

Time = 1

smoothSolver:  Solving for e, Initial residual = 1, Final residual = 0.0540073, No Iterations 1
GAMG:  Solving for p, Initial residual = 1, Final residual = 0.00371374, No Iterations 1
time step continuity errors : sum local = 0.146365, global = 0.074303, cumulative = 0.074303
rho max/min : 4.84782 2.38329
smoothSolver:  Solving for epsilon, Initial residual = 0.172435, Final residual = 0.00961314, No Iterations 2
smoothSolver:  Solving for k, Initial residual = 1, Final residual = 0.0693484, No Iterations 2
ExecutionTime = 39.26 s  ClockTime = 39 s

Time = 2

smoothSolver:  Solving for e, Initial residual = 0.206248, Final residual = 0.0125807, No Iterations 1
GAMG:  Solving for p, Initial residual = 0.497519, Final residual = 0.00163633, No Iterations 1
time step continuity errors : sum local = 0.0922393, global = 0.00722332, cumulative = 0.0815263
rho max/min : 4.68042 2.30108
smoothSolver:  Solving for epsilon, Initial residual = 0.081466, Final residual = 0.00135644, No Iterations 4
smoothSolver:  Solving for k, Initial residual = 0.135448, Final residual = 0.00222524, No Iterations 4
ExecutionTime = 60.8 s  ClockTime = 61 s

Time = 3

smoothSolver:  Solving for e, Initial residual = 0.0921914, Final residual = 0.0067252, No Iterations 1
GAMG:  Solving for p, Initial residual = 0.295628, Final residual = 0.00206877, No Iterations 1
time step continuity errors : sum local = 0.1348, global = -0.0479959, cumulative = 0.0335304
rho max/min : 4.5214 2.22033
smoothSolver:  Solving for epsilon, Initial residual = 0.0482015, Final residual = 0.00140061, No Iterations 4
smoothSolver:  Solving for k, Initial residual = 0.0592527, Final residual = 0.00145718, No Iterations 4
ExecutionTime = 81.9 s  ClockTime = 82 s

Time = 4

smoothSolver:  Solving for e, Initial residual = 0.0537717, Final residual = 0.0046956, No Iterations 1
GAMG:  Solving for p, Initial residual = 0.184845, Final residual = 0.00221746, No Iterations 1
time step continuity errors : sum local = 0.157532, global = -0.0805149, cumulative = -0.0469844
rho max/min : 4.37033 2.14308
smoothSolver:  Solving for epsilon, Initial residual = 0.0371772, Final residual = 0.00132592, No Iterations 4
smoothSolver:  Solving for k, Initial residual = 0.0359271, Final residual = 0.0011415, No Iterations 4
ExecutionTime = 102.71 s  ClockTime = 102 s

Time = 5

smoothSolver:  Solving for e, Initial residual = 0.037143, Final residual = 0.00366518, No Iterations 1
GAMG:  Solving for p, Initial residual = 0.119611, Final residual = 0.00216066, No Iterations 1
time step continuity errors : sum local = 0.162309, global = -0.094971, cumulative = -0.141955
rho max/min : 4.22682 2.06984
smoothSolver:  Solving for epsilon, Initial residual = 0.0308441, Final residual = 0.00137104, No Iterations 4
smoothSolver:  Solving for k, Initial residual = 0.0255359, Final residual = 0.000959661, No Iterations 4
ExecutionTime = 123.21 s  ClockTime = 123 s

Time = 6

smoothSolver:  Solving for e, Initial residual = 0.0281171, Final residual = 0.000449398, No Iterations 2
GAMG:  Solving for p, Initial residual = 0.0798722, Final residual = 0.00201198, No Iterations 1
time step continuity errors : sum local = 0.155986, global = -0.0975481, cumulative = -0.239504
rho max/min : 4.09048 2.00056
smoothSolver:  Solving for epsilon, Initial residual = 0.0354407, Final residual = 0.00139249, No Iterations 4
bounding epsilon, min: -3030.03 max: 17421.2 average: 207.091
smoothSolver:  Solving for k, Initial residual = 0.0198908, Final residual = 0.000838357, No Iterations 4
ExecutionTime = 143.7 s  ClockTime = 143 s

Time = 7

smoothSolver:  Solving for e, Initial residual = 0.0222361, Final residual = 0.000380718, No Iterations 2
GAMG:  Solving for p, Initial residual = 0.054566, Final residual = 0.00182607, No Iterations 1
time step continuity errors : sum local = 0.144461, global = -0.093211, cumulative = -0.332715
rho max/min : 3.96095 1.93506
smoothSolver:  Solving for epsilon, Initial residual = 0.0336136, Final residual = 0.00138304, No Iterations 4
bounding epsilon, min: -398.097 max: 18157.5 average: 207.952
smoothSolver:  Solving for k, Initial residual = 0.0164301, Final residual = 0.000750733, No Iterations 4
ExecutionTime = 163.52 s  ClockTime = 163 s

Time = 8

smoothSolver:  Solving for e, Initial residual = 0.0183909, Final residual = 0.000333399, No Iterations 2
GAMG:  Solving for p, Initial residual = 0.0381647, Final residual = 0.00164253, No Iterations 1
time step continuity errors : sum local = 0.131653, global = -0.0852954, cumulative = -0.41801
rho max/min : 3.8379 1.87311
smoothSolver:  Solving for epsilon, Initial residual = 0.0452828, Final residual = 0.00157203, No Iterations 4
bounding epsilon, min: -5692.65 max: 18873.5 average: 208.924
smoothSolver:  Solving for k, Initial residual = 0.0140894, Final residual = 0.00068383, No Iterations 4
ExecutionTime = 183.43 s  ClockTime = 183 s

Time = 9

smoothSolver:  Solving for e, Initial residual = 0.0156991, Final residual = 0.00029791, No Iterations 2
GAMG:  Solving for p, Initial residual = 0.0276336, Final residual = 0.000595807, No Iterations 2
time step continuity errors : sum local = 0.0477531, global = -0.0296898, cumulative = -0.4477
rho max/min : 3.72101 1.81453
smoothSolver:  Solving for epsilon, Initial residual = 0.0441157, Final residual = 0.00148421, No Iterations 4
bounding epsilon, min: -745.382 max: 19567.6 average: 209.922
smoothSolver:  Solving for k, Initial residual = 0.0125306, Final residual = 0.000631366, No Iterations 4
ExecutionTime = 202.69 s  ClockTime = 202 s

Time = 10

smoothSolver:  Solving for e, Initial residual = 0.0136794, Final residual = 0.000269679, No Iterations 2
GAMG:  Solving for p, Initial residual = 0.020065, Final residual = 0.000521133, No Iterations 2
time step continuity errors : sum local = 0.0423525, global = -0.0250551, cumulative = -0.472755
rho max/min : 3.60996 1.75873
smoothSolver:  Solving for epsilon, Initial residual = 0.0661285, Final residual = 0.00193734, No Iterations 4
bounding epsilon, min: -12255.9 max: 20241.8 average: 211.066
smoothSolver:  Solving for k, Initial residual = 0.0117622, Final residual = 0.000553884, No Iterations 4
ExecutionTime = 221.44 s  ClockTime = 221 s

Time = 11

smoothSolver:  Solving for e, Initial residual = 0.0121028, Final residual = 0.000246455, No Iterations 2
GAMG:  Solving for p, Initial residual = 0.0152189, Final residual = 0.000464024, No Iterations 2
time step continuity errors : sum local = 0.037845, global = -0.0211324, cumulative = -0.493887
rho max/min : 3.50446 1.70564
smoothSolver:  Solving for epsilon, Initial residual = 0.0631682, Final residual = 0.00171955, No Iterations 4
bounding epsilon, min: -1319.43 max: 21681.1 average: 212.209
smoothSolver:  Solving for k, Initial residual = 0.0100108, Final residual = 0.000557271, No Iterations 4
ExecutionTime = 240.19 s  ClockTime = 240 s

Time = 12


enginpower May 4, 2017 10:51

Another question is:
why should it stop if all variable residual variables are below 0.1?

Is there another problem about its stop? How to check it?

I have just this:
Code:

rhoSimpleFoam > log
#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::sigFpe::sigHandler(int) at ??:?
#2  ? in "/lib/x86_64-linux-gnu/libc.so.6"
#3  ? in "/lib/x86_64-linux-gnu/libm.so.6"
#4  pow in "/lib/x86_64-linux-gnu/libm.so.6"
#5  Foam::PengRobinsonGas<Foam::specie>::Z(double, double) const at ??:?
#6  Foam::PengRobinsonGas<Foam::specie>::cp(double, double) const at ??:?
#7  Foam::janafThermo<Foam::PengRobinsonGas<Foam::specie> >::cp(double, double) const at ??:?
#8  Foam::heThermo<Foam::psiThermo, Foam::pureMixture<Foam::sutherlandTransport<Foam::species::thermo<Foam::janafThermo<Foam::PengRobinsonGas<Foam::specie> >, Foam::sensibleInternalEnergy> > > >::CpByCpv() const at ??:?
#9  Foam::heThermo<Foam::psiThermo, Foam::pureMixture<Foam::sutherlandTransport<Foam::species::thermo<Foam::janafThermo<Foam::PengRobinsonGas<Foam::specie> >, Foam::sensibleInternalEnergy> > > >::alphaEff(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) const at ??:?
#10  Foam::EddyDiffusivity<Foam::ThermalDiffusivity<Foam::CompressibleTurbulenceModel<Foam::fluidThermo> > >::alphaEff() const at ??:?
#11  ? at ??:?
#12  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#13  ? at ??:?
Floating point exception (core dumped)

What could you suggest about that?


All times are GMT -4. The time now is 04:28.