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

Change foamLog for Pimple iteration and new variables

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 25, 2019, 10:16
Default Change foamLog for Pimple iteration and new variables
  #1
Member
 
Ilan
Join Date: Dec 2018
Posts: 52
Rep Power: 8
Magistrane is on a distinguished road
Dear Foamers,

I need a little help for my post-processing :

I use a solid solver to compute a rotation. For each time step, pimple loop is called several times. In each loop, the variable I need to plot (Angular velocity) through time is calculated.

I need to extract my angular velocity against time. I just need the last value for each time step.

I already used one of the solutions posted on CFD online that used the grep function. But it gives me all the values of the angular velocity independently of the time step.
Then I though i should use foamLog to do that. But 1) the function is not really good working when pimple do more than 1 iteration (create a new file for each variable at a certain number of iteration). 2) It is complicated for me to add a new variable in the code.

In short, I need a file with 2 colomns :
Time step/Last angular velocity of the time step

For this type of file :

Code:
Starting time loop

Courant Number mean: 2.8755e-06 max: 0.000106375
deltaT = 5.9988e-06
Time = 5.9988e-06

PIMPLE: Iteration 1
forces forces:
    Not including porosity effects
6-DoF rigid body motion
    Centre of rotation: (8.05317e-08 -1.02214e-07 1.49884e-18)
    Centre of mass: (8.05317e-08 -1.02214e-07 1.49884e-18)
    Orientation: (0.710317 -0.703881 -2.09457e-16 0.703881 0.710317 -1.1383e-15 9.50012e-16 6.61124e-16 1)
    Linear velocity: (0 0 0)
    Angular velocity: (0 0 0)
AMI: Creating addressing and weights between 10320 source faces and 10488 target faces
AMI: Patch source sum(weights) min/max/average = 0.988487, 1.34623, 1.0066
AMI: Patch target sum(weights) min/max/average = 0.371348, 1.06694, 0.998123
GAMG:  Solving for pcorr, Initial residual = 1, Final residual = 0.00954092, No Iterations 5
GAMG:  Solving for pcorr, Initial residual = 0.0082744, Final residual = 0.0082744, No Iterations 0
time step continuity errors : sum local = 6.46058e-06, global = -1.50885e-09, cumulative = -1.50885e-09
smoothSolver:  Solving for Ux, Initial residual = 1, Final residual = 3.73148e-11, No Iterations 1
smoothSolver:  Solving for Uy, Initial residual = 1, Final residual = 5.38785e-06, No Iterations 1
smoothSolver:  Solving for Uz, Initial residual = 0.999958, Final residual = 9.5898e-06, No Iterations 1
GAMG:  Solving for p, Initial residual = 1, Final residual = 0.00993448, No Iterations 5
GAMG:  Solving for p, Initial residual = 0.00830228, Final residual = 3.63498e-07, No Iterations 6
time step continuity errors : sum local = 3.62129e-14, global = -1.00253e-14, cumulative = -1.50886e-09
PIMPLE: Iteration 2
forces forces:
    Not including porosity effects
6-DoF rigid body motion
    Centre of rotation: (8.05317e-08 -1.02214e-07 1.49884e-18)
    Centre of mass: (8.05317e-08 -1.02214e-07 1.49884e-18)
    Orientation: (0.710317 -0.703881 -2.09457e-16 0.703881 0.710317 -1.1383e-15 9.50012e-16 6.61124e-16 1)
    Linear velocity: (0 0 0)
    Angular velocity: (-8.46769e-23 -4.6018e-22 4.04268e-07)
AMI: Creating addressing and weights between 10320 source faces and 10488 target faces
AMI: Patch source sum(weights) min/max/average = 0.988487, 1.34623, 1.0066
AMI: Patch target sum(weights) min/max/average = 0.371348, 1.06694, 0.998123
GAMG:  Solving for pcorr, Initial residual = 1, Final residual = 0.00949575, No Iterations 5
GAMG:  Solving for pcorr, Initial residual = 0.00827485, Final residual = 0.00827485, No Iterations 0
time step continuity errors : sum local = 6.4601e-06, global = -1.53028e-09, cumulative = -3.03913e-09
smoothSolver:  Solving for Ux, Initial residual = 0.797393, Final residual = 1.90207e-06, No Iterations 1
smoothSolver:  Solving for Uy, Initial residual = 0.177599, Final residual = 7.16774e-06, No Iterations 1
smoothSolver:  Solving for Uz, Initial residual = 0.193548, Final residual = 4.67921e-06, No Iterations 1
GAMG:  Solving for p, Initial residual = 0.00855496, Final residual = 3.27126e-05, No Iterations 4
GAMG:  Solving for p, Initial residual = 0.00194473, Final residual = 4.22478e-07, No Iterations 5
time step continuity errors : sum local = 4.88858e-14, global = 3.29588e-16, cumulative = -3.03913e-09
.
.
.
PIMPLE: Iteration 22
forces forces:
    Not including porosity effects
6-DoF rigid body motion
    Centre of rotation: (8.05317e-08 -1.02214e-07 1.49884e-18)
    Centre of mass: (8.05317e-08 -1.02214e-07 1.49884e-18)
    Orientation: (0.710317 -0.703881 -2.09457e-16 0.703881 0.710317 -1.1383e-15 9.50012e-16 6.61124e-16 1)
    Linear velocity: (0 0 0)
    Angular velocity: (-7.35178e-23 -3.99535e-22 3.50992e-07)
AMI: Creating addressing and weights between 10320 source faces and 10488 target faces
AMI: Patch source sum(weights) min/max/average = 0.988487, 1.34623, 1.0066
AMI: Patch target sum(weights) min/max/average = 0.371348, 1.06694, 0.998123
GAMG:  Solving for pcorr, Initial residual = 1, Final residual = 0.00960231, No Iterations 5
GAMG:  Solving for pcorr, Initial residual = 0.00827486, Final residual = 0.00827486, No Iterations 0
time step continuity errors : sum local = 6.45894e-06, global = -1.51682e-09, cumulative = -3.38869e-08
smoothSolver:  Solving for Ux, Initial residual = 3.51142e-06, Final residual = 7.51302e-12, No Iterations 1
smoothSolver:  Solving for Uy, Initial residual = 1.77977e-07, Final residual = 1.77977e-07, No Iterations 0
smoothSolver:  Solving for Uz, Initial residual = 3.29433e-07, Final residual = 3.29433e-07, No Iterations 0
GAMG:  Solving for p, Initial residual = 2.31852e-07, Final residual = 2.31852e-07, No Iterations 0
GAMG:  Solving for p, Initial residual = 2.31852e-07, Final residual = 2.31852e-07, No Iterations 0
time step continuity errors : sum local = 2.83004e-14, global = -9.88155e-16, cumulative = -3.38869e-08
PIMPLE: Converged in 22 iterations
ExecutionTime = 67.58 s  ClockTime = 68 s

Courant Number mean: 1.67388e-07 max: 2.82459e-05
deltaT = 7.19511e-06
Time = 1.31939e-05

PIMPLE: Iteration 1
forces forces:
    Not including porosity effects
6-DoF rigid body motion
    Centre of rotation: (8.05317e-08 -1.02214e-07 1.49884e-18)
    Centre of mass: (8.05317e-08 -1.02214e-07 1.49884e-18)
    Orientation: (0.710317 -0.703881 -2.09457e-16 0.703881 0.710317 -1.1383e-15 9.50012e-16 6.61124e-16 1)
    Linear velocity: (0 0 0)
    Angular velocity: (-2.49876e-22 -1.35796e-21 1.19297e-06)
AMI: Creating addressing and weights between 10320 source faces and 10488 target faces
AMI: Patch source sum(weights) min/max/average = 0.988487, 1.34623, 1.0066
AMI: Patch target sum(weights) min/max/average = 0.371348, 1.06694, 0.998123
GAMG:  Solving for pcorr, Initial residual = 1, Final residual = 0.00944155, No Iterations 5
GAMG:  Solving for pcorr, Initial residual = 0.00827466, Final residual = 0.00827466, No Iterations 0
time step continuity errors : sum local = 7.74685e-06, global = -1.88339e-09, cumulative = -3.57703e-08
smoothSolver:  Solving for Ux, Initial residual = 0.855398, Final residual = 2.31223e-06, No Iterations 1
smoothSolver:  Solving for Uy, Initial residual = 0.208584, Final residual = 6.76758e-06, No Iterations 1
smoothSolver:  Solving for Uz, Initial residual = 0.226375, Final residual = 6.68791e-06, No Iterations 1
GAMG:  Solving for p, Initial residual = 0.00386014, Final residual = 2.49145e-05, No Iterations 4
GAMG:  Solving for p, Initial residual = 0.00107462, Final residual = 6.67368e-07, No Iterations 4
time step continuity errors : sum local = 1.29317e-13, global = -1.04586e-14, cumulative = -3.57703e-08
PIMPLE: Iteration 2
.
.
.

Do you have any idea how to do this ?
Thanks guys !

Happy Foam
Magistrane is offline   Reply With Quote

Old   April 26, 2019, 05:26
Default
  #2
Member
 
Ilan
Join Date: Dec 2018
Posts: 52
Rep Power: 8
Magistrane is on a distinguished road
Hello, I found a solution : for any data extraction from OpenFoam logs, you can use this small awk script I wrote :
Quote:
/Time = /{gsub(")","",$3); if ($1=="Time" && f=="") print $3,0; if ($1=="Time" && f!="") print $3,f}
/Angular velocity:/{gsub(")","",$5);{f=$5}}
First line prints time steps and f.
f is the variable saved in line. It match the data you need to extract (for me, z angular velocity).
Magistrane is offline   Reply With Quote

Reply

Tags
foamlog, post processing


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



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