
[Sponsors] 
March 18, 2022, 12:21 

#21  
Member
Tony Zhang
Join Date: Nov 2019
Location: soton
Posts: 45
Rep Power: 5 
Quote:
Many thanks for your reply. Basically, I want to plot the hull pitch angle and heave along with the simulation time. So from the logfile I have the following information: Code:
Courant Number mean: 0.00587552 max: 0.999287 Interface Courant Number mean: 2.52283e05 max: 0.554831 deltaT = 0.000732041 Time = 11.5344 PIMPLE: Iteration 1 forces forces: Not including porosity effects Restraint translationDamper: force (0 0 6.68788) Restraint rotationDamper: moment (0 7.0894 0) 6DoF rigid body motion Centre of rotation: (1.86617 4.84309e07 0.15847) Centre of mass: (1.86617 4.84309e07 0.15847) Orientation: (0.999954 0 0.00954438 0 1 0 0.00954438 0 0.999954) Linear velocity: (0 0 0.000927669) Angular velocity: (0 0.000730012 0) GAMG: Solving for pcorr, Initial residual = 1, Final residual = 0.000796647, No Iterations 5 time step continuity errors : sum local = 1.35111e11, global = 3.33221e12, cumulative = 1.80929e08 smoothSolver: Solving for alpha.water, Initial residual = 1.44068e06, Final residual = 8.86336e12, No Iterations 2 Phase1 volume fraction = 0.536594 Min(alpha.water) = 7.72742e21 Max(alpha.water) = 1 Applying the previous iteration compression flux MULES: Correcting alpha.water MULES: Correcting alpha.water MULES: Correcting alpha.water MULES: Correcting alpha.water Phase1 volume fraction = 0.536594 Min(alpha.water) = 1.177e09 Max(alpha.water) = 1 GAMG: Solving for p_rgh, Initial residual = 0.000313061, Final residual = 2.24666e08, No Iterations 3 time step continuity errors : sum local = 5.17601e11, global = 9.04222e12, cumulative = 1.80839e08 PIMPLE: Iteration 2 forces forces: Not including porosity effects Restraint translationDamper: force (0 0 6.69499) Restraint rotationDamper: moment (0 7.10083 0) 6DoF rigid body motion Centre of rotation: (1.86617 4.84309e07 0.15847) Centre of mass: (1.86617 4.84309e07 0.15847) Orientation: (0.999954 0 0.00954438 0 1 0 0.00954438 0 0.999954) Linear velocity: (0 0 0.000927761) Angular velocity: (0 0.000730041 0) GAMG: Solving for pcorr, Initial residual = 1, Final residual = 0.000546164, No Iterations 5 time step continuity errors : sum local = 9.445e12, global = 3.36602e12, cumulative = 1.80805e08 smoothSolver: Solving for alpha.water, Initial residual = 1.43412e06, Final residual = 8.81716e12, No Iterations 2 Phase1 volume fraction = 0.536594 Min(alpha.water) = 7.72727e21 Max(alpha.water) = 1 Applying the previous iteration compression flux MULES: Correcting alpha.water MULES: Correcting alpha.water MULES: Correcting alpha.water MULES: Correcting alpha.water Phase1 volume fraction = 0.536594 Min(alpha.water) = 1.32948e09 Max(alpha.water) = 1 GAMG: Solving for p_rgh, Initial residual = 1.42924e06, Final residual = 1.78075e08, No Iterations 2 time step continuity errors : sum local = 4.10253e11, global = 4.71189e13, cumulative = 1.8081e08 PIMPLE: Iteration 3 forces forces: Not including porosity effects Restraint translationDamper: force (0 0 6.69565) Restraint rotationDamper: moment (0 7.10111 0) 6DoF rigid body motion Centre of rotation: (1.86617 4.84309e07 0.15847) Centre of mass: (1.86617 4.84309e07 0.15847) Orientation: (0.999954 0 0.00954438 0 1 0 0.00954438 0 0.999954) Linear velocity: (0 0 0.000927775) Angular velocity: (0 0.000730046 0) GAMG: Solving for pcorr, Initial residual = 1, Final residual = 0.000765161, No Iterations 5 time step continuity errors : sum local = 1.29848e11, global = 2.79613e12, cumulative = 1.80838e08 smoothSolver: Solving for alpha.water, Initial residual = 1.43408e06, Final residual = 8.8173e12, No Iterations 2 Phase1 volume fraction = 0.536594 Min(alpha.water) = 7.72725e21 Max(alpha.water) = 1 Applying the previous iteration compression flux MULES: Correcting alpha.water MULES: Correcting alpha.water MULES: Correcting alpha.water MULES: Correcting alpha.water Phase1 volume fraction = 0.536594 Min(alpha.water) = 1.32747e09 Max(alpha.water) = 1 GAMG: Solving for p_rgh, Initial residual = 1.32453e07, Final residual = 2.10085e08, No Iterations 1 time step continuity errors : sum local = 4.83998e11, global = 9.64363e12, cumulative = 1.80741e08 PIMPLE: Iteration 4 forces forces: Not including porosity effects Restraint translationDamper: force (0 0 6.69575) Restraint rotationDamper: moment (0 7.10116 0) 6DoF rigid body motion Centre of rotation: (1.86617 4.84309e07 0.15847) Centre of mass: (1.86617 4.84309e07 0.15847) Orientation: (0.999954 0 0.00954438 0 1 0 0.00954438 0 0.999954) Linear velocity: (0 0 0.000927777) Angular velocity: (0 0.000730045 0) GAMG: Solving for pcorr, Initial residual = 1, Final residual = 0.000555095, No Iterations 5 time step continuity errors : sum local = 9.39265e12, global = 3.4139e12, cumulative = 1.80707e08 smoothSolver: Solving for alpha.water, Initial residual = 1.43408e06, Final residual = 8.81732e12, No Iterations 2 Phase1 volume fraction = 0.536594 Min(alpha.water) = 7.72725e21 Max(alpha.water) = 1 Applying the previous iteration compression flux MULES: Correcting alpha.water MULES: Correcting alpha.water MULES: Correcting alpha.water MULES: Correcting alpha.water Phase1 volume fraction = 0.536594 Min(alpha.water) = 1.32894e09 Max(alpha.water) = 1 GAMG: Solving for p_rgh, Initial residual = 3.92688e08, Final residual = 3.92688e08, No Iterations 0 time step continuity errors : sum local = 9.04682e11, global = 2.86723e11, cumulative = 1.8042e08 PIMPLE: Iteration 5 forces forces: Not including porosity effects Restraint translationDamper: force (0 0 6.69576) Restraint rotationDamper: moment (0 7.10115 0) 6DoF rigid body motion Centre of rotation: (1.86617 4.84309e07 0.15847) Centre of mass: (1.86617 4.84309e07 0.15847) Orientation: (0.999954 0 0.00954438 0 1 0 0.00954438 0 0.999954) Linear velocity: (0 0 0.000927777) Angular velocity: (0 0.000730045 0) GAMG: Solving for pcorr, Initial residual = 1, Final residual = 0.000764826, No Iterations 5 time step continuity errors : sum local = 1.29589e11, global = 2.72512e12, cumulative = 1.80448e08 smoothSolver: Solving for alpha.water, Initial residual = 1.43408e06, Final residual = 8.81733e12, No Iterations 2 Phase1 volume fraction = 0.536594 Min(alpha.water) = 7.72725e21 Max(alpha.water) = 1 Applying the previous iteration compression flux MULES: Correcting alpha.water MULES: Correcting alpha.water MULES: Correcting alpha.water MULES: Correcting alpha.water Phase1 volume fraction = 0.536594 Min(alpha.water) = 1.33009e09 Max(alpha.water) = 1 GAMG: Solving for p_rgh, Initial residual = 4.06946e08, Final residual = 4.06946e08, No Iterations 0 time step continuity errors : sum local = 9.37529e11, global = 2.87026e11, cumulative = 1.80161e08 smoothSolver: Solving for omega, Initial residual = 4.60429e06, Final residual = 1.6717e09, No Iterations 1 smoothSolver: Solving for k, Initial residual = 0.000148782, Final residual = 2.15968e08, No Iterations 1 ExecutionTime = 114820 s ClockTime = 115202 s forces totForce write: sum of forces: pressure : (4.81482 0.0370846 2258.52) viscous : (7.34272 0.00989957 0.0580179) porous : (0 0 0) sum of moments: pressure : (0.00511215 3.71011 0.115732) viscous : (0.00273009 1.46312 0.0146114) porous : (0 0 0) I can use the script to extract the linear, angular velocities and orientation from the logfile, but since I have 3 nOuterCorrectors loops inside PIMPLE, so for each timestep, I have 3 linear, angular velocities and orientations, I am confused how to plot the pitch and heave along the simulation time. And for pitch angle, I think it should be the sin(pitch_angle) value from the third component of orientation (Orientation: (0.999954 0 0.00954438 0 1 0 0.00954438 0 0.999954)). But for heave, I have no idea how to derive it. I have attached the pitch angle variation plot along the simulation time, please correct me if I am wrong. I will try your suggestion of adding function of sixDoFRigidBodyState in controlDict file. Many thanks and have a good weekend Tony 

March 18, 2022, 13:43 

#22 
Senior Member
Join Date: Sep 2013
Posts: 341
Rep Power: 19 
The function object i listed should do just that. But learning awk is extremly helpful for linux and OpenFOAM postProcessing in general.
Hence this is extremly long and not the cleanest implementation, but hopefully readable und learnable. Put this inside an createPlot.sh file and execute it. Code:
#!/bin/sh awk '{ gsub(/[()]/,""); if ($0 ~ "Centre of rotation:") {corx=$4;cory=$5;corz=$6}; if ($0 ~ "Centre of mass:") {comx=$4;comy=$5;comz=$6}; if ($0 ~ "Linear velocity:") {velx=$3;vely=$4;velz=$5}; if ($1 == "Time") {currentTime=$3}; if ($0 ~ "ExecutionTime") { print currentTime,comy*sin(velz) } }' log.dat > resultForPlotting.dat And currently it prints those variables if it s in a line that has ExecutionTime in it. Hence at the end of a time step into a file resultForPlotting.dat. I'll leave it to you to figure out your formula. Awk can use sin cos etc (not in degrees but radians before you are searching for errors). Shouldn't the heave just be the centre of mass? 

September 19, 2022, 04:27 

#23 
New Member
Zhang zf.
Join Date: May 2022
Posts: 2
Rep Power: 0 
hey guys,
I just wonder when the density = 1, if the value of mass is just the volume? 

September 19, 2022, 04:34 

#24  
New Member
Zhang zf.
Join Date: May 2022
Posts: 2
Rep Power: 0 
Quote:
hey guys, I just wonder when the density = 1, if the value of mass is just the volume? 

Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Defining centre of mass/rotation in rigidBodyMotion solver  tok3rat0r  OpenFOAM Running, Solving & CFD  1  November 26, 2018 10:44 
Fatal error with rho in rigidBodyMotion!  monnda  OpenFOAM Running, Solving & CFD  0  November 22, 2018 05:01 
linearAxialAngularSpring restraint in rigidBodyMotion solver  jiadongw  OpenFOAM Running, Solving & CFD  4  August 13, 2018 22:33 
Inertia in 6DOF  pabsandoval  FLUENT  0  March 13, 2013 19:06 
Mass moment of inertia  Cluain  CFX  4  July 18, 2012 10:36 