-
Notifications
You must be signed in to change notification settings - Fork 184
Full dir spectra (resolved conflicts) #1332
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
Conversation
|
Sorry Jeff. Lets talk to Adam and see what changes were made. we may be able to add them to this PR. Apologies I didn't realize this was waiting on me for a merge. |
|
No problem. I thought I had left a comment for you to review it, but I guess I didn't |
|
To do:
|
|
@dforbush2 I've resolved the conflicts but haven't reviewed this PR yet. Could you send me the scripts you were using to test out the feature? |
|
@jtgrasb you can use the input data 'fullDirWave.mat' I have sent via email. These are (frequency, amplitude, direction, spread) as specified. You will need an input file with I recommend the Pioneer as a test case. |
|
Thanks @dforbush2. I tried the full directional spectrum with the pioneer example and I am getting some errors. I resolved some of them, but looks like there's some variable size issues, so if you could take a look at some point in the next couple weeks, that would be great. Here's a zip for the test case: pioneerTest.zip |
|
@jtgrasb this is good to go! HOWEVER: at this time it will not work with non-linear hydro. That will require another variant subsystem and library change, and I think is best reserved for a future PR. |
|
This looks great and functionality seems to work well! A few questions/suggestions:
|
|
Can you please post the error You are seeing when run with wave markers? I believe I fixed that…And local testing it does work. I can add the necessary clear statement to stopWecSim. Thank you for the reminder.
…________________________________
From: jtgrasb ***@***.***>
Sent: Tuesday, December 10, 2024 8:33:05 AM
To: WEC-Sim/WEC-Sim ***@***.***>
Cc: Forbush, Dominic Dean ***@***.***>; Mention ***@***.***>
Subject: [EXTERNAL] Re: [WEC-Sim/WEC-Sim] Full dir spectra (resolved conflicts) (PR #1332)
This looks great and functionality seems to work well! A few questions/suggestions:
1. Looks like this doesn't work with wave markers either. Is that intentional? Since spectrum import works with the wave markers, we should be able to get this working with wave markers, right?
2. Can you add the Simulink variant variables (e.g. sv_fullDirIrregularWaves_b*) to the clear line in stopWecSim?
—
Reply to this email directly, view it on GitHub<#1332 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AHF2G7HCTH2NL67RZMEOSFT2E4CTDAVCNFSM6AAAAABPHWHAZ2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMZSGA3TEMBUHE>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
|
Thanks good catch. That logic statement should also include the new typeNum which I think is 35.
You can also make these changes if you want, let me know.
…________________________________
From: jtgrasb ***@***.***>
Sent: Tuesday, December 10, 2024 9:07:51 AM
To: WEC-Sim/WEC-Sim ***@***.***>
Cc: Forbush, Dominic Dean ***@***.***>; Mention ***@***.***>
Subject: [EXTERNAL] Re: [WEC-Sim/WEC-Sim] Full dir spectra (resolved conflicts) (PR #1332)
It doesn't produce an error, it just doesn't plot the wave markers. There's a line in initializeWecSim where the visualization is only on if typeNum is less than 30:
image.png (view on web)<https://github.com/user-attachments/assets/0da02f49-66f6-45f4-b1c1-0ce49d1effe0>
—
Reply to this email directly, view it on GitHub<#1332 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AHF2G7BPGV4MTXROZASW3E32E4GVPAVCNFSM6AAAAABPHWHAZ2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMZSGE3DGOJWGY>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
|
@jtgrasb tested on pioneer and everything works. This is ready to merge, but please give the docs a read and make sure it is clear enough. This shouldn't prevent a merge at this time, I can fix docs later, but worth some more eyes. |
| if obj.yaw.option ==1 && length(BEMdir)<3 || std(diff(BEMdir))>5 || max(boundDiff)>15 | ||
| warning(['Passive yaw is not recommended without BEM data spanning a full yaw rotation -180 to 180 dg.' newline ... | ||
| 'Please inspect BEM data for gaps']) | ||
| clear BEMdir boundDiff | ||
| clear boundDiff | ||
| end | ||
| if ~isempty(dirBins) | ||
| BEMdir=wrapTo180(BEMdir-180); | ||
| boundDiff(1)=abs(min(dirBins,[],'all') - BEMdir(1)); boundDiff(2)=min(abs(max(dirBins,[],'all') - BEMdir(end)),... | ||
| abs(max(dirBins,[],'all')-180-BEMdir(1))); | ||
| [obj.hydroForce.(hfName).fExt.qDofGrd,null,obj.hydroForce.(hfName).fExt.qWGrd]=ndgrid([1:nDOF],dirBins(1,:),wv); % this is necessary for nd interpolation; query grids be same size as dirBins. | ||
| if length(BEMdir)<3 || max(boundDiff)>15 | ||
| warning(['BEM directions do not cover the directional spread bins or are too coarse to define spread bin distribution.' newline ... | ||
| 'Re-run with more bins']); | ||
| clear boundDiff BEMdir | ||
| end | ||
| end | ||
| [sortedDir,idx]=sort(wrapTo180(obj.hydroData(iH).simulation_parameters.direction)); | ||
| [hdofGRD,hdirGRD,hwGRD]=ndgrid(1:6,sortedDir, obj.hydroData(iH).simulation_parameters.w); | ||
| [obj.hydroForce.(hfName).fExt.dofGrd,obj.hydroForce.(hfName).fExt.dirGrd,obj.hydroForce.(hfName).fExt.wGrd]=ndgrid(1:6,... | ||
| [hdofGRD,hdirGRD,hwGRD]=ndgrid([1:nDOF],sortedDir, obj.hydroData(iH).simulation_parameters.w); | ||
| if (max(sortedDir) - min(sortedDir)) < 360 | ||
| warning('Full directional wave spectra requires full 360 dg BEM. You do not have that. Attempting to fix via spline extrapolation. Ideally preprocess BEM') | ||
| if min(sortedDir) > -180 | ||
| sortedDir2=zeros(1,length(sortedDir)+1); | ||
| sortedDir2(2:end)=sortedDir; | ||
| sortedDir2(1)=-180; | ||
| sortedDir=sortedDir2; | ||
| clear sortedDir2; | ||
| end | ||
| if max(sortedDir) < 180 | ||
| sortedDir2=zeros(1,length(sortedDir2+1)); | ||
| sortedDir2(1:end-1)=sortedDir; | ||
| sortedDir2(end)=-180; | ||
| sortedDir=sortedDir2; | ||
| clear sortedDir2; | ||
| end | ||
|
|
||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wave direction binning
| [obj.hydroForce.(hfName).fExt.dofGrd,obj.hydroForce.(hfName).fExt.dirGrd,obj.hydroForce.(hfName).fExt.wGrd]=ndgrid([1:nDOF],... | ||
| sortedDir,wv); | ||
| obj.hydroForce.(hfName).fExt.fEHRE=interpn(hdofGRD,hdirGRD,hwGRD,obj.hydroData(iH).hydro_coeffs.excitation.re(:,idx,:),... | ||
| obj.hydroForce.(hfName).fExt.dofGrd,obj.hydroForce.(hfName).fExt.dirGrd,obj.hydroForce.(hfName).fExt.wGrd)*rho*g; | ||
| obj.hydroForce.(hfName).fExt.dofGrd,obj.hydroForce.(hfName).fExt.dirGrd,obj.hydroForce.(hfName).fExt.wGrd,'spline')*rho*g; | ||
| obj.hydroForce.(hfName).fExt.fEHIM=interpn(hdofGRD,hdirGRD,hwGRD,obj.hydroData(iH).hydro_coeffs.excitation.im(:,idx,:),... | ||
| obj.hydroForce.(hfName).fExt.dofGrd,obj.hydroForce.(hfName).fExt.dirGrd,obj.hydroForce.(hfName).fExt.wGrd)*rho*g; | ||
| obj.hydroForce.(hfName).fExt.dofGrd,obj.hydroForce.(hfName).fExt.dirGrd,obj.hydroForce.(hfName).fExt.wGrd,'spline')*rho*g; | ||
| obj.hydroForce.(hfName).fExt.fEHMD=interpn(hdofGRD,hdirGRD,hwGRD,obj.hydroData(iH).hydro_coeffs.mean_drift(:,idx,:)... | ||
| ,obj.hydroForce.(hfName).fExt.dofGrd,obj.hydroForce.(hfName).fExt.dirGrd,obj.hydroForce.(hfName).fExt.wGrd)*rho*g; | ||
| ,obj.hydroForce.(hfName).fExt.dofGrd,obj.hydroForce.(hfName).fExt.dirGrd,obj.hydroForce.(hfName).fExt.wGrd,'spline')*rho*g; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
grid interpolation becomes spline


This PR is a for #1328 and attempts to resolve the merge conflicts.