Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull #1373 into dev #1380

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/functions/initializeWecSim.m
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@
for kk = 1:length(idx)
ii = idx(kk);
for iH = 1:length(body(ii).hydroData)
body(ii).hydroForcePre(waves(1), simu, iH);
body(ii).hydroForcePre(waves, simu, iH);
end
end
end; clear kk idx ii
Expand Down
Binary file modified source/lib/WEC-Sim/WECSim_Lib_Body_Elements.slx
Binary file not shown.
14 changes: 11 additions & 3 deletions source/objects/bodyClass.m
Original file line number Diff line number Diff line change
Expand Up @@ -390,11 +390,12 @@ function dragForcePre(obj,rho)
obj.dof = length(obj.quadDrag.drag);
end

function hydroForcePre(obj, waves, simu, iH)
function hydroForcePre(obj, waveObj, simu, iH)
% HydroForce Pre-processing calculations
% 1. Set the linear hydrodynamic restoring coefficient, viscous drag, and linear damping matrices
% 2. Set the wave excitation force
% 3. Loop through all included hydroData files
waves = waveObj(1);
w = waves.omega;
direction = waves.direction;
cicTime = simu.cicTime;
Expand Down Expand Up @@ -488,7 +489,7 @@ function hydroForcePre(obj, waves, simu, iH)
if ~isfield(obj.hydroData(iH).hydro_coeffs.excitation, 'QTFs')
error('QTF coefficients are not defined for the body object "%s"', obj.name);
else
obj.qtfExcitation(waveAmpTime, iH);
obj.qtfExcitation(waveObj, iH);
end
end
end
Expand Down Expand Up @@ -746,10 +747,17 @@ function noExcitation(obj, iH)
obj.hydroForce.(hfName).fExt.im=zeros(1,nDOF);
end

function qtfExcitation(obj, waveAmpTime, iH)
function qtfExcitation(obj, wavesObj, iH)
% second order excitation force
% Used by hydroForcePre
hfName = ['hf' num2str(iH)];

waveAmpTime(:,1) = wavesObj(1).waveAmpTime(:,1);
waveAmpTime(:,2) = wavesObj(1).waveAmpTime(:,2);

for iWaves = 2 : length(wavesObj)
waveAmpTime(:,2) = waveAmpTime(:,2) + wavesObj(iWaves).waveAmpTime(:,2);
end

F_max = 1 / (waveAmpTime(2,1) - waveAmpTime(1,1)); % Maximum samplng freq.
Amp_freq = fft(waveAmpTime(:,2));
Expand Down
Loading