WEC-Sim / WEC-Sim

Wave Energy Converter Simulator (WEC-Sim), an open-source code for simulating wave energy converters.
https://wec-sim.github.io/WEC-Sim
Apache License 2.0
149 stars 163 forks source link

[Feature request] Memory usage - Flag to save (or not) panels pressure with non-linear hydrodynamics #670

Closed mmartini1987 closed 3 years ago

mmartini1987 commented 3 years ago

Note: italicized text below is include as an example and should be updated before submission. If you feel any section is not applicable to your request, please replace with 'N/A' rather than delete a section.

Is your feature request related to a problem? Please describe. _Dear WEC-Sim developers, I am running a non-linear hydrodynamic simulation (nlHydro=2) of a flap-type device. I am unable to run simulations longer than approx. 3600s, as my computer runs out of memory. I noticed that in the workspace there are very large variables related to non-linear hydrodynamics that likely collapse my memory, namely: "body1_hspressure_out", "body1_wavelinearpressure_out", "body1_wavenonlinearpressureout" and so on. I understand these are not required for the simulation to run, but only to store pressure values on each panel.

Describe the solution you'd like Is there a way to avoid these variables to be saved into the workspace? I could not find anything on the WEC-Sim guide.

Describe alternatives you've considered I considered modifying myself the WEC-Sim source code but I do not want to alter the code.

Personal project context N/A

Additional context N/A

akeeste commented 3 years ago

Hello @mmartini1987

Thanks for reopening with the template. Currently I do not see a way to use the nonlinear hydro option without saving the body pressure data. You can currently change the output time step for the pressure data with simu.dtNL but that also changes the time step of the force calculations. I will link this issue to our project board for a feature enhancement.

Can you also give the follow for context:

I am a bit surprised that the number of panels does not cause an unusably slow computational speed before the computer memory is filled. Though I can see how this might happen for a very long computation time with a small time step.

Adam

akeeste commented 3 years ago

@kmruehl Thanks for the clarification.

@mmartini1987 Actually we do have a variable that should determine if pressure data is saved: simu.pressureDis. However right now this only determines if the body1_hspressure_out and other pressure variables are saved into the response class, not whether Simulink saves the variable in the first place.

mmartini1987 commented 3 years ago

Thank you very much for your prompt and kind response - and apologies if I initially opened the issue without using the template (nice and simple way to organise the forum, by the way).

@kmruehl I have two hydrodynamic bodies for this device: a base, fixed to the bottom, with ~2600 STL panels, and a flap, hinged at the base, with ~8500 STL panels. I am counting STL panels by counting the occurrences of "facet normal" in the STL file, opening it with Notepad++. Such numbers are confirmed when I look at the variables "bodyX_wavelinearpressure_out" and similar. For reference, the GDF files have 668 and 2129 panels for the base and the flap, respectively. I note that the "flap.stl" file within the OSWEC example provided with WEC-Sim accounts for ~1000 panels. Would you suggest a lower number of STL panels? For information, I have created the STL files in Rhino from the GDF by clicking on File->Save As, then picking "Stereolithography (.stl)", then '"Save geometry only", then "ASCII" as file type.

Additionally, simu.dt and simu.dtOut are 0.05 s; I have my simulation crashed when simu.endTime is 10900 s (I am at running 3 hours simulations, I have a ramp-up time of 100 s).

@akeeste, thanks for the detail, so I assume all pressure values for all panels are currently stored into the workspace during the simulation and then passed to the response class.

akeeste commented 3 years ago

@mmartini1987 I discussed with the rest of the development team and we have a few more suggestions that can help with your memory issues:

Please let me know if these suggestions help your case. If not we can revisit changing the simu.pressureDis flag to stop simulink from saving pressure data at all. Adam

mmartini1987 commented 3 years ago

Hi @akeeste, many thanks the suggestions from you and your team.

I believe the most effective solution is producing an .stl with fewer panels, noting your suggestion to have a number of panels similar to that of the .gdf. This will surely help. From my side the issue is closed.

Thanks again and best regards from Italy

Michele