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/)
-   -   Plotting residuals at specified iterations (https://www.cfd-online.com/Forums/openfoam-solving/164684-plotting-residuals-specified-iterations.html)

Harak December 29, 2015 14:20

Plotting residuals at specified iterations
 
Hi all,

I've been working with the icoFsiElasticNonLinULSolidFoam-Solver and now I wish to plot some pressures and velocities with the foamLog feature.

Using this
Code:

#!/bin/sh

foamLog log.icoFsiElasticNonLinULSolidFoam >/dev/null

gnuplot -persist > /dev/null 2>&1 << EOF
    set logscale y
    set title "Residuals vs. Iteration"
    set xlabel "Iteration"
    set ylabel "Residuals"
    plot "logs/Ux_0" with lines
        "logs/p_o" with lines
EOF

I get
http://s22.postimg.org/wqwh0d6u9/residual.png
As you see, it plots the pressure and the velocity at each time step for every iteration. This is what I do not want. I would like to make gnuplot to only plot one iteration to get something like this. By the way, which iteration is the one where the pressure is finally calculated?
http://s13.postimg.org/eaqqixnpz/residual_aim.png
I've already read here http://www.cfd-online.com/Forums/ope...residuals.html about the opportunity of searching for keywords in the log-file - say Solving for p - and then only plot the 5th iteration for instance. This does not work for me because I, unfortunately, don't have the same number of iterations at every time step, see log.icoFsiElasticNonLinULSolidFoam below.

Code:

Starting time loop

Time = 1e-05

Selecting coupling scheme Aitken

Time = 1e-05, iteration: 1
Current fsi under-relaxation factor: 0.01
Maximal accumulated displacement of interface points: 0
Courant Number mean: 0 max: 0.010582011 velocity magnitude: 0.1
DILUPBiCG:  Solving for Ux, Initial residual = 0, Final residual = 0, No Iterations 0
DILUPBiCG:  Solving for Uy, Initial residual = 0, Final residual = 0, No Iterations 0
DILUPBiCG:  Solving for Uz, Initial residual = 1, Final residual = 1.6749469e-07, No Iterations 5
GAMG:  Solving for p, Initial residual = 1, Final residual = 7.8454256e-07, No Iterations 49
GAMG:  Solving for p, Initial residual = 0.00096438099, Final residual = 4.8412496e-07, No Iterations 14
GAMG:  Solving for p, Initial residual = 0.00031436632, Final residual = 7.4264579e-07, No Iterations 13
GAMG:  Solving for p, Initial residual = 0.00016755412, Final residual = 8.1207815e-07, No Iterations 8
GAMG:  Solving for p, Initial residual = 7.6243706e-05, Final residual = 4.5374849e-07, No Iterations 10
GAMG:  Solving for p, Initial residual = 4.0915507e-05, Final residual = 9.1485343e-07, No Iterations 5
time step continuity errors : sum local = 3.7404156e-08, global = -2.3675492e-09, cumulative = -2.3675492e-09
GAMG:  Solving for p, Initial residual = 0.0013683627, Final residual = 4.3307672e-07, No Iterations 22
GAMG:  Solving for p, Initial residual = 0.00032997883, Final residual = 4.5646898e-07, No Iterations 12
GAMG:  Solving for p, Initial residual = 0.00010911632, Final residual = 7.3822523e-07, No Iterations 11
GAMG:  Solving for p, Initial residual = 5.5182661e-05, Final residual = 4.2990674e-07, No Iterations 8
GAMG:  Solving for p, Initial residual = 2.3609087e-05, Final residual = 6.4197581e-07, No Iterations 6
GAMG:  Solving for p, Initial residual = 1.2722655e-05, Final residual = 8.1051448e-07, No Iterations 4
time step continuity errors : sum local = 2.2617868e-08, global = 1.3912904e-09, cumulative = -9.7625883e-10
GAMG:  Solving for p, Initial residual = 0.00034507198, Final residual = 5.9454111e-07, No Iterations 12
GAMG:  Solving for p, Initial residual = 1.2144121e-05, Final residual = 8.5821879e-07, No Iterations 3
GAMG:  Solving for p, Initial residual = 5.1700548e-06, Final residual = 6.9191494e-07, No Iterations 2
GAMG:  Solving for p, Initial residual = 2.3666948e-06, Final residual = 8.6874379e-07, No Iterations 1
GAMG:  Solving for p, Initial residual = 1.2543314e-06, Final residual = 4.9441931e-07, No Iterations 1
GAMG:  Solving for p, Initial residual = 8.8855956e-07, Final residual = 3.9211157e-07, No Iterations 1
time step continuity errors : sum local = 1.089435e-08, global = 7.3406188e-10, cumulative = -2.4219695e-10
GAMG:  Solving for p, Initial residual = 7.0069191e-05, Final residual = 9.3483475e-07, No Iterations 9
GAMG:  Solving for p, Initial residual = 3.1369736e-06, Final residual = 9.9856345e-07, No Iterations 1
GAMG:  Solving for p, Initial residual = 1.1743612e-06, Final residual = 6.750707e-07, No Iterations 1
GAMG:  Solving for p, Initial residual = 9.4203894e-07, Final residual = 5.486074e-07, No Iterations 1
GAMG:  Solving for p, Initial residual = 6.6430607e-07, Final residual = 3.5432881e-07, No Iterations 1
GAMG:  Solving for p, Initial residual = 4.2592467e-07, Final residual = 3.0642294e-07, No Iterations 1
time step continuity errors : sum local = 8.4933605e-09, global = -1.4727172e-10, cumulative = -3.8946867e-10
GAMG:  Solving for p, Initial residual = 2.9863857e-05, Final residual = 4.6478376e-07, No Iterations 10
GAMG:  Solving for p, Initial residual = 1.6085096e-06, Final residual = 6.7482957e-07, No Iterations 1
GAMG:  Solving for p, Initial residual = 8.553162e-07, Final residual = 7.378624e-07, No Iterations 1
GAMG:  Solving for p, Initial residual = 8.5041415e-07, Final residual = 2.6464988e-07, No Iterations 1
GAMG:  Solving for p, Initial residual = 2.7796804e-07, Final residual = 4.7745699e-07, No Iterations 1
GAMG:  Solving for p, Initial residual = 5.2013223e-07, Final residual = 1.573169e-07, No Iterations 1
time step continuity errors : sum local = 4.3550762e-09, global = 2.3448494e-10, cumulative = -1.5498373e-10
GAMG:  Solving for p, Initial residual = 1.5702477e-05, Final residual = 5.1452119e-07, No Iterations 8
GAMG:  Solving for p, Initial residual = 1.1479615e-06, Final residual = 6.8158643e-07, No Iterations 1
GAMG:  Solving for p, Initial residual = 8.1848843e-07, Final residual = 4.7892717e-07, No Iterations 1
GAMG:  Solving for p, Initial residual = 5.6060344e-07, Final residual = 2.6679135e-07, No Iterations 1
GAMG:  Solving for p, Initial residual = 2.8936236e-07, Final residual = 4.0404984e-07, No Iterations 1
GAMG:  Solving for p, Initial residual = 4.3162008e-07, Final residual = 1.3174023e-07, No Iterations 1
time step continuity errors : sum local = 3.6446532e-09, global = -5.673894e-11, cumulative = -2.1172267e-10
GAMG:  Solving for p, Initial residual = 8.9544569e-06, Final residual = 5.6335007e-07, No Iterations 6
GAMG:  Solving for p, Initial residual = 9.1572445e-07, Final residual = 6.4216219e-07, No Iterations 1
GAMG:  Solving for p, Initial residual = 7.4804658e-07, Final residual = 4.7696329e-07, No Iterations 1
GAMG:  Solving for p, Initial residual = 5.4568559e-07, Final residual = 2.211012e-07, No Iterations 1
GAMG:  Solving for p, Initial residual = 2.2934069e-07, Final residual = 3.6785184e-07, No Iterations 1
GAMG:  Solving for p, Initial residual = 3.8152844e-07, Final residual = 9.5832347e-08, No Iterations 1
time step continuity errors : sum local = 2.650164e-09, global = 4.6205192e-11, cumulative = -1.6551748e-10
GAMG:  Solving for p, Initial residual = 5.0816402e-06, Final residual = 6.1511579e-07, No Iterations 4
GAMG:  Solving for p, Initial residual = 8.5831001e-07, Final residual = 3.415422e-07, No Iterations 2
GAMG:  Solving for p, Initial residual = 4.394427e-07, Final residual = 3.3790318e-07, No Iterations 1
GAMG:  Solving for p, Initial residual = 3.7722589e-07, Final residual = 2.9273201e-07, No Iterations 1
GAMG:  Solving for p, Initial residual = 3.1918999e-07, Final residual = 1.3401569e-07, No Iterations 1
GAMG:  Solving for p, Initial residual = 1.3892653e-07, Final residual = 2.0453545e-07, No Iterations 1
time step continuity errors : sum local = 5.6550917e-09, global = 1.3113372e-11, cumulative = -1.5240411e-10
GAMG:  Solving for p, Initial residual = 3.1086862e-06, Final residual = 4.9145456e-07, No Iterations 3
GAMG:  Solving for p, Initial residual = 6.3227655e-07, Final residual = 9.3057068e-07, No Iterations 1
GAMG:  Solving for p, Initial residual = 9.7543941e-07, Final residual = 2.6790381e-07, No Iterations 1
GAMG:  Solving for p, Initial residual = 2.7234262e-07, Final residual = 4.4987925e-07, No Iterations 1
GAMG:  Solving for p, Initial residual = 4.723719e-07, Final residual = 1.459882e-07, No Iterations 1
GAMG:  Solving for p, Initial residual = 1.4744957e-07, Final residual = 9.940842e-08, No Iterations 1
time step continuity errors : sum local = 2.7481027e-09, global = 1.1015887e-10, cumulative = -4.2245237e-11
GAMG:  Solving for p, Initial residual = 1.7813092e-06, Final residual = 9.1939721e-07, No Iterations 2
GAMG:  Solving for p, Initial residual = 9.8743081e-07, Final residual = 3.8617628e-07, No Iterations 1
GAMG:  Solving for p, Initial residual = 4.1404525e-07, Final residual = 4.8046096e-07, No Iterations 1
GAMG:  Solving for p, Initial residual = 5.0063707e-07, Final residual = 1.4369455e-07, No Iterations 1
GAMG:  Solving for p, Initial residual = 1.4658958e-07, Final residual = 2.7075306e-07, No Iterations 1
GAMG:  Solving for p, Initial residual = 2.8271515e-07, Final residual = 8.9927077e-08, No Iterations 1
time step continuity errors : sum local = 2.4857938e-09, global = -2.270926e-10, cumulative = -2.6933784e-10
Setting traction on solid patch
Total traction force = (0.013880744 -0.013880747 2.6947141e-09)
Solving for DU, Initial residual = 1, Final residual = 9.9921645e-09, No outer iterations 5176
Current fsi residual norm: 1

I hope I was clear enough but is there any solution for my current problem?

Thanks in advance! :)


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