### Install VTK dependencies Source: https://hfchen20.gitlab.io/foamMooring/installation Install the appropriate VTK development package based on the Ubuntu version. ```bash # Ubuntu 20.04 sudo apt install libvtk7-dev # Ubuntu 22.04 or newer sudo apt install libvtk9-dev ``` -------------------------------- ### Install LAPACK dependencies Source: https://hfchen20.gitlab.io/foamMooring/installation Install the required LAPACK libraries for MAP++ functionality. ```bash sudo apt install liblapack3 sudo apt install liblapack-dev liblapacke-dev ``` -------------------------------- ### Define mooring restraints Source: https://hfchen20.gitlab.io/foamMooring/six-dof-mooring Example of available mooring restraint types for dynamicMeshDict. ```OpenFOAM // Example mooring restraints available in libsixDoFMooring // moorDynR1 || moorDynR2 || map3R || moodyR ``` -------------------------------- ### Configure Make/files for MAP++ Source: https://hfchen20.gitlab.io/foamMooring/installation Add the necessary interface files to the Make/files configuration. ```text map3R/mapFoamInterface.C map3R/map3R.C ``` -------------------------------- ### Configure Make/options for MAP++ Source: https://hfchen20.gitlab.io/foamMooring/installation Include the required LAPACK and MAP++ library flags in the Make/options configuration. ```text -llapacke \ -lmap-1.30.00 \ ``` -------------------------------- ### Clone the foamMooring repository Source: https://hfchen20.gitlab.io/foamMooring/installation Create the project directory and clone the repository into the user directory. ```bash mkdir -p $WM_PROJECT_USER_DIR cd $WM_PROJECT_USER_DIR git clone https://gitlab.com/hfchen20/foamMooring.git cd foamMooring ``` -------------------------------- ### Register sixDoFMooring library Source: https://hfchen20.gitlab.io/foamMooring/six-dof-mooring Add the library to the controlDict file to enable mooring functionality. ```OpenFOAM libs (sixDoFMooring); ``` -------------------------------- ### Compile foamMooring Source: https://hfchen20.gitlab.io/foamMooring/installation Execute the build script to compile the libraries. ```bash ./Allwmake ``` -------------------------------- ### Configure legacy VTK output in dynamicMeshDict Source: https://hfchen20.gitlab.io/foamMooring/utilities Settings to enable runtime generation of legacy VTK files for mooring restraints. ```OpenFOAM writeMooringVTK true; // optional, default false vtkPrefix "mdv2_pt"; // optional, default depends on the underlying mooring model vtkStartTime 0; // optional, default 0 outerCorrector 3; // optional, default 3 ``` -------------------------------- ### Load rigidBodyMooring library in controlDict Source: https://hfchen20.gitlab.io/foamMooring/rgb-mooring Add this entry to the controlDict file to enable the rigidBodyMooring library. ```OpenFOAM libs (rigidBodyMooring); ``` -------------------------------- ### Compile MAP++ Source: https://hfchen20.gitlab.io/foamMooring/installation Manually compile the MAP++ library and copy it to the user library directory. ```bash (cd map-plus-plus/src; make && cp libmap-1.30.00.so $FOAM_USER_LIBBIN) ``` -------------------------------- ### Configure MAP++ for multiple bodies Source: https://hfchen20.gitlab.io/foamMooring/rgb-mooring Defines a map3R mooring system with multiple bodies and specific attachment points. ```text map3R { type map3R; body box1; bodies (box1 box1 box1 box1 box2 box2 box2 box2); inputFile "Mooring/twinFB.map"; summaryFile "Mooring/twinFB_summary.map"; outputFile "Mooring/mapForces.map"; waterDepth 0.514; writeMooringForces true; writeMooringVTK true; vtkStartTime 0; outerCorrector 3; nNodes 6; //# nodes for all lines nodesPerLine (12 12 12 12 12 12 12 12); refAttachmentPt ( (-0.25 0.3725 -0.0729) (-0.25 -0.3725 -0.0729) ( 0.25 0.3725 -0.0729) ( 0.25 -0.3725 -0.0729) (-0.25 0.3725 -0.0729) (-0.25 -0.3725 -0.0729) ( 0.25 0.3725 -0.0729) ( 0.25 -0.3725 -0.0729) ); } ``` -------------------------------- ### Configure MoorDyn for point coupling Source: https://hfchen20.gitlab.io/foamMooring/rgb-mooring Defines a moorDynR2 system using point coupling mode for multiple bodies. ```text moorDynR2_point { type moorDynR2; body box1; couplingMode "POINT"; inputFile "Mooring/lines_v2_pointCoupling.txt"; bodies (box1 box1 box1 box1 box2 box2 box2 box2); refAttachmentPt ( (-0.25 0.3725 -0.0729) (-0.25 -0.3725 -0.0729) ( 0.25 0.3725 -0.0729) ( 0.25 -0.3725 -0.0729) (-0.25 0.3725 -0.0729) (-0.25 -0.3725 -0.0729) ( 0.25 0.3725 -0.0729) ( 0.25 -0.3725 -0.0729) ); writeMooringVTK true; vtkStartTime 0; outerCorrector 3; } ``` -------------------------------- ### Configure Moody for multiple bodies Source: https://hfchen20.gitlab.io/foamMooring/rgb-mooring Defines a moodyR mooring system with multiple bodies. ```text moodyR { type moodyR; body box1; bodies (box1 box1 box1 box1 box2 box2 box2 box2); inputFile "Mooring/Chen2022_twinFB.m"; refAttachmentPt ( (-0.25 0.3725 -0.0729) (-0.25 -0.3725 -0.0729) ( 0.25 0.3725 -0.0729) ( 0.25 -0.3725 -0.0729) (-0.25 0.3725 -0.0729) (-0.25 -0.3725 -0.0729) ( 0.25 0.3725 -0.0729) ( 0.25 -0.3725 -0.0729) ); } ``` -------------------------------- ### Define sixDoF_History functionObject Source: https://hfchen20.gitlab.io/foamMooring/utilities Configuration for recording rigid body motion history at runtime using OpenFOAM functionObjects. ```OpenFOAM sixDoF_History { type sixDoFRigidBodyState; libs ("libsixDoFRigidBodyState.so"); angleFormat radians; //or degrees writeControl timeStep; writeInterval 5; } ``` -------------------------------- ### Extract motion data with Bash script Source: https://hfchen20.gitlab.io/foamMooring/utilities A script to parse OpenFOAM log files and extract center of mass, velocity, and orientation data. ```Bash #!/bin/bash # # How-to use: # Assuming a fixed number of outer iterations per time step! # $ ./extractMulti.sh log.interFoam file=$1 # Count the outer corrector NCOM=$(cat $file | grep "Centre of mass" | wc -l) NTIME=$(cat $file | grep "^Time = " | wc -l) NOUTER=$((NCOM / NTIME)) echo "nOuterCorrector = $NCOM / $NTIME = $NOUTER" # Load the data on separate files grep -e "^Time = " $file | cut -d " " -f 3 > logs/times grep "Centre of mass" $file | cut -d ":" -f 2 | tr -d "()" > logs/cM grep "Linear velocity" $file | cut -d ":" -f 2 | tr -d "()" > logs/lV grep "Angular velocity" $file | cut -d ":" -f 2 | tr -d "()" > logs/aV grep "Orientation" $file | cut -d ":" -f 2 | tr -d "()" > logs/orientation # Split the files with data repeated each outer corrector for ((i = 1 ; i <= $NOUTER ; i++)); do cat logs/cM | awk "(NR-$i) % $NOUTER == 0" > logs/cM.$i cat logs/lV | awk "(NR-$i) % $NOUTER == 0" > logs/lV.$i cat logs/aV | awk "(NR-$i) % $NOUTER == 0" > logs/aV.$i cat logs/orientation | awk "(NR-$i) % $NOUTER == 0" > logs/orientation.$i done paste logs/times logs/cM.* > logs/t_vs_CoM paste logs/times logs/lV.* > logs/t_vs_linearV paste logs/times logs/aV.* > logs/t_vs_angularV paste logs/times logs/orientation.* > logs/t_vs_orientation rm logs/times logs/cM* logs/lV* logs/orientation* logs/aV* ``` -------------------------------- ### Configure MoorDyn mooring restraints Source: https://hfchen20.gitlab.io/foamMooring/six-dof-mooring Configuration blocks for MoorDyn v1 and v2 restraint types. ```OpenFOAM // MoorDyn v1 moorDynR1 { sixDoFRigidBodyMotionRestraint moorDynR1; } // MoorDyn v2 moorDynR2_pt { sixDoFRigidBodyMotionRestraint moorDynR2; inputFile "Mooring/lines_v2_point.txt"; couplingMode "POINT"; refAttachmentPt ( (-0.25 0.3725 -0.16) (-0.25 -0.3725 -0.16) ( 0.25 0.3725 -0.16) ( 0.25 -0.3725 -0.16) ); writeMooringVTK true; vtkPrefix "mdv2_pt"; vtkStartTime 0; outerCorrector 3; } moorDynR2_bd { sixDoFRigidBodyMotionRestraint moorDynR2; inputFile "Mooring/lines_v2_body.txt"; couplingMode "BODY"; writeMooringVTK true; vtkPrefix "mdv2_body"; vtkStartTime 0; outerCorrector 3; } ``` -------------------------------- ### Configure MAP++ mooring restraint Source: https://hfchen20.gitlab.io/foamMooring/six-dof-mooring Configuration block for the map3R restraint type. ```OpenFOAM map3R { sixDoFRigidBodyMotionRestraint map3R; inputFile "Mooring/esflOWC_4lines.map"; summaryFile "Mooring/esflOWC_summary.map"; waterDepth 0.5; refAttachmentPt ( (-0.1 0.1 -0.077) (-0.1 -0.1 -0.077) ( 0.1 0.1 -0.077) ( 0.1 -0.1 -0.077) ); writeMooringForces true; outputFile "Mooring/mapForces.dat"; writeMooringVTK true; //nNodes 10; //nodesPerLine (10 10 10 10); } ``` -------------------------------- ### Configure waves2Foam mooring restraint Source: https://hfchen20.gitlab.io/foamMooring/six-dof-mooring Configuration block for the waves2FoamMooring restraint type. ```OpenFOAM catenaryLine { sixDoFRigidBodyMotionRestraint waves2FoamMooring; anchor ( (-0.889 0.3725 -0.6) (-0.889 -0.3725 -0.6) ( 0.889 0.3725 -0.6) ( 0.889 -0.3725 -0.6) ); refAttachmentPt ( (-0.25 0.3725 -0.16) (-0.25 -0.3725 -0.16) ( 0.25 0.3725 -0.16) ( 0.25 -0.3725 -0.16) ); identicalProperties true; // default true; if false, specify a list // for mass, e.g. (0.149 0.149 0.149 0.149) // and line length, e.g. (0.809 0.809 0.809 0.809) massPerLength 0.149; // Wet mass/unit length lineLength 0.809; // Length of the mooring line gravityVector (0 0 -9.81); // Gravity vector writeForce true; // optional, default false writeVTK true; // optional, default false //nNodes 10; // optional, default 10 //nodesPerLine (8 6 7 9); // optional, if absent, all lines having the same // (nNodes); if present, overwrite nNodes //vtkPrefix "wfoamMoor"; // optional, default restraint name //vtkStartTime 0; // optional, default 0 //outerCorrector 3; // optional, default 3 } ``` -------------------------------- ### Configure Moody mooring restraint Source: https://hfchen20.gitlab.io/foamMooring/six-dof-mooring Configuration block for the moodyR restraint type. ```OpenFOAM moodyR { sixDoFRigidBodyMotionRestraint moodyR; inputFile "Mooring/boxWu_exPoint.m"; couplingMode "externalPoint"; // "externalRigidBody" nCouplingDof 6; refAttachmentPt ( (-0.1 0.1 -0.077) (-0.1 -0.1 -0.077) ( 0.1 0.1 -0.077) ( 0.1 -0.1 -0.077) ); waveKinematics false; twoD true; } ``` -------------------------------- ### Define linearSpringGroup mooring restraint Source: https://hfchen20.gitlab.io/foamMooring/rgb-mooring Configuration for the linearSpringGroup mooring model. ```OpenFOAM linearSpringGroup { type linearSpringGroup; body box; anchor ( (-5.8646 5.9 0.0779) (-5.8646 -5.9 0.0779) ( 5.9354 5.9 0.0779) ( 5.9354 -5.9 0.0779) ); refAttachmentPt ( (-0.435 0.435 0) (-0.435 -0.435 0) ( 0.435 0.435 0) ( 0.435 -0.435 0) ); numberOfSprings 4; // if true, specify a scalar for stiffness, damping, restLength // otherwise, specify a scalarList for each spring (x, x, x, x) identicalSprings true; stiffness 28; damping 0; restLength 7.014391404; writeForce true; writeVTK true; compression false; // false = no spring force when compressed frelax 0.8; } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.