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 amIn 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

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/nacaAirfoilYou 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/nacaAirfoilafter 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Ä±ÅŸ

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? 
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 
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/origCellIdAnd 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Ä±ÅŸ

Hi Baris,
I ran the same lines
But when I tried to run the sonicFoam Command it showed me this:FOAM FATAL ERROR: (openfoam2112)
cannot find file “/home/adityan/OpenFOAM/adityanv2112/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. 
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/OpenFOAM9/tree/master/tutorials/compressible
As I said that I have been using ESIvariant 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/OpenFOAMhistory/tree/master/tutorials/compressible
So, it is not your fault…
Please try to switch to ESIvariant of OpenFOAM.
Best.
BarÄ±ÅŸ

Hi again,
If you use ESIvariant of OpenFOAM then it works for me.
For your info.
baris@barisVirtualBox:~/OpenFOAM/barisv2106/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 : _c15bfde3cb20210624 OPENFOAM=2106
Arch : “LSB;label=32;scalar=64”
Exec : sonicFoam
Date : Mar 09 2022
Time : 09:26:54
Host : barisVirtualBox
PID : 26520
I/O : uncollated
Case : /home/baris/OpenFOAM/barisv2106/run/nacaAirfoil
nProcs : 1
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring runtime modified files using timeStampMaster (fileModificationSkew 5, maxFileModificationPolls 20)
allowSystemOperations : Allowing usersupplied system call operations// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create timeCreate 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 effectsTime = 4e08
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.78533e10, No Iterations 8
DILUPBiCGStab: Solving for Uy, Initial residual = 0.997544, Final residual = 7.99872e10, No Iterations 8
DILUPBiCGStab: Solving for e, Initial residual = 0.999977, Final residual = 4.91035e10, No Iterations 10
DILUPBiCGStab: Solving for p, Initial residual = 1, Final residual = 2.91916e15, No Iterations 3
diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 1.52221e08, global = 3.41095e10, cumulative = 3.41095e10
DILUPBiCGStab: Solving for p, Initial residual = 2.50315e06, Final residual = 9.59684e14, No Iterations 1
diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 1.52221e08, global = 3.41095e10, cumulative = 6.8219e10
DILUPBiCGStab: Solving for epsilon, Initial residual = 0.0201314, Final residual = 3.94958e11, No Iterations 5
DILUPBiCGStab: Solving for k, Initial residual = 1, Final residual = 4.86307e11, No Iterations 8
ExecutionTime = 0.26 s ClockTime = 0 sforceCoeffs forces execute:
Coefficients
Cd : 0.114207 (pressure: 0.10081 viscous: 0.0133972)
Cs : 2.04442e21 (pressure: 2.05083e21 viscous: 6.41228e24)
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 = 8e08Courant 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.53056e05, Final residual = 6.0881e11, No Iterations 1
DILUPBiCGStab: Solving for Uy, Initial residual = 0.000993166, Final residual = 2.17057e10, No Iterations 1
DILUPBiCGStab: Solving for e, Initial residual = 2.42244e05, Final residual = 3.72535e11, No Iterations 1
DILUPBiCGStab: Solving for p, Initial residual = 1.3928e05, Final residual = 1.93735e15, No Iterations 2
diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 1.51592e16, global = 4.2809e17, cumulative = 6.8219e10
DILUPBiCGStab: Solving for p, Initial residual = 5.03001e07, Final residual = 1.0682e13, No Iterations 1
diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 1.32435e15, global = 1.41919e16, cumulative = 6.8219e10
DILUPBiCGStab: Solving for epsilon, Initial residual = 1.12416e05, Final residual = 1.32119e13, No Iterations 1
DILUPBiCGStab: Solving for k, Initial residual = 6.74642e05, Final residual = 1.38784e12, No Iterations 1
ExecutionTime = 0.41 s ClockTime = 1 sforceCoeffs forces execute:
Coefficients
Cd : 0.209812 (pressure: 0.195542 viscous: 0.0142697)
Cs : 9.59162e22 (pressure: 9.86263e22 viscous: 2.71013e23)
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.2e07Courant 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.46269e06, Final residual = 8.78126e10, No Iterations 1
DILUPBiCGStab: Solving for Uy, Initial residual = 1.4366e05, Final residual = 5.74339e13, No Iterations 1
DILUPBiCGStab: Solving for e, Initial residual = 8.77259e06, Final residual = 1.49173e12, No Iterations 1
DILUPBiCGStab: Solving for p, Initial residual = 5.02263e06, Final residual = 8.11807e13, No Iterations 1
diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 9.05512e15, global = 1.12176e15, cumulative = 6.82189e10
DILUPBiCGStab: Solving for p, Initial residual = 3.07789e07, Final residual = 1.2533e13, No Iterations 1
diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 2.5771e15, global = 5.35731e17, cumulative = 6.82189e10
DILUPBiCGStab: Solving for epsilon, Initial residual = 7.34781e06, Final residual = 1.36872e13, No Iterations 1
DILUPBiCGStab: Solving for k, Initial residual = 3.51345e05, Final residual = 6.57833e13, No Iterations 1
ExecutionTime = 0.58 s ClockTime = 1 sforceCoeffs forces execute:
Coefficients
Cd : 0.278868 (pressure: 0.263928 viscous: 0.0149402)
Cs : 4.81248e22 (pressure: 5.03098e22 viscous: 2.185e23)
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.6e07Courant 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.5686e06, Final residual = 5.97908e10, No Iterations 1
DILUPBiCGStab: Solving for Uy, Initial residual = 8.45738e06, Final residual = 3.017e13, No Iterations 1
DILUPBiCGStab: Solving for e, Initial residual = 4.94978e06, Final residual = 6.54961e13, No Iterations 1
DILUPBiCGStab: Solving for p, Initial residual = 2.81722e06, Final residual = 4.66042e13, No Iterations 1
diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 9.21714e15, global = 1.59705e15, cumulative = 6.8219e10
DILUPBiCGStab: Solving for p, Initial residual = 1.42286e07, Final residual = 6.37998e14, No Iterations 1
diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 1.95431e15, global = 6.19294e17, cumulative = 6.8219e10
DILUPBiCGStab: Solving for epsilon, Initial residual = 5.57361e06, Final residual = 1.33447e13, No Iterations 1
DILUPBiCGStab: Solving for k, Initial residual = 2.52466e05, Final residual = 4.22826e13, No Iterations 1
ExecutionTime = 0.73 s ClockTime = 1 sforceCoeffs forces execute:
Coefficients
Cd : 0.332905 (pressure: 0.317657 viscous: 0.0152475)
Cs : 1.97643e22 (pressure: 2.19426e22 viscous: 2.1783e23)
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 = 2e07Courant 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.24364e06, Final residual = 4.53324e10, No Iterations 1
DILUPBiCGStab: Solving for Uy, Initial residual = 6.08246e06, Final residual = 8.43095e10, No Iterations 1
DILUPBiCGStab: Solving for e, Initial residual = 3.39466e06, Final residual = 8.44256e10, No Iterations 1
DILUPBiCGStab: Solving for p, Initial residual = 1.90451e06, Final residual = 4.12928e13, No Iterations 1
diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 1.1875e14, global = 4.64886e15, cumulative = 6.82195e10
DILUPBiCGStab: Solving for p, Initial residual = 6.99322e08, Final residual = 3.46637e14, No Iterations 1
diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 1.4309e15, global = 1.59986e16, cumulative = 6.82195e10
DILUPBiCGStab: Solving for epsilon, Initial residual = 4.51425e06, Final residual = 1.24791e13, No Iterations 1
DILUPBiCGStab: Solving for k, Initial residual = 2.05212e05, Final residual = 3.10077e13, No Iterations 1
ExecutionTime = 0.88 s ClockTime = 1 s 
Hi Baris.
I am using ESIversion 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 
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Ä±ÅŸ

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 4e08;
writeControl runTime;
writeInterval 2e04;
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;
}
} 
Hi Baris,
It worked!
The simulation ran for 2 hours.
Thanks alot.
Regards
Log in to reply.