@@ -587,6 +587,11 @@ def run_and_store_results(self, problem_index: int) -> Results:
587587
588588 full_added_mass_matrix = np .full ((num_freqs , num_modes , num_modes ), np .nan )
589589 full_damping_matrix = np .full ((num_freqs , num_modes , num_modes ), np .nan )
590+ # --- NEW: Initialize matrices for Excitation Force and Phase ---
591+ # Note: These are vectors (one value per mode per frequency), not NxN matrices like added mass
592+ full_excitation_force = np .full ((num_freqs , num_modes ), np .nan )
593+ full_excitation_phase = np .full ((num_freqs , num_modes ), np .nan )
594+ # ---------------------------------------------------------------
590595 all_potentials_batch_data = []
591596
592597 # 1. Create a SINGLE reusable Geometry/Problem Setup
@@ -684,6 +689,13 @@ def run_and_store_results(self, problem_index: int) -> Results:
684689 j_idx = j_idx_result [0 ]
685690 full_added_mass_matrix [freq_idx , j_idx , i_idx ] = coeff_dict ['real' ]
686691 full_damping_matrix [freq_idx , j_idx , i_idx ] = coeff_dict ['imag' ]
692+ # --- NEW: Capture Excitation Force & Phase ---
693+ # We only need to store this when i_idx (radiating mode) == j_idx (force mode)
694+ # or just capture it for the active mode.
695+ if i_idx == j_idx :
696+ full_excitation_force [freq_idx , j_idx ] = coeff_dict .get ('excitation_force' , np .nan )
697+ full_excitation_phase [freq_idx , j_idx ] = coeff_dict .get ('excitation_phase' , np .nan )
698+ # ---------------------------------------------
687699
688700 Cs = temp_engine .reformat_coeffs (X_i , NMK_list , len (NMK_list ) - 1 )
689701
@@ -710,10 +722,13 @@ def run_and_store_results(self, problem_index: int) -> Results:
710722 full_damping_matrix [freq_idx , :, i_idx ] = np .nan
711723 continue
712724
725+ # --- UPDATED: Pass the new matrices to store_hydrodynamic_coefficients ---
713726 results .store_hydrodynamic_coefficients (
714727 frequencies = omegas_to_run ,
715728 added_mass_matrix = full_added_mass_matrix ,
716729 damping_matrix = full_damping_matrix ,
730+ excitation_force = full_excitation_force , # <--- Add this
731+ excitation_phase = full_excitation_phase # <--- Add this
717732 )
718733
719734 if all_potentials_batch_data :
0 commit comments