CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

How to plot a value kurve of a Variable during a calculation

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 13, 2016, 17:43
Default How to plot a value kurve of a Variable during a calculation
  #1
Senior Member
 
Peter Hess
Join Date: Apr 2011
Location: Austria
Posts: 250
Rep Power: 16
peterhess is on a distinguished road
Hello everybody,

I am trying to plot the value of the maximum (or avarage) temperature in a region during the calculation, as indecator of convergence...

In this link is clearly cemonstrated how to plot the residuals:

http://www.cfd-online.com/Forums/ope...residuals.html

But not the value of a varable...

I tried to find in forum an answer without success...

Regards

Peter
peterhess is offline   Reply With Quote

Old   June 13, 2016, 18:19
Default
  #2
Senior Member
 
Thomas Oliveira
Join Date: Apr 2015
Posts: 114
Rep Power: 11
t.oliveira is on a distinguished road
That tutorial is based on the processing of the file 'log'. Building upon that solution, you can print the desired temperature to the output, which will sent to 'log' and processed by grep.
To print the temperature to the output, you can include a line like
Info << variable_name << endl;
in the application code and recompile it.
Replace variable_name by the relevant variable and max() operation. I guess it will look like max(T.internalField()) but I haven't tested.
Remember that T is most probably a volScalarField, and you can look for the methods available for this type of object.
t.oliveira is offline   Reply With Quote

Old   June 13, 2016, 18:36
Default
  #3
Senior Member
 
Peter Hess
Join Date: Apr 2011
Location: Austria
Posts: 250
Rep Power: 16
peterhess is on a distinguished road
Thanks a lot, I will try it and send a feedback
peterhess is offline   Reply With Quote

Old   June 13, 2016, 20:22
Default
  #4
Senior Member
 
Peter Hess
Join Date: Apr 2011
Location: Austria
Posts: 250
Rep Power: 16
peterhess is on a distinguished road
hello Thomas,

It seems we talk here about diffenert things.

It is my mistake not giving sufficient information.

I use chtMultiRegionFoam in parallel using:

mpirun np -14 chtMultiRegionFoam -parallel > log

The Results will be worte like that to the log file.

gnuplot in the above given code is then (as you know) getting the needed informations included in log and plot them on a grafical...

The Tmax I am talking about is allready included in the log file because chtMultiRegionFoam give it automaticlly as an output to terminal or log file as in our case...


It looks like this (one complate iteration is shown here):



Solving for fluid region bauteil_3-um_1
diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
DILUPBiCG: Solving for Ux, Initial residual = 0.079954561, Final residual = 3.5802619e-08, No Iterations 6
DILUPBiCG: Solving for Uy, Initial residual = 0.020681034, Final residual = 9.5775808e-09, No Iterations 6
DILUPBiCG: Solving for Uz, Initial residual = 0.18888757, Final residual = 1.1096136e-08, No Iterations 6
DILUPBiCG: Solving for h, Initial residual = 3.8215072e-05, Final residual = 4.8838867e-08, No Iterations 3
Min/max T:300 554.28437
GAMG: Solving for p_rgh, Initial residual = 0.22631753, Final residual = 0.0012730539, No Iterations 3
GAMG: Solving for p_rgh, Initial residual = 0.0029054573, Final residual = 1.7563679e-05, No Iterations 7
GAMG: Solving for p_rgh, Initial residual = 0.0006402583, Final residual = 3.3393418e-06, No Iterations 4
diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors (bauteil_3-um_1): sum local = 6.1733796e-07, global = -1.8383875e-09, cumulative = -2.3500638e-07
GAMG: Solving for p_rgh, Initial residual = 0.22639056, Final residual = 0.0012736502, No Iterations 3
GAMG: Solving for p_rgh, Initial residual = 0.004369804, Final residual = 2.6429418e-05, No Iterations 7
GAMG: Solving for p_rgh, Initial residual = 0.0009625297, Final residual = 9.32754e-08, No Iterations 20
diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors (bauteil_3-um_1): sum local = 1.1455491e-08, global = 3.8230634e-11, cumulative = -2.3496815e-07

Solving for solid region bauteil_3-quelle_1
DICPCG: Solving for h, Initial residual = 0.00014244993, Final residual = 9.0399703e-07, No Iterations 4
Min/max T:554.20161 554.30021
ExecutionTime = 63.23 s ClockTime = 64 s

Region: bauteil_3-um_1 Courant Number mean: 0.32417571 max: 7.1889456
Region: bauteil_3-quelle_1 Diffusion Number mean: 0.001547934 max: 0.0052691487
Time = 8005.65


My problem here is to finde a "code" that take out the value marked with red above and plot it in for every iteration as a curve on the monitor...

This code ploting as example Ux residuals:

set logscale y
set title "Residuals"
set ylabel 'Residual'
set xlabel 'Iteration'
plot "< cat log | grep 'Solving for Ux' | cut -d' ' -f9 | tr -d ','" title 'Ux' with lines
pause 1
reread

How should I change this code to plot the value marked in red above?

Regards

Peter
peterhess is offline   Reply With Quote

Old   June 13, 2016, 21:14
Default
  #5
Senior Member
 
Thomas Oliveira
Join Date: Apr 2015
Posts: 114
Rep Power: 11
t.oliveira is on a distinguished road
I'm sorry, I didn't know that this information was already available at the log file.

Replace
cat log | grep 'Solving for Ux' | cut -d' ' -f9 | tr -d ','
by
cat log | grep 'Min/max T' | cut -d' ' -f3

For further explanation, look for the Linux commands grep, cut and tr.
t.oliveira is offline   Reply With Quote

Old   June 13, 2016, 21:27
Default
  #6
Senior Member
 
Peter Hess
Join Date: Apr 2011
Location: Austria
Posts: 250
Rep Power: 16
peterhess is on a distinguished road
Hello Thomas,

Works

Thanks a lot

yes you are right, I need to have a deeper look to those commands

Regards

Peter
peterhess is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
[Tutorials] Tutorial of how to plot residuals ! wolle1982 OpenFOAM Community Contributions 171 February 20, 2024 02:55
From CGNS to Tecplot additional variable trouble Emilio Tecplot 0 November 29, 2013 10:53
How to plot variable (alpha1) on cuttingPlane (runtime postprocessing) pythag0ra5 OpenFOAM Post-Processing 1 September 26, 2013 08:46
Question about making a variable function of proprities of onother variable ? rafiktharwat CFX 0 March 26, 2011 14:23
how to plot a variable with respect to time nandiganavishal OpenFOAM Running, Solving & CFD 0 March 15, 2009 20:02


All times are GMT -4. The time now is 18:09.