|
[Sponsors] |
January 9, 2024, 07:58 |
Plotting max aspect ratio with time
|
#1 |
Member
Michael Sukham
Join Date: Mar 2020
Location: India
Posts: 79
Rep Power: 6 |
Hello Foamers.
I am running a dynamic simulation with a moving wall and velocity laplacian. I want to check the motion before the actual simulation and so moveDynamicMesh is performed. I have the mesh quality information for the time steps. 1. How do I plot the max aspect ratio with time for the mesh motion? I want to find at which timestep, the max aspect ratio is at a peak. I am at a lost. 2. checkMesh -writeAllFields have given me the required data and can be visualised via paraView. Is there a way to generate the plot from paraView? I hope someone can point me to a right direction for the plot. Meanwhile if I come up with a solution, I will be happy to share it here An instance of the simulation is attached. With regards |
|
January 9, 2024, 08:22 |
|
#2 |
Senior Member
ONESP-RO
Join Date: Feb 2021
Location: Somwhere on Planet Earth
Posts: 127
Rep Power: 5 |
According to your screenshot, the mesh quality fields including aspect ratio are written to disk every time step. You can open them in Paraview, and plot the maximum aspect ratio over time.
If you save the output from your screenshot to a log file you can use grep command to find the maximum aspect ratio. save it to a file and plot it.
__________________
Don't keep making the same mistakes. Try to make new mistakes. |
|
January 9, 2024, 09:55 |
|
#3 |
Member
Michael Sukham
Join Date: Mar 2020
Location: India
Posts: 79
Rep Power: 6 |
Quite right. I got it by following the following instruction given on
HTML Code:
https://docs.paraview.org/en/latest/Tutorials/ClassroomTutorials/beginningPlotting.html Thanks! |
|
January 9, 2024, 10:25 |
|
#4 |
Senior Member
ONESP-RO
Join Date: Feb 2021
Location: Somwhere on Planet Earth
Posts: 127
Rep Power: 5 |
Nice
You can also use grep command to extract those values from the log file and plot them later using Gnuplot or any other software.
__________________
Don't keep making the same mistakes. Try to make new mistakes. |
|
January 9, 2024, 10:48 |
|
#5 |
Member
Michael Sukham
Join Date: Mar 2020
Location: India
Posts: 79
Rep Power: 6 |
I will do that and post the commands here after I successfully plot using grep.
Cheers. 🙂 |
|
January 10, 2024, 06:40 |
|
#6 |
Member
Michael Sukham
Join Date: Mar 2020
Location: India
Posts: 79
Rep Power: 6 |
Here is the use of grep but then how to set the x axis as time and not iterations? The time was from 1s so the graph looks a bit different but then the plotting way would remain same.
Code:
set border lw 1 set logscale y set title "Residuals" font "arial,16" set ylabel "Aspect Ratio" font "arial,12" set xlabel "Iterations" font "arial,12" set key width 1 plot "< cat log | grep 'Max aspect ratio' | cut -d' ' -f9 | tr -d ','" title 'AspectRatio' with lines lw 1, pause 1 reread How to get x axis as time??? hmmm. |
|
January 10, 2024, 07:02 |
|
#7 | |
Senior Member
ONESP-RO
Join Date: Feb 2021
Location: Somwhere on Planet Earth
Posts: 127
Rep Power: 5 |
Quote:
I have some comments: 1) Do not cat to grep! Most commands accept filenames as arguments. So instead of: Code:
cat filename | grep 'foo' Code:
grep 'foo' filename 2) Instead of using the command inside gnuplot script, you can proceed like this:
To combine the two files time.txt and maxAspectRatio.txt you can use many tools: LibreOffice calc, Microsoft Excel, or a command with the name 'paste': Code:
paste -d " " time.txt maxAspectRatio.txt > result.txt I know there are better ways to do that, but I hope this helps
__________________
Don't keep making the same mistakes. Try to make new mistakes. |
||
January 10, 2024, 07:06 |
|
#8 |
Member
Michael Sukham
Join Date: Mar 2020
Location: India
Posts: 79
Rep Power: 6 |
okay now I think I can accomplish this. I will post the result once this is done for other users if they need it. And Thank you for the input!! Really appreciated.
P.S. I am also looking into swak4Foam and pyFoam so if I get the alternatives, I will post here for other users. Cheers! |
|
January 12, 2024, 21:10 |
|
#9 |
Member
Michael Sukham
Join Date: Mar 2020
Location: India
Posts: 79
Rep Power: 6 |
So pyFoamPlotRunner.py can be used. or run the moveDynamicMesh > log and use
Code:
pyFoamPlotWatcher.py log --hardcopy --format-of-hardcopy=png I consider my thread closed. Thanks! |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
LES, Courant Number, Crash, Sudden | Alhasan | OpenFOAM Running, Solving & CFD | 5 | November 22, 2019 02:05 |
plot over time | fferroni | OpenFOAM Post-Processing | 7 | June 8, 2012 07:56 |
Force can not converge | colopolo | CFX | 13 | October 4, 2011 22:03 |
On the damBreak4phaseFine cases | paean | OpenFOAM Running, Solving & CFD | 0 | November 14, 2008 21:14 |
IcoFoam parallel woes | msrinath80 | OpenFOAM Running, Solving & CFD | 9 | July 22, 2007 02:58 |