diff --git a/.github/workflows/run-tests-reusable.yml b/.github/workflows/run-tests-reusable.yml index 06448c3c..ce6a373a 100644 --- a/.github/workflows/run-tests-reusable.yml +++ b/.github/workflows/run-tests-reusable.yml @@ -54,15 +54,15 @@ jobs: ref: ${{ inputs.base_ref }} path: './WEC-Sim' - name: Check out MoorDyn - if: matrix.folder == 'Mooring' + if: matrix.folder == 'Mooring' || matrix.folder == 'OWC' || matrix.folder == 'Paraview_Visualization' uses: actions/checkout@v4 with: repository: WEC-Sim/MoorDyn path: './MoorDyn' - name: Copy MoorDyn Files - if: matrix.folder == 'Mooring' + if: matrix.folder == 'Mooring' || matrix.folder == 'OWC' || matrix.folder == 'Paraview_Visualization' run: | - cp * ../WEC-Sim/source/functions/moorDyn + cp -r * ../WEC-Sim/source/functions/moorDyn ls ../WEC-Sim/source/functions/moorDyn shell: bash working-directory: './MoorDyn' diff --git a/.github/workflows/wec-sim-dev-tests.yml b/.github/workflows/wec-sim-dev-tests.yml index f1033663..8025ed14 100644 --- a/.github/workflows/wec-sim-dev-tests.yml +++ b/.github/workflows/wec-sim-dev-tests.yml @@ -1,5 +1,6 @@ name: Test WEC-Sim dev branch on: + workflow_dispatch: {} repository_dispatch: types: - wecsim-dev diff --git a/.github/workflows/wec-sim-main-tests.yml b/.github/workflows/wec-sim-main-tests.yml index f0f0b605..aa3efa17 100644 --- a/.github/workflows/wec-sim-main-tests.yml +++ b/.github/workflows/wec-sim-main-tests.yml @@ -1,5 +1,6 @@ name: Test WEC-Sim main branch on: + workflow_dispatch: {} repository_dispatch: types: - wecsim-main diff --git a/Body-to-Body_Interactions/TestB2B.m b/Body-to-Body_Interactions/TestB2B.m index 9631c04e..4deff748 100644 --- a/Body-to-Body_Interactions/TestB2B.m +++ b/Body-to-Body_Interactions/TestB2B.m @@ -53,26 +53,32 @@ function checkVisibilityRestored(testCase) function testB2B_Case1(testCase) cd('B2B_Case1') wecSim + close_system('RM3',0) end function testB2B_Case2(testCase) cd('B2B_Case2') wecSim + close_system('RM3',0) end function testB2B_Case3(testCase) cd('B2B_Case3') wecSim + close_system('RM3',0) end function testB2B_Case4(testCase) cd('B2B_Case4') wecSim + close_system('RM3',0) end function testB2B_Case5(testCase) cd('B2B_Case5') wecSim + close_system('RM3',0) end function testB2B_Case6(testCase) cd('B2B_Case6') wecSim + close_system('RM3',0) end end end diff --git a/Desalination/OSWEC_RO.slx b/Desalination/OSWEC_RO.slx index 131a6b06..3444b958 100644 Binary files a/Desalination/OSWEC_RO.slx and b/Desalination/OSWEC_RO.slx differ diff --git a/Free_Decay/TestFreeDecay.m b/Free_Decay/TestFreeDecay.m index b881e7ef..7a26f25b 100644 --- a/Free_Decay/TestFreeDecay.m +++ b/Free_Decay/TestFreeDecay.m @@ -53,26 +53,31 @@ function checkVisibilityRestored(testCase) function testFree_Decay_0m(testCase) cd('0m') wecSim + close_system('sphere',0) cd(testCase.testDir) end function testFree_Decay_1m(testCase) cd('1m') wecSim + close_system('sphere',0) cd(testCase.testDir) end function testFree_Decay_1m_ME(testCase) cd('1m-ME') wecSim + close_system('sphere',0) cd(testCase.testDir) end function testFree_Decay_3m(testCase) cd('3m') wecSim + close_system('sphere',0) cd(testCase.testDir) end function testFree_Decay_5m(testCase) cd('5m') wecSim + close_system('sphere',0) cd(testCase.testDir) end end diff --git a/Mooring/MoorDyn/wecSimInputFile.m b/Mooring/MoorDyn/wecSimInputFile.m index 425c0cc6..aa7d76fb 100644 --- a/Mooring/MoorDyn/wecSimInputFile.m +++ b/Mooring/MoorDyn/wecSimInputFile.m @@ -1,11 +1,11 @@ %% Simulation Data simu = simulationClass(); simu.simMechanicsFile = 'RM3MoorDyn.slx'; % WEC-Sim Model File -simu.mode = 'accelerator'; +simu.mode = 'accelerator'; simu.explorer = 'off'; -simu.rampTime = 40; +simu.rampTime = 40; simu.endTime = 400; -simu.dt = 0.01; +simu.dt = 0.01; simu.cicDt = 0.05; %% Wave Information diff --git a/Mooring/TestMooring.m b/Mooring/TestMooring.m index bf2f01d0..0a4f12cd 100644 --- a/Mooring/TestMooring.m +++ b/Mooring/TestMooring.m @@ -56,11 +56,13 @@ function testMoorDyn(testCase) "MoorDyn is not installed"); cd MoorDyn wecSim + close_system('RM3MoorDyn',0) cd(testCase.testDir) end function testMooringMatrix(testCase) cd MooringMatrix wecSim + close_system('RM3MooringMatrix',0) cd(testCase.testDir) end end diff --git a/Morison_Element/TestMorisonElement.m b/Morison_Element/TestMorisonElement.m index 83059477..aa709ab2 100644 --- a/Morison_Element/TestMorisonElement.m +++ b/Morison_Element/TestMorisonElement.m @@ -53,11 +53,13 @@ function checkVisibilityRestored(testCase) function testMorisonElement(testCase) cd('morisonElement') wecSim + close_system('monopile',0) cd(testCase.testDir) end function testMonopile(testCase) cd('monopile') wecSim + close_system('monopile',0) cd(testCase.testDir) end end diff --git a/Multiple_Condition_Runs/TestMultipleConditionRuns.m b/Multiple_Condition_Runs/TestMultipleConditionRuns.m index ba00e8ce..9f227b12 100644 --- a/Multiple_Condition_Runs/TestMultipleConditionRuns.m +++ b/Multiple_Condition_Runs/TestMultipleConditionRuns.m @@ -53,18 +53,22 @@ function checkVisibilityRestored(testCase) function testRM3_MCROPT1(testCase) cd RM3_MCROPT1 wecSimMCR + close_system('RM3',0) end function testRM3_MCROPT2(testCase) cd RM3_MCROPT2 wecSimMCR + close_system('RM3',0) end function testRM3_MCROPT3(testCase) cd RM3_MCROPT3 wecSimMCR + close_system('RM3',0) end function testRM3_MCROPT3_SeaState(testCase) cd RM3_MCROPT3_SeaState wecSimMCR + close_system('RM3',0) end end end diff --git a/Nonlinear_Hydro/TestNonlinearHydro.m b/Nonlinear_Hydro/TestNonlinearHydro.m index acc55824..e1424eac 100644 --- a/Nonlinear_Hydro/TestNonlinearHydro.m +++ b/Nonlinear_Hydro/TestNonlinearHydro.m @@ -53,18 +53,22 @@ function checkVisibilityRestored(testCase) function testNonlinear_Hydro_ode4_Regular(testCase) cd(fullfile('ode4', 'Regular')) wecSim + close_system('ellipsoid',0) end function testNonlinear_Hydro_ode4_RegularCIC(testCase) cd(fullfile('ode4', 'RegularCIC')) wecSim + close_system('ellipsoid',0) end function testNonlinear_Hydro_ode45_Regular(testCase) cd(fullfile('ode45', 'Regular')) wecSim + close_system('ellipsoid',0) end function testNonlinear_Hydro_ode45_RegularCIC(testCase) cd(fullfile('ode45', 'RegularCIC')) wecSim + close_system('ellipsoid',0) end end end diff --git a/OWC/OrificeModel/hydroData/bemio.m b/OWC/OrificeModel/hydroData/bemio.m index 11dd6c02..58154d92 100644 --- a/OWC/OrificeModel/hydroData/bemio.m +++ b/OWC/OrificeModel/hydroData/bemio.m @@ -1,22 +1,43 @@ %% OWC - WAMIT GBM simulation +%% Define the despiking structure +despike = struct(); +despike.negThresh = 1e-3; % the threshold below which negative damping will be removed +despike.N = 5; % will loop the despiking procedure N time before filtering +despike.appFilt = 1; % boolean, 1 to apply low pass filter after despiking -%% Run BEMIO for WAMIT Run and despike the hydro data -% 1) load deSpike.mat, to create structure depSpike in workspace. -% 2) call >> outHydro=badBemioFix_fcn({'test17a.out'},'WAMIT',deSpike,[1,1;3,3;5,5;7,7]) -% This will despike the resonance associated with the OWC moonpool and generate an h5 -% file with the _clean suffix. - -load deSpike.mat -outHydro = badBemioFix_fcn({'test17a.out'},'WAMIT',deSpike,[1,1;3,3;5,5;7,7]); -writeBEMIOH5(outHydro); - -%% Run BEMIO for WAMIT Run - -% hydro = struct(); -% hydro = readWAMIT(hydro,'test17a.out',[]); -% hydro = radiationIRF(hydro,20,[],[],[],11); -% hydro = radiationIRFSS(hydro,20,[]); -% hydro = excitationIRF(hydro,20,[],[],[],11); -% hydro.plotDofs = [1,1;3,3;5,5;7,7]; -% writeBEMIOH5(hydro); -% plotBEMIO(hydro); \ No newline at end of file +% thresholds: applied to 'Threshold' argument of findpeaks +despike.B.Threshold = 2e-4; % damping +despike.A.Threshold = 1e-3; % added mass +despike.ExRe.Threshold = 1e-3; % real part excitation +despike.ExIm.Threshold = 1e-3; % imag part excitation + +% minimum peak prominence, applied to 'MinPeakProminence' argument of findpeaks +despike.B.Prominence = 2e-4; +despike.A.Prominence = 1e-3; +despike.ExRe.Prominence = 1e-3; +despike.ExIm.Prominence = 1e-3; + +% minimum peak distance, applied to 'MinPeakDistance' argument of findpeaks +despike.A.MinPeakDistance = 3; +despike.B.MinPeakDistance = 3; +despike.ExRe.MinPeakDistance = 3; +despike.ExIm.MinPeakDistance = 3; + +% the b and a inputs to MATLAB's filtfilt(b,a,x) function +despike.Filter.b = 0.02008336556421123561544384017452102853 .* [1 2 1]; +despike.Filter.a = [1 -1.561018075800718163392843962355982512236 0.641351538057563175243558362126350402832]; + +%% Read and clean WAMIT results +hydro = struct(); +hydro = readWAMIT(hydro,'test17a.out',[]); +hydro = cleanBEM(hydro,despike); +hydro.file = 'test17a_clean'; + +hydro = radiationIRF(hydro,20,[],[],[],11); +hydro = radiationIRFSS(hydro,20,[]); +hydro = excitationIRF(hydro,20,[],[],[],11); + +hydro.plotDofs = [1,1;3,3;5,5;7,7]; +% plotBEMIO(hydro); + +writeBEMIOH5(hydro); diff --git a/OWC/OrificeModel/hydroData/deSpike.mat b/OWC/OrificeModel/hydroData/deSpike.mat deleted file mode 100644 index cde46166..00000000 Binary files a/OWC/OrificeModel/hydroData/deSpike.mat and /dev/null differ diff --git a/OWC/TestOWC.m b/OWC/TestOWC.m index 918406d6..e10f72f6 100644 --- a/OWC/TestOWC.m +++ b/OWC/TestOWC.m @@ -58,6 +58,7 @@ function checkVisibilityRestored(testCase) function testOWCOrifice(testCase) cd('OrificeModel') wecSim + close_system('OWC_rigid',0) end function testOWCFloating(testCase) @@ -65,6 +66,7 @@ function testOWCFloating(testCase) "MoorDyn is not installed"); cd('FloatingOWC') wecSim + close_system('OWC_GBM',0) end end end \ No newline at end of file diff --git a/Passive_Yaw/PassiveYawRegression/IrrYaw_org.mat b/Passive_Yaw/PassiveYawRegression/IrrYaw_org.mat index a6ff1c2b..dc5e3430 100644 Binary files a/Passive_Yaw/PassiveYawRegression/IrrYaw_org.mat and b/Passive_Yaw/PassiveYawRegression/IrrYaw_org.mat differ diff --git a/Passive_Yaw/PassiveYawRegression/runLoadPassiveYawIrr.m b/Passive_Yaw/PassiveYawRegression/runLoadPassiveYawIrr.m index 74b5d22a..95edd6e6 100644 --- a/Passive_Yaw/PassiveYawRegression/runLoadPassiveYawIrr.m +++ b/Passive_Yaw/PassiveYawRegression/runLoadPassiveYawIrr.m @@ -34,7 +34,7 @@ save('IrrYaw','IrrYaw') %% Plot Old vs. New Comparison -figure(1); % plots of yaw position +figure(); % plots of yaw position subplot(1,2,1) plot(IrrYaw.time_new,IrrYaw.Pos_new,':k','LineWidth',1.4) hold on; grid on; @@ -42,12 +42,12 @@ title('Passive Yaw, irregular wave') xlabel('Time(s)'); ylabel('Yaw position (rad)') subplot(1,2,2) % plots of yaw position -plot(IrrYaw.time_new,IrrYaw.Pos_new,':k','LineWidth',1.4) +plot(IrrYaw.time_new,IrrYaw.Force_new,':k','LineWidth',1.4) hold on; grid on; -plot(IrrYaw.time_org,IrrYaw.Pos_org,'-k') +plot(IrrYaw.time_org,IrrYaw.Force_org,'-k') xlabel('Time(s)'); ylabel('Total Yaw Force (N)') legend('New','Original') -savefig('figYawIrr'); +savefig('figYawIrr'); %% Clear output and .slx directory try diff --git a/Passive_Yaw/TestPassiveYaw.m b/Passive_Yaw/TestPassiveYaw.m index 20b2404a..c108a74b 100644 --- a/Passive_Yaw/TestPassiveYaw.m +++ b/Passive_Yaw/TestPassiveYaw.m @@ -53,10 +53,12 @@ function checkVisibilityRestored(testCase) function testPassiveYawOFF(testCase) cd('PassiveYawOFF') wecSim + close_system('OSWEC',0) end function testPassiveYawON(testCase) cd('PassiveYawON') wecSim + close_system('OSWEC',0) end end end diff --git a/Passive_Yaw/TestPassiveYawRegression.m b/Passive_Yaw/TestPassiveYawRegression.m index 473cb880..dd7a3185 100644 --- a/Passive_Yaw/TestPassiveYawRegression.m +++ b/Passive_Yaw/TestPassiveYawRegression.m @@ -32,7 +32,9 @@ function runYawIrrTest(testCase) cd(fullfile(testCase.testDir, ... 'PassiveYawRegression')) runLoadPassiveYawIrr; + close_system('OSWEC',0) testCase.IrrYaw = load('IrrYaw.mat').("IrrYaw"); + cd(fullfile(testCase.testDir)); end end diff --git a/RM3_PTO_Extension/TestRM3PTOExtension.m b/RM3_PTO_Extension/TestRM3PTOExtension.m index feda1379..75b8de29 100644 --- a/RM3_PTO_Extension/TestRM3PTOExtension.m +++ b/RM3_PTO_Extension/TestRM3PTOExtension.m @@ -53,11 +53,13 @@ function checkVisibilityRestored(testCase) function testRM3_PTO_Extension_float(testCase) cd('float') wecSim + close_system('RM3',0) cd(testCase.testDir) end function testRM3_PTO_Extension_spar(testCase) cd('spar') wecSim + close_system('RM3',0) cd(testCase.testDir) end end diff --git a/Variable_Hydro/TestVariableHydro.m b/Variable_Hydro/TestVariableHydro.m index 11911bc8..8ea87de0 100644 --- a/Variable_Hydro/TestVariableHydro.m +++ b/Variable_Hydro/TestVariableHydro.m @@ -69,10 +69,12 @@ function checkVisibilityRestored(testCase) function testPY(testCase) cd('Passive_Yaw') runCases + close_system('OSWEC',0) end function testVM(testCase) cd('Variable_Mass') wecSim + close_system('OSWEC',0) end end diff --git a/Variable_Hydro/Variable_Mass/sphereVarMass.slx b/Variable_Hydro/Variable_Mass/sphereVarMass.slx index 353e0f77..b62e867f 100644 Binary files a/Variable_Hydro/Variable_Mass/sphereVarMass.slx and b/Variable_Hydro/Variable_Mass/sphereVarMass.slx differ diff --git a/WECCCOMP/TestWECCCOMP.m b/WECCCOMP/TestWECCCOMP.m index d8b677aa..a2b17925 100644 --- a/WECCCOMP/TestWECCCOMP.m +++ b/WECCCOMP/TestWECCCOMP.m @@ -58,10 +58,12 @@ function checkVisibilityRestored(testCase) function testWECCCOMP_Fault(testCase) cd('WECCCOMP_Fault_Implementation') wecSim + close_system('WaveStar',0) end function testWECCCOMP_MPC(testCase) cd('WECCCOMP_Nonlinear_Model_Predictive') wecSim + close_system('WaveStar',0) end end end