From b2e638594c9bda65308f0b90e471428a86497022 Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Sun, 8 Nov 2026 09:28:46 +0900 Subject: [PATCH] fix(waves): a MoorDyn-C mean level is added to the elevation alone A non-zero omega = 0 row of wave_frequencies.txt (WaveKin 7), or the mean of wave_elevation.txt (WaveKin 3), is now added to the elevation alone, as MoorDyn-C does: the wave numbers stay those of WtrDpth, and the Wheeler stretching maps the water under the total elevation. CableDyn took the wave numbers at WtrDpth plus the level and measured z from it. The mean of a WaterKin WaveKinMod 1 record still raises the still-water level; the docs now say that MoorDyn-F drops it. CD_Component_Wave_Kinematics takes an optional eta_offset, a steady level in the surface the stretching maps. A new wavekin_modes case runs both files with a 0.8 m level against MoorDyn-C v2.7.2, with six WaveKin 7 components in six directions. WaveKin 7 matches to 1e-8 of its scale, where the previous rule was 7.7e-3 m off in elevation and 1e-2 in velocity. WaveKin 3 matches to the existing grid tolerances, where it was 6e-3 off in velocity. Signed-off-by: Jae Hoon Seo --- CHANGELOG.md | 11 + CMakeLists.txt | 6 + doc/driver_format.md | 16 +- doc/theory.rst | 7 + src/CableDyn_DeckDriver.f90 | 37 +- src/CableDyn_Hydro.f90 | 32 +- tests/data/wavekin_mdc_mean/mdc_wavekin3.csv | 13 + tests/data/wavekin_mdc_mean/mdc_wavekin7.csv | 41 ++ tests/data/wavekin_mdc_mean/points3.txt | 12 + tests/data/wavekin_mdc_mean/points7.txt | 40 ++ tests/data/wavekin_mdc_mean/water_grid.txt | 9 + .../data/wavekin_mdc_mean/wave_elevation.txt | 401 ++++++++++++++++++ .../wavekin_mdc_mean/wave_frequencies.txt | 7 + tests/data/wavekin_mdc_mean/wavekin3.dat | 27 ++ tests/data/wavekin_mdc_mean/wavekin7.dat | 27 ++ tests/test_wavekin_modes.f90 | 11 + .../scripts/wavekin_moordyn_c_reference.py | 35 +- 17 files changed, 694 insertions(+), 38 deletions(-) create mode 100644 tests/data/wavekin_mdc_mean/mdc_wavekin3.csv create mode 100644 tests/data/wavekin_mdc_mean/mdc_wavekin7.csv create mode 100644 tests/data/wavekin_mdc_mean/points3.txt create mode 100644 tests/data/wavekin_mdc_mean/points7.txt create mode 100644 tests/data/wavekin_mdc_mean/water_grid.txt create mode 100644 tests/data/wavekin_mdc_mean/wave_elevation.txt create mode 100644 tests/data/wavekin_mdc_mean/wave_frequencies.txt create mode 100644 tests/data/wavekin_mdc_mean/wavekin3.dat create mode 100644 tests/data/wavekin_mdc_mean/wavekin7.dat diff --git a/CHANGELOG.md b/CHANGELOG.md index e738725f..b9789bdd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -96,6 +96,13 @@ All notable changes to CableDyn are recorded in this file. The format follows - Every initialisation note of a coupled line reaches the console; long lists were cut or dropped. - The OpenFAST module driver runs a rotating motion in a single-precision build. - A range-graph file that cannot be written completely is removed instead of left behind. +- A mean level in a MoorDyn-C kinematics file, a non-zero `omega = 0` row of `WaveKin 7` or the + mean of a `WaveKin 3` record, is added to the elevation alone, as MoorDyn-C does: the wave + numbers stay those of `WtrDpth` and the stretching maps the water under the total elevation. + CableDyn took the wave numbers at `WtrDpth` plus the level. With a 0.8 m level in 50 m of water + and six components in six directions, `WaveKin 7` now matches MoorDyn-C v2.7.2 to 1e-8 instead + of 7.7e-3 m in elevation and 1 % in velocity. The mean of a WaterKin `WaveKinMod 1` record still + raises the still-water level; MoorDyn-F drops it. - The C API messages of `CableDyn_UpdatePointFluidFields` and `CableDyn_CalcOutputDerivatives` on the coupled aggregate name its real scope: decks with finite-EI lines, bodies or rods. @@ -121,6 +128,10 @@ All notable changes to CableDyn are recorded in this file. The format follows `EI × Curv` only to within the strain. Tension, positions and forces are unchanged, and so are `OutputRecovery element` values on elements without a stiffener sleeve. - Azimuth values of the `EI = 0` lines named above read 360 degrees lower on those routes. +- On a `WaveKin 3` or `WaveKin 7` deck whose mean level is not zero, the elevation away from the + origin, the fluid velocity and acceleration, and so the loads and every output, change by the + order of the level over the depth: up to 1 % in velocity at 0.8 m in 50 m. A deck with no mean + level is unchanged bit for bit. - OpenFAST checkpoints change format: they carry the range graphs and the input of the last commit, so a checkpoint written by an earlier CableDyn cannot be restarted with this one. diff --git a/CMakeLists.txt b/CMakeLists.txt index 269911c2..cd0d95d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2321,6 +2321,12 @@ file(GLOB CD_WAVEKIN_MDC_FILES RELATIVE ${CMAKE_SOURCE_DIR}/tests/data/wavekin_m foreach(f IN LISTS CD_WAVEKIN_MDC_FILES) configure_file(tests/data/wavekin_mdc/${f} ${CMAKE_BINARY_DIR}/wavekin_mdc/${f} COPYONLY) endforeach() +# the same with a mean level (an omega = 0 row, a raised record), against MoorDyn-C v2.7.2 +file(GLOB CD_WAVEKIN_MDC_MEAN_FILES RELATIVE ${CMAKE_SOURCE_DIR}/tests/data/wavekin_mdc_mean + ${CMAKE_SOURCE_DIR}/tests/data/wavekin_mdc_mean/*) +foreach(f IN LISTS CD_WAVEKIN_MDC_MEAN_FILES) + configure_file(tests/data/wavekin_mdc_mean/${f} ${CMAKE_BINARY_DIR}/wavekin_mdc_mean/${f} COPYONLY) +endforeach() add_executable(test_wavekin_modes tests/test_wavekin_modes.f90) target_link_libraries(test_wavekin_modes PRIVATE cabledyn_core) add_test(NAME wavekin_modes COMMAND test_wavekin_modes WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) diff --git a/doc/driver_format.md b/doc/driver_format.md index 0512bdda..84d808ed 100644 --- a/doc/driver_format.md +++ b/doc/driver_format.md @@ -1385,10 +1385,13 @@ time-varying and of a sheared current to MoorDyn-C's within 0.9 % on a 70 m rope ([options](options.rst)) are an extension of CableDyn and no part of MoorDyn-C or MoorDyn-F: a deck with them is not a plain MoorDyn deck, and a MoorDyn solver would not place the phases there. -A non-zero `omega = 0` row raises the still-water level. CableDyn then takes every wave number at -the depth `WtrDpth` plus that level, as it does for the mean of an elevation record, where -MoorDyn-C keeps `WtrDpth` and adds the level to the elevation alone. The two differ by the order -of the level over the depth in the long components. +A mean level, a non-zero `omega = 0` row or the mean of `wave_elevation.txt`, is added to the +elevation alone, as MoorDyn-C does: every wave number stays that of `WtrDpth`, and the Wheeler +stretching maps the water column under the total elevation, the level included. The +`wavekin_modes` test holds both files with a 0.8 m level, under six `WaveKin 7` components in +six directions, to MoorDyn-C v2.7.2: `WaveKin 7` to `1e-8` of its scale and `WaveKin 3` to the +tolerances above. The mean of a WaterKin `WaveKinMod 1` record raises the still-water level +instead ([below](#moordyn-f-waterkin-file-modes)). (waterkin-file-modes)= ### MoorDyn-F `WaterKin` file modes @@ -1406,6 +1409,11 @@ A MoorDyn-F deck may select a WaterKin file (grammar in [Auxiliary file formats] | `CurrentMod = 1` | N-level WaterKin depth table, interpolated at structural nodes | | `CurrentMod = 2` | current from the coupled host SeaState field | +The mean of a `WaveKinMod 1` record raises the still-water level: its wave numbers are those of +`WtrDpth` plus the mean, and the stretching maps the water column under the raised level. +MoorDyn-F instead drops the record's mean, and its Nyquist bin, so a record whose mean is not zero +puts the surface of the two codes apart by that mean. + **`WaveKinMod 1`** is standalone-only. It needs a `WaveKinFile` of at least four finite `time elevation` rows starting at `t = 0` with strictly increasing times, a positive `dtWave`, a positive `TMax`, and the ordinary `waves` requirements (`dtM`/`TMax` and `WtrDpth`). It cannot be diff --git a/doc/theory.rst b/doc/theory.rst index 05f5d2f5..7b45a636 100644 --- a/doc/theory.rst +++ b/doc/theory.rst @@ -1185,6 +1185,13 @@ has one direction :math:`\beta_i = \beta`. The rows of a ``WaveKin 7`` table may their own: a short-crested sea, whose elevation and kinematics are the sums of those of its directions, stretched by the one total elevation. +The mean :math:`\bar\eta` of an elevation history, or the ``omega = 0`` row of a ``WaveKin 7`` +table, is a steady level. A WaterKin history raises the still-water level by it: the wave numbers +are those of the depth :math:`h + \bar\eta`, and the stretching maps the water column under the +raised level. A MoorDyn-C file (``WaveKin 3`` or ``7``) adds it to the elevation alone, as +MoorDyn-C does: the wave numbers stay those of :math:`h`, and the stretching maps +:math:`[-h,\ \bar\eta + \eta]` onto :math:`[-h,\ 0]`. + Every point sums every component of the elevation. The sums run in interleaved partial sums added up in a fixed order, so a result does not depend on the vector width or the thread count, and each point is a function of its position and time alone: nothing carries from one diff --git a/src/CableDyn_DeckDriver.f90 b/src/CableDyn_DeckDriver.f90 index e01287c0..bb3317d5 100644 --- a/src/CableDyn_DeckDriver.f90 +++ b/src/CableDyn_DeckDriver.f90 @@ -675,7 +675,8 @@ MODULE CableDyn_DeckDriver ! irregular seas; wave_eta_mean carries the zero-frequency waterline offset. REAL(wp), ALLOCATABLE :: wave_component_omega(:), wave_component_k(:) REAL(wp), ALLOCATABLE :: wave_component_amplitude(:), wave_component_phase(:) - ! exp(-2 k (wtrdpth + wave_eta_mean)) and the tail_sums of the table (CD_Component_Wave_Kinematics) + ! exp(-2 k d) at the depth d of the wave numbers (wtrdpth, plus wave_eta_mean for a WaterKin + ! record: component_level_shift) and the tail_sums of the table (CD_Component_Wave_Kinematics) REAL(wp), ALLOCATABLE :: wave_component_e2kd(:), wave_component_tail(:, :) ! a short-crested table (WaveKin 7 rows of different directions): each component's direction ! cosine and sine, in ascending frequency; unallocated when all share wave_direction @@ -14305,6 +14306,8 @@ SUBROUTINE read_moordyn_c_kinematics(dir, opts, ErrStat, ErrMsg) !! is the mean-level offset and its beta has no effect. Rows that share one direction are !! a long-crested table in file order; rows that differ a short-crested table in ascending !! frequency, the order the tail bound of the sums needs. + !! The mean level of either file is added to the elevation alone, which the stretching then + !! maps, and the wave numbers stay those of WtrDpth, as in MoorDyn-C (component_level_shift). !! - Currents 1, current_profile.txt (`z ux uy uz` rows after its header rows): the steady !! profile, linear in z and held beyond its ends, as MoorDyn-C's current grid. !! - Currents 2, current_profile_dynamic.txt (constructDynamicCurrentGrid of MoorDyn-C's @@ -32751,7 +32754,7 @@ SUBROUTINE deck_wave_kinematics(opts, x, y, z, time, eta, velocity, acceleration INTEGER, INTENT(OUT) :: ErrStat CHARACTER(*), INTENT(OUT) :: ErrMsg REAL(wp), INTENT(OUT), OPTIONAL :: pdyn - REAL(wp) :: ramp, ramp_rate + REAL(wp) :: ramp, ramp_rate, shift IF (opts%has_wave .AND. .NOT. opts%wave_cache_ready) THEN CALL fail(ErrStat, ErrMsg, 'deck wave kinematics called before wave precompute') @@ -32787,26 +32790,29 @@ SUBROUTINE deck_wave_kinematics(opts, x, y, z, time, eta, velocity, acceleration CALL CD_Stream_Kinematics(opts%stream, x, y, z, time, ramp, eta, velocity, acceleration, ErrStat, ErrMsg, & pdyn) CASE (WAVE_COMPONENTS) + ! the mean of a WaterKin record raises the still-water level (shift); that of a MoorDyn-C + ! file is added to the surface alone (eta_offset), the wave numbers staying at WtrDpth + shift = component_level_shift(opts) IF (ramp < CD_ONE) THEN - CALL CD_Component_Wave_Kinematics(x - opts%wave_ref_x, y - opts%wave_ref_y, z - opts%wave_eta_mean, time, & - opts%wtrdpth + opts%wave_eta_mean, opts%wave_direction, .TRUE., & + CALL CD_Component_Wave_Kinematics(x - opts%wave_ref_x, y - opts%wave_ref_y, z - shift, time, & + opts%wtrdpth + shift, opts%wave_direction, .TRUE., & opts%wave_component_omega, opts%wave_component_k, & opts%wave_component_amplitude, opts%wave_component_phase, & eta, velocity, acceleration, ErrStat, ErrMsg, inputs_validated=.TRUE., & amplitude_scale=ramp, pdyn=pdyn, exp_m2kd=opts%wave_component_e2kd, & tail_sums=opts%wave_component_tail, comp_cos=opts%wave_component_cos, & - comp_sin=opts%wave_component_sin) + comp_sin=opts%wave_component_sin, eta_offset=opts%wave_eta_mean - shift) ELSE - CALL CD_Component_Wave_Kinematics(x - opts%wave_ref_x, y - opts%wave_ref_y, z - opts%wave_eta_mean, time, & - opts%wtrdpth + opts%wave_eta_mean, opts%wave_direction, .TRUE., & + CALL CD_Component_Wave_Kinematics(x - opts%wave_ref_x, y - opts%wave_ref_y, z - shift, time, & + opts%wtrdpth + shift, opts%wave_direction, .TRUE., & opts%wave_component_omega, opts%wave_component_k, & opts%wave_component_amplitude, opts%wave_component_phase, & eta, velocity, acceleration, ErrStat, ErrMsg, inputs_validated=.TRUE., & pdyn=pdyn, exp_m2kd=opts%wave_component_e2kd, & tail_sums=opts%wave_component_tail, comp_cos=opts%wave_component_cos, & - comp_sin=opts%wave_component_sin) + comp_sin=opts%wave_component_sin, eta_offset=opts%wave_eta_mean - shift) END IF - eta = eta + opts%wave_eta_mean + eta = eta + shift CASE DEFAULT eta = CD_ZERO velocity = CD_ZERO @@ -32818,6 +32824,15 @@ SUBROUTINE deck_wave_kinematics(opts, x, y, z, time, eta, velocity, acceleration acceleration = acceleration + (ramp_rate/ramp)*velocity END SUBROUTINE deck_wave_kinematics + PURE REAL(wp) FUNCTION component_level_shift(opts) RESULT(shift) + !! The rise of the still-water level under a component table: the mean of a WaterKin + !! WaveKinMod 1 record, so its wave numbers are those of WtrDpth plus the mean; zero for a + !! MoorDyn-C kinematics file (WaveKin 3, 7), whose mean MoorDyn-C adds to the elevation alone. + TYPE(DeckOptions), INTENT(IN) :: opts + shift = opts%wave_eta_mean + IF (opts%mdc_wave_kin > 0) shift = CD_ZERO + END FUNCTION component_level_shift + PURE SUBROUTINE deck_wave_ramp(ramp_time, time, ramp, ramp_rate) !! Half-cosine start-up ramp r(t) = (1 - cos(pi*t/T))/2 on [0, T], 1 afterwards, and !! its rate dr/dt; T <= 0 disables the ramp (r = 1). r and dr/dt are continuous, so @@ -33193,12 +33208,12 @@ SUBROUTINE precompute_deck_wave(opts, ErrStat, ErrMsg) END IF DO k = 1, SIZE(opts%wave_component_omega) CALL CD_Solve_Dispersion_Wavenumber(opts%wave_component_omega(k), & - opts%wtrdpth + opts%wave_eta_mean, opts%g, & + opts%wtrdpth + component_level_shift(opts), opts%g, & opts%wave_component_k(k), ErrStat, ErrMsg) IF (ErrStat /= CD_DECKDRV_OK) EXIT END DO IF (ErrStat == CD_DECKDRV_OK) THEN - opts%wave_component_e2kd = EXP(-2.0_wp*(opts%wave_component_k*(opts%wtrdpth + opts%wave_eta_mean))) + opts%wave_component_e2kd = EXP(-2.0_wp*(opts%wave_component_k*(opts%wtrdpth + component_level_shift(opts)))) CALL set_component_tail(opts%wave_component_omega, opts%wave_component_k, opts%wave_component_amplitude, & opts%wave_component_tail) END IF diff --git a/src/CableDyn_Hydro.f90 b/src/CableDyn_Hydro.f90 index 2a6789ad..5cde0efc 100644 --- a/src/CableDyn_Hydro.f90 +++ b/src/CableDyn_Hydro.f90 @@ -2239,7 +2239,8 @@ END SUBROUTINE CD_JONSWAP_Wave_Kinematics_Precomputed SUBROUTINE CD_Component_Wave_Kinematics(x, y, z, t, depth, direction_deg, stretch, & omega_comp, k_comp, amplitude, phase, & eta, velocity, acceleration, ErrStat, ErrMsg, inputs_validated, & - amplitude_scale, pdyn, exp_m2kd, tail_sums, comp_cos, comp_sin) + amplitude_scale, pdyn, exp_m2kd, tail_sums, comp_cos, comp_sin, & + eta_offset) !! Evaluate linear irregular-wave kinematics from a CALLER-SUPPLIED component table: !! the general (arbitrary length, explicit per-component phase) form of the fixed-size !! deterministic-phase JONSWAP evaluator above, sharing its conventions exactly -- @@ -2278,6 +2279,10 @@ SUBROUTINE CD_Component_Wave_Kinematics(x, y, z, t, depth, direction_deg, stretc !! comp_cos and comp_sin, given together, hold the cosine and sine of each component's own !! direction, in place of the one direction_deg of a long-crested table: a short-crested !! table. The bound of tail_sums holds for any direction, since it bounds the magnitude. + !! eta_offset is a steady level added to the surface elevation the stretching maps and eta + !! returns, the components' wave numbers staying those of depth: the zero-frequency row of a + !! MoorDyn-C kinematics file, which MoorDyn-C adds to the elevation alone. It is not scaled + !! by amplitude_scale. REAL(wp), INTENT(IN) :: x, y, z, t, depth, direction_deg LOGICAL, INTENT(IN) :: stretch REAL(wp), INTENT(IN) :: omega_comp(:), k_comp(:), amplitude(:), phase(:) @@ -2290,8 +2295,9 @@ SUBROUTINE CD_Component_Wave_Kinematics(x, y, z, t, depth, direction_deg, stretc ! (omega^2/k) a cosh(k(z+h))/sinh(kh) cos(theta)), as in CD_Airy_Wave_Kinematics_Precomputed REAL(wp), INTENT(OUT), OPTIONAL :: pdyn REAL(wp), INTENT(IN), OPTIONAL :: exp_m2kd(:), tail_sums(:, :), comp_cos(:), comp_sin(:) + REAL(wp), INTENT(IN), OPTIONAL :: eta_offset INTEGER :: n - REAL(wp) :: cb, sb, scl + REAL(wp) :: cb, sb, scl, offset LOGICAL :: trust_inputs eta = CD_ZERO @@ -2356,6 +2362,12 @@ SUBROUTINE CD_Component_Wave_Kinematics(x, y, z, t, depth, direction_deg, stretc CALL fail(ErrStat, ErrMsg, 'point, time, and direction must be finite') RETURN END IF + offset = CD_ZERO + IF (PRESENT(eta_offset)) offset = eta_offset + IF (.NOT. CD_Is_Finite(offset)) THEN + CALL fail(ErrStat, ErrMsg, 'eta_offset must be finite') + RETURN + END IF ! Preserve the regular-wave reduction as an executable identity, independent of ! compiler reassociation choices in the general summation loop. Besides making the ! documented one-component contract portable, this avoids loop setup in a common @@ -2364,7 +2376,8 @@ SUBROUTINE CD_Component_Wave_Kinematics(x, y, z, t, depth, direction_deg, stretc ! a unit scale is exact, so the unscaled table is reproduced bit for bit scl = CD_ONE IF (PRESENT(amplitude_scale)) scl = amplitude_scale - IF (n == 1 .AND. ABS(phase(1)) <= CD_ZERO .AND. scl*amplitude(1) > CD_ZERO .AND. .NOT. PRESENT(comp_cos)) THEN + IF (n == 1 .AND. ABS(phase(1)) <= CD_ZERO .AND. scl*amplitude(1) > CD_ZERO .AND. .NOT. PRESENT(comp_cos) & + .AND. ABS(offset) <= CD_ZERO) THEN CALL CD_Airy_Wave_Kinematics_Precomputed(x, y, z, t, 2.0_wp*(scl*amplitude(1)), omega_comp(1), k_comp(1), & depth, direction_deg, stretch, eta, velocity, acceleration, & ErrStat, ErrMsg, pdyn) @@ -2372,19 +2385,20 @@ SUBROUTINE CD_Component_Wave_Kinematics(x, y, z, t, depth, direction_deg, stretc END IF cb = COS(direction_deg*DEG2RAD) sb = SIN(direction_deg*DEG2RAD) - CALL component_sums(n, x, y, z, t, depth, stretch, scl, cb, sb, omega_comp, k_comp, amplitude, phase, eta, & - velocity, acceleration, ErrStat, ErrMsg, pdyn, exp_m2kd, tail_sums, comp_cos, comp_sin) + CALL component_sums(n, x, y, z, t, depth, stretch, scl, offset, cb, sb, omega_comp, k_comp, amplitude, phase, & + eta, velocity, acceleration, ErrStat, ErrMsg, pdyn, exp_m2kd, tail_sums, comp_cos, comp_sin) END SUBROUTINE CD_Component_Wave_Kinematics - SUBROUTINE component_sums(n, x, y, z, t, depth, stretch, scl, cb, sb, omega_comp, k_comp, amplitude, phase, eta, & - velocity, acceleration, ErrStat, ErrMsg, pdyn, exp_m2kd, tail_sums, comp_cos, comp_sin) + SUBROUTINE component_sums(n, x, y, z, t, depth, stretch, scl, offset, cb, sb, omega_comp, k_comp, amplitude, phase, & + eta, velocity, acceleration, ErrStat, ErrMsg, pdyn, exp_m2kd, tail_sums, comp_cos, comp_sin) !! The sums of CD_Component_Wave_Kinematics, on explicit-shape tables: their blocks pass to !! the block kernels without a copy, and the loops run at unit stride. A long-crested table !! forms each phase from the one distance along its direction and sums the horizontal !! velocity and acceleration once, for cb and sb to multiply; a short-crested one (comp_cos, !! comp_sin) forms each phase from the component's own direction and sums x and y apart. + !! offset (eta_offset) is added to the summed elevation before the stretching. INTEGER, INTENT(IN) :: n - REAL(wp), INTENT(IN) :: x, y, z, t, depth, scl, cb, sb + REAL(wp), INTENT(IN) :: x, y, z, t, depth, scl, offset, cb, sb LOGICAL, INTENT(IN) :: stretch REAL(wp), INTENT(IN) :: omega_comp(n), k_comp(n), amplitude(n), phase(n) REAL(wp), INTENT(INOUT) :: eta, velocity(3), acceleration(3) @@ -2432,7 +2446,7 @@ SUBROUTINE component_sums(n, x, y, z, t, depth, stretch, scl, cb, sb, omega_comp CALL add_elevation_lanes(nk, amplitude(i0:i1), bc, lane_eta) END IF END DO - eta = scl*CD_Wave_Sum_Lanes(lane_eta, lanes) + eta = scl*CD_Wave_Sum_Lanes(lane_eta, lanes) + offset IF (stretch) THEN IF (z > eta) RETURN diff --git a/tests/data/wavekin_mdc_mean/mdc_wavekin3.csv b/tests/data/wavekin_mdc_mean/mdc_wavekin3.csv new file mode 100644 index 00000000..ab8d9207 --- /dev/null +++ b/tests/data/wavekin_mdc_mean/mdc_wavekin3.csv @@ -0,0 +1,13 @@ +t,x,y,z,zeta,ux,uy,uz,ax,ay,az +0.99999999999999989,0,0,-5,1.7656452967352594,0.47135439858475092,0,-0.29093734127193621,-0.22924510870124556,0,-0.45098576580724214 +1,10,0,-20,1.5690766434753844,0.16941914094865154,0,-0.0078435433010975823,0.00096846301730661504,0,-0.12599244844427579 +1,20,-5,-35,1.112362131387534,0.06783435076708863,0,0.026051979639990383,0.028040421037256014,0,-0.037700903133677501 +1,-10,5,-2,0.91266849598056543,0.072837870869480681,0,-0.83498814438788249,-0.80734296163395158,0,-0.053093553014689598 +2.4999999999998339,0,0,-5,0.37564516514619584,-0.23553638413104661,0,-0.61718481847489548,-0.58290981241145723,0,0.2136805234959544 +2.5,10,0,-20,1.3755740128737259,0.058057303846107994,0,-0.16490950041415758,-0.13813731121596753,0,-0.052052106001920929 +2.5,20,-5,-35,1.4991103067360099,0.059901405251279349,0,-0.034834434114414517,-0.037385801049596705,0,-0.034382628028303712 +2.5,-10,5,-2,-0.2605257763638415,-0.84023102804197525,0,-0.16611787248606089,-0.071989247228249356,0,0.82674813935607339 +6.3000000000008001,0,0,-5,1.3607144758357559,0.27319781347647693,0,0.34656556520065551,0.24374637664390825,0,-0.29566432600598991 +6.3000000000008001,10,0,-20,0.61875379753327753,-0.062648480661586736,0,0.1747058117574215,0.15165498943135303,0,0.043872097232282969 +6.3000000000008001,20,-5,-35,-0.26857987692399771,-0.070031511042301292,0,0.03108222587075667,0.03306636054444799,0,0.041893438306418285 +6.3000000000008001,-10,5,-2,1.2532524850724429,0.27573000972212669,0,0.055019136270277241,-0.086139173441920722,0,-0.15924458020052942 diff --git a/tests/data/wavekin_mdc_mean/mdc_wavekin7.csv b/tests/data/wavekin_mdc_mean/mdc_wavekin7.csv new file mode 100644 index 00000000..2d6e1f3a --- /dev/null +++ b/tests/data/wavekin_mdc_mean/mdc_wavekin7.csv @@ -0,0 +1,41 @@ +t,x,y,z,zeta,ux,uy,uz,ax,ay,az +0.014900835100000006,79.1728498258,-89.578804867599999,-4.2729514839,1.3533181799406684,0.0033803362336228479,-0.11435574237165855,-0.017446805942206552,0.082027710610248356,-0.2110306980128252,-0.15350668250870234 +0.30346007659999996,37.836530609599997,-48.778135586499999,-8.7890383547000006,1.0450276229723783,-0.22095071472922914,0.0034170814895026769,-0.16739510779509506,-0.20110853666145792,-0.016125333150614447,-0.043016483968293238 +0.85649167140000015,43.8717378865,-1.7167250582,-13.0077272247,0.7602247933398032,-0.15954859103125976,0.080024245100983812,-0.29368949622438034,-0.073865451433667934,0.0826089237639724,-0.0016331914241466544 +0.90852713500000015,76.818180040900003,83.870498685499996,-10.033959214599999,1.3029353544188775,0.28724406170807942,0.014212927420526449,0.40655298734744716,-0.023647324283988479,-0.17453959128356644,-0.073960850954690599 +0.94128642240000016,-17.142502968399999,111.655541001,-9.7340212099999999,-0.20098181727346828,-0.22648210231579227,0.1707583681860613,-0.58048422329612825,-0.053488351282702018,0.13027221406743086,0.25308132341089784 +1.1367201991999851,62.089310677199997,49.954744964900001,-34.088526625199997,0.19377826830578435,0.091880137393983541,0.1223510468724346,0.028893225229507616,-0.056763531340962091,-0.046270668648265172,0.038185275980553948 +1.597389146399949,90.835244319899999,-68.715067336700002,-24.275588970899999,1.068425514756459,0.12918206418169056,-0.098239838644788705,-0.21413237308721875,-0.0068206643108513097,0.0087572485217774342,-0.026958404243894028 +2.0719116807999476,-95.443218738699997,10.795843549900001,-30.263179721699998,0.94971164108743389,0.23885634825720128,-0.024062595318653752,0.010314618703632351,0.03936865952589351,0.026781158428063591,-0.0082917352182394783 +2.1871542456999875,83.944400991899997,49.430170316900004,-33.745468373999998,1.0756767385390711,0.017054105714452646,0.098658520422982399,0.04844359113243972,-0.063574230267828061,-0.089874003333895766,-0.0084693488765218566 +2.3681050659999801,-25.457440168200002,-107.5481933456,-20.4232819257,0.32800066739109063,0.049102906664738898,0.14392442630567165,-0.047811259763716002,0.047466150798345638,0.089613025081260261,0.079024908814773531 +2.8420116374999478,-4.8758583571000003,43.172200133799997,-31.330905317799999,1.0426025850056049,-0.082519658920334096,-0.14300218032536544,-0.013875237671252805,0.023095112496890932,0.065847448179976509,-0.02017531819244256 +2.9272074900999905,-84.879703258000006,-31.612359566599999,-18.397768531800001,1.1032479195038283,0.32303973488096754,0.027390513860167259,0.15531360457812468,0.0010363193121072705,0.0032183154573826233,-0.014123205913095779 +2.9816309065999937,47.6223227873,21.528068826999998,-19.956089198299999,0.0073925461148624458,-0.11225237965009256,0.11087773048049371,0.033793686367833045,0.0015511724320952051,-0.087299489711745573,0.11169952546953041 +2.9840122301999998,-49.925132162899999,40.687987474000003,-40.5108441016,0.96427341201692318,-0.028330239179394777,-0.080096621398929438,0.0040298380011980746,0.027580721248794283,0.077324665950130989,-0.010393242101244309 +3.1398600202999831,89.0733959505,40.590599075,-25.976040983000001,1.0931217360187637,-0.064903258123395521,0.05117111262183327,0.028227174531857503,-0.045839731189184579,-0.12898459543832116,-0.022616002944165988 +3.742438334799933,-53.9101495325,5.5319461262000003,-28.2362404189,2.0031306469017465,0.064917831899289694,-0.087698128797432107,0.097019128756559797,-0.00045637262679477307,0.051354905690258336,-0.099841097851714175 +3.9122819049999813,14.8343324954,13.136983791600001,-14.6139463227,0.77635351587265178,-0.095473788386578703,-0.057692841295813785,0.13204246554921414,0.12842438170895912,-0.053681828658230679,-0.015956104360285623 +4.3062802041000916,-24.082506928699999,-72.444068732800005,-41.2102877162,1.4853676103885447,0.022299546489968528,0.041135415195587229,0.040824811862157258,0.066244334751953973,-0.039632944380978696,-0.018521876916435583 +4.3312694024000082,27.098278056600002,-1.1550260315,-37.7347985842,0.32517418650394703,-0.086391235888650886,-0.006870701436502643,0.032300151587738406,0.082890760709864009,-0.035775352163157997,0.02281047615559809 +4.713096651800126,-72.806582454700006,-89.901726565100006,-22.958309393899999,1.1935417174115353,0.19876113919686722,0.093741471539768931,0.0066655567961241315,-0.011594762224279045,-0.072734607139669963,-0.039870216805354186 +4.7905129814000249,-76.730990197699995,-4.6207195377000003,-27.602469659499999,1.8176058976925606,0.1104221075867783,0.011216540634493124,0.01296117331780668,-0.098113358921996158,0.046696289626768778,-0.084839488510186703 +5.167401826200126,59.246492556,8.6987821368000002,-16.390092752200001,0.26602744076339357,-0.13014478929321432,-0.10822983250397082,0.22012697762885991,0.018027664121081498,-0.18132438637958453,0.063394750929778435 +5.8216203606002184,60.533620408600001,65.785155914499995,-30.687162426499999,0.56906482430308913,-0.24881273753026723,-0.042043247629852287,-0.13934578968536784,-0.017190654070643224,0.062976644771410475,0.0029391834218828673 +5.8516293989000099,16.074689868699998,-25.520449681399999,-36.519592961199997,0.47224851811135071,0.10615556325244535,-0.013909581377304331,0.045188647504468459,0.11219577936146344,-0.02008029096886978,0.013832332669513673 +5.8679857144000058,101.0591225479,-115.2958995476,-4.9306467995999999,0.53122442393206759,-0.10136365085857404,-0.018148387859710405,-0.12431387984786844,-0.076243379603036496,0.22098597975719333,0.052979558077535932 +6.3009019979001435,-70.613988425000002,6.6599839712,-34.512450787100001,1.2077907042848384,0.0078981541478090733,0.11502593431940224,-0.063013933157145402,-0.036275020144488593,0.043297704407829977,-0.020206010263383922 +6.4854720708000615,84.216269901999993,-70.744201812,-38.676234780400002,0.39708945857437034,-0.15841351960446934,0.015851588407929905,0.07039194409148318,-0.016121505606015982,0.012068220767438397,0.021847270791199597 +6.6050006743000393,-79.443045281500005,57.901805566599997,-32.9645513643,1.7208113071599955,0.18473532048468777,-0.024150670845414893,0.023317030408501496,0.015892752587309145,-0.02560809132209425,-0.049898809857715554 +6.9621599667001179,111.4458530146,-26.712664700000001,-30.391851773999999,0.40912063160856921,-0.2407743824257349,-0.018907586978074015,0.019700009412049985,0.017908278981617304,0.018883982609223186,0.031154915495135944 +7.069650956600035,29.686254745500001,-28.6864406081,-35.320012315600003,0.9064585163633232,0.15787878716643972,-0.052473322343211531,0.096113900455676665,0.048764077235548736,-0.020645557071628722,3.5418779477682655e-05 +7.2216480814000503,25.652109122399999,98.269099144600006,-21.938392604299999,1.4986071859963108,-0.17169387056500832,-0.065103643506912889,0.1818403255945,0.16616557131603352,-0.06096774430709246,-0.09412937464796646 +7.3457715141000408,112.9341031518,-25.687093450700001,-4.7118446363000004,0.36166662499636393,-0.46699978629222627,0.0094698757519200566,-0.014609750532359342,0.12812813419542593,0.11358759760005291,0.052434988338617247 +7.3783778729000113,68.887851309300004,-36.275621483599998,-39.5811893849,0.56165939147101951,-0.067536366208613322,-0.057383929764731716,0.090153593778178012,0.041144817694670356,-0.0063229586865037705,0.001051635501535469 +7.4175668007000128,69.580194261299994,-36.475263513999998,-27.147921646,0.57726251270498907,-0.087029587180307455,-0.06037528973541028,0.2099618224456854,0.04523142119730035,-0.01012760107480461,0.0051828708908486371 +7.7327700965001052,-107.01749811099999,-4.6162631273999999,-16.269230035500001,0.80351228412341003,-0.31639296373729425,0.055992695802537726,0.051766712502043302,-0.052070246335253131,-0.089334231253165072,-0.0017450841420043536 +8.012744652100082,-31.371286537300001,-97.609893899699998,-6.9572557531000001,1.2258114450763209,0.16650422613211832,-0.16226495989851594,-0.29005294543532045,-0.010342858757003765,0.10059305695593536,-0.08094460859383748 +8.9171107044994997,-99.625254680300003,11.219377907,-2.0084697836999998,0.96048954963252176,-0.11598034930971057,-0.075141376746189051,0.012818199725523609,0.16992226980081412,-0.18957163376823963,-0.026849803974292957 +9.314638547399781,-73.553380448300004,101.1425908881,-38.823611307,0.39073062024197636,-0.0052485418776287091,0.094212861048195415,-0.016511095815423607,-0.13088265651550551,0.0047714976673098233,0.017983785244080973 +9.5626725483998634,-68.671922233900005,15.1012955711,-21.8961978496,0.86581395543153905,0.038330865745534515,-0.016638763782584609,-0.020187829650832771,0.0087817048754248624,-0.13780666063566374,-0.0041517837451947349 +9.7346027476999062,86.074063719799994,58.538449764100001,-7.1083772647999997,-0.7770742811106871,-0.034270260189710938,0.39665987853670143,0.485867951865949,0.058032526547136185,-0.078859279848147917,0.52001574037284726 diff --git a/tests/data/wavekin_mdc_mean/points3.txt b/tests/data/wavekin_mdc_mean/points3.txt new file mode 100644 index 00000000..2049952f --- /dev/null +++ b/tests/data/wavekin_mdc_mean/points3.txt @@ -0,0 +1,12 @@ +1.000000 0.000000 0.000000 -5.000000 +1.000000 10.000000 0.000000 -20.000000 +1.000000 20.000000 -5.000000 -35.000000 +1.000000 -10.000000 5.000000 -2.000000 +2.500000 0.000000 0.000000 -5.000000 +2.500000 10.000000 0.000000 -20.000000 +2.500000 20.000000 -5.000000 -35.000000 +2.500000 -10.000000 5.000000 -2.000000 +6.300000 0.000000 0.000000 -5.000000 +6.300000 10.000000 0.000000 -20.000000 +6.300000 20.000000 -5.000000 -35.000000 +6.300000 -10.000000 5.000000 -2.000000 diff --git a/tests/data/wavekin_mdc_mean/points7.txt b/tests/data/wavekin_mdc_mean/points7.txt new file mode 100644 index 00000000..86f993b4 --- /dev/null +++ b/tests/data/wavekin_mdc_mean/points7.txt @@ -0,0 +1,40 @@ +0.0149008351 79.1728498258 -89.5788048676 -4.2729514839 +0.3034600766 37.8365306096 -48.7781355865 -8.7890383547 +0.8564916714 43.8717378865 -1.7167250582 -13.0077272247 +0.9085271350 76.8181800409 83.8704986855 -10.0339592146 +0.9412864224 -17.1425029684 111.6555410010 -9.7340212100 +1.1367201992 62.0893106772 49.9547449649 -34.0885266252 +1.5973891464 90.8352443199 -68.7150673367 -24.2755889709 +2.0719116808 -95.4432187387 10.7958435499 -30.2631797217 +2.1871542457 83.9444009919 49.4301703169 -33.7454683740 +2.3681050660 -25.4574401682 -107.5481933456 -20.4232819257 +2.8420116375 -4.8758583571 43.1722001338 -31.3309053178 +2.9272074901 -84.8797032580 -31.6123595666 -18.3977685318 +2.9816309066 47.6223227873 21.5280688270 -19.9560891983 +2.9840122302 -49.9251321629 40.6879874740 -40.5108441016 +3.1398600203 89.0733959505 40.5905990750 -25.9760409830 +3.7424383348 -53.9101495325 5.5319461262 -28.2362404189 +3.9122819050 14.8343324954 13.1369837916 -14.6139463227 +4.3062802041 -24.0825069287 -72.4440687328 -41.2102877162 +4.3312694024 27.0982780566 -1.1550260315 -37.7347985842 +4.7130966518 -72.8065824547 -89.9017265651 -22.9583093939 +4.7905129814 -76.7309901977 -4.6207195377 -27.6024696595 +5.1674018262 59.2464925560 8.6987821368 -16.3900927522 +5.8216203606 60.5336204086 65.7851559145 -30.6871624265 +5.8516293989 16.0746898687 -25.5204496814 -36.5195929612 +5.8679857144 101.0591225479 -115.2958995476 -4.9306467996 +6.3009019979 -70.6139884250 6.6599839712 -34.5124507871 +6.4854720708 84.2162699020 -70.7442018120 -38.6762347804 +6.6050006743 -79.4430452815 57.9018055666 -32.9645513643 +6.9621599667 111.4458530146 -26.7126647000 -30.3918517740 +7.0696509566 29.6862547455 -28.6864406081 -35.3200123156 +7.2216480814 25.6521091224 98.2690991446 -21.9383926043 +7.3457715141 112.9341031518 -25.6870934507 -4.7118446363 +7.3783778729 68.8878513093 -36.2756214836 -39.5811893849 +7.4175668007 69.5801942613 -36.4752635140 -27.1479216460 +7.7327700965 -107.0174981110 -4.6162631274 -16.2692300355 +8.0127446521 -31.3712865373 -97.6098938997 -6.9572557531 +8.9171107045 -99.6252546803 11.2193779070 -2.0084697837 +9.3146385474 -73.5533804483 101.1425908881 -38.8236113070 +9.5626725484 -68.6719222339 15.1012955711 -21.8961978496 +9.7346027477 86.0740637198 58.5384497641 -7.1083772648 diff --git a/tests/data/wavekin_mdc_mean/water_grid.txt b/tests/data/wavekin_mdc_mean/water_grid.txt new file mode 100644 index 00000000..3bbf7f86 --- /dev/null +++ b/tests/data/wavekin_mdc_mean/water_grid.txt @@ -0,0 +1,9 @@ +--------------------- MoorDyn Waves grid File ---------------------------------- +List of grid points, in 3 blocks (x, y, z): 1 = list of coordinates, 2 = first last n +Grid points (m) +1 +-10.0 0.0 10.0 20.0 +1 +-5.0 0.0 5.0 +2 +-50.0 2.0 209 diff --git a/tests/data/wavekin_mdc_mean/wave_elevation.txt b/tests/data/wavekin_mdc_mean/wave_elevation.txt new file mode 100644 index 00000000..283569c2 --- /dev/null +++ b/tests/data/wavekin_mdc_mean/wave_elevation.txt @@ -0,0 +1,401 @@ +0.00 1.718208082664536e+00 +0.10 1.762704008141818e+00 +0.20 1.799678040328327e+00 +0.30 1.828476159110647e+00 +0.40 1.848526490966111e+00 +0.50 1.859349053471077e+00 +0.60 1.860564334648381e+00 +0.70 1.851900565627129e+00 +0.80 1.833199563982629e+00 +0.90 1.804421046001700e+00 +1.00 1.765645328660035e+00 +1.10 1.717074365958081e+00 +1.20 1.659031089073121e+00 +1.30 1.591957045165761e+00 +1.40 1.516408355236895e+00 +1.50 1.433050036771228e+00 +1.60 1.342648761633289e+00 +1.70 1.246064143417894e+00 +1.80 1.144238670830897e+00 +1.90 1.038186424339796e+00 +2.00 9.289807319658721e-01 +2.10 8.177409363994919e-01 +2.20 7.056184593534809e-01 +2.30 5.937823600111510e-01 +2.40 4.834045924039918e-01 +2.50 3.756451714433925e-01 +2.60 2.716374590530468e-01 +2.70 1.724737803750243e-01 +2.80 7.919157537351584e-02 +2.90 -7.239716594134693e-03 +3.00 -8.593085241128595e-02 +3.10 -1.560838877777113e-01 +3.20 -2.170020296438120e-01 +3.30 -2.680980999659450e-01 +3.40 -3.089014928723690e-01 +3.50 -3.390635297198259e-01 +3.60 -3.583611403300571e-01 +3.70 -3.666988235572830e-01 +3.80 -3.641088658691121e-01 +3.90 -3.507498224317589e-01 +4.00 -3.269032908791569e-01 +4.10 -2.929690331198340e-01 +4.20 -2.494585248092800e-01 +4.30 -1.969870351168534e-01 +4.40 -1.362643607936423e-01 +4.50 -6.808435797490153e-02 +4.60 6.686567667538501e-03 +4.70 8.712183713106048e-02 +4.80 1.722477534041668e-01 +4.90 2.610570396160259e-01 +5.00 3.525226577152976e-01 +5.10 4.456117024911694e-01 +5.20 5.392991660182382e-01 +5.30 6.325813710197470e-01 +5.40 7.244888781383499e-01 +5.50 8.140986815699756e-01 +5.60 9.005455197977285e-01 +5.70 9.830321430591306e-01 +5.80 1.060838396450487e+00 +5.90 1.133328996939399e+00 +6.00 1.199959903710797e+00 +6.10 1.260283203876211e+00 +6.20 1.313950459271326e+00 +6.30 1.360714484477726e+00 +6.40 1.400429550945215e+00 +6.50 1.433050036771228e+00 +6.60 1.458627565924969e+00 +6.70 1.477306704105929e+00 +6.80 1.489319300632690e+00 +6.90 1.494977586421666e+00 +7.00 1.494666156915110e+00 +7.10 1.488832985461792e+00 +7.20 1.477979626885623e+00 +7.30 1.462650782579149e+00 +7.40 1.443423407254644e+00 +7.50 1.420895543344493e+00 +7.60 1.395675071880807e+00 +7.70 1.368368568465924e+00 +7.80 1.339570449683604e+00 +7.90 1.309852589056514e+00 +8.00 1.279754572537952e+00 +8.10 1.249774751688816e+00 +8.20 1.220362238332255e+00 +8.30 1.191909967835470e+00 +8.40 1.164748939514448e+00 +8.50 1.139143722298233e+00 +8.60 1.115289292056760e+00 +8.70 1.093309244244132e+00 +8.80 1.073255402106956e+00 +8.90 1.055108817034768e+00 +9.00 1.038782134070082e+00 +9.10 1.024123272530816e+00 +9.20 1.010920349500809e+00 +9.30 9.989077529740477e-01 +9.40 9.877732520341184e-01 +9.50 9.771660139262006e-01 +9.60 9.667053825181904e-01 +9.70 9.559902596990588e-01 +9.80 9.446089209363094e-01 +9.90 9.321490886783266e-01 +10.00 9.182080826645362e-01 +10.10 9.024028645730402e-01 +10.20 8.843797958200326e-01 +10.30 8.638239317077813e-01 +10.40 8.404676824300302e-01 +10.50 8.140986815699762e-01 +10.60 7.845667155060490e-01 +10.70 7.517895823710954e-01 +10.80 7.157577666486927e-01 +10.90 6.765378348575276e-01 +11.00 6.342744787615595e-01 +11.10 5.891911548139090e-01 +11.20 5.415892917391842e-01 +11.30 4.918460619097276e-01 +11.40 4.404107360945623e-01 +11.50 3.877996648701275e-01 +11.60 3.345899530972076e-01 +11.70 2.814119160150286e-01 +11.80 2.289404263226011e-01 +11.90 1.778852807710176e-01 +12.00 1.289807319658718e-01 +12.10 8.297434599526476e-02 +12.20 4.061535890955470e-02 +12.30 2.642714777733812e-03 +12.40 -3.022702513217346e-02 +12.50 -5.731170867356528e-02 +12.60 -7.797536050600984e-02 +12.70 -9.163949933549098e-02 +12.80 -9.779381829246447e-02 +12.90 -9.600605041001264e-02 +13.00 -8.593085241128573e-02 +13.10 -6.731755396183348e-02 +13.20 -4.001663597783311e-02 +13.30 -3.984820255430233e-03 +13.40 4.071132668668831e-02 +13.50 9.389335039713065e-02 +13.60 1.552704772061088e-01 +13.70 2.244408216761339e-01 +13.80 3.008942345748143e-01 +13.90 3.840167679724664e-01 +14.00 4.730967091208432e-01 +14.10 5.673321104489444e-01 +14.20 6.658397196990158e-01 +14.30 7.676651922860136e-01 +14.40 8.717944477424382e-01 +14.50 9.771660139262001e-01 +14.60 1.082684186809871e+00 +14.70 1.187232820387095e+00 +14.80 1.289689550738103e+00 +14.90 1.388940250760198e+00 +15.00 1.483893507613773e+00 +15.10 1.573494913635342e+00 +15.20 1.656740963352174e+00 +15.30 1.732692354275780e+00 +15.40 1.800486497280682e+00 +15.50 1.859349053471077e+00 +15.60 1.908604328333810e+00 +15.70 1.947684370461996e+00 +15.80 1.976136640958781e+00 +15.90 1.993630140508177e+00 +16.00 1.999959903710797e+00 +16.10 1.995049794280437e+00 +16.20 1.978953559715253e+00 +16.30 1.951854129711143e+00 +16.40 1.914061168481379e+00 +16.50 1.866006916888186e+00 +16.60 1.808240385484025e+00 +16.70 1.741419983816445e+00 +16.80 1.666304694298670e+00 +16.90 1.583743920237542e+00 +17.00 1.494666156915110e+00 +17.10 1.400066651645913e+00 +17.20 1.300994233219645e+00 +17.30 1.198537502868634e+00 +17.40 1.093810587695587e+00 +17.50 9.879386632275369e-01 +17.60 8.820434543446402e-01 +17.70 7.772289232325095e-01 +17.80 6.745673492396782e-01 +17.90 5.750859986522876e-01 +18.00 4.797545725379525e-01 +18.10 3.894736081200377e-01 +18.20 3.050639938239620e-01 +18.30 2.272577404326039e-01 +18.40 1.566901309783664e-01 +18.50 9.389335039713143e-02 +18.60 3.929167291442792e-02 +18.70 -6.801739011900620e-03 +18.80 -4.418639522697965e-02 +18.90 -7.277439410940423e-02 +19.00 -9.258871582839379e-02 +19.10 -1.037599386133559e-01 +19.20 -1.065214478331279e-01 +19.30 -1.012032302819853e-01 +19.40 -8.822436710821391e-02 +19.50 -6.808435797490098e-02 +19.60 -4.135342601788983e-02 +19.70 -8.661967703806561e-03 +19.80 2.931067642801466e-02 +19.90 7.184794510954795e-02 +20.00 1.182080826645358e-01 +20.10 1.676362741688131e-01 +20.20 2.193766953761087e-01 +20.30 2.726842864743650e-01 +20.40 3.268360648938661e-01 +20.50 3.811418014530171e-01 +20.60 4.349538959469935e-01 +20.70 4.876763026605828e-01 +20.80 5.387723729827130e-01 +20.90 5.877715010416499e-01 +21.00 6.342744787615591e-01 +21.10 6.779574886297879e-01 +21.20 7.185746854051641e-01 +21.30 7.559593416202430e-01 +21.40 7.900235556536204e-01 +21.50 8.207565449870841e-01 +21.60 8.482215706333733e-01 +21.70 8.725515612484467e-01 +21.80 8.939435267665271e-01 +21.90 9.126518711752442e-01 +22.00 9.289807319658714e-01 +22.10 9.432754895640439e-01 +22.20 9.559136034178499e-01 +22.30 9.672949421806001e-01 +22.40 9.778317834039071e-01 +22.50 9.879386632275360e-01 +22.60 9.980222586363209e-01 +22.70 1.008471483920542e+00 +22.80 1.019647979041473e+00 +22.90 1.031877160734159e+00 +23.00 1.045439997487189e+00 +23.10 1.060565657182338e+00 +23.20 1.077425161356104e+00 +23.30 1.096126163000603e+00 +23.40 1.116708945829020e+00 +23.50 1.139143722298233e+00 +23.60 1.163329285742189e+00 +23.70 1.189093049079000e+00 +23.80 1.216192479083108e+00 +23.90 1.244317911541246e+00 +24.00 1.273096709120843e+00 +24.10 1.302098700853171e+00 +24.20 1.330842820142941e+00 +24.30 1.358804837519430e+00 +24.40 1.385426065278605e+00 +24.50 1.410122894043157e+00 +24.60 1.432297006368927e+00 +24.70 1.451346100097609e+00 +24.80 1.466674944404083e+00 +24.90 1.477706584576075e+00 +25.00 1.483893507613774e+00 +25.10 1.484728579819463e+00 +25.20 1.479755569686195e+00 +25.30 1.468579074565264e+00 +25.40 1.450873677721624e+00 +25.50 1.426392173354119e+00 +25.60 1.394972710797645e+00 +25.70 1.356544725228577e+00 +25.80 1.311133540514855e+00 +25.90 1.258863550103950e+00 +26.00 1.199959903710796e+00 +26.10 1.134748650711657e+00 +26.20 1.063655315206956e+00 +26.30 9.872019023082792e-01 +26.40 9.060023599453010e-01 +26.50 8.207565449870852e-01 +26.60 7.322427663416944e-01 +26.70 6.413090005604112e-01 +26.80 5.488628969647337e-01 +26.90 4.558607090933731e-01 +27.00 3.632953070166364e-01 +27.10 2.721834405017455e-01 +27.20 1.835524358857059e-01 +27.30 9.842651961260440e-02 +27.40 1.781296855325532e-02 +27.50 -5.731170867356516e-02 +27.60 -1.260153541914385e-01 +27.70 -1.874233041703577e-01 +27.80 -2.407308952686149e-01 +27.90 -2.852151449164910e-01 +28.00 -3.202454274620470e-01 +28.10 -3.452929822841879e-01 +28.20 -3.599391066199640e-01 +28.30 -3.638819048008120e-01 +28.40 -3.569414865577969e-01 +28.50 -3.390635297198270e-01 +28.60 -3.103211466446281e-01 +28.70 -2.709150187224150e-01 +28.80 -2.211717888929610e-01 +28.90 -1.615407279252827e-01 +29.00 -9.258871582839556e-02 +29.10 -1.499360479747935e-02 +29.20 7.046394583285243e-02 +29.30 1.629100494285302e-01 +29.40 2.613884524508442e-01 +29.50 3.648725221420525e-01 +29.60 4.722781915182733e-01 +29.70 5.824776775296143e-01 +29.80 6.943137768719386e-01 +29.90 8.066145355137733e-01 +30.00 9.182080826645320e-01 +30.10 1.027937417737594e+00 +30.20 1.134674939884403e+00 +30.30 1.237336513877227e+00 +30.40 1.334894873429943e+00 +30.50 1.426392173354119e+00 +30.60 1.510951515089324e+00 +30.70 1.587787285916614e+00 +30.80 1.656214170316650e+00 +30.90 1.715654712185822e+00 +31.00 1.765645328660034e+00 +31.10 1.805840699773959e+00 +31.20 1.836016482739101e+00 +31.30 1.856070324876276e+00 +31.40 1.866021174795951e+00 +31.50 1.866006916888186e+00 +31.60 1.856280379169455e+00 +31.70 1.837203788651312e+00 +31.80 1.809241771274823e+00 +31.90 1.772953014744021e+00 +32.00 1.728980731965874e+00 +32.10 1.678042079968272e+00 +32.20 1.620916703861778e+00 +32.30 1.558434587414016e+00 +32.40 1.491463400940076e+00 +32.50 1.420895543344497e+00 +32.60 1.347635078195379e+00 +32.70 1.272584763631057e+00 +32.80 1.196633372707450e+00 +32.90 1.120643494550039e+00 +33.00 1.045439997487191e+00 +33.10 9.717993233664612e-01 +33.20 9.004397676901231e-01 +33.30 8.320128832900872e-01 +33.40 7.670961262699646e-01 +33.50 7.061868421812761e-01 +33.60 6.496976682060241e-01 +33.70 5.979534038455805e-01 +33.80 5.511893786391809e-01 +33.90 5.095513211370195e-01 +34.00 4.730967091208418e-01 +34.10 4.417975572843921e-01 +34.20 4.155445756346444e-01 +34.30 3.941526101165623e-01 +34.40 3.773672567425205e-01 +34.50 3.648725221420565e-01 +34.60 3.562993872265944e-01 +34.70 3.512351168415740e-01 +34.80 3.492331470701444e-01 +34.90 3.498233734319032e-01 +35.00 3.525226577152972e-01 +35.10 3.568453686752899e-01 +35.20 3.623137723522581e-01 +35.30 3.684680913092310e-01 +35.40 3.748760585792926e-01 +35.50 3.811418014530182e-01 +35.60 3.869139022615631e-01 +35.70 3.918924978257127e-01 +35.80 3.958352960065604e-01 +35.90 3.985624065351722e-01 +36.00 3.999599037107969e-01 +36.10 3.999820603074322e-01 +36.20 3.986522147630324e-01 +36.30 3.960622570748610e-01 +36.40 3.923707424091348e-01 +36.50 3.877996648701282e-01 +36.60 3.826299467826382e-01 +36.70 3.771957208498978e-01 +36.80 3.718775032987539e-01 +36.90 3.670943752774961e-01 +37.00 3.632953070166355e-01 +37.10 3.609497743176229e-01 +37.20 3.605378295516872e-01 +37.30 3.625397993231170e-01 +37.40 3.674257881123139e-01 +37.50 3.756451714433943e-01 +37.60 3.876162633447260e-01 +37.70 4.037163410630595e-01 +37.80 4.242722051753109e-01 +37.90 4.495514454877368e-01 +38.00 4.797545725379507e-01 +38.10 5.150081612845899e-01 +38.20 5.553591378883311e-01 +38.30 6.007703226020549e-01 +38.40 6.511173219782851e-01 +38.50 7.061868421812745e-01 +38.60 7.656764724977027e-01 +38.70 8.291959645336169e-01 +38.80 8.962700084409769e-01 +38.90 9.663424832188934e-01 +39.00 1.038782134070079e+00 +39.10 1.112889606346691e+00 +39.20 1.187905743166789e+00 +39.30 1.263021032684563e+00 +39.40 1.337386071593176e+00 +39.50 1.410122894043157e+00 +39.60 1.480337000054355e+00 +39.70 1.547129904932475e+00 +39.80 1.609612021380234e+00 +39.90 1.666915679082554e+00 +40.00 1.718208082664534e+00 diff --git a/tests/data/wavekin_mdc_mean/wave_frequencies.txt b/tests/data/wavekin_mdc_mean/wave_frequencies.txt new file mode 100644 index 00000000..50223d20 --- /dev/null +++ b/tests/data/wavekin_mdc_mean/wave_frequencies.txt @@ -0,0 +1,7 @@ +0.000000 0.000000 0.800000 0.000000 +0.450000 -0.360000 -0.360000 0.300000 +0.550000 0.180000 -0.140000 2.400000 +0.650000 0.080000 -0.470000 -1.000000 +0.650000 0.300000 0.200000 3.700000 +0.800000 -0.200000 0.250000 5.100000 +1.100000 0.100000 0.120000 -2.200000 diff --git a/tests/data/wavekin_mdc_mean/wavekin3.dat b/tests/data/wavekin_mdc_mean/wavekin3.dat new file mode 100644 index 00000000..ea3b2947 --- /dev/null +++ b/tests/data/wavekin_mdc_mean/wavekin3.dat @@ -0,0 +1,27 @@ +--------------------- MoorDyn Input File ------------------------------------ +Mean-level water-kinematics parity deck (MoorDyn-C WaveKin 3, Currents 0) +----------------------- LINE TYPES ------------------------------------------ +TypeName Diam Mass/m EA BA/-zeta EI Cd Ca CdAx CaAx +(name) (m) (kg/m) (N) (N-s/-) (N-m^2) (-) (-) (-) (-) +chain 0.1 50.0 1.0e7 0.0 0 1.2 1.0 0.2 0.0 +---------------------- POINT PROPERTIES -------------------------------- +ID Type X Y Z Mass Volume CdA Ca +(#) (-) (m) (m) (m) (kg) (m^3) (m^2) (-) +1 Fixed -30.0 0.0 -20.0 0 0 0 0 +2 Vessel 30.0 0.0 -20.0 0 0 0 0 +---------------------- LINES ---------------------------------------- +ID LineType AttachA AttachB UnstrLen NumSegs LineOutputs +(#) (name) (#) (#) (m) (-) (-) +1 chain 2 1 70.0 20 - +---------------------- OPTIONS ----------------------------------------- +0.002 dtM time step to use in mooring integration (s) +10.0 TMax simulation length (s) +3.0e6 kBot bottom stiffness (Pa/m) +3.0e5 cBot bottom damping (Pa-s/m) +1025.0 WtrDnsty water density (kg/m^3) +50 WtrDpth water depth (m) +0.0 TmaxIC max time for ic gen (s) +3 WaveKin MoorDyn-C water kinematics mode (-) +0.1 dtWave wave time step (s) +0 Currents MoorDyn-C current mode (-) +------------------------- need this line -------------------------------------- diff --git a/tests/data/wavekin_mdc_mean/wavekin7.dat b/tests/data/wavekin_mdc_mean/wavekin7.dat new file mode 100644 index 00000000..20a6f40b --- /dev/null +++ b/tests/data/wavekin_mdc_mean/wavekin7.dat @@ -0,0 +1,27 @@ +--------------------- MoorDyn Input File ------------------------------------ +Mean-level water-kinematics parity deck (MoorDyn-C WaveKin 7, Currents 0) +----------------------- LINE TYPES ------------------------------------------ +TypeName Diam Mass/m EA BA/-zeta EI Cd Ca CdAx CaAx +(name) (m) (kg/m) (N) (N-s/-) (N-m^2) (-) (-) (-) (-) +chain 0.1 50.0 1.0e7 0.0 0 1.2 1.0 0.2 0.0 +---------------------- POINT PROPERTIES -------------------------------- +ID Type X Y Z Mass Volume CdA Ca +(#) (-) (m) (m) (m) (kg) (m^3) (m^2) (-) +1 Fixed -30.0 0.0 -20.0 0 0 0 0 +2 Vessel 30.0 0.0 -20.0 0 0 0 0 +---------------------- LINES ---------------------------------------- +ID LineType AttachA AttachB UnstrLen NumSegs LineOutputs +(#) (name) (#) (#) (m) (-) (-) +1 chain 2 1 70.0 20 - +---------------------- OPTIONS ----------------------------------------- +0.002 dtM time step to use in mooring integration (s) +10.0 TMax simulation length (s) +3.0e6 kBot bottom stiffness (Pa/m) +3.0e5 cBot bottom damping (Pa-s/m) +1025.0 WtrDnsty water density (kg/m^3) +50 WtrDpth water depth (m) +0.0 TmaxIC max time for ic gen (s) +7 WaveKin MoorDyn-C water kinematics mode (-) +0.1 dtWave wave time step (s) +0 Currents MoorDyn-C current mode (-) +------------------------- need this line -------------------------------------- diff --git a/tests/test_wavekin_modes.f90 b/tests/test_wavekin_modes.f90 index 2cfcf46b..cf4e05ce 100644 --- a/tests/test_wavekin_modes.f90 +++ b/tests/test_wavekin_modes.f90 @@ -14,6 +14,13 @@ !> equals the record's two harmonics to 1e-10 m), and velocity and acceleration, which !> MoorDyn-C interpolates in the stretched depth on its 0.25 m grid, within 1e-3 of their !> scale; +!> - a mean level (tests/data/wavekin_mdc_mean, MoorDyn-C v2.7.2): an omega = 0 row of 0.8 m +!> under six WaveKin 7 components in six directions, and the WaveKin 3 record raised by +!> 0.8 m. MoorDyn-C adds the level to the elevation alone, which its stretching then maps, and +!> keeps the wave numbers of WtrDpth; CableDyn matches it to the tolerances above (WaveKin 7 +!> to 1e-8). Taking +!> the wave numbers at WtrDpth plus the level, as 0.4.0 did, put WaveKin 7 7.7e-3 m off in +!> elevation and 1e-2 of its scale in velocity, and WaveKin 3 2.2e-4 m and 6e-3; !> - WvHiCOff: 1 rad/s keeps only the record's 8 s harmonic, exactly; none keeps both, as the !> 0.5 Hz default does (the record has nothing above it); !> - Currents 1: identical to 1e-12 m/s; @@ -34,6 +41,10 @@ PROGRAM test_wavekin_modes 1.0e-6_wp, 1.0e-6_wp) CALL check_mode('wavekin_mdc/wavekin3.dat', 'wavekin_mdc/mdc_wavekin3.csv', 'WaveKin 3', 1.0e-6_wp, & 1.0e-3_wp, 1.0e-3_wp) + CALL check_mode('wavekin_mdc_mean/wavekin7.dat', 'wavekin_mdc_mean/mdc_wavekin7.csv', 'WaveKin 7, mean level', & + 1.0e-6_wp, 1.0e-6_wp, 1.0e-6_wp) + CALL check_mode('wavekin_mdc_mean/wavekin3.dat', 'wavekin_mdc_mean/mdc_wavekin3.csv', 'WaveKin 3, mean level', & + 1.0e-6_wp, 1.0e-3_wp, 1.0e-3_wp) CALL check_record() CALL check_cutoff() CALL check_mode('wavekin_mdc/currents1.dat', 'wavekin_mdc/mdc_currents1.csv', 'Currents 1', 1.0e-12_wp, & diff --git a/validation/scripts/wavekin_moordyn_c_reference.py b/validation/scripts/wavekin_moordyn_c_reference.py index 2d08cba2..e536699a 100644 --- a/validation/scripts/wavekin_moordyn_c_reference.py +++ b/validation/scripts/wavekin_moordyn_c_reference.py @@ -1,10 +1,11 @@ # SPDX-License-Identifier: Apache-2.0 -"""Regenerate the MoorDyn-C water-kinematics references of tests/data/wavekin_mdc. +"""Regenerate the MoorDyn-C water-kinematics references of tests/data/wavekin_mdc and wavekin_mdc_mean. Compiles wavekin_mdc_probe.cpp against a MoorDyn-C build (CD_MDC_SRC, CD_MDC_BUILD, CD_GXX as for the bodies scripts), runs it on the shared decks (WaveKin 3, WaveKin 7, Currents 1) and their probe points, and writes mdc_wavekin3.csv, mdc_wavekin7.csv and mdc_currents1.csv next to them. -The wavekin_modes CTest compares CableDyn against these rows. +wavekin_mdc_mean holds the same WaveKin 3 and 7 decks with a 0.8 m mean level; its references +come from MoorDyn-C v2.7.2. The wavekin_modes CTest compares CableDyn against these rows. """ import os @@ -15,10 +16,13 @@ from bodies_common import GXX, MDC_BUILD, MDC_SRC, REPO, SCRIPTS -DATA = REPO / "tests" / "data" / "wavekin_mdc" -CASES = (("wavekin3.dat", "points3.txt", "mdc_wavekin3.csv"), - ("wavekin7.dat", "points7.txt", "mdc_wavekin7.csv"), - ("currents1.dat", "pointsc.txt", "mdc_currents1.csv")) +FOLDERS = { + REPO / "tests" / "data" / "wavekin_mdc": (("wavekin3.dat", "points3.txt", "mdc_wavekin3.csv"), + ("wavekin7.dat", "points7.txt", "mdc_wavekin7.csv"), + ("currents1.dat", "pointsc.txt", "mdc_currents1.csv")), + REPO / "tests" / "data" / "wavekin_mdc_mean": (("wavekin3.dat", "points3.txt", "mdc_wavekin3.csv"), + ("wavekin7.dat", "points7.txt", "mdc_wavekin7.csv")), +} def main() -> None: @@ -34,14 +38,17 @@ def main() -> None: subprocess.run([GXX, "-O2", "-std=c++17", *[f"-I{p}" for p in inc], str(SCRIPTS / "wavekin_mdc_probe.cpp"), str(dll), "-o", str(exe)], check=True, env=env) shutil.copy2(dll, work / "libmoordyn.dll") - for f in DATA.iterdir(): - if not f.name.startswith("mdc_"): - shutil.copy2(f, work / f.name) - for deck, points, out in CASES: - subprocess.run([str(exe), deck, points, out], cwd=work, check=True, env=env, - stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) - shutil.copy2(work / out, DATA / out) - print(f"wrote {DATA / out}") + for data, cases in FOLDERS.items(): + case_dir = work / data.name + case_dir.mkdir() + for f in data.iterdir(): + if not f.name.startswith("mdc_"): + shutil.copy2(f, case_dir / f.name) + for deck, points, out in cases: + subprocess.run([str(exe), deck, points, out], cwd=case_dir, check=True, env=env, + stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + shutil.copy2(case_dir / out, data / out) + print(f"wrote {data / out}") if __name__ == "__main__":