﻿ Constraints: Solution method

# Constraints: Solution method

The constrained relative motion between the in-frame and the out-frame can be computed in two mathematically distinct ways. For ease of terminology, we refer to these as the direct and indirect solution methods. Each method has its advantages and disadvantages. Historically, only the direct solution method was used by OrcaFlex.

 Note: The direct and indirect solution methods are mathematically equivalent descriptions of the same physical system. However, they are fundamentally different formulations which will only match precisely in the limit of small time-steps and tight tolerances.

### Direct solution method

The direct solution method works by defining coordinate mappings to directly express the position and orientation of the out-frame in terms of the position and orientation of the in-frame, plus some generalised auxiliary coordinates, which encode the relative motion between the two frames. The generalised coordinates are chosen in such a way that the constraint equations are automatically satisfied at all possible points in the solution space explored by OrcaFlex's solver. The advantages of the direct method are:

• It is much more prescriptive than the indirect method, in that there is a direct and obvious relationship between the various coordinates, and these are enforced explicitly, rather than solved for implicitly. This means that the constraint equations will be satisfied exactly (up to machine precision) and the method may be more robust because of this.
• It is compatible with explicit time domain integration and modal analysis.
• Winding can be accounted for when computing the moment generated by the stiffness associated with the rotational offset between the in-frame and the out-frame.

• It can be slow compared to the indirect method, especially when many constraints are chained together. This is because it induces widespread couplings between coordinates in the system Jacobian matrix, which are expensive to resolve.
• Double-sided connections are not possible.

### Indirect solution method

The indirect solution method works by using OrcaFlex's solver to solve the constraint equations implicitly. This is achieved by adding additional, non-dynamical degrees of freedom to the system – Lagrange multipliers – which are closely related to the constraint forces needed to enforce the constraint equations. OrcaFlex then solves this larger system of equations to recover the physical solution. The advantages of the indirect method are:

• It is generally more computationally efficient than the direct method, especially when many constraints are chained together. This means that models containing indirectly solved constraints will often run faster than their directly solved equivalents.
• Use of the indirect solution method allows double-sided connections to be defined.

• Since the constraint equations are solved for indirectly by the solver, they may only be satisfied up to the tolerance of the solve. For instance, a Cartesian constraint with its internal $x$ degree of freedom locked out should report $x=0$ at all log sample times, when asked for results upon completion of a simulation. This will be the case for directly solved constraints, but for indirect constraints there may be some small fluctuations about zero, governed by the tolerance of the analysis.
• The introduction of non-dynamical degrees of freedom can make models more prone to convergence problems, preventing them from running to completion.
• Models represented by indeterminate systems of mathematical equations are more frequently encountered when using the indirect solution method. Such a model may be perfectly valid from a physics perspective, but may produce singular Jacobian matrices because of redundant degrees of freedom perceived by the solver. Such models will fail to run, usually by raising a singular matrix error in statics. This problem can often be overcome by defining a small, but non-zero, Jacobian perturbation factor for the model, but this requires extra consideration on the part of the user when building models. Models containing double-sided connections will be especially vulnerable to indeterminacy, for reasons expounded below.
• Lagrange multipliers are not compatible with explicit time domain integration or modal analysis.
• It cannot account for rotational winding between the in-frame and the out-frame.

The indirect solution method can be applied to all constraint types (apart from free constraints, for which the solution method is not relevant), including imposed motion constraints. An imposed motion constraint has zero physical degrees of freedom, since its motion is completely prescribed. However, for an indirect imposed motion constraint, OrcaFlex actually solves a twelve degree of freedom system! These degrees of freedom are the six coordinates of the out-frame plus an additional six Lagrange multipliers. Compare this with the direct solution method, in which there are no degrees of freedom to solve for at all. Why, therefore, would the indirect solution method ever be useful for an imposed motion constraint? The reason is that you might want to make the constraint connection double-sided, which is not possible for a directly solved constraint.

### Double-sided connections

Constraints solved with the indirect solution method can have a double-sided connection. This means that it is possible to connect the constraint's in-frame to one object and the constraint's out-frame to another. You can realise this by ticking the double-sided connection checkbox on the constraint data form. When you do this, a whole new set of data items will appear, inviting you to set the parent object to which the out-frame will be connected, plus the usual connection positions and attitude angles relative to this parent object. This data will initially be used to determine the position and orientation of the out-frame in reset state. This is very different from a constraint that does not have a double-sided connection; in that case, the out-frame's reset position and orientation are determined from the usual data which defines the relationship between the out-frame and the in-frame (e.g. the DOF initial values for a Cartesian constraint, or the initial displacement values for a constraint whose motion is determined by a partially ramped time history). In the double-sided case, the actual constraint equations are ignored in reset; they are only enforced (by the solver) once the analysis gets underway.

The default value for the out-frame connection is free. This means that the out-frame ostensibly has six free degrees of freedom, which allows the solver to place it anywhere it likes in order to satisfy the stated relationship between the in-frame and the out-frame (such as a particular internal degree of freedom, e.g. $x$, being fixed on the degrees of freedom page). Internally, this is exactly the same approach as is used for a single-sided constraint solved with the indirect solution method. In that case, the solver also perceives the out-frame as having six free degrees of freedom; however, the difference between the two cases is that the single-sided case starts off satisfying the constraint, even when the model is reset, just like a directly solved constraint would.

What is the utility of a double-sided constraint? The main reason for using one is to obviate issues with circular connection dependencies, such as would happen if you connected Buoy1 to Buoy2, then Buoy2 to Buoy3, then attempted to connect Buoy3 to Buoy1. This sort of loop is not permitted in OrcaFlex. The issue can be circumvented by adding a constraint with a double-sided connection: the in-frame of the constraint could be connected to Buoy3 and the out-frame connected to Buoy1, closing the loop. Whilst this example has no practical value and is purely to illustrate the concept, it is easy to construct systems in which double-sided constraints are extremely useful. For instance, building a model of a solar array, a lattice composed of interconnecting panels, can be extremely difficult, or even impossible, without using double-sided connections. Having to keep track of loops of connections, in order to avoid circular connection dependencies, can be extremely time-consuming and confusing.

The key advantage of double-sided constraints is that you can always use one to connect any two objects or subsystems together, regardless of the details of the subsystems or any existing connections in the model. This makes them much easier to add into complex models than their single-sided counterparts.

It is very easy to build an ostensibly indeterminate system, with redundant degrees of freedom, with double-sided connections. For instance, returning to the earlier example in which the chain of connections is in-frame $\rightarrow$ Buoy3 $\rightarrow$ Buoy2 $\rightarrow$ Buoy1 $\leftarrow$ out-frame, the constraint is literally adding nothing to the physical system. Removing it would result in exactly the same physics, namely that of three buoys rigidly connected together. However, what the constraint does add is additional equations of motion and associated degrees of freedom to be solved for. These additional degrees of freedom are completely redundant and will often lead to systems with singular Jacobian matrices, since certain equations of motion are identically satisfied for all values of coordinates guessed by the solver. As already mentioned, it will often be possible to resolve such issues via a judicious choice of Jacobian perturbation factor.

 Note: It is also possible to connect other objects to a double-sided constraint, in the usual fashion. The child object forms its connection to the out-frame of the double-sided constraint, which is exactly the same behaviour as when connecting a child object to a single-sided constraint.

### Modelling considerations

It is possible to specify out-frame connection data that is incompatible with the defined relationship between the in-frame and the out-frame; such models are insoluble and will fail to converge. For instance, consider a case where the in-frame and the out-frame have fixed connections to different positions in OrcaFlex's global frame of reference. If it is further specified that all six internal degrees of freedom of the constraint, $x, y, z, Rx, Ry$ and $Rz$ are fixed (to be 0), then there is literally no way that all these restrictions can simultaneously be satisfied. Mathematically, this is what is known as an overdetermined system. The converse case is an underdetermined (aka indeterminate) system, in which there are more free coordinates in the mathematical representation of the system than there are degrees of freedom of the actual physical system. Such systems will generally have multiple solutions.

 Note: Identifying redundant degrees of freedom in (the mathematical representation of) an OrcaFlex model can be an extremely difficult task, in general, and not one that is readily amenable to automation. In particular, the redundancy may be associated with some nontrivial combination of the physical model coordinates.

Let us illustrate the above concepts with some examples. For simplicity, we set the gravitational acceleration, $g$, to 10 m/s2 on the general data form. Consider the case of a constraint with its in-frame fixed 100m above the sea surface. Set the constraint's translational stiffness, $k$, to 1 kN/m, then attach a default 3D buoy (of mass $m=$ 3 te) to it (with no offset). Now make the constraint's internal $z$ degree of freedom free on the degrees of freedom page of the constraint data form. We expect the static equilibrium for the system to be where the weight of the buoy balances the stiffness. This will be when $z = -30$m, since $k z = -m g$.

Firstly, consider the case where the solution method is direct: there is a single free coordinate, $z$, in the system of equations, which OrcaFlex can solve for without issue.

Secondly, consider the case where the solution method is indirect: the system of equations contains the six rigid body degrees of freedom of the out-frame, plus an additional five Lagrange multipliers, one for each of the five constraint equations $x=0$, $y=0$, $Rx=0$, $Ry=0$ and $Rz=0$. This makes an eleven degree of freedom problem, which OrcaFlex solves to yield the same result as in the direct case.

Thirdly, consider an equivalent model with a double-sided connection. We construct this by changing the buoy's connection to free, then giving the constraint a double-sided connection and attaching its out-frame to the 3D buoy. If you were to run statics for this case, you would find that it would fail to converge with a singular Jacobian error. The reason for this is that we have constructed an underdetermined system of equations. Once again, there are five constraint equations, $x=0$, $y=0$, $Rx=0$, $Ry=0$ and $Rz=0$, with a Lagrange multiplier for each. However, this time there are only three additional free coordinates, the three translational coordinates of the 3D buoy. This is eight degrees of freedom in total. To see why this makes the system indeterminate, consider the orientation of the out-frame. Since the out-frame is rigidly connected to the 3D buoy, and the 3D buoy has no rotational degrees of freedom, its orientation is forced to remain aligned with the global axes at all times. This means that the three rotational constraint equations, $Rx=0$, $Ry=0$ and $Rz=0$ are identically satisfied: there is no guess for the eight free coordinates that the solver can make to alter this. Accordingly, the three Lagrange multipliers associated with the $Rx$, $Ry$ and $Rz$ degrees of freedom are completely redundant and could be removed from the system of equations without changing the physics. It is this redundancy which makes the Jacobian singular for this problem.

Now open the general data form and set a small Jacobian perturbation factor of $10^{-18}$. This is sufficient to render the Jacobian non-singular, allowing OrcaFlex to find a valid solution (since this is a statics analysis, the Jacobian perturbation factor will only affect the rate of convergence, not the accuracy of the resulting solution).

Open the constraint data form and set the constraint's internal $Rx$, $Ry$ and $Rz$ degrees of freedom to be free. Using the direct solution method, this would have the effect of adding three degrees of freedom to the problem; however, in the indirect case it has the effect of removing the three redundant Lagrange multipliers that were causing the indeterminacy, so that the total number of degrees of freedom is reduced by three. Now set the Jacobian perturbation factor back to 0 and re-run statics. This time the analysis converges with no problems.

Finally, set the constraint's internal $Rx$, $Ry$ and $Rz$ degrees of freedom back to fixed and put the Jacobian perturbation factor back to $10^{-18}$. Now set the out-frame declination angle to be 1°. This time, the static analysis will run without error but fail to converge. The reason for this is that the three rotational constraint equations are now $Rx=0$, $Ry=1$°; and $Rz=0$. Clearly, the $Ry$ equation is incompatible with the condition that the orientation of the out-frame must remain aligned with the global axes. This is therefore an overdetermined system of equations and is insoluble.

The above example is slightly artificial because it is rare to connect another object to a 3D buoy in OrcaFlex, exactly because it has no rotational degrees of freedom and cannot handle any moments generated by the objects connected to it. If we'd used a 6D buoy instead of a 3D buoy in the earlier examples, then everything would have been fine. There is, however, one very important case where you might encounter similar issues: when you connect the out-frame of a constraint to a line that does not include torsion. OrcaFlex will issue a warning if you try to run such a model, recommending that you turn on torsion for the line.

As already explained, if a particular model requires a non-zero Jacobian perturbation factor in order to run, then this indicates that there is an indeterminacy in its system of equations. The indeterminacy may be in either its physical coordinates or its nondynamical Lagrange multipliers (or a combination of both). One example of the former is a perfectly cylindrical buoy. All other things being equal, this buoy can be rotated by an arbitrary amount about its axis of symmetry without affecting the forces it experiences. Such a system has multiple equilibria and the angle of rotation of the buoy about its axis is effectively redundant.

Indeterminacy in the Lagrange mulipliers is a sign that the connection load equations have multiple solutions. For instance, consider a mass, $m$, held from above by two perfectly rigid cables. The forces in the two cables, $F_1$ and $F_2$, must provide a total force of $F_1 + F_2 = mg$. This equation can be solved in an infinite number of ways. For instance, $F_1 = F_2 = m g / 2$ seems like a natural solution. However, $F_1 = 1001 m g$, $F_2 = -1000 m g$ is an equally good solution. This ambiguity arises because in reality there is no such thing as a perfectly rigid cable. In a real physical system, the cables will have stiffnesses, $k_1$ and $k_2$, and there will be some strain of length, $x$. The forces in the two cables are $F_1 = k_1 x$ and $F_2 = k_2 x$, and we have $x = m g / (k_1 + k_2)$. If we write $k_1 = a k$ and $k_2 = b k$, then we have $F_2/F_1 = k_2/k_1 = b/a$, which still holds as we send $k \rightarrow \infty$. However, in our original, perfectly rigid case, we have no information about the relative stiffnesses and hence no way to accurately reconstruct the two connection forces. The only meaningful thing we can say is that $F_1 + F_2 = m g$.

Given these ambiguities, it is impossible to say with certainty which solution to the connection load equations OrcaFlex will produce for a given indeterminate system. It depends entirely on the path traversed by OrcaFlex's solver through its coordinate space. We therefore offer the following guidance:

 Guidance: If you have a model with indirect constraints that requires a non-zero Jacobian perturbation factor to run, then be extremely careful when interpreting connection load results. It may be that only certain linear combinations of these connection loads are physically meaningful.

Which connection loads may not be physically meaningful when viewed in isolation? This depends on the details of the model; but, in general, such loads can be expected any place where a pair of subsystems are joined by two or more connections in such a way that removing one of the connections would not affect (a particular component of) the motion between them. If this is the case, then the connection loads associated with those components of motion are probably only valid as a combination of the loads across all the connection points between the two subsystems.

### Sea fastening and interface loads

It would be useful to extract meaningful connection loads (when there are multiple connections between two subsystems) in sea fastening applications, such as modelling a shipping container tethered to the deck of a vessel at multiple points. As discussed in the previous section, this would not be possible if the tethers were modelled as double-sided constraints with fixed internal degrees of freedom ($x$, $y$, $z$, $Rx$, $Ry$, $Rz$), since in that case only the combined connection load would be meaningful. However, it is possible to use double-sided constraints for this purpose by setting all their internal degrees of freedom to free and applying a soft constraint between the in-frame and the out-frame via non-zero translational and rotational stiffnesses. This allows each connection point to strain independently of the others and, as in the case of the earlier example of a point mass supported by two cables, these strains will be sufficient to recover the exact connection loads within each individual constraint.