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

How to get the trim angle using interDyMFoam?

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 4 Post By zkdkeen

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 14, 2017, 03:45
Default How to get the trim angle using interDyMFoam?
  #1
Member
 
Antoni Alexander
Join Date: Nov 2009
Posts: 43
Rep Power: 17
zkdkeen is on a distinguished road
Hello, everyone!
I am using OpenFOAM 2.3.0 interDyMFoam to simulate the planning process of a certain boat. I have copied the DTCHull from the interDyMFoam tutorial, then changed the grid to my model grid, and made some other modification. After that, the computation is running well.

However, when I see the output log file, I did not find any information of the trim angle of my boat.

The output of one time step from my log file is as follows:
Code:
Interface Courant Number mean: 1.02311e-05 max: 5.03824
Courant Number mean: 0.00387547 max: 9.9856
deltaT = 8.32898e-05
Time = 1.087646


Restraint translationDamper:  force (-0 -29.8886 -0)
Restraint rotationDamper:  moment (-0 -0 -40.6732)
Centre of mass: (1.999 0.135179 0)
Linear velocity: (0 0.00348609 0)
Angular velocity: (0 0 0.00349454)
Execution time for mesh.update() = 1.36 s
GAMG:  Solving for pcorr, Initial residual = 1, Final residual = 0.0878525, No Iterations 13
time step continuity errors : sum local = 6.88552e-13, global = -4.13486e-13, cumulative = 7.49271e-07
smoothSolver:  Solving for alpha.water, Initial residual = 7.31488e-07, Final residual = 4.15881e-12, No Iterations 2
Phase-1 volume fraction = 0.613521  Min(alpha1) = -2.88339e-17  Max(alpha1) = 1
Applying the previous iteration compression flux
MULES: Correcting alpha.water
MULES: Correcting alpha.water
MULES: Correcting alpha.water
MULES: Correcting alpha.water
Phase-1 volume fraction = 0.613521  Min(alpha1) = -5.01782e-09  Max(alpha1) = 1
GAMG:  Solving for p_rgh, Initial residual = 0.000485961, Final residual = 4.47356e-07, No Iterations 11
time step continuity errors : sum local = 6.06207e-12, global = 3.72063e-12, cumulative = 7.49274e-07
GAMG:  Solving for p_rgh, Initial residual = 6.56915e-05, Final residual = 5.96469e-08, No Iterations 24
time step continuity errors : sum local = 8.08326e-13, global = 4.84482e-13, cumulative = 7.49275e-07
GAMG:  Solving for p_rgh, Initial residual = 3.83081e-05, Final residual = 4.69749e-08, No Iterations 24
time step continuity errors : sum local = 6.36565e-13, global = 3.72979e-13, cumulative = 7.49275e-07
smoothSolver:  Solving for omega, Initial residual = 2.03442e-07, Final residual = 4.6581e-10, No Iterations 1
bounding omega, min: -724.397 max: 1.08996e+06 average: 454.004
smoothSolver:  Solving for k, Initial residual = 2.63561e-06, Final residual = 5.50966e-09, No Iterations 1
bounding k, min: -4.08257 max: 43.585 average: 0.0755764
ExecutionTime = 81314.7 s  ClockTime = 81351 s

forces forces output:
    sum of forces:
        pressure : (77.6269 419.922 -166.705)
        viscous  : (3.34985 -0.269405 1.06011)
        porous   : (0 0 0)
    sum of moments:
        pressure : (1.78104 -10.2919 -34.4436)
        viscous  : (-0.346968 0.814481 1.01335)
        porous   : (0 0 0)
And the dynamicMeshDict file is as follows:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.3.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dynamicFvMesh       dynamicMotionSolverFvMesh;

motionSolverLibs    ("libsixDoFRigidBodyMotion.so");

solver              sixDoFRigidBodyMotion;

sixDoFRigidBodyMotionCoeffs
{
    patches         (hull);
    innerDistance   0.3;
    outerDistance   1;

    centreOfMass    (1.999 0.135 0);
    mass            39.08;
    momentOfInertia (1 1 40);
    rhoInf          1;
    report          on;
    reportToFile    on;
    accelerationRelaxation 0.3;
    value           uniform (0 0 0);

    constraints
    {
        yAxis
        {
            sixDoFRigidBodyMotionConstraint line;
            direction     (0 1 0);
        }
        zPlane
        {
            sixDoFRigidBodyMotionConstraint axis;
            axis          (0 0 1);
        }
    }

    restraints
    {
        translationDamper
        {
            sixDoFRigidBodyMotionRestraint linearDamper;
            coeff         8596;
        }
        rotationDamper
        {
            sixDoFRigidBodyMotionRestraint sphericalAngularDamper;
            coeff         11586;
        }
    }
}


// ************************************************************************* //

From that I can tell the sinkage from the centre of mass of each time step, but I can't get the trim angle information.


So, how can I get the trim angle? Should I do some modification in any of the dictionary files?


Any suggestion will be appreciated.
zkdkeen is offline   Reply With Quote

Old   September 17, 2017, 22:21
Default
  #2
Member
 
Antoni Alexander
Join Date: Nov 2009
Posts: 43
Rep Power: 17
zkdkeen is on a distinguished road
No one has this kind of experience?
zkdkeen is offline   Reply With Quote

Old   September 19, 2017, 06:58
Default
  #3
Senior Member
 
JNSN's Avatar
 
Jan
Join Date: Jul 2009
Location: Hamburg
Posts: 143
Rep Power: 20
JNSN is on a distinguished road
Easiest would be to switch to the latest dev-Version:

https://github.com/OpenFOAM/OpenFOAM...73d888c26dfbbd

Best regards,
Jan
JNSN is offline   Reply With Quote

Old   September 21, 2017, 23:04
Default
  #4
Member
 
Antoni Alexander
Join Date: Nov 2009
Posts: 43
Rep Power: 17
zkdkeen is on a distinguished road
Thanks Jan, I will check the latest version. Maybe I will start from a interDyMFoam tutorial.

But if we concentrate on this 2.3.0 version, is it possible to modify the code a little bit so that the Euler Angle could be printed as well?

Best regards,
Antoni
zkdkeen is offline   Reply With Quote

Old   October 10, 2017, 08:14
Default
  #5
Member
 
Antoni Alexander
Join Date: Nov 2009
Posts: 43
Rep Power: 17
zkdkeen is on a distinguished road
With the new version of OF, I got the orientation from the output.

Note that, in my case, the ship is fixed in z=0 plane, which is different from the tutorial of DTCHull, so I think the orientation should be (cosφ −sinφ 0 sinφ cosφ 0 0 0 1). If your ship is fixed in y=0 plane, which is the same as the DTCHull tutorial, the orientation will change to (cosθ 0 sinθ 0 1 0 −sinθ 0 cosθ). Based on these information, the trim angle φ orθ can be easily calculated.

By searching in this forum, I've found some useful scripts provided by foamers. After that I modified them and added some new functions. Use this script, the trim angle and CG rise of a ship can be plotted directly.

motion.sh
Code:
#!/bin/bash
#pick centre of mass
grep 'Centre of mass' $1 | cut -d '(' -f 2 | tr -d ")" > centreMass_Extract
grep -e "^Time = " $1 | cut -d " " -f 3 > times_Extract
 
awk 'NR == 1 || (NR-1) % 3 == 0' centreMass_Extract > centreMass_Extract1
 
paste times_Extract centreMass_Extract1 > cmMotion_parcial
sed -e 's/ [ ]*/\t/g' cmMotion_parcial > cmMotion
 
 
#pick euler angle and convert it to degree
grep 'Orientation' $1 | cut -d '(' -f 2 | tr -d ")" > ort
awk 'NR == 1 || (NR-1) % 3 == 0' ort > ort1
 
awk '{ print $2 }' ort1 > sin_theta
  
awk '
function acos(x){return atan2(sqrt(1-x*x),x);}
function asin(x){return atan2(x,sqrt(1-x*x));}
function pi(){return 2*asin(1);}
{
        trim_in_deg=asin($1)/pi()*180
        print trim_in_deg 
}' sin_theta > trim_extract
paste times_Extract trim_extract > trimMotion
 
rm cmMotion_parcial
rm times_Extract
rm centreMass_Extract
rm centreMass_Extract1
 
rm ort
rm ort1
rm sin_theta
rm trim_extract
 
#plot cm and trim angle
gnuplot -persist > /dev/null 2>&1 << EOF
        set title "Motion vs. Time"
        set xlabel "Time / Iteration"
        set ylabel "CG Rise (m) or Trim Angle (degree)"
        
#        set xrange [3.06:]      
        plot    "cmMotion" using 1:3 title 'CG Rise' with linespoints,\
                        "trimMotion" using 1:2 title 'Trim Angle' with linespoints
EOF
Code:
montion.sh log
log is your output file of interDyMFoam solver.

Best regards,
Antoni
Artur, dupeng, Richal Sun and 1 others like this.
zkdkeen is offline   Reply With Quote

Reply


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
Dynamic contact angle calculation in multiphaseInterFoam rajeshchem OpenFOAM 3 December 23, 2022 15:00
Roll angle values at every time step... interDyMFoam Help plz 13msmemusman OpenFOAM Programming & Development 0 June 20, 2015 16:10
[Netgen] Import netgen mesh to OpenFOAM hsieh OpenFOAM Meshing & Mesh Conversion 32 September 13, 2011 06:50
Normal vector, slope and aspect angle g_niro Main CFD Forum 0 February 2, 2011 18:24
error using interDyMFoam with kOmegaSST to simulate sloshing anmartin OpenFOAM Running, Solving & CFD 0 July 20, 2010 14:21


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