1919 * - Reads HDF5 hydrodynamic data via H5FileInfo (equilibrium, stiffness, RIRF kernels)
2020 * - Uses WaveBase hierarchy for wave excitation forces
2121 * - Applies forces to Chrono bodies through ChForce/ChLoadAddedMass
22- * - Maintains velocity history buffers for radiation convolution
22+ * - RadiationComponent maintains velocity history for radiation convolution
2323 *
2424 * KEY ASSUMPTIONS:
2525 * - All bodies share the same H5 file (multibody data in single file)
2626 * - Bodies are 1-indexed in ForceFunc6d interface (legacy)
2727 * - 6 DOF per body (surge, sway, heave, roll, pitch, yaw)
2828 * - Forces computed once per time step, cached via prev_time check
29- * - Radiation history stored per-body in velocity_history_ vector
29+ * - RadiationComponent is the single source of truth for radiation history/forces
3030 *
3131 * KNOWN LIMITATIONS:
3232 * - Monolithic design: all force components mixed in one class
3636 *
3737 * DEBUG INSTRUMENTATION:
3838 * To enable debug output, compile with -DHYDROCHRONO_DEBUG.
39- * This will print force components, history sizes, and timing info.
39+ * This will print force components and timing info.
4040 * Baseline outputs to record:
4141 * - Total force vector per time step (total_force_)
4242 * - Individual components (hydrostatic, radiation, waves)
43- * - Velocity history size and time span
4443 * - RIRF kernel access patterns
4544 *********************************************************************/
4645
5857#include " hydro/core/hydro_system.h"
5958#include " hydro/chrono/chrono_hydro_coupler.h"
6059#include " hydro/radiation/radiation_rirf_processing.h"
61- #include " hydro/radiation/radiation_rirf_convolution.h"
6260
6361#include < chrono/physics/ChLoad.h>
6462#include < unsupported/Eigen/Splines>
@@ -261,17 +259,7 @@ TestHydro::TestHydro(std::vector<std::shared_ptr<ChBody>> user_bodies,
261259 // Total degrees of freedom (multibody: 6 DOF per body)
262260 int total_dofs = kDofPerBody * num_bodies_;
263261
264- // Initialize radiation convolution module
265- const int rirf_steps = file_info_.GetRIRFDims (2 );
266- radiation_convolution_ = std::make_unique<hydrochrono::hydro::RadiationRirfConvolution>(
267- num_bodies_, rirf_steps, rirf_time_vector, rirf_width_vector);
268-
269- // Initialize vectors (legacy: kept for compatibility, but radiation_convolution_ owns the history)
270- time_history_.clear ();
271- velocity_history_.clear ();
272- for (int b = 0 ; b < num_bodies_; ++b) {
273- velocity_history_.push_back (std::vector<std::vector<double >>(0 ));
274- }
262+ // Initialize force vectors
275263 force_hydrostatic_.assign (total_dofs, 0.0 );
276264 force_radiation_damping_.assign (total_dofs, 0.0 );
277265 total_force_.assign (total_dofs, 0.0 );
@@ -609,13 +597,13 @@ void TestHydro::CompareWithHydroSystem(double time, int total_dofs) {
609597}
610598
611599// Main radiation convolution computation.
612- // Delegates to RadiationComponent for force computation.
600+ // RadiationComponent is the single source of truth for radiation history and forces.
601+ // It internally manages velocity history and performs RIRF convolution.
613602std::vector<double > TestHydro::ComputeForceRadiationDampingConv () {
614603 auto __t0 = std::chrono::steady_clock::now ();
615- const int rirf_steps = file_info_.GetRIRFDims (2 );
616604 const int total_dofs = kDofPerBody * num_bodies_;
617605
618- assert (total_dofs > 0 && rirf_steps > 0 );
606+ assert (total_dofs > 0 );
619607
620608 // Ensure radiation component exists with current settings
621609 EnsureRadiationComponent ();
@@ -625,37 +613,23 @@ std::vector<double> TestHydro::ComputeForceRadiationDampingConv() {
625613 const hydrochrono::hydro::SystemState& system_state = GetCachedSystemState (simulation_time);
626614
627615#ifdef HYDROCHRONO_DEBUG
616+ const int rirf_steps = file_info_.GetRIRFDims (2 );
628617 std::cout << " [HYDRO_DEBUG] Radiation conv: time=" << simulation_time
629618 << " , rirf_steps=" << rirf_steps << std::endl;
630619#endif
631620
632- // Compute forces using the radiation component
621+ // RadiationComponent::Compute() handles:
622+ // - Recording current velocities into its internal history
623+ // - Performing RIRF convolution over the velocity history
624+ // - Returning the radiation damping forces
633625 hydrochrono::hydro::BodyForces body_forces (num_bodies_);
634626 for (int b = 0 ; b < num_bodies_; ++b) {
635627 body_forces[b].resize (kDofPerBody );
636628 body_forces[b].setZero ();
637629 }
638630 radiation_component_->Compute (system_state, simulation_time, body_forces);
639631
640- // Also update legacy history buffers for compatibility (used by GetRIRFval and other legacy code)
641- // Extract velocities for legacy buffer update
642- std::vector<std::vector<double >> body_velocities (num_bodies_);
643- for (int b = 0 ; b < num_bodies_; ++b) {
644- const auto & body_state = system_state.bodies [b];
645- body_velocities[b] = {
646- body_state.linear_velocity [0 ], body_state.linear_velocity [1 ], body_state.linear_velocity [2 ],
647- body_state.angular_velocity [0 ], body_state.angular_velocity [1 ], body_state.angular_velocity [2 ]
648- };
649- }
650- time_history_.insert (time_history_.begin (), simulation_time);
651- for (int b = 0 ; b < num_bodies_; ++b) {
652- velocity_history_[b].insert (velocity_history_[b].begin (), body_velocities[b]);
653- }
654-
655- // Also update legacy radiation_convolution_ for compatibility
656- radiation_convolution_->RecordVelocities (simulation_time, body_velocities);
657-
658- // Convert BodyForces back to legacy flat 6N vector format
632+ // Convert BodyForces to legacy flat 6N vector format
659633 force_radiation_damping_.assign (kDofPerBody * num_bodies_, 0.0 );
660634 for (int b = 0 ; b < num_bodies_; ++b) {
661635 const int body_offset = kDofPerBody * b;
0 commit comments