You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/Rod.cpp
+12-23Lines changed: 12 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -917,29 +917,17 @@ Rod::doRHS()
917
917
918
918
// just use the wave elevation computed at the location of the top node for
919
919
// now
920
-
vec r_top, r_bottom;
921
-
real zeta_i;
922
-
if (r[N][2] > r[0][2]) {
923
-
r_top = r[N];
924
-
r_bottom = r[0];
925
-
zeta_i = zeta[N];
926
-
} else {
927
-
r_top = r[0];
928
-
r_bottom = r[N];
929
-
zeta_i = zeta[0];
930
-
}
931
-
932
-
if ((r_bottom[2] < zeta_i) && (r_top[2] > zeta_i)) {
933
-
// the water plane is crossing the rod
934
-
// (should also add some limits to avoid near-horizontals at some point)
935
-
h0 = (zeta_i - r_bottom[2]) / fabs(q[2]);
936
-
} elseif (r[0][2] < zeta_i) {
937
-
// fully submerged case
938
-
h0 = UnstrLen;
939
-
} else {
940
-
// fully unsubmerged case (ever applicable?)
941
-
h0 = 0.0;
942
-
}
920
+
real zeta_i = zeta[N];
921
+
922
+
// get approximate location of waterline crossing along Rod axis (note: negative h0 indicates end A is above end B, and measures -distance from end A to waterline crossing)
923
+
if ((r[0][2] < zeta_i) && (r[N][2] < zeta_i)) // fully submerged case
924
+
h0 = UnstrLen;
925
+
elseif ((r[0][2] < zeta_i) && (r[N][2] > zeta_i)) // check if it's crossing the water plane (should also add some limits to avoid near-horizontals at some point)
926
+
h0 = (zeta_i - r[0][2])/q[2]; // distance along rod centerline from end A to the waterplane
927
+
elseif ((r[N][2] < zeta_i) && (r[0][2] > zeta_i)) // check if it's crossing the water plane but upside down
928
+
h0 = -(zeta_i - r[0][2])/q[2]; // negative distance along rod centerline from end A to the waterplane
929
+
else
930
+
h0 = 0.0; // fully unsubmerged case (ever applicable?)
0 commit comments