Skip to content

Conversation

@kmruehl
Copy link
Collaborator

@kmruehl kmruehl commented Feb 8, 2023

This PR relates to issue #983 and pull request #986 submitted by @yman95

Hello the WEC-Sim team,

Thanks for all the amazing work you have done!

As you may know, NEMOH was updated to v3.0 Dec 2022, and with that, some format changes were made to Nemoh.cal. >Noticeably, on line 27 of Nemoh.cal, there is an additional number at the beginning denoting the unit output of NEMOH.
e.g., 1 50 0.1 2.0 ! Freq type 1,2,3=[rad/s,Hz,s], Number of wave frequencies/periods, Min, and Max

I made the following changes to readNEMOH.m to make it work, from line 92 to 97
92 if isempty(strfind(raw{n},'Number of wave frequencies'))==0
93 tmp = textscan(raw{n},'%f %f %f %f'); % added one more %f
94 hydro(F).Nf = tmp{2}; % Number of wave frequencies %tmp(1) ->2
95 hydro(F).w = linspace(tmp{3},tmp{4},tmp{2}); % Wave frequencies %tmp2,3,1 ->3,4,2
96 hydro(F).T = 2*pi./hydro(F).w; % Wave periods
97 end

Also, I noticed a potential bug on line 173 of readNEMOH.m.
173 if isempty(strfind(raw{n},'Diffraction force'))==0

It is scanning for 'Diffraction force' in ExcitationForce.tec? I generated my ExcitationForce.tec from NEMOH, and by default, >it is
e.g. 8 Zone t="Excitation force - beta = 0.000 deg",I= 100,F=POINT
So the potential solution here is to change line 173 to if isempty(strfind(raw{n},'Excitation force'))==0

And in all of the WEC-Sim examples for BEMIO NEMOH, they have 'Diffraction force' in the ExcitationForce.tec. I'm not sure >if it is done on purpose or a potential bug, so I hope maybe someone from the development team can clarify.

Thanks again for building WEC-Sim. I'm excited to learn and research with this tool!

Best,
Yi

@kmruehl
Copy link
Collaborator Author

kmruehl commented Feb 8, 2023

The first revision makes BEMIO compatible with NEMOH v3.0 by changing readNEMOH.m lines 92 to 97

92 if isempty(strfind(raw{n},'Number of wave frequencies'))==0
93 tmp = textscan(raw{n},'%f %f %f %f'); % added one more %f
94 hydro(F).Nf = tmp{2}; % Number of wave frequencies %tmp(1) ->2
95 hydro(F).w = linspace(tmp{3},tmp{4},tmp{2}); % Wave frequencies %tmp2,3,1 ->3,4,2
96 hydro(F).T = 2*pi./hydro(F).w; % Wave periods
97 end

@kmruehl kmruehl added the BEM/BEMIO related to BEMIO or BEM hydro data label Feb 8, 2023
@kmruehl kmruehl mentioned this pull request Feb 8, 2023
@kmruehl
Copy link
Collaborator Author

kmruehl commented Feb 8, 2023

It's unclear if there's also an issue with line 73 of readNEMOH.m for v3.0.
173 if isempty(strfind(raw{n},'Diffraction force'))==0
it may need to be changed to
if isempty(strfind(raw{n},'Excitation force'))==0

@yman95 do you have a NEMOH 3.0 test case you could share?

@dforbush2
Copy link
Contributor

dforbush2 commented Mar 3, 2023

In all example files provided, 'Diffraction force" is the start string of the data table for both DiffractionForce.tec and ExcitationForce.tec. However, as noted by user, this was manually modified to work with existing readNemoh.m script. User provided attached readNemoh.m script for test purposed. Confirming unmodified output file string then will deploy to *dev.
readNEMOH.txt

I do not currently have push access to this fork.

@dforbush2
Copy link
Contributor

Unmodified nemoh v3.0 files provided by user. readNemoh.m has been updated and user confirmed working. Ready to merge.

@kmruehl kmruehl merged commit f616871 into WEC-Sim:dev Mar 22, 2023
@kmruehl kmruehl deleted the feature_readNEMOH branch September 16, 2024 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BEM/BEMIO related to BEMIO or BEM hydro data Feature new feature request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants