-
Notifications
You must be signed in to change notification settings - Fork 46
Description
Dear All,
I’m relatively new to MoorDyn and have been tasked with creating a line whose length changes over the course of a simulation. To adjust the overall length, I’m using the MoorDyn_SetLineUnstretchedLengthVel function. However, at small lengths, instabilities arise due to an excessive number of nodes. As far as I know, MoorDyn does not provide a built-in function to add or remove nodes during a simulation.
Given this , I’ve thought of three approaches and would like to hear on whether they are even feasible, or if there’s a better solution I haven’t thought of:
1) Adapting Segment by Segment
In this approach, I modify the MoorDyn_SetLineUnstretchedLength function to only affect the first segment l[0]. Once the length of the first segment reaches a critical distance—too close to the fairlead point—I attempt to remove the node using .erase(). The process then repeats for the next segment, and so on.
Removing a node from line variables (e.g., r, rd, q, qs, and forces) seems straightforward. However, I struggled with the state variables pos and vel. I tried using setState and adjusting the check so that when vel and pos no longer match N-1 (after removing a node), the first row of pos and vel is removed (Good to note, that I am using an older verison of Moordyn, not exactly sure when). Unfortunately, this causes the line values to explode, likely from how it's copying the pos and vel to r and rd (I think....).
I suspect my limited C++ skills and incomplete understanding of MoorDyn are hindering a more elegant solution. But more generally, I am wondering whether removing nodes during a simulation is even a viable approach?
2) Restarting the Simulation with Loaded Values
From what I understand, MoorDyn’s load functions require the same input file, so my idea is to write all key initialization variables, interpolate midpoints to halve the number of nodes and their associated data, and then reload the simulation with the reduced node count. By uploading all the variables from the previous step ( I hope) to avoid initializing the problem. To me, this seems relatively straightforward, but perhaps I am overlooking something. The downside relative to the first is that it does require a restart of Moordyn.
3) Reinitializing with a New Input File
Here, I extract the x and xd values of the points defining the line and create a new “case” with these inputs. This method works reasonably well, but it requires reinitializing the simulation, which is time-consuming. Additionally, all data between the two states is lost, which is far from ideal. Therefore, I am not inclined to follow this method, unless there is a way of preventing the lost data. I can provide more details if needed, but I already feel bad about how long this post is.
I apologize for the lengthy post and happy to provide clarifications if needed. Thank you for your time and your input—I’m looking forward to hearing your thoughts!
Best Regards,
Carl
PS: I was not able to upload any code snippets since my code is on an offline computer and it is difficult to transfer data to this one.