Skip to content

Conversation

@yuyihsiang
Copy link
Contributor

@yuyihsiang yuyihsiang commented Oct 27, 2020

Modified the wecSim.m file and created wecSimMATLABPCT.m and wecSimFcn.m files

This allows the user to run MCR using the MATLAB Parallel Computing Toolbox Execute this feature by running:

wecSimMATLABPCT

@kmruehl kmruehl self-requested a review October 27, 2020 22:41
@kmruehl kmruehl added Feature new feature request MCR/PCT multiple condition runs (wecSimMCR) and/or parallel computing toolbox (wecSimPCT) labels Oct 27, 2020
@kmruehl
Copy link
Collaborator

kmruehl commented Oct 28, 2020

@yuyihsiang is there any way for me to test this functionality? Also, can you allow me to push to your fork so that I can make a minor revision? I would like to change the name of the function to wecSimFcn for consistency. I have these changes locally but cannot push to your fork. Thank you.

Copy link
Collaborator

@kmruehl kmruehl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made some minor revisions to this, including changing the name of the function.

But I'm unable to run this for all MCR cases from our MCR Application cases.

RM3_MCROPT1

waves.H = 1.5:1:2.5;                   	% Wave Height [m]
waves.T = 6:2:8;                        % Wave Period [s]

errors with:

Error using waveClass/waveSetup (line 201)
Matrix dimensions must agree.

Error in wecSim (line 151)
waves.waveSetup(body(1).hydroData.simulation_parameters.w, body(1).hydroData.simulation_parameters.water_depth,
simu.rampTime, simu.dt, simu.maxIt, simu.g, simu.rho,  simu.endTime);

Error in wecSimFcn (line 4)
wecSim

Error in wecSimMATLABPCT (line 104)
parfor imcr=1:length(mcr.cases(:,1))

RM3_MCROPT3 errors with:

Error using wecSim (line 348)
Unable to write to MAT-file
C:\Users\kmruehl\Documents\GitHub\WEC-Sim\WEC-Sim_Applications\Multiple_Condition_Runs\RM3_MCROPT3\output\RM3_matlabWorkspace.mat.
The file may be corrupt.

Error in wecSimFcn (line 4)
wecSim

Error in wecSimMATLABPCT (line 104)
parfor imcr=1:length(mcr.cases(:,1))

@kmruehl
Copy link
Collaborator

kmruehl commented Oct 29, 2020

@yuyihsiang What about storing the hydroData between runs like we do for MCR (see snippet from wecSimMCR)?

%% Store hydrodata in memory for reuse in future runs.
    if simu.reloadH5Data == 0 && imcr == 1        % Off->'0', On->'1', (default = 0)  
        for ii = 1:simu.numWecBodies 
            hydroData(ii) = body(ii).hydroData;
        end
    end

Copy link
Collaborator

@kmruehl kmruehl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yuyihsiang please make changes to resolve the issue with RM3_MCROPT3_SeaState and then this is ready for a merge. Also, feel free to modify the docs/man/advanced_features.rst PCT section.

Fix the path issue for reading the two wave files when using PCT
Copy link
Collaborator

@kmruehl kmruehl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing RM3_MCROPT3_SeaState right now... @yuyihsiang it works, thanks!

@kmruehl
Copy link
Collaborator

kmruehl commented Oct 30, 2020

@yuyihsiang can you review https://github.com/WEC-Sim/WEC-Sim/pull/438/conflicts and see which should be passed into wecSimFcn?

Also, these lines don't seem to suppress the warning for me

warning('off', 'MATLAB:MKDIR:DirectoryExists');
warning('off','MATLAB:DELETE:FileNotFound'); 

yuyihsiang added 4 commits October 30, 2020 10:35
Add warning('off', 'MATLAB:MKDIR:DirectoryExists'); to wecSimPCT.m
Remove the makewecSimFcn.m since it has been renamed.
remove the "warning off" from wecSimFcn.m since they are no longer needed.
Fix userDefineFunctions.
@kmruehl
Copy link
Collaborator

kmruehl commented Oct 30, 2020

@yuyihsiang this looks great, thanks! I'm merging it right now.

@kmruehl kmruehl merged commit 47a2e53 into WEC-Sim:dev Oct 30, 2020
kmruehl added a commit that referenced this pull request Oct 30, 2020
* Update Morison Elemnet with decomposed flow vector

* Update Morison Element with Decomposition

* Correct inputs to ME function

* Change Morrison to Morison

* Small ME block changes

* Update to Morison Element Implementation

This commit has verified the implementatino of the normal and tangential Morison Element written by the initial pull request developer. The WEC-Sim team has chosen to keep both implementations active for users. Therefore, additional code development was needed to make this possible for the end user.

* changing function name

* updating bodyClass comment

* end stop implementation

* Update advanced_features.rst

Updating the Morison Element documentation to reflect the two modeling approaches provided for the user.

* Update WECSim_Lib.slx

Updating the WECSim_Lib.slx.

It appears that the conflict resolution over wrote the updates in the Morison Element block. Therefore, had to reconfigure the ME and make a correction in the calculation as well.

* Fix MATLAB Parallel Computing Toolbox support issue

* Update advanced_features.rst

Adding to the documentation after being able to compile locally.

* adding PCT to docs

* Update WECSim_Lib.slx

Update the WECSim_Lib.slx to fix broken links in the Flex Body block.

* renamed to wecSimPCT and minor update to wecSimMCR

* cleaning up batch run scripts removing commented lines

* fixed library masks

* remove mask comment

* Update wecSim.m

Fix the path issue for reading the two wave files when using PCT

* save library as 2019a

* Update advanced_features.rst

Update the PCT documentation

* renaming to wecSimFcn

* adding drag bod and hardstop doc rsts

* minor edit hard stop doc

* Remove warning

Add warning('off', 'MATLAB:MKDIR:DirectoryExists'); to wecSimPCT.m

* updates

Remove the makewecSimFcn.m since it has been renamed.
remove the "warning off" from wecSimFcn.m since they are no longer needed.

* Update bodyClass.m and wecSim.m to add a check on the

Code updates were made to the bodyClass.m and wecSim.m files to check when using option 1 for the Morison Element that the body(i).morisonElement.z vector is a unit normal vector.

* Update wecSim.m

Fix userDefineFunctions.

* library saved to 2015b

* Update WECSim_Lib.slx, bodyClass.m, simulationClass.m, and documentation

Updated the attached files to keep simu.morisonElement = 1 the same as the past implementation which setting simu.morisonElement = 2 for the new normal and tangential formulation.

* Add WEC-Sim MCR capability using MATLAB parallel computing toolbox (#438)

* Fix MATLAB Parallel Computing Toolbox support issue

* adding PCT to docs

* renamed to wecSimPCT and minor update to wecSimMCR

* cleaning up batch run scripts removing commented lines

* Update wecSim.m

Fix the path issue for reading the two wave files when using PCT

* Update advanced_features.rst

Update the PCT documentation

* renaming to wecSimFcn

* Remove warning

Add warning('off', 'MATLAB:MKDIR:DirectoryExists'); to wecSimPCT.m

* updates

Remove the makewecSimFcn.m since it has been renamed.
remove the "warning off" from wecSimFcn.m since they are no longer needed.

* Update wecSim.m

Fix userDefineFunctions.

Co-authored-by: Kelley Ruehl <kmruehl@sandia.gov>

* minor doc updates

* initializing with NaNs and adding warnings

* Update WECSim_Lib.slx

Update the WECSim_Lib.slx Flex Body block. The wave diffraction and excitation block as well as the hydrostatic restoring block cannot be linked to their equivalent block in the rigid body block.

* adding warning flags and changing ME properties to NaN

Co-authored-by: Lily Nguyen <lily.nguyen@nrel.gov>
Co-authored-by: nathanmtom <nathan.tom@nrel.gov>
Co-authored-by: Kelley Ruehl <kmruehl@sandia.gov>
Co-authored-by: yuyihsiang <yi-hsiang.yu@nrel.gov>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature new feature request MCR/PCT multiple condition runs (wecSimMCR) and/or parallel computing toolbox (wecSimPCT)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants