Skip to content

Commit 03be930

Browse files
committed
Add documentation for radiation damping convolution
1 parent d973f47 commit 03be930

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

doc/user/_theory/theory.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ The :math:`K_{rad}(t)` function is derived by implementing the inverse continuou
114114
115115
This transform allows the frequency domain coefficients, :math:`B(\omega)`, to be remapped into the time domain, thus producing the radiation impulse response function, :math:`K_{rad}(t)`. The :math:`B(\omega)` values can be sourced using open-source BEM software.
116116

117+
In HydroChrono, the force is computed through trapezoidal integration at the time values given by the RIRF time array relative to the current simulation time step. Linear interpolation is done for the velocity history if a given time value is between two values of the time series of the stored velocity history.
117118
Wave excitation force, :math:`F_{exc}(t)`
118119
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
119120

include/hydroc/hydro_forces.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,13 @@ class TestHydro {
193193
/**
194194
* @brief Computes the Radiation Damping force with convolution history for a 6N dimensional system.
195195
*
196+
* The discretization uses the time series of the the RIRF relative to the current step.
197+
* Linear interpolation is done on the velocity history if time_sim-time_rirf is between two values of the time
198+
* history. Trapezoidal integration is used to compute the force.
199+
*
200+
* Time history is automatically added in this function (so it should only be called once per time step), and
201+
* history that is older than the maximum RIRF time value is automatically removed.
202+
*
196203
* @return 6N dimensional force for 6 DOF and N bodies in system.
197204
*/
198205
std::vector<double> ComputeForceRadiationDampingConv();

src/hydro_forces.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,14 +306,12 @@ std::vector<double> TestHydro::ComputeForceRadiationDampingConv() {
306306

307307
assert(numRows * size > 0 && numCols > 0);
308308

309-
std::vector<double> tmp_s(numRows * size, 0.0);
310-
311-
// Helper function for tmp_s indexing
312-
auto TmpSIndex = [&](int row, int step) { return (row * size) + step; };
313-
314309
// time history
315310
auto t_sim = bodies_[0]->GetChTime();
316311
auto t_min = t_sim - rirf_time_vector.tail<1>()[0];
312+
if (time_history_.size() > 0 && t_sim == time_history_.front()) {
313+
throw std::runtime_error("Tried to compute the radiation damping convolution twice within the same time step!");
314+
}
317315
time_history_.insert(time_history_.begin(), t_sim);
318316

319317
// velocity history

0 commit comments

Comments
 (0)