Skip to content

Commit 3bc2450

Browse files
authored
fix(statics): refine a graded mesh element by element to the bending length (#125)
Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
1 parent ae59f10 commit 3bc2450

5 files changed

Lines changed: 307 additions & 13 deletions

File tree

‎CMakeLists.txt‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1788,6 +1788,21 @@ if(Python3_Interpreter_FOUND)
17881788
TIMEOUT 900
17891789
ENVIRONMENT "${_cabledyn_python_test_environment}")
17901790

1791+
# A lazy wave on a strongly graded deck mesh (4 m and 10 m elements beside a refined buoyant
1792+
# section) in oblique and cross currents: the route is repeated on the mesh refined element by
1793+
# element to the bending length, and agrees with the deck on 2 m elements. PROCESSORS reserves
1794+
# the four driver processes the test runs at once.
1795+
add_test(NAME graded_mesh_statics
1796+
COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_graded_mesh_statics.py
1797+
--exe $<TARGET_FILE:cabledyn>
1798+
--data ${CMAKE_CURRENT_SOURCE_DIR}/tests/data
1799+
--output ${CMAKE_BINARY_DIR}/graded_mesh_statics)
1800+
set_tests_properties(graded_mesh_statics PROPERTIES
1801+
LABELS "python;hermite;static;robustness;attachments"
1802+
PROCESSORS 4
1803+
TIMEOUT 1500
1804+
ENVIRONMENT "${_cabledyn_python_test_environment}")
1805+
17911806
# Finite-EI generalised-alpha blends: force-blend dtM convergence under prescribed surge.
17921807
add_test(NAME hermite_force_blend_dt
17931808
COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_hermite_force_blend_dt.py

‎doc/theory.rst‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1860,7 +1860,13 @@ mesh-sequenced route described below first and this route as its fallback):
18601860
whose continuation or polish fails, or whose folded element the local refinement does not
18611861
resolve, repeats the route on a mesh refined until the elements are at most
18621862
half the bending length (when the continuation on that mesh runs out of its iteration
1863-
budget, on the coarser powers of two down to twice the deck mesh); a rotationally
1863+
budget, on the coarser powers of two down to twice the deck mesh) and, when that fails too,
1864+
on the deck mesh with each element split only into the power of two (at most 16) that brings
1865+
it to half the bending length. A uniform refinement keeps a graded deck's ratios and refines
1866+
its short elements with the long ones: a lazy wave meshed 4 m at its sag bend, 0.9 m over its
1867+
buoyant section and 10 m at its touchdown failed in an oblique current on the deck mesh and on
1868+
the 8x refined one, and solves on the mesh refined element by element (within 1.2e-3 of its
1869+
fairlead tension of the same deck on 2 m elements); a rotationally
18641870
restrained end whose boundary layer :math:`\sqrt{EI/T}` is shorter than its element, which
18651871
shows as a polish that does not converge or a compression at that end, repeats it on a mesh
18661872
graded geometrically toward that end. The refined mesh is reported.

‎doc/troubleshooting.rst‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,8 @@ Warnings and notes that do not stop a run
857857
elements; or the continuation or polish failed on a deck mesh with elements longer than
858858
half the bending length :math:`(EI/|w|)^{1/3}`, and the route was repeated on the whole
859859
line refined uniformly by a power of two, up to the factor at which every element meets
860-
that length (or, at a rotationally
860+
that length, and then on the deck mesh with only its long elements split to that length
861+
(or, at a rotationally
861862
restrained end, on end elements halved toward the end down to its boundary layer). See
862863
:doc:`theory`, Static equilibrium. The run uses the refined mesh, statics and dynamics
863864
alike, and its profile and per-line outputs have that many segments; the refinement

‎src/CableDyn_DeckDriver.f90‎

Lines changed: 146 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1913,6 +1913,8 @@ RECURSIVE SUBROUTINE build_one_hermite_cable(ln, sections, types, points, opts,
19131913
LOGICAL :: tensile_error
19141914
CHARACTER(1024) :: note_text
19151915
CHARACTER(1024) :: limit_text
1916+
! the still-water diagnosis read its compression on elements longer than half the bending length
1917+
LOGICAL :: coarse_sw
19161918
! The geometric cause of a line with no admissible planar equilibrium clear of the seabed:
19171919
! too long to hang as a catenary (net-heavy), or weightless (no catenary exists at all).
19181920
LOGICAL :: weightless_line
@@ -3115,8 +3117,13 @@ RECURSIVE SUBROUTINE build_one_hermite_cable(ln, sections, types, points, opts,
31153117
! route diagnostics below are bounded and would cut it. A line already compressed
31163118
! without the current is named before that: the current starts from that layout.
31173119
limit_text = ''
3118-
IF (opts%has_current) CALL still_water_compression(limit_text)
3119-
IF (LEN_TRIM(limit_text) > 0) THEN
3120+
IF (opts%has_current) CALL still_water_compression(limit_text, coarse_sw)
3121+
IF (LEN_TRIM(limit_text) > 0 .AND. coarse_sw) THEN
3122+
CALL fail_solve(ErrStat, ErrMsg, 'finite-EI cable static solve failed in the current: '// &
3123+
TRIM(limit_text)//'. Catenary-continuation route: '// &
3124+
TRIM(short_message(primary_msg, 360))//'. Mesh-sequenced route: '// &
3125+
TRIM(short_message(sequence_msg, 360))); RETURN
3126+
ELSE IF (LEN_TRIM(limit_text) > 0) THEN
31203127
CALL fail_solve(ErrStat, ErrMsg, 'finite-EI cable has no static equilibrium in the current: '// &
31213128
TRIM(limit_text)//'. Catenary-continuation route: '// &
31223129
TRIM(short_message(primary_msg, 360))//'. Mesh-sequenced route: '// &
@@ -4234,18 +4241,25 @@ SUBROUTINE audit_refined_state(done, why)
42344241
END IF
42354242
END SUBROUTINE audit_refined_state
42364243

4237-
SUBROUTINE still_water_compression(text)
4244+
SUBROUTINE still_water_compression(text, coarse)
42384245
!! On a failed solve in a current: whether the same line without the current is
42394246
!! already in axial compression (an element-mean force below -1e-3 of the peak
42404247
!! tension, held only by the bending stiffness). Returns the diagnosis, or blank.
4248+
!! coarse: the still-water state is on elements longer than half the bending length
4249+
!! (EI/|w|)^(1/3), where the element-mean axial force of a stiff line oscillates and can
4250+
!! read a compression the line does not carry; the diagnosis then says so instead of
4251+
!! naming the layout (a lazy wave on 4 m and 10 m elements beside 0.9 m ones read
4252+
!! -2.8 kN where it carries about +1 kN, and solves on a mesh that resolves its bends).
42414253
CHARACTER(*), INTENT(OUT) :: text
4254+
LOGICAL, INTENT(OUT) :: coarse
42424255
TYPE(DeckOptions) :: opts_sw
42434256
TYPE(CD_HFMF_ModuleType) :: sw_cable
42444257
INTEGER :: sw_node, esw, e_min, wios
4245-
REAL(wp) :: t_min, t_max, s_min
4258+
REAL(wp) :: t_min, t_max, s_min, need
42464259
CHARACTER(1024) :: emw
42474260
CHARACTER(2048) :: sw_note
42484261
text = ''
4262+
coarse = .FALSE.
42494263
opts_sw = opts
42504264
opts_sw%has_current = .FALSE.
42514265
opts_sw%has_current_profile = .FALSE.
@@ -4265,10 +4279,21 @@ SUBROUTINE still_water_compression(text)
42654279
CALL CD_HermiteCable_Mean_Axial_Extremes(sw_cable%line%l0, sw_cable%line%EA, sw_cable%line%q, t_min, &
42664280
t_max, e_min, s_min, esw, emw)
42674281
IF (esw == CD_HCSTAT_OK .AND. t_min < -1.0e-3_wp*t_max) THEN
4268-
WRITE (text, '(A,ES10.3,A,F10.2,A,ES10.3,A)', IOSTAT=wios) 'the line is already in axial '// &
4269-
'compression without the current (element mean ', t_min, ' N at unstretched arc length ', &
4270-
s_min, ' m from the anchor, peak tension ', t_max, ' N), a layout that only its bending '// &
4271-
'stiffness holds; the current pushes that layout further and no equilibrium follows it'
4282+
need = bending_refine_need(sw_cable%line%l0, sw_cable%line%EI, sw_cable%line%w)
4283+
coarse = need > CD_ONE
4284+
IF (coarse) THEN
4285+
WRITE (text, '(A,ES10.3,A,F10.2,A,ES10.3,A,F6.2,A)', IOSTAT=wios) 'without the current the line '// &
4286+
'reads an element-mean axial compression (', t_min, ' N at unstretched arc length ', s_min, &
4287+
' m from the anchor, peak tension ', t_max, ' N) on elements up to ', need, ' times half the '// &
4288+
'bending length (EI/|w|)^(1/3), where the element-mean axial force of a stiff line oscillates '// &
4289+
'and can read a compression the line does not carry; refine those elements (NumSegs) to half '// &
4290+
'the bending length or less'
4291+
ELSE
4292+
WRITE (text, '(A,ES10.3,A,F10.2,A,ES10.3,A)', IOSTAT=wios) 'the line is already in axial '// &
4293+
'compression without the current (element mean ', t_min, ' N at unstretched arc length ', &
4294+
s_min, ' m from the anchor, peak tension ', t_max, ' N), a layout that only its bending '// &
4295+
'stiffness holds; the current pushes that layout further and no equilibrium follows it'
4296+
END IF
42724297
END IF
42734298
END IF
42744299
CALL CD_HFMF_End(sw_cable)
@@ -7043,9 +7068,119 @@ RECURSIVE SUBROUTINE graded_restart()
70437068
END SUBROUTINE graded_restart
70447069

70457070
RECURSIVE SUBROUTINE refined_restart()
7046-
!! Repeat the route on a uniformly refined mesh (power of two, capped) when the
7047-
!! deck mesh is longer than half the bending length (EI/|w|)^(1/3) somewhere. The
7071+
!! Repeat the route on a refined mesh when the deck mesh is longer than half the bending
7072+
!! length (EI/|w|)^(1/3) somewhere: uniformly refined (uniform_restart), then, when that
7073+
!! fails, with each element split only as far as the rule asks of it (rule_restart). The
70487074
!! refined equilibrium is returned in the *_am outputs like an adaptive refinement.
7075+
CALL uniform_restart()
7076+
IF (ErrStat /= CD_HCSTAT_OK .AND. .NOT. inadmissible) CALL rule_restart()
7077+
END SUBROUTINE refined_restart
7078+
7079+
RECURSIVE SUBROUTINE rule_restart()
7080+
!! Repeat the route on the deck mesh with every element split into the power of two
7081+
!! (capped) that brings it to half its bending length (EI/|w|)^(1/3), the elements that
7082+
!! meet the rule kept. A uniform refinement by the largest factor keeps the deck's grading
7083+
!! and refines the short elements beside the long ones as well: on a lazy wave meshed
7084+
!! 4 m / 0.9 m / 10 m (the buoyant section refined, the sag bend and the touchdown
7085+
!! coarse) the long elements' axial force oscillated into compression beside the short
7086+
!! ones, the 8x refined mesh stalled at the start of its stiffness continuation, and the
7087+
!! deck failed in an oblique current although the same layout solves on 2 m elements.
7088+
!! Not run when the rule asks the same factor of every element (the uniform refinement
7089+
!! was that mesh) or more than REFINED_MAX_ELEMENTS elements.
7090+
INTEGER, PARAMETER :: REFINED_MAX_ELEMENTS = 4096
7091+
REAL(wp), ALLOCATABLE :: l0_g(:), ea_g(:), ei_g(:), w_g(:), diam_g(:), dry_g(:)
7092+
INTEGER, ALLOCATABLE :: fixed_g(:), parent_g(:), node_of(:), split(:)
7093+
LOGICAL, ALLOCATABLE :: fixed_map(:, :)
7094+
LOGICAL :: planar, inadm_g, walked_sub
7095+
INTEGER :: k, j, n_g, nf, es_g, slot, piece
7096+
REAL(wp) :: need
7097+
CHARACTER(1024) :: em_g
7098+
IF (PRESENT(refined_pass) .OR. fold) RETURN
7099+
ALLOCATE (split(ne))
7100+
split = 1
7101+
DO k = 1, ne
7102+
IF (.NOT. (ei(k) > CD_ZERO .AND. ABS(w(k)) > CD_ZERO)) CYCLE
7103+
need = l0(k)/(0.5_wp*(ei(k)/ABS(w(k)))**(CD_ONE/3.0_wp))
7104+
DO WHILE (REAL(split(k), wp) < need .AND. split(k) < CD_HC_REFINE_CAP)
7105+
split(k) = 2*split(k)
7106+
END DO
7107+
END DO
7108+
IF (ALL(split == 1)) RETURN
7109+
IF (ALL(split == MAXVAL(split))) RETURN
7110+
n_g = SUM(split)
7111+
IF (n_g > REFINED_MAX_ELEMENTS) RETURN
7112+
ALLOCATE (l0_g(n_g), parent_g(n_g), node_of(nnode))
7113+
j = 0
7114+
node_of(1) = 1
7115+
DO k = 1, ne
7116+
DO piece = 1, split(k)
7117+
j = j + 1
7118+
l0_g(j) = l0(k)/REAL(split(k), wp)
7119+
parent_g(j) = k
7120+
END DO
7121+
node_of(k + 1) = j + 1
7122+
END DO
7123+
ALLOCATE (ea_g(n_g), ei_g(n_g), w_g(n_g), diam_g(n_g), dry_g(n_g))
7124+
ea_g = ea(parent_g); ei_g = ei(parent_g); w_g = w(parent_g)
7125+
diam_g = diam(parent_g); dry_g = dry_b(parent_g)
7126+
! Held DOFs: the deck nodes keep theirs; inserted nodes take the out-of-plane reduction
7127+
! (y, m_y) when the deck holds it on every node (as graded_restart).
7128+
ALLOCATE (fixed_map(6, nnode))
7129+
fixed_map = .FALSE.
7130+
DO k = 1, SIZE(fixed_dofs)
7131+
fixed_map(MOD(fixed_dofs(k) - 1, 6) + 1, (fixed_dofs(k) - 1)/6 + 1) = .TRUE.
7132+
END DO
7133+
planar = ALL(fixed_map(2, :))
7134+
ALLOCATE (fixed_g(6*(n_g + 1)))
7135+
nf = 0
7136+
k = 1
7137+
DO j = 1, n_g + 1
7138+
IF (k <= nnode) THEN
7139+
IF (node_of(k) == j) THEN
7140+
DO slot = 1, 6
7141+
IF (fixed_map(slot, k)) THEN
7142+
nf = nf + 1; fixed_g(nf) = 6*(j - 1) + slot
7143+
END IF
7144+
END DO
7145+
k = k + 1
7146+
CYCLE
7147+
END IF
7148+
END IF
7149+
IF (planar) THEN
7150+
nf = nf + 1; fixed_g(nf) = 6*(j - 1) + 2
7151+
nf = nf + 1; fixed_g(nf) = 6*(j - 1) + 5
7152+
END IF
7153+
END DO
7154+
IF (PRESENT(bathymetry)) THEN
7155+
CALL hermite_static_primary(anchor, fairlead, l0_g, ea_g, ei_g, w_g, diam_g, dry_g, fixed_g(1:nf), &
7156+
contact_enabled, contact_z, frame_cs, endconn_k, endconn_d0, endconn_mode, &
7157+
opts, static_tol, l0_am, ea_am, ei_am, w_am, q_static, curv, fixed_am, &
7158+
applied_scale, diag, res, iters, es_g, em_g, inadm_g, tolerance_note, &
7159+
kink_refined, bathymetry=bathymetry, refined_pass=.TRUE., cur_obj=cur_obj, &
7160+
walked=walked_sub, fold_walk=fold)
7161+
ELSE
7162+
CALL hermite_static_primary(anchor, fairlead, l0_g, ea_g, ei_g, w_g, diam_g, dry_g, fixed_g(1:nf), &
7163+
contact_enabled, contact_z, frame_cs, endconn_k, endconn_d0, endconn_mode, &
7164+
opts, static_tol, l0_am, ea_am, ei_am, w_am, q_static, curv, fixed_am, &
7165+
applied_scale, diag, res, iters, es_g, em_g, inadm_g, tolerance_note, &
7166+
kink_refined, refined_pass=.TRUE., cur_obj=cur_obj, walked=walked_sub, &
7167+
fold_walk=fold)
7168+
END IF
7169+
IF (es_g == CD_HCSTAT_OK) THEN
7170+
ErrStat = CD_HCSTAT_OK
7171+
ErrMsg = ''
7172+
kink_refined = .TRUE.
7173+
inadmissible = .FALSE.
7174+
IF (PRESENT(walked)) walked = walked_sub
7175+
ELSE
7176+
ErrMsg = TRIM(ErrMsg)//'; on the mesh refined element by element to the bending length: '//TRIM(em_g)
7177+
IF (inadm_g) inadmissible = .TRUE.
7178+
END IF
7179+
END SUBROUTINE rule_restart
7180+
7181+
RECURSIVE SUBROUTINE uniform_restart()
7182+
!! The route on a uniformly refined mesh (power of two, capped) when the deck mesh is
7183+
!! longer than half the bending length somewhere (refined_restart).
70497184
REAL(wp), ALLOCATABLE :: l0_r(:), q_r(:), q_ref_r(:), ea_r(:), ei_r(:), w_r(:), diam_r(:), dry_r(:)
70507185
INTEGER, ALLOCATABLE :: fixed_r(:)
70517186
INTEGER :: scale, scale_need, k, es_r, parent
@@ -7111,7 +7246,7 @@ RECURSIVE SUBROUTINE refined_restart()
71117246
IF (INDEX(em_r, 'iteration budget') == 0) RETURN
71127247
scale = scale/2
71137248
END DO
7114-
END SUBROUTINE refined_restart
7249+
END SUBROUTINE uniform_restart
71157250

71167251
SUBROUTINE polish_with_floor()
71177252
!! Polish at the tight tolerance; accept the coupled static tolerance when the

0 commit comments

Comments
 (0)