From 46067a010a898d48e542091c0485888cb9b5e0db Mon Sep 17 00:00:00 2001 From: Adam Keester <72414466+akeeste@users.noreply.github.com> Date: Wed, 22 Sep 2021 08:33:25 -0600 Subject: [PATCH] Documentation updates for FY21 Q4 (#707) * miscellaneous cleanup * update run from sim documentation and terminology formatting * update responseClass API * fix nonlinear capitalization --- .github/ISSUE_TEMPLATE/bug_report.md | 5 +- .github/ISSUE_TEMPLATE/developer-issue.md | 2 +- docs/_include/terminology.rst | 2 +- docs/_include/viz.rst | 34 +++--- docs/introduction/release_notes.rst | 4 +- docs/theory/theory.rst | 4 +- docs/user/advanced_features.rst | 108 ++++++++++++------ docs/user/applications.rst | 2 +- docs/user/code_structure.rst | 2 +- docs/user/troubleshooting.rst | 6 +- docs/user/workflow.rst | 18 ++- examples/OSWEC/wecSimInputFile.m | 4 +- examples/RM3/wecSimInputFile.m | 12 +- examples/RM3FromSimulink/wecSimInputFile.m | 8 +- source/functions/initializeWecSim.m | 8 +- .../functions/paraview/write_paraview_body.m | 2 +- source/functions/postProcess.m | 2 +- source/objects/bodyClass.m | 4 +- source/objects/mooringClass.m | 2 +- source/objects/responseClass.m | 86 +++++++------- source/objects/simulationClass.m | 2 +- source/objects/waveClass.m | 2 + 22 files changed, 176 insertions(+), 143 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index ff930b730..55ae750ce 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,6 +1,6 @@ --- name: Bug report -about: Create a report to help us asses and resolve a potential bug +about: Create a report to help us assess and resolve a potential bug title: "[BUG]" labels: bug assignees: '' @@ -14,6 +14,7 @@ _A clear and concise description of what the perceived bug is._ **WEC-Sim file(s)** _If known, please identify the the WEC-Sim files causing the bug or error:_ +_Please upload relevant case files if possible to speed debugging._ **To Reproduce** _Steps to reproduce the behavior:_ @@ -22,6 +23,8 @@ _Steps to reproduce the behavior:_ 3. _Scroll down to '....'_ 4. _See error_ +_State method of running WEC-Sim (command line, from simulink with input file, from simulink with custom parameters)_ + **Expected behavior** _A clear and concise description of what you expected to happen._ diff --git a/.github/ISSUE_TEMPLATE/developer-issue.md b/.github/ISSUE_TEMPLATE/developer-issue.md index dc2db4a86..6edc91cc4 100644 --- a/.github/ISSUE_TEMPLATE/developer-issue.md +++ b/.github/ISSUE_TEMPLATE/developer-issue.md @@ -1,7 +1,7 @@ --- name: Developer Issue about: For the use of the development team to note issues associated with the development - of WEC-Sim + of WEC-Sim. Users please use an alternate template. title: "[Developer Issue]" labels: '' assignees: '' diff --git a/docs/_include/terminology.rst b/docs/_include/terminology.rst index 52cc5a142..8877d2de6 100644 --- a/docs/_include/terminology.rst +++ b/docs/_include/terminology.rst @@ -70,7 +70,7 @@ JS JONSWAP Spectrum :math:`\omega` Wave frequency (rad/s), :math:`\omega = \frac{2\pi}{T}` :math:`\phi` Wave phase (rad) :math:`\sigma` Wave spectrum coefficient (JONSWAP) -:math:`\gamma` Wave spectrum non-dimensional peak shape parameter +:math:`\gamma` Wave spectrum nondimensional peak shape parameter Pitch (Ry) Rotation about the Y-axis PM Pierson-Moskowitz Specturm :math:`P_{PTO}` Power from the PTO diff --git a/docs/_include/viz.rst b/docs/_include/viz.rst index 560b6c060..5d7076436 100644 --- a/docs/_include/viz.rst +++ b/docs/_include/viz.rst @@ -4,7 +4,7 @@ This section describes how to use ParaView for visualizing data from a WEC-Sim s Using ParaView visualization improves on the SimMechanics explorer by: * Visualizing the wave field -* Visualizing the cell-by-cell non-linear hydrodynamic forces (when using nonlinear buoyancy and Froude-Krylov wave excitation) +* Visualizing the cell-by-cell nonlinear hydrodynamic forces (when using nonlinear buoyancy and Froude-Krylov wave excitation) * Allowing data manipulation and additional visualization options However, the SimMechanics explorer shows the following information not included in the ParaView visualization: @@ -50,9 +50,9 @@ The following table lists the WEC-Sim simulation parameters that can be specifie +---------------------------+-----------------------------------------------------------+ | ``simu.pathParaviewVideo``| directory to create ParaView visualization files | +---------------------------+-----------------------------------------------------------+ -| | ``simu.nlHydro`` | | 0 for no non-linear hydro [default] | -| | | 1 for non-linear hydro with mean free surface | -| | | 2 for non-linear hydro with instantaneous free surface | +| | ``simu.nlHydro`` | | 0 for no nonlinear hydro [default] | +| | | 1 for nonlinear hydro with mean free surface | +| | | 2 for nonlinear hydro with instantaneous free surface | +---------------------------+-----------------------------------------------------------+ | ``simu.domainSize`` | size of ground and water planes in meters [default 200] | +---------------------------+-----------------------------------------------------------+ @@ -106,35 +106,35 @@ An example using Paraview for visualization of WEC-Sim data is provided in the ` The **RM3_MoorDyn_Viz** example uses ParaView for WEC-Sim data visualization of a WEC-Sim model coupled with [MoorDyn](http://wec-sim.github.io/WEC-Sim/advanced_features.html#moordyn) to simulate a mooring system for the [RM3](http://wec-sim.github.io/WEC-Sim/tutorials.html#two-body-point-absorber-rm3) geometry. -Non-Linear Hydro Visualization in ParaView +Nonlinear Hydro Visualization in ParaView ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -When using non-linear buoyancy and Froude-Krylov Wave Excitation the paraview files also contain cell data for the bodies. +When using nonlinear buoyancy and Froude-Krylov wave excitation the paraview files also contain cell data for the bodies. The cell data are: * Cell areas * Hydrostatic pressures * Linear Froude-Krylov pressures -* Non-linear Froude-Krylov pressures +* Nonlinear Froude-Krylov pressures The ``pressureGlyphs`` macro calculates cell normals, and cell centers. It then creates the following glyphs: -* Hydrostatic Pressure +* Hydrostatic pressure * Linear Froude-Krylov pressure -* Non-linear Froude-Krylov pressure -* Total pressure (hydrostatic plus non-linear Froude-Krylov) -* Froude-Krylov delta (non-linear minus linear) +* Nonlinear Froude-Krylov pressure +* Total pressure (hydrostatic plus nonlinear Froude-Krylov) +* Froude-Krylov delta (nonlinear minus linear) -To view WEC-Sim non-linear hydro data in ParaView: +To view WEC-Sim nonlinear hydro data in ParaView: * Open the ``$CASE/vtk/.pvd`` file in ParaView * Select the WEC-Sim model in the pipeline, and run the ``WEC-Sim`` macro * Move the camera to desired view -* Select the non-linear hydro body in the pipeline, and run the ``pressureGlyphs`` macro +* Select the nonlinear hydro body in the pipeline, and run the ``pressureGlyphs`` macro * Select which features to visualize in the pipeline * Click the green arrow (play) button The video below shows three different views of the RM3 model described in the tutorials. -The top right shows glyphs of the non-linear Froude-Krylov pressure acting on the float. +The top right shows glyphs of the nonlinear Froude-Krylov pressure acting on the float. The bottom right shows the float colored by hydrostatic pressure. .. raw:: html @@ -142,8 +142,8 @@ The bottom right shows the float colored by hydrostatic pressure. -An example using Paraview for visualization of non-linear hydro WEC-Sim data is provided in the ``Paraview_Visualization`` directory on the `WEC-Sim Applications `_ repository. -The **OSWEC_NonLinear_Viz** example uses ParaView for WEC-Sim data visualization of a WEC-Sim model with [Non-linear Hydro](http://wec-sim.github.io/WEC-Sim/advanced_features.html#nonlinear-buoyancy-and-froude-krylov-excitation) to simulate non-linear wave excitation on the flap of the [OSWEC](http://wec-sim.github.io/WEC-Sim/tutorials.html#oscillating-surge-wec-oswec) geometry. +An example using Paraview for visualization of nonlinear hydro WEC-Sim data is provided in the ``Paraview_Visualization`` directory on the `WEC-Sim Applications `_ repository. +The **OSWEC_NonLinear_Viz** example uses ParaView for WEC-Sim data visualization of a WEC-Sim model with [nonlinear Hydro](http://wec-sim.github.io/WEC-Sim/advanced_features.html#nonlinear-buoyancy-and-froude-krylov-excitation) to simulate nonlinear wave excitation on the flap of the [OSWEC](http://wec-sim.github.io/WEC-Sim/tutorials.html#oscillating-surge-wec-oswec) geometry. Loading a ParaView State File ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -154,4 +154,4 @@ If a previous `*.pvsm`` ParaView state file was saved, the state can be applied * Select the desired ``$CASE/.pvsm`` Paraview state file to apply * Select the "Search files under specified directory" option, specify the desired WECS-Sim ``$CASE/vtk/`` directory, and click ``OK`` -Paraview state files are provided for both **Paraview_Visualization** examples on the `WEC-Sim Applications `_ repository, one for the RM3 using MoorDyn, and another for the OSWEC with non-linear hydro. \ No newline at end of file +Paraview state files are provided for both **Paraview_Visualization** examples on the `WEC-Sim Applications `_ repository, one for the RM3 using MoorDyn, and another for the OSWEC with nonlinear hydro. \ No newline at end of file diff --git a/docs/introduction/release_notes.rst b/docs/introduction/release_notes.rst index 8536c3376..6b4f380d0 100644 --- a/docs/introduction/release_notes.rst +++ b/docs/introduction/release_notes.rst @@ -181,7 +181,7 @@ Previous Releases `WEC-Sim v2.2 `_ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -* Added option to save pressure data for non-linear hydro (`simu.pressureDis`) +* Added option to save pressure data for nonlinear hydro (`simu.pressureDis`) * Update to moorDyn parser (doesn't require line#.out) @@ -252,7 +252,7 @@ Previous Releases * State space radiation * Wave directionality * User-defined wave elevation time-series -* Imports non-dimensionalized BEMIO hydrodynamic data (instead of fully dimensional coefficients) +* Imports nondimensionalized BEMIO hydrodynamic data (instead of fully dimensional coefficients) * Variant Subsystems implemented to improve code stability (instead of if statements) * Bug fixes diff --git a/docs/theory/theory.rst b/docs/theory/theory.rst index ab09897e1..ab7ff3295 100644 --- a/docs/theory/theory.rst +++ b/docs/theory/theory.rst @@ -63,7 +63,7 @@ for the velocity potential, which assumes the flow is inviscid, incompressible, and irrotational. More details on the theory for the frequency-domain BEM can be found in :cite:`Lee2006`. -WEC-Sim imports non-dimensionalized hydrodynamic coefficients from an ``*.h5`` +WEC-Sim imports nondimensionalized hydrodynamic coefficients from an ``*.h5`` data structure generated by :ref:`user-advanced-features-bemio` for the BEM solvers: WAMIT, AQWA, NEMOH or CAPYTAINE. Alternatively, the ``*.h5`` data structure can be manually defined by the user. The WEC-Sim code scales the hydrodynamic @@ -477,7 +477,7 @@ spectrum :cite:`IEC-2` is defined by: S_{JS}\left( f \right) = C_{ws} \left(\gamma\right) S_{PM} \gamma^{\alpha} -where :math:`\gamma` is the non-dimensional peak-shape parameter. +where :math:`\gamma` is the nondimensional peak-shape parameter. The normalizing factor, :math:`C_{ws}\left(\gamma\right)`, is defined as: diff --git a/docs/user/advanced_features.rst b/docs/user/advanced_features.rst index 14be0c12e..f6f109e0d 100644 --- a/docs/user/advanced_features.rst +++ b/docs/user/advanced_features.rst @@ -37,6 +37,76 @@ This section provides an overview of WEC-Sim's simulation class features; for more information about the simulation class code structure, refer to :ref:`user-code-structure-simulation-class`. +Running WEC-Sim +^^^^^^^^^^^^^^^ + +The subsection describes the various ways to run WEC-Sim. The standard method is +to type the command ``wecSim`` in the MATLAB command window when in a ``$CASE`` +directory. This is the same method described in the :ref:`user-workflow` and +:ref:`user-tutorials` sections. + + +.. _user-advanced-features-fcn: + +Running as Function +""""""""""""""""""" + +WEC-Sim allows users to execute WEC-Sim as a function by using ``wecSimFcn``. +This option may be useful for users who wish to devise their own batch runs, +isolate the WEC-Sim workspace, create a special set-up before running WEC-Sim, +or link to another software. + + +.. _user-advanced-features-simulink: + +Running from Simulink +""""""""""""""""""""" + +Beginning in version 4.3, WEC-Sim can also be run from Simulink. The Run From +Simulink advanced feature allows users to initialize WEC-Sim from the command +window and then begin the simulation from Simulink. This allows greater +compatibility with other models or hardware-in-the-loop simulations that must +start in Simulink. The WEC-Sim library contains mask options that allow users to +either: + + 1. Define an standard input file to use in WEC-Sim or + 2. Define custom parameters inside the block masks. + +The Global Reference Frame mask controls whether an input file or custom +parameters are used for WEC-Sim. Note that when the Custom Parameters options is +selected, WEC-Sim will only use those variable in the block masks. Certain options +become visible when the correct flag is set. For example, ``body.morisonElement.cd`` +will not be visible unless ``body.morisonElement.on > 0``. This method of running +WEC-Sim may help some users visualize the interplay between the blocks and classes. +For more information on how the blocks and classes are related, see the +:ref:`user-code-structure` section. + +To run WEC-Sim from Simulink, open the Simulink ``.slx`` file and choose whether to +use an input file or custom parameters in the Global Reference Frame. Next type +``initializeWecSim`` in the MATLAB Command Window. Lastly, run the model from the +Simulink interface: + +* Run from Simulink with a wecSimInputFile.m + * Set the Global Reference Frame to use an input file + * Choose the correct input file + * Type ``initializeWecSim`` in the Command Window + * Run the model from Simulink +* Run from Simulink with custom parameters + * Set the Global Reference Frame to use custom parameters + * (Optional) prefill parameters by loading an input file. + * Edit custom parameters as desired + * Type ``initializeWecSim`` in the Command Window + * Run the model from Simulink + +.. Note:: + After running WEC-Sim from Simulink with custom parameters, a + ``wecSimInputFile_simulinkCustomParameters.m`` file is written to the ``$CASE`` + directory. This file specifies all non-default WEC-Sim parameters used for the + WEC-Sim simulation. This file serves as a record of how the case was run for + future reference. It may be used in the same manner as other input files when + renamed to ``wecSimInputFile.m`` + + .. _user-advanced-features-mcr: Multiple Condition Runs (MCR) @@ -104,44 +174,6 @@ setting for ``simu.reloadH5Data`` in the WEC-Sim input file. Please use ``userDefinedFunctions.m`` instead. -.. _user-advanced-features-fcn: - -Running as Function -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -WEC-Sim allows users to execute WEC-Sim as a function by using ``wecSimFcn``. - - - -.. _user-advanced-features-simulink: - -Running from Simulink -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Beginning in version 4.3, WEC-Sim can also be run from Simulink. -The WEC-Sim library now allows for an input file or custom parameters to be used inside the block masks. -This mode is useful when using WEC-Sim in conjunction with hardware-in-the-loop or other Simulink models with their own initialization. -To run WEC-Sim from Simulink, open the Simulink ``.slx`` file and choose whether to use an input file or custom parameters in the Global Reference Frame. -Next type ``initializeWecSim`` in the MATLAB Command Window. -Lastly, run the model from the Simulink interface. - -* Run from Simulink with a wecSimInputFile.m - * Set the Global Reference Frame to use an input file - * Choose the correct input file - * Type ``initializeWecSim`` in the Command Window - * Run the model from Simulink -* Run from Simulink with custom parameters - * Set the Global Reference Frame to use custom parameters - * (Optional) prefill parameters by loading an input file. - * Edit custom parameters as desired - * Type ``initializeWecSim`` in the Command Window - * Run the model from Simulink - -Upon completion of a WEC-Sim simulation run from Simulink a ``wecSimInputFile_simulinkCustomParameters.m`` file is written to the ``$CASE`` directory including the WEC-Sim parameters used for the WEC-Sim simulation. - -Refer to :ref:`user-tutorials-examples` for more details on how to run the examples - - State-Space Representation ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/docs/user/applications.rst b/docs/user/applications.rst index 798ef6e58..3e238b9ce 100644 --- a/docs/user/applications.rst +++ b/docs/user/applications.rst @@ -90,7 +90,7 @@ Nonlinear Hydrodynamic Body Example using :ref:`Nonlinear Hydro ` to run WEC-Sim for a :ref:`heaving ellipsoid `. -Includes examples of running non-linear hydrodynamics with different :ref:`fixed and +Includes examples of running nonlinear hydrodynamics with different :ref:`fixed and variable time-step solvers ` (ode4/ode45), and different regular wave formulations (with/without CIC). Execute the `runNL.m` script to run this case. diff --git a/docs/user/code_structure.rst b/docs/user/code_structure.rst index 7ab926c9f..358233ec2 100644 --- a/docs/user/code_structure.rst +++ b/docs/user/code_structure.rst @@ -31,7 +31,7 @@ WEC-Sim Simulink Library ``WECSim_Lib.slx`` ``$WECSIM/source/lib`` The WEC-Sim executable is the ``wecSim.m`` file. Executing ``wecSim`` from a case directory parses the user input data, -performs preprocessing calculations in each of the classes, selects and +performs pre-processing calculations in each of the classes, selects and initializes variant subsystems in the Simulink model, runs the time-domain simulations in WEC-Sim, and calls post-processing scripts. When a WEC-Sim case is properly set-up, the user only needs to use the single command ``wecSim`` diff --git a/docs/user/troubleshooting.rst b/docs/user/troubleshooting.rst index 6b593ddb6..d2f531d86 100644 --- a/docs/user/troubleshooting.rst +++ b/docs/user/troubleshooting.rst @@ -156,9 +156,9 @@ If a CIC wave continues to oscillate without decaying to a steady state, the con Increase ``simu.CITime`` to a greater value or use the state space option (``simu.ssCalc=1``). In BEMIO, check that the convolution integral time is long enough for all oscillations to decay. -**Non-linear Hydrodynamics:** -If a user wishes to use the non-linear hydro options, they should first follow this same workflow with ``simu.nlHydro=0`` and again with ``simu.nlHydro=1,2`` -The non-linear hydro options are difficult to set-up and must be used with care. +**Nonlinear Hydrodynamics:** +If a user wishes to use the nonlinear hydro options, they should first follow this same workflow with ``simu.nlHydro=0`` and again with ``simu.nlHydro=1,2`` +The nonlinear hydro options are difficult to set-up and must be used with care. A highly refined mesh is required to get an accurate displaced volume and wetted surface area at each time step. diff --git a/docs/user/workflow.rst b/docs/user/workflow.rst index 4a5c0d17d..4935b1d13 100644 --- a/docs/user/workflow.rst +++ b/docs/user/workflow.rst @@ -249,21 +249,17 @@ geometry file(s) ``*.stl``, and the hydrodynamic data file (``*.h5``) . Step 5: Run WEC-Sim ^^^^^^^^^^^^^^^^^^^ -Lastly, WEC-Sim can be executed from the ``$CASE`` directory using the following methods: +Lastly, WEC-Sim can be executed from the ``$CASE`` directory using the following method: - -* Run from MATLAB Command Window (for RM3 and OSWEC examples) * Type ``wecSim`` in the Command Window -* Run from Simulink (for RM3FromSimulink example) - * Open the relevant WEC-Sim Simulink file - * Type ``initializeWecSim`` in the Command Window - * Hit Play in Simulink model to run -Refer to :ref:`user-tutorials-examples` for more details on how to run the examples. To customize or develop a new WEC-Sim model that runs from Simlunk (e.g. for Hardware-in-the-Loop, HIL, applications) refer to :ref:`user-advanced-features-simulink` for more information. +Refer to :ref:`user-tutorials-examples` for more details on how to run the examples. -Users may also use ``wecSimMCR``, ``wecSimPCT``, ``wecSimFcn`` and as described in the advanced features -sections :ref:`user-advanced-features-mcr`, :ref:`user-advanced-features-pct`, and :ref:`user-advanced-features-fcn`. -These options are only available in through the MATLAB Command Window. +Users may also run WEC-Sim from Simulink, or use the commands ``wecSimMCR``, +``wecSimPCT``, and ``wecSimFcn`` as described in the advanced features +sections :ref:`user-advanced-features-simulink`, +:ref:`user-advanced-features-mcr`, :ref:`user-advanced-features-pct`, +and :ref:`user-advanced-features-fcn`. .. Note:: The WEC-Sim source code is located in the ``$WECSIM`` directory, but WEC-Sim must be executed from the ``$CASE`` directory. diff --git a/examples/OSWEC/wecSimInputFile.m b/examples/OSWEC/wecSimInputFile.m index 995045a02..766af7462 100644 --- a/examples/OSWEC/wecSimInputFile.m +++ b/examples/OSWEC/wecSimInputFile.m @@ -2,10 +2,10 @@ simu = simulationClass(); % Initialize Simulation Class simu.simMechanicsFile = 'OSWEC.slx'; % Specify Simulink Model File simu.mode = 'normal'; % Specify Simulation Mode ('normal','accelerator','rapid-accelerator') -simu.explorer='on'; % Turn SimMechanics Explorer (on/off) +simu.explorer = 'on'; % Turn SimMechanics Explorer (on/off) simu.startTime = 0; % Simulation Start Time [s] simu.rampTime = 100; % Wave Ramp Time [s] -simu.endTime=400; % Simulation End Time [s] +simu.endTime = 400; % Simulation End Time [s] simu.solver = 'ode4'; % simu.solver = 'ode4' for fixed step & simu.solver = 'ode45' for variable step simu.dt = 0.1; % Simulation Time-Step [s] simu.CITime = 30; % Specify CI Time [s] diff --git a/examples/RM3/wecSimInputFile.m b/examples/RM3/wecSimInputFile.m index b3ae790fd..238f72b96 100644 --- a/examples/RM3/wecSimInputFile.m +++ b/examples/RM3/wecSimInputFile.m @@ -2,10 +2,10 @@ simu = simulationClass(); % Initialize Simulation Class simu.simMechanicsFile = 'RM3.slx'; % Specify Simulink Model File simu.mode = 'normal'; % Specify Simulation Mode ('normal','accelerator','rapid-accelerator') -simu.explorer='on'; % Turn SimMechanics Explorer (on/off) +simu.explorer = 'on'; % Turn SimMechanics Explorer (on/off) simu.startTime = 0; % Simulation Start Time [s] simu.rampTime = 100; % Wave Ramp Time [s] -simu.endTime=400; % Simulation End Time [s] +simu.endTime = 400; % Simulation End Time [s] simu.solver = 'ode4'; % simu.solver = 'ode4' for fixed step & simu.solver = 'ode45' for variable step simu.dt = 0.1; % Simulation time-step [s] @@ -56,12 +56,12 @@ %% Body Data % Float body(1) = bodyClass('hydroData/rm3.h5'); - %Create the body(1) Variable, Set Location of Hydrodynamic Data File - %and Body Number Within this File. + % Create the body(1) Variable, Set Location of Hydrodynamic Data File + % and Body Number Within this File. body(1).geometryFile = 'geometry/float.stl'; % Location of Geomtry File body(1).mass = 'equilibrium'; - %Body Mass. The 'equilibrium' Option Sets it to the Displaced Water - %Weight. + % Body Mass. The 'equilibrium' Option Sets it to the Displaced Water + % Weight. body(1).momOfInertia = [20907301 21306090.66 37085481.11]; %Moment of Inertia [kg*m^2] % Spar/Plate diff --git a/examples/RM3FromSimulink/wecSimInputFile.m b/examples/RM3FromSimulink/wecSimInputFile.m index 689fcfeda..c638934ba 100644 --- a/examples/RM3FromSimulink/wecSimInputFile.m +++ b/examples/RM3FromSimulink/wecSimInputFile.m @@ -56,12 +56,12 @@ %% Body Data % Float body(1) = bodyClass('hydroData/rm3.h5'); - %Create the body(1) Variable, Set Location of Hydrodynamic Data File - %and Body Number Within this File. + % Create the body(1) Variable, Set Location of Hydrodynamic Data File + % and Body Number Within this File. body(1).geometryFile = 'geometry/float.stl'; % Location of Geomtry File body(1).mass = 'equilibrium'; - %Body Mass. The 'equilibrium' Option Sets it to the Displaced Water - %Weight. + % Body Mass. The 'equilibrium' Option Sets it to the Displaced Water + % Weight. body(1).momOfInertia = [20907301 21306090.66 37085481.11]; %Moment of Inertia [kg*m^2] % Spar/Plate diff --git a/source/functions/initializeWecSim.m b/source/functions/initializeWecSim.m index 151f63ffe..6c8ec41b3 100644 --- a/source/functions/initializeWecSim.m +++ b/source/functions/initializeWecSim.m @@ -223,7 +223,7 @@ waves.waveSetup([], [], simu.rampTime, simu.dt, simu.maxIt, simu.g, simu.rho, simu.endTime); end -% Non-linear hydro +% Nonlinear hydro for kk = 1:length(body(1,:)) if (body(kk).nlHydro >0) || (simu.paraview == 1) body(kk).bodyGeo(body(kk).geometryFile) @@ -303,14 +303,14 @@ % Check for etaImport with nlHydro for ii = 1:simu.numWecBodies if strcmp(waves.type,'etaImport') && body(ii).nlHydro == 1 - error(['Cannot run WEC-Sim with non-linear hydro (body(ii).nlHydro) and "etaImport" wave type']) + error(['Cannot run WEC-Sim with nonlinear hydro (body(ii).nlHydro) and "etaImport" wave type']) end end % Check for etaImport with morisonElement for ii = 1:simu.numWecBodies if strcmp(waves.type,'etaImport') && body(ii).morisonElement.option ~= 0 - error(['Cannot run WEC-Sim with Morrison Element (body(ii).morisonElement.option>0) and "etaImport" wave type']) + error(['Cannot run WEC-Sim with Morison Element (body(ii).morisonElement.option>0) and "etaImport" wave type']) end end @@ -362,7 +362,7 @@ end; clear ii; % yawNonLin Activation yawNonLin=simu.yawNonLin; -% Morrison Element +% Morison Element for ii=1:length(body(1,:)) if body(ii).nhBody ~=1 eval(['morisonElement_' num2str(ii) ' = body(ii).morisonElement.option;']) diff --git a/source/functions/paraview/write_paraview_body.m b/source/functions/paraview/write_paraview_body.m index a43d15937..63b72a8c3 100644 --- a/source/functions/paraview/write_paraview_body.m +++ b/source/functions/paraview/write_paraview_body.m @@ -96,7 +96,7 @@ function write_paraview_body(body, t, pos_all, bodyname, model, simdate, hspress fprintf(fid, '\n'); fprintf(fid,' \n'); end - % Non-Linear Froude-Krylov Wave Pressure + % Nonlinear Froude-Krylov Wave Pressure if ~isempty(wavenonlinearpressure) fprintf(fid,' \n'); for ii = 1:numFace diff --git a/source/functions/postProcess.m b/source/functions/postProcess.m index b2eba9a81..444bb62ab 100644 --- a/source/functions/postProcess.m +++ b/source/functions/postProcess.m @@ -37,7 +37,7 @@ eval(['bodiesOutput(' num2str(iBod) ').wpressurel = body' num2str(iBod) '_wavelinearpressure_out;']); else if body(iBod).nlHydro ==0 && simu.pressureDis == 1 - warning('Pressure distribution on the body is only output when wecSim is run with non-linear hydro (simu.pressureDis == 1 && simu.nlHydro~=0 && body(i).nhBody==0)') + warning('Pressure distribution on the body is only output when wecSim is run with nonlinear hydro (simu.pressureDis == 1 && simu.nlHydro~=0 && body(i).nhBody==0)') end bodiesOutput(iBod).hspressure = []; bodiesOutput(iBod).wpressurenl = []; diff --git a/source/objects/bodyClass.m b/source/objects/bodyClass.m index 9f986eabf..894005209 100644 --- a/source/objects/bodyClass.m +++ b/source/objects/bodyClass.m @@ -525,7 +525,7 @@ function regExcitation(obj,w,waveDir,rho,g,yawFlag) BEMdir=sort(obj.hydroData.simulation_parameters.wave_dir); boundDiff(1)=abs(-180 - BEMdir(1)); boundDiff(2)=abs(180 - BEMdir(end)); if length(BEMdir)<3 || std(diff(BEMdir))>5 || max(boundDiff)>15 - warning(['Non-linear yaw is not recommended without BEM data spanning a full yaw rotation -180 to 180 dg.' newline 'Please inspect BEM data for gaps']) + warning(['Nonlinear 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 end % wrap BEM directions -180 to 180 dg, if they are not already there [sortedDir,idx]=sort(wrapTo180(obj.hydroData.simulation_parameters.wave_dir)); @@ -568,7 +568,7 @@ function irrExcitation(obj,wv,numFreq,waveDir,rho,g,yawFlag) BEMdir=sort(obj.hydroData.simulation_parameters.wave_dir); boundDiff(1)=abs(-180 - BEMdir(1)); boundDiff(2)=abs(180 - BEMdir(end)); if length(BEMdir)<3 || std(diff(BEMdir))>5 || max(boundDiff)>15 - warning(['Non-linear yaw is not recommended without BEM data spanning a full yaw rotation -180 to 180 dg.' newline 'Please inspect BEM data for gaps']) + warning(['Nonlinear 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 end [sortedDir,idx]=sort(wrapTo180(obj.hydroData.simulation_parameters.wave_dir)); diff --git a/source/objects/mooringClass.m b/source/objects/mooringClass.m index 09f66f62e..1de34b7c5 100755 --- a/source/objects/mooringClass.m +++ b/source/objects/mooringClass.m @@ -106,4 +106,4 @@ function listInfo(obj) fprintf('\n\t***** Mooring Name: %s *****\n',obj.name) end end -end \ No newline at end of file +end diff --git a/source/objects/responseClass.m b/source/objects/responseClass.m index 8e63638f9..83adfdf9f 100644 --- a/source/objects/responseClass.m +++ b/source/objects/responseClass.m @@ -27,73 +27,73 @@ % % , it includes: % - % * ``type`` (`string`) = 'waveType' - % * ``time`` (`array`) = [# of time-steps x 1] - % * ``elevation`` (`array`) = [# of time-steps x 1] - % * ``waveGauge1Elevation`` (`array`) = [# of time-steps x 1] - % * ``waveGauge2Elevation`` (`array`) = [# of time-steps x 1] - % * ``waveGauge3Elevation`` (`array`) = [# of time-steps x 1] + % * ``type`` (`string`) = 'waveType'. Wave type used in the simulation + % * ``time`` (`array`) = [# of time-steps x 1] Simulation output timeseries. Used in the wave elevation calculations. + % * ``elevation`` (`array`) = [# of time-steps x 1] Wave elevation at the origin (0,0) + % * ``waveGauge1Elevation`` (`array`) = [# of time-steps x 1] Wave elevation at gauge 1 location + % * ``waveGauge2Elevation`` (`array`) = [# of time-steps x 1] Wave elevation at gauge 2 location + % * ``waveGauge3Elevation`` (`array`) = [# of time-steps x 1] Wave elevation at gauge 3 location % %.. autoattribute:: objects.responseClass.bodies % % , it includes: % - % * ``name`` (`string`) = 'bodyName' - % * ``time`` (`array`) = [# of time-steps x 1] - % * ``position`` (`array`) = [# of time-steps x 6] - % * ``velocity`` (`array`) = [# of time-steps x 6] - % * ``accleration`` (`array`) = [# of time-steps x 6] - % * ``forceTotal`` (`array`) = [# of time-steps x 6] - % * ``forceExcitation`` (`array`) = [# of time-steps x 6] - % * ``forceRadiationDamping`` (`array`) = [# of time-steps x 6] - % * ``forceAddedMass`` (`array`) = [# of time-steps x 6] - % * ``forceRestoring`` (`array`) = [# of time-steps x 6] - % * ``forceMorisonAndViscous`` (`array`) = [# of time-steps x 6] - % * ``forceLinearDamping`` (`array`) = [# of time-steps x 6] + % * ``name`` (`string`) = 'bodyName' Body name + % * ``time`` (`array`) = [# of time-steps x 1] Simulation output timeseries + % * ``position`` (`array`) = [# of time-steps x 6] 6-DOF body position in the global coordinate system + % * ``velocity`` (`array`) = [# of time-steps x 6] 6-DOF body velocity in the global coordinate system + % * ``accleration`` (`array`) = [# of time-steps x 6] 6-DOF body acceleration in the global coordinate system + % * ``forceTotal`` (`array`) = [# of time-steps x 6] Summation of all hydrodynamic forces acting on the body + % * ``forceExcitation`` (`array`) = [# of time-steps x 6] Wave excitation force exerted by the body + % * ``forceRadiationDamping`` (`array`) = [# of time-steps x 6] Radiation Damping force exerted by the body + % * ``forceAddedMass`` (`array`) = [# of time-steps x 6] Added mass force exerted by the body + % * ``forceRestoring`` (`array`) = [# of time-steps x 6] Hydrostatic restoring force exerted by the body + % * ``forceMorisonAndViscous`` (`array`) = [# of time-steps x 6] Sum of the Morison element and viscous drag forces exerted by the body + % * ``forceLinearDamping`` (`array`) = [# of time-steps x 6] Linear damping force exerted by the body % - % There are 4 additional ``output.bodies`` arrays when using non-linear hydro and Paraview output: + % There are 4 additional ``output.bodies`` arrays when using nonlinear hydro and Paraview output: % - % * ``cellPressures_time`` (`array`) = [# of Paraview time-steps x 1] - % * ``cellPressures_hydrostatic`` (`array`) = [# of Paraview time-steps x # of mesh faces] - % * ``cellPressures_waveLinear`` (`array`) = [# of Paraview time-steps x # of mesh faces] - % * ``cellPressures_waveNonLinear`` (`array`) = [# of Paraview time-steps x # of mesh faces] + % * ``cellPressures_time`` (`array`) = [# of Paraview time-steps x 1] Nonlinear calculation timeseries + % * ``cellPressures_hydrostatic`` (`array`) = [# of Paraview time-steps x # of mesh faces] Hydrostatic pressure on each stl facet + % * ``cellPressures_waveLinear`` (`array`) = [# of Paraview time-steps x # of mesh faces] Excitation pressure on each stl facet given zero displacement and the mean free surface + % * ``cellPressures_waveNonLinear`` (`array`) = [# of Paraview time-steps x # of mesh faces] Excitation pressure on each stl facet given the instantaneous displacement and instantaneous free surface % %.. autoattribute:: objects.responseClass.ptos % % , it includes: % - % * ``name`` (`string`) = 'ptoName' - % * ``time`` (`array`) = [# of time-steps x 1] - % * ``position`` (`array`) = [# of time-steps x 6] - % * ``velocity`` (`array`) = [# of time-steps x 6] - % * ``accleration`` (`array`) = [# of time-steps x 6] - % * ``forceTotal`` (`array`) = [# of time-steps x 6] - % * ``forceActuation`` (`array`) = [# of time-steps x 6] - % * ``forceConstraint`` (`array`) = [# of time-steps x 6] - % * ``forceInternalMechanics`` (`array`) = [# of time-steps x 6] - % * ``powerInternalMechanics`` (`array`) = [# of time-steps x 6] + % * ``name`` (`string`) = 'ptoName' PTO name + % * ``time`` (`array`) = [# of time-steps x 1] Simulation output timeseries + % * ``position`` (`array`) = [# of time-steps x 6] 6-DOF position of the follower relative to the base body at the PTO location + % * ``velocity`` (`array`) = [# of time-steps x 6] 6-DOF velocity of the follower relative to the base body at the PTO location + % * ``accleration`` (`array`) = [# of time-steps x 6] 6-DOF acceleration of the follower relative to the base body at the PTO location + % * ``forceTotal`` (`array`) = [# of time-steps x 6] Total force exerted on the follower by the base body + % * ``forceActuation`` (`array`) = [# of time-steps x 6] External force applied to the PTO joint in the unconstrained DOFs + % * ``forceConstraint`` (`array`) = [# of time-steps x 6] Force exerted on the follower by the base body that is required to maintain zero motion in the constrained DOFs + % * ``forceInternalMechanics`` (`array`) = [# of time-steps x 6] Sum of the spring and damping forces + % * ``powerInternalMechanics`` (`array`) = [# of time-steps x 6] Sum of the power dissipated by the damper and absorbed by the spring % %.. autoattribute:: objects.responseClass.constraints % % , it includes: % - % * ``name`` (`string`) = 'coonstraintName' - % * ``time`` (`array`) = [# of time-steps x 1] - % * ``position`` (`array`) = [# of time-steps x 6] - % * ``velocity`` (`array`) = [# of time-steps x 6] - % * ``accleration`` (`array`) = [# of time-steps x 6] - % * ``forceConstraint`` (`array`) = [# of time-steps x 6] + % * ``name`` (`string`) = 'coonstraintName' Constraint name + % * ``time`` (`array`) = [# of time-steps x 1] Simulation output timeseries + % * ``position`` (`array`) = [# of time-steps x 6] 6-DOF position of the follower relative to the base body at the constraint location + % * ``velocity`` (`array`) = [# of time-steps x 6] 6-DOF velocity of the follower relative to the base body at the constraint location + % * ``accleration`` (`array`) = [# of time-steps x 6] 6-DOF acceleration of the follower relative to the base body at the constraint location + % * ``forceConstraint`` (`array`) = [# of time-steps x 6] Force exerted on the follower by the base body that is required to maintain zero motion in the constrained DOFs % %.. autoattribute:: objects.responseClass.mooring % % , it includes: % - % * ``position`` (`array`) = [# of time-steps x 6] - % * ``velocity`` (`array`) = [# of time-steps x 6] - % * ``forceMooring`` (`array`) = [# of time-steps x 6] + % * ``position`` (`array`) = [# of time-steps x 6] 6-DOF position of the follower body at the mooring location + % * ``velocity`` (`array`) = [# of time-steps x 6] 6-DOF velocity of the follower body at the mooring location + % * ``forceMooring`` (`array`) = [# of time-steps x 6] Total force exerted on the follower body at the mooring location % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - + properties (SetAccess = 'public', GetAccess = 'public') wave = struct() % This property generates the ``wave`` structure for each instance of the ``waveClass`` diff --git a/source/objects/simulationClass.m b/source/objects/simulationClass.m index d7dac167d..70a169a86 100755 --- a/source/objects/simulationClass.m +++ b/source/objects/simulationClass.m @@ -42,7 +42,7 @@ rho = 1000 % (`float`) Density of water. Default = ``1000`` kg/m^3 g = 9.81 % (`float`) Acceleration due to gravity. Default = ``9.81`` m/s yawNonLin = 0 % (`integer`) Option for nonlinear yaw calculation linear->0, nonlinear->1 for nonlinear. Default = ``0`` - yawThresh = 1 % (`float`) Yaw position threshold (in degrees) above which excitation coefficients will be interpolated in non-linear yaw. Default = ``1`` dg + yawThresh = 1 % (`float`) Yaw position threshold (in degrees) above which excitation coefficients will be interpolated in nonlinear yaw. Default = ``1`` dg b2b = 0 % (`integer`) Option for body2body interactions: off->0, on->1. Default = ``0`` paraview = 0 % (`integer`) Option for writing vtp files for paraview visualization, off->0, on->1. Default = ``0`` StartTimeParaview = 0; % (`float`) Start time for the vtk file of Paraview. Default = ``0`` diff --git a/source/objects/waveClass.m b/source/objects/waveClass.m index 5f12aeb76..4b3aa09e2 100755 --- a/source/objects/waveClass.m +++ b/source/objects/waveClass.m @@ -377,8 +377,10 @@ function checkinputs(obj) % % Y : matrix % (m x n) matrix of Y coordinates at which to calculate the wave elevation + % % TimeBodyParav : Time vector starting from zero specified for % paraview video files. + % % it : time step iteration, % % g : gravitational acceleration constant from simulationClass