Find answers, ask questions, and connect with our <br>community around the world.

Home Forums OpenFOAM Forum Post processsing Assignment on Lesson 19

  • Post processsing Assignment on Lesson 19

    Posted by Adityan Rajesh on March 1, 2022 at 6:15 am

    In the Assignment mentioned in Lesson 19.
    It is mentioned that we must copy the case of NACA Airfoil of the sonicfoam tutorial.
    I copied the geometry from the resources folder of the naca airfoil.
    But now I am confused as to how to mesh it.
    I have a few doubts.
    first is what is decomposeParDict? Is it used as a part of meshing? Because when I gave decomposePar after copying the geometry, it showed an error.
    Second is how to start of meshing it? Should I do it in ANSYS and then export it, or is there any other way using OpenFOAM tools as blockmesh nor SnappyHex Mesh is seen in the systems folder of the case.

    Barış Bicer replied 2 years, 3 months ago 2 Members · 12 Replies
  • 12 Replies
  • Barış Bicer

    Moderator
    March 6, 2022 at 4:42 am

    Hi Adityan,

    First, thank you for your question.

    To understand what is going on a tutorial, my suggestion is always to look at Allrun file which shows the required steps for running that case. As you can see below that Mesh is created in starCCM and then converted to OpenFOAM:

    # Convert mesh from resources directory
    runApplication star4ToFoam -scale 1 \
    “$FOAM_TUTORIALS”/resources/geometry/nacaAirfoil/nacaAirfoil

    You dont need to do anything. Only use below line (inside Allrun file) and delete other lines

    #!/bin/sh
    cd “${0%/*}” || exit # Run from this directory
    . ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
    #——————————————————————————

    restore0Dir

    # Convert mesh from resources directory
    runApplication star4ToFoam -scale 1 \
    “$FOAM_TUTORIALS”/resources/geometry/nacaAirfoil/nacaAirfoil

    after that only run this command : ./Allrun

    That will create your mesh.

    or simply you can copy nacaAirFoil folder from geometry to your case folder.

    cp -r $FOAM_TUTORIALS/resources/geometry/nacaAirfoil/nacaAirfoil .

    then use : star4ToFoam -scale 1 nacaAirfoil/nacaAirfoil.inp

    That will also create your mesh.

    I hope that it addresses your question.

    Best.

    Barış

  • Adityan Rajesh

    Member
    March 6, 2022 at 5:41 pm

    Thanks alot, I got the mesh.
    But now when I tried to run the simulation it is showing error.
    I simply ran the command sonicFoam.
    Should I need to add more commands?

  • Adityan Rajesh

    Member
    March 6, 2022 at 5:51 pm

    Thanks alot, I got the mesh.
    But now when I tried to run the simulation it is showing error.
    I simply ran the command sonicFoam.
    Should I need to add more commands?
    Because, when I went through the Allrun files, I went through the instructions accordingly.
    But it shows – runApplication: command not found
    How can I then run the case

  • Barış Bicer

    Moderator
    March 7, 2022 at 7:37 pm

    Hi Adityan,

    Yeah if you look at the Allrun file please do followings one by one :

    If you have already mesh then change the boundary type :

    —> sed -i -e ‘s/symmetry\([)]*;\)/empty\1/’ constant/polyMesh/boundary

    After that remove the files which are not needed :
    —> rm -f constant/cellTable constant/polyMesh/cellTableId constant/polyMesh/interfaces constant/polyMesh/origCellId

    And then , if you wanna run serial just type: sonicFoam

    or if you wanna run parallel (for example in 4 CPUs), first use : decomposePar (dont forget that you have to have decomposeParDict inside /system folder which have 4 CPUs setup)

    then run : mpirun -np 4 sonicFoam -parallel

    I hope that it makes all work for you.

    Best

    Barış

  • Adityan Rajesh

    Member
    March 8, 2022 at 7:43 am

    Hi Baris,
    I ran the same lines
    But when I tried to run the sonicFoam Command it showed me this:

    FOAM FATAL ERROR: (openfoam-2112)
    cannot find file “/home/adityan/OpenFOAM/adityan-v2112/run/assignments/nacaAirfoil/0/p”

    From virtual Foam::autoPtr<Foam::ISstream> Foam::fileOperations::uncollatedFileOperation::readStream(Foam::regIOobject&, const Foam::fileName&, const Foam::word&, bool) const
    in file global/fileOperations/uncollatedFileOperation/uncollatedFileOperation.C at line 542.

    FOAM exiting

    So I changed the 0.orig file name to 0
    and ran the sonicFoam Command again
    But initially I thought it was running
    then I understood that it’s running for a long time and still staying in Iteration 1.

  • Barış Bicer

    Moderator
    March 9, 2022 at 6:22 am

    Hi Adityan,

    I have checked the case. I have a bad news if you use Foundation variant of OpenFOAM (like of9 or etc…)

    There is no any tutorial which is called sonicFoam.. (OMG!!!) You can see below

    https://github.com/OpenFOAM/OpenFOAM-9/tree/master/tutorials/compressible

    As I said that I have been using ESI-variant of OpenFOAM around for 10 years and you can see in the below the solver of compressible flow which also includes the sonicFoam.

    https://github.com/OpenCFD/OpenFOAM-history/tree/master/tutorials/compressible

    So, it is not your fault…

    Please try to switch to ESI-variant of OpenFOAM.

    Best.

    Barış

  • Barış Bicer

    Moderator
    March 9, 2022 at 6:26 am

    Hi again,

    If you use ESI-variant of OpenFOAM then it works for me.

    For your info.

    baris@baris-VirtualBox:~/OpenFOAM/baris-v2106/run/nacaAirfoil$ sonicFoam
    /*—————————————————————————*\
    | ========= | |
    | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
    | \\ / O peration | Version: v2106 |
    | \\ / A nd | Website: http://www.openfoam.com |
    | \\/ M anipulation | |
    \*—————————————————————————*/
    Build : _c15bfde3cb-20210624 OPENFOAM=2106
    Arch : “LSB;label=32;scalar=64”
    Exec : sonicFoam
    Date : Mar 09 2022
    Time : 09:26:54
    Host : baris-VirtualBox
    PID : 26520
    I/O : uncollated
    Case : /home/baris/OpenFOAM/baris-v2106/run/nacaAirfoil
    nProcs : 1
    trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
    fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 5, maxFileModificationPolls 20)
    allowSystemOperations : Allowing user-supplied system call operations

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

    Create mesh for time = 0

    PIMPLE: Operating solver in PISO mode

    Reading thermophysical properties

    Selecting thermodynamics package
    {
    type hePsiThermo;
    mixture pureMixture;
    transport const;
    thermo hConst;
    equationOfState perfectGas;
    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 LaunderSharmaKE
    RAS
    {
    RASModel LaunderSharmaKE;
    turbulence on;
    printCoeffs on;
    Cmu 0.09;
    C1 1.44;
    C2 1.92;
    C3 0;
    sigmak 1;
    sigmaEps 1.3;
    }

    Creating field kinetic energy K

    No MRF models present

    No finite volume options present

    Starting time loop

    forceCoeffs forces:
    Not including porosity effects

    Time = 4e-08

    Courant Number mean: 0.000174184 max: 0.948172
    diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
    PIMPLE: iteration 1
    DILUPBiCGStab: Solving for Ux, Initial residual = 1, Final residual = 6.78533e-10, No Iterations 8
    DILUPBiCGStab: Solving for Uy, Initial residual = 0.997544, Final residual = 7.99872e-10, No Iterations 8
    DILUPBiCGStab: Solving for e, Initial residual = 0.999977, Final residual = 4.91035e-10, No Iterations 10
    DILUPBiCGStab: Solving for p, Initial residual = 1, Final residual = 2.91916e-15, No Iterations 3
    diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
    time step continuity errors : sum local = 1.52221e-08, global = -3.41095e-10, cumulative = -3.41095e-10
    DILUPBiCGStab: Solving for p, Initial residual = 2.50315e-06, Final residual = 9.59684e-14, No Iterations 1
    diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
    time step continuity errors : sum local = 1.52221e-08, global = -3.41095e-10, cumulative = -6.8219e-10
    DILUPBiCGStab: Solving for epsilon, Initial residual = 0.0201314, Final residual = 3.94958e-11, No Iterations 5
    DILUPBiCGStab: Solving for k, Initial residual = 1, Final residual = 4.86307e-11, No Iterations 8
    ExecutionTime = 0.26 s ClockTime = 0 s

    forceCoeffs forces execute:
    Coefficients
    Cd : 0.114207 (pressure: 0.10081 viscous: 0.0133972)
    Cs : -2.04442e-21 (pressure: -2.05083e-21 viscous: 6.41228e-24)
    Cl : 0.240746 (pressure: 0.239814 viscous: 0.000932111)
    CmRoll : -0.120373 (pressure: -0.119907 viscous: -0.000466055)
    CmPitch : -0.151506 (pressure: -0.149708 viscous: -0.00179818)
    CmYaw : 0.0571036 (pressure: 0.050405 viscous: 0.0066986)
    Cd(f) : -0.0632693
    Cd(r) : 0.177476
    Cs(f) : 0.0571036
    Cs(r) : -0.0571036
    Cl(f) : -0.0311332
    Cl(r) : 0.271879
    Time = 8e-08

    Courant Number mean: 0.000174179 max: 0.947253
    diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
    PIMPLE: iteration 1
    DILUPBiCGStab: Solving for Ux, Initial residual = 7.53056e-05, Final residual = 6.0881e-11, No Iterations 1
    DILUPBiCGStab: Solving for Uy, Initial residual = 0.000993166, Final residual = 2.17057e-10, No Iterations 1
    DILUPBiCGStab: Solving for e, Initial residual = 2.42244e-05, Final residual = 3.72535e-11, No Iterations 1
    DILUPBiCGStab: Solving for p, Initial residual = 1.3928e-05, Final residual = 1.93735e-15, No Iterations 2
    diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
    time step continuity errors : sum local = 1.51592e-16, global = -4.2809e-17, cumulative = -6.8219e-10
    DILUPBiCGStab: Solving for p, Initial residual = 5.03001e-07, Final residual = 1.0682e-13, No Iterations 1
    diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
    time step continuity errors : sum local = 1.32435e-15, global = 1.41919e-16, cumulative = -6.8219e-10
    DILUPBiCGStab: Solving for epsilon, Initial residual = 1.12416e-05, Final residual = 1.32119e-13, No Iterations 1
    DILUPBiCGStab: Solving for k, Initial residual = 6.74642e-05, Final residual = 1.38784e-12, No Iterations 1
    ExecutionTime = 0.41 s ClockTime = 1 s

    forceCoeffs forces execute:
    Coefficients
    Cd : 0.209812 (pressure: 0.195542 viscous: 0.0142697)
    Cs : -9.59162e-22 (pressure: -9.86263e-22 viscous: 2.71013e-23)
    Cl : 0.446133 (pressure: 0.445754 viscous: 0.000378739)
    CmRoll : -0.223066 (pressure: -0.222877 viscous: -0.000189369)
    CmPitch : -0.277259 (pressure: -0.275684 viscous: -0.00157464)
    CmYaw : 0.104906 (pressure: 0.0977712 viscous: 0.00713485)
    Cd(f) : -0.11816
    Cd(r) : 0.327972
    Cs(f) : 0.104906
    Cs(r) : -0.104906
    Cl(f) : -0.0541924
    Cl(r) : 0.500325
    Time = 1.2e-07

    Courant Number mean: 0.000174156 max: 0.891778
    diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
    PIMPLE: iteration 1
    DILUPBiCGStab: Solving for Ux, Initial residual = 2.46269e-06, Final residual = 8.78126e-10, No Iterations 1
    DILUPBiCGStab: Solving for Uy, Initial residual = 1.4366e-05, Final residual = 5.74339e-13, No Iterations 1
    DILUPBiCGStab: Solving for e, Initial residual = 8.77259e-06, Final residual = 1.49173e-12, No Iterations 1
    DILUPBiCGStab: Solving for p, Initial residual = 5.02263e-06, Final residual = 8.11807e-13, No Iterations 1
    diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
    time step continuity errors : sum local = 9.05512e-15, global = 1.12176e-15, cumulative = -6.82189e-10
    DILUPBiCGStab: Solving for p, Initial residual = 3.07789e-07, Final residual = 1.2533e-13, No Iterations 1
    diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
    time step continuity errors : sum local = 2.5771e-15, global = -5.35731e-17, cumulative = -6.82189e-10
    DILUPBiCGStab: Solving for epsilon, Initial residual = 7.34781e-06, Final residual = 1.36872e-13, No Iterations 1
    DILUPBiCGStab: Solving for k, Initial residual = 3.51345e-05, Final residual = 6.57833e-13, No Iterations 1
    ExecutionTime = 0.58 s ClockTime = 1 s

    forceCoeffs forces execute:
    Coefficients
    Cd : 0.278868 (pressure: 0.263928 viscous: 0.0149402)
    Cs : -4.81248e-22 (pressure: -5.03098e-22 viscous: 2.185e-23)
    Cl : 0.573166 (pressure: 0.573459 viscous: -0.000293065)
    CmRoll : -0.286583 (pressure: -0.286729 viscous: 0.000146533)
    CmPitch : -0.351814 (pressure: -0.350543 viscous: -0.00127053)
    CmYaw : 0.139434 (pressure: 0.131964 viscous: 0.00747008)
    Cd(f) : -0.147149
    Cd(r) : 0.426017
    Cs(f) : 0.139434
    Cs(r) : -0.139434
    Cl(f) : -0.0652307
    Cl(r) : 0.638397
    Time = 1.6e-07

    Courant Number mean: 0.000174141 max: 0.820787
    diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
    PIMPLE: iteration 1
    DILUPBiCGStab: Solving for Ux, Initial residual = 1.5686e-06, Final residual = 5.97908e-10, No Iterations 1
    DILUPBiCGStab: Solving for Uy, Initial residual = 8.45738e-06, Final residual = 3.017e-13, No Iterations 1
    DILUPBiCGStab: Solving for e, Initial residual = 4.94978e-06, Final residual = 6.54961e-13, No Iterations 1
    DILUPBiCGStab: Solving for p, Initial residual = 2.81722e-06, Final residual = 4.66042e-13, No Iterations 1
    diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
    time step continuity errors : sum local = 9.21714e-15, global = -1.59705e-15, cumulative = -6.8219e-10
    DILUPBiCGStab: Solving for p, Initial residual = 1.42286e-07, Final residual = 6.37998e-14, No Iterations 1
    diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
    time step continuity errors : sum local = 1.95431e-15, global = -6.19294e-17, cumulative = -6.8219e-10
    DILUPBiCGStab: Solving for epsilon, Initial residual = 5.57361e-06, Final residual = 1.33447e-13, No Iterations 1
    DILUPBiCGStab: Solving for k, Initial residual = 2.52466e-05, Final residual = 4.22826e-13, No Iterations 1
    ExecutionTime = 0.73 s ClockTime = 1 s

    forceCoeffs forces execute:
    Coefficients
    Cd : 0.332905 (pressure: 0.317657 viscous: 0.0152475)
    Cs : -1.97643e-22 (pressure: -2.19426e-22 viscous: 2.1783e-23)
    Cl : 0.655222 (pressure: 0.656215 viscous: -0.000993108)
    CmRoll : -0.327611 (pressure: -0.328107 viscous: 0.000496554)
    CmPitch : -0.398192 (pressure: -0.397272 viscous: -0.000920766)
    CmYaw : 0.166452 (pressure: 0.158829 viscous: 0.00762374)
    Cd(f) : -0.161158
    Cd(r) : 0.494063
    Cs(f) : 0.166452
    Cs(r) : -0.166452
    Cl(f) : -0.0705816
    Cl(r) : 0.725803
    Time = 2e-07

    Courant Number mean: 0.00017412 max: 0.768061
    diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
    PIMPLE: iteration 1
    DILUPBiCGStab: Solving for Ux, Initial residual = 1.24364e-06, Final residual = 4.53324e-10, No Iterations 1
    DILUPBiCGStab: Solving for Uy, Initial residual = 6.08246e-06, Final residual = 8.43095e-10, No Iterations 1
    DILUPBiCGStab: Solving for e, Initial residual = 3.39466e-06, Final residual = 8.44256e-10, No Iterations 1
    DILUPBiCGStab: Solving for p, Initial residual = 1.90451e-06, Final residual = 4.12928e-13, No Iterations 1
    diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
    time step continuity errors : sum local = 1.1875e-14, global = -4.64886e-15, cumulative = -6.82195e-10
    DILUPBiCGStab: Solving for p, Initial residual = 6.99322e-08, Final residual = 3.46637e-14, No Iterations 1
    diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
    time step continuity errors : sum local = 1.4309e-15, global = 1.59986e-16, cumulative = -6.82195e-10
    DILUPBiCGStab: Solving for epsilon, Initial residual = 4.51425e-06, Final residual = 1.24791e-13, No Iterations 1
    DILUPBiCGStab: Solving for k, Initial residual = 2.05212e-05, Final residual = 3.10077e-13, No Iterations 1
    ExecutionTime = 0.88 s ClockTime = 1 s

  • Adityan Rajesh

    Member
    March 9, 2022 at 9:01 am

    Hi Baris.
    I am using ESI-version of OpenFOAM in Windows Subsystem for Linux
    And it is still showing the same error.
    In fact when I changed the 0.orig fie to 0 file, the simulation was running endlessly.
    So I had to stop it in between
    and tried to look at the post processing, but it again shows error.
    Regards

  • Barış Bicer

    Moderator
    March 9, 2022 at 11:13 am

    Hi Adityan,

    Could you please paste here your controlDict set up and log file of your run.

    After that we can evaluate it.

    Best.

    Barış

  • Adityan Rajesh

    Member
    March 9, 2022 at 1:31 pm

    Hi, Baris, I ran the simulation for 2 hours, and it finally got solved.
    But the ControlDict file is attached here.
    I think the time step size is very small. Is that the reason for very long simulation time?
    FoamFile
    {
    version 2.0;
    format ascii;
    class dictionary;
    object controlDict;
    }
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

    application sonicFoam;

    startFrom latestTime;

    startTime 0;

    stopAt endTime;

    endTime 0.0027;

    deltaT 4e-08;

    writeControl runTime;

    writeInterval 2e-04;

    purgeWrite 0;

    writeFormat ascii;

    writePrecision 6;

    writeCompression off;

    timeFormat general;

    timePrecision 6;

    runTimeModifiable true;

    functions
    {
    forces
    {
    type forceCoeffs;
    libs (forces);
    writeControl writeTime;

    patches
    (
    wall_4
    );

    rhoInf 1;

    CofR (0 0 0);
    liftDir (-0.239733 0.970839 0);
    dragDir (0.970839 0.239733 0);
    pitchAxis (0 0 1);
    magUInf 618.022;
    lRef 1;
    Aref 1;
    }
    }

  • Adityan Rajesh

    Member
    March 12, 2022 at 6:53 am

    Hi Baris,
    It worked!
    The simulation ran for 2 hours.
    Thanks alot.
    Regards

  • Barış Bicer

    Moderator
    March 12, 2022 at 10:34 am

    Thats great Adityan.

    Well done!

Log in to reply.

error: Content is protected !!