Skip to content

Commit

Permalink
Merge pull request #31 from jtgrasb/MD_Fix
Browse files Browse the repository at this point in the history
[BUG] Fix Mean Drift userDefinedFunctions
  • Loading branch information
nathanmtom authored May 17, 2023
2 parents d416f7b + 40faf83 commit 2195e6c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Mean_Drift/WECSim/userDefinedFunctions.m
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
inds = find(output.wave.time >= simu.rampTime + waves.period*5);
%%
surgeMeanDriftTH = body.hydroForce.fExt.md(1)*waves.A^2;
surgeMeanDriftTH = body.hydroForce.fExt.md(1)*waves.amplitude^2;
surgeMeanDriftWS = mean(output.bodies.forceExcitation(inds,1));
%%
close all
plot(output.bodies.time/waves.period,output.bodies.forceExcitation(:,1)/(simu.rho*simu.g*waves.A),...
output.bodies.time/waves.period,ones(size(output.bodies.time)).*mean(output.bodies.forceExcitation(inds,1)/(simu.rho*simu.g*waves.A)),'--',...
output.bodies.time/waves.period,ones(size(output.bodies.time)).*surgeMeanDriftTH/(simu.rho*simu.g*waves.A),'-.');grid on
plot(output.bodies.time/waves.period,output.bodies.forceExcitation(:,1)/(simu.rho*simu.gravity*waves.amplitude),...
output.bodies.time/waves.period,ones(size(output.bodies.time)).*mean(output.bodies.forceExcitation(inds,1)/(simu.rho*simu.gravity*waves.amplitude)),'--',...
output.bodies.time/waves.period,ones(size(output.bodies.time)).*surgeMeanDriftTH/(simu.rho*simu.gravity*waves.amplitude),'-.');grid on
xlabel('Time, t/T, [-]');ylabel('Surge Wave Excitation Force, f_{ext,1}/\rhogA, [N/(N/m^{2})]');
legend('Surge Excitation Force','Surge Mean Drift Force WEC-Sim','Surge Mean Drift Force Theory')
figure()
Expand Down
1 change: 1 addition & 0 deletions Mean_Drift/WECSim/wecSimInputFile.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
% 0 (no),
% 1 (from control surface)
% 2 (from momentum conservation)
% 3 (from pressure integration)
body(1).meanDrift = 1;

%% PTO and Constraint Parameters
Expand Down

0 comments on commit 2195e6c

Please sign in to comment.