Skip to content

Commit bdad54a

Browse files
MShabaraakeeste
andauthored
Multi wave class bug fix v2 (#1373)
* fixes a bug that happens when multiple waves are defined * Adjusts the lin block version to 2020b * reduce number of From blocks in exc force blocks, mask update respectively * Allows QTF calculation for multiple wave instances * revert change to rm3.h 5 --------- Co-authored-by: akeeste <[email protected]>
1 parent 2c12e29 commit bdad54a

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

source/functions/initializeWecSim.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@
292292
for kk = 1:length(idx)
293293
ii = idx(kk);
294294
for iH = 1:length(body(ii).hydroData)
295-
body(ii).hydroForcePre(waves(1), simu, iH);
295+
body(ii).hydroForcePre(waves, simu, iH);
296296
end
297297
end
298298
end; clear kk idx ii
661 Bytes
Binary file not shown.

source/objects/bodyClass.m

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,11 +390,12 @@ function dragForcePre(obj,rho)
390390
obj.dof = length(obj.quadDrag.drag);
391391
end
392392

393-
function hydroForcePre(obj, waves, simu, iH)
393+
function hydroForcePre(obj, waveObj, simu, iH)
394394
% HydroForce Pre-processing calculations
395395
% 1. Set the linear hydrodynamic restoring coefficient, viscous drag, and linear damping matrices
396396
% 2. Set the wave excitation force
397397
% 3. Loop through all included hydroData files
398+
waves = waveObj(1);
398399
w = waves.omega;
399400
direction = waves.direction;
400401
cicTime = simu.cicTime;
@@ -488,7 +489,7 @@ function hydroForcePre(obj, waves, simu, iH)
488489
if ~isfield(obj.hydroData(iH).hydro_coeffs.excitation, 'QTFs')
489490
error('QTF coefficients are not defined for the body object "%s"', obj.name);
490491
else
491-
obj.qtfExcitation(waveAmpTime, iH);
492+
obj.qtfExcitation(waveObj, iH);
492493
end
493494
end
494495
end
@@ -746,10 +747,17 @@ function noExcitation(obj, iH)
746747
obj.hydroForce.(hfName).fExt.im=zeros(1,nDOF);
747748
end
748749

749-
function qtfExcitation(obj, waveAmpTime, iH)
750+
function qtfExcitation(obj, wavesObj, iH)
750751
% second order excitation force
751752
% Used by hydroForcePre
752753
hfName = ['hf' num2str(iH)];
754+
755+
waveAmpTime(:,1) = wavesObj(1).waveAmpTime(:,1);
756+
waveAmpTime(:,2) = wavesObj(1).waveAmpTime(:,2);
757+
758+
for iWaves = 2 : length(wavesObj)
759+
waveAmpTime(:,2) = waveAmpTime(:,2) + wavesObj(iWaves).waveAmpTime(:,2);
760+
end
753761

754762
F_max = 1 / (waveAmpTime(2,1) - waveAmpTime(1,1)); % Maximum samplng freq.
755763
Amp_freq = fft(waveAmpTime(:,2));

0 commit comments

Comments
 (0)