CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

Can't get residual plot for K and Omega

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By yasmine

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 25, 2022, 07:30
Default Can't get residual plot for K and Omega
  #1
New Member
 
yasmine
Join Date: Jun 2022
Posts: 10
Rep Power: 4
yasmine is on a distinguished road
Hello foamers,
I am making a simulation using the komega sst turbulence model and i am monitoring the residuals in real time but unfortunately i only get plots for the P Ux and Uy but cant get residual plots for the K and Omega ?! is there any suggestiong about how to resolve this issue?!!
yasmine is offline   Reply With Quote

Old   July 25, 2022, 09:16
Default
  #2
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,236
Rep Power: 29
Yann will become famous soon enoughYann will become famous soon enough
Hi Yasmine,

Can you elaborate? How do you monitor the residuals, what functions are you using, which solver, etc...

Thanks,
Yann
Yann is offline   Reply With Quote

Old   July 25, 2022, 09:52
Default
  #3
New Member
 
yasmine
Join Date: Jun 2022
Posts: 10
Rep Power: 4
yasmine is on a distinguished road
Quote:
Originally Posted by Yann View Post
Hi Yasmine,

Can you elaborate? How do you monitor the residuals, what functions are you using, which solver, etc...

Thanks,
Yann

Thank you for the Reply ,
in order to plot the residuals i have inserted this line in the controlDict File the flowing line

functions
{
#includeFunc residuals

}

and I added a residual file in system.
When I execute my calculation with ( mpirun -np 12 SRFSimpleFoam -parallel > log ) the calculations run correctly in log without any problem but in the residuals.dat file in the post processing folder there are only the velocity and pressure values.

also when I plot the residuals I only have the velocity and pressure plots (w and k are missing)

I could send you this by email if you want to make it clearer (I don't know how to put the files here)
yasmine is offline   Reply With Quote

Old   July 25, 2022, 10:02
Default
  #4
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,236
Rep Power: 29
Yann will become famous soon enoughYann will become famous soon enough
Can you just paste the content of your system/residuals file here ?
You can use the [CODE] tag (paste between the following tags):

[CODE][/CODE ]

Thanks,
Yann
Yann is offline   Reply With Quote

Old   July 25, 2022, 10:10
Default
  #5
New Member
 
yasmine
Join Date: Jun 2022
Posts: 10
Rep Power: 4
yasmine is on a distinguished road
my residual file in system :

[CODE]/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Web: www.OpenFOAM.org
\\/ M anipulation |
-------------------------------------------------------------------------------
Description
For specified fields, writes out the initial residuals for the first
solution of each time step; for non-scalar fields (e.g. vectors), writes
the largest of the residuals for each component (e.g. x, y, z).

\*---------------------------------------------------------------------------*/

#includeEtc "caseDicts/postProcessing/numerical/residuals.cfg"

fields (p U k omega);

// ************************************************** *********************** //
[/CODE ]
yasmine is offline   Reply With Quote

Old   July 25, 2022, 10:16
Default
  #6
New Member
 
yasmine
Join Date: Jun 2022
Posts: 10
Rep Power: 4
yasmine is on a distinguished road
in case/postProcessing/residuals/0/ :


# Residuals
# Time p Ux Uy Uz k omega
1 1.000000e+00 N/A 1.000000e+00 7.381090e-03
2 1.184740e-01 N/A 3.004260e-01 9.900590e-03
3 1.372570e-01 N/A 1.864050e-01 2.488720e-03
4 5.901410e-02 N/A 1.588650e-01 5.401030e-04
5 8.814780e-02 N/A 1.479080e-01 1.200040e-04
6 1.253310e-01 N/A 1.418400e-01 3.845520e-05
7 2.565160e-01 N/A 1.423450e-01 1.849330e-05
8 4.336510e-01 N/A 1.497910e-01 1.253860e-05
9 4.601830e-01 N/A 1.510710e-01 1.025730e-05
10 1.930540e-01 N/A 1.447380e-01 8.981750e-06
11 1.148540e-01 N/A 1.430770e-01 8.430300e-06
12 9.624520e-02 N/A 1.441970e-01 8.416790e-06
13 1.051520e-01 N/A 1.431350e-01 8.249120e-06
14 1.067250e-01 N/A 1.400700e-01 8.190930e-06
15 1.124230e-01 N/A 1.370520e-01 8.239140e-06
16 1.127760e-01 N/A 1.340960e-01 8.434510e-06
17 9.872760e-02 N/A 1.317960e-01 8.502050e-06
18 8.100470e-02 N/A 1.300360e-01 8.686630e-06
19 6.849960e-02 N/A 1.288510e-01 8.985640e-06
20 6.633530e-02 N/A 1.272620e-01 9.242020e-06
yasmine is offline   Reply With Quote

Old   July 25, 2022, 10:20
Default
  #7
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,236
Rep Power: 29
Yann will become famous soon enoughYann will become famous soon enough
Thanks, in your controlDict, try replacing #includeFunc by #include:

Code:
functions
{
     #include residuals
}
Let us know how it goes,
Yann
Yann is offline   Reply With Quote

Old   July 25, 2022, 10:26
Default
  #8
New Member
 
yasmine
Join Date: Jun 2022
Posts: 10
Rep Power: 4
yasmine is on a distinguished road
unfortunately it doesn't work, I get this as an error message:


--> FOAM FATAL IO ERROR:
wrong token type - expected string, found on line 52 the word 'residuals'

file: C:/Users/yasmine/AppData/Roaming/BLUECF~2/ofuser-of8/run/mixer/system/controlDict at line 52.


at line 52 i have : #include residuals
yasmine is offline   Reply With Quote

Old   July 25, 2022, 10:32
Default
  #9
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,236
Rep Power: 29
Yann will become famous soon enoughYann will become famous soon enough
My bad!
Just to be sure before going further, could you please post the log file of your run? (you can attach a file with your message, trim it down to the beginning of the log file up to the few first iterations if it is too big to upload)
Yann is offline   Reply With Quote

Old   July 25, 2022, 10:37
Default
  #10
New Member
 
yasmine
Join Date: Jun 2022
Posts: 10
Rep Power: 4
yasmine is on a distinguished road
my log file (I put the beginning and the end) :


Pstream initialized with:
floatTransfer : 0
nProcsSimpleSum : 0
commsType : nonBlocking
polling iterations : 0
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations

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

Create mesh for time = 0


SIMPLE: no convergence criteria found. Calculations will run for 2000 steps.

Reading field p

Reading field Urel

Reading/calculating face flux field phi

AMI: Creating addressing and weights between 5869 source faces and 5869 target faces
AMI: Patch source sum(weights) min/max/average = 1, 1, 1
AMI: Patch target sum(weights) min/max/average = 1, 1, 1
Creating SRF model

Selecting SRFModel rpm
Selecting incompressible transport model Newtonian
Selecting turbulence model type RAS
Selecting RAS turbulence model kOmegaSST
Selecting patchDistMethod meshWave
RAS
{
RASModel kOmegaSST;
turbulence on;
printCoeffs on;
alphaK1 0.85;
alphaK2 1;
alphaOmega1 0.5;
alphaOmega2 0.856;
gamma1 0.555556;
gamma2 0.44;
beta1 0.075;
beta2 0.0828;
betaStar 0.09;
a1 0.31;
b1 1;
c1 10;
F3 false;
}

No finite volume options present


Starting time loop

Time = 1

smoothSolver: Solving for Urelx, Initial residual = 1, Final residual = 0.0126975, No Iterations 4
smoothSolver: Solving for Urely, Initial residual = 1, Final residual = 0.0141798, No Iterations 4
smoothSolver: Solving for Urelz, Initial residual = 1, Final residual = 0.0201171, No Iterations 2
GAMG: Solving for p, Initial residual = 1, Final residual = 0.0450792, No Iterations 4
GAMG: Solving for p, Initial residual = 0.0416938, Final residual = 0.00051409, No Iterations 2
GAMG: Solving for p, Initial residual = 0.00741679, Final residual = 0.00024247, No Iterations 2
GAMG: Solving for p, Initial residual = 0.00249148, Final residual = 8.94275e-05, No Iterations 2
time step continuity errors : sum local = 166.617, global = 15.1947, cumulative = 15.1947
smoothSolver: Solving for omega, Initial residual = 0.00738109, Final residual = 8.81856e-05, No Iterations 2
smoothSolver: Solving for k, Initial residual = 1, Final residual = 0.0100352, No Iterations 2
ExecutionTime = 1.49 s ClockTime = 1 s

Time = 2

smoothSolver: Solving for Urelx, Initial residual = 0.131829, Final residual = 0.00124024, No Iterations 4
smoothSolver: Solving for Urely, Initial residual = 0.287553, Final residual = 0.0028456, No Iterations 4
smoothSolver: Solving for Urelz, Initial residual = 0.318563, Final residual = 0.00175222, No Iterations 4
GAMG: Solving for p, Initial residual = 0.118474, Final residual = 0.00328084, No Iterations 5
GAMG: Solving for p, Initial residual = 0.0318544, Final residual = 0.00046694, No Iterations 2
GAMG: Solving for p, Initial residual = 0.00571584, Final residual = 0.000205005, No Iterations 2
GAMG: Solving for p, Initial residual = 0.00190701, Final residual = 7.79746e-05, No Iterations 2
time step continuity errors : sum local = 192.875, global = 18.9204, cumulative = 34.1152
smoothSolver: Solving for omega, Initial residual = 0.00990059, Final residual = 3.02477e-06, No Iterations 2
smoothSolver: Solving for k, Initial residual = 0.300426, Final residual = 0.0090328, No Iterations 2
ExecutionTime = 2.22 s ClockTime = 2 s

Time = 3

smoothSolver: Solving for Urelx, Initial residual = 0.124796, Final residual = 0.00134026, No Iterations 4
smoothSolver: Solving for Urely, Initial residual = 0.183014, Final residual = 0.00127576, No Iterations 4
smoothSolver: Solving for Urelz, Initial residual = 0.291652, Final residual = 0.00179695, No Iterations 4
GAMG: Solving for p, Initial residual = 0.137257, Final residual = 0.00501436, No Iterations 4
GAMG: Solving for p, Initial residual = 0.0304781, Final residual = 0.000679854, No Iterations 2
GAMG: Solving for p, Initial residual = 0.00568039, Final residual = 0.000260231, No Iterations 2
GAMG: Solving for p, Initial residual = 0.00194214, Final residual = 4.64146e-05, No Iterations 3
time step continuity errors : sum local = 75.7742, global = 9.78391, cumulative = 43.8991
smoothSolver: Solving for omega, Initial residual = 0.00248872, Final residual = 2.61873e-06, No Iterations 2
smoothSolver: Solving for k, Initial residual = 0.186405, Final residual = 0.00884514, No Iterations 2
ExecutionTime = 2.97 s ClockTime = 3 s

Time = 4

smoothSolver: Solving for Urelx, Initial residual = 0.23103, Final residual = 0.00287752, No Iterations 4
smoothSolver: Solving for Urely, Initial residual = 0.220433, Final residual = 0.00220461, No Iterations 4
smoothSolver: Solving for Urelz, Initial residual = 0.251165, Final residual = 0.00243047, No Iterations 4
GAMG: Solving for p, Initial residual = 0.0590141, Final residual = 0.00282732, No Iterations 2
GAMG: Solving for p, Initial residual = 0.0143316, Final residual = 0.000468573, No Iterations 3
GAMG: Solving for p, Initial residual = 0.00498702, Final residual = 0.000187188, No Iterations 2
GAMG: Solving for p, Initial residual = 0.00127501, Final residual = 3.57821e-05, No Iterations 3
time step continuity errors : sum local = 32.8889, global = -2.06978, cumulative = 41.8293
smoothSolver: Solving for omega, Initial residual = 0.000540103, Final residual = 2.41478e-06, No Iterations 2
smoothSolver: Solving for k, Initial residual = 0.158865, Final residual = 0.0112241, No Iterations 2
ExecutionTime = 3.68 s ClockTime = 4 s

Time = 5

smoothSolver: Solving for Urelx, Initial residual = 0.203791, Final residual = 0.00250987, No Iterations 4
smoothSolver: Solving for Urely, Initial residual = 0.196476, Final residual = 0.00221819, No Iterations 4
smoothSolver: Solving for Urelz, Initial residual = 0.18284, Final residual = 0.00204569, No Iterations 4
GAMG: Solving for p, Initial residual = 0.0881478, Final residual = 0.00234285, No Iterations 4
GAMG: Solving for p, Initial residual = 0.130595, Final residual = 0.00237015, No Iterations 2
GAMG: Solving for p, Initial residual = 0.0210733, Final residual = 0.00089486, No Iterations 2
GAMG: Solving for p, Initial residual = 0.00622934, Final residual = 0.000152093, No Iterations 3
time step continuity errors : sum local = 45.3095, global = -1.76439, cumulative = 40.0649
smoothSolver: Solving for omega, Initial residual = 0.000120004, Final residual = 1.8535e-06, No Iterations 2
smoothSolver: Solving for k, Initial residual = 0.147908, Final residual = 0.0120588, No Iterations 2
ExecutionTime = 4.41 s ClockTime = 4 s



.
.
.
.
.
.
.
.
.

Time = 1998

smoothSolver: Solving for Urelx, Initial residual = 0.00503808, Final residual = 6.27413e-05, No Iterations 4
smoothSolver: Solving for Urely, Initial residual = 0.00198169, Final residual = 2.4672e-05, No Iterations 4
smoothSolver: Solving for Urelz, Initial residual = 0.00322746, Final residual = 4.1753e-05, No Iterations 4
GAMG: Solving for p, Initial residual = 0.00672841, Final residual = 0.00024438, No Iterations 2
GAMG: Solving for p, Initial residual = 0.00144828, Final residual = 3.86989e-05, No Iterations 3
GAMG: Solving for p, Initial residual = 0.000475463, Final residual = 1.9264e-05, No Iterations 2
GAMG: Solving for p, Initial residual = 0.000141943, Final residual = 5.013e-06, No Iterations 3
time step continuity errors : sum local = 0.351212, global = -0.00258018, cumulative = 8.82405
smoothSolver: Solving for omega, Initial residual = 2.12626e-06, Final residual = 1.59701e-07, No Iterations 2
smoothSolver: Solving for k, Initial residual = 0.00264075, Final residual = 2.91221e-05, No Iterations 4
ExecutionTime = 1422.87 s ClockTime = 1439 s

Time = 1999

smoothSolver: Solving for Urelx, Initial residual = 0.00503523, Final residual = 6.25361e-05, No Iterations 4
smoothSolver: Solving for Urely, Initial residual = 0.00198526, Final residual = 2.47469e-05, No Iterations 4
smoothSolver: Solving for Urelz, Initial residual = 0.00323853, Final residual = 4.20185e-05, No Iterations 4
GAMG: Solving for p, Initial residual = 0.00672002, Final residual = 0.000243346, No Iterations 2
GAMG: Solving for p, Initial residual = 0.00145101, Final residual = 3.90021e-05, No Iterations 3
GAMG: Solving for p, Initial residual = 0.000484619, Final residual = 1.99894e-05, No Iterations 2
GAMG: Solving for p, Initial residual = 0.000143845, Final residual = 5.00554e-06, No Iterations 3
time step continuity errors : sum local = 0.351595, global = -0.0125304, cumulative = 8.81152
smoothSolver: Solving for omega, Initial residual = 2.11238e-06, Final residual = 1.59213e-07, No Iterations 2
smoothSolver: Solving for k, Initial residual = 0.00266684, Final residual = 2.90942e-05, No Iterations 4
ExecutionTime = 1423.58 s ClockTime = 1439 s

Time = 2000

smoothSolver: Solving for Urelx, Initial residual = 0.00502815, Final residual = 6.23425e-05, No Iterations 4
smoothSolver: Solving for Urely, Initial residual = 0.001989, Final residual = 2.48424e-05, No Iterations 4
smoothSolver: Solving for Urelz, Initial residual = 0.00324989, Final residual = 4.22898e-05, No Iterations 4
GAMG: Solving for p, Initial residual = 0.00674416, Final residual = 0.000245853, No Iterations 2
GAMG: Solving for p, Initial residual = 0.00145269, Final residual = 7.18713e-05, No Iterations 2
GAMG: Solving for p, Initial residual = 0.000451705, Final residual = 1.6493e-05, No Iterations 3
GAMG: Solving for p, Initial residual = 0.000198452, Final residual = 6.16087e-06, No Iterations 2
time step continuity errors : sum local = 0.433841, global = -0.0256793, cumulative = 8.78584
smoothSolver: Solving for omega, Initial residual = 2.10729e-06, Final residual = 1.59279e-07, No Iterations 2
smoothSolver: Solving for k, Initial residual = 0.00266866, Final residual = 2.90817e-05, No Iterations 4
ExecutionTime = 1425.05 s ClockTime = 1442 s

End

Finalising parallel run
yasmine is offline   Reply With Quote

Old   July 25, 2022, 10:46
Default
  #11
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,236
Rep Power: 29
Yann will become famous soon enoughYann will become famous soon enough
Thanks!

You are actually correctly getting the residuals for p, k and omega. Check the values reported in case/postProcessing/residuals/0/, the last 2 columns correspond to the initial residuals reported in the log file for k and omega, as expected.

Your problem is actually related to the velocity field : SFRSimpleFoam solves the relative velocity Urel instead of U, but in your residuals file you are requesting residuals on p, U, k and omega. This is why you get a N/A column for the velocity.

Try something like this, I guess it should work:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Web: www.OpenFOAM.org
\\/ M anipulation |
-------------------------------------------------------------------------------
Description
For specified fields, writes out the initial residuals for the first
solution of each time step; for non-scalar fields (e.g. vectors), writes
the largest of the residuals for each component (e.g. x, y, z).

\*---------------------------------------------------------------------------*/

#includeEtc "caseDicts/postProcessing/numerical/residuals.cfg"

fields (p Urel k omega);

// ************************************************************************* //
Yann
Yann is offline   Reply With Quote

Old   July 25, 2022, 11:02
Default
  #12
New Member
 
yasmine
Join Date: Jun 2022
Posts: 10
Rep Power: 4
yasmine is on a distinguished road
it worked! thank you so much Yann for your help and your time.
you have really saved me!
Yann likes this.
yasmine is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help sought on axial compressor simulation jyotir OpenFOAM Running, Solving & CFD 0 November 17, 2021 11:49
[solids4Foam] How to calculate drag coeff when using solids4Foam amuzeshi OpenFOAM CC Toolkits for Fluid-Structure Interaction 15 November 7, 2019 13:50
decompose dependent solution arionfard OpenFOAM 3 December 10, 2018 10:36
Free surface issues with interDyMFoam for hydroturbine oumnion OpenFOAM Running, Solving & CFD 0 October 6, 2017 15:05
Floating point exception error lpz_michele OpenFOAM Running, Solving & CFD 53 October 19, 2015 03:50


All times are GMT -4. The time now is 15:13.