General HydroStatics
Ship Stability Software 
Command of the Week
(New or interesting aspects of GHS that you may not know about) 
Roll Decay Simulation
(Requires GHS version 17.5 or later with SK) 
John Bonn called and he seemed upsettruly frazzled one might say.
"John, what seems to be the trouble?" We asked. "I've been trying to understand why these roll angles are so large!" He lurched. "Well, have you checked your..." We started. "I've done it all! My gyradii are correct. The wave environment is correct. I've double, triple, and quadruple checked it." He sighed. At this point we were genuinely impressed. "Well, John, you've really done well. But have you considered looking closer at your roll damping? It can really have a marked impact on predicted roll angles, especially near resonance. I would start by..." And with that, John hung up. We're not entirely sure why because we were just getting to the interesting part. Despite his reaction, we decided to put together a little run file to help him assess his vessel's damping characteristics. And we knew exactly what he needed: a time domain roll decay simulation. It is synonymous with roll damping evaluation. The first step in such a task is to compute the undamped roll natural frequency. Why? Because when a vessel rolls back and forth as it decays to rest from an initial inclination it will oscillate near this frequency. We've talked about natural periods before in COW176, but that's not really the full story. You see, the roll natural frequency depends on the added mass of the vessel at the natural frequency. See the problem here? We need to know the natural frequency to compute the added mass that we need to compute the natural frequency... In COW176 we just used the highest frequency added mass that we had, and that was good enough for our needs. But in this case we really need to be more accurate. To do this, we write a macro that iterates by repeatedly calculating the natural frequency, computing the added mass at that frequency, and then recomputing the natural frequency using this new added mass until the result converges. After using the SEAKEEPING command to write the vessel's hydrodynamic data to a file called "SKHYDROS.DAT" we craft the following macros: 
macro NaturalFreq
%4:=SQRT(%3/(%1+%2)) / macro Interpolate vari m,b m:=(%4%2)/(%3%1) b:=%2m*%1 %6:=m*%5+b / macro FindABC i:=i+1 wn44p:=wn44 f1:=sk.freq_{i}  f2:=sk.freq_{i+1} a1:=sk.a44_{i}  a2:=sk.a44_{i+1} b1:=sk.b44_{i}  b2:=sk.b44_{i+1} bv1:=sk.b44v_{i}  bv2:=sk.b44v_{i+1} if {sk.freq_{i+1}}>={wn44p} then ;; if {sk.freq_{i}}<={wn44p} then ;; .Interpolate {f1} {a1} {f2} {a2} {wn44p} a44n ;;  .Interpolate {f1} {b1} {f2} {b2} {wn44p} b44n ;;  .Interpolate {f1} {bv1} {f2} {bv2} {wn44p} b44vn ;;  .NaturalFreq {sk.ixx} {a44n} {sk.c44} wn44 ;;  if {wn44wn44p}<0.1 then exit if {i+1}>{sk.nwaves} then exit else exit FindABC / 
Yes, FindABC looks nasty, but it's really just doing a linear interpolation on the data near the natural frequency on each iteration. Calling these macros looks like: 
run sk.lib /call /quiet
.sk.gethydrodata "skhydros.dat" vari i=0 .NaturalFreq {sk.ixx} {sk.a44_{sk.nwaves}} {sk.c44} wn44 .FindABC am44:=sk.ixx+a44n `total mass b44e:=b44n+b44vn `total linearized damping coefficient vari zeta,b44c b44c:=2*am44*wn44 `critical damping zeta:=b44e/b44c `critical damping ratio 
In the above, we first compute an initial guess for the roll natural frequency. Then, we call FindABC, which interpolates the added mass, damping, and stiffness data that was imported from the SKHYDROS.DAT file. Once convergence is obtained, the macro exits and we are left with the added mass and damping (and viscous term!) coefficients at the natural frequency. Pretty neat! Using these values we can compute the true undamped natural frequency, the critical damping, and the critical damping ratio, as shown. Some results for our beloved FV.GF are given below: 
Now that we have our coefficients, we can set up another macro to solve the uncoupled roll equation of motion in the time domain. This is when you thank your lucky stars for the SETfree variable arithmetic added in v17.5. Something good did come from 2020. We write a deceptively simple macro that solves the equation of motion numerically using firstorder explicit Euler integration! That's right, numerical integration in a run file. Don't run and hidebe empowered!

macro Integrator
t:=t+dt  v2p:=v2  v1p:=v1 v2dp:=(1/am44)*(sk.c44*v1p+b44n*v2p) `acceleration v2:=v2p+dt*v2dp `velocity v1:=v1p+dt*v2 `position me {t} {v1/RAD} if {t}>{endtime} then exit else exit Integrator / 
Now all we have to do is give the vessel some initial conditions, define our timestep, and compute! 
vari RAD=0.01745 `PI/180
vari endtime=60 `simulation time, 60 seconds vari t,dt=0.05 `timestep t:=0 v1:=20*RAD `initial condition 20 degree roll v2:=0 `zero initial velocity .Integrator 
The result is the characteristic roll decay curve we would expect. Notice that the roll motion starts at the 20 degree initial inclination that we defined. For curious readers, the SK Manual has a section on experimental roll damping that discusses how these curves can be used to compute damping coefficients. In this case, the curve was derived from coefficients, so using the curve in such a way would be redundant. However, the curve gives a qualitative assessment of the damping characteristics and can be easily compared to modelscale data. 
After we finished the run file we sent it off to John and considered it a job well done. Hopefully he enjoys it as much as we did. For anyone who has made it this far, we assume you'd like to try this for yourself. A complete run file is available here. 
Questions, comments, or requests?
Contact Creative Systems, Inc. USA phone: 3603856212 Fax: 3603856213 Office hours: 7:00 am  4:00 pm Pacific Time, Monday  Friday Mailing address: PO Box 1910 Port Townsend, WA 98368 USA Click here for an index to this and previous COWs 