# Cross-validation of DAVE and Orcaflex Dynamics of Barge¶

Build a scene with the example barge ballasted down to 4m draft

```
from DAVE import *
s = Scene('100x30x8_barge.dave')
s.goal_seek(evaluate="s['Barge'].z",
target=-4.0,
change_property="mass",
change_node="Barge")
s.solve_statics()
```

```
Equilibrium-core version = 1.07
default resource folders:
/home/ruben/miniconda3/lib/python3.8/site-packages/DAVE/resources
/home/ruben/DAVE_models
/home/ruben/DAVE_book/DAVE-notebooks
Loading /home/ruben/miniconda3/lib/python3.8/site-packages/DAVE/resources/100x30x8_barge.dave
```

```
Attempting to evaluate s['Barge'].z to -4.0 (now 0.0)
By changing the value of Barge.mass (now 5000.0)
setting 5000.0 results in -1.626016260162601
setting 5000.0001 results in -1.626016292682927
setting 12299.999824615852 results in -3.999999942964505
converged: True
flag: 'converged'
function_calls: 3
iterations: 2
root: 12300.0
Solved to 1.4551915228366852e-11.
```

```
True
```

Show the model

```
from DAVE.jupyter import *
show(s, sea = True, camera_pos = (158.99328689012356, -83.11396799310523, 14.821261537388635), lookat = (18.24840759806191, 36.62760209655524, -6.699510976000989), force_normalize = True, force_scale = 1.6, cog_scale = 0.25)
```

```
embedWindow(verbose=True): could not load k3d module, try:
> pip install k3d # and if necessary:
> conda install nodejs
```

```
# view(s) # for interactive view
```

The buoyancy of the model comes from a buoyancy mesh. Unfortunately Orcaflex does not support meshes as buoyancy objects.

The DAVE.marine package provides a function to create a linearized buoayncy node (HydSpring) from a buoyancy shape.

```
from DAVE.marine import *
linearize_buoyancy(s, s['Buoyancy mesh'])
```

```
Deleting Buoyancy mesh [Buoyancy]
```

```
Buoyancy mesh <'DAVE.scene.HydSpring>
```

The buoyancy mesh node has now been replaced with a HydSpring node. Confusingly with the same name…

```
node = s['Buoyancy mesh']
type(node)
```

```
DAVE.scene.HydSpring
```

Lets give is another name and report its properties

```
node.name = "Linear buoyancy"
report(node)
```

Property | Value | Unit | Remarks | Explained |
---|---|---|---|---|

name | Linear buoyancy | str | Name of the node , must be unique | |

cob | (50.000, 0.000, 2.000 ) | m,m,m | Center of buoyancy in parent axis system | |

BMT | 18.752 | m | Vertical distance between cob and metacenter for roll | |

BML | 208.335 | m | Vertical distance between cob and metacenter for pitch | |

COFX | 0.000 | m | center of waterplane area | Horizontal x-position Center of Floatation , relative to cob |

COFY | 0.000 | m | center of waterplane area | Horizontal y-position Center of Floatation , relative to cob |

kHeave | 30165.750 | kN/m | Heave stiffness | |

waterline | 2.000 | m | which is where is normally is | Waterline-elevation relative to cob for un-stretched heave-spring. Positive if cob is below the waterline |

displacement_kN | 120662.998 | kN | Displacement when waterline is at waterline-elevation | |

name | Linear buoyancy | str | Name of the node , must be unique | |

parent | Barge | Determines the parent of the node. Should be an axis or None |

And lets double-check that it does not affect the equilibrium position of the barge, it should still be at -4.000 m and even-keel:

```
s.solve_statics()
report(s['Barge'],['global_position','heel','trim'])
```

```
Solved to 1.4551915228366852e-11.
```

Property | Value | Unit | Remarks | Explained |
---|---|---|---|---|

global_position | (0.000, 0.000, -4.000 ) | m, m, m | global axis | The global position of the origin of the axis system |

heel | 0.000 | deg | Heel in degrees. SB down is positive . | |

trim | 0.000 | deg | Trim in degrees. Bow-down is positive . |

```
from DAVE.frequency_domain import *
prepare_for_fd(s)
```

Minimum damping for frequency domain analysis, as fraction of critical damping based on diagonal terms.

```
FD_GLOBAL_MIN_DAMPING_FRACTION = 0.005
```

```
from DAVE.frequency_domain import RAO_1d
wave_direction = 90
min = 0.1
max = 4
steps = 100
omega = np.linspace(min,max,steps)
data = RAO_1d(s, omega, wave_direction)
```

```
Increasing diagonal damping for mode 0 to (11.619211919858886+0j)
Increasing diagonal damping for mode 1 to (12.986510266023139+0j)
Increasing diagonal damping for mode 2 to (494.941942298777+0j)
Increasing diagonal damping for mode 3 to (21885.99701069219+0j)
Increasing diagonal damping for mode 4 to (348616.33900855196+0j)
Increasing diagonal damping for mode 5 to (24358.206963065626+0j)
Increasing diagonal damping for mode 0 to (11.624884354366689+0j)
Increasing diagonal damping for mode 1 to (13.00076032917426+0j)
Increasing diagonal damping for mode 3 to (21922.140902099476+0j)
Increasing diagonal damping for mode 4 to (349381.20456792216+0j)
Increasing diagonal damping for mode 5 to (24364.035790357284+0j)
Increasing diagonal damping for mode 0 to (11.632665559060804+0j)
Increasing diagonal damping for mode 1 to (13.027897197242288+0j)
Increasing diagonal damping for mode 3 to (21947.543623663896+0j)
Increasing diagonal damping for mode 4 to (350514.0369907897+0j)
Increasing diagonal damping for mode 5 to (24380.964584137793+0j)
Increasing diagonal damping for mode 0 to (11.643204277185857+0j)
Increasing diagonal damping for mode 1 to (13.064444559274735+0j)
Increasing diagonal damping for mode 3 to (21974.929391810754+0j)
Increasing diagonal damping for mode 4 to (351996.9032820412+0j)
Increasing diagonal damping for mode 5 to (24403.33973271421+0j)
Increasing diagonal damping for mode 0 to (11.65649957973754+0j)
Increasing diagonal damping for mode 1 to (13.107265119165415+0j)
Increasing diagonal damping for mode 3 to (22013.438000933176+0j)
Increasing diagonal damping for mode 4 to (353807.28470898425+0j)
Increasing diagonal damping for mode 5 to (24426.442345186657+0j)
Increasing diagonal damping for mode 0 to (11.671677204540073+0j)
Increasing diagonal damping for mode 3 to (22069.61514499135+0j)
Increasing diagonal damping for mode 4 to (355945.02506770956+0j)
Increasing diagonal damping for mode 5 to (24445.950227830388+0j)
Increasing diagonal damping for mode 3 to (22130.362536256693+0j)
Increasing diagonal damping for mode 5 to (24476.73078175216+0j)
Increasing diagonal damping for mode 3 to (22195.717107795288+0j)
Increasing diagonal damping for mode 5 to (24522.216344411052+0j)
Increasing diagonal damping for mode 3 to (22261.550427378075+0j)
Increasing diagonal damping for mode 5 to (24574.40048387209+0j)
Increasing diagonal damping for mode 5 to (24629.785809326197+0j)
Increasing diagonal damping for mode 3 to (20858.890076636515+0j)
Increasing diagonal damping for mode 3 to (20856.863381092233+0j)
Increasing diagonal damping for mode 3 to (20878.845218712006+0j)
Increasing diagonal damping for mode 3 to (20905.161613607677+0j)
Increasing diagonal damping for mode 3 to (20931.444921819868+0j)
Increasing diagonal damping for mode 3 to (20957.695267831845+0j)
Increasing diagonal damping for mode 4 to (317711.18249839905+0j)
Increasing diagonal damping for mode 3 to (20983.91277534826+0j)
Increasing diagonal damping for mode 4 to (318297.17747855396+0j)
Increasing diagonal damping for mode 3 to (20992.355194736305+0j)
Increasing diagonal damping for mode 4 to (318492.6900224831+0j)
Increasing diagonal damping for mode 3 to (20995.470724202594+0j)
Increasing diagonal damping for mode 4 to (318571.23977989465+0j)
Increasing diagonal damping for mode 3 to (20998.58579142234+0j)
Increasing diagonal damping for mode 4 to (318649.7701741533+0j)
Increasing diagonal damping for mode 3 to (21001.700396601227+0j)
Increasing diagonal damping for mode 4 to (318728.28121957165+0j)
Increasing diagonal damping for mode 3 to (21004.81453994479+0j)
Increasing diagonal damping for mode 4 to (318806.7729304444+0j)
Increasing diagonal damping for mode 3 to (21007.928221658414+0j)
Increasing diagonal damping for mode 4 to (318885.2453210489+0j)
Increasing diagonal damping for mode 3 to (21011.04144194733+0j)
Increasing diagonal damping for mode 4 to (318963.6984056448+0j)
Increasing diagonal damping for mode 3 to (21014.15420101661+0j)
Increasing diagonal damping for mode 4 to (319042.13219847425+0j)
Increasing diagonal damping for mode 3 to (21017.266499071186+0j)
Increasing diagonal damping for mode 4 to (319120.5467137619+0j)
Increasing diagonal damping for mode 3 to (21020.37833631583+0j)
Increasing diagonal damping for mode 4 to (319198.941965715+0j)
Increasing diagonal damping for mode 3 to (21023.48971295517+0j)
Increasing diagonal damping for mode 4 to (319277.3179685233+0j)
Increasing diagonal damping for mode 3 to (21026.600629193672+0j)
Increasing diagonal damping for mode 4 to (319355.674736359+0j)
Increasing diagonal damping for mode 2 to (375.07467498535+0j)
Increasing diagonal damping for mode 3 to (21029.711085235664+0j)
Increasing diagonal damping for mode 4 to (319434.0122833771+0j)
Increasing diagonal damping for mode 2 to (375.2366233791062+0j)
Increasing diagonal damping for mode 3 to (21032.821081285303+0j)
Increasing diagonal damping for mode 4 to (319512.33062371524+0j)
Increasing diagonal damping for mode 2 to (375.3985019076935+0j)
Increasing diagonal damping for mode 3 to (21035.930617546626+0j)
Increasing diagonal damping for mode 4 to (319590.62977149367+0j)
Increasing diagonal damping for mode 2 to (375.5603106614541+0j)
Increasing diagonal damping for mode 3 to (21039.039694223487+0j)
Increasing diagonal damping for mode 4 to (319668.9097408153+0j)
Increasing diagonal damping for mode 2 to (375.72204973053573+0j)
Increasing diagonal damping for mode 3 to (21042.14831151961+0j)
Increasing diagonal damping for mode 4 to (319747.1705457659+0j)
Increasing diagonal damping for mode 2 to (375.88371920489254+0j)
Increasing diagonal damping for mode 3 to (21045.256469638553+0j)
Increasing diagonal damping for mode 4 to (319825.412200414+0j)
Increasing diagonal damping for mode 2 to (376.04531917428494+0j)
Increasing diagonal damping for mode 3 to (21048.364168783744+0j)
Increasing diagonal damping for mode 4 to (319903.6347188108+0j)
Increasing diagonal damping for mode 2 to (376.20684972828064+0j)
Increasing diagonal damping for mode 3 to (21051.471409158443+0j)
Increasing diagonal damping for mode 4 to (319981.8381149904+0j)
Increasing diagonal damping for mode 2 to (376.36831095625524+0j)
Increasing diagonal damping for mode 3 to (21054.57819096577+0j)
Increasing diagonal damping for mode 4 to (320060.0224029698+0j)
Increasing diagonal damping for mode 2 to (376.52970294739265+0j)
Increasing diagonal damping for mode 3 to (21057.684514408684+0j)
Increasing diagonal damping for mode 4 to (320138.18759674876+0j)
Increasing diagonal damping for mode 2 to (376.6910257906857+0j)
Increasing diagonal damping for mode 3 to (21060.790379690006+0j)
Increasing diagonal damping for mode 4 to (320216.3337103101+0j)
Increasing diagonal damping for mode 2 to (376.8522795749369+0j)
Increasing diagonal damping for mode 3 to (21063.89578701241+0j)
Increasing diagonal damping for mode 4 to (320294.4607576196+0j)
Increasing diagonal damping for mode 2 to (377.01346438875856+0j)
Increasing diagonal damping for mode 3 to (21067.000736578404+0j)
Increasing diagonal damping for mode 4 to (320372.5687526257+0j)
Increasing diagonal damping for mode 2 to (377.1745803205739+0j)
Increasing diagonal damping for mode 3 to (21070.10522859036+0j)
Increasing diagonal damping for mode 4 to (320450.6577092603+0j)
Increasing diagonal damping for mode 2 to (377.33562745861724+0j)
Increasing diagonal damping for mode 3 to (21073.20926325051+0j)
Increasing diagonal damping for mode 4 to (320528.7276414379+0j)
Increasing diagonal damping for mode 2 to (377.4966058909347+0j)
Increasing diagonal damping for mode 3 to (21076.3128407609+0j)
Increasing diagonal damping for mode 4 to (320606.77856305643+0j)
Increasing diagonal damping for mode 2 to (377.65751570538487+0j)
Increasing diagonal damping for mode 3 to (21079.415961323473+0j)
Increasing diagonal damping for mode 4 to (320684.8104879966+0j)
Increasing diagonal damping for mode 2 to (377.818356989639+0j)
Increasing diagonal damping for mode 3 to (21082.518625139994+0j)
Increasing diagonal damping for mode 4 to (320762.8234301224+0j)
Increasing diagonal damping for mode 2 to (377.9791298311821+0j)
Increasing diagonal damping for mode 3 to (21085.62083241209+0j)
Increasing diagonal damping for mode 4 to (320840.817403281+0j)
Increasing diagonal damping for mode 2 to (378.139834317313+0j)
Increasing diagonal damping for mode 3 to (21088.722583341234+0j)
Increasing diagonal damping for mode 4 to (320918.7924213026+0j)
Increasing diagonal damping for mode 2 to (378.3004705351452+0j)
Increasing diagonal damping for mode 3 to (21091.823878128762+0j)
Increasing diagonal damping for mode 4 to (320996.74849800067+0j)
Increasing diagonal damping for mode 2 to (378.4610385716072+0j)
Increasing diagonal damping for mode 3 to (21094.92471697585+0j)
Increasing diagonal damping for mode 4 to (321074.685647172+0j)
Increasing diagonal damping for mode 2 to (378.6215385134434+0j)
Increasing diagonal damping for mode 3 to (21098.025100083527+0j)
Increasing diagonal damping for mode 4 to (321152.6038825964+0j)
Increasing diagonal damping for mode 2 to (378.7819704472141+0j)
Increasing diagonal damping for mode 3 to (21101.125027652684+0j)
Increasing diagonal damping for mode 4 to (321230.50321803737+0j)
Increasing diagonal damping for mode 2 to (378.9423344592968+0j)
Increasing diagonal damping for mode 3 to (21104.224499884058+0j)
Increasing diagonal damping for mode 4 to (321308.38366724126+0j)
Increasing diagonal damping for mode 2 to (379.1026306358858+0j)
Increasing diagonal damping for mode 3 to (21107.32351697823+0j)
Increasing diagonal damping for mode 4 to (321386.24524393806+0j)
Increasing diagonal damping for mode 2 to (379.2628590629936+0j)
Increasing diagonal damping for mode 3 to (21110.42207913566+0j)
Increasing diagonal damping for mode 4 to (321464.0879618411+0j)
Increasing diagonal damping for mode 2 to (379.4230198264511+0j)
Increasing diagonal damping for mode 3 to (21113.52018655663+0j)
Increasing diagonal damping for mode 4 to (321541.91183464695+0j)
Increasing diagonal damping for mode 2 to (379.58311301190787+0j)
Increasing diagonal damping for mode 3 to (21116.61783944129+0j)
Increasing diagonal damping for mode 4 to (321619.7168760359+0j)
Increasing diagonal damping for mode 2 to (379.74313870483314+0j)
Increasing diagonal damping for mode 3 to (21119.71503798965+0j)
Increasing diagonal damping for mode 4 to (321697.50309967133+0j)
Increasing diagonal damping for mode 2 to (379.9030969905161+0j)
Increasing diagonal damping for mode 3 to (21122.811782401557+0j)
Increasing diagonal damping for mode 4 to (321775.27051920054+0j)
Increasing diagonal damping for mode 2 to (380.0629879540663+0j)
Increasing diagonal damping for mode 3 to (21125.908072876726+0j)
Increasing diagonal damping for mode 4 to (321853.0191482539+0j)
Increasing diagonal damping for mode 2 to (380.2228116804147+0j)
Increasing diagonal damping for mode 3 to (21129.00390961472+0j)
Increasing diagonal damping for mode 4 to (321930.7490004456+0j)
Increasing diagonal damping for mode 2 to (380.38256825431336+0j)
Increasing diagonal damping for mode 3 to (21132.09929281495+0j)
Increasing diagonal damping for mode 4 to (322008.4600893732+0j)
Increasing diagonal damping for mode 2 to (380.54225776033695+0j)
Increasing diagonal damping for mode 3 to (21135.194222676684+0j)
Increasing diagonal damping for mode 4 to (322086.15242861817+0j)
Increasing diagonal damping for mode 2 to (380.70188028288226+0j)
Increasing diagonal damping for mode 3 to (21138.288699399058+0j)
Increasing diagonal damping for mode 4 to (322163.82603174535+0j)
Increasing diagonal damping for mode 2 to (380.86143590616956+0j)
Increasing diagonal damping for mode 3 to (21141.38272318104+0j)
Increasing diagonal damping for mode 4 to (322241.4809123032+0j)
Increasing diagonal damping for mode 2 to (381.0209247142427+0j)
Increasing diagonal damping for mode 3 to (21144.47629422147+0j)
Increasing diagonal damping for mode 4 to (322319.117083824+0j)
Increasing diagonal damping for mode 0 to (11.20570881102795+0j)
Increasing diagonal damping for mode 2 to (381.1803467909698+0j)
Increasing diagonal damping for mode 3 to (21147.569412719036+0j)
Increasing diagonal damping for mode 4 to (322396.73455982376+0j)
```

```
import matplotlib.pyplot as plt
roll = data[3]
roll_amp = abs(roll) # radians !
frequency_hz = omega / (2*np.pi)
plt.plot(frequency_hz, np.degrees(roll_amp))
plt.grid('on')
plt.xlabel('Frequency [Hz]')
plt.ylabel('Amplitude [deg/m]')
plt.ylim([0, 20])
plt.xlim([0, 0.7])
plt.title('Roll RAO')
```

```
Text(0.5, 1.0, 'Roll RAO')
```

```
plt.plot(frequency_hz, abs(data[2]))
plt.grid('on')
plt.xlabel('Frequency [Hz]')
plt.ylabel('Amplitude [m/m]')
plt.ylim([0, 1.2])
plt.xlim([0, 0.5])
plt.title('Heave RAO')
```

```
Text(0.5, 1.0, 'Heave RAO')
```

## Time response¶

## Orcaflex¶

This model can be exported to an orcaflex .yml model file.

```
from DAVE.io.orcaflex import *
export_ofx_yml(s,'barge.yml')
```

```
created barge.yml
```

Now it is possible that you, like me, do not have orcaflex. You can still download the orcaflex demo to open and view the .yml model file

Now there is some explaining to do on how exactly this was exported.

The hydrodynamics are easy: the first order wave forces, added mass and damping were exported to the vessel-type.

The hydrostatics are a bit more complex, but in a nice way.

The mass of the vessel is exported as a 6D buoy. This 6D buoy is then connected to the vessel. The buoyancy of the vessel is exported to the vessel type. This means that the mass of the vessel-type is set to almost zero. The effect of that is that the stiffness matrix of the vessel type, which normally includes the weight components, is reduced to purely the hydrostatic matrix. So based on KM, not KG. If you have ever tried to model a vessel in orcaflex using different 6D buoys (for example a vessel with a crane) then you will certainly appreciate this method.

So:

Hydrodynamics and Buoyancy go into the vessel-type (everything related to water)

Mass and inertia go into a 6D buoy