Skip to main content

Package with additional tools to the OrcFxAPI package

Project description

NsgOrcFx

Library of tools for the OrcaFlex API

This package wraps the original API from Orcina (OrcFxAPI) to include:

  • methods: pre- and post-processing tools such as line selection, load case generation, modal and fatigue analysis
  • coding facilities: auto-complete and hints with descriptions in IDE


All the attributes and methods from the source (OrcFxAPI) still accessible in the same way.


Installation:

pip install --upgrade NsgOrcFx

Example 1 - Auto-complete feature of IDE (e.g. VS Code and Spyder)

import NsgOrcFx

model = NsgOrcFx.Model()
line = model.CreateLine()

# The data name may be found in the `data` attribute with the auto complete of the IDE
# in addition, a hint shows the description of the parameter (mouse cursor stopped in the data name)

model.general.data.ImplicitConstantTimeStep = 0.01 # data from general object
model.environment.data.WaveHeight = 5.0 # data from environment object
line.data.EndAConnection = 'Anchored' # data form the line object

The line could be alse located by name with the following method. Although it could be done with the original method (line = model['Line1']), the new method is recommended to allow the functionality of auto-complete (data attribute)

line = model.findLineByName('Line1')

A list of all lines in the model may be retrieved and then select the first one by

lines = model.getAllLines()
line = lines[0]

Example 2 - Generate load cases

import NsgOrcFx

model = NsgOrcFx.Model()
model.CreateLine()

# list of wave direction, height, and periods to define the Load Cases (LCs)
directions = [0, 45, 90] 
heights = [1.5, 2.0, 3.0]
periods = [5, 7, 9]

# Folder to save the generated files (LCs)
outFolder = 'tmp'

# Regular waves
model.GenerateLoadCases('Dean stream', directions, heights, periods, outFolder)


In case of irregular wave:

model.GenerateLoadCases('JONSWAP', directions, heights, periods, outFolder)


To run irregular waves with reduced simulation time, based on the occurance of the largest rise or fall in the specified storm period.

model.GenerateLoadCases('JONSWAP', directions, heights, periods, outFolder, reducedIrregDuration=200)

Example 3 - Calculating modal analysis and getting the normalized modal shape

import NsgOrcFx

model = NsgOrcFx.Model()
model.CreateLine()

modes = model.CalculateModal()

# mode shape index (0 for the 1st)
modeIndex = 0

# mode frequency
freq = modes.getModeFrequency(modeIndex)

# if normalize = True, the displacements will be normalized, so the maximum total displacements is equal to the line diameter
[arcLengths, Ux, Uy, Uz] = modes.GlobalDispShape('Line1', modeIndex, True)
print('Frequency = ', freq, 'Hz')
print(arcLengths, Ux, Uy, Uz)

Example 4 - Defining fatigue analysis and getting the fatigue life calculated

import NsgOrcFx

simFile = r'tests\tmp\fatigue.sim'
ftgFile = r'tests\tmp\fatigue.ftg'

# First, it is necessary a model with simulation complete
model = NsgOrcFx.Model()
model.CreateLine()
model.RunSimulation()
model.Save(simFile) 

# The fatigue analysis is defined, including the S-N curve based on the DNV-RP-C203
analysis = NsgOrcFx.FatigueAnalysis()
analysis.data.AnalysisType = 'Rainflow'
analysis.data.LoadCaseCount = 1
analysis.addLoadCase(simFile)
analysis.addSNCurveByNameAndEnv('F3','seawater')
analysis.addAnalysisData()
analysis.Calculate()
analysis.Save(ftgFile)

# Result of fatigue life in each node
lifePerNode = analysis.getLifeList()
print(lifePerNode)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nsgorcfx-1.0.12.tar.gz (29.8 kB view details)

Uploaded Source

Built Distribution

NsgOrcFx-1.0.12-py3-none-any.whl (33.2 kB view details)

Uploaded Python 3

File details

Details for the file nsgorcfx-1.0.12.tar.gz.

File metadata

  • Download URL: nsgorcfx-1.0.12.tar.gz
  • Upload date:
  • Size: 29.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.5

File hashes

Hashes for nsgorcfx-1.0.12.tar.gz
Algorithm Hash digest
SHA256 b18d0f0d8b6b3a4909569aeeecf6a9631f3e981e817b4219365106d1791fdda8
MD5 fff9964bd1ae71281e1afba105cca369
BLAKE2b-256 fcd6aeb0298aabe55edf008db0307a6b39fadf475f1a46ac3b83b77502970513

See more details on using hashes here.

File details

Details for the file NsgOrcFx-1.0.12-py3-none-any.whl.

File metadata

  • Download URL: NsgOrcFx-1.0.12-py3-none-any.whl
  • Upload date:
  • Size: 33.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.5

File hashes

Hashes for NsgOrcFx-1.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 838698103567e34a84cf55ca6637d81579a093bb5a84447a6f734f5a7881428d
MD5 63696ee7e0700b44dbbe5f8c92a858d5
BLAKE2b-256 f538ce526b415b8fc6f11ae0c8cdf77f2c03d1de309b1812796ad33c77f012a1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page