CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   6-DOF monitoring after or during runtime (https://www.cfd-online.com/Forums/openfoam-post-processing/175151-6-dof-monitoring-after-during-runtime.html)

JensH July 25, 2016 04:05

6-DOF monitoring after or during runtime
 
Dear Foamers,

I hope this questioned hasn't been asked here before.
I'm trying to simulate a floating structure under regular wave impact. After testing a few solvers I'm now working with ola(DyM)Foam on OF 4.0. So far, the simulations look quite promising although still some instabilities occur.
I now want to extract my simulated data of the 6 DOF's to further improve the simulations. Either during runtime or after the simulation has completed - both would be fine for me. The problem is that I have hardly any programming skills to easily extract the data. So my question:

Is there an easy way, for example a function in controlDict like "forces", to get the 6 DOF's clearly arranged for every time step in one file?
The second possibility would be a command to extract at least some values (e.g. centre of mass) out of the log file (see below).

Code:

Courant Number mean: 0.000706526 max: 0.491233
Interface Courant Number mean: 1.5213e-05 max: 0.102411
deltaT = 0.0192202
Time = 2.30807

PIMPLE: iteration 1
forces forces:
    Not including porosity effects
6-DoF rigid body motion
    Centre of rotation: (249.96 -2.76754e-07 -78.2397)
    Centre of mass: (249.96 -2.76754e-07 -78.2397)
    Orientation: (1 -6.18905e-08 6.00102e-05 6.18906e-08 1 -2.25103e-09 -6.00102e-05 2.25474e-09 1)
    Linear velocity: (-0.0225261 -9.2888e-08 -0.154357)
    Angular velocity: (9.77217e-10 2.15082e-05 5.38426e-08)
Velocity BC on patch inlet
3D_2D Absorption BC on patch outlet
"Correction Levels" 1( -0.041915 )

Execution time for mesh.update() = 0.9 s
Velocity BC on patch inlet
3D_2D Absorption BC on patch outlet
"Correction Levels" 1( -0.041915 )

DICPCG:  Solving for pcorr, Initial residual = 1, Final residual = 9.53932e-06, No Iterations 404
time step continuity errors : sum local = 2.91162e-13, global = 4.67776e-14, cumulative = -8.12108e-07
alpha.water BC on patch inlet
smoothSolver:  Solving for alpha.water, Initial residual = 5.67831e-06, Final residual = 1.94173e-10, No Iterations 1
Phase-1 volume fraction = 0.680182  Min(alpha.water) = -2.41813e-15  Max(alpha.water) = 1
Applying the previous iteration compression flux
MULES: Correcting alpha.water
alpha.water BC on patch inlet
MULES: Correcting alpha.water
alpha.water BC on patch inlet
MULES: Correcting alpha.water
alpha.water BC on patch inlet
Phase-1 volume fraction = 0.680182  Min(alpha.water) = -4.84977e-10  Max(alpha.water) = 1
Velocity BC on patch inlet
3D_2D Absorption BC on patch outlet
"Correction Levels" 1( -0.042129 )

DICPCG:  Solving for p_rgh, Initial residual = 0.00744167, Final residual = 0.000351415, No Iterations 4
time step continuity errors : sum local = 4.45801e-08, global = -4.33877e-10, cumulative = -8.12541e-07
DICPCG:  Solving for p_rgh, Initial residual = 0.000431143, Final residual = 2.09697e-05, No Iterations 111
Velocity BC on patch inlet
3D_2D Absorption BC on patch outlet
"Correction Levels" 1( -0.042129 )

time step continuity errors : sum local = 2.67396e-09, global = 1.50462e-10, cumulative = -8.12391e-07
DICPCG:  Solving for p_rgh, Initial residual = 4.70132e-05, Final residual = 9.66919e-08, No Iterations 224
Velocity BC on patch inlet
3D_2D Absorption BC on patch outlet
"Correction Levels" 1( -0.042129 )

time step continuity errors : sum local = 1.23822e-11, global = -5.39366e-13, cumulative = -8.12392e-07
ExecutionTime = 2579.76 s  ClockTime = 2600 s

Does anybody know such a command? That would help me quite a lot.:)

Kind regards,
Jens

Phicau July 25, 2016 04:48

1 Attachment(s)
Hi Jens,

I always work reading the log file. There is a utility that extracts data from the logs, but I doubt that it will work in your case. It is called foamLog.

As a personal advice I would suggest that you invest some of your time in researching ways to scan data from log files, it will prove very useful. In particular, there are some linux commands that are very simple: cat and grep

Also python is a very handy tool for these purposes. You can check this script that works for an old version of the output file and can be easily modified.

Best,

Pablo

mo_na July 25, 2016 05:35

Hi Jens,

I had the same problem a few weeks ago. Check out this thread:
http://www.cfd-online.com/Forums/ope...ecay-test.html
You will find there a shell script that writes you three dat-files containing linear velocity, angular velocity and orientation of the body over time. Of course you can also modify it to write out other information from the logfile.

Hope it helps :)

JensH July 25, 2016 06:27

Thanks a lot Mona that's exactly what I was looking for. That works great!
As I've seen in your post, you are doing a pitch motion analysis.
I'm also interested in the pitch movement of my structure. But from where can I extract it? Is it one of the nine digits inside the orientation parenthesis?

@ Pablo: Thanks for your advice,too. I tried it with foamlog before but that wasn't very successful. You're probably right, that I should spend some more time on linux commands and python :o

Best,
Jens

mo_na July 25, 2016 07:19

I am glad I could help! Took me quite some time to figure it out myself.
And yes you can extract the pitch motion from the orientation. The first column for example is the cosine of the pitch angle. This is a part of the octave script I use for the analysis of a free decay test:
Code:

 
 start=10.7; 
 %Import  data
 cd '/home/mona/OpenFoam/case1_undamped/data'
 load orientation.dat
 X1=orientation;
 time1=X1(:,1);
 cos1=X1(:,2);
 angle1=start-(acos(cos1)*180/pi);


aakie January 8, 2019 04:20

Collecting Acceleration
 
Hee guys,

Thanks for sharing the script, it works perfect.

I was wondering if some of you found a way to also collect the acceleration over time (preferably for every pimple outer correction)?

I dont see this quantity in the log file (while the velocity and displacement are indeed located in the log file). I only noticed that the acceleration is present in every time Dir in the uniform folder, but batching all this data into one single file feels a bit crude. Please let me know if you have smart way!

Btw, the purpose of collecting this data is actually to monitor the relative error of the acceleration over time.

BR,
A


All times are GMT -4. The time now is 05:06.