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 bug fixes into dev #900

Merged
merged 10 commits into from
Jul 1, 2022
Prev Previous commit
Next Next commit
[Bug fix] Mac path fixes and make outputDir public (#874)
* Moved simulationClass.outputDir to public.

* Replaced paths with fullfile paths in CompareBEMIO.m. The paths didd not work on Mac due to file separator.

* Update line 38 in reaadAQWA.m so it works on a Mac.

* change filesep in BEMIO examples, update readAQWA fileparts

* Update stopWecSim.m

Replaced hardcoded 'output' string with simu.outputDir.

* Removed clc and close all from initializeWecSim.

It should be up to the user to clear the command windows and close the figures.

Co-authored-by: Lermart96 <anders.brandt@oceanharvesting.com>
Co-authored-by: akeeste <akeeste@sandia.gov>
  • Loading branch information
3 people authored Jun 29, 2022
commit 466c1ce4abecb7d829fa30c137a5b03d31ae3ca4
2 changes: 1 addition & 1 deletion examples/BEMIO/CAPYTAINE/coer_comp/bemio.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
hydro = struct();

hydro = readCAPYTAINE(hydro,'.\coer_comp_full.nc');
hydro = readCAPYTAINE(hydro,'coer_comp_full.nc');
hydro = radiationIRF(hydro,10,[],[],[],[]);
hydro = radiationIRFSS(hydro,[],[]);
hydro = excitationIRF(hydro,20,[],[],[],[]);
Expand Down
2 changes: 1 addition & 1 deletion examples/BEMIO/CAPYTAINE/cubes/bemio.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
hydro = struct();

hydro = readCAPYTAINE(hydro,'.\cubes_full.nc');
hydro = readCAPYTAINE(hydro,'cubes_full.nc');
hydro = radiationIRF(hydro,30,[],[],[],[]);
hydro = radiationIRFSS(hydro,[],[]);
hydro = excitationIRF(hydro,200,[],[],[],[]);
Expand Down
2 changes: 1 addition & 1 deletion examples/BEMIO/CAPYTAINE/cylinder/bemio.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
hydro = struct();

hydro = readCAPYTAINE(hydro,'.\cylinder_full.nc');
hydro = readCAPYTAINE(hydro,'cylinder_full.nc');
hydro = radiationIRF(hydro,15,[],[],[],[]);
hydro = radiationIRFSS(hydro,[],[]);
hydro = excitationIRF(hydro,15,[],[],[],[]);
Expand Down
2 changes: 1 addition & 1 deletion examples/BEMIO/CAPYTAINE/ellipsoid/bemio.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
hydro = struct();

hydro = readCAPYTAINE(hydro,'.\ellipsoid_full.nc');
hydro = readCAPYTAINE(hydro,'ellipsoid_full.nc');
hydro = radiationIRF(hydro,15,[],[],[],[]);
hydro = radiationIRFSS(hydro,[],[]);
hydro = excitationIRF(hydro,15,[],[],[],[]);
Expand Down
2 changes: 1 addition & 1 deletion examples/BEMIO/CAPYTAINE/oswec/bemio.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
hydro = struct();

hydro = readCAPYTAINE(hydro,'.\oswec_full.nc');
hydro = readCAPYTAINE(hydro,'oswec_full.nc');
hydro = radiationIRF(hydro,40,[],[],[],[]);
hydro = radiationIRFSS(hydro,[],[]);
hydro = excitationIRF(hydro,75,[],[],[],[]);
Expand Down
2 changes: 1 addition & 1 deletion examples/BEMIO/CAPYTAINE/rm3/bemio.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
hydro = struct();

hydro = readCAPYTAINE(hydro,'.\rm3_full.nc');
hydro = readCAPYTAINE(hydro,'rm3_full.nc');
hydro = radiationIRF(hydro,60,[],[],[],1.9);
hydro = radiationIRFSS(hydro,[],[]);
hydro = excitationIRF(hydro,157,[],[],[],1.9);
Expand Down
2 changes: 1 addition & 1 deletion examples/BEMIO/CAPYTAINE/sphere/bemio.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
hydro = struct();

hydro = readCAPYTAINE(hydro,'.\sphere_full.nc');
hydro = readCAPYTAINE(hydro,'sphere_full.nc');
hydro = radiationIRF(hydro,15,[],[],[],[]);
hydro = radiationIRFSS(hydro,[],[]);
hydro = excitationIRF(hydro,15,[],[],[],[]);
Expand Down
4 changes: 2 additions & 2 deletions examples/BEMIO/NEMOH/Coer_Comp/bemio.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
hydro = struct();

hydro = readNEMOH(hydro,'..\Coer_Comp\');
% hydro = readWAMIT(hydro,'..\..\WAMIT\Coer_Comp\coer_comp.out',[]);
hydro = readNEMOH(hydro,'../Coer_Comp/');
% hydro = readWAMIT(hydro,'../../WAMIT/Coer_Comp/coer_comp.out',[]);
% hydro = combineBEM(hydro); % Compare to WAMIT
hydro = radiationIRF(hydro,10,[],[],[],[]);
hydro = radiationIRFSS(hydro,[],[]);
Expand Down
4 changes: 2 additions & 2 deletions examples/BEMIO/NEMOH/Cubes/bemio.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
hydro = struct();

hydro = readNEMOH(hydro,'..\Cubes\');
% hydro = readWAMIT(hydro,'..\..\WAMIT\Cubes\cubes.out',[]);
hydro = readNEMOH(hydro,'../Cubes/');
% hydro = readWAMIT(hydro,'../../WAMIT/Cubes/cubes.out',[]);
% hydro = combineBEM(hydro); % Compare WAMIT
hydro = radiationIRF(hydro,20,[],[],[],[]);
hydro = radiationIRFSS(hydro,[],[]);
Expand Down
4 changes: 2 additions & 2 deletions examples/BEMIO/NEMOH/Cylinder/bemio.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
hydro = struct();

hydro = readNEMOH(hydro,'..\Cylinder\');
% hydro = readWAMIT(hydro,'..\..\WAMIT\Cylinder\cyl.out',[]);
hydro = readNEMOH(hydro,'../Cylinder/');
% hydro = readWAMIT(hydro,'../../WAMIT/Cylinder/cyl.out',[]);
% hydro = combineBEM(hydro); % Compare to WAMIT
hydro = radiationIRF(hydro,5,[],[],[],[]);
hydro = radiationIRFSS(hydro,[],[]);
Expand Down
4 changes: 2 additions & 2 deletions examples/BEMIO/NEMOH/Ellipsoid/bemio.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
hydro = struct();

hydro = readNEMOH(hydro,'..\Ellipsoid\');
% hydro = readWAMIT(hydro,'..\..\WAMIT\Ellipsoid\ellipsoid.out',[]);
hydro = readNEMOH(hydro,'../Ellipsoid/');
% hydro = readWAMIT(hydro,'../../WAMIT/Ellipsoid/ellipsoid.out',[]);
% hydro = combineBEM(hydro); % Compare to WAMIT
hydro = radiationIRF(hydro,10,[],[],[],[]);
hydro = radiationIRFSS(hydro,[],[]);
Expand Down
4 changes: 2 additions & 2 deletions examples/BEMIO/NEMOH/OSWEC/bemio.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
hydro = struct();

hydro = readNEMOH(hydro,'..\OSWEC\');
% hydro = readWAMIT(hydro,'..\..\WAMIT\OSWEC\oswec.out',[]);
hydro = readNEMOH(hydro,'../OSWEC/');
% hydro = readWAMIT(hydro,'../../WAMIT/OSWEC/oswec.out',[]);
% hydro = combineBEM(hydro); % Compare WAMIT
hydro = radiationIRF(hydro,20,[],[],[],[]);
hydro = radiationIRFSS(hydro,[],[]);
Expand Down
4 changes: 2 additions & 2 deletions examples/BEMIO/NEMOH/RM3/bemio.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
hydro = struct();

hydro = readNEMOH(hydro,'..\RM3\');
% hydro = readWAMIT(hydro,'..\..\WAMIT\RM3\rm3.out',[]);
hydro = readNEMOH(hydro,'../RM3/');
% hydro = readWAMIT(hydro,'../../WAMIT/RM3/rm3.out',[]);
% hydro = combineBEM(hydro); % Compare WAMIT
hydro = radiationIRF(hydro,60,[],[],[],1.9);
hydro = radiationIRFSS(hydro,[],[]);
Expand Down
4 changes: 2 additions & 2 deletions examples/BEMIO/NEMOH/Sphere/bemio.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
hydro = struct();

hydro = readNEMOH(hydro,'..\Sphere\');
% hydro = readWAMIT(hydro,'..\..\WAMIT\Sphere\sphere.out',[]);
hydro = readNEMOH(hydro,'../Sphere/');
% hydro = readWAMIT(hydro,'../../WAMIT/Sphere/sphere.out',[]);
% hydro = combineBEM(hydro); % Compare to WAMIT
hydro = radiationIRF(hydro,15,[],[],[],[]);
hydro = radiationIRFSS(hydro,[],[]);
Expand Down
24 changes: 12 additions & 12 deletions examples/BEMIO/compareBEMIO.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

% Load WAMIT hydro data
WAMIT_hydro = struct();
WAMIT_out = '.\WAMIT\Sphere\sphere.out';
WAMIT_out = fullfile('.', 'WAMIT', 'Sphere', 'sphere.out');
WAMIT_hydro = readWAMIT(WAMIT_hydro,WAMIT_out,[]);
WAMIT_hydro = radiationIRF(WAMIT_hydro,15,[],[],[],[]);
WAMIT_hydro = excitationIRF(WAMIT_hydro,15,[],[],[],[]);
Expand All @@ -14,15 +14,15 @@

% Load AQWA hydro data
AQWA_hydro = struct();
AQWA_AH1 = '.\AQWA\Sphere\sphere.AH1';
AQWA_LIS = '.\AQWA\Sphere\sphere.LIS';
AQWA_AH1 = fullfile('.','AQWA', 'Sphere', 'sphere.AH1');
AQWA_LIS = fullfile('.','AQWA', 'Sphere', 'sphere.LIS');
AQWA_hydro = readAQWA(AQWA_hydro, AQWA_AH1, AQWA_LIS);
AQWA_hydro = radiationIRF(AQWA_hydro,15,[],[],[],[]);
AQWA_hydro = excitationIRF(AQWA_hydro,15,[],[],[],[]);

% Load Capytaine hydro data
CAP_hydro = struct();
CAP_nc = '.\Capytaine\Sphere\sphere_full.nc';
CAP_nc = fullfile('.', 'Capytaine', 'Sphere', 'sphere_full.nc');
CAP_hydro = readCAPYTAINE(CAP_hydro,CAP_nc);
CAP_hydro = radiationIRF(CAP_hydro,15,[],[],[],[]);
CAP_hydro = excitationIRF(CAP_hydro,15,[],[],[],[]);
Expand All @@ -43,29 +43,29 @@

% Load WAMIT hydro data
WAMIT_hydro = struct();
WAMIT_out = '.\WAMIT\RM3\rm3.out';
WAMIT_out = fullfile('.', 'WAMIT', 'RM3', 'rm3.out');
WAMIT_hydro = readWAMIT(WAMIT_hydro,WAMIT_out,[]);
WAMIT_hydro = radiationIRF(WAMIT_hydro,60,[],[],[],[]);
WAMIT_hydro = excitationIRF(WAMIT_hydro,20,[],[],[],[]);

% Load AQWA hydro data
AQWA_hydro = struct();
AQWA_AH1 = '.\AQWA\RM3\RM3.AH1';
AQWA_LIS = '.\AQWA\RM3\RM3.LIS';
AQWA_AH1 = fullfile('.', 'AQWA', 'RM3', 'RM3.AH1');
AQWA_LIS = fullfile('.', 'AQWA', 'RM3', 'RM3.LIS');
AQWA_hydro = readAQWA(AQWA_hydro, AQWA_AH1, AQWA_LIS);
AQWA_hydro = radiationIRF(AQWA_hydro,60,[],[],[],[]);
AQWA_hydro = excitationIRF(AQWA_hydro,20,[],[],[],[]);

% Load Capytaine hydro data
CAP_hydro = struct();
CAP_nc = '.\Capytaine\RM3\rm3_full.nc';
CAP_nc = fullfile('.', 'Capytaine', 'RM3', 'rm3_full.nc');
CAP_hydro = readCAPYTAINE(CAP_hydro,CAP_nc);
CAP_hydro = radiationIRF(CAP_hydro,60,[],[],[],1.9);
CAP_hydro = excitationIRF(CAP_hydro,20,[],[],[],1.9);

% Load NEMOH hydro data
NEMOH_hydro = struct();
NEMOH_dir = '.\NEMOH\RM3';
NEMOH_dir = fullfile('.', 'NEMOH', 'RM3');
NEMOH_hydro = readNEMOH(NEMOH_hydro,NEMOH_dir);
NEMOH_hydro = radiationIRF(NEMOH_hydro,60,[],[],[],1.9);
NEMOH_hydro = excitationIRF(NEMOH_hydro,20,[],[],[],1.9);
Expand All @@ -86,15 +86,15 @@

% Load WAMIT hydro data
WAMIT_hydro = struct();
WAMIT_out = '.\WAMIT\WEC3\wec3.out';
WAMIT_out = fullfile('.', 'WAMIT', 'WEC3', 'wec3.out');
WAMIT_hydro = readWAMIT(WAMIT_hydro,WAMIT_out,[]);
WAMIT_hydro = radiationIRF(WAMIT_hydro,160,[],[],[],[]);
WAMIT_hydro = excitationIRF(WAMIT_hydro,160,[],[],[],[]);

% Load AQWA hydro data
AQWA_hydro = struct();
AQWA_AH1 = '.\AQWA\WEC3\wec3.AH1';
AQWA_LIS = '.\AQWA\WEC3\wec3.LIS';
AQWA_AH1 = fullfile('.', 'AQWA', 'WEC3', 'wec3.AH1');
AQWA_LIS = fullfile('.', 'AQWA', 'WEC3', 'wec3.LIS');
AQWA_hydro = readAQWA(AQWA_hydro, AQWA_AH1, AQWA_LIS);
AQWA_hydro = radiationIRF(AQWA_hydro,160,[],[],[],[]);
AQWA_hydro = excitationIRF(AQWA_hydro,160,[],[],[],[]);
Expand Down
4 changes: 2 additions & 2 deletions source/functions/BEMIO/readAQWA.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@

hydro(F).code = 'AQWA';
V182 = 0; % Set AqwaVersion flag "Version 18.2 or larger" to 0
tmp = strsplit(ah1Filename,{' ','\','.'});
hydro(F).file = tmp{length(tmp)-1}; % Base filename
[~,tmp,~] = fileparts(ah1Filename);
hydro(F).file = tmp; % Base filename

fileID = fopen(ah1Filename);
raw1 = textscan(fileID,'%[^\n\r]'); %Read/copy raw output, ah1
Expand Down
2 changes: 1 addition & 1 deletion source/functions/initializeWecSim.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

%% Start WEC-Sim log
% Clear old input, plots, log file and start new log file.
clc; diary off; close all;
diary off
clear body waves simu output pto constraint ptoSim mooring values names InParam
try delete('*.log'); end
diary('simulation.log')
Expand Down
2 changes: 1 addition & 1 deletion source/functions/stopWecSim.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
cd(pctDir);
simu.caseDir = [simu.caseDir filesep pctDir];
end
outputFile = [simu.caseDir filesep 'output' filesep simu.caseFile];
outputFile = [simu.caseDir filesep simu.outputDir filesep simu.caseFile];
save(outputFile,'-v7.3')
if exist('pctDir')
filename = sprintf('savedData%03d.mat', imcr);
Expand Down
2 changes: 1 addition & 1 deletion source/objects/simulationClass.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
stateSpace = 0 % (`integer`) Flag for convolution integral or state-space calculation, Options: 0 (convolution integral), 1 (state-space). Default = ``0``
startTime = 0 % (`float`) Simulation start time. Default = ``0`` s
zeroCross = 'DisableAll' % (`string`) Disable zero cross control. Default = ``'DisableAll'``
outputDir = 'output' % (`string`) Data output directory name. Default = ``'output'``
end

properties (SetAccess = 'public', GetAccess = 'public') % internal WEC-Sim
Expand All @@ -83,7 +84,6 @@
date = datetime % (`string`) Simulation date and time
gitCommit = [] % (`string`) GitHub commit
maxIt = [] % (`integer`) Total number of simulation time steps. Approximate for variable step solvers. Default = dependent
outputDir = 'output' % (`string`) Data output directory name. Default = ``'output'``
wsVersion = '5.0' % (`string`) WEC-Sim version
end

Expand Down