Skip to content

Commit

Permalink
Update readNEMOH.m for compatibility with NEMOH v3.0 (WEC-Sim#1105)
Browse files Browse the repository at this point in the history
* Update readNEMOH.m for compatibility with NEMOH v3.0

* Removing line 374

This capability is within Dev, but not currently pulled over to Master. A separate PR was submitted to Dev for this fix.
  • Loading branch information
nathanmtom authored Aug 22, 2023
1 parent 24b7ff3 commit 60e7c6f
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions source/functions/BEMIO/readNEMOH.m
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,24 @@
hydro(F).body{b} = tmp{length(tmp)-1}; % Body names
end
if isempty(strfind(raw{n},'Number of wave frequencies'))==0
tmp = textscan(raw{n},'%f %f %f');
hydro(F).Nf = tmp{1}; % Number of wave frequencies
hydro(F).w = linspace(tmp{2},tmp{3},tmp{1}); % Wave frequencies
hydro(F).T = 2*pi./hydro(F).w; % Wave periods
tmp = textscan(raw{n},'%f %f %f %f');
if isempty(tmp{end})
hydro(F).Nf = tmp{1}; % Number of wave frequencies
hydro(F).w = linspace(tmp{2},tmp{3},tmp{1}); % Wave frequencies
hydro(F).T = 2*pi./hydro(F).w; % Wave periods
else
hydro(F).Nf = tmp{2}; % Number of wave frequencies
if tmp{1} == 1
hydro(F).w = linspace(tmp{3},tmp{4},tmp{2}); % Wave frequencies
hydro(F).T = 2*pi./hydro(F).w; % Wave periods
elseif tmp{1} == 2
hydro(F).w = 2*pi*linspace(tmp{3},tmp{4},tmp{2}); % Wave frequencies
hydro(F).T = 2*pi./hydro(F).w; % Wave periods
else
hydro(F).T = linspace(tmp{3},tmp{4},tmp{2}); % Wave periods
hydro(F).w = 2*pi./hydro(F).T; % Wave frequencies
end
end
end
if isempty(strfind(raw{n},'Number of wave directions'))==0
tmp = textscan(raw{n},'%f %f %f');
Expand Down Expand Up @@ -170,7 +184,7 @@
N = length(raw);
i = 0;
for n = 1:N
if isempty(strfind(raw{n},'Diffraction force'))==0
if isempty(strfind(raw{n},'Excitation force'))==0 || isempty(strfind(raw{n},'Diffraction force'))==0
i = i+1;
for k = 1:hydro(F).Nf
tmp = textscan(raw{n+k},'%f');
Expand Down

0 comments on commit 60e7c6f

Please sign in to comment.