|
Text data files: Examples of setting data |
Here, we give some examples of setting model data using the OrcaFlex text data file. The OrcaFlex text data file format is described in the text data files topic, and if you haven't already read this we recommend that you do so before tackling these examples.
Building an entire OrcaFlex model through the text data file is possible but not to be recommended. The normal approach is to specify a variation model; that is, to modify an existing model imported using the BaseFile identifier and apply incremental changes. This results in a much more compact text data file that can be easily generated using a scripting language or by the OrcaFlex spreadsheet. The OrcaFlex text data file format is not a scripting language, so some batch script operations (InvokeWizard, for instance) are not available.
The easiest way to see how data for a particular model item is represented is to create the item in OrcaFlex and then use the edit data as text item on the model menu to see the text representation. Existing objects normally need to be selected by name before modifying their data, although there are some exceptions that require specific selection identifiers and examples of these are given below.
To set data for an object existing in the base file BaseCase.yml, the object must be first selected by name, here objects named Link1, 3D Buoy1 and Line1 are modified:
BaseFile: BaseCase.yml
Links:
Link1:
UnstretchedLength: 25
3DBuoys:
3D buoy1:
Mass: 4
Volume: 8
Height: 7.5
Lines:
Line1:
IncludeTorsion: Yes
Note: | In subsequent examples we omit the BaseFile directive for brevity. |
Table data are set using an index in square brackets [i] after the data name, where i is the index of the table row starting at 1. The following example sets some data in the first two sections of Line1:
Lines:
Line1:
NumberOfSections: 2
LineType[1]: Riser
Length[1]: 75
TargetSegmentLength[1]: 4
LineType[2]: Rope
Length[2]: 200
TargetSegmentLength[2]: 20
The NumberOfSections identifier specifies the number of rows in the sections table, it is only required if we are changing the size of the table. Every table has an associated row count data item, increasing the count will add new rows to the end of the table containing default data, reducing the count will delete rows from the end of the table. We could replace the table entirely and use a YAML list to repopulate the data, for example setting a new current profile:
Environment:
# Single current
CurrentMethod: Interpolated
RefCurrentSpeed: 1.2
RefCurrentDirection: 36.0
# Define the current profile table
CurrentDepth, CurrentFactor, CurrentRotation:
- [10, 1.0, 0]
- [50, 0.8, 0]
- [90, 0.5, 0]
These objects also need to be referenced by name, they cannot be selected with index notation.
LineTypes:
Line type1:
OD: 0.28
ID: 0.21
ClumpTypes:
Clump type1:
Mass: 0.1
Volume: 0.2
Height: 4
DragAreaX: 0.7
DragChainTypes:
Drag chain type1:
Length: 12
WingTypes:
Wing type1:
Angle[2]: -80
Lift[2]: 0.2
Drag[2]: 0.15
Moment[2]: 0.5
New objects can be added to the model using the New keyword. The object will be created with default data that can be then modified. To add a new line type to the line types list:
LineTypes:
New: Variant line type3
Variant line type3:
OD: 0.29
ID: 0.20
Lines:
Line1:
LineType[2]: Variant line type3
And some new attachment types:
ClumpTypes:
New: Clump 5
Clump 5:
DragArea: [0.7, 07, 0.1]
DragChainTypes:
New: Short chain 2
Short chain 2:
Length: 12
Note: | Objects must be created before they are referred to later in the file. So a new line type must be created in the data file before a line can be later modified to refer to it. |
It is also possible to provide a new list of objects, using the YAML sequence syntax. When this is done, existing objects are removed, and only the objects specified in the sequence remain.
LineTypes:
- Name: Variant line type3
OD: 0.29
ID: 0.20
- Name: Variant line type4
OD: 0.34
ID: 0.24
If any existing objects are referenced by other objects in the model, such as line objects using any pre-existing line types in this example, then an error will be raised when OrcaFlex opens the text data file.
Data on these forms can be set by referencing the general or environment objects as follows (this example assumes that the base file model has 2 simulation stages):
General:
ImplicitUseVariableTimeStep: No
ImplicitConstantTimeStep : 0.1
# Add another simulation stage
StageCount: 3
StageDuration[3]: 12.0
Environment:
SeabedNormalStiffness: 3000
SeabedDamping: 80
RefCurrentSpeed: 1.2
RefCurrentDirection: 36.0
Wave train data requires that the target wave train is selected by name first. The example assumes a base file model with only one wave train and adds a new wave train and names it AiryWave (after being added the wave train is automatically selected). Then the first wave train is modified after being selected with the SelectedWave identifier:
Environment:
# Add a wave train
NumberOfWaveTrains: 2
WaveName[2]: AiryWave
# AiryWave is now the selected wave
WaveType: Airy
WaveDirection: 180
WaveHeight: 3.2
WavePeriod: 12.5
# Change selected wave to Wave1
SelectedWave: Wave1
WaveDirection: 100
WaveHeight: 4.3
WavePeriod: 7.8
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:
General:
SelectedPostCalculationAction: Action3
PostCalculationActionScriptFileName: PostCalculationAction.py
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:
General:
SelectedUserDefinedResult: Result3
UserDefinedResultScriptFileName: UserDefinedResult.py
The example below creates two currents in a multiple current set, and sets one to be the active current using the ActiveCurrent identifier:
Environment:
# Multiple current set
MultipleCurrentDataCanBeDefined: Yes
NumberOfCurrentDataSets: 2
CurrentName[1]: Ebb
CurrentName[2]: Flow
# To modify the ebb current, we must select it first
SelectedCurrent: Ebb
CurrentMethod: Power law
CurrentSpeedAtSurface: 1.2
CurrentSpeedAtSeabed: 0.8
RefCurrentDirection: 180.0
# Now select the other current
SelectedCurrent: Flow
CurrentMethod: Power law
CurrentSpeedAtSurface: 1.2
CurrentSpeedAtSeabed: 0.8
RefCurrentDirection: 0.0
# Set the active current
ActiveCurrent: Ebb
Simple vessel type data are set as for other type data mentioned above, by referencing the vessel type by name first:
VesselTypes:
Vessel type1:
Length: 120
PenWidth: 3
Symmetry: xz plane
Much vessel type data applies to a draught which must also then be referenced by name:
VesselTypes:
Vessel type1:
Draughts:
Draught1:
Mass: 7600
CentreOfMass: [2.53, 0, -1.97]
To set data for displacement RAOs, wave load RAOs and wave drift QTFs you must also specify which type of RAO the data applies to:
VesselTypes:
Vessel type1:
Draughts:
Draught1:
DisplacementRAOs:
RAOOrigin: [2.53, 0, -1.97]
LoadRAOs:
RAOOriginY: -1.2
The RAO data are per direction, so the direction also needs to be selected using the SelectedRAODirectionValue YAML identifier. This example sets the yaw amplitude in the second row in the period table for directions 22.5 and 45 degree of the wave drift RAOs:
VesselTypes:
Vessel type1:
Draughts:
Draught1:
WaveDrift:
SelectedRAODirectionValue: 22.5
RAOYawAmp[2]: 0.13
SelectedRAODirectionValue: 45
RAOYawAmp[2]: 0.18
To modify the frequency-dependent added mass and damping matrices, the frequency or period needs to be selected first, by either index or value. Here we use the SelectedAMDPeriodOrFrequencyValue identifier to access the relevant tables. Data in the tables is then accessed using index notation:
VesselTypes:
Vessel type1:
Draughts:
Draught1:
SelectedAMDPeriodOrFrequencyValue: 5.5
AddedMassMatrixX[1]: 255
AddedMassMatrixY[2]: 249
AddedMassMatrixZ[1]: 136
DampingY[2]: 0.4
It is unlikely that you will want to change individual values in the RAO tables, however the vessel, draught and RAO sections of the text data file are ideal candidates for the IncludeFile function:
VesselTypes:
Vessel type1:
Draughts:
Draught1:
DisplacementRAOs:
IncludeFile: RAOs\UnladenRAOs.yml
Some multibody group data are set in a straightforward manner as follows:
MultibodyGroups:
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:
MultibodyGroups:
Multibody group1:
SelectedStiffnessBody: Body2
DisplacedVolume: 85e3
To set the added mass and damping data you must select the period and both the row and column bodies:
MultibodyGroups:
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
With P-y model data, each depth needs to be selected before the model data can be accessed:
# Create a new P-y model
P-yModels:
New: P-y model1
P-y model1:
NumberOfDepths: 3
DepthBelowSeabedFrom[1]: 0.0
DepthBelowSeabedFrom[2]: 10.0
DepthBelowSeabedFrom[3]: 20.0
# Modify existing P-y model
P-yModels:
P-y model1:
SelectedDepthBelowSeabedFrom: 0
ModelType: API RP 2A soft clay
EffectiveUnitSoilDensity: 1.6
UndrainedShearStrength: 6
J: 0.5
Epsilonc: 4
SelectedDepthBelowSeabedFrom: 10
ModelType: API RP 2A sand
EffectiveUnitSoilDensity: 0
C1: 0
C2: 2
C3: 15
k: 42
SelectedDepthBelowSeabedFrom: 20
ModelType: P-y table
Deflection, Resistance:
- [0, 0]
- [0.2, 11]
Note: | This example creates a new P-y table with two rows. To modify rows in an existing table, use indexing, e.g. Deflection[2]: 0.2. |
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:
SHEAR7Data:
SHEAR7Version: 4.6
SHEAR7OutputDmg: Yes
To access the data in the S-N curve table requires that the curve is first selected with the SelectedSHEAR7SNCurve identifier:
SHEAR7Data:
SelectedSHEAR7SNCurve: Curve2
SHEAR7SNCurveNumberOfPoints: 3
SHEAR7SNCurveS[3]: 10E5
SHEAR7SNCurveN[3]: 10E4
SHEAR7SNCurveEnduranceLimit: 750.7
SHEAR7 whole line data and stress concentration factors are accessed through a line object:
Lines:
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:
Lines:
Line1:
SHEAR7StrouhalType[1]: Rough cylinder
SHEAR7LiftFactor[1]: 0.9
SHEAR7SectionSNCurve[2]: Curve1
To edit penetrator data, the penetrator locations data set must first be selected using the SelectedPenetratorLocationsDataSet identifier:
LineContactData:
PenetratorData:
SelectedPenetratorLocationsDataSet: Locations1
Penetratorx[2]: 13.6
Penetratory[2]: -2.5
PenetratorContactArea[2]: 0.85
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:
CodeChecks:
APIRP2RDDesignCaseFactor: 1
The per-line type code check data are just like any other line type data:
LineTypes:
Line type1:
APIRP2RDTcorr: 0.001
APIRP2RDSMYS: 380e3
New variable data sources can be created in two ways, the first example creates a new fluid temperature data item with 2 table rows:
VariableData:
FluidTemperature:
- Name: fluidTempA
IndependentValue, DependentValue:
- [10, 17]
- [100, 11]
As seen above in creating new objects this example clears the fluid temperature data source list before adding fluidTempA. If any existing variable data items are referenced by other objects then an error will be raised. If you wish to add another variable data item and retain existing data items in the list then use the following YAML format:
VariableData:
FluidTemperature:
New: fluidTempB
fluidTempB:
IndependentValue, DependentValue:
- [10, 15]
- [100, 9.5]
Existing variable data sources can be referenced by name as with other objects. The following example resets the table values for a bending stiffness variable data item:
VariableData:
Stiffness1:
IndependentValue, DependentValue:
- [0, 0]
- [0.2, 1000]
- [0.4, 5000]
Connection data can be set using polar coordinates as presented on the all objects data form. Although these data are displayed in table form, they are still accessed by referencing the relevant object:
Buoys:
Buoy1:
PolarR: 10.0
PolarTheta: 30.0
Lines:
Line1:
PolarR[1]: 20.0
PolarTheta[1]: 45.0
PolarR[2]: 20.0
PolarTheta[2]: 345.0
Line2:
PolarR[1]: 20.0
PolarTheta[1]: 90.0
PolarR[2]: 3400.0
PolarTheta[2]: 90.0
Winches:
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.
For any object that supports object tags, the tags can be edited like this:
Lines:
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 can be set using pre-defined colours or RGB values as described for batch scripts:
LineTypes:
Line type1:
PenColour: Red
LineTypes:
Line type1:
PenColour: 255
LineTypes:
Line type1:
PenColour: \$00FF00
Sections of an OrcaFlex text data file can be imported using the IncludeFile directive. This specifies another YAML file containing a section of an OrcaFlex text data file that will be processed as if the data were part of the original file. The imported segment cannot refer to objects that do not yet exist in the main data file. Using IncludeFile is a useful way of adding or modifying complex data from a library of common object data, for example vessel RAOs:
VesselTypes:
Vessel type1:
Draughts:
Draught1:
DisplacementRAOs:
IncludeFile: MyVesselRAOs.yml
The data in the included file must continue from where the original file left off but there is no need to repeat the YAML header, or start at the same indentation level, although relative indentation in the include file is still required:
# File: C:\Desktop\MyVesselRAOs.yml
RAOOrigin: [2.53, 0, -1.97]
PhaseOrigin: [~, ~, ~]
RAOs:
- RAODirection: 0
RAOPeriodOrFreq, RAOSurgeAmp, RAOSurgePhase, RAOSwayAmp, RAOSwayPhase, RAOHeaveAmp, RAOHeavePhase, RAORollAmp, RAORollPhase, RAOPitchAmp, RAOPitchPhase, RAOYawAmp, RAOYawPhase:
- [0, 0, 360, 0, 0, 0, 360, 0, 0, 0, 0, 0, 0]
# etc..
The IncludeFile identifier can be used more than once in the same OrcaFlex text data file and the included files can also contain the IncludeFile identifier themselves. A very simple OrcaFlex text data file may comprise just the following:
%YAML 1.1
---
# This file: C:\Desktop\Case x.yml
BaseFile: BaseCase y.yml
IncludeFile: Variation set z.yml
...
The above file is easy to create using a script, substituting file names for the BaseFile and IncludeFile files from a collection of initial cases and variation sets.