compartment->string compartment

Convert compartment to human-readable string.

convert-asset asset [#:options]

Convert asset using options. Output format is specified as output-format option. See supported-asset-options for the full list of options.

default-policy

Return default policy. Policy can be either openmp or opencl. It controls whether processor cores or GPU is used to accelerate computations.

export-asset asset [#:options]

Export asset to file using options. File path is specified as output-path option. See supported-asset-options for the full list of options.

export-polyhedron polyhedron path [#:options]

Export polyhedron to the file specified by path using options. Output format is specified as output-format option. See supported-asset-options for the full list of options.

generate-compartments hull rooms

Generate ship compartments for hull. rooms specify how many rooms in each dimension is generated. Fits the grid of rooms in the bounding box of the hull.

get-testbed

Get the current instance of virtual testbed. This can only be done when the GUI is stopped (see testbed-gui-stop!).

grid->string grid

Convert grid to human-readable string.

grid-max grid

Get upper bound.

grid-min grid

Get lower bound.

grid-select grid dimensions

Construct a new grid by selecting dimensions from the existing grid. dimensions is a list of integers.

import-asset [#:options]

Import an asset from file using options specified. File path is specified as input-path option. See supported-asset-options for the full list of options.

import-compartments path [#:options]

Import ship compartments from the file specified by path using options. See supported-asset-options for the full list of options.

import-hull path [#:options]

Import ship hull from the file specified by path using options. Input format is specified as input-format option. This function is the same as import-polyhedron but also computes ship mass. See supported-asset-options for the full list of options.

import-polyhedron path [#:options]

Import polyhedron from the file specified by path using options. File path is specified as input-path option. Input format is specified as input-format option. See supported-asset-options for the full list of options.

make-anlt-wind-solver [#:velocity] [#:leeward-ratio] [#:policy]

Make wind velocity field generator and solver. The generator produces wind field with constant velocity taking into account obstacles. leeward-ratio controls the ratio of the velocity vector that is reflected from the leeward part of the obstacle.

make-calm-sea-generator

Make calm sea wavy surface generator. This generator produces perfectly flat ocean surface.

make-compartment polyhedron [#:name]

Make ship compartment from polyhedron with optional name.

make-gerstner-solver [#:waves] [#:policy] [#:diffraction] [#:radiation] [#:waterline-only] [#:diffraction-ratio] [#:depth]

Make Gerstner solver. This solver replaces both the wave generator and the wave pressure solver. waves is a list of <linear-wave> objects created by make-wave. diffraction and radiation are boolean options that enable or disable simulation of the corresponding phenomena. waterline-only option, when enabled, makes the solver neglect the ship hull panels that are underwater and compute radiation and diffraction forces only for the panels that are directly on the waterline. This reduces accuracy, but improves performance greatly. diffraction-ratio controls wave reflection. If you set it to 0, no reflection occurres. If you set it to 1, wave are fully reflected and their amplitudes are doubled. depth is water depth. Set it to positive infinity to neglect shallow water terms. policy controls parallel computations. See supported-policies for the explanation and possible values.

make-grid [#:min] [#:max] [#:num-points] [#:num-segments]

Make multidimensional rectangular grid. Specify either the number of points or the number of segments: the other parameter is calculated as num-segments = num-points - 1.

make-opencl-context [#:platform-suffix] [#:device-name] [#:device-type] [#:flags]

Make OpenCL context. You need this context only if you plan to use GPU acceleration. To do so, pass the context as an argument to make-testbed. The following options help to choose a particular plaform. Use opencl-platforms to find out particular values on your machine. platform-suffix is the suffix of the platform. You can use any substring, uppercase or lowecase, as long as it uniquely identifies the platform. device-name is the name of the device. You can use any substring, uppercase or lowecase, as long as it uniquely identifies the device. device-type is the type of the device. Possible values are accelerator, all, CPU, GPU, custom, default. flags is compiler flags. Refer to OpenCL manual for a list of possible values.

make-plane-wave-generator [#:wave] [#:policy]

Make plane wave generator. This generator produces ocean surface made by the specified wave. wave is created by make-wave. policy controls parallel computations. See supported-policies for the explanation and possible values.

make-quaternion w x y z [#:unit]

Make quaterinon from w, x, y, z components. "If unit is true, then the resulting quaternion is normalised (the default).

make-ship [#:hull] [#:compartments] [#:mass] [#:displacement] [#:draught] [#:quaternion]

Construct ship from hull, compartments and optionally specify any of the following: mass, displacement, draught, quaternion.

make-testbed [#:grid] [#:wave-generator] [#:wind-solver] [#:ship] [#:policy] [#:opencl-context]

Make virtual testbed. All arguments are optional, when omitted, sane defaults are used. grid is four-dimensional or three-dimensional simulation grid. wave-generator is a ocean wave generator (see make-plane-wave-generator). wind-solver is wind velocity field generator and solver (see make-anlt-wind-solver). ship is ship made by make-ship. policy controls parallel computations. See supported-policies for the explanation and possible values. opencl-context OpenCL context.

make-wave type [#:amplitude] [#:length] [#:direction] [#:normal]

Make wave with specified type, amplitude, length and direction angle or normal. Angular frequency is calculated using dispersion relation for the specified type of the wave. Type can be one of the following.

<propagating-cosine-wave>Linear wave theory.
<standing-cosine-wave>Linear wave theory.
<linear-wave>Linear wave theory.
<propagating-stokes-wave>Stokes wave.
opencl-platforms

Get the list of all OpenCL platforms.

polyhedron-bounding-box polyhedron

Compute bounding box of the polyhedron. Return minimum and maximum value for each dimension as a pair of two lists.

polyhedron-bounds polyhedron dimension

Compute the extent of the polyhedron in specified dimension.

polyhedron-centroid polyhedron

Compute centroid of the polyhedron.

polyhedron-empty? polyhedron

Return true if polyhedron contains no vertices, faces and normals.

polyhedron-flip polyhedron dimension

Flip the polyhedron relative to the origin in a specified dimension. Return new polyhedron.

polyhedron-flip! polyhedron dimension

Flip the polyhedron relative to the origin in a specified dimension. Change existing polyhedron.

polyhedron-mirror polyhedron dimension

Mirror the polyhedron relative to the origin in a specified dimension. Return new polyhedron.

polyhedron-mirror! polyhedron dimension

Mirror the polyhedron relative to the origin in a specified dimension. Change existing polyhedron.

polyhedron-move polyhedron delta

Move the polyhedron to a specified delta in three dimensions. Return new polyhedron.

polyhedron-move! polyhedron delta

Move the polyhedron to a specified delta in three dimensions. Change existing polyhedron.

polyhedron-normalise polyhedron

Compute vertex and face normals. Return new polyhedron. Use polyhedron-reorder to make sure that face indices winding order is correct.

polyhedron-normalise! polyhedron

Compute vertex and face normals. Change polyhedron. Use polyhedron-reorder! to make sure that face indices winding order is correct.

polyhedron-reorder polyhedron

Fix face vertices winding order. Return new polyhedron. This procedure makes winding order of all face indices compatible with neighbouring faces. The method finds reference face and computes surface normal using simple heuristic (the value of angle between normal and vector from the centre of the geometry to face centre). If the guess is correct, all faces would have the correct surface normal, otherwise they would have normals with the opposite directions.

Reference face is a face that is closest to the geometry centre.

Use polyhedron-unique to make sure that there are no faces with duplicate indices and there are no duplicate vertices.

polyhedron-reorder! polyhedron

Fix face vertices winding order. Change polyhedron. This procedure makes winding order of all face indices compatible with neighbouring faces. The method finds reference face and computes surface normal using simple heuristic (the value of angle between normal and vector from the centre of the geometry to face centre). If the guess is correct, all faces would have the correct surface normal, otherwise they would have normals with the opposite directions.

Reference face is a face that is closest to the geometry centre.

Use polyhedron-unique! to make sure that there are no faces with duplicate indices and there are no duplicate vertices.

polyhedron-rotate polyhedron dimension angle

Rotate the polyhedron relative to the origin in a specified dimension by the angle that is multiple of 90 degrees. Return new polyhedron.

polyhedron-rotate! polyhedron dimension angle

Rotate the polyhedron relative to the origin in a specified dimension by the angle that is multiple of 90 degrees. Change existing polyhedron.

polyhedron-scale polyhedron factor

Scale the polyhedron by a specified factor in three dimensions. Return new polyhedron.

polyhedron-scale! polyhedron factor

Scale the polyhedron by a specified factor in three dimensions. Change existing polyhedron.

polyhedron-signed-volume polyhedron

Compute signed volume of the polyhedron.

polyhedron-signed-volume-below polyhedron dimension level

Compute signed volume of the polyhedron below certain level in dimension. For example, use (polyhedron-signed-volume-below poly 2 0) to compute signed volume of poly below 0 in dimension.

polyhedron-unique polyhedron

Remove duplicate vertices and faces. Return new polyhedron. Removes faces with duplicate indices as a side effect.

polyhedron-unique! polyhedron

Remove duplicate vertices and faces. Change polyhedron. Removes faces with duplicate indices as a side effect.

polyhedron-volume polyhedron

Compute absolute volume of the polyhedron.

set-testbed! other

Replace the current instance of virtual testbed with other. This can only be done when the GUI is stopped (see testbed-gui-stop!).

ship-compartment-flood! ship name volume

Flood ship compartment named name with volume of water. Use ship-compartments to find compartments names.

ship-compartments ship

Get ship compartments including their names.

ship-mass ship

Get ship mass.

ship-quaternion ship

Get ship quaternion.

ship-quaternion! ship quaternion

Set ship quaternion.

statistics-columns statistics

Get all column names as symbols.

timeSimulation time instant, s.
surgeShip translation along axis, m.
swayShip translation along axis, m.
heaveShip translation along axis, m.
rollShip rotation angle around axis, m.
pitchShip rotation angle around axis, m.
yawShip rotation angle around axis, m.
velocity-xShip linear velocity along axis, m/s.
velocity-yShip linear velocity along axis, m/s.
velocity-zShip linear velocity along axis, m/s.
angular-velocity-xShip angular velocity around axis, m/s.
angular-velocity-yShip angular velocity around axis, m/s.
angular-velocity-zShip angular velocity around axis, m/s.
acceleration-xShip linear acceleration along axis, m/s.
acceleration-yShip linear acceleration along axis, m/s.
acceleration-zShip linear acceleration along axis, m/s.
angular-acceleration-xShip angular acceleration around axis, m/s.
angular-acceleration-yShip angular acceleration around axis, m/s.
angular-acceleration-zShip angular acceleration around axis, m/s.
underwater-volumeThe volume of submerged part of the ship, .
wave-length-tSurface wave period, s.
wave-length-xSurface wave length along axis, m.
wave-length-ySurface wave length along axis, m.
wave-number-tSurface wave frequency, .
wave-number-xSurface wave number along axis, .
wave-number-ySurface wave number along axis, .
wave-height-tSurface wave height along time axis measured at one point of space, m.
wave-height-xSurface wave height along axis measured at one point of time, m.
wave-height-ySurface wave height along axis measured at one point of time, m.
elevationSurface elevation measured at one point of time and space (at ship position for regular grid and at the starting point of the grid for irregular grid).
angular-momentum-xShip angular momentum around axis, .
angular-momentum-yShip angular momentum around axis, .
angular-momentum-zShip angular momentum around axis, .
statistics-current-row statistics

Get the current row of the table as associative list.

supported-asset-options

Return a list of options supported by asset import, export and conversion procedures. Basic options for all converters are: input-path, output-path, input-format, output-format. Options are specified as a list of pairs where the first element of the pair is symbol denoting the name of the option, and the second element is a string containing option value. If input format is not present in options, it is determined automatically from the file extension. The list of all options is below.

Common options:

gnuplotOutput as Gnuplot script. This option works for any asset internal representation of which is polyhedron. Default value is #f.
input-formatInput format. Can be one of the following: obj, stl, vsl, bsp, igs, rms.
output-formatOutput format. Can be one of the following: obj, stl, vsl, bsp, igs, rms.
input-pathInput file path.
output-pathOutput file path.

VSL options:

close-topDo not remove the main deck. Default value is #t.
close-bottomDo not remove the bottom. Default value is #t.
step-zVertical distance between points in metres. Default value is computed automatically as the average vertical distance between spline points.

BSP options:

resolution-uThe number of points for segment in dimension. Default value is 2.
resolution-vThe number of points for segment in dimension. Default value is 2.

Options for import-hull

centre-of-massHow to determine centre of mass? Possible values: "centroid", "auto". Default value is "auto".
centre-of-mass-deltaThree-dimensional offset of the centre of mass from the centroid. Default value is '(0 0 0).
draughtHull draught. Default value is determined automatically from the file format. If the format does not contain draught value, minimal coordinate is used. If minimal coordinate is nought, then the distance from the bottom of the hull to the centre of mass is used instead.
supported-policies

Return a list of policies supported by virtual testbed. Policy can be either openmp or opencl. It controls whether processor cores or GPU is used to accelerate computations.

testbed-grid testbed

Get simulation grid.

testbed-gui-pause!

Pause real-time simulation and screen recording.

testbed-gui-start!

Start real-time simulation.

testbed-gui-start-recording!

Start screen recording. Can be done before or after GUI has been started. The screen is recorded os OGV file in the current working directory. When GUI is stopped or paused, screen recording is stopped.

testbed-gui-stop!

Stop real-time simulation and screen recording.

testbed-gui-stop-recording!

Stop screen recording. This procedure properly closes screen recording output file.

testbed-policy! testbed policy

Set testbed policy. Setting the policy replaces all testbed solvers with default ones for the specified policy. policy controls parallel computations. See supported-policies for the explanation and possible values.

testbed-reset! testbed

Reset testbed state.

testbed-statistics testbed

Get statistics that contains time series of recorded ship motion and fluid motion parameters.

testbed-step! testbed delta-t

Simulate one time step. delta-t is the size of the step in seconds.

testbed-time-instant testbed

Get the current simulation time instant.

vtestbed-gc

Run garbage collection and all object destructors. Use this procedure to make sure that all memory allocated in C++ part of the programme is freed.