Batch processing: Examples of setting data

The Select command is probably the most difficult script command to use. To help understand how it works we present some examples of its use.

Simple examples

For many objects the script commands for setting data take the form:

  1. Select the object using the command Select <ObjectName>.
  2. Set the data using one or more commands of the form DataName = Value.

The object name is most easily found in the model browser. The data name is found by opening the relevant data form, selecting the required data item and pressing F7.

Some examples of this procedure follow:

Select Link1
  UnstretchedLength = 50

Select "3D buoy1"
  Mass = 4
  Volume = 8
  Height = 7.5

Select Line1
  IncludeTorsion = Yes

Note: The name "3D buoy1" needs to be enclosed in quotes because it contains a space. If the name contains a double quote and spaces then it should be enclosed with single quotes.

Data in tables and indices

Some data in OrcaFlex appear in tables. For example consider the structure page of the line data form which specifies how a line is made up of a number of sections. Each section is specified by its line type, length etc. The following example sets the number of sections of the line to be 2 and then sets data for both sections in turn.

Select Line1
  NumberOfSections = 2

  LineType[1] = Riser
  Length[1] = 75
  TargetSegmentLength[1] = 4

  LineType[2] = Rope
  Length[2] = 200
  TargetSegmentLength[2] = 20

Note that we use blank lines to lay out the script. This is not essential but makes reading the script easier.

Data which appear in tables are always set using this indexed notation. Having stated this rule, we immediately break it in the following section!

Line type, clump type and flex joint type data

These data are set by first selecting the type by name and then assigning the data:

Select "Line type1"
  OuterDiameter = 0.28
  InnerDiameter = 0.21

On the line types data form there is an option to view the data for all line types at once or to view by individual line type. When viewing for all line types at once, the data appear in tables with one row per line type. However, these data must be set by first selecting the type by name and then assigning the data. You cannot set line type data using index notation.

Similar rules apply to clump type data and to flex joint type data.

Drag chain type and wing type data

These data are also set by first selecting the type by name and then assigning the data. For example:

Select "Drag chain type1"
  Length = 12

Select "Wing type1"
  NumberOfAngles = 12
  Angle[2] = -80
  Lift[2] = 0.2
  Drag[2] = 0.15
  Moment[2] = 0.5

Data found on the general data form

Data found on the general data form can be set as follows:

Select General
  ImplicitConstantTimeStep = 0.1

Data found on the environment data form

Data found on the environment data form can be set as follows:

Select Environment
  SeaBedStiffness = 3000
  SeaBedDamping = 80

For data specific to a particular wave train you must first select the environment and then select the particular wave train. This makes use of the alternative syntax for Select which is Select <ObjectType> <ObjectName>. For a wave train you replace <ObjectType> with Wave and replace <ObjectName> with the name of the wave train as defined on the environment data form. For example:

Select Environment
  Select Wave "Swell from SW"
    WaveDirection = 135
    WaveType = "Dean stream"
    WaveHeight = 2.5
    WavePeriod = 18
  Select Wave "Local wind sea"
    WaveDirection = 40
    WaveType = JONSWAP
    WaveHs = 5.7
    WaveTz = 9

You may also use the syntax Select <ObjectType>Index <ObjectIndex>, where <ObjectIndex> is the index of the required wave train in the list held by the environment and displayed on the environment data form. For instance, if the wave train named "Swell from SW" is the first in the list and "Local wind sea" is the second, then the following script would have exactly the same effect as the previous example:

Select Environment
  Select WaveIndex 1
    WaveDirection = 135
    WaveType = "Dean stream"
    WaveHeight = 2.5
    WavePeriod = 18
  Select WaveIndex 2
    WaveDirection = 40
    WaveType = JONSWAP
    WaveHs = 5.7
    WaveTz = 9

Note that this index, as other indices in batch script, is 1-based: the first entry in the list has index 1.

Data for post calculation actions

To modify existing post calculation actions they must first be selected. The example below shows how to modify the script file name for the post calculation action named Action3:

Select General
  Select PostCalculationAction Action3
    PostCalculationActionScriptFileName = PostCalculationAction.py

Data for user defined results

To modify existing user defined results they must first be selected. The example below shows how to modify the script file name for the user defined result named Result3:

Select General
  Select UserDefinedResult Result3
    UserDefinedResultScriptFileName = UserDefinedResult.py

Data for current data sets

Multiple current data sets can be defined. Again this requires the alternative syntax for select using either name or index, as shown below:

Select Environment
  MultipleCurrentDataCanBeDefined = Yes
    NumberOfCurrentDataSets = 2
    CurrentName[1] = "120deg"
    CurrentName[2] = "150deg"
    Select Current "120deg"
      RefCurrentDirection = 120
    Select CurrentIndex 2
      RefCurrentDirection = 150
  ActiveCurrent = "150deg"

Vessel type data

Some vessel type data are set in a straightforward manner as follows:

Select "Vessel type1"
  Length = 120
  PenWidth = 3
  Symmetry = "xz plane"

However, the majority of vessel type data require that you also specify to which draught the data apply:

Select "Vessel type1"
  Select Draught "Transit draught"
    CurrentCoeffSurgeArea = 1200
    CurrentCoeffSwayArea = 1100
    CurrentCoeffYawAreaMoment = 120E3

To set data for displacement RAOs, wave load RAOs, wave drift QTFs and sum frequency QTFs you must also specify to which type of RAO the data apply. For example:

Select "Vessel type1"
  Select Draught "Survival draught"

    Select RAOs Displacement
      RAOOriginX = 10
      RAOOriginY = 0
      RAOOriginZ = 2

    Select RAOs WaveLoad
      RAOOriginX = 0
      RAOOriginY = 0
      RAOOriginZ = 0

    Select RAOs WaveDrift
      RAOOriginX = -3
      RAOOriginY = 0
      RAOOriginZ = 4

    Select RAOs SumFrequencyQTF
      RAOOriginX = -3
      RAOOriginY = 0
      RAOOriginZ = 4

Note that the data names RAOOriginX etc are the same in each case, but different data are set depending on which type of RAOs has been selected.

In addition, when setting RAO table data (for displacement RAOs, wave load RAOs and wave drift QTFs) you must specify to which direction the data apply. You may specify either the index of the direction in the list of all directions for that type, or the value of the direction. For example:

Select "Vessel type1"
  Select Draught "Survival draught"
    Select RAOs Displacement
      Select RAODirectionIndex 2
        RAOYawAmplitude[2] = 0.13
      Select RAODirectionValue 135
        RAOYawAmplitude[2] = 0.18

However, it is worth pointing out that situations where you would wish to specify RAO table data in a batch script are rare. It is much more likely that you would import these data into OrcaFlex from some external source and then save it as part of the base case data file.

Multibody group data

Some multibody group data are set in a straightforward manner as follows:

Select "Multibody group1"
  NumberOfBodies = 2
  BodyName[1] = Body1
  VesselType[1] = "Vessel type1"
  BodyName[2] = Body2
  VesselType[2] = "Vessel type2"

To set the stiffness data you must first select the body:

Select "Multibody group1"
  SelectedStiffnessBody = Body2
  DisplacedVolume = 85e3

To set the added mass and damping data you must select the period or frequency (by either index or value) and the row/column body:

Select "Multibody group1"
  NumberOfAMDPeriodsOrFrequencies = 2
  AMDPeriodOrFrequency[1] = 11.0
  AMDPeriodOrFrequency[2] = 13.0
  SelectedAMDPeriodOrFrequencyValue = 11.0
  SelectedAMDRowBody = Body1
  SelectedAMDColumnBody = Body2
  AddedMassX[1] = 42.0
  DampingX[1] = 35.0

The fact that it is possible to set these data through batch script does not necessarily make it a good idea to do so! These data are exceedingly unwieldy to manipulate in batch script. Should you find yourself doing so, it might be prudent to look for a more elegant solution to your problem.

P-y model data

Setting P-y model data is complicated because each depth must be selected before the model data can be accessed. Selection may be by value (SelectedDepthBelowSeabedFrom) or index (SelectedDepthBelowSeabedIndex).

Select "P-y model1"
  NumberOfDepths = 3
  DepthBelowSeabedFrom[1] = 0.0
  DepthBelowSeabedFrom[2] = 10.0
  DepthBelowSeabedFrom[3] = 20.0
  SelectedDepthBelowSeabedIndex = 1
    ModelType = "API RP 2A soft clay"
    EffectiveUnitSoilDensity = 1.6
    UndrainedShearStrength = 6.0
    J = 0.5
    Epsilonc = 4.0
  SelectedDepthBelowSeabedFrom = 10.0
    ModelType = "API RP 2A sand"
    EffectiveUnitSoilDensity = 1.3
    C1 = 1.1
    C2 = 2.0
    C3 = 15.0
    k = 42.0
  SelectedDepthBelowSeabedFrom = 20.0
    ModelType = "P-y table"
    NumberOfEntries = 2
    Deflection[1] = 0.0
    Resistance[1] = 0.0
    Deflection[2] = 0.2
    Resistance[2] = 11.0

SHEAR7 data

SHEAR7 data ownership is divided between the SHEAR7 object and line objects. The SHEAR7 version, output file options and S-N curve data are owned by the SHEAR7 object:

Select "SHEAR7 data"
  SHEAR7Version = 4.6
  SHEAR7OutputDmg = Yes

To access the S-N curve table requires that the curve is selected first, either by name or by index:

Select "SHEAR7 data"
  Select SHEAR7SNCurve Curve2
    SHEAR7SNCurveNumberOfPoints = 3
    SHEAR7SNCurveS[3] = 10E5
    SHEAR7SNCurveN[3] = 10E4
    SHEAR7SNCurveEnduranceLimit = 750.7
  Select SHEAR7SNCurveIndex 1
    SHEAR7SNCurveEnduranceLimit = 531.0

SHEAR7 whole line data and stress concentration factors are accessed through a line object:

Select Line1
  SHEAR7CurrentProfileDiscretisation = "Regular spacing"
  SHEAR7CurrentProfileTargetSpacing = 10
  SHEAR7LocalSCFArcLength[1] = 32.0
  SHEAR7LocalSCF[1] = 1.15

The SHEAR7 hydrodynamic and structural section data apply to a line section, so the index of the section is required:

Select Line1
  SHEAR7StrouhalType[1] = "Rough cylinder"
  SHEAR7LiftFactor[1] = 0.9
  SHEAR7SectionSNCurve[2] = Curve1

Line contact data

To edit penetrator data, the penetrator locations data set must first be selected either by name or by index:

Select "Line contact data"
  Select PenetratorLocationsDataSetIndex 1
    Penetratorx[2] = 13.6
    Penetratory[2] = -2.5
    PenetratorContactArea[2] = 0.85
  Select PenetratorLocationsDataSet Locations2
    Penetratorx[2] = 10.9
    Penetratory[2] = 3.0
    PenetratorContactArea[2] = 0.25

Code checks data

Code checks data ownership is divided between the code checks object and line type objects. Model-wide data items are owned by the code checks object:

Select "Code checks"
  APIRP2RDDesignCaseFactor = 1

The per line type code check data are just like any other line type data:

Select "Line type1"
  APIRP2RDTcorr = 0.001
  APIRP2RDSMYS = 380e3

Variable data sources

Data for variable data sources can be set from the batch script, although once again we feel it is unlikely that you would need to do this often. The procedure for setting variable data sources is illustrated below:

Select Stiffness1
  NumberOfRows = 3

  IndependentValue[1] = 0
  DependentValue[1] = 0

  IndependentValue[2] = 0.2
  DependentValue[2] = 1000

  IndependentValue[3] = 0.4
  DependentValue[3] = 5000

Note that IndependentValue and DependentValue are the data names for the X and Y columns of the variable data source. If, for example, you are setting data for a bending stiffness data source, then IndependentValue denotes curvature and DependentValue denotes bend moment.

Line type wizard

The line type wizard can be used from batch script. First of all you must select the line type and set its wizard data. Once this is complete the wizard is invoked using the InvokeWizard command:

Select "Line type1"
  WizardCalculation = "Homogeneous Pipe"
  PipeMaterial = Steel
  PipeOuterDiameter = 0.082
  PipeWallThickness = 0.005
InvokeWizard

Select "Line type2"
  WizardCalculation = "Line with floats"
  FloatBaseLineType = "Line type3"
  FloatDiameter = 0.80
  FloatLength = 1.2
  FloatPitch = 5.5
InvokeWizard

Plasticity wizard

The plasticity wizard can be used from batch script. First of all you must select the bend stiffness variable data source and set its wizard data. Once this is complete the wizard is invoked using the InvokeWizard command:

Select Stiffness1
  StressOD = 0.30
  StressID = 0.27
  Type = "Ramberg-Osgood curve"
  E = 230.0e6
  RefStress = 385.0e3
InvokeWizard

Line setup wizard

The line setup wizard can be used from batch script using the InvokeLineSetupWizard command. The input data should be set before invoking. These data are owned by a variety of different objects. The model-wide data (e.g. calculation mode and convergence parameters) are owned by the general object. The line-specific data are owned by each individual line. The following script illustrates this:

Select General
  LineSetupCalculationMode = "Calculate line lengths"
  LineSetupMaxDamping = 20
Select Line1
  LineSetupTargetVariable = "Tension"
  LineSetupLineEnd = "End A"
  LineSetupArclength = 0.0
  LineSetupTargetValue = 830.0
Select Line2
  LineSetupIncluded = No
InvokeLineSetupWizard

Polar coordinates data on the all objects form

The all objects data form allows connection data to be specified as polar coordinates. The data appear in a table containing all connections in the model. However, the data still belong to each individual object and the appearance of a table of data is purely presentational. This means that to set the data you must first select the individual object and then set the data, as illustrated below:

Select Buoy1
  PolarR = 10.0
  PolarTheta = 30.0

Select Line1
  PolarR[1] = 20.0
  PolarTheta[1] = 45.0
  PolarR[2] = 340.0
  PolarTheta[2] = 45.0
Select Line2
  PolarR[1] = 20.0
  PolarTheta[1] = 90.0
  PolarR[2] = 340.0
  PolarTheta[2] = 90.0

Select Winch1
  PolarR[3] = 0.0
  PolarTheta[3] = 90.0
  PolarR[4] = 10.0
  PolarTheta[4] = 90.0

For objects with multiple connections, an index must be specified to identify the connection. For lines and links an index of 1 means end A and an index of 2 means end B. For winches the index identifies the winch connection point. For turbines, index 1 means the turbine connection, index 2 means the end A tower connection, and index 3 means the end B tower connection.

Object tags

For any object that supports object tags, the tags can be edited like this:

Select Line1
  Tags[name] = value

If a tag with that name is already defined by the object, its value will be modified; otherwise, a new tag will be added.

Colour data

Drawing colour data items can be set through batch script in a variety of ways. The simplest is to use the pre-defined colours:

Select "Line type1"
  PenColour = Red
Select "Line type2"
  PenColour = Green

The full list of pre-defined colours is: Black, Maroon, Green, Olive, Navy, Purple, Teal, Gray, Silver, Red, Lime, Yellow, Blue, Fuchsia, Aqua, MoneyGreen, SkyBlue, Cream, MedGray and White.

If you want more control over the colour then you can specify an RGB value as an integer. The following example has the same effect as the previous one:

Select "Line type1"
  PenColour = 255
Select "Line type2"
  PenColour = 65280

Using decimal values for RGB value is impractical. Instead a neat trick is to specify the colour as a hexadecimal value by prefixing it with a \$ sign:

Select "Line type1"
  PenColour = \$0000FF
Select "Line type2"
  PenColour = \$00FF00
Select "Line type3"
  PenColour = \$FF0000

This sets the colours to red, green and blue respectively. Each pair of hex digits controls the amount of red, green and blue, in the order \$BBGGRR. So red is \$0000FF, green is \$00FF00, blue is \$FF0000, white is \$FFFFFF and black is \$000000. A value of \$C0C0C0 gives a light grey and \$808080 produces a darker grey.

Fatigue analysis data

Fatigue analysis data are quite simple in the script. The only complication is that you must select S-N and T-N curves before assigning their data. As usual, you may select them either by their name or their index.

NewFatigue
  DamageCalculation = "Homogeneous pipe stress"
  AnalysisType = Rainflow
  ArclengthIntervalsCount = 1
  FromArclength[1] = 0.0
  ToArclength[1] = 30.0
  SCF[1] = 1.5
  SNcurveCount = 2
  Select SNcurveIndex 1
    SNcurveEnduranceLimit = 15.0
  SNcurveName[2] = ProjectSteel
  Select SNcurve ProjectSteel
    SNcurveEnduranceLimit = 0.0