11%% OWC - WAMIT GBM simulation
2+ %% Define the despiking structure
3+ despike = struct();
4+ despike.negThresh = 1e-3 ; % the threshold below which negative damping will be removed
5+ despike.N = 5 ; % will loop the despiking procedure N time before filtering
6+ despike.appFilt = 1 ; % boolean, 1 to apply low pass filter after despiking
27
3- %% Run BEMIO for WAMIT Run and despike the hydro data
4- % 1) load deSpike.mat, to create structure depSpike in workspace.
5- % 2) call >> outHydro=badBemioFix_fcn({'test17a.out'},'WAMIT',deSpike,[1,1;3,3;5,5;7,7])
6- % This will despike the resonance associated with the OWC moonpool and generate an h5
7- % file with the _clean suffix.
8+ % thresholds: applied to 'Threshold' argument of findpeaks
9+ despike.B.Threshold = 2e-4 ; % damping
10+ despike.A.Threshold = 1e-3 ; % added mass
11+ despike.ExRe.Threshold = 1e-3 ; % real part excitation
12+ despike.ExIm.Threshold = 1e-3 ; % imag part excitation
813
14+ % minimum peak prominence, applied to 'MinPeakProminence' argument of findpeaks
15+ despike.B.Prominence = 2e-4 ;
16+ despike.A.Prominence = 1e-3 ;
17+ despike.ExRe.Prominence = 1e-3 ;
18+ despike.ExIm.Prominence = 1e-3 ;
919
10- % outHydro = cleanBEM({'test17a.out'},'WAMIT',deSpike,[1,1;3,3;5,5;7,7]);
11- % writeBEMIOH5(outHydro);
20+ % minimum peak distance, applied to 'MinPeakDistance' argument of findpeaks
21+ despike.A.MinPeakDistance = 3 ;
22+ despike.B.MinPeakDistance = 3 ;
23+ despike.ExRe.MinPeakDistance = 3 ;
24+ despike.ExIm.MinPeakDistance = 3 ;
1225
13- %% Run BEMIO for WAMIT Run
14- % 1) load deSpike.mat, to create structure depSpike in workspace.
15- % 2) call cleanBEM to despike the resonance associated with the OWC
16- % moonpool and generate an h5 file with the _clean suffix.
26+ % the b and a inputs to MATLAB's filtfilt(b,a,x) function
27+ despike.Filter.b = 0.02008336556421123561544384017452102853 .* [1 2 1 ];
28+ despike.Filter.a = [1 - 1.561018075800718163392843962355982512236 0.641351538057563175243558362126350402832 ];
1729
18- load deSpike.mat
30+ %% Read and clean WAMIT results
1931hydro = struct();
2032hydro = readWAMIT(hydro ,' test17a.out' ,[]);
21- hydro = cleanBEM(hydro , deSpike );
33+ hydro = cleanBEM(hydro ,despike );
34+ hydro.file = ' test17a_clean' ;
35+
2236hydro = radiationIRF(hydro ,20 ,[],[],[],11 );
2337hydro = radiationIRFSS(hydro ,20 ,[]);
2438hydro = excitationIRF(hydro ,20 ,[],[],[],11 );
39+
2540hydro.plotDofs = [1 ,1 ;3 ,3 ;5 ,5 ;7 ,7 ];
41+ % plotBEMIO(hydro);
42+
2643writeBEMIOH5(hydro );
27- % plotBEMIO(hydro);
0 commit comments