Cross-validation of DAVE and Orcaflex static results : 3 point lift#

Create a new DAVE scene for a three point lift:

from DAVE import *
s = Scene()

#code for Body
s.new_rigidbody(name='Body',
                mass=10.0,
                cog=(1.7,
                     3.6,
                     -2.0),
                fixed = False)
# code for Point1_1
s.new_point(name='Point1_1',
          position=(1.0,
                    -3.0,
                    11.0))
# code for Point2_1
s.new_point(name='Point2_1',
          position=(7.0,
                    5.0,
                    10.0))
# code for Point3_1
s.new_point(name='Point3_1',
          position=(-7.0,
                    4.0,
                    10.0))
# code for Point1
s.new_point(name='Point1',
          parent='Body',
          position=(0.0,
                    -3.0,
                    0.0))
# code for Point2
s.new_point(name='Point2',
          parent='Body',
          position=(7.0,
                    5.0,
                    4.0))
# code for Point3
s.new_point(name='Point3',
          parent='Body',
          position=(-7.0,
                    4.0,
                    3.0))
# code for Cable2
s.new_cable(name='Cable2',
            endA='Point2_1',
            endB='Point2',
            length=6.0,
            EA=100.0)
# code for Cable1
s.new_cable(name='Cable1',
            endA='Point1_1',
            endB='Point1',
            length=10.0,
            EA=400.0)
# code for Cable3
s.new_cable(name='Cable3',
            endA='Point3',
            endB='Point3_1',
            length=7.0,
            EA=200.0)

s.solve_statics()
DAVEcore version = 2.0 from c:\python\miniconda3\envs\book\Lib\site-packages\DAVEcore.cp311-win_amd64.pyd
! Blender not found - Blender can be installed from the microsoft windows store.   if you have blender already and want to be able to use blender then please either:
   - configure windows to open .blend files with blender automatically 
   - add the folder containing blender-launcher.exe to the PATH variable.
True

Show the model

from DAVE.jupyter import *
show(s, camera_pos = (27.76337383340547, -20.104069593345237, 5.912761778010189), lookat = (3.2308766177977186, 2.6085609885763255, 4.531373097710178), force_do_normalize = True, force_scale = 1.6, cog_scale = 1)
../_images/a0119a4d7418245aacb83a4914dceff531eb9840317864ef95628e868cd8ed3d.png

The model consists of a single body suspended from three cables. All cables have different stiffnesses:

report(s['Cable1'],['EA','length'])
Properties of Cable1 (Cable)
PropertyValueUnitRemarksExplained
EA400.000[kN]Stiffness of the cable
length10.000[m]Length of the cable when in rest

report(s['Cable2'],['EA','length'])
Properties of Cable2 (Cable)
PropertyValueUnitRemarksExplained
EA100.000[kN]Stiffness of the cable
length6.000[m]Length of the cable when in rest

report(s['Cable3'],['EA','length'])
Properties of Cable3 (Cable)
PropertyValueUnitRemarksExplained
EA200.000[kN]Stiffness of the cable
length7.000[m]Length of the cable when in rest

Orcaflex#

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

If you have orcaflex on this computer then DAVE will use the OrcFxAPI to open the model, solve statics and summarize the static results. The static results are returned as a dict.

This only runs if you have orcaflex and an available license.

from DAVE.io.orcaflex import *

# If the orcaflex/python configuration on your pc is not properly configured then you may need to manually add the path to the orcaflex api. This is done here
import sys
sys.path.append(r'C:\Program Files (x86)\Orcina\OrcaFlex\10.2\OrcFxAPI\Python')

try:
    ofx_results = run_statics_collect(s, filename = r'3plift.yml')
except Exception as E:
    print(E)
created 3plift.yml
Written C:\Users\beneden\AppData\Local\Temp\ofx_dave_runfile.py to run 3plift.yml and save resuts as 3plift_sum.yml
No module named 'OrcFxAPI'

Now it is possible that you, like me, do not have orcaflex. In that case the previous cell resulted in an error like “No module named ‘OrcFxAPI’ “

What if you do not have Orcaflex#

  • You can still download the orcaflex demo to open and view the .yml model file

screenshot

- All the body has been exported as a 6D buoy
- The cables have been exported as winches
  • You can give the model to somebody who has orcaflex and ask nicely if they can run it for you using the created .py file

  • You can then load the model_sum.yml file directly.

ofx_results = r'3plift_sum.yml' # this step can be skipped if the previous cell ran without errors

There is a small utility fuction to compare the orcaflex static results to the results in the DAVE model. ofx_results may be a results dictionary or a modelname_sum.yml file

comparison = compare_statics(s, ofx_results)

To nicely display the result dictionary we convert it to a pandas dataframe. Just a quick trick to make a table.

import pandas as pd
pd.DataFrame.from_dict(comparison)
Name Prop Orcaflex DAVE
0 Body global position [m,m,m] (0.13236197627607232, -0.633160597588408, -0.4... (0.13236197459972854, -0.6331605972032116, -0....
1 Body global rotation vec [deg,deg,deg] [-14.953789651449451, 5.430296961568462, 1.917... (-14.953789597389738, 5.430296935898007, 1.917...
2 Cable2 Tension [kN] 43.08903436605629 43.089034
3 Cable2 Stretched length [m] 8.585342061963377 8.585342
4 Cable1 Tension [kN] 29.022418181228318 29.022418
5 Cable1 Stretched length [m] 10.725560454530708 10.72556
6 Cable3 Tension [kN] 26.132293342543228 26.132293
7 Cable3 Stretched length [m] 7.914630266989013 7.91463

The results are comparable enough to conclude that both programs agree on the equilibrium positions and tensions. They are also different enough to confirm that they are really originate from different programs.

– end –